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.Area.FixedMap.GramRank |
| 2 | import PoincareLib.Geometry.Riemannian.MinimalSurface.Sphere.Analysis.Gram.DeterminantDerivative |
| 3 | |
| 4 | /-! |
| 5 | # Pointwise fixed-map area variation |
| 6 | |
| 7 | Morgan-Tian Claim 18.13, printed p. 427, with the corrected factor in |
| 8 | reviews/errata/2026-09-14-sphere-area.md. At an independent differential, |
| 9 | the Ricci-flow equation differentiates the square-root Gram determinant. |
| 10 | At a dependent differential the density is identically zero for all time. |
| 11 | Both cases give minus the actual Ricci-trace density as within-time derivative. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle BigOperators |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | |
| 26 | /-- The exact variation of each sphere area density, including the |
| 27 | rank-deficient locus and endpoints. Source: corrected MT Claim 18.13, p. 427. -/ |
| 28 | theorem m60SphereDensity_variation {J : Set ℝ} (F : RicciFlow n M J) |
| 29 | (f : UnitTwoSphere → M) (z : LoopPlane) {t : ℝ} (ht : t ∈ J) : |
| 30 | HasDerivWithinAt (fun s => m60SphereAreaDensity (F.metric s) f z) |
| 31 | (-m60SphereRicciTraceDensity (F.connection t) f z) J t := by |
| 32 | by_cases hdeg : Matrix.det (m60AreaGram (F.metric t) (f ∘ m60SphereParameter) z) = 0 |
| 33 | · exact m60SphereDensity_variation_of_degenerate F f z t hdeg |
| 34 | let G := fun s => m60AreaGram (F.metric s) (f ∘ m60SphereParameter) z |
| 35 | let e := fun i : Fin 2 => mfderiv (𝓡 2) (𝓡 n) (f ∘ m60SphereParameter) z |
| 36 | (EuclideanSpace.basisFun (Fin 2) ℝ i) |
| 37 | let R : Matrix (Fin 2) (Fin 2) ℝ := |
| 38 | fun i j => (F.connection t).ricci ((f ∘ m60SphereParameter) z) (e i) (e j) |
| 39 | have hG : ∀ i j, HasDerivWithinAt (fun s => G s i j) (-2 * R i j) J t := |
| 40 | fun i j => F.equation t ht ((f ∘ m60SphereParameter) z) (e i) (e j) |
| 41 | have hnonneg (s : ℝ) : 0 ≤ Matrix.det (G s) := |
| 42 | m60AreaGram_det_nonneg (F.metric s) (f ∘ m60SphereParameter) z |
| 43 | have hpos : 0 < Matrix.det (G t) := lt_of_le_of_ne (hnonneg t) (Ne.symm hdeg) |
| 44 | have hd := M60.hasDerivWithinAt_sqrt_det_fin_two hG hpos |
| 45 | have harea : (fun s => Real.sqrt (Matrix.det (G s))) = |
| 46 | fun s => m60SphereAreaDensity (F.metric s) f z := by |
| 47 | funext s |
| 48 | exact congrArg Real.sqrt (max_eq_right (hnonneg s)).symm |
| 49 | rw [harea] at hd |
| 50 | convert hd using 1 |
| 51 | unfold m60SphereRicciTraceDensity |
| 52 | rw [if_neg hdeg] |
| 53 | unfold m60AreaDensity |
| 54 | rw [max_eq_right (hnonneg t)] |
| 55 | simp only [Fin.sum_univ_two] |
| 56 | dsimp only [G, R, e] |
| 57 | ring |
| 58 | |
| 59 | end PoincareMT |