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.Extinction.Width.Transport.Event.MetricDifferential |
| 2 | import PoincareLib.Geometry.Riemannian.MinimalSurface.Sphere.AreaEnergy |
| 3 | |
| 4 | set_option autoImplicit false |
| 5 | set_option backward.isDefEq.respectTransparency false |
| 6 | |
| 7 | open scoped Manifold ContDiff Bundle |
| 8 | |
| 9 | namespace PoincareMT |
| 10 | |
| 11 | variable {M N : Type*} |
| 12 | [TopologicalSpace M] [ChartedSpace LoopAmbient M] [IsManifold (𝓡 3) ∞ M] |
| 13 | [TopologicalSpace N] [ChartedSpace LoopAmbient N] [IsManifold (𝓡 3) ∞ N] |
| 14 | |
| 15 | private theorem inner_self_nonnegative (g : RiemannianMetric 3 M) (x : M) |
| 16 | (v : TangentSpace (𝓡 3) x) : 0 ≤ g.inner x v v := by |
| 17 | by_cases hv : v = 0 |
| 18 | · simp [hv] |
| 19 | · exact (g.pos x v hv).le |
| 20 | |
| 21 | /-- Quadratic differential domination controls the two-dimensional Gram determinant. -/ |
| 22 | theorem m67_gram_det_le_of_differential_le |
| 23 | (g : RiemannianMetric 3 M) (h : RiemannianMetric 3 N) |
| 24 | (f : M → N) {c : ℝ} (hc : 0 ≤ c) |
| 25 | (hbound : ∀ x v, |
| 26 | h.inner (f x) (mfderiv (𝓡 3) (𝓡 3) f x v) (mfderiv (𝓡 3) (𝓡 3) f x v) ≤ |
| 27 | c * g.inner x v v) |
| 28 | (x : M) (u v : TangentSpace (𝓡 3) x) : |
| 29 | let L := mfderiv (𝓡 3) (𝓡 3) f x |
| 30 | h.inner (f x) (L u) (L u) * h.inner (f x) (L v) (L v) - |
| 31 | (h.inner (f x) (L u) (L v)) ^ 2 ≤ |
| 32 | c ^ 2 * (g.inner x u u * g.inner x v v - (g.inner x u v) ^ 2) := by |
| 33 | dsimp only |
| 34 | let L := mfderiv (𝓡 3) (𝓡 3) f x |
| 35 | by_cases hu : u = 0 |
| 36 | · simp [hu] |
| 37 | have hgu : 0 < g.inner x u u := g.pos x u hu |
| 38 | let a := g.inner x u v / g.inner x u u |
| 39 | let w := v - a • u |
| 40 | have hgidentity : g.inner x u u * g.inner x v v - (g.inner x u v) ^ 2 = |
| 41 | g.inner x u u * g.inner x w w - (g.inner x u w) ^ 2 := by |
| 42 | dsimp [w] |
| 43 | simp only [map_sub, map_smul, sub_apply, smul_apply, smul_eq_mul] |
| 44 | rw [g.symm x v u] |
| 45 | ring |
| 46 | have hhidentity : h.inner (f x) (L u) (L u) * h.inner (f x) (L v) (L v) - |
| 47 | (h.inner (f x) (L u) (L v)) ^ 2 = |
| 48 | h.inner (f x) (L u) (L u) * h.inner (f x) (L w) (L w) - |
| 49 | (h.inner (f x) (L u) (L w)) ^ 2 := by |
| 50 | dsimp [w] |
| 51 | simp only [map_sub, map_smul, sub_apply, smul_apply, smul_eq_mul] |
| 52 | rw [h.symm (f x) (L v) (L u)] |
| 53 | ring |
| 54 | have horth : g.inner x u w = 0 := by |
| 55 | dsimp [w, a] |
| 56 | simp only [map_sub, map_smul, smul_eq_mul] |
| 57 | field_simp |
| 58 | ring |
| 59 | change h.inner (f x) (L u) (L u) * h.inner (f x) (L v) (L v) - |
| 60 | (h.inner (f x) (L u) (L v)) ^ 2 ≤ _ |
| 61 | rw [hhidentity, hgidentity, horth, zero_pow (by decide : 2 ≠ 0), sub_zero] |
| 62 | calc |
| 63 | _ ≤ h.inner (f x) (L u) (L u) * h.inner (f x) (L w) (L w) := |
| 64 | sub_le_self _ (sq_nonneg _) |
| 65 | _ ≤ (c * g.inner x u u) * (c * g.inner x w w) := |
| 66 | mul_le_mul (hbound x u) (hbound x w) (inner_self_nonnegative h (f x) (L w)) |
| 67 | (mul_nonneg hc hgu.le) |
| 68 | _ = _ := by ring |
| 69 | |
| 70 | /-- Smooth postcomposition has the quadratic area loss of its distance bound. -/ |
| 71 | theorem m67_area_density_comp_le [T2Space M] [T2Space N] |
| 72 | (g : RiemannianMetric 3 M) (h : RiemannianMetric 3 N) |
| 73 | {f : M → N} (hf : MDifferentiable (𝓡 3) (𝓡 3) f) |
| 74 | {L : ℝ} (hL : 0 ≤ L) |
| 75 | (hbound : ∀ x y, h.edist (f x) (f y) ≤ ENNReal.ofReal L * g.edist x y) |
| 76 | {d : LoopPlane → M} {z : LoopPlane} |
| 77 | (hd : MDifferentiableAt (𝓡 2) (𝓡 3) d z) : |
| 78 | parametrizedAreaDensity h (f ∘ d) z ≤ L ^ 2 * parametrizedAreaDensity g d z := by |
| 79 | let e := fun i : Fin 2 => mfderiv (𝓡 2) (𝓡 3) d z |
| 80 | (EuclideanSpace.basisFun (Fin 2) ℝ i) |
| 81 | have hdet := m67_gram_det_le_of_differential_le g h f (sq_nonneg L) |
| 82 | (m67_inner_mfderiv_le_of_distance_bound g h hf hL hbound) (d z) (e 0) (e 1) |
| 83 | have hdet' : Matrix.det (m60AreaGram h (f ∘ d) z) ≤ |
| 84 | (L ^ 2) ^ 2 * Matrix.det (m60AreaGram g d z) := by |
| 85 | unfold m60AreaGram |
| 86 | rw [mfderiv_comp z (hf (d z)) hd, Matrix.det_fin_two, Matrix.det_fin_two] |
| 87 | simp only [ContinuousLinearMap.comp_apply, Function.comp_apply] |
| 88 | rw [h.symm (f (d z)) (mfderiv (𝓡 3) (𝓡 3) f (d z) (e 1)) |
| 89 | (mfderiv (𝓡 3) (𝓡 3) f (d z) (e 0)), g.symm (d z) (e 1) (e 0)] |
| 90 | simpa only [pow_two] using hdet |
| 91 | change Real.sqrt (max 0 (Matrix.det (m60AreaGram h (f ∘ d) z))) ≤ |
| 92 | L ^ 2 * Real.sqrt (max 0 (Matrix.det (m60AreaGram g d z))) |
| 93 | rw [max_eq_right (m60AreaGram_det_nonneg h (f ∘ d) z), |
| 94 | max_eq_right (m60AreaGram_det_nonneg g d z)] |
| 95 | calc |
| 96 | _ ≤ Real.sqrt ((L ^ 2) ^ 2 * Matrix.det (m60AreaGram g d z)) := Real.sqrt_le_sqrt hdet' |
| 97 | _ = _ := by rw [Real.sqrt_mul (sq_nonneg _), Real.sqrt_sq (sq_nonneg L)] |
| 98 | |
| 99 | end PoincareMT |