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.Riemannian.MinimalSurface.Sphere.AreaEnergy |
| 2 | import PoincareLib.Geometry.RicciFlow.Basic |
| 3 | import Mathlib.Analysis.InnerProductSpace.GramMatrix |
| 4 | |
| 5 | /-! |
| 6 | # The rank-deficient part of fixed-map variation |
| 7 | |
| 8 | Morgan-Tian Claim 18.13, printed p. 427, with the correction recorded in |
| 9 | reviews/errata/2026-09-14-sphere-area.md. Gram rank is independent of the |
| 10 | positive target metric. A fixed rank-deficient differential therefore has |
| 11 | identically zero area along the flow, and the prescribed Ricci-trace |
| 12 | density is zero there as well. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle |
| 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 | /-- Nonzero Gram determinant means independence of the actual differential |
| 27 | columns. Source: MT Claim 18.13, p. 427, rank-deficient variation derivation. -/ |
| 28 | theorem m60AreaGram_det_ne_zero_iff (g : RiemannianMetric n M) |
| 29 | (F : LoopPlane → M) (z : LoopPlane) : |
| 30 | Matrix.det (m60AreaGram g F z) ≠ 0 ↔ |
| 31 | LinearIndependent ℝ (fun i : Fin 2 => |
| 32 | mfderiv (𝓡 2) (𝓡 n) F z (EuclideanSpace.basisFun (Fin 2) ℝ i)) := by |
| 33 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 34 | ⟨g.toRiemannianMetric⟩ |
| 35 | exact Matrix.det_gram_ne_zero_iff_linearIndependent (𝕜 := ℝ) |
| 36 | (v := fun i : Fin 2 => |
| 37 | mfderiv (𝓡 2) (𝓡 n) F z (EuclideanSpace.basisFun (Fin 2) ℝ i)) |
| 38 | |
| 39 | /-- The degenerate locus of a fixed map does not change with the metric. |
| 40 | Source: MT Claim 18.13, p. 427, rank-deficient variation derivation. -/ |
| 41 | theorem m60AreaGram_det_eq_zero_iff (g h : RiemannianMetric n M) |
| 42 | (F : LoopPlane → M) (z : LoopPlane) : |
| 43 | Matrix.det (m60AreaGram g F z) = 0 ↔ Matrix.det (m60AreaGram h F z) = 0 := by |
| 44 | exact not_iff_not.mp |
| 45 | ((m60AreaGram_det_ne_zero_iff g F z).trans (m60AreaGram_det_ne_zero_iff h F z).symm) |
| 46 | |
| 47 | /-- Degeneracy in one metric forces zero area density in every metric. |
| 48 | Source: MT Claim 18.13, p. 427, rank-deficient variation derivation. -/ |
| 49 | theorem m60AreaDensity_eq_zero_of_det_eq_zero (g h : RiemannianMetric n M) |
| 50 | (F : LoopPlane → M) (z : LoopPlane) (hz : Matrix.det (m60AreaGram g F z) = 0) : |
| 51 | m60AreaDensity h F z = 0 := by |
| 52 | simp only [m60AreaDensity, (m60AreaGram_det_eq_zero_iff g h F z).mp hz, |
| 53 | max_self, Real.sqrt_zero] |
| 54 | |
| 55 | /-- The Ricci-trace density vanishes at each degenerate differential. |
| 56 | Source: MT Claim 18.13, p. 427, corrected variation convention. -/ |
| 57 | theorem m60SphereRicciTraceDensity_eq_zero {g : RiemannianMetric n M} |
| 58 | (D : LeviCivitaData g) (f : UnitTwoSphere → M) (z : LoopPlane) |
| 59 | (hz : Matrix.det (m60AreaGram g (f ∘ m60SphereParameter) z) = 0) : |
| 60 | m60SphereRicciTraceDensity D f z = 0 := by |
| 61 | simp only [m60SphereRicciTraceDensity, hz, if_true] |
| 62 | |
| 63 | /-- The fixed-map variation formula holds pointwise at every degenerate |
| 64 | differential, including endpoints. Source: MT Claim 18.13, p. 427. -/ |
| 65 | theorem m60SphereDensity_variation_of_degenerate {J : Set ℝ} |
| 66 | (F : RicciFlow n M J) (f : UnitTwoSphere → M) (z : LoopPlane) (t : ℝ) |
| 67 | (hz : Matrix.det (m60AreaGram (F.metric t) (f ∘ m60SphereParameter) z) = 0) : |
| 68 | HasDerivWithinAt (fun s => m60SphereAreaDensity (F.metric s) f z) |
| 69 | (-m60SphereRicciTraceDensity (F.connection t) f z) J t := by |
| 70 | rw [m60SphereRicciTraceDensity_eq_zero (F.connection t) f z hz, neg_zero] |
| 71 | have hzero : (fun s => m60SphereAreaDensity (F.metric s) f z) = fun _ => (0 : ℝ) := by |
| 72 | funext s |
| 73 | exact m60AreaDensity_eq_zero_of_det_eq_zero (F.metric t) (F.metric s) |
| 74 | (f ∘ m60SphereParameter) z hz |
| 75 | rw [hzero] |
| 76 | exact hasDerivWithinAt_const _ _ _ |
| 77 | |
| 78 | end PoincareMT |