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.Metric.PullbackVariation |
| 2 | import Mathlib.Analysis.Calculus.Deriv.Inv |
| 3 | import Mathlib.Analysis.Calculus.MeanValue |
| 4 | |
| 5 | /-! # Homothetic metric identities from the actual soliton evolution -/ |
| 6 | |
| 7 | set_option autoImplicit false |
| 8 | set_option backward.isDefEq.respectTransparency false |
| 9 | |
| 10 | open Set |
| 11 | open scoped Manifold ContDiff |
| 12 | |
| 13 | namespace PoincareMT.RicciFlow |
| 14 | |
| 15 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 16 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 17 | {J : Set ℝ} (F : RicciFlow n M J) (hJ : IsOpen J) |
| 18 | {f : ℝ × M → ℝ} {Φ : ℝ → M → M} |
| 19 | (hf : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ f (J ×ˢ univ)) |
| 20 | (hs : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) (𝓡 n) ∞ |
| 21 | (fun z : ℝ × M => Φ z.1 z.2) (J ×ˢ univ)) |
| 22 | (hΦ : ∀ s ∈ J, ∀ y, HasMFDerivAt 𝓘(ℝ, ℝ) (𝓡 n) (fun r => Φ r y) s |
| 23 | ((1 : ℝ →L[ℝ] ℝ).smulRight |
| 24 | (-((F.connection s).gradient (fun z => f (s, z)) (Φ s y))))) |
| 25 | |
| 26 | include hJ hf hs hΦ |
| 27 | |
| 28 | /-- The soliton equation gives the scalar evolution of the actual pulled |
| 29 | metric; the supplied maps need not be known to be diffeomorphisms. -/ |
| 30 | theorem hasDerivAt_soliton_pullback_metric {t : ℝ} (ht : t ∈ J) |
| 31 | (hsol : ∀ y (a b : TangentSpace (𝓡 n) y), |
| 32 | (F.connection t).ricci y a b + (F.connection t).hessian (fun z => f (t, z)) y a b + |
| 33 | (1 / (2 * t)) * (F.metric t).inner y a b = 0) |
| 34 | (x : M) (v w : TangentSpace (𝓡 n) x) : |
| 35 | HasDerivAt (fun s => (F.metric s).inner (Φ s x) |
| 36 | (mfderiv (𝓡 n) (𝓡 n) (Φ s) x v) (mfderiv (𝓡 n) (𝓡 n) (Φ s) x w)) |
| 37 | ((1 / t) * (F.metric t).inner (Φ t x) |
| 38 | (mfderiv (𝓡 n) (𝓡 n) (Φ t) x v) (mfderiv (𝓡 n) (𝓡 n) (Φ t) x w)) t := by |
| 39 | apply (F.hasDerivAt_negativeGradient_pullback_metric hJ hf hs hΦ ht x v w).congr_deriv |
| 40 | have h := hsol (Φ t x) |
| 41 | (mfderiv (𝓡 n) (𝓡 n) (Φ t) x v) (mfderiv (𝓡 n) (𝓡 n) (Φ t) x w) |
| 42 | have hcoef : (2 : ℝ) * (1 / (2 * t)) = 1 / t := by |
| 43 | simp only [one_div, mul_inv_rev] |
| 44 | ring |
| 45 | rw [← hcoef] |
| 46 | linear_combination -2 * h |
| 47 | |
| 48 | /-- The actual pulled metrics at two times differ by the time ratio. -/ |
| 49 | theorem soliton_pullback_metric_eq_time_ratio |
| 50 | (hzero : ∀ s ∈ J, s ≠ 0) |
| 51 | (hsol : ∀ s ∈ J, ∀ y (a b : TangentSpace (𝓡 n) y), |
| 52 | (F.connection s).ricci y a b + (F.connection s).hessian (fun z => f (s, z)) y a b + |
| 53 | (1 / (2 * s)) * (F.metric s).inner y a b = 0) |
| 54 | {s t : ℝ} (hsJ : s ∈ J) (htJ : t ∈ J) (x : M) (v w : TangentSpace (𝓡 n) x) : |
| 55 | (F.metric t).inner (Φ t x) |
| 56 | (mfderiv (𝓡 n) (𝓡 n) (Φ t) x v) (mfderiv (𝓡 n) (𝓡 n) (Φ t) x w) = |
| 57 | (t / s) * (F.metric s).inner (Φ s x) |
| 58 | (mfderiv (𝓡 n) (𝓡 n) (Φ s) x v) (mfderiv (𝓡 n) (𝓡 n) (Φ s) x w) := by |
| 59 | let m : ℝ → ℝ := fun r => (F.metric r).inner (Φ r x) |
| 60 | (mfderiv (𝓡 n) (𝓡 n) (Φ r) x v) (mfderiv (𝓡 n) (𝓡 n) (Φ r) x w) |
| 61 | have hd (r : ℝ) (hr : r ∈ J) : HasDerivAt m ((1 / r) * m r) r := |
| 62 | F.hasDerivAt_soliton_pullback_metric hJ hf hs hΦ hr (hsol r hr) x v w |
| 63 | have hz (r : ℝ) (hr : r ∈ J) : HasDerivAt (fun u => m u / u) 0 r := by |
| 64 | apply ((hd r hr).div (hasDerivAt_id r) (hzero r hr)).congr_deriv |
| 65 | dsimp only [id_eq] |
| 66 | field_simp [hzero r hr] |
| 67 | ring |
| 68 | have heq : m t / t = m s / s := hJ.is_const_of_deriv_eq_zero F.interval.isPreconnected |
| 69 | (fun r hr => (hz r hr).differentiableAt.differentiableWithinAt) |
| 70 | (fun r hr => (hz r hr).deriv) htJ hsJ |
| 71 | change m t = (t / s) * m s |
| 72 | calc |
| 73 | m t = (m t / t) * t := (div_mul_cancel₀ (m t) (hzero t htJ)).symm |
| 74 | _ = (m s / s) * t := by rw [heq] |
| 75 | _ = (t / s) * m s := by ring |
| 76 | |
| 77 | end PoincareMT.RicciFlow |