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

Where the three million lines go
Issue S-4, #14.
Measured on 2026-12-03 at main commit
c888d66f31f7aeb12905bf64f7d0abf564db4791.
This route changes no Lean source, so these counts also describe its source tree.
Scope and reading key
The census includes every tracked .lean file below PoincareLib/: 23,554
files, 3,061,704 physical lines. A line means one newline byte, exactly as in
wc -l; blank lines, comments, docstrings, imports and notices count. It excludes
PoincareLib.lean, the entry-point wrappers, Comparator, Mathlib and all other
dependencies. This is a source-size census, not a count of proof terms, necessary
lines, distinct mathematics, build work or dependency reachability.
The main table goes two directory levels below PoincareLib/; the two drilldowns
go one level further to expose the issue's surgery and smoothing examples. Each
table is a partition of its named parent: counts are recursive, and direct files
are separate. Do not add a drilldown to its parent total.
The reading regions below are navigation pointers, not an exclusive allocation
of files to book pages, and B is not the authors' background classifier. The
book is John Morgan and Gang Tian, Ricci Flow and the Poincaré Conjecture,
Clay Mathematics Monographs 3, 2007: publisher's PDF.
Its contents (printed pp. v–viii) supply the inclusive spans below; these may
include blank pages. Repeated regions overlap and must not be summed. The
examples below were opened in the Lean; no statement-equivalence audit is claimed.
There were no P-4 guides under docs/guide/ at the measured commit.
| Key | Part served / reading pointer | Printed pages; nominal span |
|---|---|---|
| B | Shared/supporting material; no dedicated book block assigned here | —; no per-folder page count established |
| R | Riemannian background: chapters 1–2, 5 | 3–34 (32), 83–102 (20) |
| F | Early Ricci flow: chapters 3–5 | 35–102 (68) |
| L | Reduced geometry / noncollapse: chapters 6–8 | 105–178 (74) |
| K | Ancient solutions: chapter 9 | 179–244 (66) |
| G | Geometric limits: chapters 10–11 | 245–292 (48); also §3.8, 59–62 |
| S | Standard solution and surgery: chapters 12–17 | 293–328 (36), 331–412 (82) |
| E | Extinction: chapter 18 | 415–436 (22) |
| C | Curve shrinking: chapter 19 | 437–496 (60); §19.2 uses the 2015 correction |
| N | Neck/cap topology: Appendix, with chapter 9 | 497–514 (18); also 230–244 |
| T | Topological-to-smooth extension | Introduction p. ix, footnote 1; less than one page |
| P | Final smooth endpoint: Corollary 0.2(a) | Introduction p. x; proof route E/C |
For C, Morgan–Tian's 2015 correction, arXiv:1512.00699v1 replaces the estimates in the 2007 §19.2, pp. 441–445. The page comparison uses the 2007 pagination and acknowledges this replacement; it does not certify the correction's implementation. T refers to the book's footnote on printed p. ix, which treats smoothing as an available result rather than developing its proof.
Totals by subject
Folder under PoincareLib/ |
Lean files | Physical lines | Reading region |
|---|---|---|---|
AlgebraicTopology |
272 | 35,427 | B |
Analysis |
540 | 119,266 | B (examples support F/C) |
Geometry |
13,854 | 1,785,931 | R/F/L/K/G/S/E/C + B |
LinearAlgebra |
4 | 452 | B |
MeasureTheory |
6 | 571 | B |
Topology |
8,878 | 1,120,057 | N/T/P/S/E + B |
| Total | 23,554 | 3,061,704 |
Two levels down
A broad region marks where to start reading; a parent folder can serve several parts. In particular, the remaining analytic and topological helpers marked B have not been assigned disjoint page ranges.
Folder under PoincareLib/ |
Lean files | Physical lines | Reading region |
|---|---|---|---|
AlgebraicTopology/FundamentalGroup |
16 | 2,197 | B |
AlgebraicTopology/HomologicalAlgebra |
7 | 684 | B |
AlgebraicTopology/HomotopyGroup |
114 | 11,429 | B |
AlgebraicTopology/SingularHomology |
135 | 21,117 | B |
Analysis/Approximation |
9 | 1,215 | B |
Analysis/Asymptotics |
4 | 299 | F |
Analysis/Calculus |
63 | 7,289 | B |
Analysis/Complex |
1 | 75 | B |
Analysis/Convex |
6 | 631 | B |
Analysis/Convolution |
5 | 443 | B |
Analysis/Distribution |
1 | 87 | B |
Analysis/Elliptic |
112 | 38,688 | B |
Analysis/Heat |
5 | 985 | B |
Analysis/InnerProductSpace |
3 | 364 | B |
Analysis/Integral |
3 | 153 | C |
Analysis/Matrix |
1 | 147 | B |
Analysis/Measure |
2 | 143 | B |
Analysis/Normed |
1 | 38 | C |
Analysis/NormedSpace |
1 | 33 | B |
Analysis/ODE |
65 | 17,152 | B |
Analysis/Parabolic |
218 | 43,616 | F/C + B |
Analysis/Sobolev |
35 | 7,138 | B |
Analysis/Spectral |
5 | 770 | B |
Geometry/Alexandrov |
39 | 3,941 | B |
Geometry/Curvature |
222 | 36,166 | B |
Geometry/CurveShortening |
2,534 | 332,768 | C/E |
Geometry/Euclidean |
5 | 353 | B |
Geometry/Manifold |
114 | 12,176 | B |
Geometry/RicciFlow |
9,088 | 1,135,178 | F/L/K/G/S/E/C + B |
Geometry/Riemannian |
1,704 | 250,434 | R + B |
Geometry/Spacetime |
148 | 14,915 | B |
LinearAlgebra/BilinearForm |
2 | 175 | B |
LinearAlgebra/CrossProduct |
2 | 277 | B |
MeasureTheory/Integral |
5 | 492 | B |
MeasureTheory/Measure |
1 | 79 | R |
Topology (direct files) |
1 | 98 | B |
Topology/CWComplex |
10 | 1,282 | B |
Topology/Connected |
20 | 1,932 | B |
Topology/Covering |
13 | 3,479 | B |
Topology/Flow |
1 | 86 | B |
Topology/Gluing |
4 | 501 | B |
Topology/Homotopy |
70 | 10,344 | B |
Topology/Manifold |
8,511 | 1,047,097 | N/T/P/S/E + B |
Topology/Maps |
5 | 573 | B |
Topology/Metric |
4 | 485 | B |
Topology/MetricSpace |
40 | 9,419 | B |
Topology/Order |
1 | 100 | B |
Topology/Paths |
1 | 116 | B |
Topology/Plane |
42 | 15,718 | B |
Topology/Quotient |
1 | 91 | B |
Topology/SecondCountable |
1 | 49 | B |
Topology/Sequences |
2 | 125 | B |
Topology/Sheaves |
1 | 104 | B |
Topology/Surface |
147 | 28,165 | B |
Topology/UniformConvergence |
1 | 96 | B |
Topology/VectorBundle |
2 | 197 | B |
| Total | 23,554 | 3,061,704 |
Ricci flow drilldown
Folder under PoincareLib/ |
Lean files | Physical lines | Reading region |
|---|---|---|---|
Geometry/RicciFlow (direct files) |
11 | 1,020 | F + B |
Geometry/RicciFlow/AncientKappa |
397 | 47,941 | K |
Geometry/RicciFlow/Area |
37 | 3,096 | E |
Geometry/RicciFlow/Blowup |
234 | 31,387 | G |
Geometry/RicciFlow/CanonicalNeighborhood |
477 | 62,293 | K/S |
Geometry/RicciFlow/Compactness |
169 | 20,935 | F/R |
Geometry/RicciFlow/ConjugateHeat |
21 | 2,314 | K/L |
Geometry/RicciFlow/Connection |
4 | 753 | B |
Geometry/RicciFlow/Coordinates |
1 | 49 | F |
Geometry/RicciFlow/Curvature |
117 | 27,815 | F/R |
Geometry/RicciFlow/CurveShortening |
42 | 5,249 | C/E |
Geometry/RicciFlow/Evolution |
1 | 163 | B |
Geometry/RicciFlow/Extinction |
114 | 11,095 | E |
Geometry/RicciFlow/Frame |
16 | 2,804 | F |
Geometry/RicciFlow/Generalized |
1,439 | 171,424 | G/F |
Geometry/RicciFlow/Harnack |
369 | 64,041 | F/K |
Geometry/RicciFlow/Limit |
10 | 984 | F/G |
Geometry/RicciFlow/Local |
167 | 69,370 | F |
Geometry/RicciFlow/Measure |
1 | 50 | F |
Geometry/RicciFlow/Metric |
3 | 469 | B |
Geometry/RicciFlow/MetricComparison |
3 | 467 | F |
Geometry/RicciFlow/MetricFamily |
6 | 493 | B |
Geometry/RicciFlow/Pinching |
39 | 5,577 | F |
Geometry/RicciFlow/Positivity |
20 | 4,313 | F |
Geometry/RicciFlow/Product |
15 | 1,520 | C |
Geometry/RicciFlow/ReducedGeometry |
780 | 82,992 | L |
Geometry/RicciFlow/Rescaling |
12 | 1,290 | B |
Geometry/RicciFlow/Soliton |
297 | 37,135 | K |
Geometry/RicciFlow/Spacetime |
13 | 1,849 | C |
Geometry/RicciFlow/Splitting |
35 | 5,663 | B |
Geometry/RicciFlow/Surgery |
4,118 | 459,270 | S |
Geometry/RicciFlow/Tensor |
17 | 2,283 | K + B |
Geometry/RicciFlow/Volume |
103 | 9,074 | S + B |
| Total | 9,088 | 1,135,178 |
Manifold drilldown
Folder under PoincareLib/ |
Lean files | Physical lines | Reading region |
|---|---|---|---|
Topology/Manifold (direct files) |
3 | 478 | N/P + B |
Topology/Manifold/ConnectedSum |
9 | 888 | S |
Topology/Manifold/Diffeomorph |
76 | 10,193 | B |
Topology/Manifold/EmbeddedSphere |
36 | 3,024 | B |
Topology/Manifold/NeckCap |
584 | 103,398 | N |
Topology/Manifold/Orientation |
25 | 3,115 | B |
Topology/Manifold/Poincare |
31 | 1,252 | P/T |
Topology/Manifold/Schoenflies |
864 | 124,259 | B (topological bridge support) |
Topology/Manifold/Separation |
9 | 776 | B |
Topology/Manifold/Smoothing |
6,394 | 736,177 | T |
Topology/Manifold/Surgery |
422 | 52,791 | S/E |
Topology/Manifold/ThreeDimensional |
58 | 10,746 | B |
| Total | 8,511 | 1,047,097 |
Opened Lean anchors for the reading regions
These witnesses explain the orientation of the large folders. A witness neither classifies every file in its folder nor establishes that its hypotheses are discharged; several explicitly package predecessor assumptions.
| Folder / region | Opened declaration and what is visible there |
|---|---|
Geometry/Riemannian / R |
PoincareMT.RiemannianMetric.toponogov_comparison: Triangle comparison; docstring points to Theorem 2.4 and Theorem 5.35. |
Geometry/RicciFlow/ReducedGeometry / L |
PoincareMT.reducedVolumeMonotonicity: Reduced-volume assembly with explicit predecessor inputs. |
Geometry/RicciFlow/AncientKappa / K |
PoincareMT.ancientKappaStructuralConsequences: Ancient-solution structural consequences with predecessor theories. |
Geometry/RicciFlow/CanonicalNeighborhood / K/S |
PoincareMT.M27KappaNine93Conclusion: Ancient κ-solution alternatives. |
Geometry/RicciFlow/Generalized / G/F |
PoincareMT.GeneralizedRicciFlowData: Changing time-slice carriers and local Ricci-flow boxes. |
Geometry/RicciFlow/Surgery / S |
PoincareMT.repairedGlobalFlow: Global surgery construction; docstring names Theorem 15.9 and Corollary 15.10. |
Geometry/RicciFlow/Extinction / E |
PoincareMT.M71GlobalFiniteExtinctionStatement: Finite-extinction statement, with references to chapter 18. |
Geometry/CurveShortening / C |
PoincareMT.M64Annulus: Actual Lipschitz annuli; references Lemma 19.15 and later annulus estimates. |
Topology/Manifold/NeckCap / N |
PoincareMT.m25NeckCapTopology: Neck/cap topology linked to chapter 9 and Appendix A. This anchor is a direct file of Manifold, outside the NeckCap child count. |
Topology/Manifold/Surgery / S/E |
PoincareMT.RepairedGroupEffectsTheory: Surgery group effects and persistence of trivial component groups. |
Topology/Manifold/ConnectedSum / S |
PoincareMT.SurgeryRegionEquivalence.transportTarget: Reconstruction transport across a diffeomorphism. |
Topology/Manifold/Schoenflies / B |
Poincare.Manifold.Schoenflies.exists_nonsingular_sphere_extension: Local sphere-collar input; by itself this is not an extension over the ball. Its cited source is outside Morgan–Tian. |
Topology/Manifold/Smoothing / T |
PoincareMT.m76CompatibleSmoothing: Compatible smooth model via the Hamilton–Cairns route. |
Topology/Manifold/Smoothing / T |
PoincareMT.M76.smoothingConclusion_iff_exists_atlas: Connects the replacement-atlas formulation to the smoothing bridge. |
Topology/Manifold/Poincare / P/T |
PoincareMT.m80EndpointAssembly: Packages smooth and topological endpoints. The direct file Poincare.lean exports both skeleton theorems. |
Additional opened witnesses for the Ricci-flow reading keys (paths below are
relative to PoincareLib/Geometry/RicciFlow/):
| Folder / region | Declaration in the opened file |
|---|---|
Area / E |
PoincareMT.m60AreaGram_det_ne_zero_iff: Area Gram determinant used for extinction. |
Blowup / G |
PoincareMT.m29GeneralizedBoundedDistance: Bounded-distance theory, with the uniform estimate a premise. |
Compactness / F/R |
PoincareMT.PointedRicciFlowCompactnessHypotheses.eventually_exists_uniform_finset_cover: Uniform finite covers for compactness. |
ConjugateHeat / K/L |
PoincareMT.RicciFlow.conjugateHeatDensity_residual: Conjugate-heat density residual. |
Coordinates / F |
PoincareMT.RicciFlow.contDiffOn_pullbackCoefficients: Regularity of pullback coefficients. |
Curvature / F/R |
PoincareMT.ricciFlowCurvatureTheory: Curvature evolution and regularity theory. |
Frame / F |
PoincareMT.RicciFlow.Frame.exists_ricciTransport_on: Ricci transport along an interval. |
Harnack / F/K |
PoincareMT.differentialHarnackAncientTheory: Harnack theory for ancient solutions. |
Limit / F/G |
PoincareMT.RicciFlow.exists_of_coordinate_jets_on_open: Limit flow from coordinate jets. |
Local / F |
PoincareMT.ricciFlowLocalTheory: Local existence, uniqueness and continuation. |
Measure / F |
PoincareMT.RicciFlow.volumeMeasure_antitone_of_nonnegative_ricci: Volume-measure monotonicity. |
MetricComparison / F |
PoincareMT.RicciFlow.metric_comparison_of_curvature_bound: Metric comparison from curvature bounds. |
Pinching / F |
PoincareMT.LeviCivitaData.curvatureOperator_mem_region_iff: Curvature-operator pinching carrier. |
Positivity / F |
PoincareMT.RicciFlow.nonnegativeSectionalCurvature_preserved: Preservation of nonnegative sectional curvature. |
Soliton / K |
PoincareMT.twoDimensionalAncientAndShrinkingSolitonClassification: Two-dimensional ancient/soliton classification. |
Product / C |
PoincareMT.M62.nonempty_circleProductData: Circle-product Ricci flow. |
Spacetime / C |
PoincareMT.M62.nonempty_spacetimeCharts: Spacetime charts, with the corrected curve-evolution source. |
Tensor / K + B |
PoincareMT.RicciFlow.hasDerivAt_gradient_normSq: Gradient-energy time derivative. |
Volume / S + B |
PoincareMT.repairedFinitePrefix: Finite surgery-prefix construction. |
B is deliberately conservative. For example, Analysis/Asymptotics/Harnack.lean
contains the real-analysis limit step used in chapter 4;
Analysis/Integral/DifferentialApproximation.lean and
Analysis/Normed/Multilinear/UnitBound.lean cite the 2015 correction. Their
folder position alone does not separate background theory from theorem-specific
work. The remaining B entries have no dedicated page allocation established by this
reading of the source layout and representative module headers; neither the
repository overview nor the absent P-4 guides supply one. The algebraic-topology,
analytic, linear-algebra and measure-theory rows
are counted in full even where no exclusive book allocation was established.
Checking the authors' two figures
The authors' paper, arXiv:2610.08329v1, §5 and footnote 6
reports roughly 48% background/support. Footnote 6 attributes that split to
GPT-6-Astra's assessment at
3d7318c32025ccb30465dd29850e95a9e2aa1526.
This is a model-assessed classification at another revision, not a statistic
reproduced by these directory counts; that footnote supplies no per-file
classification or counting command. We confirm what the source reports, not an
independent 48% measurement of this tree.
The same paragraph reports about 650,000 lines for compatible smooth
structures including supporting theory. Our narrower directory census is
6,394 files / 736,177 physical lines in Topology/Manifold/Smoothing:
24.04% of this library's physical lines. The paper's introduction, footnote 3,
uses comment-stripped source for its headline totals. Neither its revision,
classification nor that metric equals our directory/newline metric, so 650,000
is not reproduced as a current wc -l result. Conversely, counting only this
folder does not include all its imported support. The book-side comparison is
T: one footnote, not a smoothing chapter.
The other three large examples are Geometry/RicciFlow/Surgery (459,270 lines,
15.00%), Geometry/CurveShortening (332,768, 10.87%) and
Geometry/Riemannian (250,434, 8.18%). Together with Smoothing they account for
1,778,649 physical lines (58.09%). These are places to investigate readability
and reuse, not lines proved redundant or removable. The map does not show
which lines either endpoint actually needs, nor verify the proof.
Reproduce after a merge
Use a clean checkout; record its commit before comparing counts. To reproduce this snapshot, use the commit at the top of this page. After a merge, run the same commands on the new commit and update the snapshot and tables together. The script reads tracked paths and current file contents, so untracked scratch Lean files are excluded and local modifications must be absent.
git status --short
git rev-parse HEAD
python3 - <<'PYCODE'
from collections import defaultdict
from pathlib import Path
import subprocess
paths = subprocess.check_output(
['git', 'ls-files', '-z', '--', 'PoincareLib']
).decode().split('\0')
tables = {name: defaultdict(lambda: [0, 0]) for name in
('Totals', 'Two levels', 'Ricci flow detail', 'Manifold detail')}
for name in sorted(p for p in paths if p.endswith('.lean')):
path = Path(name)
parts = path.relative_to('PoincareLib').parts
lines = path.read_bytes().count(b'\n') # same physical-line metric as wc -l
keys = [('Totals', parts[0] if len(parts) > 1 else '(direct files)'),
('Two levels', '/'.join(parts[:2]) if len(parts) > 2
else str(Path(*parts).parent) + ' (direct files)')]
for prefix, table in [(('Geometry', 'RicciFlow'), 'Ricci flow detail'),
(('Topology', 'Manifold'), 'Manifold detail')]:
if parts[:2] == prefix:
key = '/'.join(parts[:3]) if len(parts) > 3 else '/'.join(prefix) + ' (direct files)'
keys.append((table, key))
for table, key in keys:
tables[table][key][0] += 1
tables[table][key][1] += lines
for table, rows in tables.items():
print('\n' + table)
print('Folder\tFiles\tLines')
for folder, (files, lines) in sorted(rows.items()):
print(f'{folder}\t{files}\t{lines}')
print('TOTAL\t{}\t{}'.format(*(sum(v[i] for v in rows.values()) for i in (0, 1))))
PYCODE
The emitted tables reproduce the folder, file and line columns above (without
thousands separators or reading labels). The first two totals are both
23554 / 3061704; the drilldown totals are 9088 / 1135178 and
8511 / 1047097. For an independent find/wc cross-check of a parent, use:
find PoincareLib -type f -name '*.lean' -exec wc -l {} + |
awk '$NF != "total" { files++; lines += $1 }
END { printf "%d files, %d lines\n", files, lines }'
find PoincareLib/Topology/Manifold/Smoothing -type f -name '*.lean' -exec wc -l {} + |
awk '$NF != "total" { files++; lines += $1 }
END { printf "%d files, %d lines\n", files, lines }'
Expected: 23554 files, 3061704 lines and 6394 files, 736177 lines.
These shell commands assume this tree's whitespace-free paths and, unlike the
tracked-path script, include untracked files, so use a clean checkout. Discarding
batch total rows avoids double-counting when find -exec ... + invokes wc
more than once. A second person's rerun and review are still required by #14;
these local cross-checks do not satisfy that independent-review condition.