Alectryon supports literate programs and documents (combinations of code and prose) written in Coq and reStructuredText. Here is an example, written in reST. It can be converted to Coq, HTML, or LaTeX using the following commands:
alectryon literate_reST.rst # reST+Coq → HTML; produces ‘literate_reST.html’ $ DOCUTILSCONFIG=literate.docutils.conf alectryon \ literate_reST.rst --backend latex # reST+Coq → LaTeX; produces ‘literate_reST.tex’ alectryon literate_reST.rst --backend coq # reST+Coq → Coq; produces ‘literate_reST.v’ $ cd ..; python -m alectryon.literate \ recipes/literate_reST.rst > recipes/literate_reST.min.v # Minimal reST → Coq; produces ‘literate_reST.min.v’ $ cd ..; python -m alectryon.literate --rst2coq - \ < recipes/literate_reST.rst > recipes/literate_reST.min.stdin.v # Minimal reST → Coq; produces ‘literate_reST.min.stdin.v’
Coq fragments are introduced with .. coq:::
forall y x : nat, S x <= y -> x <= yy: nat
IHy: forall x : nat, S x <= y -> x <= y
H: S y <= S yy <= S yy: nat
IHy: forall x : nat, S x <= y -> x <= y
x: nat
H: S x <= S y
H1: S x <= yx <= S yQed.forall x y z : nat, x <= y <= z -> x <= z
They can be nested nested into other reST directives, such as tables:
Coq command | Description |
---|---|
|
Move the variables x and y into the context. |
|
Perform induction on y , generalizing x . |
|
Move conjunction into the context, splitting it into Hl and Hr . |
|
Solve base case; inversion changes x <= 0 into x = 0 . |
|
Solve inductive case using the le_l lemma. |