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.CurveShortening.Ramp.LocalFlow.Uniqueness.LocalFootpoint |
| 2 | import Mathlib.Analysis.Calculus.MeanValue |
| 3 | import Mathlib.Analysis.Calculus.Deriv.MeanValue |
| 4 | import Mathlib.Topology.Order.IntermediateValue |
| 5 | |
| 6 | /-! |
| 7 | # A unique nearby normal label |
| 8 | |
| 9 | Explicit speed and acceleration bounds make the actual scalar normal |
| 10 | constraint strictly decreasing in a label window. MT2007 Claim 19.1, |
| 11 | p. 437; `2026-09-22-uniqueness-periodic-footpoint.md`, statements 1--2. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set |
| 17 | open scoped ContDiff RealInnerProductSpace |
| 18 | |
| 19 | namespace PoincareMT.M63 |
| 20 | |
| 21 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 22 | |
| 23 | /-- The scalar label partial of the actual normal constraint at any |
| 24 | point-label pair. MT2007 Claim 19.1, p. 437; periodic-footpoint |
| 25 | derivation, statement 1. -/ |
| 26 | theorem curveFootpointResidual_partial_at {r : ℝ → E} (hr : ContDiff ℝ ∞ r) |
| 27 | (z : E) (y : ℝ) : |
| 28 | (fderiv ℝ (curveFootpointResidual r) (z, y)).comp |
| 29 | (ContinuousLinearMap.inr ℝ E ℝ) = |
| 30 | (-‖deriv r y‖ ^ 2 + ⟪z - r y, deriv (deriv r) y⟫) • |
| 31 | ContinuousLinearMap.id ℝ ℝ := by |
| 32 | have hr₁ := (contDiff_infty_iff_deriv.mp hr).1 |
| 33 | have hr₂ := (contDiff_infty_iff_deriv.mp (contDiff_infty_iff_deriv.mp hr).2).1 |
| 34 | have hpartial : HasDerivAt (fun s => curveFootpointResidual r (z, s)) |
| 35 | (-‖deriv r y‖ ^ 2 + ⟪z - r y, deriv (deriv r) y⟫) y := by |
| 36 | simpa only [curveFootpointResidual, Pi.sub_apply, zero_sub, inner_neg_left, |
| 37 | real_inner_self_eq_norm_sq, add_comm] using |
| 38 | (((hasDerivAt_const y z).sub (hr₁ y).hasDerivAt).inner ℝ |
| 39 | (hr₂ y).hasDerivAt) |
| 40 | have hprod : (0 : ℝ →L[ℝ] E).prod (ContinuousLinearMap.id ℝ ℝ) = |
| 41 | ContinuousLinearMap.inr ℝ E ℝ := by |
| 42 | apply ContinuousLinearMap.ext |
| 43 | intro s |
| 44 | rfl |
| 45 | have hslice : HasFDerivAt (fun s => curveFootpointResidual r (z, s)) |
| 46 | ((fderiv ℝ (curveFootpointResidual r) (z, y)).comp |
| 47 | (ContinuousLinearMap.inr ℝ E ℝ)) y := by |
| 48 | simpa only [Function.comp_def, hprod] using |
| 49 | ((curveFootpointResidual_contDiff hr).differentiable (by simp) |
| 50 | (z, y)).hasFDerivAt.comp y |
| 51 | ((hasFDerivAt_const z y).prodMk (hasFDerivAt_id y)) |
| 52 | rw [hslice.unique hpartial.hasFDerivAt] |
| 53 | apply ContinuousLinearMap.ext |
| 54 | intro s |
| 55 | change s * _ = _ * s |
| 56 | exact mul_comm _ _ |
| 57 | |
| 58 | /-- The actual footpoint denominator stays positive on the whole closed |
| 59 | label window. MT2007 Claim 19.1, p. 437; periodic-footpoint derivation, |
| 60 | statement 2. No injectivity of the reference image is used. -/ |
| 61 | theorem curveFootpoint_denominator_lower {r : ℝ → E} (hr : ContDiff ℝ ∞ r) |
| 62 | {m M B rho eps x y : ℝ} {z : E} |
| 63 | (hm : 0 < m) (hM : 0 < M) (_hB : 0 ≤ B) (hrho : 0 < rho) (heps : 0 < eps) |
| 64 | (hlower : ∀ s, m ≤ ‖deriv r s‖) (hupper : ∀ s, ‖deriv r s‖ ≤ M) |
| 65 | (hsecond : ∀ s, ‖deriv (deriv r) s‖ ≤ B) |
| 66 | (hsmall : 2 * B * (eps + M * rho) ≤ m ^ 2) |
| 67 | (hz : ‖z - r x‖ < eps) (hy : y ∈ Icc (x - rho) (x + rho)) : |
| 68 | m ^ 2 / 2 ≤ ‖deriv r y‖ ^ 2 - ⟪z - r y, deriv (deriv r) y⟫ := by |
| 69 | have hxy : |y - x| ≤ rho := abs_le.mpr ⟨by linarith [hy.1], by linarith [hy.2]⟩ |
| 70 | have hLip : ‖r y - r x‖ ≤ M * |y - x| := by |
| 71 | simpa only [Real.norm_eq_abs] using |
| 72 | (convex_univ : Convex ℝ (univ : Set ℝ)).norm_image_sub_le_of_norm_deriv_le |
| 73 | (fun s _ => (hr.differentiable (by simp) s)) (fun s _ => hupper s) |
| 74 | (mem_univ x) (mem_univ y) |
| 75 | have hdist : ‖z - r y‖ ≤ eps + M * rho := calc |
| 76 | ‖z - r y‖ ≤ ‖z - r x‖ + ‖r x - r y‖ := by |
| 77 | simpa only [dist_eq_norm] using dist_triangle z (r x) (r y) |
| 78 | _ = ‖z - r x‖ + ‖r y - r x‖ := by rw [norm_sub_rev (r x) (r y)] |
| 79 | _ ≤ eps + M * rho := add_le_add hz.le (hLip.trans (mul_le_mul_of_nonneg_left hxy hM.le)) |
| 80 | have hinner : ⟪z - r y, deriv (deriv r) y⟫ ≤ (eps + M * rho) * B := |
| 81 | (real_inner_le_norm _ _).trans |
| 82 | (mul_le_mul hdist (hsecond y) (norm_nonneg _) (by positivity)) |
| 83 | have hsquare : m ^ 2 ≤ ‖deriv r y‖ ^ 2 := by |
| 84 | nlinarith [hlower y, norm_nonneg (deriv r y)] |
| 85 | nlinarith |
| 86 | |
| 87 | /-- The normal constraint has exactly one root in the prescribed open |
| 88 | label window. MT2007 Claim 19.1, p. 437; periodic-footpoint derivation, |
| 89 | statement 2. Endpoint margins follow from the stated smallness bounds. -/ |
| 90 | theorem existsUnique_curveFootpoint_near {r : ℝ → E} (hr : ContDiff ℝ ∞ r) |
| 91 | {m M B rho eps x : ℝ} {z : E} |
| 92 | (hm : 0 < m) (hM : 0 < M) (hB : 0 ≤ B) (hrho : 0 < rho) (heps : 0 < eps) |
| 93 | (hlower : ∀ s, m ≤ ‖deriv r s‖) (hupper : ∀ s, ‖deriv r s‖ ≤ M) |
| 94 | (hsecond : ∀ s, ‖deriv (deriv r) s‖ ≤ B) |
| 95 | (hsmall : 2 * B * (eps + M * rho) ≤ m ^ 2) |
| 96 | (hmargin : 4 * eps * M ≤ m ^ 2 * rho) (hz : ‖z - r x‖ < eps) : |
| 97 | ∃! y, |y - x| < rho ∧ curveFootpointResidual r (z, y) = 0 := by |
| 98 | let H : ℝ → ℝ := fun s => curveFootpointResidual r (z, s) |
| 99 | have hr₁ := (contDiff_infty_iff_deriv.mp hr).1 |
| 100 | have hr₂ := (contDiff_infty_iff_deriv.mp (contDiff_infty_iff_deriv.mp hr).2).1 |
| 101 | have hderiv (s : ℝ) : HasDerivAt H |
| 102 | (-‖deriv r s‖ ^ 2 + ⟪z - r s, deriv (deriv r) s⟫) s := by |
| 103 | simpa only [H, curveFootpointResidual, Pi.sub_apply, zero_sub, inner_neg_left, |
| 104 | real_inner_self_eq_norm_sq, add_comm] using |
| 105 | (((hasDerivAt_const s z).sub (hr₁ s).hasDerivAt).inner ℝ |
| 106 | (hr₂ s).hasDerivAt) |
| 107 | have hcontinuous : Continuous H := continuous_iff_continuousAt.mpr |
| 108 | (fun s => (hderiv s).continuousAt) |
| 109 | have hdifferentiable : Differentiable ℝ H := fun s => (hderiv s).differentiableAt |
| 110 | have hbound (s : ℝ) (hs : s ∈ Icc (x - rho) (x + rho)) : deriv H s ≤ -(m ^ 2 / 2) := by |
| 111 | rw [(hderiv s).deriv] |
| 112 | have h := curveFootpoint_denominator_lower hr hm hM hB hrho heps |
| 113 | hlower hupper hsecond hsmall hz hs |
| 114 | linarith |
| 115 | have hx : x ∈ Icc (x - rho) (x + rho) := ⟨by linarith, by linarith⟩ |
| 116 | have hab : x - rho ≤ x + rho := by linarith |
| 117 | have hleft := (convex_Icc (x - rho) (x + rho)).image_sub_le_mul_sub_of_deriv_le |
| 118 | hcontinuous.continuousOn hdifferentiable.differentiableOn |
| 119 | (fun s hs => hbound s (interior_subset hs)) |
| 120 | (x - rho) (left_mem_Icc.mpr hab) x hx (by linarith) |
| 121 | have hright := (convex_Icc (x - rho) (x + rho)).image_sub_le_mul_sub_of_deriv_le |
| 122 | hcontinuous.continuousOn hdifferentiable.differentiableOn |
| 123 | (fun s hs => hbound s (interior_subset hs)) |
| 124 | x hx (x + rho) (right_mem_Icc.mpr hab) (by linarith) |
| 125 | have hcenter : |H x| ≤ eps * M := |
| 126 | (abs_real_inner_le_norm (z - r x) (deriv r x)).trans |
| 127 | (mul_le_mul hz.le (hupper x) (norm_nonneg _) heps.le) |
| 128 | have hpositive : 0 < m ^ 2 * rho := mul_pos (sq_pos_of_pos hm) hrho |
| 129 | have hleftpos : 0 < H (x - rho) := by |
| 130 | have hcenterlo := (abs_le.mp hcenter).1 |
| 131 | nlinarith |
| 132 | have hrightneg : H (x + rho) < 0 := by |
| 133 | have hcenterhi := (abs_le.mp hcenter).2 |
| 134 | nlinarith |
| 135 | obtain ⟨y, hy, hzero⟩ := intermediate_value_Ioo' hab hcontinuous.continuousOn |
| 136 | (show (0 : ℝ) ∈ Ioo (H (x + rho)) (H (x - rho)) from ⟨hrightneg, hleftpos⟩) |
| 137 | have hstrict : StrictAntiOn H (Icc (x - rho) (x + rho)) := |
| 138 | strictAntiOn_of_deriv_neg (convex_Icc _ _) hcontinuous.continuousOn |
| 139 | (fun s hs => (hbound s (interior_subset hs)).trans_lt (by nlinarith [sq_pos_of_pos hm])) |
| 140 | refine ⟨y, ⟨abs_lt.mpr ⟨by linarith [hy.1], by linarith [hy.2]⟩, hzero⟩, ?_⟩ |
| 141 | intro y' hy' |
| 142 | have hy'window : y' ∈ Icc (x - rho) (x + rho) := by |
| 143 | have habs := abs_lt.mp hy'.1 |
| 144 | exact ⟨by linarith [habs.1], by linarith [habs.2]⟩ |
| 145 | exact hstrict.injOn hy'window (Ioo_subset_Icc_self hy) (hy'.2.trans hzero.symm) |
| 146 | |
| 147 | end PoincareMT.M63 |