Every number and status word a reader sees is rendered from data. None is typed by hand.
A public Lean verification repository needs one section a reader can trust:
what is formalized and what is not, under which assumptions, what the
receipts prove, how to reproduce the result, how to cite it, and whom to
credit. lean-pkg page NAME renders that section into the package’s
README.md from data the tool already checks. lean-pkg page NAME --check
fails when the section no longer matches the data. Counts copied by hand into
several files drift apart; a rendered block that is checked in CI cannot.
lean-pkg coverage check my-companion # validate coverage.yaml (below)
lean-pkg page my-companion # print the block
lean-pkg page my-companion --write # replace the marked block in README.md
lean-pkg page my-companion --check # exit 1 when it is missing or stale
lean-pkg page my-companion --site docs --html docs/verification.html # docs pages + one HTML file
What it reads
| Input | Read how | Feeds |
|---|---|---|
coverage.yaml |
committed at HEAD, schema coverage/1 (below) |
the summary sentence, one block per paper result (number, title, the paper’s statement when paper.statement gives it, the hypotheses), Not formalized, the manuscript reference, the compute acknowledgment (for a library: the main results, no manuscript) |
claims.yaml |
committed at HEAD |
the Lean declarations of each row |
| the Lean sources | the claim’s file, or the Challenge module of the comparator configuration that compares it, at the gate-bound commit |
the Lean statement shown beside the paper’s (below) |
| the claims ledger | lean-pkg claims ledger NAME, promote stage |
the word verified, per row and in the capsule |
| receipts | .lean-receipts/*.json committed at HEAD; the registry’s gate.receipt and gate.comparator mark the recorded ones |
What the checks establish, How this was checked (the receipt table, the expected axioms) |
lean-toolchain, lake-manifest.json |
committed at HEAD |
the reproduce section |
CITATION.cff |
committed at HEAD; it needs a title and at least one author |
the citation |
| registry | repo (as an https URL), status, license_spdx (checked against the committed license file), doi |
the clone command, the capsule, the license, the citation DOI when CITATION.cff has none |
Only these receipt fields are copied: the commit, the toolchain, the Mathlib
revision, the sorry count, the axioms, the theorem names, the permitted
axioms and the definition names of each comparator configuration, the date
part of generated_at, the SHA-256 of the committed file, and a job id of
the form slurm-<J>, or gha-<run>-<attempt> when the receipt’s ci block
passes level 1 (a GitHub Actions run names a public run, not a host).
Host names, paths, user names, checker commands and every other job id (a
systemd unit’s or a local run’s, which name a host) are never copied. Every output (the block, the site pages, the HTML file) then
passes through the
public-safety scanner
with the package’s .lean-pkg-private-patterns. A blocking hit in any of them
refuses the render and nothing is written.
Text that comes from data (titles, notes, inputs, the summary, authors) is
written inert: &, < and > become entities, and the Markdown markup
characters are backslash-escaped. A note cannot open a tag, a link or a code
span on GitHub, in MkDocs or in the HTML file.
The sections
The page puts the mathematics first, after the model of Palomar’s entry pages (design): what to compare, then the results, then what the checks establish, and only then the receipts.
| Section | What it says |
|---|---|
| Verification at a glance | one fixed line, How to read this page: Lean has checked every step; it cannot check that a Lean statement says what the paper says, so the reader compares, for each result, the paper’s statement with the Lean statement. Then the summary sentence, the manuscript, the number of results by class and how many the ledger closes. The registry status is not shown: it changes on promote, while the page is committed at one commit |
| The paper’s results in Lean (Main results for a library) | one block per formalized result, headed by its number and title: whether it is verified; Conclusion (only for a row whose Lean conclusion is weaker than the paper’s or a special case); In the paper (the paper.statement TeX in a latex code block, or a pointer to the paper); In Lean (the declaration, linked at the gate-bound commit, and its statement in a lean code block); Hypotheses (the paper’s own, or the paper’s plus the named inputs); Hypotheses can be met (only for a row that names a witness); Definitions checked by a person (definition holes and who signed them off); Axioms; Note |
| Not formalized | every outside row, or the nothing_excluded reason |
| What the checks establish | in plain words: every proof is checked by Lean (no sorry, which axioms); the statements shown are the ones proved (the comparator); and what no tool checks. The full account: Trust model |
| How this was checked | the claims ledger with its digest; the build check and the statement comparison, with their commits; Receipts: one row per receipt committed under .lean-receipts/ (path, check, commit, date, Slurm job, SHA-256); Reproduce: toolchain, Mathlib revision, the commands, the expected #print axioms result |
| Citation | authors, title, version and DOI from CITATION.cff, and the manuscript |
| License | license_spdx and the license file |
| Acknowledgments | the lean-pkg credit, always; a site’s sentence (such as a cluster’s) only with evidence |
The page never uses lean-pkg’s internal words (tiers, evidence-only descendants, rule numbers, stage names); a test holds every output to that.
The Lean statement
When the recorded comparator receipt compares a claim (its theorem name is the
claim’s decl, or <Prefix>.<decl>), the page shows the statement from that
configuration’s Challenge module: the statement the proof was checked against.
Otherwise it shows the declaration in the claim’s own file. Both are read at
the gate-bound commit, from the declaration keyword to the := that starts the
proof, comments kept. That := is the first one outside brackets that no
let, letI, have or haveI of the statement is waiting for: each of them
owns one := (its value), so theorem t : let n : Nat := 1; n = 1 := rfl is
shown whole. The text is copied, not parsed: when the file is not committed
there, the name is not declared exactly once, the statement has no such :=
(an equation-compiler form), holds a form the scanner does not follow (a by,
calc or do outside brackets before the proof) or is longer than 40 lines,
the page shows the linked name and says the statement could not be read,
rather than a guess or a prefix. Like every other output, the copied text passes the
public-safety scan.
An umbrella Challenge module, one that holds only import lines, declares
none of the compared theorems itself. The page then follows the Challenge’s
imports through the package’s own files: each module name maps to its file by
Lake’s convention (A.B.C is A/B/C.lean, a «quoted» component is one path
component), only files committed at the gate-bound commit are read, a module
outside the package (Mathlib, say) is not followed, each file is read once (an
import cycle ends there), and the walk stops at 32 import levels or 1000 files.
A module name that could leave the package directory (a .., . or empty
component, a path separator) is never read. When exactly one file of that
closure declares the theorem’s fully qualified name (namespace plus name), the
statement is copied from that file and linked at the line of its keyword
(Challenge/Reference/Airy/Core.lean#L1147). When the name is declared in no
file or in more than one, or the walk was cut short or met a module name it
refused, the page keeps the fallback above and links the Challenge module.
Comments inside a statement are kept verbatim, as Lean has them in the source:
a binder such as (x : ℝ /- [definition] -/ ) is shown with its comment. The
end of the statement and its brackets are found with every comment (/- ... -/,
nested as Lean nests them, and -- to the end of the line) and every string
literal blanked out, so a :=, a bracket or a -/ inside a comment, a doc
comment or a string neither ends the statement nor unbalances it. A block
comment that is never closed leaves no := to find, and the page falls back.
The paper’s statement
paper.statement (and statement on a library row) is optional TeX, up to
2000 characters, several lines allowed. The page shows it as written in a
latex code block: it is not rendered, so a reader sees exactly the
transcription the authors made, and no data can inject Markdown or HTML. It is
the authors’ transcription of the manuscript; nothing checks it against the
paper.
The status words are tied to the ledger. A row says verified only when
lean-pkg claims ledger NAME (promote stage, so the comparator tier as well
as the gate) closes every claim the row names. Otherwise the row shows the
ledger’s own status (open, blocked, unknown, out-of-scope). Nothing in
the block calls the paper verified.
Such a row reads “Not yet verified. lean-pkg’s record of the checks says: open. Until it says verified, read the Lean statement below as work in progress.”, with two exceptions, both for a proof that is built where only the statement comparison is missing.
When every claim of the row that is not verified is open for the single
ledger reason no-comparator-config (the gate and comparator receipts pass
at the gate-bound commit, but no comparator configuration names the
declaration), the statement comparison a reusable claim needs is missing, so
the row reads:
Built, not compared. Lean accepts the proof (the build passed), but its statement has not yet been compared by a second checker, which this result requires.
When at least one of those claims is instead an internal theorem or lemma
that is out-of-scope only because no passing comparator configuration
judged it (no diagnostic at all: the gate receipt passes at the gate-bound
commit and the declaration is there), and the others are of either kind, the
row reads:
Built, not compared. Lean accepts the proof (the build passed), but its statement has not been compared by a second checker, which lean-pkg needs before it counts the result as verified.
Both are wording only: the ledger status stays open or out-of-scope, the
row is not counted as verified, and the Ledger column of coverage.md still
shows the ledger’s word. A claim open for any other reason (a
comparator-todo entry among them), an internal definition (no comparator
judges a definition), or a claim blocked, unknown or conditional, keeps
the row on “Not yet verified”.
The comparator tier is required only for reusable claims, so a row can be
verified without a statement comparison. A verified row says “(the build,
and the statement comparison)” only when every claim it names was judged by a
passing configuration of the recorded comparator receipt at the gate-bound
commit; otherwise it says “every check that applies to this result passed (the
build; its statement was not compared by a second checker)”. When some verified
results were not compared, the summary line adds how many were (“for 8 of them
a second checker also compared the statement”).
A claim with status internal (a step of the formalization, not a result
offered for reuse) is verified only when the statement comparison judged it:
a theorem or lemma that a configuration of a passing comparator receipt,
bound to the gate-bound commit, names by its declaration (the ledger’s rule), with the same gate evidence any other
claim needs. A verified internal claim is therefore always one whose
statement was compared. Otherwise its ledger status is out-of-scope, and a
row naming it is not verified. A result block that names an internal claim
carries an Internal. line, and the Ledger column of coverage.md adds
(internal) to that claim’s status (verified (internal),
out-of-scope (internal)). Internal claims are never required, so they never change the
ledger’s package status or the “required claim(s) verified” count.
A weaker conclusion or a special case
A row’s class names its hypotheses only. When the Lean statement concludes
less than the paper’s result, say so with conclusion and conclusion_scope
(proposal 0010; keys):
- paper: {number: "Proposition 3.2", title: "Linear stability"}
class: same-assumptions
conclusion: weaker # or special-case; absent (or full): the paper's conclusion
conclusion_scope: "the modewise algebraic inequality only; the semigroup and nonlinear conclusions are not formalized"
claims: [demo/modewise-sign]
A verified row then never reads as the bare “Verified.”. Its status line
starts “Verified: a weaker statement.” or “Verified: a special case.”,
and a Conclusion. line follows it, whatever the status: “A weaker
statement than the paper’s: SCOPE” or “A special case of the paper’s result:
SCOPE”. The header adds how many of the verified results do so (“- Verified:
3 of the 3 result(s) in Lean; of the verified, 1 prove(s) a weaker statement
than the paper’s and 1 a special case of it.”), and in coverage.md the
row’s Correspondence cell gains “Weaker conclusion: SCOPE” or “Special case:
SCOPE”. page --json carries verified_conclusions {weaker, special-case}
when some row sets conclusion. A row without the key, or with
conclusion: full, renders exactly as before. The keys are the authors’ description, like
the class and the note: no tool checks a scope against the Lean statement.
Hypotheses that can be met (a witness)
A theorem whose hypotheses can never hold together proves anything. A row
shows that they can be met by naming a witness
(proposal 0011; keys): a claim whose Lean
statement is exactly ∃ over the headline theorem’s parameters, in order, of
the ∧ of all its hypotheses, in order (the probe’s hyp-witness fact,
formats). Name it twice: as witness on the headline claim in
claims.yaml, and as witness on the row.
# claims.yaml
- id: demo/lfpp-converges
decl: Demo.lfpp_converges # ∀ γ h, 0 < γ → γ < 2 → IsGFF h → Converges γ h
witness: demo/lfpp-converges-nonvacuous
- id: demo/lfpp-converges-nonvacuous
decl: Demo.lfpp_converges_nonvacuous # ∃ γ h, 0 < γ ∧ γ < 2 ∧ IsGFF h
# coverage.yaml
- paper: {number: "Theorem 1.1", title: "Convergence of LFPP"}
class: same-assumptions
claims: [demo/lfpp-converges]
witness: demo/lfpp-converges-nonvacuous
The row’s block then carries, after its hypotheses, one of:
- “Hypotheses can be met. Lean proves that some instance satisfies all of
them together (
WITNESS, checked by lean-pkg’s probe against the Challenge).”; - “Hypotheses can be met: claimed by
WITNESS, not yet checked (REASON).”; - “Hypotheses can be met: the named witness
WITNESSdoes not have the expected type, so nothing is shown.”
The state is the claims ledger’s (lean-pkg claims ledger): checked needs
the probe’s facts in the sealed verify log and a comparator configuration
that credits both theorems. Also:
- the header adds “N of the verified have a checked witness that their hypotheses can be met”;
- the reading note adds that a witness shows the hypotheses can be met under the package’s own definitions, and that whether those are the paper’s objects stays the reader’s comparison;
- the Correspondence cell of
coverage.md(the Note cell of a library) says “Witness: checked”, “Witness: not yet checked” or “Witness: wrong type”; page --jsoncarriesverified_with_witness.
A row without the key renders exactly as before.
A claim that sets only witness (no hypotheses) is not conditional. When
the facts to judge its witness are missing, the claim keeps its status and only
the witness is not yet checked. A witness of the wrong type is
witness-type-mismatch, a failed claim, as for a conditional claim.
Conditional results
A claim that lists hypotheses (conditional claims,
proposal 0003) is conditional in the claims
ledger, never verified, and the page never calls it verified without saying under what. A result
block whose claims are all verified or conditional, at least one conditional, reads:
Conditional. Verified under assumptions
Hyp.A,Hyp.B. Discharged:Hyp.A(proved bydemo/proof-a; corollarydemo/main-of-b, compared at3f2a9c1e0b7d). Outstanding:Hyp.B(the tail estimate of [12, Theorem 2]). Lean accepts the proof under these assumptions, and lean-pkg’s record shows every check of this result passed (the build, and the statement comparison).
The text after an outstanding hypothesis is its {hypothesis, text} entry of the row’s inputs;
an outstanding hypothesis a claim inherits through depends_on says “inherited from” that claim.
With nothing outstanding the block reads “Verified (all assumptions discharged: …)”. Each
hypothesis links to its declaration at the gate-bound commit, so the reader can read what it says,
when the page can form the link: the sealed verify log names the module of each hypothesis constant,
and the link is made when that module is a file of the package that declares the name. A
hypothesis whose name is not a plain Lean name is counted (“1 more not shown here”), never dropped.
A row with a claim that is also open still reads “Not yet verified”.
When claims.yaml declares the statements module (statements_module,
A statements module for conditional claims),
read at the commit the page reads, “Verification at a glance” gains one paragraph after the fixed one:
Assumptions module. The assumptions the results below name are Lean definitions in
Demo.Statements, the one module beyond Mathlib that the Lean statements may use. It is part of the statement: read what each assumption says, because an assumption that is trivially true or false changes what a result means.
The module name links to its source, and a hypothesis whose module the sealed log does not name links into the statements module when the module declares it. A page without the key has no such paragraph.
Only when a claim uses the keys: the fixed paragraph gains “A conditional result says nothing when
an outstanding assumption is false.”, the counts line gains “conditional (proved under the
assumptions each names): K” (the verified count never includes them), the Ledger gloss of
coverage.md says what conditional means, and page --json gains conditional_rows. Every other
page is byte for byte what it was. To update a published page, run page --write (and --site /
--html), as after any change to the data.
Unlisted assumptions
Listing an assumption is the author’s choice. An assumption the declaration takes but no one lists
is not hidden (the Lean statement on the page shows it, and the comparator checks it), but the
ledger then calls the claim verified, and the row does not say it is conditional. coverage check
warns about such an assumption (open question 7 of proposal 0003), and never refuses for it:
beta: coverage: OK; 2 row(s): 1 same-assumptions, 0 inputs-supplied, 1 outside; manuscript arxiv
warning: rows[0] (Theorem 1, same-assumptions): claim beta/foo-le-bar (Demo.foo_le_bar) takes the assumption Hyp.A, a Prop def of the package (Demo.Statements), that neither the claim's hypotheses nor the row's inputs name (the gate receipt's sealed verify log): the claims ledger calls it verified without it. List it under hypotheses of beta/foo-le-bar and name it in the row's inputs (class inputs-supplied), or make it part of the statement (proposal 0003, open question 7)
The warning reads only the hyp-decl lines of the hyp-probe/1 section of the gate receipt’s
sealed verify log (hash-checked against report_sha256), for each claim a same-assumptions or
inputs-supplied row names. It names a binder of the claim’s declaration whose head is a Prop
def declared in a module of the package (its file committed at HEAD) and that neither the
claim’s hypotheses nor a {hypothesis, text} input of the row names. A head from Mathlib or any
other dependency, an inductive Prop or a structure, and the rows of a library coverage (each is
its Lean statement) give no warning. Without a gate receipt, a readable sealed log or a complete
hyp-probe/1 section there is no warning, and the output is what it was. receipt check appends
the first such warning to its coverage check, which still passes.
Commit the README and coverage.yaml after the gate, and the gate-bound
commit is no longer HEAD. The package needs the docs-only opt-in so the
receipts keep binding. Without it, the ledger reports the receipts as stale
and the page says so.
The docs-only opt-in
The opt-in is lean-pkg-binding.yaml (docs_descendants: true), committed
in the package directory at the commit the receipts bind
(receipts). lean-pkg new
writes it; for an older package, lean-pkg update NAME --write-binding-file
writes it from the registry record, then commit it in a commit of its own
and run the verify step again.
page --write handles a gated package without the file at its gated commit
X through the registry route, which is deprecated: when the record says
nothing either way it sets docs_descendants: true (its own
update --accept-docs-descendants invocation and updated event), a record
false (the veto) is left alone, and it prints WARN: deprecated: ...
(--json: deprecations[]).
It does not write lean-pkg-binding.yaml. The file is a build input:
added after X it unbinds the current receipts until the next verify run, so
it never belongs in the documentation commit. page --write prints the move
as deferred advice instead: right before the next verify run, run
lean-pkg update NAME --write-binding-file and commit the file in a commit
of its own. --json keeps the two apart:
outputs[]: the files this run wrote for the documentation commit (README.md, relative to the package directory, and any--siteor--htmlfiles);deferred[]: the migration, never part of that commit, with the keysid(binding-file),path,state,written,command,whenandadvice.binding_file{path, state, written}stays, withstate: deferredwhen nothing was written.
page --write --write-binding-file also writes the file into the working
tree, never staged and never over an existing path (deferred[].written
true). Commit README.md without it (git add README.md, not git add -A)
and the file on its own right before the next verify run. With the file at
X, page --write does none of this.
coverage.yaml
claims.yaml lists Lean results. coverage.yaml lists paper results: each
numbered result of a citable manuscript and how the formalization relates to
it. It lives in the package directory and is read at HEAD.
schema: coverage/1
package: telescoping-companion
manuscript:
title: "Telescoping sums and a sharp estimate"
version: "arXiv:<id>v<N>" # the posted id and version; or {repo: https://..., commit: <40 hex>, sha256: <64 hex>}
summary: "Lemma 2.1 is formalized with the paper's hypotheses; Proposition 2.3 uses it with one supplied input."
rows:
- paper: {number: "Lemma 2.1", title: "Partial sums", label: "L:partial"} # label optional
class: same-assumptions
claims: [telescoping-companion/sum-inv-mul-succ]
- paper: {number: "Proposition 2.3", title: "The estimate"}
class: inputs-supplied
claims: [telescoping-companion/estimate]
inputs: ["the tail bound of Section 3"]
note: "the Lean statement takes the tail bound as a hypothesis"
- paper: {number: "Theorem 4.1", title: "Asymptotics"}
class: outside
note: "not formalized"
compute: # optional; see Site acknowledgments
- cluster: easley
jobs: [slurm-123456]
| Key | Rule |
|---|---|
schema, package |
coverage/1; the package name |
manuscript.version |
a posted version: arXiv:<id>v<N>, or {repo, commit, sha256} (a public https repository, a full commit, the SHA-256 of the manuscript file). unposted (a private draft) is refused unless --allow-private-manuscript is passed; the page then says the numbers cannot be checked yet. When the registry record’s paper.status is published (update NAME --paper-status published), an unposted version is a published paper whose exact source has no public anchor: the page cites it as published; the exact source the paper numbers refer to is not publicly anchored and its note, Published; source not publicly anchored, says a reader cannot check the numbers against a posted version and names how to anchor one (formalization anchor for an arXiv version, or a public {repo, commit, sha256} source), never not yet posted or an unposted draft; --json carries paper_status and manuscript_note: "published-unanchored" |
manuscript.eprint_sha256 |
optional, only beside an arXiv:<id>v<N> version: the SHA-256 of that version’s e-print. lean-pkg formalization anchor writes it with the record data/source-baselines/arXiv-<id>v<N>.json; coverage check refuses a value that differs from the record committed at HEAD and warns when no record is committed. An older lean-pkg refuses the key (coverage/1 is strict) |
summary |
one line: the capsule’s only hand-written sentence |
rows[].paper.statement |
optional: the result as the paper states it, TeX, at most 2000 characters, several lines allowed; no line may start a code fence, and the README block’s markers (lean-pkg:page:) may not appear. Shown beside the Lean statement. An older lean-pkg refuses the key (coverage/1 is strict) |
rows[].class |
same-assumptions (the Lean statement carries the paper’s hypotheses), inputs-supplied (it also takes the named inputs as hypotheses), outside (no Lean counterpart) |
rows[].conclusion |
optional (proposal 0010): how the Lean conclusion relates to the paper’s, independently of class (which names the hypotheses): full (the paper’s conclusion; an absent key means full), weaker (a strictly weaker statement) or special-case (the result for a special case of the paper’s setting). Refused on an outside row. The page says “Verified: a weaker statement.” or “Verified: a special case.” instead of “Verified.” (above). An older lean-pkg refuses the key (coverage/1 is strict) |
rows[].conclusion_scope |
one line, at most 400 characters: what the Lean proves relative to the paper’s result. Required when conclusion is weaker or special-case, refused when it is absent or full, refused on an outside row. Shown as the Conclusion. line. An older lean-pkg refuses the key |
rows[].witness |
optional (proposal 0011): a claim id, the witness in claims.yaml of one of the row’s claims (its headline); refused on an outside row. Shown as Hypotheses can be met with the ledger’s state of that witness (a witness) |
rows[].claims |
ids in claims.yaml at HEAD; at least one for the first two classes, none for outside; a superseded claim is refused |
rows[].inputs |
required for inputs-supplied, refused for same-assumptions. Each entry is one line of text, or {hypothesis: Name, text: one line} with exactly those keys (proposal 0003): Name is the fully qualified name of an assumption in the hypotheses of some claim the row names (conditional claims), each named once; coverage check (both forms) refuses any other. The page shows the text and the name. An older lean-pkg refuses the mapping (coverage/1 is strict) |
nothing_excluded |
{reason: TEXT}, only when no row is outside. One of the two is required: a page always says where the formalization stops |
compute |
[{cluster: NAME, jobs: [slurm-<J>, ...]}]; NAME a site profile (easley is built in); each job must be a receipt of the site’s scheduler committed under .lean-receipts/ |
lean_pkg_version |
optional {version, doi}: the exact lean-pkg version to credit. When lean-pkg’s own CITATION.cff is readable it must list that version with exactly that DOI |
kind |
optional: paper (the default, everything above) or library (below). An older lean-pkg refuses the key (coverage/1 is strict) |
stack |
optional: the LTS stack the package opts into, lts-YYYY.04 or lts-YYYY.10 (lean-pkg new --stack writes it). coverage check checks only the name’s shape; doctor NAME, verify and page check the committed lean-toolchain and Mathlib commit against the stack and warn on a difference, never failing a check. When they match, How this was checked carries the line “Built on lean-pkg stack NAME”, linking the stack’s page. lean-pkg 0.14.0 and older refuse the key (coverage/1 is strict) |
The file is strict: unknown and missing keys, values outside the enums and
repeated mapping keys are refused. lean-pkg coverage check NAME validates the
committed file; --file PATH checks a working copy before you commit it (claim
ids and receipts are still read at HEAD).
Migrating an existing map is mechanical. A hand-written guide table with
one row per theorem becomes one row each: its correspondence class, the
declarations’ claim ids, and the premises as inputs. A ledger JSON whose
rows carry reference {label, number, page} and a status becomes rows of
paper {number, title, label}. There verified maps to same-assumptions,
verified-conditional to inputs-supplied with its conditions as inputs,
and outside-agreed-scope to outside. A row that is not yet verified keeps its class: the ledger, not
the class, decides the word verified. The per-theorem prose notes stay
hand-written, outside the markers.
Extension keys
A tool that builds something else from coverage.yaml, such as a book appendix or a site of its own, can keep its
data on the row it belongs to in a key whose name starts with x-
(proposal 0015):
conclusion_scope: the bound holds for t <= 1 only
x-appendix-scope-tex: 'the bound holds for $t \le 1$ only'
lean-pkg checks nothing inside an extension key and never shows it, on the page, the README block or a site. A reader must not take its content as checked. These are the rules:
- Where: at the top level and on rows (paper or library) only. An
x-key anywhere else (manuscript,rows[].paper,inputs,computeand the rest) is refused. - Name:
x-and then lowercase letters, digits,_or-, starting with a letter or digit, at most 64 characters. Prefix the tool’s name (x-<tool>-<field>) so that two tools do not collide. No lean-pkg key ever starts withx-. - Value: a string (several lines allowed), a number, a boolean or null, or a list or a mapping (string keys) of these, nested at most two levels. The compact JSON of the value is at most 4000 bytes. There are at most 16 extension keys on one object.
- Judged checks: none applies to an extension value. Placeholder text and long or multi-line values are fine there. Every other unknown key is still refused, so a misspelled real key is still caught.
- Output:
coverage checkprints one line after its verdict that names each distinct extension key and where it appears (x-appendix-scope-tex on 7 row(s)), so a misspelled extension key shows up beside the intended one.--jsonlists them inextension_keys(<root>.x-...,rows[N].x-...). - Writers:
formalization anchor --writeedits only the manuscript lines, so extension keys stay byte for byte.claims rebase --out-dirkeeps every key and its value, though the layout may change.
An older lean-pkg refuses a file with an extension key (unknown key(s) x-...). Pin a release that knows them.
A library with no manuscript
A reusable library that has no paper of its own (an adopted standalone
package, say) states what it verified as kind: library. Its rows are the
library’s main results, each named by its Lean declarations, and nothing on
the page names a manuscript or a paper:
schema: coverage/1
package: my-library
kind: library
summary: "The library's main estimates are formalized and every one of them is compared."
rows:
- title: "Main estimate" # one line, unique in the file
claims: [my-library/main-estimate] # at least one id in claims.yaml at HEAD
note: "the headline bound" # optional
compute: # optional; the site rule is the same
- cluster: easley
jobs: [slurm-123456]
| Rule | |
|---|---|
| refused | manuscript and nothing_excluded (each would state a manuscript), and a row’s paper, class, inputs, conclusion or conclusion_scope |
rows[].statement |
optional TeX, as paper.statement for a paper; shown as In words |
rows[].witness |
optional, as for a paper row (proposal 0011) |
rows[].title, rows[].claims, rows[].note |
one line each; at least one claim id, each in claims.yaml at HEAD, none superseded, each claim’s file committed |
| comparator | as for a paper: every theorem the recorded comparator receipt compares is the declaration of a claim some row names, or of a claim claims.yaml marks internal or reusable, so the claims account for everything the page says was compared |
compute, lean_pkg_version, stack, summary |
as above |
The page then carries Main results (one block per result, with its Lean
statement) in place of the paper’s results and Not formalized; the first line says
each result is exactly its Lean statement (lean-pkg’s own wording on a library
page never uses the words manuscript, paper or private, so a package’s
private patterns may block them), and the citation names no manuscript. --allow-private-manuscript
does not apply. formalization anchor refuses to bind a library coverage to an
e-print, and claims rebase leaves it alone. A package that formalizes results
of a paper, posted or not, stays kind: paper: a private draft is
unposted, never library.
The README block
The block sits between two markers:
<!-- lean-pkg:page:begin -->
...generated...
<!-- lean-pkg:page:end -->
--write replaces exactly the marked block. When the README has no markers
it appends the block, and when there is no README it creates one. Prose before
and after the markers is never touched, so keep the title, the long reader
guide and the per-theorem notes outside them. Unbalanced or repeated markers
are refused. --write never commits and never writes the registry (no lock,
no --commit). A live lease held by another agent refuses it unless you pass
--agent HOLDER. --out PATH writes the block to another file instead.
--check writes nothing and exits 1 when:
README.mdis missing, or has no block, or its block differs from a fresh render;- the README lacks the lean-pkg credit (the repository link and the concept DOI);
- the README mentions the Easley Cluster anywhere, inside the markers or not, without a backing receipt;
- the README carries the GitHub Actions sentence without a corroborated run: it needs
--corroborate(GitHub Actions), which asks GitHub’s public run API about each listed job and renders the sentence, with the runs’ links, only when every one reaches level 2; - with
--site DIRor--html PATH, a file there is missing or differs from a fresh render.
Run it in the companion’s CI. lean-pkg publish NAME --dry-run carries the
same check as one checklist line (JSON page {status, adopted, problems}). For
a package with no coverage.yaml and no block, the line is a WARN, except for
an unbacked site sentence, which is a failure.
What --check covers, and what it does not
--check renders the page afresh (which runs the coverage check rules and
the public-safety scan on the rendered text) and then compares:
- The marked block, byte for byte against the fresh render (the toolchain advisory lines aside). This is the only text whose content it checks.
- The lean-pkg credit: the repository link and the concept DOI must
appear somewhere in
README.md. - Site acknowledgments: a sentence naming the cluster anywhere in
README.mdfails without backing receipts. --siteand--htmlfiles, each compared whole.
It does not read any prose outside the markers (beyond those two searches),
and no other file: not docs/index.md, llms.txt, the abstract or message
in CITATION.cff, release notes or the manuscript. The public-safety scan
also covers only the rendered text; run
lean-pkg public-safety
on the tree for the rest. Hand-written summaries can therefore drift from the
block while --check passes. A field report found exactly that: the README,
the docs index, llms.txt and CITATION.cff said a premise was derived.
The generated block is the single source of truth for statements. Prose elsewhere should point to it rather than restate it. When you do restate a result outside the markers, check each sentence:
- Name every hypothesis as an assumption (“assuming …”, “under …”); the block’s Hypotheses line lists them.
- Never state an input, a named hypothesis or a definition hole as proved or derived. Only the conclusion of a verified result is proved.
- Quote the paper’s theorem number, as the block does, rather than paraphrase which result it is.
- Match the quantifier domains of the Lean statement (
∀ n ≥ 1,p ∈ (1, ∞)), no wider. - Re-read every such sentence after each new gate and
page --write: the block changes with the data, the prose does not.
Site acknowledgments
A computing site often asks to be thanked in a fixed sentence: a cluster’s
“This work was completed in part with resources provided by …”. A
site profile holds that sentence and the README pattern that finds
it. lean-pkg ships two built-in profiles (easley, a university cluster, and
github-actions), and a package can commit its own under lean-pkg-sites/.
Every profile follows the rule below with its own sentence; the examples use
easley.
A receipt does not record where its job ran: a Slurm receipt says
slurm-<J>, and the job number alone does not name the cluster. The sentence
therefore needs two things: an explicit declaration in coverage.yaml
(compute: [{cluster: easley, jobs: [...]}], the profile’s name), and, for every listed job, a
committed receipt whose job is that Slurm job. That is a lower-tier receipt
with job_id: slurm-<J> (what lean-pkg receipt slurm writes) or a comparator
receipt whose host_policy says it ran in Slurm job <J> and whose claim is
sealed with the job’s sacct record
(lean-pkg receipt comparator --seal-sacct;
SLURM_JOB_ID alone can be set by any shell, so an unsealed claim backs
nothing). With both, the
Acknowledgments carry the official sentence with the cluster linked. Without
them there is no sentence, and --check fails on one written by hand.
A lower-tier receipt whose job_id is a bare number (5581013) does not
back the sentence: nothing in it shows the number is a Slurm job. The refusal
names such a receipt. Write it with lean-pkg receipt slurm --job <J>, which
checks sacct first, rather than editing job_id by hand.
A repository whose gated commit already has a README with a site’s sentence
adopts the page after the gate. Without lean-pkg-binding.yaml at the gated
commit, only the registry route (deprecated, with a WARN: deprecated:
line) keeps the current receipts bound, until the next verify run at a
commit with the file:
lean-pkg update NAME --accept-docs-descendants --reason TEXT
Then commit coverage.yaml with its compute entry, run
lean-pkg page NAME --write and commit the README. Both receipts stay bound to the gated commit, so no new
gate is needed.
Citation
CITATION.cff must be committed, with a title and at least one author
with family-names or name: a citation without its human authors is not
usable. The DOI is the file’s doi, else the registry’s concept DOI.
Docs pages and a static HTML page
lean-pkg page my-companion --site docs # docs/verification.md + docs/coverage.md
lean-pkg page my-companion --html docs/verification.html # one HTML file
lean-pkg page my-companion --check --site docs --html docs/verification.html
--site DIR writes two Markdown pages for MkDocs (or any static site
generator) from the same data as the README block:
| File | What it holds |
|---|---|
verification.md |
the full page under one # Verification title: every section of the README block, in the same order, plus a link to coverage.md |
coverage.md |
every row of coverage.yaml, one table line each: number, title, class, every claim id, its declaration, each claim’s own ledger status, the inputs and the note |
--html PATH writes one HTML file holding both pages: no script, no
external stylesheet, font or image, a few lines of inline CSS (light and dark;
a serif text face, a 48rem measure, the Lean and TeX statements in marked code
blocks). TeX is shown as source, not typeset: typesetting needs MathJax or
KaTeX, a script, which this file never carries.
It is rendered from the same Markdown, so it says exactly what the pages say.
Links are kept only to https targets and in-page anchors.
The files do not depend on DIR: the same data gives the same bytes wherever
they are written. Links to the package’s own files (LICENSE,
CITATION.cff) point at the repository on GitHub (blob/HEAD), since the
docs directory is your choice; on another host they are plain names. Without
--check both options write (atomically; a symlink as a target is refused)
and leave README.md alone unless --write is given too. With --check they
are compared and nothing is written. Neither writes the registry.
Add verification.md and coverage.md to the nav of mkdocs.yml
yourself (or link them from the landing page of a Jekyll or static site);
lean-pkg never edits it. lean-pkg site check reads the whole site around
these two pages: whether they are current and linked, the mathematics, the
noindex while the package is private, and the files the site serves
(The site standard).
Hand-written pages beside the generated ones
--check --site DIR also reads the pages you write yourself: every *.md
under DIR, outside directories whose name starts with _ or . and
outside site/, node_modules/ and vendor/. A block-level HTML element
(<details>, <div>, <section>, <aside>, <article>, <blockquote>)
whose opening tag has no markdown attribute, and that holds Markdown
(a table row, a code fence, a list item, a heading, a quote, or inline
emphasis, code or a link), is a problem: --check exits 1 and names the
file and line.
GitHub Pages renders with kramdown and MkDocs with md_in_html; both treat
the inside of such a block as raw HTML unless the tag says markdown="1"
(a bare markdown works too). The table or code fence is then published as
literal | a | b | rows and three backticks. github.com shows the same file
correctly, so the page looks right in review; folded <details> hide it on
the site as well, until a reader opens one. Write the tag as:
<details markdown="1">
<summary>Complete Lean type</summary>
| Item | Scope |
|---|---|
| Status | Verified |
</details>
Lines inside a fenced code block are never read, so a page can show such
a block as an example, as this one does. With --json the findings are
html_blocks[] {path, line, tag, sample}, a key only --check --site prints.
In CI
page --check reads the lean-pkg registry record of the package (its
status, license, recorded receipts). A hosted runner has no registry, so the
job writes one from a repository secret and points --repo at the checkout.
--repo DIR reads that checkout instead of the registered local_path, for
this call only; one of its remotes must be the package’s repository.
The page is read from DIR’s committed HEAD (never its working tree; a
warning names uncommitted changes). When the recorded gate receipt binds that
HEAD, or HEAD is an evidence-only descendant of the commit it binds (the
rule gate applies), the page is the one the registered checkout renders: its
file links and Lean statements are at the bound commit. When it does not (a
candidate commit not yet gated), the page is a preview of HEAD: the links and
statements are read at HEAD, so a result added since the last gate links to
its own file; no fact of the receipts is shown (axioms, sorry count,
statement comparison, (used here)); no result is verified (the ledger
decides that, and it closes nothing at an unbound commit); and a Preview of
commit note under the first heading names the commit the page reads and the
commit the build check binds. formalization render --repo decides receipt
facts by the same rule. The JSON repo_override then carries head,
anchor_commit (the commit the links are at) and receipt_facts {receipt,
commit, included, binds_head, reason}.
A receipt that binds HEAD (or an ancestor HEAD descends from by that rule)
but does not validate for another reason (axioms outside the allowed set, a
nonzero sorry count, a toolchain or Mathlib mismatch, a malformed field) is
not a preview: it is a failed check. The page reads the links and statements
at the commit the receipt names, shows no receipt fact, verifies no result,
and says under the first heading The recorded build check does not
validate, with the reason; receipt_facts.binds_head is true and
included false. page --check --repo then never calls the difference
drift between gate runs: repair the receipt or run the gate again.
The official page stays bound to the accepted evidence: page --write and
page --check without --repo render the receipt-bound page. So between gate
runs, page --check --repo on a candidate commit compares its preview with
that committed receipt-bound block, and they differ. Each difference (the
README block, and a --site or --html file) is a warning that names both
commits (the preview’s HEAD and the commit the receipts bind): expected drift,
not a failed gate. The check exits 0, and its JSON says preview: true and
current: null (whether the committed files are current is not known: they
are receipt-bound by design); outside a preview preview is false and
current is true or false. Real problems still exit 1 under a preview: a
missing README or page block, unbalanced markers, a missing lean-pkg credit, a
site acknowledgment without backing, a missing --site/--html file, a
private-string hit, and a receipt that binds HEAD but does not validate.
--strict-preview (only with --check --repo) makes the differences fail
again (exit 1). The drift clears when the gate is run at that commit and the
page is written again; page --check without --repo checks the official
page.
- Put a registry file holding the package’s record into a repository secret
named
LEAN_PKG_REGISTRY_YAML(the record names local paths, so it does not belong in the public tree). Refresh it when the record changes (a new gate, a new status). - Add the job:
# .github/workflows/verification-page.yml
name: verification page
on: [push, pull_request]
jobs:
page:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # the ledger checks that HEAD descends from the gate-bound commit
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pipx install git+https://github.com/lean-pkg/lean-pkg.git@v0.7.54
- name: lean-pkg page --check
env:
LEAN_PKG_REGISTRY_YAML: $
run: |
printf '%s\n' "$LEAN_PKG_REGISTRY_YAML" > "$RUNNER_TEMP/lean-packages.yaml"
lean-pkg --registry "$RUNNER_TEMP/lean-packages.yaml" page my-companion --check --repo "$GITHUB_WORKSPACE" --site docs
On a commit between gate runs the job passes with a warning per difference
(the preview above); add --strict-preview to make it fail there instead.
Drop --site docs when the package has no docs pages; add --html PATH
when it ships the HTML file.
A package that backs compute with GitHub Actions runs
(GitHub Actions) renders and checks its page with
--corroborate, so the GitHub Actions sentence is earned from GitHub’s
record of each run; the job’s own GITHUB_TOKEN raises the API rate limit
and is never printed:
- name: lean-pkg page --check --corroborate
env:
LEAN_PKG_REGISTRY_YAML: $
GITHUB_TOKEN: $ # read-only use: the public run API's rate limit
run: |
printf '%s\n' "$LEAN_PKG_REGISTRY_YAML" > "$RUNNER_TEMP/lean-packages.yaml"
lean-pkg --registry "$RUNNER_TEMP/lean-packages.yaml" page my-companion --check --corroborate --repo "$GITHUB_WORKSPACE"
Render the committed block the same way (page NAME --write --corroborate).
Once a run’s records expire (90 days by default) its corroboration fails, the
sentence is dropped from a fresh render and the check fails until the README
is rendered again from a newer, corroborated run. Pin the lean-pkg version you render with: a newer
version may word a section differently, and the check then reports the
committed files as stale until you render them again.
Where the registry is at hand (a machine holding the registry, a self-hosted runner, a pre-push hook), a Makefile target is enough:
.RECIPEPREFIX := >
.PHONY: verification-page
# exit 1 when README.md, docs/verification.md, docs/coverage.md or the HTML page is stale
verification-page:
> lean-pkg page my-companion --check --site docs --html docs/verification.html
repo export exports the package tree as it is and adds no
generated files, so it does not install the workflow; copy it in yourself.
Blueprint cross-check
A package with a leanblueprint can check that the blueprint and the Lean code agree:
lean-pkg blueprint check NAME # exit 0 nothing missing, 1 otherwise
lean-pkg does not parse the blueprint. leanblueprint writes every name of
the blueprint’s \lean{...} tags to blueprint/lean_decls, and
checkdecls checks that each
one exists in the built package. The command runs that tool on a clean
checkout: lake build, then lake exe checkdecls blueprint/lean_decls. It
reports every name checkdecls prints as missing, and then reads claims.yaml
at HEAD: a claim whose decl the blueprint names must be a declaration that
checkdecls accepts. Claims outside the blueprint, and blueprint names that no
claim carries, are listed as notes and never refused (a blueprint also names
Mathlib declarations). A package with no blueprint/ directory and no
declaration list is skipped with a message, exit 0. --decls PATH names
another list. Nothing is written.
checkdecls is a Lake dependency that the package adds itself, pinned to a
commit; lean-pkg never edits the lakefile. In lakefile.lean:
require checkdecls from git "https://github.com/PatrickMassot/checkdecls.git" @ "3d425859e73fcfbef85b9638c2a91708ef4a22d4"
In lakefile.toml:
[[require]]
name = "checkdecls"
git = "https://github.com/PatrickMassot/checkdecls.git"
rev = "3d425859e73fcfbef85b9638c2a91708ef4a22d4"
Then run lake update checkdecls and commit the lakefile and
lake-manifest.json. The pin is the tag lean4.18.0, the newest tag and the
head of its default branch on 2026-10-17. Lake builds it with the package’s
own toolchain (it was run on Lean v4.29.0). Without the dependency, the
command refuses and prints these lines. With another revision it runs and
notes that the revision is not the documented pin.
checkdecls is by Patrick Massot and is licensed under Apache-2.0. lean-pkg runs it as the package’s own dependency and includes none of its code.
From lean-scope-page
The earlier script lean-scope-page (init and lint of hand-written
docs/scope/<slug>.md pages) is superseded by coverage.yaml and
lean-pkg page: the page is now rendered, so most of its rules hold by
construction, and the rest are checks of the data. coverage check runs
them, and so does every page render (page --check included).
| lean-scope-page rule | In lean-pkg |
|---|---|
| R1 a scope page exists | page --check fails when README.md has no page block; with --site/--html, when a file is missing |
| R2 exactly one H1 title | by construction: verification.md and coverage.md each have one # title |
| R3 the sections, in order | by construction: the fixed section order above; Not formalized always sits after the map |
R4 no FILL-ME placeholder |
coverage check: any text of coverage.yaml carrying FILL-ME, TODO, TBD, FIXME or XXX is refused |
| R5 Papers has a bullet | coverage check: manuscript {title, version} is required, the version posted (or --allow-private-manuscript); a kind: library coverage has no manuscript and refuses one |
| R6 Scope has prose | coverage check: summary is required, one line |
| R7 Not formalized is non-empty, or “nothing excluded” with a justification | coverage check: at least one outside row, or nothing_excluded: {reason} (never both) |
| R8 the comparator table’s links resolve | coverage check: every claim a row names has its file committed at HEAD; the declaration links point at the gate-bound commit |
| R9 every relative link resolves | by construction: the only relative links are LICENSE and CITATION.cff from the README (both required at HEAD) and coverage.md/verification.md beside each other |
| R10 every comparator config is linked | coverage check (with R11): every configuration of the recorded comparator receipt is accounted for through its theorems |
R11 every theorem_names entry has a row |
coverage check: every theorem the recorded comparator receipt compares is the declaration of a claim some row names, or of a claim claims.yaml marks internal or reusable (a supporting lemma the package declares as such needs no row; an experimental or superseded claim’s theorem is refused, with its status named): the name ends in the claim’s whole fully qualified decl (<Prefix>.<decl>, the Challenge form, counts; ChemoAudit.Chemo.Hopf.thm covers Chemo.Hopf.thm, ChemoAudit.Hopf.thm does not). A decl counts when the claim’s file declares it, or, for a declaration Lean generates and no line of the file states (a structure field, an @[ext] lemma), when the gate receipt’s claim_axioms read it from the built environment: a claim of claims.yaml at the receipt’s commit, not in its missing list. The offline form (--file, and verify’s preflight) has no receipt and reads the files alone. A name that differs from one row’s decl only in its leading namespace component gets a hint: naming the covering name; it is never credited. A configuration lean-pkg-signoff.json marks as a smoke check (smoke: {reason}, at the receipt’s commit or HEAD) is exempt: its theorems need no row, and must be the declaration of no claim a row names; the page lists them as smoke checks, never as results (smoke checks). comparator.md |
| R12 definition holes name their reviewer | coverage check: a configuration of the recorded comparator receipt with definition_names must carry a sign-off reviewer (its signoff copy of lean-pkg-signoff.json, or the deprecated judged_as.reviewer); the trust boundary then names each hole and who judged its body, and when |
Two differences. lean-pkg reads the comparator configurations from the
recorded comparator receipt, not from the files in the tree: the page states
what was compared, not what is configured. And there is one page per package,
not one per family; a package with several families lists them as rows of one
coverage.yaml.
Migrating a scope page: each table row of ## Comparator links becomes a
coverage.yaml row whose claims name the theorem’s claim; each bullet of
## Not formalized becomes an outside row; the “nothing excluded”
justification becomes nothing_excluded.reason; the ## Scope prose becomes
summary (one sentence) and, for the rest, hand prose outside the README
markers. Then delete docs/scope/ and run lean-pkg page NAME --write.
Not yet
- Measured wall time and peak memory in the reproduce section, once receipts record them.
- A registry-free CI check (today the job needs the record from a secret).