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.ReducedGeometry.ReducedVolume.Regularity.Semiconcavity.ContactConcavity |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedVolume.Metric.Hessian.LineSecondDerivative |
| 3 | import Mathlib.Analysis.InnerProductSpace.Calculus |
| 4 | import Mathlib.Analysis.Convex.Function |
| 5 | |
| 6 | /-! |
| 7 | # Semiconcavity from coordinate upper contacts |
| 8 | |
| 9 | Morgan-Tian Claim 7.18 and Corollary 7.19, pp. 158-160, with the |
| 10 | concavity correction. Only each contact's Hessian at its contact point |
| 11 | is bounded; the chord argument makes no off-center assertion. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Topology |
| 18 | |
| 19 | namespace PoincareMT.ReducedVolume |
| 20 | |
| 21 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 22 | |
| 23 | /-- The affine-line second derivative formula holds at every parameter value. -/ |
| 24 | theorem second_deriv_affine_line_at {f : E → ℝ} (x v : E) {t : ℝ} |
| 25 | (hf : ContDiffAt ℝ 2 f (x + t • v)) : |
| 26 | deriv (deriv (fun s : ℝ ↦ f (x + s • v))) t = |
| 27 | fderiv ℝ (fderiv ℝ f) (x + t • v) v v := by |
| 28 | let F := fun s : ℝ ↦ f (x + s • v) |
| 29 | have heq : (fun s : ℝ ↦ f ((x + t • v) + s • v)) = fun s ↦ F (t + s) := by |
| 30 | funext s |
| 31 | simp only [F, add_smul, add_assoc] |
| 32 | have h := second_deriv_affine_line hf v |
| 33 | rw [heq] at h |
| 34 | have hfirst : deriv (fun s ↦ F (t + s)) = fun s ↦ deriv F (t + s) := |
| 35 | funext (deriv_comp_const_add F t) |
| 36 | rw [hfirst, deriv_comp_const_add, add_zero] at h |
| 37 | exact h |
| 38 | |
| 39 | /-- Subtracting the Euclidean quadratic cancels the upper Hessian bound on every chord. -/ |
| 40 | theorem second_deriv_sub_norm_sq_on_line {f : E → ℝ} (x v : E) {t : ℝ} |
| 41 | (hf : ContDiffAt ℝ 2 f (x + t • v)) (K : ℝ) : |
| 42 | deriv (deriv (fun s : ℝ ↦ f (x + s • v) - K * ‖x + s • v‖ ^ 2 / 2)) t = |
| 43 | fderiv ℝ (fderiv ℝ f) (x + t • v) v v - K * ‖v‖ ^ 2 := by |
| 44 | have hnorm (s : ℝ) : K * ‖x + s • v‖ ^ 2 / 2 = |
| 45 | K * ‖x‖ ^ 2 / 2 + (K * inner ℝ x v) * s + (K * ‖v‖ ^ 2 / 2) * s ^ 2 := by |
| 46 | rw [norm_add_sq_real, real_inner_smul_right, norm_smul, Real.norm_eq_abs, |
| 47 | mul_pow, sq_abs] |
| 48 | ring |
| 49 | simp_rw [hnorm] |
| 50 | have hline : ContDiffAt ℝ 2 (fun s : ℝ ↦ f (x + s • v)) t := |
| 51 | hf.comp t (by fun_prop) |
| 52 | rw [second_deriv_sub_quadratic hline, second_deriv_affine_line_at x v hf] |
| 53 | ring |
| 54 | |
| 55 | /-- A uniform bound on the Hessians of upper contacts makes the corrected function concave. -/ |
| 56 | theorem concaveOn_sub_norm_sq_of_upper_contacts {s : Set E} {f : E → ℝ} {K : ℝ} |
| 57 | (hs : Convex ℝ s) (hf : ContinuousOn f s) |
| 58 | (hcontacts : ∀ x ∈ s, ∃ B : E → ℝ, |
| 59 | B x = f x ∧ (∀ᶠ y in 𝓝 x, f y ≤ B y) ∧ ContDiffAt ℝ 2 B x ∧ |
| 60 | ∀ v : E, fderiv ℝ (fderiv ℝ B) x v v ≤ K * ‖v‖ ^ 2) : |
| 61 | ConcaveOn ℝ s (fun x ↦ f x - K * ‖x‖ ^ 2 / 2) := by |
| 62 | refine ⟨hs, ?_⟩ |
| 63 | intro x hx y hy a b ha hb hab |
| 64 | let L := fun t : ℝ ↦ x + t • (y - x) |
| 65 | have hLform (t : ℝ) : L t = (1 - t) • x + t • y := by |
| 66 | dsimp only [L] |
| 67 | simp only [sub_smul, one_smul, smul_sub] |
| 68 | abel |
| 69 | have hL : Continuous L := by dsimp only [L]; fun_prop |
| 70 | have hLmem : MapsTo L (Icc 0 1) s := by |
| 71 | intro t ht |
| 72 | rw [hLform] |
| 73 | exact hs hx hy (sub_nonneg.mpr ht.2) ht.1 (by ring) |
| 74 | let F := fun t ↦ f (L t) - K * ‖L t‖ ^ 2 / 2 |
| 75 | have hF : ContinuousOn F (Icc 0 1) := |
| 76 | (hf.comp hL.continuousOn hLmem).sub |
| 77 | (show Continuous (fun t ↦ K * ‖L t‖ ^ 2 / 2) by fun_prop).continuousOn |
| 78 | have hupper (c : ℝ) (hc : c ∈ Ioo 0 1) : ∃ B : ℝ → ℝ, |
| 79 | B c = F c ∧ (∀ᶠ t in 𝓝 c, F t ≤ B t) ∧ |
| 80 | ContDiffAt ℝ 2 B c ∧ deriv (deriv B) c ≤ 0 := by |
| 81 | obtain ⟨B, hBc, hupper, hB, hsecond⟩ := hcontacts (L c) (hLmem ⟨hc.1.le, hc.2.le⟩) |
| 82 | refine ⟨fun t ↦ B (L t) - K * ‖L t‖ ^ 2 / 2, ?_, ?_, ?_, ?_⟩ |
| 83 | · simp only [hBc, F] |
| 84 | · have hnear : ∀ᶠ t in 𝓝 c, f (L t) ≤ B (L t) := hL.continuousAt hupper |
| 85 | exact hnear.mono (fun t ht ↦ sub_le_sub_right ht _) |
| 86 | · exact (hB.comp c (by dsimp only [L]; fun_prop)).sub |
| 87 | ((contDiffAt_const.mul ((show ContDiffAt ℝ 2 L c by |
| 88 | dsimp only [L]; fun_prop).norm_sq ℝ)).div_const 2) |
| 89 | · rw [second_deriv_sub_norm_sq_on_line x (y - x) hB K] |
| 90 | exact sub_nonpos.mpr (hsecond (y - x)) |
| 91 | have hb1 : b ≤ 1 := by linarith |
| 92 | have h := chord_le_of_upper_contacts hF hupper (x := b) ⟨hb, hb1⟩ |
| 93 | have h0 : L 0 = x := by simp [L] |
| 94 | have h1 : L 1 = y := by simp [L] |
| 95 | have hbform : L b = a • x + b • y := by |
| 96 | rw [hLform, show 1 - b = a by linarith] |
| 97 | simpa only [F, h0, h1, hbform, show 1 - b = a by linarith, smul_eq_mul] using h |
| 98 | |
| 99 | end PoincareMT.ReducedVolume |