Go to the first, previous, next, last section, table of contents.


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.

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.

9.2 Coq-specific variables

The variable

  coq-version-is-V7

is used to force version of Coq, if it is t, then Coq is considered in version 7, if it is nil, then Coq is considered in an old version (V6). You should not have to set this variable, since ProofGeneral sets it by doing the shell command:

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

If you have problems with different versions of Coq, you can set this variable in your config file (before ProofGeneral is loaded).

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.

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: do "Undo 1." when in proof mode, and "Back 1." when in toplevel mode.

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 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" "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 4.7 Escaping script management) or C-c C-v to re-issue an erroneously back-tracked tactic without recording it in the script.


Go to the first, previous, next, last section, table of contents.