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.ConjugateHeat.Basic |
| 2 | import PoincareLib.Geometry.Riemannian.ScalarOperators.Composition |
| 3 | import PoincareLib.Geometry.Riemannian.ScalarOperators.Scaling |
| 4 | import Mathlib.Analysis.SpecialFunctions.Pow.Deriv |
| 5 | |
| 6 | /-! |
| 7 | # The conjugate-heat density of a potential |
| 8 | |
| 9 | For forward time `t < 0`, the density is `(-t)^(-n/2) exp(-f)`. |
| 10 | Its conjugate-heat residual is minus the density times the potential |
| 11 | residual. This uses the unnormalized reduced-volume convention. |
| 12 | Reference: Morgan--Tian, Lemma 9.33, pp. 199-202. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Manifold ContDiff Bundle Topology |
| 20 | |
| 21 | namespace PoincareMT |
| 22 | |
| 23 | variable {n : ℕ} {M : Type*} |
| 24 | |
| 25 | theorem conjugateHeatDensity_pos (f : M × ℝ → ℝ) {t : ℝ} (ht : t < 0) |
| 26 | (x : M) : 0 < conjugateHeatDensity n f t x := |
| 27 | mul_pos (Real.rpow_pos_of_pos (neg_pos.mpr ht) _) (Real.exp_pos _) |
| 28 | |
| 29 | theorem hasDerivAt_conjugateHeatDensity {f : M × ℝ → ℝ} {t a : ℝ} |
| 30 | (ht : t < 0) (x : M) (hf : HasDerivAt (fun s ↦ f (x, s)) a t) : |
| 31 | HasDerivAt (fun s ↦ conjugateHeatDensity n f s x) |
| 32 | ((n / (2 * -t) - a) * conjugateHeatDensity n f t x) t := by |
| 33 | have hb := ((hasDerivAt_id t).neg).rpow_const |
| 34 | (p := -(n : ℝ) / 2) (Or.inl (ne_of_gt (neg_pos.mpr ht))) |
| 35 | convert! hb.mul hf.neg.exp using 1 |
| 36 | simp only [conjugateHeatDensity, id, Pi.neg_apply, Real.rpow_eq_pow] |
| 37 | rw [Real.rpow_sub (neg_pos.mpr ht), Real.rpow_one] |
| 38 | field_simp |
| 39 | ring |
| 40 | |
| 41 | namespace LeviCivitaData |
| 42 | |
| 43 | variable [TopologicalSpace M] [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 44 | [IsManifold (𝓡 n) ∞ M] {g : RiemannianMetric n M} |
| 45 | |
| 46 | theorem laplacian_exp_neg (D : LeviCivitaData g) {f : M → ℝ} |
| 47 | (hf : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ f) (x : M) : |
| 48 | D.laplacian (fun y ↦ Real.exp (-f y)) x = |
| 49 | Real.exp (-f x) * (g.inner x (D.gradient f x) (D.gradient f x) - |
| 50 | D.laplacian f x) := by |
| 51 | have hd : deriv (fun a : ℝ ↦ Real.exp (-a)) = fun a ↦ -Real.exp (-a) := by |
| 52 | funext a |
| 53 | simpa using ((hasDerivAt_id a).neg.exp).deriv |
| 54 | have hdd (a : ℝ) : deriv (fun b : ℝ ↦ -Real.exp (-b)) a = Real.exp (-a) := by |
| 55 | simpa using ((hasDerivAt_id a).neg.exp.neg).deriv |
| 56 | have he : ContDiff ℝ ∞ (fun a : ℝ ↦ Real.exp (-a)) := |
| 57 | Real.contDiff_exp.comp contDiff_id.neg |
| 58 | have h := D.laplacian_comp hf he x |
| 59 | rw [hd, hdd] at h |
| 60 | change D.laplacian (fun y ↦ Real.exp (-f y)) x = _ at h |
| 61 | rw [h] |
| 62 | ring |
| 63 | |
| 64 | theorem gradient_exp_neg (D : LeviCivitaData g) {f : M → ℝ} |
| 65 | {x : M} (hf : MDifferentiableAt (𝓡 n) 𝓘(ℝ, ℝ) f x) : |
| 66 | D.gradient (fun y ↦ Real.exp (-f y)) x = |
| 67 | -Real.exp (-f x) • D.gradient f x := by |
| 68 | have hd : HasDerivAt (fun a : ℝ ↦ Real.exp (-a)) (-Real.exp (-f x)) (f x) := by |
| 69 | simpa using ((hasDerivAt_id (f x)).neg.exp) |
| 70 | simpa only [Function.comp_def, hd.deriv] using |
| 71 | D.gradient_comp hf hd.differentiableAt |
| 72 | |
| 73 | end LeviCivitaData |
| 74 | |
| 75 | namespace RicciFlow |
| 76 | |
| 77 | variable [TopologicalSpace M] [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 78 | [IsManifold (𝓡 n) ∞ M] {J : Set ℝ} |
| 79 | |
| 80 | theorem gradient_conjugateHeatDensity (F : RicciFlow n M J) |
| 81 | {f : M × ℝ → ℝ} {t : ℝ} {x : M} |
| 82 | (hf : MDifferentiableAt (𝓡 n) 𝓘(ℝ, ℝ) (fun y ↦ f (y, t)) x) : |
| 83 | (F.connection t).gradient (conjugateHeatDensity n f t) x = |
| 84 | -conjugateHeatDensity n f t x • |
| 85 | (F.connection t).gradient (fun y ↦ f (y, t)) x := by |
| 86 | apply ((F.metric t).inner_isInvertible x).injective |
| 87 | ext v |
| 88 | rw [(F.connection t).inner_gradient] |
| 89 | unfold conjugateHeatDensity |
| 90 | rw [mvfderiv_const_mul, ← (F.connection t).inner_gradient, |
| 91 | (F.connection t).gradient_exp_neg hf] |
| 92 | simp only [map_smul, smul_apply, smul_eq_mul] |
| 93 | ring |
| 94 | |
| 95 | theorem laplacian_conjugateHeatDensity (F : RicciFlow n M J) |
| 96 | {f : M × ℝ → ℝ} {t : ℝ} |
| 97 | (hf : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun y ↦ f (y, t))) (x : M) : |
| 98 | (F.connection t).laplacian (conjugateHeatDensity n f t) x = |
| 99 | conjugateHeatDensity n f t x * |
| 100 | ((F.metric t).inner x ((F.connection t).gradient (fun y ↦ f (y, t)) x) |
| 101 | ((F.connection t).gradient (fun y ↦ f (y, t)) x) - |
| 102 | (F.connection t).laplacian (fun y ↦ f (y, t)) x) := by |
| 103 | unfold conjugateHeatDensity |
| 104 | rw [(F.connection t).laplacian_const_mul, |
| 105 | (F.connection t).laplacian_exp_neg hf] |
| 106 | ring |
| 107 | |
| 108 | theorem conjugateHeatDensity_residual (F : RicciFlow n M J) |
| 109 | {f : M × ℝ → ℝ} {t : ℝ} (ht : t < 0) |
| 110 | (hf : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun y ↦ f (y, t))) |
| 111 | (x : M) (hft : DifferentiableAt ℝ (fun s ↦ f (x, s)) t) : |
| 112 | F.conjugateHeatResidual (fun z ↦ conjugateHeatDensity n f z.2 z.1) t x = |
| 113 | -conjugateHeatDensity n f t x * F.potentialResidual f t x := by |
| 114 | unfold conjugateHeatResidual |
| 115 | rw [(hasDerivAt_conjugateHeatDensity ht x hft.hasDerivAt).deriv, |
| 116 | F.laplacian_conjugateHeatDensity hf] |
| 117 | dsimp only [potentialResidual] |
| 118 | ring |
| 119 | |
| 120 | theorem conjugateHeatDensity_residual_eq_zero_iff (F : RicciFlow n M J) |
| 121 | {f : M × ℝ → ℝ} {t : ℝ} (ht : t < 0) |
| 122 | (hf : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun y ↦ f (y, t))) |
| 123 | (x : M) (hft : DifferentiableAt ℝ (fun s ↦ f (x, s)) t) : |
| 124 | F.conjugateHeatResidual (fun z ↦ conjugateHeatDensity n f z.2 z.1) t x = 0 ↔ |
| 125 | F.potentialResidual f t x = 0 := by |
| 126 | rw [F.conjugateHeatDensity_residual ht hf x hft, mul_eq_zero] |
| 127 | simp only [neg_ne_zero.mpr (ne_of_gt (conjugateHeatDensity_pos f ht x)), false_or] |
| 128 | |
| 129 | end RicciFlow |
| 130 | |
| 131 | end PoincareMT |