On-disk formats
Every file lean-pkg writes or reads, who owns its format, the version it
is at, the versions a reader accepts, and how an older file is brought
forward. This is the format freeze of the
1.0 command tree
(section 6, items 1 to 3); tests/test_formats.py checks the versions
below against the code.
The rule for changes within a version
A format version names a set of keys and what each one means.
- A new optional key keeps the version. Readers that do not know the
key ignore it, and a file without it means what it meant before. The
receipt keys
producer,claim_axiomsandreport_compressed,kind: libraryincoverage/1, and the conditional-claim keys (hypotheses,dischargesandwitnessinclaims/1, aninputsentry{hypothesis, text}incoverage/1; proposal 0003) were added this way, and so was the top-levelstatements_moduleofclaims/1(#369: the one module ofPropdefinitions a Challenge may import; A statements module for conditional claims). The registry’s top-levellean_pkg: {recommended: X.Y.Z}was added the same way, within version 3 (#388; The registry file): an older lean-pkg ignores it and keeps it on every save.claims/1andcoverage/1are strict, so an older lean-pkg refuses a file that uses a key added after it: a package that uses one needs a release that knows it in its CI pin.coverage/1also acceptsx-extension keys at the top level and on rows, which lean-pkg shape-checks and otherwise ignores (Extension keys, proposal 0015).index-entry/2gained two optional derived keys of a claim the same way,status(onlyconditional) andopen_hypotheses, written byindex addonly for a headline whose claim is conditional and recomputed byindex check(Conditional claims); an older lean-pkg refuses an entry that carries them (the entry schema is strict). - A new required key, a removed key, or a changed meaning bumps the
version (
claims/1toclaims/2,v: 1tov: 2). A lean-pkg that meets a version newer than it knows refuses the file, naming the upgrade, rather than reading part of it; a reader of the event log skips such a line and says so. - Evidence is never rewritten. Receipts bind bytes, so readers accept every earlier receipt version forever, and there is no migration for them. State files (registry, claims, index entries) have a migration command, a dry run by default where the command has one, and readers accept the older versions until the next major release (section 5).
One exception: lean-pkg-binding.yaml refuses unknown keys. The file
grants a rule (the docs-only descendant rule),
so a key this lean-pkg does not know is not ignored: the file does not opt
in, and the output names the key. Repeated keys, anchors, aliases and
explicit tags are refused the same way, and docs_descendants must be the
literal true or false. A new optional key there still keeps
lean-pkg-binding/1, but an older lean-pkg reading a file that uses it
falls back to the evidence-only rule, which is the safe direction.
A new version of any lean-pkg format is a schema change: it starts as a design proposal.
Formats lean-pkg owns
| Format | File | Version marker (current) | Readers accept | Migration |
|---|---|---|---|---|
| Registry | lean-packages.yaml |
version: 3 |
1, 2 and 3; a newer version is refused (“upgrade lean-pkg”) | lean-pkg registry migrate (in place, additive, idempotent; --dry-run) |
| Event log | lean-package-events.jsonl |
v: 1 on each line |
0 (a line without v) and 1; a line with a newer or unreadable v is not interpreted, and the reader says so |
none: the log is append-only, old lines stay as written |
| Claims | claims.yaml |
schema: claims/1 |
claims/1 |
lean-pkg claims migrate (a legacy claims.json to a claims/1 skeleton) |
| Coverage | coverage.yaml |
schema: coverage/1 |
coverage/1 |
none needed yet |
| Declared controls | lean-pkg-controls.yaml |
schema: controls/1 |
controls/1, strictly, in a fixed line shape the verify job reads with awk (Declared controls) |
none needed yet |
| Lower-tier receipt | .lean-receipts/<c12>-<job>.json |
schema: lower-receipt/1 |
0 (no schema key: every receipt written before 0.22.0) and lower-receipt/1; a newer lower-receipt/N is refused (“upgrade lean-pkg”), any other value is refused |
none: evidence is never rewritten |
| Comparator receipt | .lean-receipts/<c12>-comparator.json |
schema: comparator-receipt/2 |
comparator-receipt/1 (legacy mechanism implied) and /2 |
none: evidence is never rewritten |
| Comparator estimate | printed JSON (receipt comparator --estimate) |
schema: comparator-estimate/2 |
not read back as evidence (receipt check skips it) |
none needed |
| Sign-off sidecar | lean-pkg-signoff.json |
schema: lean-pkg-signoff/1 |
lean-pkg-signoff/1 |
from inline judged_as keys: lean-pkg comparator migrate-signoff PATH |
| Index entry | index/<name>/entry.yaml |
schema: index-entry/2 |
index-entry/1 and /2 |
lean-pkg index migrate (--check to list without writing) |
| Binding opt-in | lean-pkg-binding.yaml (the package directory) |
schema: lean-pkg-binding/1 |
lean-pkg-binding/1; a newer lean-pkg-binding/N, an unknown key or any other invalid file does not opt in (fail closed: the evidence-only rule binds, and the output names the file and the key) |
none needed yet (written by hand; docs-only descendants) |
| Seal-bundle spec | the package’s seal-bundle.yaml (any path, given to seal-bundle --spec) |
schema: seal-bundle/1 |
seal-bundle/1; any other value, or an unknown key, is refused (seal-bundle) |
none needed yet |
| Site profile | lean-pkg-sites/<name>.yaml (and the built-in profiles) |
schema: site-profile/1 |
site-profile/1 |
none needed yet |
| Source baseline | data/source-baselines/arXiv-<id>v<N>.json |
schema: source-baseline/1 |
source-baseline/1 |
none needed yet |
| Extraction ledger | --ledger PATH of lean-pkg-extract ledger and decls (private; outside the source and the target; decls records target.commit: null, nothing being committed) |
schema: lean-pkg-extract-ledger/1, with the comparison method in method (text/1, or types/1 with its optional keys source_type_sha256, target_type_sha256 and types_cleared per entry and types per ledger) |
lean-pkg-extract-ledger/1 with method text/1 or types/1, strictly (exact keys for the method, closed verdicts, duplicate keys refused); a newer lean-pkg-extract-ledger/N or an unknown method is refused (“upgrade lean-pkg”); read back by lean-pkg-extract recheck only, never by a gate, page or index |
none: evidence is never rewritten (extraction ledger) |
| Upgrade record | docs/upgrades/<version>.yaml (this repository) |
schema: lean-pkg-upgrade-record/1 |
lean-pkg-upgrade-record/1 |
none needed yet |
Blocks and sidecars inside the receipt formats carry their own markers and
follow the same rule: the sacct seal (slurm-sacct-seal/1, in
slurm_sacct.schema), the olean manifest (olean-manifest/1) and the
dependency fill provenance (lean-pkg-fill-provenance/1). So does the
hypotheses section of the sealed verify log (hyp-probe/1, in its header
line; The hypotheses section). The ci block
of a receipt from a GitHub Actions run has no marker of its own: it is an
additive key of lower-receipt/1 (The ci block).
Internal, not a public format. The comparator runner’s working files
under comparator-stages/ (comparator-stages/1, comparator-attempt/1,
comparator-partial/1, comparator-slot/1), the comparator types
checkpoint, the output of the extraction ledger’s types/1 programs
(lean-pkg-extract-types/1, read back by --from-output only when this
release’s program wrote it: its hash is in the output), and the search cache (lean-pkg-palomar-cache/1) belong to
the run that wrote them and may change in any release. So do the data
files lean-pkg ships (lean-pkg-toolchain-advisories/1,
lean-pkg-stack/1, lean-pkg-upgrade-breaking/1,
lean-pkg-verify-workflow-pins/1), which only the same release reads.
Reports. Output that is printed or written on request and never read
back is versioned too, so a script can tell what it has:
claims-ledger/1, claims-rebase/1, host-routes/1, exercise-check/1,
exercise-batch/1, lean-pkg-extract-plan/1, lean-pkg-upgrade/1,
formalization-kept/1, comparator-types/1, lean-pkg-lean-diag/1,
lean-pkg-dup-constants/1, lean-pkg-comparator-contracts/1,
lean-pkg-extract-ledger-summary/1 and lean-pkg-report/1. The
lean-pkg-extract manifest a user writes is lean-pkg-extract/1.
lean-pkg-report/1 is the bug report lean-pkg report assembles: the first
line of its body, in the dry run, the filed issue and --json, is the
marker <!-- lean-pkg-report/1 -->, and --json carries the same string
as schema. An intake channel reads it to recognise a report and its
layout: the template’s bold section labels in order, with the optional
**Blocking** line before Version and **Workaround** section after What
you expected (report).
lean-pkg-extract-ledger-summary/1 is the public summary of an extraction
ledger (lean-pkg-extract recheck --public-summary PATH, written only when
the recheck passes, once, outside SRC, after a public-safety scan; it may
live inside the target): strict JSON, keys sorted, exactly the keys
schema, method (the ledger’s: text/1 or types/1), ok (always
true), ledger_sha256 (of the ledger file rechecked), at_ledger_commits,
source_commit (null unless --include-source-commit), target {commit,
modules (target module names, sorted)}, entries (each {target (null
for a DROPPED row), target_module, verdict, source_sha256,
target_sha256}), context (each {target_module, verdict,
source_sha256, target_sha256}) and totals (the ledger’s). It holds no
source path, source module or declaration name, reason, warning or (by
default) source commit; nothing reads it back
(A public summary of a ledger).
Formats owned by outside projects
lean-pkg reads and writes these but does not define them: it follows the version its release targets, and says which one.
| Format | Owner | Version lean-pkg targets | How lean-pkg handles another version |
|---|---|---|---|
formalization.yaml |
mathlib-initiative (formalization.yaml) | version: v0.4, validated against the vendored JSON schema formalization-0.4.schema.json |
lean-pkg formalization render NAME --write writes v0.4; a later version is adopted by a lean-pkg release that vendors its schema (an upgrade-record entry of kind format) |
| Comparator configuration | Palomar (comparator.json, comparator/config*.json) |
Palomar’s keys; the deprecated inline judged_as is warned |
lean-pkg comparator migrate-signoff PATH moves inline sign-offs to the sidecar |
| Headline configuration | Palomar’s six keys (comparator.headline.json, or the registry’s headline_config) |
as a comparator configuration | as a comparator configuration |
| Palomar submission rules | PalomarRegistry/PalomarSubmission | browser-preflight-policy.json schema 1 at commit d4e41c1 (committed 2026-10-05, read 2026-10-16) |
lean-pkg palomar check --rules FILE reads a newer policy file downloaded by hand; lean-pkg never fetches it |
Lower-tier receipt versions
receipt slurm and receipt systemd (alias receipt local) write
"schema": "lower-receipt/1" as the first key of every receipt since
0.22.0. Version 1 is version 0 with the marker: every key, rule and
optional key is the same (lower-tier receipt schema).
| Version | Marker | Read by gate, gate --check, receipt check, the ledger, next, page, palomar, index check, formalization |
|---|---|---|
| 0 | no schema key |
judged exactly as before, forever |
| 1 | "schema": "lower-receipt/1" |
the same rules |
| newer | "schema": "lower-receipt/2" and later |
refused: lower-tier receipt schema lower-receipt/2 is not supported (...); this lean-pkg is older than the receipt: upgrade lean-pkg (exit 1) |
| other | any other schema value |
refused: receipt schema must be 'lower-receipt/1' (or absent, ...) (exit 1) |
A receipt that lacks a required key is refused for that key first, as before, unless its marker names a newer version: then the upgrade message comes first, since a newer version may have changed the key set.
The ci block
ci is an optional, additive key of lower-receipt/1
(proposal 0008): the
GitHub Actions run a receipt came from, every value from a variable the
runner sets. The marker stays lower-receipt/1: a receipt without ci
means what it meant before, and a lean-pkg that predates the key ignores it
(it then reads the receipt as an ordinary lower-tier receipt and checks no
ci rule). A receipt whose job_id is gha-<run_id>-<run_attempt> and
whose ci block passes level 1 is the job of the built-in github-actions
scheduler and can back coverage.yaml compute
(Compute sites). lean-pkg receipt ci writes
the block inside the job, keys in the order of the table below
(A lower-tier receipt from GitHub Actions).
Level 1 is offline and is what gate, gate --check, coverage check,
page and receipt check apply. A block that fails any rule below refuses
the receipt (ci block (a GitHub Actions run, level 1; ...): ..., every
failing rule named). Unknown keys inside ci (and inside runner) are
ignored, as for producer.
| Key | Type | Level 1 check |
|---|---|---|
provider |
string | equals github-actions |
server_url |
string | equals https://github.com (GitHub Enterprise Server is not accepted) |
repository |
OWNER/REPO |
well formed, and the OWNER/REPO prefix of workflow_ref |
repository_id |
integer > 0 | the type (level 2 compares it with the run) |
run_id |
integer > 0 | job_id is gha-<run_id>-<run_attempt> |
run_attempt |
integer >= 1 | as run_id |
job |
one line of text | shown; not load-bearing |
event |
string | push or workflow_dispatch; every other event is refused |
head_sha |
40 lowercase hex | equals the receipt’s commit |
workflow_ref |
OWNER/REPO/.github/workflows/FILE.yml@REF |
well formed (the file directly under .github/workflows/, .yml or .yaml) |
workflow_sha |
40 lowercase hex | the commit the workflow file is read at |
workflow_file_sha256 |
64 lowercase hex | the workflow file at workflow_sha hashes to it when that commit is in the clone; when it is not, a shown skip (· ci: workflow file ... not rehashed) |
job_workflow |
OWNER/REPO/.github/workflows/FILE.yml@REF or null |
well formed when not null |
runner |
mapping {environment, os, arch, image, image_version} |
environment is github-hosted (a self-hosted runner is refused, naming receipt local); os, arch one line of text; image, image_version one line of text or null |
verify_log_sha256 |
64 lowercase hex | equals report_sha256 (which the committed redacted log must hash to, as for every receipt) |
attestation |
file name (no /), optional |
the form only (the bundle is checked at level 3, below) |
Level 1 is consistency with the receipt, the commit and the committed log:
the strength of a slurm-<J> receipt, and as forgeable, since every value
is text the author could write (Trust model).
It backs a compute job but never puts the GitHub Actions sentence on the
page: that needs a corroborated run (level 2, --corroborate;
Corroborating the run). A receipt with a gha- job id and no ci block still passes
gate and backs no compute job.
The attestation bundle
attestation (stage S4) is written by receipt ci --attest, which
lean-pkg’s verify.yml passes: it names the Sigstore bundle
<c12>-gha-<run_id>-<run_attempt>.sigstore.json, committed beside the
receipt under .lean-receipts/ (the receipt’s own file name with
.sigstore.json for .json). The bundle is what
actions/attest-build-provenance writes: Sigstore bundle JSON (one bundle;
a JSON Lines file of exactly one is read too) whose DSSE envelope carries an
in-toto statement with exactly two subjects, the SHA-256 of the receipt
bytes and the receipt’s report_sha256 (the redacted log). Its name is
fixed before the signature, so the receipt can name it and still be a
subject. lean-pkg never writes or edits the bundle; it is not a receipt,
and the receipt listings of coverage check, page and receipt check
skip files ending in .sigstore.json. Level 3 (--attested) verifies it
with gh attestation verify (Attesting the run).
The key stays optional: a receipt without it means what it meant before,
and reaches at most level 2.
In a comparator receipt
ci is also an optional, additive key of comparator-receipt/2 (stage S5
of the proposal): lean-pkg receipt comparator writes it when it runs on a
GitHub-hosted runner, with job_id gha-<run_id>-<run_attempt> and
host_policy GitHub Actions run <run_id> attempt <run_attempt>
(On a GitHub-hosted runner). The
schema stays comparator-receipt/2, and a lean-pkg that predates the key
ignores it, as validate_comparator ignores every key it does not read.
The block has the keys of the table above except verify_log_sha256: a
comparator receipt has no verify log, and each of its comparison logs is
bound by configs[].log_sha256. Level 1 applies the same rules, with
commit the comparator receipt’s own, plus two of its own: host_policy
must name the run (GitHub Actions run <run_id> attempt <run_attempt>), and
a verify_log_sha256 key is refused. gate, gate --check and
receipt check refuse a comparator receipt whose block fails
(comparator ci block (a GitHub Actions run, level 1; ...): ...). Only a
comparator receipt whose block passes backs a github-actions compute
job, as only a sealed one backs a Slurm job; one with a gha- job id and no
block is named in the refusal.
The hypotheses section of the verify log (hyp-probe/1)
Written since stage H1 of proposal 0003
(conditional claims, #320); read by the claims
ledger since stage H3 (Conditional claims), which judges the
facts from the sealed log the gate receipt binds, at the gate-bound commit, on every call; since
stage H4 also by receipt check (its hypotheses check), index add and index check, by the same
rule; since stage H5 the hyp-decl lines also by coverage check and receipt check’s coverage
check, for a warning only (Unlisted assumptions).
The lower-tier verify scripts (receipt slurm --template and the verify.sh that lean-pkg new
writes) append this section after the
per-claim axioms lines, before the seal, so
report_sha256 covers it. The receipt schema does not change: there is no new receipt key and
lower-receipt/1 stays. hyp-probe/1 is the marker in the section’s header line. A small
core-Lean program, HypProbe.lean, prints facts and Python judges them: the probe never prints a
verdict. Every line after the header is a tag, a colon, a space and one JSON object with exactly
the keys below. An excerpt of the section the test fixture (tests/fixtures/hypotheses) gives:
== lean-pkg hypotheses (hyp-probe/1) ==
hyp-decl: {"v":1,"theorem":"Paper.main","binders":[{"i":0,"head":"Hyp.A","kind":"def","module":"Fx.Statements","explicit":true},{"i":1,"head":"Hyp.B","kind":"def","module":"Fx.Statements","explicit":true}],"data_binders":0}
hyp-decl: {"v":1,"theorem":"Paper.useAx","binders":[{"i":0,"head":"Heads.Ax","kind":"axiom","module":"Fx.Heads","explicit":true}],"data_binders":0}
hyp-missing: {"v":1,"theorem":"Paper.gone"}
hyp-challenge-build: {"module":"Fx.Challenge","ok":true}
hyp-challenge: {"v":1,"theorem":"Audit.main","binders":[{"i":0,"head":"Hyp.A","kind":"def","module":"Fx.Statements","explicit":true},{"i":1,"head":"Hyp.B","kind":"def","module":"Fx.Statements","explicit":true}],"data_binders":0,"config":"comparator.json"}
hyp-challenge: {"v":1,"theorem":"Audit.main_of_B","binders":[{"i":0,"head":"Hyp.B","kind":"def","module":"Fx.Statements","explicit":true}],"data_binders":0,"config":"comparator.json"}
hyp-challenge: {"v":1,"theorem":"Audit.param_of","binders":[],"data_binders":1,"config":"comparator.json"}
hyp-challenge: {"v":1,"theorem":"Audit.proofA","binders":[],"data_binders":0,"config":"comparator.json"}
hyp-corollary: {"corollary":"Audit.main_of_B","of":"Audit.main","drops":["Hyp.A"],"binders":[0]}
hyp-corollary: {"corollary":"Audit.param_of","of":"Audit.param","drops":["Hyp.PA"],"binders":[1]}
hyp-skip: {"theorem":"Audit.many","reason":"13 distinct hypothesis constants, more than 12: the corollary search is not run"}
hyp-proof: {"proof":"Audit.proofA","proves":"Hyp.A"}
hyp-witness: {"witness":"Audit.witness_ok","of":"Audit.three2"}
hyp-done: {"v":1,"decls":7,"challenge":23,"configs":["comparator.json"]}
The probe has two parts. The decl part runs whenever the package has a claims.yaml, under
the job’s LEAN_PATH, on the modules the claims’ files name. The Challenge part runs only
when claims.yaml uses hypotheses, discharges or witness (a line matching
^[[:blank:]-]+(hypotheses|discharges|witness):), so other packages pay nothing. It reads the
comparator configurations (comparator*.json and comparator/config*.json), builds each
Challenge module they name with lake build, its output in a side log
(hyp-challenge-build.log: in the job’s work directory for the template, beside the log for
verify.sh), outside the sealed log, so the Challenge’s sorry warnings never reach
sorry_count; only the hyp-challenge-build status line enters the sealed log. It then imports
every Challenge module in a separate run from the decl part. The job, not Lean, writes the header
and the final hyp-done line, counting the lines Lean printed; a part whose run fails is replaced
by one hyp-error line, and the job goes on.
| Line | Printed by | When | JSON keys |
|---|---|---|---|
hyp-decl: |
decl part | once per claim decl found in the built environment |
v (1); theorem (the claim’s decl); binders: every binder of Prop type whose head is a constant, explicit or not, each {i, head, kind, module, explicit} (its position in the telescope, counting every binder from 0; the head constant; the head’s declaration kind: def, inductive, axiom, opaque, theorem, quot, constructor or recursor; the module that declares the head, "" when none; and whether the binder is explicit); data_binders (the number of binders that are not Props) |
hyp-missing: |
decl part | once per claim decl not in the built environment |
v, theorem |
hyp-challenge-build: |
Challenge part | once per Challenge module the configurations name | module, ok (whether lake build succeeded; its output is in the side log) |
hyp-challenge: |
Challenge part | once per name in each configuration’s theorem_names that is in the Challenge environment |
the keys of hyp-decl, plus config (the configuration’s path) |
hyp-corollary: |
Challenge part | for each ordered pair of distinct Challenge theorems where the corollary’s type is the other theorem’s type with every binder headed by some non-empty set of its hypothesis constants removed | corollary, of, drops (the hypothesis constants whose binders were removed, in the order they first occur), binders (the removed positions in of’s telescope) |
hyp-proof: |
Challenge part | when a Challenge theorem’s type is exactly a hypothesis constant (the head of a Prop binder of some Challenge theorem) |
proof, proves |
hyp-witness: |
Challenge part | when a Challenge theorem’s type is the expected witness type of a Challenge theorem with at least one hypothesis: ∃ over its non-Prop binders in order, of the right-nested ∧ of all its Prop binders in order |
witness, of |
hyp-skip: |
Challenge part | the corollary search was not run for a theorem (more than 12 distinct hypothesis constants) | theorem, reason |
hyp-error: |
either part | the part could not run (for example, the program does not compile on the package’s toolchain, a module is not built, or a Challenge module did not build), or a configured Challenge name is not in the Challenge environment | phase (decl or challenge), message (exit N, then the first error line with every path prefix removed, at most 200 characters, so a redaction never alters it) |
hyp-done: |
the job, last line | always, once | v (1); decls (the number of hyp-decl and hyp-missing lines); challenge (the number of hyp-challenge lines); configs (the configuration paths read; [] when the Challenge part did not run) |
Only positive facts are printed: no line says that a corollary or a proof does not match. Types
are compared with Expr.eqv, which ignores binder names, plus equal binder annotations on the
outer binders of the two types, and the other theorem’s universe parameters renamed positionally
to the theorem’s; there is no unfolding, whnf or isDefEq. Only non-dependent binders are
dropped (a binder a later binder or the conclusion mentions cannot be), a hypothesis constant
names all of its binders, and the search covers the non-empty subsets of at most 12 distinct
hypothesis constants. A theorem head cannot occur in practice: the kernel refuses a theorem
whose type is not a proposition, so no theorem can be a binder’s type.
Refusals, at write time (receipt slurm, receipt systemd, --check; the receipt is not
written): a section without hyp-done, counts that do not match it (and a hyp-challenge line
naming a configuration hyp-done does not list), a line printed twice (or a second line for the
same decl, Challenge theorem and configuration, or Challenge module), a malformed line (not one
JSON object, or not exactly its tag’s keys and types, or v not 1), a line after hyp-done, a
hyp-*: line before the header or with an unknown tag, a second header, and a redaction that
alters a section line. A log without the section stays a valid receipt, as before. hyp-error
and hyp-skip are never refusals. The claims ledger reads a section the write-time check would refuse,
no section, a hyp-error of the part it needs, a failed Challenge build or a hyp-skip of the theorem
it needs as missing facts: the claims that use hypotheses, discharges or witness are then
hypotheses-unchecked, never discharged. Only the decl part is needed at the gate stage.
Declared controls (controls/1)
Written since the first implementation stage of
proposal 0014 (accepted); verify’s preflight checks the
declaration. The gate does not read the section yet: that, and the counts on page, status and the catalog,
are the next stage, so a failed control does not yet refuse anything.
A package may commit lean-pkg-controls.yaml beside claims.yaml. Since the verify job reads it with awk (a
job has no Python), it keeps one line shape, which verify’s preflight and
python3 -m lean_pkg.controls --file lean-pkg-controls.yaml check: schema: controls/1, then controls:,
then per control ` - id: ID and its other keys one per line, indented four spaces; a list is a flow list
[A, B]; expect is double-quoted with no ”` or backslash inside.
| Key | Kinds | Meaning |
|---|---|---|
id |
all | unique, [a-z0-9][a-z0-9-]* |
kind |
all | must-fail (must not compile, for a non-setup reason), refutes (must compile and prove the listed theorems, each a negation), compiles (must compile cleanly) |
file |
all | a relative path to a tracked .lean file; one control per file |
expect |
must-fail |
a substring of the first error message (all its lines) |
theorem |
refutes, required |
a theorem name or a flow list of names |
targets |
all | package declarations the control must use |
timeout |
all | seconds, 1 to 3600 (default 300); a timeout is a failure |
note |
all | one line; a refutation false only through a library’s junk value (Γ 0 = 0, x / 0 = 0) must say so here |
The verify scripts (receipt slurm --template, and the verify.sh that lean-pkg new writes) run each
control one at a time, after the hypotheses section and before the seal, as
timeout T lean --run ControlsProbe.lean KIND FILE .lake/build ... in the package directory (so the package’s
toolchain’s lean runs) with the LEAN_PATH the script checked. ControlsProbe.lean, lean-pkg’s core-Lean
program, elaborates the file through the same processor as lean FILE (a module header behaves the same)
and prints its facts; the job adds the control’s id, file hash and time:
== lean-pkg controls (controls/1) ==
ctl-decl: {"v":1,"file":"lean-pkg-controls.yaml","sha256":"<64 hex>","controls":6,"toolchain":"leanprover/lean4:v4.35.0"}
ctl: {"v":1,"id":"neg-wrong-bound","kind":"must-fail","file":"controls/WrongBound.lean","sha256":"<64 hex>","seconds":2.0,"exit":1,"errors":1,"first_error":"omega could not prove the goal: ...","first_kind":"[anonymous]","setup_error":null,"expect":"matched","sorry":false,"targets":{"Cx.double":"statement"},"ok":true,"message":null}
ctl: {"v":1,"id":"ref-double","kind":"refutes","file":"refutations/DoubleNotLt.lean","sha256":"<64 hex>","seconds":1.9,"exit":0,"errors":0,"first_error":null,"first_kind":null,"setup_error":null,"expect":"absent","sorry":false,"theorems":{"Refutations.double_not_lt":{"found":true,"negation":true,"axioms":["propext"]}},"other_axioms":["Quot.sound","propext"],"targets":{"Cx.double":"negation"},"ok":true,"message":null}
ctl-done: {"v":1,"ran":6,"passed":3,"failed":3,"seconds":11.7}
- Messages: every snapshot’s messages, with severity and
kind(a named error’s kind is its name plus._namedError).first_erroris the first error message’s text, path prefixes removed, at most 400 characters;errorscounts the error messages. - Setup errors, checked on every error message (case-insensitive patterns, and error names matching the
kind with or without
._namedError):unknown (identifier|constant|namespace|tactic|module),invalid field,unexpected token,unexpected end of input,unknown option,unknown attribute,object file .* does not exist,\(deterministic\) timeout,deterministic timeout,maximum recursion;lean.unknownIdentifier,lean.invalidField,lean.invalidDottedIdent. A match fails the control, whatever its kind (SETUP_PATTERNSinlean_pkg/controls.py; the probe’s copy is checked against it on the recorded first errors). - Negation: after the theorem’s binders, the head is
NotorNe, or the conclusion isFalse. - Targets: a declaration whose module’s
.oleanlies under the package’s.lake/build(anylean_lib). Formust-fail, it must occur among the elaborated terms of the command that reports the first error (statementorproof); there is no imports fallback. Forrefutesandcompiles, in a declaration the file adds (negationwhen in a listed theorem, elseother), or in a command’s terms (other). - Axioms: the standard three only (
propext,Quot.sound,Classical.choice), for every declaration of arefutesorcompilesfile;sorry(a warning orsorryAx) fails it. - A control whose file is missing, or whose probe exits non-zero or times out, gets a
ctl:line with"ok": falseand amessage. No declaration: no section.
report_sha256 seals the section; the receipt schema does not change.
Event log
lean-package-events.jsonl holds one JSON object per line, keys sorted,
appended and never rewritten. Every line has ts (UTC ISO-8601 with an
offset, second precision), event, name (the package, or null) and,
since 0.22.0, v: 1. A line without v (written before) is version 0 and
is read as before. Since 0.29.0 every line also carries producer, the
lean-pkg that wrote it (proposal 0013):
{lean_pkg, install, commit, dirty}, where lean_pkg is its release,
install is installed, editable or unknown (the detection behind
lean-pkg --version), and commit and dirty are the full HEAD of an
editable checkout and whether its tracked files were modified (null for an
installed release, whose version names its tag). The key is additive within
version 1: an older reader ignores it, and a line without it (written
before) means producer unknown. It carries no path, host or user name, is
not copied into history[], and, like every line of the log, is a record,
not evidence. A reader that interprets events (the prior-art note of
lease claim) skips a line whose v is newer than 1, or is not a
non-negative integer, and prints one warning naming the upgrade; a reader
that only shows lines (the board’s last event, the pending-change summary
of a committed-mode refusal) shows them as they are.
Package events (every event below except the five log-only ones) are also
appended to the package’s history[] in the registry, without v, and may
carry actor: the --agent of the gate, comparator, record,
publish, claims sync or verify run that wrote an event with no
agent key. The log-only events are registry-created,
registry-migrated, registry-recommended, index-added and prior-art-searched.
The keys of each event, beyond ts, event, name and v. Not every key
is on every line: a key that does not apply is left out. <field>_from
stands for one key per field update changed, holding its old value.
| Event | Written by | Keys |
|---|---|---|
registry-created |
registry init |
registry, version, forced |
registry-migrated |
registry migrate |
from_version, to_version, changes |
registry-recommended |
registry recommend |
recommended, previous, reason |
registered |
register |
repo, local_path, status, visibility, lean_toolchain, mathlib_pin, workspace, agent, reason, like, license_spdx |
updated |
update |
fields, reason, forced, notes_replaced, <field>_from |
claimed |
lease claim |
agent, workspace, ttl_hours, reason, contact |
claim-forced |
lease claim --force |
agent, workspace, ttl_hours, reason, contact |
claim-refreshed |
lease claim by the holder, lease renew |
agent, workspace, ttl_hours, reason, contact, contact_cleared |
released |
lease release |
agent, workspace, released_by, reason |
release-forced |
lease release --force |
agent, workspace, released_by, reason |
lease-expired |
registry audit --write |
agent, workspace, claimed_at, ttl_hours |
gate-passed |
gate |
commit, job_id, checker, receipt, descendant_of, docs_paths, opt_in, comparator, comparator_cleared, status_unchanged, pins |
regated |
gate --regate |
previous_commit, commit, job_id, checker, receipt, descendant_of, docs_paths, opt_in, comparator, comparator_cleared, status_unchanged, pins, reason, non_descendant |
comparator-attached |
comparator attach |
commit, comparator, host, job_id, descendant_of, docs_paths, opt_in |
comparator-replaced |
comparator attach --replace |
commit, comparator, host, job_id, replaced, descendant_of, docs_paths, opt_in |
promoted |
publish --yes |
commit, visibility |
publication-withdrawn |
update --withdraw-publication |
status_from, status_to, visibility_from, visibility_to, reason, by, github_visibility, promoted_commit, forced |
publication-hold-released |
update --release-publication-hold |
reason, hold, by, forced |
audit-fix |
registry audit --write |
field, old, new, source |
relocated |
repo move |
old_path, new_path, reason, cleared, kept_by_hash (only when a receipt was kept because its bytes match the old checkout’s copy), agent, redetected |
status-changed |
repo move (when the status moves) |
status_from, status_to, reason |
palomar-prepared |
palomar prepare |
commit, bundle, bundle_sha256 |
claims-synced |
claims sync |
commit, file, claims |
index-added |
index add |
repo, commit, trust, index |
prior-art-searched |
search --record |
term, sources, hits, record, decision, actor |
evidence-retracted |
record NAME retract |
retracted_event, retracted_ts, retracted_entry, reason |
consent-recorded |
record |
who, role, pointer, reason |
palomar-preflight-pass |
record |
commit, run, reason |
palomar-submitted |
record |
commit, submission_id, comparator_config, reason |
palomar-review |
record |
commit, outcome, reason |
palomar-registered |
record |
commit, id, version, comparator_config, reason |
palomar-withdrawn |
record |
id, version, reason |
doi-minted |
record |
doi, tag, commit, reason, concept, track |
reservoir-listed |
record |
url, reason |
mathlib-pr-opened |
record |
url, reason |
mathlib-pr-merged |
record |
url, reason |
The table is EVENT_KEYS in src/lean_pkg/core.py. The test suite checks
that every event a call in the source can write is listed there and here,
and that every event line any test makes lean-pkg write has only the keys
listed for its event: a new event or key fails the suite until it is
documented.