[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9. Coq Proof General

Coq Proof General is an instantiation of Proof General for the Coq proof assistant. It supports most of the generic features of Proof General, but does not have integrated file management or proof-by-pointing yet.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.1 Coq-specific commands

Coq Proof General supplies the following key-bindings:

C-c C-a C-i

Inserts "Intros "

C-c C-a C-a

Inserts "Apply "

C-c C-a C-s

Inserts "Section "

C-c C-a C-e

Inserts "End <section-name>." (this should work well with nested sections).

C-c C-a C-o

Prompts for a SearchIsos argument.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.2 Coq-specific variables

The variable

 
  coq-version-is-Vx

(where x is 8-0 or 8-1) is used to force version of Coq, if it is t, then Coq is considered in version x. ProofGeneral sets it automatically by doing the following shell command:

 
  (concat coq-prog-name "-v")

So you should not have to set this variable unless you have problems with different versions of Coq, you can set to t the variable corresponding to the version you are using in your config file (before ProofGeneral is loaded) and ProofGeneral won't override it.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.3 Editing multiple proofs

Coq allows the user to enter top-level commands while editing a proof script. For example, if the user realizes that the current proof will fail without an additional axiom, he or she can add that axiom to the system while in the middle of the proof. Similarly, the user can nest lemmas, beginning a new lemma while in the middle of an earlier one, and as the lemmas are proved or their proofs aborted they are popped off a stack.

Coq Proof General supports this feature of Coq. Top-level commands entered while in a proof are well backtracked. If new lemmas are started, Coq Proof General lets the user work on the proof of the new lemma, and when the lemma is finished it falls back to the previous one. This is supported to any nesting depth that Coq allows.

Warning! Using coq commands for navigating inside the different proofs (Resume and especially Suspend) are not supported, backtracking will break syncronization.

Special note: The old feature that moved nested proofs outside the current proof is disabled.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.4 User-loaded tactics

Another feature that Coq allows is the extension of the grammar of the proof assistant by new tactic commands. This feature interacts with the proof script management of Proof General, because Proof General needs to know when a tactic is called that alters the proof state. When the user tries to retract across an extended tactic in a script, the algorithm for calculating how far to undo has a default behavior that is not always accurate in proof mode: do "Undo".

Coq Proof General does not currently support dynamic tactic extension in Coq: this is desirable but requires assistance from the Coq core. Instead we provide a way to add tactic and command names in the `.emacs' file. Four Configurable variables allows to register personal new tactics and commands into four categories:

We give an example of existing commands that fit each category.

This variables are regexp string lists. See their documentations in emacs (C-h v coq-user...) for details on how to set them in your `.emacs' file.

Here is a simple example:

 
(setq coq-user-state-changing-commands 
      '("MyHint" "MyRequire"))
(setq coq-user-state-preserving-commands 
      '("Show\\s-+Mydata"))

The regexp character sequence \\s-+ means "one or more whitespaces". See the Emacs documentation of regexp-quote for the syntax and semantics. WARNING: you need to restart Emacs to make the changes to these variables effective.

In case of losing synchronization, the user can use C-c C-z to move the locked region to the proper position, (proof-frob-locked-end, see section Escaping script management) or C-c C-v to re-issue an erroneously back-tracked tactic without recording it in the script.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.5 Holes feature

Holes are an experimental feature for complex expression editing. It is inspired from other tools, like Pcoq (http://www-sop.inria.fr/lemme/pcoq/index.html). The principle is simple, holes are pieces of text that can be "filled" by different means. The new coq command insertion menu system makes use of the holes system. Almost all holes operations are available in the Coq/holes menu.

Note: Holes make use of the Emacs abbreviation mechanism, it will work without problem if you don't have an abbrev table defined for Coq in your config files (C-h v abbrev-file-name to see the name of the abbreviation file). If you already have such a table it won't be automatically overwritten (so that you keep your own abbreviations). But you must read the abbrev file given in PG/Coq sources to be able to use the command insertion menus. You can do the following to merge your abbreviations with ProofGeneral's abbreviations: M-x read-abbrev-file, then select the file named coq-abbrev.el in the ProofGeneral/coq directory. At Emacs exit you will be asked if you want to save abbrevs; answer yes.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by David Aspinall on November, 7 2006 using texi2html 1.76.