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 Mathlib.Analysis.Calculus.ImplicitContDiff |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 3 | import Mathlib.Analysis.InnerProductSpace.Calculus |
| 4 | |
| 5 | /-! |
| 6 | # A local footpoint branch at a specified immersed label |
| 7 | |
| 8 | The fixed-reference normal constraint has a nonzero scalar label |
| 9 | derivative. Mathlib's implicit-function theorem supplies an actual branch |
| 10 | near that label, without requiring injectivity of the reference image. |
| 11 | MT2007 Claim 19.1, p. 437; |
| 12 | `2026-09-21-uniqueness-local-footpoint.md`. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Filter |
| 18 | open scoped ContDiff Topology RealInnerProductSpace |
| 19 | |
| 20 | namespace PoincareMT.M63 |
| 21 | |
| 22 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 23 | |
| 24 | /-- The literal fixed-reference normal constraint at a candidate point |
| 25 | and label. MT2007 Claim 19.1, p. 437; local-footpoint derivation. -/ |
| 26 | noncomputable def curveFootpointResidual (r : ℝ → E) (z : E × ℝ) : ℝ := |
| 27 | ⟪z.1 - r z.2, deriv r z.2⟫ |
| 28 | |
| 29 | /-- A smooth reference has a smooth actual normal-constraint residual. |
| 30 | MT2007 Claim 19.1, p. 437; local-footpoint derivation, statement 1. -/ |
| 31 | theorem curveFootpointResidual_contDiff {r : ℝ → E} (hr : ContDiff ℝ ∞ r) : |
| 32 | ContDiff ℝ ∞ (curveFootpointResidual r) := by |
| 33 | exact (contDiff_fst.sub (hr.comp contDiff_snd)).inner ℝ |
| 34 | ((contDiff_infty_iff_deriv.mp hr).2.comp contDiff_snd) |
| 35 | |
| 36 | /-- At the specified reference label the scalar partial derivative is |
| 37 | minus the squared reference speed. MT2007 Claim 19.1, p. 437; |
| 38 | local-footpoint derivation, statement 1. Actual smoothness witnesses |
| 39 | the derivatives before they enter the displayed formula. -/ |
| 40 | theorem curveFootpointResidual_partial {r : ℝ → E} (hr : ContDiff ℝ ∞ r) (x : ℝ) : |
| 41 | (fderiv ℝ (curveFootpointResidual r) (r x, x)).comp |
| 42 | (ContinuousLinearMap.inr ℝ E ℝ) = |
| 43 | (-‖deriv r x‖ ^ 2) • ContinuousLinearMap.id ℝ ℝ := by |
| 44 | have hr₁ := (contDiff_infty_iff_deriv.mp hr).1 |
| 45 | have hr₂ := (contDiff_infty_iff_deriv.mp (contDiff_infty_iff_deriv.mp hr).2).1 |
| 46 | have hpartial : HasDerivAt (fun y => curveFootpointResidual r (r x, y)) |
| 47 | (-‖deriv r x‖ ^ 2) x := by |
| 48 | simpa only [curveFootpointResidual, Pi.sub_apply, sub_self, zero_sub, inner_zero_left, |
| 49 | inner_neg_left, real_inner_self_eq_norm_sq, zero_add] using |
| 50 | (((hasDerivAt_const x (r x)).sub (hr₁ x).hasDerivAt).inner ℝ |
| 51 | (hr₂ x).hasDerivAt) |
| 52 | have hprod : (0 : ℝ →L[ℝ] E).prod (ContinuousLinearMap.id ℝ ℝ) = |
| 53 | ContinuousLinearMap.inr ℝ E ℝ := by |
| 54 | apply ContinuousLinearMap.ext |
| 55 | intro y |
| 56 | rfl |
| 57 | have hslice : HasFDerivAt (fun y => curveFootpointResidual r (r x, y)) |
| 58 | ((fderiv ℝ (curveFootpointResidual r) (r x, x)).comp |
| 59 | (ContinuousLinearMap.inr ℝ E ℝ)) x := by |
| 60 | simpa only [Function.comp_def, hprod] using |
| 61 | ((curveFootpointResidual_contDiff hr).differentiable (by simp) |
| 62 | (r x, x)).hasFDerivAt.comp x |
| 63 | ((hasFDerivAt_const (r x) x).prodMk (hasFDerivAt_id x)) |
| 64 | rw [hslice.unique hpartial.hasFDerivAt] |
| 65 | apply ContinuousLinearMap.ext |
| 66 | intro y |
| 67 | change y * (-‖deriv r x‖ ^ 2) = (-‖deriv r x‖ ^ 2) * y |
| 68 | exact mul_comm _ _ |
| 69 | |
| 70 | /-- At each specified nonzero reference label there is an actual smooth |
| 71 | footpoint germ with local uniqueness in point-label space. It retracts |
| 72 | the reference labels near that label, even at self-intersections. |
| 73 | MT2007 Claim 19.1, p. 437; local-footpoint derivation, statement 2. |
| 74 | Infinity-order regularity is asserted only as a germ at the center. -/ |
| 75 | theorem exists_curveFootpoint_germ [CompleteSpace E] |
| 76 | {r : ℝ → E} (hr : ContDiff ℝ ∞ r) {x : ℝ} (hx : deriv r x ≠ 0) : |
| 77 | ∃ pi : E → ℝ, pi (r x) = x ∧ ContDiffAt ℝ ∞ pi (r x) ∧ |
| 78 | (∀ᶠ z in 𝓝 (r x), curveFootpointResidual r (z, pi z) = 0) ∧ |
| 79 | (∀ᶠ z : E × ℝ in 𝓝 (r x, x), |
| 80 | curveFootpointResidual r z = 0 ↔ pi z.1 = z.2) ∧ |
| 81 | (∀ᶠ y in 𝓝 x, pi (r y) = y) ∧ |
| 82 | HasDerivAt (fun y => pi (r y)) 1 x := by |
| 83 | have hH := (curveFootpointResidual_contDiff hr).contDiffAt (x := (r x, x)) |
| 84 | have hc : -‖deriv r x‖ ^ 2 ≠ 0 := |
| 85 | neg_ne_zero.mpr (pow_ne_zero 2 (norm_ne_zero_iff.mpr hx)) |
| 86 | have hinv : ((fderiv ℝ (curveFootpointResidual r) (r x, x)).comp |
| 87 | (ContinuousLinearMap.inr ℝ E ℝ)).IsInvertible := by |
| 88 | rw [curveFootpointResidual_partial hr x] |
| 89 | apply ContinuousLinearMap.IsInvertible.of_inverse |
| 90 | (g := (-‖deriv r x‖ ^ 2)⁻¹ • ContinuousLinearMap.id ℝ ℝ) |
| 91 | · apply ContinuousLinearMap.ext |
| 92 | intro y |
| 93 | simp only [ContinuousLinearMap.comp_apply, smul_apply, |
| 94 | ContinuousLinearMap.id_apply, smul_smul, mul_inv_cancel₀ hc, one_smul] |
| 95 | · apply ContinuousLinearMap.ext |
| 96 | intro y |
| 97 | simp only [ContinuousLinearMap.comp_apply, smul_apply, |
| 98 | ContinuousLinearMap.id_apply, smul_smul, inv_mul_cancel₀ hc, one_smul] |
| 99 | let pi := hH.implicitFunction (by simp) hinv |
| 100 | have hH0 : curveFootpointResidual r (r x, x) = 0 := by |
| 101 | simp only [curveFootpointResidual, sub_self, inner_zero_left] |
| 102 | have hlocal : ∀ᶠ z : E × ℝ in 𝓝 (r x, x), |
| 103 | curveFootpointResidual r z = 0 ↔ pi z.1 = z.2 := by |
| 104 | simpa only [hH0] using hH.eventually_apply_eq_iff_implicitFunction (by simp) hinv |
| 105 | have hreference : ∀ᶠ y in 𝓝 x, pi (r y) = y := by |
| 106 | have hlim : Tendsto (fun y => (r y, y)) (𝓝 x) (𝓝 (r x, x)) := |
| 107 | hr.continuous.continuousAt.prodMk continuousAt_id |
| 108 | filter_upwards [hlim.eventually hlocal] with y hy |
| 109 | exact hy.mp (by simp only [curveFootpointResidual, sub_self, inner_zero_left]) |
| 110 | refine ⟨pi, hH.implicitFunction_apply_self (by simp) hinv, |
| 111 | hH.contDiffAt_implicitFunction (by simp) hinv, ?_, hlocal, hreference, ?_⟩ |
| 112 | · simpa only [hH0] using hH.eventually_apply_implicitFunction (by simp) hinv |
| 113 | · exact (hasDerivAt_id x).congr_of_eventuallyEq hreference |
| 114 | |
| 115 | end PoincareMT.M63 |