Skip to content

Latest commit

 

History

History
127 lines (105 loc) · 5.72 KB

README.org

File metadata and controls

127 lines (105 loc) · 5.72 KB

Coq layer

img/coq.png

Table of Contents

Description

This layer adds support for the Coq proof assistant (adapted from spacemacs-coq) to Spacemacs.

Features:

  • Syntax highlighting
  • Syntax-checking
  • Auto-completion
  • Debugging of mathematical proofs from within emacs using a special proof layout
  • Replacement of certain constants with the correct mathematical signs
  • Inserting of certain preconfigured proof elements

Install

Layer

To use this configuration layer, add it to your ~/.spacemacs. You will need to add coq to the existing dotspacemacs-configuration-layers list in this file.

Coq

Official installers for MacOS and Windows are available from: https://coq.inria.fr/download.

Linux users can build from source or consult with their own package managers.

Troubleshooting

There are empty square boxes in place of math operators

Math symbols present in your buffer (e.g. forall exists) will attempt to be prettified, if you are seeing empty square boxes this means an appropriate math symbol cannot be found in your font. You can either install a appropriate math font, or disable the feature by adding the following snippet to the your dotspacemacs/user-config.

(with-eval-after-load 'company-coq
  (add-to-list 'company-coq-disabled-features 'prettify-symbols))

Key bindings

Laying out windows

Key bindingDescription
SPC m l cClear response buffer
SPC m l lRe-layout windows
SPC m l pShow current proof

Managing prover process

Key bindingDescription
SPC m p iInterrupt prover
SPC m p pProcess buffer - processes and moves point to end of buffer
SPC m p qQuit prover
SPC m p rRetract buffer - rewinds and moves point to beginning of buffer

Getting documentation

Key bindingDescription
SPC m h hShow documentation for whatever is below the cursor
SPC m h eShow documentation for the error in the `*response*` buffer
SPC m h EBrowse all available documentation for errors

Prover queries

The mnemonic for a is “ask”.

Key bindingDescription
SPC m a aPrint
SPC m a APrint (showing all)
SPC m a bAbout
SPC m a BAbout (showing all)
SPC m a cCheck
SPC m a CCheck (showing all)
SPC m a fSearch (mnemonic: “find theorems”)
SPC m a i bAbout (showing implicits)
SPC m a i cCheck (showing implicits)
SPC m a i iPrint (showing implicits)
SPC m a oShow an outline of the current proof script

Moving the point

Key bindingDescription
SPC m g eGo to end of command at point
SPC m g gGo to definition at point
SPC m g lGo to last processed command
SPC m g sGo to start of command at point

Inserting

Key bindingDescription
SPC m M-RETInsert regular match branch
SPC m M-S-RETInsert match goal with branch
SPC m i cInsert a vernacular command
SPC m i eInsert End <section-name>
SPC m i iInsert intros with default variable names
SPC m i lExtract lemma from current goal - exit with C-RET (not C-j)
SPC m i mInsert match on a type
SPC m i rInsert a Require statement
SPC m i sInsert a Section or Module
SPC m i tInsert a tactic
SPC m i TInsert a tactical

Note the last two are regular company-coq bindings, left alone since they are most useful in insert mode. The full company-coq tutorial showcasing all available company-coq key bindings can be accessed at any time using SPC SPC company-coq-tutorial.