Design of This Website
How this site works: native Lean publishing, checked Verso authoring, and Gwern-inspired reading.
This site is built with Lean 4 and Verso. It brings gwern.net’s reading ergonomics to my long-running blog: several hundred Markdown manuscripts, original illustrations, and retained talks. New essays can mix prose, executable examples, and proofs in one Lean file. Some of the code you use while reading is also Lean, compiled to WebAssembly. The generator is called GwernPort; its source is not public yet.
Why Lean
Two reasons. First, I like reading gwern.net and wanted its reading ergonomics — dense typography, tables of contents, sidenotes, hover popups — for my own writing. Second, and more seriously: a static site generator is a real program with parsers, graph algorithms, and HTML transformations, which makes it useful corpus data for the Lean software scaling laws question. A domain-matched pair — the same problem solved in Haskell (Hakyll) and Lean — is exactly the kind of controlled comparison that proposal calls for. So a standing rule of this codebase is that build-side logic lives in typed Lean. The browser supplies events and measurements; small compiled Lean functions can decide what those events mean.
The pipeline
Lean discovers the Markdown sources, parses Jekyll front matter, and
normalizes the corpus’s conventions: inline \(x\) math retains its TeX,
Liquid site.url-style variables resolve against _config.yml, and leading
title headings are deduplicated. A native Lean parser turns Markdown into a
typed document tree. Verso's HTML representation renders that tree, escaping
ordinary text and keeping authored HTML explicit. Pandoc is available as a
comparison oracle; production generation does not run it.
New essays can be written directly in Verso, with compiler-checked references and executable Lean examples. The authoring page shows an expression whose displayed source and evaluated result come from one Lean term.
The converted fragments then go through Lean analysis passes:
a table of contents is extracted from the rendered section structure and floated at the top-left of long pages;
an internal link graph is folded out of every page’s anchors, and each page gets a Backlinks section listing its referrers;
Jekyll’s old date-based permalinks are mapped onto canonical URLs, so decade-old cross-references still resolve;
every link is classified (Wikipedia, arXiv, GitHub, PDF, external …) and stamped with an icon glyph and a tooltip at build time;
word counts and reading times are computed for the metadata line under each title;
a search index, an Atom feed, and a sitemap are emitted as data. Search includes the published bodies of the original manuscripts, the native Verso essays, and the retained HTML talks. Lean extracts and deduplicates the text; the browser matches the reader's current query. Scripts and source-only drafts are excluded.
The single HTML rewriting engine behind several of these passes parses start tags into typed records and applies composable transformations in one scan — the same machinery serves alias resolution, base-path prefixing, icon attribution, and lazy image loading.
The build reads original image headers to reserve their space before they download. JPEG orientation matters: a photograph stored sideways needs its displayed width and height exchanged. SVG points and centimeters need an explicit conversion; a viewBox alone does not specify a pixel size. Lean supplies dimensions where they are known and preserves the original files. This keeps a late-loading illustration from displacing the paragraph you are reading. Unsupported sizes retain their authored behavior.
Lean in the browser
The two-thread experiment is one example. Choose which thread moves next and a compiled Lean function computes the transition. The obvious lock admits the schedule A, B, A, B and lets both threads in; Peterson's algorithm has a Lean proof covering every finite schedule. The diagram, checked model, and scalar implementation are connected by explicit correspondence theorems. A 567-byte WebAssembly module runs the transitions.
The image viewer uses the same compilation route for an everyday reading operation. Open a figure in the derivative essay, enlarge it with the wheel or +, drag to inspect a detail, and press 0 to fit it again. A 360-byte Lean module computes the fitted width and each bounded zoom step. JavaScript passes the measured dimensions, receives an integer, and updates the existing image. Focus, pointer capture, scrolling, and CSS remain browser responsibilities.
For an 800 × 600 image in a 366 × 645 space, the policy returns 366 pixels:
(ImageViewport.fit 800 600 366 645)366That example is evaluated when this page is built. The viewer calls the compiled scalar implementation when you interact with it. Its UInt32 inputs and UInt64 intermediate products match the unbounded Nat policy for every possible input, including zeros and invalid actions. The proof checks that multiplication cannot overflow and that narrowing the result cannot discard bits. Fitted images stay within the natural and available widths; valid zoom stays positive and at most eight times the natural width, with an explicit UInt32 cap.
Inspect the refinement statements and the complete kernel¶
These statements and their axiom inventories come directly from Lean's environment. They are checked when this page compiles.
GwernPort.Browser.ImageRefinement.fit_agrees∀ (w h aw ah : UInt32),
(ImageKernel.fit w h aw ah).toNat =
ImageViewport.fit w.toNat h.toNat aw.toNat ah.toNatAxioms: propext, Classical.choice, Quot.sound
GwernPort.Browser.ImageRefinement.zoom_agrees∀ (current naturalWidth action delta : UInt32),
(ImageKernel.zoom current naturalWidth action delta).toNat =
ImageViewport.zoom current.toNat naturalWidth.toNat action.toNat delta.toNatAxioms: propext, Classical.choice, Quot.sound
The executable module contains just the scalar policy. The proof module is a separate consumer of these definitions, so the browser does not download a theorem prover to zoom an image.
namespace GwernPort.Browser.ImageKernel
set_option compiler.extract_closed false
@[export gwernport_image_abi]
def abiVersion (_ : UInt32) : UInt32 := 1
/-- Scalar realization of ImageViewport.fit. Products use UInt64: even two
maximum UInt32 values multiply to less than 2^64. -/
@[export gwernport_image_fit]
def fit (width height availableWidth availableHeight : UInt32) : UInt32 :=
if width == 0 || height == 0 || availableWidth == 0 || availableHeight == 0 then 0
else
let byHeight := width.toUInt64 * availableHeight.toUInt64 / height.toUInt64
(min width.toUInt64 (min availableWidth.toUInt64 (max 1 byHeight))).toUInt32
/-- Scalar realization of ImageViewport.zoom. The highest intermediate product
is at most UInt32.max * 1400, far below UInt64.max. -/
@[export gwernport_image_zoom]
def zoom (current naturalWidth action delta : UInt32) : UInt32 :=
if current == 0 || naturalWidth == 0 || action > 1 then 0
else
let factor : UInt64 := 1000 + (max 1 (min 400 delta)).toUInt64
let next := if action == 0 then current.toUInt64 * factor / 1000
else current.toUInt64 * 1000 / factor
let upper := min 4294967295 (naturalWidth.toUInt64 * 8)
(min upper (max 1 next)).toUInt32
end GwernPort.Browser.ImageKernel
A source-level proof does not verify a compiler or a browser. The build keeps the generated C, Wasm bytes, source hashes, and disassembly, then independently executes the artifact against the Lean model and a BigInt arithmetic oracle. The browser checks the module's digest and interface before using it. If that enhancement fails, the original images and ordinary reading remain available.
The reading experience
The visual language is deliberately close to gwern.net: a 900px measure of justified, hyphenated Source Serif 4, small-caps titles, dropcaps, first-line paragraph indents, and dotted-rule chrome. Dark mode follows your OS preference, with a three-state override in the toolbar.
The colors are Lean values, and that the text can be read is a theorem. Each text color, in both themes, has a contrast ratio of at least 4.5 to 1 against every background it is set on, which is the level the Web Content Accessibility Guidelines call AA. The build fails if a color is changed to one that does not. When the theorem was first stated it was false: comments in code had a ratio of 2.65 in the light theme. Four colors were darkened or lightened until it held.
GwernPort.Site.Palette.light_legibleGwernPort.Site.Palette.light.legible = trueAxioms: propext
GwernPort.Site.Palette.dark_legibleGwernPort.Site.Palette.dark.legible = trueAxioms: propext
The ratio involves a power of 2.4, which the proof never computes. It carries a table of 256 whole numbers and proves that each one is within a millionth of the true value, using only whole-number arithmetic.
A further theorem connects those whole numbers to the ratio itself. It holds in any ordered number system in which some function has the two properties that define the 2.4th power here: its values are not negative, and their fifth powers are the twelfth powers of the inputs. For any such function, two colors that pass the whole-number test have a contrast ratio of at least 4.5. That the real numbers contain such a function is the one thing left assumed.
Inspect the soundness statement¶
GwernPort.Site.Palette.contrast_sound∀ {R : Type} [inst : Lean.Grind.CommRing R] [inst_1 : LE R] [inst_2 : LT R]
[Std.LawfulOrderLT R] [inst_4 : Std.IsLinearOrder R] [Lean.Grind.OrderedRing R]
{linear : Fin 256 → R},
GwernPort.Site.Palette.IsLinearization linear →
∀ (tenths : Nat) (first second : GwernPort.Site.Palette.Color),
GwernPort.Site.Palette.contrastAtLeast tenths first second = true →
GwernPort.Site.Palette.ContrastAtLeast linear tenths first secondAxioms: propext, Classical.choice, Quot.sound
Footnotes become margin sidenotes on wide screens. Links grow hover popups that render the actual target page — and links inside a popup spawn further popups, up to six deep. Popups can be pinned (click the ○) or dragged by their title bars (dragging pins them). Close the latest preview with Escape; keyboard previews return focus to the link that opened them. Press Alt+↓ on a focused link to inspect it without navigating. On a narrow screen, tapping an annotated link or footnote opens a compact panel; its title opens the destination. Footnote and section links preview just the note or section. Math inside popups is typeset live.
Where a popup goes and how far down a margin note sits are decided in Lean. Each rule is written once. Read one way it is a function on whole numbers, and the two theorems below are about that function. Read another way it is a syntax tree, which is printed as the JavaScript your browser runs. The first theorem says that a popup which can fit in the window is wholly visible, wherever its link is. The second says that margin notes never overlap.
GwernPort.Browser.Layout.popup_within_height∀ (linkTop linkBottom height viewportHeight : Int),
height + 24 ≤ viewportHeight →
have top := Layout.popupTop linkTop linkBottom height viewportHeight;
12 ≤ top ∧ top + height ≤ viewportHeight - 12Axioms: propext, Classical.choice, Quot.sound
GwernPort.Browser.Layout.placeNotes_separated∀ (notes : List Layout.Note) (previousBottom? : Option Int),
Layout.separated previousBottom? notes (Layout.placeNotes previousBottom? notes)Axioms: propext, Quot.sound
Each rule is first translated into a small model of JavaScript, and that the translation keeps the rule's meaning is proved. That the printed text is the JavaScript it names is tested, not proved: the printed functions are run against the Lean ones on about 330,000 inputs each time the tests run.
Press / anywhere to search the full site; results rank title matches over body matches and are navigable from the keyboard.
Displayed equations have a Copy LaTeX button that keeps the original notation. Section links open folded material when necessary, and notes keep their return links as they move between the margin and the end of the page. Reader settings choose the color theme, a narrower distraction-free layout, and whether links open previews.
What is proved, and what is not
This page says several times that something is proved. The table below is the whole list of such statements, together with the statements that are only tested, the things taken on trust, and the questions still open. Lean generates the table from one value and checks it. An entry marked Proved names theorems, and this page does not compile unless each of them exists and rests on nothing beyond Lean's three standard axioms. A proof replaced by a placeholder, or by a computation the kernel did not check, is refused.
Tested means a test suite tried many generated inputs and found no counter-example; the entry names the suite. Assumed entries are what the proofs do not reach: the browser's layout engine, floating-point arithmetic, compilers. Open entries are exact statements that nobody has proved.
| Status | Claim and evidence |
|---|---|
| The image viewer | |
| Proved | The width the viewer fits an image to, computed in the browser with 32-bit and 64-bit machine integers, equals the rule written with unbounded whole numbers, for every possible input including zeros.Theorems: GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | Each zoom step computed with machine integers equals the unbounded rule, for every input including invalid actions.Theorems: GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | A fitted image is never wider than the image itself or than the space available, and is at least one pixel wide when all four measurements are positive.Theorems: GwernPort., GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | A zoomed image is never wider than eight times its natural width. An image whose current and natural widths are positive stays at least one pixel wide under a valid action.Theorems: GwernPort., GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | The size the build reserves for an image has positive width and height, also when the file records a rotation.Theorems: GwernPort., GwernPort.. Axioms: propext. |
| Tested | The WebAssembly module that ships computes what the Lean functions compute.Suite: Test/ImageKernel.lean. Runs the checked-in module in Node against expectations emitted from the Lean model and against a BigInt oracle, and checks its digest. |
| Assumed | The theorems are about Lean source; a browser runs compiled code.Trusted: Lean's compiler to C, the C-to-WebAssembly toolchain that built the module, and the browser's WebAssembly engine. |
| The two-thread experiment | |
| Proved | Peterson's algorithm never lets both threads into the critical section, for every schedule of every length.Theorems: GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | The one-number transition function the browser runs agrees with the model on every schedule, and is therefore safe on every schedule.Theorems: GwernPort., GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | The obvious lock is unsafe: the schedule A, B, A, B puts both threads in the critical section.Theorems: GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | When both threads are contending, which one writes its priority last decides which one waits, and both orders are safe.Theorems: GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | The diagrams on the page are the models: every state has its own node, and following any two arrows in a diagram ends where two steps of the model end.Theorems: GwernPort., GwernPort., GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | A state or thread number that is out of range is answered with a fixed error value, never acted on.Theorems: GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Tested | The WebAssembly module that ships computes the same transitions.Suite: Test/BrowserKernel.lean. Runs the checked-in module in Node against expectations emitted from the Lean model, checks its digest, and checks the model against an independent earlier definition on every state. |
| Colors | |
| Proved | Each of the 256 entries of the luminance table is the whole-number part of the true linearized channel value in millionths. The claim is stated without real numbers: fifth powers of the entries are compared with twelfth powers of the channel.Theorems: GwernPort.. No axioms. |
| Proved | In the light and the dark theme, every text color passes the whole-number contrast test at 4.5 to 1 against every background it is set on, and the focus outline passes at 3 to 1.Theorems: GwernPort., GwernPort.. Axioms: propext. |
| Proved | The whole-number test is sound. In any ordered number system, for any function with the two defining properties of the sRGB transfer function, each table entry brackets the function's value, the luminance bounds hold, and two colors the test accepts have a WCAG contrast ratio of at least the threshold. So in both themes every text color has a ratio of at least 4.5 against its backgrounds.Theorems: GwernPort., GwernPort., GwernPort., GwernPort., GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Assumed | The real numbers, with the real sRGB function, are such a number system and such a function.Trusted: That the real numbers are an ordered field, and that for a nonnegative real x the number x^2.4 is nonnegative and its fifth power is x^12. Nothing else about real powers is used. Also that the formulas in GwernPort/Site/Palette/Contrast.lean are the ones in WCAG 2, which were copied by hand. |
| Tested | WCAG's formula, computed directly, agrees with what is proved.Suite: Test/Properties.lean. Evaluates the standard's formula in binary64 at all 256 channel values, checks it against the description used in the proof and against every table bracket, and computes each text and background ratio directly (smallest: 4.59 light, 4.56 dark). |
| Assumed | The stylesheet sets each color only on the backgrounds the theorem pairs it with.Trusted: The list textPairs in GwernPort/Site/Palette.lean (prose on the page and on panels, code on panels). No rule of the stylesheet is checked against it. |
| Popups | |
| Proved | A popup keeps a 12-pixel margin on both sides of the window, whatever the window's width and wherever its link is, and is never wider than 520 pixels.Theorems: GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | A popup that can fit in the window with both margins is wholly visible, wherever its link is; and its top is never above the top margin, so its title bar can always be reached.Theorems: GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | For a link that is inside the window: when there is room below it, its popup sits exactly 8 pixels below it; when there is room only above, the popup's bottom edge is exactly 8 pixels above it.Theorems: GwernPort., GwernPort.. Axioms: Quot.sound, propext. |
| Proved | A popup that fits below or above its link does not cover the link.Theorems: GwernPort.. Axioms: Quot.sound, propext. |
| Proved | Sideways, a popup follows its link: moving the link right never moves the popup left, and the popup moves no further than the link does.Theorems: GwernPort., GwernPort.. Axioms: Quot.sound, propext. |
| Proved | Vertically a popup does not follow its link monotonically, by design: moving a link down can flip its popup from below to above. Two positions that show it are recorded.Theorems: GwernPort., GwernPort.. No axioms. |
| Assumed | The measurements the rules receive are the real ones, and elements appear where the script puts them.Trusted: The browser's layout engine: getBoundingClientRect, the window's reported size, and CSS positioning. |
| Margin notes | |
| Proved | Margin notes never overlap, keep a 12-pixel gap, and are never above the reference they belong to; every note gets a position.Theorems: GwernPort., GwernPort., GwernPort.. Axioms: Quot.sound, propext. |
| Proved | Among all placements with those properties, the rule's placement puts every note highest.Theorems: GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Assumed | The script places notes as the Lean function placeNotes does.Trusted: The correspondence, by reading, between the nine-line JavaScript loop that walks the notes and placeNotes. Each step of the loop calls the printed rule; the loop itself is hand-written. |
| Page widths | |
| Proved | Every window width is in exactly one of four classes: narrow (up to 700 pixels), stacked (701 to 942), column (943 to 1406) and margin (1407 and above).Theorems: GwernPort., GwernPort., GwernPort., GwernPort., GwernPort., GwernPort.. Axioms: Quot.sound, propext. |
| Proved | The width at which footnotes move into the margin is derived, not chosen: beside a centred 895-pixel text column, with a 36-pixel gap and a 20-pixel edge margin, a margin note is at least 200 pixels wide exactly when the window is at least 1407 pixels wide.Theorems: GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | In a window at least 1407 pixels wide the text column has its full width and its gutters; the widest contents box ends inside the column; a margin note begins 36 pixels right of the column, at least 631 pixels right of the contents box, is between 200 and 320 pixels wide, and ends at least 20 pixels inside the window's right edge.Theorems: GwernPort., GwernPort.. Axioms: Quot.sound, propext. |
| Proved | A window is in the margin class exactly when it is at least 1407 pixels wide, so below that width no note is placed in the margin; and the arithmetic the script runs computes the class.Theorems: GwernPort., GwernPort., GwernPort., GwernPort.. Axioms: Quot.sound, propext. |
| Assumed | The browser lays the columns out as the functions say, and the script and stylesheet act on the class.Trusted: That the stylesheet's rules for the text column, the contents box and the margin note, whose lengths and media queries are printed from the same constants, give the edges the functions compute (the contents box is taken at its greatest width; a scroll bar that narrows the layout is not modelled); that the width a media query compares is the window.innerWidth the script reads; and, by reading, that the script returns before placing a note unless the printed class is the margin class. |
| Settings button | |
| Proved | At every window width at which the settings button is fixed, so that it stays on the screen while the page scrolls, the text column has its full width of 895 pixels and ends at least 12 pixels left of the button; and if footnotes stand in the margin at that width, a margin note ends at or left of the button's left edge. So a fixed button covers neither the text nor a note.Theorems: GwernPort.. Axioms: Quot.sound, propext. |
| Proved | The width from which the button is fixed beside margin notes is derived, not chosen: in a window at least 1407 pixels wide, a margin note ends at or left of a button fixed in the top right corner exactly when the window is at least 1719 pixels wide. The button scrolls with the page, from its place at the top right of the page, at exactly the widths where footnotes stand in the margin and one would reach under a fixed button.Theorems: GwernPort., GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | In a phone-shaped window, from 320 to 760 pixels wide, the settings button stands in the header: inside the window, 12 pixels below the site mark, at least 12 pixels left of the navigation, and ending no lower than the header's least height. The 58 pixels the button reaches from the top of the page, where it scrolls with the page, are no more than the 68 pixels of space above and below the header.Theorems: GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Assumed | The browser puts the button, the header, the text and the notes where these statements say.Trusted: That the stylesheet's rules for the button, printed from the same constants and bounds, hold it as settingsPlacement says at each width; that a button which is not fixed scrolls with the page and so meets only what is beside it at the top; that the page's content, margin notes included, starts below the header's margins; and that a media query compares the window width the functions take. The browser smoke test measures the boxes at a 390-pixel phone and at eight widths from 1407 to 1920 pixels, at every scroll position that brings a note or a line of text to the button; it is a measurement, not a proof. |
| Search ranking | |
| Proved | A page that mentions a query word scores at least 1 for it and is kept; a page that does not scores 0 and is dropped.Theorems: GwernPort., GwernPort.. Axioms: Quot.sound, propext. |
| Proved | A word found in a title always outranks a word found only in an excerpt or a body, and a word in an excerpt outranks one found only in the body.Theorems: GwernPort., GwernPort.. Axioms: Quot.sound, propext. |
| Assumed | The four yes-or-no facts the rule is given are right, and the scores of a query's words are added.Trusted: The hand-written JavaScript that searches the index for each word and sums the printed rule's results. |
| Printed JavaScript | |
| Proved | For each rule, the syntax tree that is printed means the Lean function the theorems are about.Theorems: GwernPort., GwernPort., GwernPort., GwernPort., GwernPort., GwernPort.. Axioms: propext. |
| Proved | Translating a rule into a JavaScript term preserves its meaning: the term denotes the integer the rule evaluates to, for every rule and every input.Theorems: GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | The printed form is unambiguous as a list of tokens: a parser reads any term's tokens back as that term, accepts no other token list, and so two different terms never print the same tokens.Theorems: GwernPort., GwernPort., GwernPort.. Axioms: Quot.sound, propext. |
| Proved | No printed rule reads a variable that is not one of its parameters; every printed name is a plain identifier that JavaScript does not reserve; and no rule lists a parameter twice.Theorems: GwernPort., GwernPort., GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | Given inputs of magnitude at most 2^31, no value computed anywhere inside a printed rule has magnitude above 2^53.Theorems: GwernPort., GwernPort., GwernPort., GwernPort., GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Assumed | A browser's arithmetic gives the integer answer on the printed rules.Trusted: That JavaScript numbers are IEEE 754 binary64, and that binary64 addition, subtraction, comparison, minimum and maximum are exact on integers when the operands and the result have magnitude at most 2^53. Also that a measured length is below 2^31 pixels. |
| Tested | Binary64 arithmetic agrees with integer arithmetic on every printed rule.Suite: Test/Properties.lean. Reads each printed term with Lean's binary64 Float on 20,000 generated inputs within 2^31 and compares with the integer meaning; also confirms that the two differ at 2^60, outside the proved range. |
| Assumed | The text of a term is the JavaScript it names.Trusted: That an engine reads the printed characters as the tokens listed in GwernPort/Browser/JavaScript.lean and evaluates them as Term.denote says; and the hand-written wrapper around each rule (the function header and Math.round on each parameter). |
| Tested | Node, given the printed text, computes what Lean computes.Suite: Test/Layout.lean. Runs every printed function in Node on every tuple from a grid of twenty lengths, 328,820 cases with fractional nudges, and compares each result with the Lean meaning. |
| Open | The printed text, not only the token list, determines the term.Stated as GwernPort.. The token-level statement is proved. The step from characters to tokens needs a verified tokenizer. |
| The assistant's file access | |
| Proved | Every part of every path a tool accepts is one safe path segment by the same test the generator applies to its own output files, and no part is . or .. .Theorems: GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | A path is exactly an editable folder and a Markdown file name, and the file it names is the content folder, then that folder, then that name.Theorems: GwernPort., GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | Reading a path from text and printing it are inverse, so the text an assistant sent names the file the server uses.Theorems: GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Tested | The parser accepts exactly the strings the earlier string validator accepted.Suite: Test/Properties.lean. Compares the two on 6,000 generated path-like strings and 1,000 arbitrary strings; Test/Mcp.lean compares them on 41 hand-written hostile strings. |
| Assumed | A safe two-part name reaches a file inside the content folder.Trusted: That neither editable folder is a symbolic link to somewhere else, and that the operating system resolves the name without reinterpreting it. The theorems are about names, not about the disk. |
| Markdown and HTML | |
| Tested | Text never becomes markup: for a document with no raw HTML, the renderer emits only elements from its own list, emits no unescaped text, and every < in the output opens or closes one of those elements.Suite: Test/Properties.lean. 1,500 generated sources built from Markdown and markup fragments; about half contain no raw HTML and exercise the claim. |
| Tested | The syntax highlighter is lossless: its tokens, and its highlighted lines, join to exactly the source.Suite: Test/Properties.lean. 2,500 generated sources across nine language names. |
| Open | The highlighter is lossless for every input, as a theorem.Stated as GwernPort.. Holds on every generated case. A proof needs the tokenizer rewritten as a list of cut points. |
| Tested | Page and section names are stable: slugify is idempotent, and slugify and headingSlug emit only the characters their use allows and never an empty name.Suite: Test/Properties.lean. 2,500 generated titles and 1,000 arbitrary strings for each function. |
| Proved | A section name is a fixed point of the function that makes section names: for every title, headingSlug applied to its own result returns that result.Theorems: GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | The function the build applies to each HTML page as its last step returns text with no control character that HTML forbids, for every input. That the build applies it to every page is how rewriteHtmlFiles is written, not part of the theorem.Theorems: GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | The site linter resolves every address in every page before a release. For every page and every address, the path it resolves to has no empty, . or .. segment, so however many .. an address contains, looking it up never reads outside the site. That the linter then finds every dead link is tested on a small site with one of each fault, not proved.Theorems: GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Tested | A link to a section contains only unreserved URL characters and well-formed percent escapes.Suite: Test/Properties.lean. 2,500 generated identifiers and 1,000 arbitrary strings. |
| Mathematics | |
| Proved | For every Markdown document and every list of reserved names, the record of formulas the renderer returns counts exactly the formulas the page shows: the formula nodes of the document's blocks and of each footnote that something shown refers to, a figure's caption included. A formula in an image's alternative text, which is plain text, or in a footnote definition the page does not show, is not counted. The formulas it lists as rejected are exactly those the typesetter rejected, in document order, each with the source of a formula of the document, and the typeset ones and the listed ones together are all of them.Theorems: GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Tested | A page's markup holds exactly one formula element for each formula its record counts, so no formula the page is to show is missing from it. A formula in an image's alternative text is read as plain text, and a footnote definition the page does not show is named in a warning.Suite: Test/Math.lean. Compares the two numbers on documents with formulas in headings, emphasis, links, quotations, lists, tables, definitions, captions and footnotes, and on documents with a formula in alternative text, in a footnote nothing refers to, and in a second definition of a footnote. The build makes the same comparison on every imported page and stops on a difference. |
| Proved | Splitting the source of a formula into tokens loses nothing: for every string, the tokens joined give the string, and each token's recorded position is where its characters stand.Theorems: GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | The markup of every typeset formula is a tree in which each MathML element stands under an element that allows it and has the number and kind of children it requires. The claim is about the typed tree: it says nothing of attributes, of text, or of the printer that writes the tree as characters.Theorems: GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Tested | A typeset formula says what its TeX says.Suite: Test/Math.lean. Pins the exact markup of about seventy constructions, among them an argument without braces read as one token; typesets all 700 formulas surveyed from the site; and pins the code point of every entry of the symbol table. Outside the suite, a reviewer compared the visible characters of all 698 distinct formulas of the built site with KaTeX's by program, and 216 of them by eye. |
| Site structure | |
| Tested | The check that runs before any file is written accepts a set of output paths exactly when no path has two owners and no file is also a folder on the way to another path.Suite: Test/Properties.lean. 6,000 generated layouts compared with a description written independently of the code. |
| Tested | The search index is valid JSON that lists each page once with its fields unchanged, whatever characters the fields contain.Suite: Test/Properties.lean. 1,500 generated page lists with quotes, backslashes, control characters and </script>. |
| Tested | A page's backlinks are exactly the other pages with a link that resolves to it.Suite: Test/Properties.lean. 3,000 generated sites with aliases, queries, fragments, self-links and dead links. |
| Tested | A page is never listed as similar to itself, and every similar-pages list is in order, free of repeats and within its length.Suite: Test/Properties.lean. 2,000 generated sets of documents. |
| Proved | In projects data that passes its check, both ends of every relation name a declared project, and no project builds on itself through any chain of the direct relations the page shows.Theorems: GwernPort., GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Proved | The projects page lists every visible project of checked data, and lists none twice.Theorems: GwernPort.. Axioms: Classical.choice, Quot.sound, propext. |
| Tested | The projects page rendered from the data file is the page the Jekyll site served: the same entries, descriptions, links and relations in the same order, and the same data for the map.Suite: Test/Projects.lean. Compares the rendered list and the map's data with what alok.blog served on 2026-11-11, and checks that each kind of fault in the data is reported at its line and column. |
| Foundations | |
| Assumed | A theorem Lean accepts is true.Trusted: Lean 4's kernel, including its built-in arithmetic on large whole numbers, and the axioms propext, Quot.sound and Classical.choice. |
A writing loop in Verso
This page is itself a Verso document. The source, displayed result, theorem statement, and axiom inventory above are drawn from Lean values rather than separate copies maintained by hand. The authoring example also demonstrates checked code blocks with compiler types and tactic proof states.
The local writing command rebuilds after a source change and reloads the preview after a successful build. An unfinished edit can report an error while the previous readable preview remains available. A checked page catalog owns routes, navigation, search, and publication metadata, so adding an essay does not require editing several parallel lists. The older manuscripts retain adjacent Markdown downloads and their original media alongside these native pages.
Privacy and deliberate limits
There are no comments. Analytics is an explicit build policy, not an ambient dependency: offline builds and reusable Verso consumers disable it by default, while a production build may opt in to GA4 with a checked measurement ID. When enabled and not blocked, it configures GA4 to record ordinary pageviews. The site-owned adapter exposes only four named reader-interface events: theme changes, reader-mode toggles, search opens, and popup opens. The configuration disables Google signals and ad-personalization signals. The current site has no spatial runtime, and the adapter accepts no gaze, hand or pose data, room geometry, permission state, frame data, or XR-session events. GA4 remains an external service, and blocking it is supported.
The core document is static HTML. With JavaScript disabled or analytics blocked, the prose, links, table of contents, references, and images remain usable; search, hover popups, and the manual theme override degrade without gating the content. MathJax is the other external script and is loaded only on pages that contain math.
There is no automatic link archiving yet. External previews provide a Wayback link, which is different from maintaining local archival copies. A small hand-written annotation collection accompanies the authoring and Lean scaling references; most local previews render the actual target page.
Colophon
About this site lists what the site is made with, whose design it follows, and the licences of the typefaces.
The site is built locally and published as static files under its own nested
URL, preserving the earlier site around it. The generator does not
bake that host into the content. A checked publication root owns the HTTP(S)
scheme, host, optional port, and deployment base; the same source can be built
at /, below a nested path such as /GwernPort, or for a custom self-hosted
domain. An offline build names only its deployment base and emits no canonical
public host. The source, including the documentation this page distills, is
not public yet.