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

| 1 | import PoincareLib.Geometry.CurveShortening.Comparison.Compatibility.SourceNames |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.Approximation.Flattened.PolygonGeometry |
| 3 | import PoincareLib.Geometry.RicciFlow.Curvature.Estimates.Shi.Paths.Energy |
| 4 | import PoincareLib.Geometry.CurveShortening.Comparison.PolygonApproximation.Polygon.Length |
| 5 | |
| 6 | /-! |
| 7 | # Fixed-metric length of the actual flattened polygon |
| 8 | |
| 9 | The actual speed is continuous and equals side speed times the normalized |
| 10 | profile on each closed cell. Periodicity and finite adjacent integration |
| 11 | therefore recover the exact sum of side lengths. Claim 19.22, MT2007 |
| 12 | pp. 452-453; see `2026-09-21-flattened-polygon-length.md`. |
| 13 | |
| 14 | Morgan--Tian context: Section 19.4, Definition 19.18 and Claims 19.19-19.22, printed pp. |
| 15 | 450-453. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | |
| 20 | open Set |
| 21 | open scoped Manifold ContDiff intervalIntegral |
| 22 | |
| 23 | namespace PoincareMT |
| 24 | |
| 25 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 27 | {g : RiemannianMetric n M} {D : LeviCivitaData g} |
| 28 | |
| 29 | /-- Flattening preserves the sum of the actual side lengths, with the |
| 30 | calibrated cell length multiplying side speed. Claim 19.22, pp. 452-453. -/ |
| 31 | theorem m64FlattenedPolygon_length {N : ℕ} |
| 32 | (polygon : M63GeodesicPolygon g D N) (hN : 0 < N) : |
| 33 | (∫ x in (0 : ℝ)..curvePeriod, |
| 34 | g.tangentNorm (m63FlattenedPolygon polygon x) |
| 35 | (curveVelocity (n := n) (m63FlattenedPolygon polygon) x)) = |
| 36 | ∑ j : Fin N, m63CellLength N * (polygon.side j).speed := by |
| 37 | let ell := m63CellLength N |
| 38 | let v : ℝ → ℝ := fun x => g.tangentNorm (m63FlattenedPolygon polygon x) |
| 39 | (curveVelocity (n := n) (m63FlattenedPolygon polygon) x) |
| 40 | have hell : 0 < ell := m63CellLength_pos hN |
| 41 | have hv : Continuous v := M04.continuous_pathSpeed g |
| 42 | ((m63FlattenedPolygon_smooth polygon hN).of_le (by simp)) |
| 43 | have hcell (j : Fin N) : |
| 44 | (∫ x in m63CellLeft N j..(m63CellLeft N j + ell), v x) = ell * (polygon.side j).speed := by |
| 45 | have hab : m63CellLeft N j ≤ m63CellLeft N j + ell := le_add_of_nonneg_right hell.le |
| 46 | have heq : (∫ x in m63CellLeft N j..(m63CellLeft N j + ell), v x) = |
| 47 | ∫ x in m63CellLeft N j..(m63CellLeft N j + ell), |
| 48 | (polygon.side j).speed * m63Profile N x := by |
| 49 | apply intervalIntegral.integral_congr |
| 50 | intro x hx |
| 51 | rw [uIcc_of_le hab] at hx |
| 52 | have hs : x - m63CellLeft N j ∈ Icc 0 ell := by constructor <;> linarith [hx.1, hx.2] |
| 53 | have h := m63FlattenedPolygon_cell_speed polygon hN j hs |
| 54 | change v (m63CellLeft N j + (x - m63CellLeft N j)) = |
| 55 | (polygon.side j).speed * m63Profile N (m63CellLeft N j + (x - m63CellLeft N j)) at h |
| 56 | have hxsum : m63CellLeft N j + (x - m63CellLeft N j) = x := by ring |
| 57 | simpa only [hxsum] using h |
| 58 | rw [heq, intervalIntegral.integral_const_mul] |
| 59 | have hprofile : (∫ x in m63CellLeft N j..(m63CellLeft N j + ell), m63Profile N x) = ell := by |
| 60 | have h := (m63Profile_periodic hN).intervalIntegral_add_eq (m63CellLeft N j) 0 |
| 61 | simpa only [zero_add, m63Profile_cell_integral hN] using h |
| 62 | rw [hprofile, mul_comm] |
| 63 | have hsum : (∑ j : Fin N, ∫ x in m63CellLeft N j..(m63CellLeft N j + ell), v x) = |
| 64 | ∫ x in (0 : ℝ)..curvePeriod, v x := by |
| 65 | have htel := intervalIntegral.sum_integral_adjacent_intervals |
| 66 | (a := fun k : ℕ => (k : ℝ) * ell) (n := N) (μ := MeasureTheory.volume) |
| 67 | (fun _ _ => hv.intervalIntegrable _ _) |
| 68 | rw [← Fin.sum_univ_eq_sum_range] at htel |
| 69 | simpa only [ell, m63CellLeft, Nat.cast_add, Nat.cast_one, add_mul, one_mul, |
| 70 | Nat.cast_zero, zero_mul, m63_count_mul_cellLength hN, curvePeriod] using htel |
| 71 | change (∫ x in (0 : ℝ)..curvePeriod, v x) = ∑ j : Fin N, ell * (polygon.side j).speed |
| 72 | rw [← hsum] |
| 73 | exact Finset.sum_congr rfl (fun j _ => hcell j) |
| 74 | |
| 75 | /-- The literal flattened family has the same length as its raw sampled polygon. Source: |
| 76 | Auxiliary step for MT Definition 19.18 and Claims 19.19/19.22, pp. 450-453; project |
| 77 | construction in `proof-work/tasks/M64/reports/2026-09-23-static-polygon.md`. -/ |
| 78 | theorem m64_freeLoopLength_eq_polygonLength |
| 79 | {M : Type*} [TopologicalSpace M] [ChartedSpace LoopAmbient M] |
| 80 | [IsManifold (𝓡 3) ∞ M] {g : RiemannianMetric 3 M} {D : LeviCivitaData g} |
| 81 | {N : ℕ} (hN : 0 < N) (polygon : M63GeodesicPolygon g D N) |
| 82 | (gamma : C1FreeLoopSpace (M := M)) |
| 83 | (heq : ∀ x : ℝ, periodicFreeLoop gamma x = m63FlattenedPolygon polygon x) : |
| 84 | freeLoopLength g gamma = m64PolygonLength polygon := by |
| 85 | unfold freeLoopLength |
| 86 | rw [show periodicFreeLoop gamma = m63FlattenedPolygon polygon from funext heq] |
| 87 | rw [show rampPeriod = curvePeriod from rfl] |
| 88 | rw [m64FlattenedPolygon_length polygon hN, m64PolygonLength_eq_sum polygon hN] |
| 89 | |
| 90 | end PoincareMT |