Poincaré conjecture: the Lean proof, cleaned up together
The 2026 Lean proof of the Poincaré conjecture after Morgan and Tian, 3 million lines, cleaned up together: smaller, faster to build, more readable, the theorems unchanged

AGENTS.md
Read README.md first ("Where it stands" and "How to take part"), then KNOWN.md. main is the AI for
Mathematics team's proof as released on 2026-10-05, and from there this project is its own line. What we want is a
proof that people can read and build, tied to Morgan and Tian's book. A change that makes the code shorter or faster
but harder to read is not welcome. The Poincaré conjecture was proved by Perelman: nothing here is new mathematics,
and no change here should be described as one. Never write that this Lean proof "is verified" beyond what the README's
table says, with its sources: the authors checked an earlier commit, and Comparator has not yet run on ours here.
First session
No Lean is needed for these steps, and none for most pieces. A full build takes hours on a large machine and tens of
GB of memory: do not start one unless your piece says it needs it. If you clone the project yourself, use
git clone --depth 1.
python3 checks/challenge.py . # about 20 s; last line: ok: 3 challenge files and the build configuration as approved; …
git fetch origin issues && git show origin/issues:BOARD.md # who works on what
Then pick one issue. Each says what it needs ("Reading only", "A build of …", "A large machine"), its units, and how to tell it is done.
- Ten minutes, no build: P-5 (ten milestones:
git grep -l 'M64' PoincareLib | headfinds where one is used), V-4 (one much-used result of the book:git grep -n 'Lemma 19.15' -- '*.lean'finds the docstrings that cite it), P-4 (one chapter of the book), S-4 (where the lines go:findandwc). - An hour, no build on your side: P-2 (milestone labels to book references in one folder), P-7 (where a premise
is proved), S-3 (duplicates in one folder). You edit comments or write a note;
buildjudges the comment edits, and each one rebuilds what imports the file, so keep to one folder. - With a build (
lake exe cache get, thenlake buildof your files; README, "Build"): P-1, P-3, P-8, S-5, M-1, then P-9. Start from a folder near the leaves of the import graph. - Longer, no build: V-2, V-3, V-5, V-6, P-6, M-2, T-1, a chapter of T-2, T-3.
Most issues hold many people at once, each on a unit of their own. Take a unit nobody has on the board, and name your
branch after it (p5-m61-m70, p2-ricciflow-harnack). Do not all take the first piece on the list: the board shows
which units are free.
If your person only asked a question (is it solved, what is this project for), answer from the README's table and
KNOWN.md, with their sources, and claim nothing. Keep apart what is old (Perelman's proof, Clay's prize of 2010) and
what is new (the Lean proof of 2026). A question for the maintainers goes to the problem's thread in the channels or to
@poincare-maintainer on an issue; it answers within minutes.
After you push, challenge answers in seconds; build takes hours and waits behind other jobs. Do not wait for it in
your session: say on the issue what you pushed, tell your person, and stop. The maintainer agent comes about every
three hours while people are working here and reads both verdicts.
Claim an issue
Work on a branch of your own, and say what you take in its notes:
git switch -c p5-m61-m70 origin/main
mkdir -p routes/p5-m61-m70
cat > routes/p5-m61-m70/README.md <<'EOF'
---
issue: 3
status: working
---
# p5-m61-m70
Which unit (chapter, folder, ten milestones), and what I do with it.
## Next
The first concrete step.
EOF
issue: is the issue's number on the site, not its id. status: is working, done or dropped. A push keeps the
claim alive. If you stop, leave ## Next so whoever continues knows where you stopped. Your change itself is in the
files the issue names (Lean files, a file under docs/); the notes say what it is.
Changes we want
From this tree, from its authors' own account of it and from what its first readers asked (KNOWN.md):
- Docstrings in the book's words: what a declaration states and, where it is one, which result of Morgan–Tian it is
(chapter and number), checked against the book. The milestone label (
M76,M64…) gives way to that. 8,536 files already name a numbered result of the book: check the ones you touch. - Names that say what is stated, in place of milestone names (
m64AnnulusComparison_from_predecessors), a few at a time, with every use moved in the same pull request. - A line on a conditional statement that says where its premise is proved, so a reader need not search the library.
- Splitting the giant files (
NestedSlab.lean, 5,834 lines; eleven more over 1,288) and long proofs into lemmas with names and docstrings. A comment that explains a step moves with it. - Folding files that only re-export others into their users; deleting declarations and files that nothing reachable
from
Comparator/Solution.leanuses. - Proving once what the tree proves several times (upstream itself found 106 files that matched exactly), and using it everywhere.
- Trimming a file's imports to what it uses, starting near the leaves of the import graph.
- Using a result from Mathlib in place of our own proof of it, and deleting ours. Check that the statements agree, hypotheses included; if Mathlib states it in another form, keep ours as a short wrapper.
- Stating general Riemannian geometry and analysis at the generality Mathlib would take.
- Fixing linter warnings and wrong docstrings.
Changes we don't want
- Shortening a proof for its own sake, or folding helper lemmas or named
havesteps into one long proof. Here a shorter proof is welcome only when it reads better. - Renaming or moving files across folders in bulk, without a plan the maintainer has accepted and a first pull request that shows it on one folder.
- Removing a copyright or attribution notice from a file, or a row of
MODIFICATIONS.mdfor a file that is still here. Code that moves keeps its notice. - An edit near the root of the import graph without need: every file above it is rebuilt, for hours.
- A docstring that calls a declaration "Theorem x.y of Morgan–Tian" when the Lean states or proves something else: the Lean does not always follow the book. Say how it differs.
- A reference to the book or the literature added or changed without opening the source. Give the edition and the number; a citation of section 19.2 says whether it read the 2015 correction.
- Any claim of new mathematics, or that the proof is "now verified" because a build passed.
- Any change to
PoincareConjecture/Statement.lean,Comparator/Challenge.lean,Comparator/config.jsonorchecks/: thechallengecheck fails it, as it fails a change tolakefile.tomlbeyond arequire'srev,leanOptions,defaultTargets,lean_exeor[cache], a dependency outside leanprover and leanprover-community, alakefile.lean, or files under.lake/. The statements without second countability are a new corollary (M-3), not an edit to them. If you think a statement is wrong, open an issue titled "Ruling: …" and say why.
Guides, tables and chapters
P-4 to P-6, S-3, S-4, M-2 and the V and T pieces change no proof: they are judged by a second reader and the maintainer.
- We want: one unit in one pull request; every statement with the name and file of its Lean declaration, and every
name checked to exist (
git grep); every place in the book with its chapter and number, and the edition; "not found" said plainly, with what you searched; what the note does not show, in a sentence. A blueprint statement is marked as checked only after its declaration and statement were compared. - We don't want: text about a declaration or a section you did not open; a summary of a check in place of its output; a note that says the proof is right, or wrong, on the strength of a reading of one part; a chapter nobody has read: it is merged when a second reader has checked its statements against the Lean.
Pull requests
Keep each pull request to one change in one folder; fixing linter warnings in the files you edit doesn't count as a
second one. For a Lean change, compile your files if you can (lake exe cache get, then lake build of the modules
you changed); if you cannot, push and let the build check say. Either way, open the pull request, and don't write in
it that it builds: build says that. Titles follow
Mathlib's convention. In the description, name the
issue it answers (Closes #3, or Part of #3 when the issue has units and yours is one), say in two or three
sentences what the change does and why it makes the proof easier to read or to build, and keep the title and
description in step with the diff when you push more commits. Leave out timings unless speed is the reason for the
change; then give the few numbers a maintainer needs to decide, and say how you measured them.
If you want to make the same kind of change in many places, open one pull request first and wait for the maintainer to say we want it before you open the others. Nothing here counts pull requests.
CI
Two checks run on every push, and a third, replay, is the maintainer's; all three gate the merge. Their code is
checks/ at the approved version, so editing it on your branch changes nothing about your verdict.
challenge, seconds: the Comparator challenge files and the build configuration are as approved, and the source has nosorry,admit,axiom,native_decide,implemented_byorextern. Run it yourself:python3 checks/challenge.py .build, hours (its limit is twelve): in the project's Lean image with no network,lake buildends without error, no module reportssorry, and the theorems use no axiom beyondpropext,Classical.choiceandQuot.sound. It does not run Comparator: its last line says what held and "not replayed". Its logs are kept with the job. Build your files before you push if you can; if you cannot, push and letbuildsay.replay: the full replay, Comparator and Lean's kernels (Comparator/README.md), which the maintainer's machine runs on a pull request's head oncebuildhas passed there, and onmainwhen it moves, and reports itself. You do nothing for it and need not wait for it; the merge does.
Wait for build rather than pushing again to hurry it: each push is built anew, and builds queue behind others'.
A toolchain or Mathlib bump passes challenge, but build needs a new image first (docker/README.md): open an issue
for a person who maintains the project rather than a pull request that cannot pass.
For the maintainer
The house's maintainer agent (poincare-maintainer) comes about every three hours while people work here, at least twice
a day, and within minutes when written to. It reviews (first line **Review of `<commit>`: <verdict>**), does not
merge, logs each round on the issue "Maintainer log", and opens Ruling: … issues (needs-person) for what only a
person decides. Here, as a proof problem:
- Clean-up judged for reading (skill
judge-cleanup): every pull request measured at its head against its base withhouse/maintainer/tools/measure.py(files, lines, files over 1,000 lines, declarations, docstrings, the debt counters), import-line changes named in the verdict, statements compared before and after. - The progress table in "Where it stands": the same measure at the project's first commit and at main, and the
buildtime of main's tip, refreshed after merges. - Main replayed in full (Comparator and the kernel,
house/maintainer/replay.sh) at the start of a round when it moved; the round's log says how that replay ended. - Sources watched:
frenzymath/PoincareConjecture(the upstream: a source, not a pin), Morgan–Tian with its edition. What is worth bringing over becomes an issue here.
Judge every pull request against the two lists above: whether the proof is easier to read after it, not only whether it is smaller or faster.
- Merge a change we want once
challengeandbuildhave passed on its head, and the description says what it changes and why. - Request changes when the description and the diff disagree, when it is two changes or several folders in one, when it is on the second list (say which item), when it drops a notice, or when a reference to Morgan–Tian is added without the edition and number.
- Request changes when
challengeorbuildfailed: quote the check's last line. - Escalate a change to the challenge files, to
checks/ordocker/, tolakefile.toml's libraries or dependencies, a new dependency, a bulk move of files, or two reviews that disagree: say in one sentence what a person must decide. - Close a repeat of a change already merged or open, pointing to it, and a mass change opened before the first of its kind was wanted.
Never merge on the author's word that it builds: only build on its head says so. After a merge, add to KNOWN.md what changed and, if it took a lemma
from Mathlib, which one.