Lean-native GwernPort

The reusable Verso authoring plugin and typed site architecture.

Alok Singh·509 words

This page is the production canary for GwernPort's reusable Verso plugin. It is authored as a typed Lean value, compiled with the same build that imports the older Markdown corpus, and rendered with the site's real component registry.

The architectural rule is simple: structure belongs in Lean. A native Lean parser turns the existing Markdown corpus into typed document values, then renders them through Verso's HTML representation.Ordinary text and attributes are escaped. Authored raw HTML remains an explicit trusted-source node so the old documents retain their embedded material.

The project is useful both as a website and as a domain-matched data point for (Gwern Branwen, 2025). The authoring layer builds on (Lean FRO) instead of inventing a parallel document engine.

See the self-documenting design page for the user-facing feature inventory and implementation history.

Mathematics is typeset when this page is built: x2+y2=z2x^2 + y^2 = z^2 reaches your browser as MathML and needs no script.

Displayed equations have a Copy LaTeX control. It preserves the notation you wrote, including line breaks in a longer derivation:

∑i=07i2=140\sum_{i=0}^{7} i^2 = 140

Notes are part of the document1, so they can move between the margin and the end of the page without changing their links.

Writing with executable examples

The expression and result below come from one Lean term. Change the expression in the editor, rebuild, and the published result changes with it. An ill-typed expression stops the build. There is no browser evaluator and no separately maintained answer to drift out of date.

Evaluated by Lean
((List.range 8).map (fun n => n * n))
Result
[0, 1, 4, 9, 16, 25, 36, 49]

This checks and evaluates the example; a general mathematical claim still needs its own theorem. The same writing environment supports citations, margin notes, figures, and collapsible explanations. Standard footnote syntax works alongside those components1.

Code you can inspect

These commands are written directly inside this Verso essay. Lean checks them when the page compiles. Hover over a name to inspect its inferred type; select the tactic to reveal its proof state. The example context persists between code blocks, just as the explanation develops between paragraphs.

Checked Lean example
def twice (n : Nat) : Nat := n + n

The function computes a value. The next block proves a statement about every natural number, using the definition from the preceding block.

Checked Lean example
theorem twice_eq_add (n : Nat) : twice n = n + n := n:Nat⊢ twice n = n + n All goals completed! 🐙

This code presentation uses Verso's compiler information. The separate theorem cards in the concurrency essay also expose their axiom inventory and reject unfinished proofs.

How the old posts are published

The production path parses and renders the Jekyll-era posts in Lean. The same source keeps its adjacent Markdown download. An independent corpus comparison checks prose, code, math, destinations, and fragment identifiers against the earlier rendering. Pandoc remains available as an optional comparison tool.

What Lean already owns

Lean owns discovery, front matter, Markdown conversion, link classification, aliases, backlinks, similar-page analysis, feeds, search data, the site shell, and final artifact validation. This lets the corpus migrate incrementally instead of freezing the site during a rewrite.

Alok Singh

Alok Singh, the site's author. The same typed asset description appears on the front page with intrinsic dimensions and eager loading.

References

  1. Gwern Branwen. Lean software scaling 2025.
  2. Lean FRO. Verso: a document system for Lean
  1. One named note is rendered once, even when it has several references. Each occurrence has its own return link. Lean allocates the identifiers before writing HTML; the browser measures where the existing note fits.

    ↩︎↩︎2