Alectryon supports literate programs and documents (combinations of code and prose) written in Lean4 and reStructuredText. Here is an example written in Lean4. It can be converted to reST, HTML, or LaTeX using the following commands:
alectryon literate_lean4.lean
# Lean4+reST → HTML; produces ‘literate_lean4.html’
alectryon literate_lean4.lean --backend latex \
--latex-dialect lualatex \
-o literate_lean4.lua.tex
# Lean4+reST → LaTeX; produces ‘literate_lean4.lua.tex’
alectryon literate_lean4.lean --backend rst
# Lean4+reST → reST; produces ‘literate_lean4.lean.rst’
Alectryon captures the results of #check, #eval, and the like:
def x : Nat := 55 + x
By default, these results are folded and are displayed upon hovering or clicking. We can unfold them by default using annotations or directives:
Nat
Bool1 + 1
Other flags can be used to control display, like .no-in:
Iff
Alectryon also captures goals and hypotheses as proofs progress:
theorem test (p q : Prop) (hp : p) (hq : q): p ∧ q ↔ q ∧ p :=p, q: Prop
hp: p
hq: qp ∧ q ↔ q ∧ pp, q: Prop
hp: p
hq: q
mpp ∧ q → q ∧ pp, q: Prop
hp: p
hq: qq ∧ p → p ∧ qp, q: Prop
hp: p
hq: q
mpp ∧ q → q ∧ pp, q: Prop
hp: p
hq: q
h: p ∧ q
mpq ∧ pp, q: Prop
hp: p
hq: q
h: p ∧ q
mp.leftqp, q: Prop
hp: p
hq: q
h: p ∧ qpp, q: Prop
hp: p
hq: q
h: p ∧ q
mp.leftqGoals accomplished! 🐙p, q: Prop
hp: p
hq: q
h: p ∧ q
mp.rightpGoals accomplished! 🐙p, q: Prop
hp: p
hq: q
mprq ∧ p → p ∧ qp, q: Prop
hp: p
hq: q
h: q ∧ p
mprp ∧ qp, q: Prop
hp: p
hq: q
h: q ∧ p
mpr.leftpp, q: Prop
hp: p
hq: q
h: q ∧ pqp, q: Prop
hp: p
hq: q
h: q ∧ p
mpr.leftpGoals accomplished! 🐙p, q: Prop
hp: p
hq: q
h: q ∧ p
mpr.rightqGoals accomplished! 🐙