lean-check decides whether a Lean 4 file proves a theorem from formal-conjectures exactly as that theorem is stated at a pinned commit, using no axiom beyond propext, Classical.choice and Quot.sound. Lean proof tasks on BrainChain are coming, and this is the check they will use: BrainChain's checking service runs the image built from image/ and signs every verdict it reaches.
It also decides contract properties: a theorem about a contract's deployed bytecode, stated against a Lean model whose bytes are the code the chain returns for that contract. The first kit states the supply property of the stock token contract on Robinhood Chain. See Contract properties.
And it checks explanations of accepted proofs: each step must cite something the proof uses and the kernel accepts as proving exactly what the step claims. See Explained proofs.
The Lean kernel is deterministic. Given a signed verdict and the file it names, you can run the same check yourself and see whether it reaches the same decision.
You need Docker on an x86-64 machine, Node.js 22 or later and about 30 GB of free disk.
git clone https://github.com/usebrainchain/lean-check
cd lean-check
npm ci
host/recheck.mjs record.jsonrecord.json is a BrainChain decision record for a Lean proof task, read from a file or an https URL. A record keeps the verdict in its oracle field and the delivered file in its result. If you have only the verdict and its signature ({"verdict": "...", "signature": "0x..."}), pass the Lean file as a second argument: a path, an https URL, or pr:<number> for a proof merged on Left to Solve. When GitHub's API is too busy to answer for Left to Solve, pr:<number> reads the file over git instead; it is held to the verdict's SHA-256 either way.
recheck.mjs then:
- recovers the key that signed the verdict and requires BrainChain's checker,
0xf4Dce863d7E45F14b554d4C393F04a8b02793f6A(--checkernames another); - requires the file's SHA-256 to be the verdict's
proofSha256; - checks the file in a fresh container against the verdict's pins: the theorem (
decl), the formal-conjecturescommitand thekindof claim asked for; - compares the decision: outcome, claim, stage, axioms and answer.
If no image is built for the verdict's commit, it builds lean-check:<first 12 characters of the commit> first. That takes about an hour on an eight-core machine and produces an image of about 26 GB. --image <image> uses one you already have, and --verify-only stops after the first two steps.
| Exit | Meaning |
|---|---|
| 0 | The re-check reaches the same decision as the verdict. |
| 1 | It reaches a different one. The report lists the fields that differ. |
| 2 | Nothing was decided: the check could not finish (killed, out of memory, a timeout the reference proof could not account for) or an input could not be read. |
| 3 | The verdict does not stand: its signature does not recover to the checker, it is not a well-formed verdict, or the file is not the one it names. |
The report is JSON on standard output. A one-line summary goes to standard error.
The recheck workflow runs the same re-check without Docker. The runner fetches the pinned formal-conjectures commit, the elan release the image pins and Mathlib's build for that commit, then runs image/session.py directly. Start it from the Actions tab, or with the GitHub CLI on your fork:
gh workflow run recheck.yml -f verdict=https://example.com/record.jsonverdict takes a URL or the JSON itself. proof is optional and takes the same forms as the second argument above.
A run takes about 5 minutes the first time for a commit and about 2 once its build is cached; a file the rules reject is decided in under a minute. The job summary shows both decisions, and the report is kept as the run's artifact for 90 days.
docker build -t lean-check image
host/run-check.sh lean-check RefactorableNumber.zelinsky_refactorable_progression_conjecture proof MyProof.leanThe third argument is proof, disproof or either. The command prints the check's decision as {"code", "verdict"} and exits 0 when the file is accepted, 1 when it is rejected and 2 when the check could not decide. A short proof takes about 30 seconds once the image is built. To check against another formal-conjectures commit, build with --build-arg FC_COMMIT=<full commit>.
The container has no network, a read-only root, 2 GB of /tmp, no capabilities and runs as uid 10001. It gets 14 GB of memory and 6 CPUs, the limits of BrainChain's service; LEAN_CHECK_MEMORY and LEAN_CHECK_CPUS change them. A check that runs out of memory ends undecided (exit 2).
The file is at most 100,000 bytes of UTF-8. It starts with the import of the theorem's formal-conjectures module and states exactly one claim, as a top-level theorem:
import FormalConjectures.Wikipedia.RefactorableNumber
theorem OMA.solution : type_of% @RefactorableNumber.zelinsky_refactorable_progression_conjecture := by
...A disproof states theorem OMA.disproof : ¬ (type_of% @<decl>) instead. A task asks for a proof, a disproof or either, and a file that states the other claim is rejected at the claim stage. These are the forms Left to Solve uses, so one file serves both.
The check runs in stages, and a verdict names the stage it stopped at.
| Stage | What is checked |
|---|---|
lint |
The file's text, before anything compiles. Further imports may only be Mathlib modules. Top-level commands are limited to theorem, lemma, def, abbrev, structure, inductive, instance, open, namespace, section, end, variable and universe, with the modifiers private, protected and noncomputable. set_option is allowed only as set_option <maxHeartbeats | maxRecDepth | synthInstance.maxHeartbeats | synthInstance.maxSize> <number> in, and attributes only as @[simp] and @[local simp]. The file may not contain sorry, admit, axiom, native_decide, decide := true, unsafe, partial, implemented_by, extern, opaque, macro, syntax, elab, notation, initialize, run_cmd, attribute, any # command or other metaprogramming, a double-quote character, or a control or invisible character. The full list is BANNED in image/check.py. |
claim |
The claim is the kind the task asks for. A file that answers a value problem (one whose statement compares against a placeholder <decl>.answer) is refused here: only a person can judge whether a proposed answer is an explicit value. |
build upstream, compile proof |
Lean compiles the file inside the formal-conjectures project, 1,200 seconds per Lean run. |
kernel replay |
leanchecker replays every declaration of the compiled file through the kernel. |
check target |
A file the check writes itself imports yours and states the target, theorem BrainChainRecheck.target : type_of% @<decl> := @OMA.solution or its negation. What your file says about its own statement does not count. |
axioms |
#print axioms on the target lists only propext, Classical.choice and Quot.sound; the result does not use the upstream theorem itself; and the theorem is declared in the module the file imports. |
done |
Accepted. |
A run that times out rejects the file only if a reference proof passes in the same session under the same limit; otherwise the check is undecided. The reference is the proof of RefactorableNumber.zelinsky_refactorable_progression_conjecture merged on Left to Solve in pull request 483, fetched into the image and pinned by SHA-256 (image/reference.json).
A verdict is canonical JSON: keys sorted, no whitespace, absent fields left out. The checker signs that exact text as an EIP-191 personal message, so any Ethereum library recovers the signer from the text and the signature alone. host/verdict.mjs builds, signs and verifies verdicts; standing() is the verification.
| Field | Value |
|---|---|
version |
1 |
task |
The BrainChain task the check was made for (32 bytes, hex) |
decl, commit, kind |
The pins: the theorem, the formal-conjectures commit and the claim asked for (proof, disproof or either) |
proofSha256 |
SHA-256 of the Lean file |
outcome |
accepted or rejected |
claim |
The claim the file makes: proof or refutation |
reason, stage |
Why, and where the check stopped |
axioms |
The axioms the result depends on, once the check reaches them |
answer |
OMA.answer when the file answers a value problem |
seconds |
How long the check took |
reference |
After a timeout: the reference proof's run |
image, lean |
The image that ran and its Lean version |
checker |
The address that signed the verdict |
checkedAt |
When |
In a decision record the verdict sits in oracle, with kind (lean), outcome, verdict (the signed text), verdictSha256, signature and checker. A verdict counts for a task only when its signature recovers to the checker and its task, theorem, commit, kind and file all match the task's.
A contract property is a Lean theorem about the code a contract runs. A kit pins three things: the contract's runtime bytes as the chain returns them, a Lean model that certifies those exact bytes, and the theorems a proof may target. lean-check accepts a proof only when the Lean kernel accepts it as a proof of exactly one of those theorems, with no axiom beyond propext, Classical.choice and Quot.sound, after reading the contract's code from the chain and finding the kit's bytes.
A team can state a property of its own contract this way and anyone can check a proof of it with the same command. Proof tasks for contract properties on BrainChain are coming.
You need Docker on an x86-64 Linux machine with 16 GB of memory, Node.js 22 or later and about 20 GB of free disk.
git clone https://github.com/usebrainchain/lean-check
cd lean-check
docker build -f kit/Dockerfile -t lean-check-kit .
host/admit-kit.sh kits/stock/kit.json kits/stock stock-kit
host/run-kit-check.sh stock-kit BrainChainKit.Stock.supply Solution.leanadmit-kit.sh runs once per kit. It reads the contract's code from Robinhood Chain, rebuilds the Lean model from its pinned commits, checks that the model certifies those bytes and leaves the built kit in stock-kit/: about 10 minutes on eight cores, 17 on a GitHub runner, and 12 GB of disk. run-kit-check.sh then checks one file in a fresh container with no network, after reading the chain again.
To see an accepted proof, check the kit's reference solution, a property the model already proves:
host/run-kit-check.sh stock-kit BrainChainKit.Stock.pause_requires_role kits/stock/Reference.leanprints, abridged:
{"code": 0, "verdict": {"accepted": true, "kind": "proof", "reason": "the kernel accepts OMA.solution as a proof of BrainChainKit.Stock.pause_requires_role about the bytes with SHA-256 0ac99e9cc7a3738645af72f6d9e8fb8242660b63134d8fb0c44ba6fac39deec2", "axioms": ["propext", "Classical.choice", "Quot.sound"], "seconds": 18.0, "decl": "BrainChainKit.Stock.pause_requires_role", "stage": "done"}}The open statement is BrainChainKit.Stock.supply in kits/stock/Challenge.lean: minting adds exactly the amount to the total supply and to one balance, burning removes it from both, and no other entry point changes the total supply. Nobody has proved it yet. The Stock kit lists what a proof needs, and What a delivery is shows how to ship one with Lean modules of your own.
| Exit | Meaning |
|---|---|
| 0 | Accepted: the kernel accepts the file as a proof of the named theorem about the kit's bytes. |
| 1 | Rejected. verdict.stage and verdict.reason say where and why. |
| 2 | Nothing was decided: the chain could not be read or did not return the kit's bytes, the theorem is not in the kit, or the check ran out of memory or out of time without the reference solution passing in the same session. |
The output is one line of JSON, {"code", "verdict"}. RPC_URL sets the node the chain is read from; the default is Robinhood Chain's public RPC.
The rest of this section is the format in full.
A kit is one JSON file (format 2, at most 64 KB). Its SHA-256, taken over the canonical JSON (keys sorted, no whitespace), is the kit's id, and a task names a kit by that id.
| Field | What it pins |
|---|---|
contract |
chainId, address, block, and the codeSha256 and codeBytes of the runtime code eth_getCode returned for the address at that block |
model.repo, model.base |
The Lean project the model starts from: a git repository and a full commit |
model.patches |
The patches that turn the base into the model, in order, each named by sha256 and bytes, with an optional url to fetch it from |
model.head, model.tree |
The commit and git tree the patches rebuild, applied with git am as the first patch's author at the patches' dates |
model.library |
The library the model's modules live in, such as Blanc |
model.code |
The constant holding the certified bytes, a ByteArray such as Blanc.Lift.Stock.code |
model.modules |
The modules built for checks; a delivery may import any of them |
challenge |
sha256 and bytes of Challenge.lean, the file of statements |
reference |
Optional: a theorem of Challenge.lean the model already proves (decl), and the sha256 and bytes of a solution for it |
The brief carries the kit and Challenge.lean. Patches are fetched by hash, so a model of several megabytes adds only a line per patch to the brief.
Challenge.lean is compiled as the module BrainChainKit.Challenge. Each theorem in it is a statement a proof can target, with sorry as its proof. It follows the rules of What the check accepts, except that it may import any module of the model and use sorry as a proof.
docker build -f kit/Dockerfile -t lean-check-kit .
host/admit-kit.sh kits/stock/kit.json kits/stock <kit dir><files> holds Challenge.lean and the reference solution under any name; admission finds them by SHA-256. Admission reads the contract's code from the chain and requires the kit's hash; fetches the base and the patches by hash and requires the pinned commit and tree; builds model.modules; requires that no Lean file the patches change contains sorry, admit, native_decide, implemented_by, extern, axiom, opaque or unsafe; evaluates model.code and requires the kit's bytes; compiles Challenge.lean and requires that no statement in it reaches an axiom beyond the standard three; replays every changed module and the challenge through the kernel with leanchecker; and runs the reference solution through a check exactly as a delivery gets one. For the Stock kit this took 9 minutes 23 seconds and about 12 GB of disk on eight cores: 1.5 minutes for Mathlib's cache, 5.5 for the build, 2 for the kernel replay.
The delivered result is at most 100,000 bytes. It is either Solution.lean itself (or one fenced block holding it), or a JSON delivery:
{"delivery": 2, "solution": "<the text of Solution.lean>", "patches": ["<sha256>", "..."], "tree": "<git tree>"}Solution.lean starts with import BrainChainKit.Challenge and states the claim in the form a formal-conjectures proof uses, with the kit's theorem as the target:
import BrainChainKit.Challenge
import Solution.Supply
theorem OMA.solution : type_of% @BrainChainKit.Stock.supply := by
...Larger work goes in patches on the model's head, in git format-patch form. Each is at most 8 MiB, and together at most 32 MiB, 200 patches. The delivery names them by SHA-256 and the git tree they produce (git rev-parse HEAD^{tree}); the files are handed to the checker beside the delivery, by hash. Patches may only add regular files: a patch that changes or removes a file of the model is rejected, so every definition the statement unfolds to stays as admitted. The Lean files a delivery adds are modules under Solution/ (Solution/Mint.lean is Solution.Mint), a root of their own, so they can neither stand in for a model module nor be hidden by one. Every module Solution.lean reaches follows the same rules as the solution and may not use the OMA namespace; it may import the model's built modules and other added modules.
The check runs without network, with the admitted kit read-only. The chain is read first, on the host: eth_getCode at the kit's block must return the kit's bytes. A node that keeps no state that old is asked at its latest block, and the verdict names the block read.
| Stage | What is checked |
|---|---|
delivery |
The result's form and size |
lint, claim |
Solution.lean against the rules, the target's form, and a proof rather than a refutation |
bytes |
model.code evaluates to the bytes the kit pins |
patches |
Each patch's hash and size, that they apply to head, produce the named tree and only add files |
lint |
Every module Solution.lean reaches: the rules, and that each import is a built model module or an added one |
compile modules, compile proof |
The added modules in import order, then the solution |
kernel replay |
leanchecker replays every added module and the solution |
check target |
Compare.lean, below |
axioms |
Only propext, Classical.choice and Quot.sound; the result does not use the kit's own sorry'd statement; and the statement is declared in BrainChainKit.Challenge |
Compare.lean is the exact-match rule. The check writes it itself, imports the compiled solution, and states the target from the kit's compiled Challenge.lean:
import BrainChainRecheckProof
theorem BrainChainRecheck.target : type_of% @BrainChainKit.Stock.supply := @OMA.solution
#print axioms BrainChainRecheck.targetfollowed by the same walk over every constant the result reaches as a formal-conjectures proof gets. type_of% takes the statement from the kit's compiled challenge, so what the solution says about its own statement does not count, and the statement names the model's code constant, whose bytes the check has tied to the chain.
Each Lean run has 1,800 seconds and the whole check 3 hours, in 24 GB of memory. A run that times out rejects the delivery only if the kit's reference solution passes in the same session; otherwise the check is undecided.
host/run-kit-check.sh <kit dir> BrainChainKit.Stock.supply delivery.json <patches dir>prints the decision as {"code", "verdict"} and exits 0 accepted, 1 rejected, 2 undecided. RPC_URL sets the node the chain is read from. On the Stock kit a check takes 16 seconds for a solution alone and 27 for one with an added module.
host/recheck.mjs --kit <kit dir> --blobs <patches dir> <verdict> <delivery> re-checks a version 2 verdict the same way it re-checks a version 1 one.
Version 2. Signed and verified as version 1 is (host/verdict.mjs: kitVerdictOf, standing()).
| Field | Value |
|---|---|
version |
2 |
task, kit, decl |
The task, the kit's id and the theorem of Challenge.lean |
kind |
contract |
deliverySha256 |
SHA-256 of the delivered result |
contract |
The kit's contract |
chain |
readAt, the block the code was read at, and the codeSha256 read |
solutionSha256, patches, tree, modules |
What the delivery held and the modules it added |
outcome, claim, reason, stage, axioms, seconds, reference |
As in version 1 |
image, lean, checker, checkedAt |
As in version 1 |
kits/stock is the first kit: Robinhood's stock token implementation 0xb35490d6f9163DE4F80d88dc75c3516eb64C5aE2 on Robinhood Chain, 11,614 bytes, modelled by the proofs in stock-token-proofs (Blanc bdb2984 with eleven patches, head 0dcf77d). Its statement is the supply property: every successful mint(to, amount) adds exactly amount to totalSupply and to to's balance and writes no other slot; every successful burn or adminBurn(from, amount) removes exactly amount from both, after checking from held it; and every other entry point leaves totalSupply as it was. supply_mint, supply_burn, supply_adminBurn and supply_kept are the four parts and supply is all four. The stock-token-proofs tests check the property on the source; nobody has proved it.
Storage words wrap at 2^256 as the EVM's do, and the statements assume that the balance, allowance and nonce entries a call can write are not the totalSupply slot, which only a Keccak-256 collision could break. A proof needs, beyond what the model proves:
- the effect of each instruction on storage, followed along the certified code paths of
mint,burnandadminBurnpast the role, pause and blocklist checks the model already walks; - the Solidity mapping slots as Keccak-256 of key and slot, and the
SSTOREs on each path tied to them; - for every other entry point, that no
SSTOREreaches thetotalSupplyslot: fixed slots are other constants, mapping entries are excluded by the premise, and the string slots ofsetMetadataandinitializelie more than 2^251 below it, further than gas lets a loop write; - the free-pointer annotation on the certificate's entries the paths use (it fails on 50 of 181 today), or another account of memory.
pause_requires_role is the kit's reference, solved by kits/stock/Reference.lean.
An accepted proof settles that a theorem holds. An explanation tells a reader how, and lean-check holds it to the proof: every step must cite a theorem or a named have the proof really uses and state in Lean what the step claims, and the kernel must accept the cited term as a proof of exactly that claim. A step that claims more than the proof contains fails, and the report prints what the cited term does prove.
You need the image from Check a proof before you deliver it.
docker build -t lean-check image
docker run --rm --entrypoint cat lean-check /opt/lean-check/reference.lean > proof.lean
host/run-explain.sh lean-check RefactorableNumber.zelinsky_refactorable_progression_conjecture proof.lean examples/zelinsky/explanation.mdThe second line copies out the proof the examples explain, Left to Solve PR 483, which the image keeps as its reference. run-explain.sh re-checks the proof exactly as run-check.sh does, since an explanation is only of an accepted proof, then checks the explanation step by step with no model involved. Each example takes about 35 seconds on a GitHub runner once formal-conjectures is built, the proof's re-check included.
| Exit | Meaning |
|---|---|
| 0 | Passed: every step's claim is proved by what it cites, and every part of the proof is explained or skipped with a reason. |
| 1 | Failed. The report names each failing step and why. |
| 2 | Nothing was decided: the proof check could not finish, a Lean run ran out of memory, or the checker crashed. |
The JSON report goes to standard output and a readable one to standard error. examples/zelinsky/unproved-step.md drops the hypothesis n₀ < p from the step about coprimality and fails there (abridged):
explanation of RefactorableNumber.zelinsky_refactorable_progression_conjecture (proof 0bae6de1ea2c): FAILED
[ok ] step 1 What is proved
cites OMA.solution (theorem, the proof's own theorem, BrainChainRecheckProof)
kernel: proves the claim as stated; axioms propext, Classical.choice, Quot.sound
[ok ] step 2 Choose a prime
cites Nat.exists_prime_gt_modEq_one (theorem, named in the proof, Mathlib.NumberTheory.PrimesCongruentOne)
kernel: proves the claim as stated; axioms propext, Classical.choice, Quot.sound
[FAIL] step 3 The two factors share no prime
cites OMA.solution/hcop (have, inside the proof, BrainChainRecheckProof)
the cited term proves the statement shown as cited, not the claim
claim: ∀ (n₀ : ℕ), 0 < n₀ → ∀ (p : ℕ), Nat.Prime p → n₀.Coprime (p ^ (p - 1))
cited: ∀ (n₀ : ℕ), 1 ≤ n₀ → ∀ (p : ℕ), Nat.Prime p → n₀ < p → n₀.Coprime (p ^ (p - 1))
...
coverage: 8 explained, 17 skipped, 1 missing, of 26
missing OMA.solution/hcop
explanation.md passes; cites-outside-the-proof.md cites the open statement, a library theorem the proof never uses, an axiom, a have the proof does not have and a lemma that does not exist, and fails on each.
An explanation is a Markdown file that walks a reader through an accepted proof. Each step ends in a lean step block that names what the step rests on and states, in Lean, what it claims:
## Count the divisors of the prime power
The divisors of p^(p−1) are 1, p, p², …, p^(p−1): exactly p of them.
```lean step
cites: OMA.solution/hcard
claim: ∀ (p : ℕ), Nat.Prime p → 2 ≤ p → (p ^ (p - 1)).divisors.card = p
```cites is a theorem (Nat.ModEq.mul_left) or a named have inside one of the proof's own theorems (OMA.solution/hcard, or OMA.solution/h#2 when the name repeats). A lean explains block pins the theorem, the commit and the proof's SHA-256, and may open namespaces for the claims. A lean skip block lists, one per line, what the explanation leaves out and why.
| Check | Fails when |
|---|---|
| Form | a step has no cites or claim, or a claim contains anything but a statement: no by, :=, #, quotes, elab%-style elaborators, commands or the words check.py bans |
| Resolves | the cited name is not a declaration, is an axiom or a definition, or the proof has no such have |
| Matches | the kernel does not accept the cited term as a proof of the claim. A have is first lifted out of the proof into a theorem of its own, over exactly the hypotheses its proof term uses |
| Axioms | the step rests on anything beyond propext, Classical.choice and Quot.sound, such as a statement upstream leaves as sorry |
| Used | the proof does not depend on the cited theorem |
| Coverage | one of the proof's own theorems or named haves, or a library theorem its text names, is neither explained nor skipped; the conclusion is skipped or unexplained; more than half of the proof's own theorems and haves are skipped |
Each step's report says whether the claim matched as stated or only after unfolding definitions. Until an image is built with it, run-explain.sh mounts image/explain.py from the checkout.
- It cannot tell whether a step's prose says what its claim says, or whether the explanation reads well. Each claim sits verbatim under its prose so a reader can compare them.
- An explanation is at most 60,000 bytes and 100 steps, and a claim at most 2,000 characters.
- Each Lean run has 1,200 seconds; an explanation whose claims take longer fails.
- The kernel checks the statement as formal-conjectures writes it at the pinned commit. It cannot tell whether that statement says what the original problem means.
- Docker builds are not bit-for-bit reproducible, so an image you build has a different digest from the one in a verdict. It runs the same Lean, Mathlib, formal-conjectures and check code, and the re-check compares decisions, not digests.
- Time limits depend on the machine. A file rejected for running out of time may pass on a faster one, and the re-check reports that as a disagreement.
- A signature proves which key signed a verdict. The re-check tests the rest without trusting that key.
- Value problems are refused at the
claimstage. - The image installs elan for x86-64 Linux.
For contract properties:
- A theorem is about the runtime bytes the kit pins. When the contract sits behind a proxy, as the stock token does, the proxy and the code it delegates to are outside the model.
- The model assumes the chain executes these opcodes as the Ethereum forks the model describes do.
- The kernel decides whether a proof proves the kit's statement. Whether the statement captures the property you care about is for the kit's author and its readers to judge, and the Stock kit's premises (gas below 2^256, no Keccak-256 collision with the
totalSupplyslot) are part of what it says. - Modules a delivery adds may not define macros, elaborators, syntax or
initialize, so a proof that needs its own tactics cannot be checked yet. - A node without archive state is read at its latest block, and the verdict names that block.
npm test needs no Lean. It covers the verdict format, signatures, the comparison, the rules on the fixtures, and the form and claim rules of explanations.
On every push the recheck workflow re-checks these six cases on GitHub's runners, each against a verdict in test/verdicts/:
| Case | File | Decision |
|---|---|---|
pr-483-proof |
Left to Solve PR 483 | accepted, proof; axioms propext, Classical.choice, Quot.sound |
pr-1906-disproof |
Left to Solve PR 1906 | accepted, refutation; same axioms |
pr-12914-value |
Left to Solve PR 12914 | rejected at claim: it answers a value problem. The kernel accepts the file; a task never asks for one. |
sorry |
test/fixtures/zelinsky-sorry.lean |
rejected at lint: sorry |
upstream |
test/fixtures/zelinsky-upstream.lean |
rejected at axioms: it uses the upstream theorem, which depends on sorryAx |
axiom |
test/fixtures/zelinsky-axiom.lean |
rejected at lint: axiom |
The Left to Solve files are fetched at their merge commits and must match the SHA-256 in test/cases.json. The test verdicts are signed by a key made for the purpose and then discarded; its address is checker in test/cases.json. node test/sign.mjs signs them again with a new key after a case changes.
The contract property cases, test/kit-cases/cases.json, run against an admitted Stock kit with node test/kit-cases.mjs <kit dir>. The kit workflow admits the Stock kit from scratch on a GitHub runner and runs all eight on every push and pull request that touches the kit checker, the kits or the cases:
| Case | Delivery | Decision |
|---|---|---|
reference |
kits/stock/Reference.lean |
accepted |
patch-accept |
a patch adding Solution/PauseAgain.lean, and a solution through it |
accepted |
mismatch |
the model's unpause_requires_role for the pause statement |
rejected at compile proof |
other-decl |
a claim about supply on the pause task |
rejected at lint |
other-bytes |
a patch that changes one byte of the certified code | rejected at patches |
sorry |
sorry in the solution |
rejected at lint |
sorry-module |
sorry in a module a patch adds |
rejected at lint |
challenge-used |
the kit's own sorry'd statement | rejected at axioms |
npm test covers the kit format, deliveries, the kit lint, the chain read and version 2 verdicts without Lean.
The explain workflow checks the three explanations in examples/zelinsky/ against Left to Solve PR 483 on a GitHub runner, on every push and pull request that touches the explanation checker, the examples or the cases (test/explain-cases/cases.json; locally python3 -I test/explain-cases.py proof.lean --image lean-check):
| Case | Decision |
|---|---|
explanation |
passes |
unproved-step |
fails at the step citing OMA.solution/hcop: without n₀ < p the claim is not what the have proves |
cites-outside-the-proof |
fails at all five steps |
| Path | What it is |
|---|---|
image/Dockerfile |
The checker for one formal-conjectures commit (default 9097e2f9, Lean v4.33.1): Ubuntu 24.04 and elan pinned by digest, Mathlib from its cache, every formal-conjectures module built at image time so that a check never writes into the project |
image/check.py |
The check itself: rules, compile, kernel replay, target and axioms |
image/session.py |
One check as a task asks for it: the claim held to the task's kind, and the reference run after a timeout |
image/statements.py |
The index of every categorised theorem at the commit (/home/lean/index/statements.json in the image): module, statement, docstring, whether it is proved upstream, whether it is a value problem |
host/run-check.sh |
One check in a fresh container |
host/recheck.mjs |
Re-check a signed verdict |
host/verdict.mjs |
The verdict format: canonical JSON, signing, verification |
image/explain.py, host/run-explain.sh |
Check an explanation of an accepted proof |
examples/zelinsky/ |
Three explanations of Left to Solve PR 483: one that passes, two that fail |
test/ |
The six cases, their verdicts, the fixtures and the unit tests; kit-cases/, the contract property cases; explain-cases/, the explanation cases |
kit/Dockerfile, kit/kit.py |
The contract property checker: admission and one check |
host/admit-kit.sh, host/run-kit-check.sh, host/chain.mjs |
Admit a kit, run one contract property check, read a contract's code from the chain |
kits/stock/ |
The Stock kit: kit.json, Challenge.lean, Reference.lean |
MIT. formal-conjectures and Mathlib (both Apache-2.0) are fetched when the image is built and are not part of this repository. The reference proof and the three Left to Solve test files (Apache-2.0) are fetched by pinned SHA-256.