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.Analysis.Convex.Semiconcavity.Derivative |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 3 | |
| 4 | /-! # Directional bounds for uniform approximations with upper Hessian control -/ |
| 5 | |
| 6 | set_option autoImplicit false |
| 7 | set_option backward.isDefEq.respectTransparency false |
| 8 | |
| 9 | open Set |
| 10 | open scoped ContDiff |
| 11 | |
| 12 | namespace Poincare.Analysis |
| 13 | |
| 14 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 15 | |
| 16 | /-- A backward increment of the reference function controls the differential |
| 17 | of a uniform smooth approximation with a one-sided second derivative bound. -/ |
| 18 | theorem fderiv_le_of_approx_of_backward_increment |
| 19 | {u F : E → ℝ} (hu : ContDiff ℝ 2 u) {y v : E} {T ε c Cf Cu : ℝ} |
| 20 | (hT : 0 < T) |
| 21 | (herr : ∀ t ∈ Icc (0 : ℝ) T, |u (y - t • v) - F (y - t • v)| ≤ ε) |
| 22 | (hH : ∀ t ∈ Icc (0 : ℝ) T, |
| 23 | fderiv ℝ (fderiv ℝ u) (y - t • v) v v ≤ Cu * ‖v‖ ^ 2) |
| 24 | (hinc : F y - F (y - T • v) ≤ c * T + Cf * T ^ 2 * ‖v‖ ^ 2 / 2) : |
| 25 | fderiv ℝ u y v ≤ c + 2 * ε / T + (Cf + Cu) * T * ‖v‖ ^ 2 / 2 := by |
| 26 | let q : ℝ → E := fun t => y - t • v |
| 27 | let f : ℝ → ℝ := fun t => u (q t) |
| 28 | let f' : ℝ → ℝ := fun t => -fderiv ℝ u (q t) v |
| 29 | let f'' : ℝ → ℝ := fun t => fderiv ℝ (fderiv ℝ u) (q t) v v |
| 30 | have hq (t : ℝ) : HasDerivAt q (-v) t := by |
| 31 | simpa only [q, id_eq, one_smul] using ((hasDerivAt_id t).smul_const v).const_sub y |
| 32 | have hfirst (t : ℝ) (_ht : t ∈ Icc (0 : ℝ) T) : HasDerivAt f (f' t) t := by |
| 33 | simpa only [f, f', Function.comp_def, map_neg] using |
| 34 | ((hu.differentiable (by norm_num) (q t)).hasFDerivAt.comp_hasDerivAt t (hq t)) |
| 35 | have hsecond (t : ℝ) (_ht : t ∈ Ioo (0 : ℝ) T) : HasDerivAt f' (f'' t) t := by |
| 36 | have hdu : DifferentiableAt ℝ (fderiv ℝ u) (q t) := |
| 37 | ((hu.contDiffAt.fderiv_right (m := 1) (by norm_num)).differentiableAt (by norm_num)) |
| 38 | have h := ((hdu.hasFDerivAt.comp_hasDerivAt t (hq t)).clm_apply |
| 39 | (hasDerivAt_const t v)).neg |
| 40 | convert! h using 1 |
| 41 | simp only [f'', map_neg, neg_apply, map_zero, add_zero, neg_neg] |
| 42 | have htaylor := quadratic_upper_bound_of_hasDerivAt2_le hT.le hfirst hsecond |
| 43 | (fun t ht => hH t ⟨ht.1.le, ht.2.le⟩) |
| 44 | have hzero := (abs_le.mp (herr 0 ⟨le_rfl, hT.le⟩)).2 |
| 45 | have hlast := (abs_le.mp (herr T ⟨hT.le, le_rfl⟩)).1 |
| 46 | simp only [f, f', q, zero_smul, sub_zero] at htaylor hzero |
| 47 | have hbound : fderiv ℝ u y v * T ≤ |
| 48 | c * T + 2 * ε + (Cf + Cu) * T ^ 2 * ‖v‖ ^ 2 / 2 := by |
| 49 | nlinarith [htaylor, hzero, hlast, hinc] |
| 50 | have hdiv := (le_div_iff₀ hT).mpr hbound |
| 51 | convert! hdiv using 1 |
| 52 | field_simp |
| 53 | |
| 54 | end Poincare.Analysis |