2016-08-25 04:38:03 +00:00
#+TITLE : Coq layer
2019-05-07 08:21:07 +00:00
#+TAGS : dsl|layer|programming
2019-05-05 17:26:40 +00:00
2016-08-25 04:38:03 +00:00
[[file:img/coq.png ]]
2019-05-07 20:05:06 +00:00
* Table of Contents :TOC_5_gh:noexport:
2017-05-22 14:16:12 +00:00
- [[#description ][Description ]]
2018-02-01 16:20:53 +00:00
- [[#features ][Features: ]]
2017-05-22 14:16:12 +00:00
- [[#install ][Install ]]
- [[#layer ][Layer ]]
- [[#coq ][Coq ]]
2018-02-01 16:20:53 +00:00
- [[#troubleshooting ][Troubleshooting ]]
- [[#there-are-empty-square-boxes-in-place-of-math-operators ][There are empty square boxes in place of math operators ]]
2017-05-22 14:16:12 +00:00
- [[#key-bindings ][Key bindings ]]
- [[#laying-out-windows ][Laying out windows ]]
- [[#managing-prover-process ][Managing prover process ]]
2018-08-09 18:06:46 +00:00
- [[#getting-documentation ][Getting documentation ]]
2017-05-22 14:16:12 +00:00
- [[#prover-queries ][Prover queries ]]
- [[#moving-the-point ][Moving the point ]]
- [[#inserting ][Inserting ]]
2020-02-22 10:39:46 +00:00
- [[#options ][Options ]]
2016-08-25 04:38:03 +00:00
* Description
2018-02-01 16:20:53 +00:00
This layer adds support for the [[https://coq.inria.fr/ ][Coq ]] proof assistant (adapted from [[https://github.com/tchajed/spacemacs-coq ][spacemacs-coq ]]) to Spacemacs.
** Features:
- Syntax highlighting
- Syntax-checking
- Auto-completion
2019-06-01 17:13:30 +00:00
- Debugging of mathematical proofs from within Emacs using a special proof layout
2018-02-01 16:20:53 +00:00
- Replacement of certain constants with the correct mathematical signs
- Inserting of certain preconfigured proof elements
2016-08-25 04:38:03 +00:00
* 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
2019-10-13 05:27:17 +00:00
Official installers for macOS and Windows are available from:
2016-08-25 04:38:03 +00:00
[[https://coq.inria.fr/download ]].
Linux users can build from source or consult with their own package managers.
2018-02-01 16:20:53 +00:00
* 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= .
#+BEGIN_SRC emacs-lisp
2018-09-19 03:54:47 +00:00
(with-eval-after-load 'company-coq
(add-to-list 'company-coq-disabled-features 'prettify-symbols))
2018-02-01 16:20:53 +00:00
#+END_SRC
2016-08-25 04:38:03 +00:00
* Key bindings
** Laying out windows
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2016-08-25 04:38:03 +00:00
|-------------+-----------------------|
2017-02-13 03:08:36 +00:00
| ~SPC m l c~ | Clear response buffer |
| ~SPC m l l~ | Re-layout windows |
| ~SPC m l p~ | Show current proof |
2016-08-25 04:38:03 +00:00
** Managing prover process
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2016-08-25 04:38:03 +00:00
|-------------+-----------------------------------------------------------------|
2017-02-13 03:08:36 +00:00
| ~SPC m p i~ | Interrupt prover |
| ~SPC m p p~ | Process buffer - processes and moves point to end of buffer |
| ~SPC m p q~ | Quit prover |
| ~SPC m p r~ | Retract buffer - rewinds and moves point to beginning of buffer |
2016-08-25 04:38:03 +00:00
2018-08-09 18:06:46 +00:00
** Getting documentation
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-08-17 16:01:22 +00:00
|-------------+-------------------------------------------------------------|
| ~SPC m h h~ | Show documentation for whatever is below the cursor |
| ~SPC m h e~ | Show documentation for the error in the `*response*` buffer |
| ~SPC m h E~ | Browse all available documentation for errors |
2018-08-09 18:06:46 +00:00
2016-08-25 04:38:03 +00:00
** Prover queries
2019-05-26 20:58:52 +00:00
The mnemonic for =a= is "ask".
2016-08-25 04:38:03 +00:00
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2017-02-13 03:08:36 +00:00
|---------------+---------------------------------------------|
| ~SPC m a a~ | Print |
| ~SPC m a A~ | Print (showing all) |
| ~SPC m a b~ | About |
| ~SPC m a B~ | About (showing all) |
| ~SPC m a c~ | Check |
| ~SPC m a C~ | Check (showing all) |
2019-05-26 20:58:52 +00:00
| ~SPC m a f~ | Search (mnemonic: "find theorems") |
2017-02-13 03:08:36 +00:00
| ~SPC m a i b~ | About (showing implicits) |
| ~SPC m a i c~ | Check (showing implicits) |
| ~SPC m a i i~ | Print (showing implicits) |
| ~SPC m a o~ | Show an outline of the current proof script |
2016-08-25 04:38:03 +00:00
** Moving the point
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2016-08-25 04:38:03 +00:00
|-------------+---------------------------------|
2017-02-13 03:08:36 +00:00
| ~SPC m g e~ | Go to end of command at point |
| ~SPC m g g~ | Go to definition at point |
| ~SPC m g l~ | Go to last processed command |
| ~SPC m g s~ | Go to start of command at point |
2016-08-25 04:38:03 +00:00
** Inserting
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2017-02-13 03:08:36 +00:00
|-----------------+-----------------------------------------------------------------|
| ~SPC m M-RET~ | Insert regular match branch |
| ~SPC m M-S-RET~ | Insert =match goal with= branch |
2018-08-03 00:24:54 +00:00
| ~SPC m i c~ | Insert a vernacular command |
2017-02-13 03:08:36 +00:00
| ~SPC m i e~ | Insert =End <section-name>= |
2018-08-03 00:24:54 +00:00
| ~SPC m i i~ | Insert =intros= with default variable names |
2017-02-13 03:08:36 +00:00
| ~SPC m i l~ | Extract lemma from current goal - exit with ~C-RET~ (not ~C-j~) |
| ~SPC m i m~ | Insert =match= on a type |
2018-08-03 00:24:54 +00:00
| ~SPC m i r~ | Insert a =Require= statement |
| ~SPC m i s~ | Insert a =Section= or =Module= |
| ~SPC m i t~ | Insert a tactic |
| ~SPC m i T~ | Insert a tactical |
2016-08-25 04:38:03 +00:00
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
2018-10-23 14:18:21 +00:00
available =company-coq= key bindings can be accessed at any time using =SPC SPC
2016-08-25 04:38:03 +00:00
company-coq-tutorial=.
2020-02-11 20:46:39 +00:00
** Options
2020-02-22 10:39:46 +00:00
| Key binding | Description |
|-------------+-----------------------------|
| ~SPC m T e~ | Toggle electric terminator. |