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.ScalarUpperContacts |
| 2 | import Mathlib.Analysis.Calculus.IteratedDeriv.Lemmas |
| 3 | import Mathlib.Analysis.Calculus.Deriv.Pow |
| 4 | |
| 5 | /-! |
| 6 | # Chord comparison from upper contacts |
| 7 | |
| 8 | Morgan-Tian Claim 7.18 and Corollary 7.19, with the concavity correction. |
| 9 | Only the second derivative at each contact center is bounded. A strict |
| 10 | quadratic perturbation reduces the chord inequality to compact minimization. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set Filter |
| 16 | open scoped Topology |
| 17 | |
| 18 | namespace PoincareMT.ReducedVolume |
| 19 | |
| 20 | /-- Subtracting an affine quadratic subtracts its exact second derivative. -/ |
| 21 | theorem second_deriv_sub_quadratic {B : ℝ → ℝ} {c : ℝ} |
| 22 | (hB : ContDiffAt ℝ 2 B c) (u v ε : ℝ) : |
| 23 | deriv (deriv (fun t ↦ B t - (u + v * t + ε * t ^ 2))) c = |
| 24 | deriv (deriv B) c - 2 * ε := by |
| 25 | let P := fun t : ℝ ↦ u + v * t + ε * t ^ 2 |
| 26 | have hP (t : ℝ) : HasDerivAt P (v + 2 * ε * t) t := by |
| 27 | dsimp only [P] |
| 28 | have hd := ((hasDerivAt_const t u).add ((hasDerivAt_id t).const_mul v)).add |
| 29 | ((hasDerivAt_pow 2 t).const_mul ε) |
| 30 | apply hd.congr_deriv |
| 31 | simp only [mul_one, zero_add, Nat.cast_ofNat] |
| 32 | ring |
| 33 | have hdP : deriv P = fun t ↦ v + 2 * ε * t := funext (fun t ↦ (hP t).deriv) |
| 34 | have hddP : deriv (deriv P) c = 2 * ε := by |
| 35 | rw [hdP] |
| 36 | simpa only [id_eq, mul_one] using |
| 37 | (((hasDerivAt_id c).const_mul (2 * ε)).const_add v).deriv |
| 38 | have h := iteratedDeriv_sub hB (show ContDiffAt ℝ 2 P c by dsimp [P]; fun_prop) |
| 39 | have h' : deriv (deriv (B - P)) c = deriv (deriv B) c - 2 * ε := by |
| 40 | simpa only [iteratedDeriv_succ, iteratedDeriv_zero, hddP] using h |
| 41 | exact h' |
| 42 | |
| 43 | /-- Nonpositive second derivatives of local upper contacts force the chord inequality. -/ |
| 44 | theorem chord_le_of_upper_contacts {f : ℝ → ℝ} |
| 45 | (hf : ContinuousOn f (Icc 0 1)) |
| 46 | (hcontacts : ∀ c ∈ Ioo 0 1, ∃ B : ℝ → ℝ, |
| 47 | B c = f c ∧ (∀ᶠ t in 𝓝 c, f t ≤ B t) ∧ |
| 48 | ContDiffAt ℝ 2 B c ∧ deriv (deriv B) c ≤ 0) |
| 49 | {x : ℝ} (hx : x ∈ Icc 0 1) : |
| 50 | (1 - x) * f 0 + x * f 1 ≤ f x := by |
| 51 | apply le_of_forall_pos_le_add |
| 52 | intro ε hε |
| 53 | let P := fun t : ℝ ↦ f 0 + (f 1 - f 0 - ε) * t + ε * t ^ 2 |
| 54 | let h := fun t ↦ f t - P t |
| 55 | have hcont : ContinuousOn h (Icc 0 1) := |
| 56 | hf.sub (show Continuous P by dsimp [P]; fun_prop).continuousOn |
| 57 | have hstrict (c : ℝ) (hc : c ∈ Ioo 0 1) : |
| 58 | ∃ B : ℝ → ℝ, B c = h c ∧ (∀ᶠ t in 𝓝 c, h t ≤ B t) ∧ |
| 59 | ContinuousAt B c ∧ deriv (deriv B) c < 0 := by |
| 60 | obtain ⟨B, hBc, hupper, hB, hsecond⟩ := hcontacts c hc |
| 61 | refine ⟨fun t ↦ B t - P t, ?_, ?_, ?_, ?_⟩ |
| 62 | · simp only [hBc, h] |
| 63 | · exact hupper.mono (fun t ht ↦ sub_le_sub_right ht (P t)) |
| 64 | · exact hB.continuousAt.sub (by dsimp [P]; fun_prop) |
| 65 | · rw [second_deriv_sub_quadratic hB] |
| 66 | linarith only [hsecond, hε] |
| 67 | have hbound := min_endpoints_le_of_strict_upper_contacts (by norm_num : (0 : ℝ) < 1) |
| 68 | hcont hstrict hx |
| 69 | have h0 : h 0 = 0 := by dsimp [h, P]; ring |
| 70 | have h1 : h 1 = 0 := by dsimp [h, P]; ring |
| 71 | rw [h0, h1, min_self] at hbound |
| 72 | have hquadratic : x * (1 - x) ≤ 1 := by nlinarith [sq_nonneg x] |
| 73 | have hεbound := mul_le_mul_of_nonneg_left hquadratic hε.le |
| 74 | dsimp only [h, P] at hbound |
| 75 | nlinarith only [hbound, hεbound] |
| 76 | |
| 77 | end PoincareMT.ReducedVolume |