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.RicciFlow.Basic |
| 2 | import PoincareLib.Geometry.Riemannian.ScalarOperators.Gradient |
| 3 | |
| 4 | /-! # Conjugate-heat densities and scalar residuals -/ |
| 5 | |
| 6 | set_option autoImplicit false |
| 7 | |
| 8 | open scoped Manifold ContDiff Bundle |
| 9 | |
| 10 | namespace PoincareMT |
| 11 | |
| 12 | variable {n : ℕ} {M : Type*} |
| 13 | |
| 14 | /-- The unnormalized density associated to a potential at backward time `-t`. -/ |
| 15 | noncomputable def conjugateHeatDensity (n : ℕ) (f : M × ℝ → ℝ) |
| 16 | (t : ℝ) (x : M) : ℝ := |
| 17 | Real.rpow (-t) (-(n : ℝ) / 2) * Real.exp (-f (x, t)) |
| 18 | |
| 19 | namespace RicciFlow |
| 20 | |
| 21 | variable [TopologicalSpace M] [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 22 | [IsManifold (𝓡 n) ∞ M] {J : Set ℝ} |
| 23 | |
| 24 | noncomputable def conjugateHeatResidual (F : RicciFlow n M J) |
| 25 | (u : M × ℝ → ℝ) (t : ℝ) (x : M) : ℝ := |
| 26 | deriv (fun s ↦ u (x, s)) t + |
| 27 | (F.connection t).laplacian (fun y ↦ u (y, t)) x - |
| 28 | (F.connection t).scalarCurvature x * u (x, t) |
| 29 | |
| 30 | noncomputable def potentialResidual (F : RicciFlow n M J) |
| 31 | (f : M × ℝ → ℝ) (t : ℝ) (x : M) : ℝ := |
| 32 | deriv (fun s ↦ f (x, s)) t + (F.connection t).laplacian (fun y ↦ f (y, t)) x - |
| 33 | (F.metric t).inner x ((F.connection t).gradient (fun y ↦ f (y, t)) x) |
| 34 | ((F.connection t).gradient (fun y ↦ f (y, t)) x) + |
| 35 | (F.connection t).scalarCurvature x - n / (2 * -t) |
| 36 | |
| 37 | end RicciFlow |
| 38 | |
| 39 | end PoincareMT |