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.Surgery.StandardCap.Uniqueness.Imports |
| 2 | import Mathlib.Analysis.Calculus.FDeriv.Symmetric |
| 3 | import Mathlib.Analysis.Calculus.MeanValue |
| 4 | import Mathlib.Analysis.Calculus.ContDiff.Operations |
| 5 | |
| 6 | /-! |
| 7 | # Smooth quadratic jets for the complete curvature barrier |
| 8 | |
| 9 | Morgan-Tian Lemma 12.6 and Section 12.5. A local distance support can be |
| 10 | replaced by its quadratic jet plus an arbitrarily small positive quadratic. |
| 11 | This supplies a globally smooth scalar for the sectional null-tensor test. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set Filter Asymptotics |
| 18 | open scoped Topology ContDiff |
| 19 | |
| 20 | namespace PoincareMT.M35.Uniqueness |
| 21 | |
| 22 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 23 | |
| 24 | noncomputable def quadraticJet (c : ℝ) (L : E →L[ℝ] ℝ) |
| 25 | (B : E →L[ℝ] E →L[ℝ] ℝ) (x y : E) : ℝ := |
| 26 | c + L (y - x) + (1 / 2 : ℝ) * B (y - x) (y - x) |
| 27 | |
| 28 | theorem quadraticJet_contDiff (c : ℝ) (L : E →L[ℝ] ℝ) |
| 29 | (B : E →L[ℝ] E →L[ℝ] ℝ) (x : E) : |
| 30 | ContDiff ℝ ∞ (quadraticJet c L B x) := by |
| 31 | unfold quadraticJet |
| 32 | exact (contDiff_const.add (L.contDiff.comp (contDiff_id.sub contDiff_const))).add |
| 33 | (contDiff_const.mul ((B.contDiff.comp (contDiff_id.sub contDiff_const)).clm_apply |
| 34 | (contDiff_id.sub contDiff_const))) |
| 35 | |
| 36 | @[simp] theorem quadraticJet_self (c : ℝ) (L : E →L[ℝ] ℝ) |
| 37 | (B : E →L[ℝ] E →L[ℝ] ℝ) (x : E) : quadraticJet c L B x x = c := by |
| 38 | simp [quadraticJet] |
| 39 | |
| 40 | theorem quadraticJet_hasFDerivAt (c : ℝ) (L : E →L[ℝ] ℝ) |
| 41 | (B : E →L[ℝ] E →L[ℝ] ℝ) (hB : ∀ a b, B a b = B b a) (x y : E) : |
| 42 | HasFDerivAt (quadraticJet c L B x) (L + B (y - x)) y := by |
| 43 | have hsub := (hasFDerivAt_id (𝕜 := ℝ) y).sub_const x |
| 44 | have hlin := L.hasFDerivAt.comp y hsub |
| 45 | have hquad := ((hasFDerivAt_const B y).clm_apply hsub).clm_apply hsub |
| 46 | convert! (hlin.const_add c).add (hquad.const_mul (1 / 2 : ℝ)) using 1 |
| 47 | ext v |
| 48 | simp only [ContinuousLinearMap.comp_id, add_apply, smul_apply, smul_eq_mul, |
| 49 | ContinuousLinearMap.flip_apply, zero_apply, add_zero, id_eq] |
| 50 | rw [hB v (y - x)] |
| 51 | ring |
| 52 | |
| 53 | theorem quadraticJet_fderiv (c : ℝ) (L : E →L[ℝ] ℝ) |
| 54 | (B : E →L[ℝ] E →L[ℝ] ℝ) (hB : ∀ a b, B a b = B b a) (x : E) : |
| 55 | fderiv ℝ (quadraticJet c L B x) = fun y => L + B (y - x) := |
| 56 | funext (fun y => (quadraticJet_hasFDerivAt c L B hB x y).fderiv) |
| 57 | |
| 58 | theorem quadraticJet_second_fderiv (c : ℝ) (L : E →L[ℝ] ℝ) |
| 59 | (B : E →L[ℝ] E →L[ℝ] ℝ) (hB : ∀ a b, B a b = B b a) (x y : E) : |
| 60 | fderiv ℝ (fderiv ℝ (quadraticJet c L B x)) y = B := by |
| 61 | rw [quadraticJet_fderiv c L B hB] |
| 62 | have hd := (B.hasFDerivAt.comp y ((hasFDerivAt_id y).sub_const x)).const_add L |
| 63 | simpa only [ContinuousLinearMap.comp_id, Function.comp_def, id_eq] using hd.fderiv |
| 64 | |
| 65 | /-- The genuine second-order remainder at a C2 point is little-o of |
| 66 | the squared distance; no C-infinity neighborhood is asserted. -/ |
| 67 | theorem quadraticJet_remainder_isLittleO {f : E → ℝ} {x : E} |
| 68 | (hf : ContDiffAt ℝ 2 f x) : |
| 69 | (fun y => f y - quadraticJet (f x) (fderiv ℝ f x) |
| 70 | (fderiv ℝ (fderiv ℝ f) x) x y) =o[𝓝 x] (fun y => ‖y - x‖ ^ 2) := by |
| 71 | let L := fderiv ℝ f x |
| 72 | let B := fderiv ℝ (fderiv ℝ f) x |
| 73 | let q := quadraticJet (f x) L B x |
| 74 | have hB : ∀ a b, B a b = B b a := hf.isSymmSndFDerivAt (by simp) |
| 75 | have hd : HasFDerivAt (fderiv ℝ f) B x := |
| 76 | ((hf.fderiv_right (m := 1) (by norm_num)).differentiableAt (by simp)).hasFDerivAt |
| 77 | obtain ⟨r, hr, hball⟩ := Metric.eventually_nhds_iff.mp |
| 78 | (hf.eventually (by norm_num)) |
| 79 | have hrem : (fun y => fderiv ℝ f y - (L + B (y - x))) =o[𝓝 x] |
| 80 | (fun y => ‖y - x‖ ^ 1) := by |
| 81 | simpa only [L, sub_add_eq_sub_sub, pow_one] using hd.isLittleO.norm_right |
| 82 | have h := (convex_ball x r).isLittleO_pow_succ (n := 1) |
| 83 | (Metric.mem_ball_self hr) (f := fun y => f y - q y) |
| 84 | (f' := fun y => fderiv ℝ f y - (L + B (y - x))) |
| 85 | (fun y hy => ((hball (Metric.mem_ball.mp hy)).differentiableAt (by norm_num)).hasFDerivAt.sub |
| 86 | (quadraticJet_hasFDerivAt (f x) L B hB x y) |>.hasFDerivWithinAt) |
| 87 | (hrem.mono nhdsWithin_le_nhds) |
| 88 | rw [nhdsWithin_eq_nhds.mpr (Metric.ball_mem_nhds x hr)] at h |
| 89 | simpa only [q, quadraticJet_self, sub_self, sub_zero] using h |
| 90 | |
| 91 | end PoincareMT.M35.Uniqueness |