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.Existence.InitialMetric.CoefficientCalculus |
| 2 | |
| 3 | /-! |
| 4 | # Derivatives of the actual radial connection coefficients |
| 5 | |
| 6 | Morgan-Tian Lemma 12.2, printed pp. 294-295. The rational profile formulas |
| 7 | are differentiated on neighborhoods where both radius and profile are |
| 8 | nonzero. These hypotheses justify replacing connection coefficients |
| 9 | inside derivatives in the curvature calculation. See the M34 |
| 10 | radial-curvature derivation. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Filter |
| 16 | open scoped Topology ContDiff |
| 17 | |
| 18 | namespace PoincareMT.M34 |
| 19 | |
| 20 | /-- Derivative of the angular Christoffel coefficient in terms of the |
| 21 | first two profile derivatives (Lemma 12.2, pp. 294-295). -/ |
| 22 | theorem capChristoffelA_hasDerivAt (a : ℝ) {r : ℝ} (hr : r ≠ 0) |
| 23 | (hf : capProfile a r ≠ 0) : |
| 24 | HasDerivAt (capChristoffelA a) |
| 25 | (deriv (capSlope a) r / (r * capProfile a r) - |
| 26 | capSlope a r / (r ^ 2 * capProfile a r) - |
| 27 | capSlope a r ^ 2 / (r * capProfile a r ^ 2) + 2 / r ^ 3) r := by |
| 28 | have he : capChristoffelA a =ᶠ[𝓝 r] |
| 29 | (fun s => capSlope a s / (s * capProfile a s) - 1 / s ^ 2) := by |
| 30 | filter_upwards [eventually_ne_nhds hr, |
| 31 | (capProfile_contDiff a).continuous.continuousAt.eventually_ne hf] with s hs hfs |
| 32 | exact capChristoffelA_eq a hs hfs |
| 33 | have hp := ((capSlope_contDiff_right a).differentiable (by simp) r).hasDerivAt |
| 34 | have h := (hp.div ((hasDerivAt_id r).mul (capProfile_hasDerivAt a r)) |
| 35 | (mul_ne_zero hr hf)).sub |
| 36 | ((hasDerivAt_const r (1 : ℝ)).div ((hasDerivAt_id r).pow 2) (pow_ne_zero 2 hr)) |
| 37 | convert! h.congr_of_eventuallyEq he using 1 |
| 38 | simp only [Pi.mul_apply, Pi.pow_apply, id_eq] |
| 39 | field_simp |
| 40 | ring |
| 41 | |
| 42 | /-- Derivative of the Euclidean inner-product Christoffel coefficient |
| 43 | (Lemma 12.2 curvature computation, pp. 294-295). -/ |
| 44 | theorem capChristoffelB_hasDerivAt (a : ℝ) {r : ℝ} (hr : r ≠ 0) : |
| 45 | HasDerivAt (capChristoffelB a) |
| 46 | (-(2 + capSlope a r ^ 2 + capProfile a r * deriv (capSlope a) r) / r ^ 3 + |
| 47 | 3 * capProfile a r * capSlope a r / r ^ 4) r := by |
| 48 | have he : capChristoffelB a =ᶠ[𝓝 r] |
| 49 | (fun s => 1 / s ^ 2 - capProfile a s * capSlope a s / s ^ 3) := by |
| 50 | filter_upwards [eventually_ne_nhds hr] with s hs |
| 51 | exact capChristoffelB_eq a hs |
| 52 | have hp := ((capSlope_contDiff_right a).differentiable (by simp) r).hasDerivAt |
| 53 | have h := ((hasDerivAt_const r (1 : ℝ)).div ((hasDerivAt_id r).pow 2) |
| 54 | (pow_ne_zero 2 hr)).sub |
| 55 | (((capProfile_hasDerivAt a r).mul hp).div ((hasDerivAt_id r).pow 3) (pow_ne_zero 3 hr)) |
| 56 | convert! h.congr_of_eventuallyEq he using 1 |
| 57 | simp only [Pi.mul_apply, Pi.pow_apply, id_eq] |
| 58 | field_simp |
| 59 | ring |
| 60 | |
| 61 | /-- Differentiability of the third Christoffel coefficient; its derivative |
| 62 | cancels in the curvature antisymmetrization (Lemma 12.2, pp. 294-295). -/ |
| 63 | theorem capChristoffelC_differentiableAt (a : ℝ) {r : ℝ} (hr : r ≠ 0) |
| 64 | (hf : capProfile a r ≠ 0) : DifferentiableAt ℝ (capChristoffelC a) r := by |
| 65 | have he : capChristoffelC a =ᶠ[𝓝 r] |
| 66 | (fun s => -(2 * capChristoffelA a s + capChristoffelB a s) / s ^ 2) := by |
| 67 | filter_upwards [eventually_ne_nhds hr, |
| 68 | (capProfile_contDiff a).continuous.continuousAt.eventually_ne hf] with s hs hfs |
| 69 | exact capChristoffelC_eq a hs hfs |
| 70 | have h := ((((capChristoffelA_hasDerivAt a hr hf).const_mul 2).add |
| 71 | (capChristoffelB_hasDerivAt a hr)).neg.div ((hasDerivAt_id r).pow 2) |
| 72 | (pow_ne_zero 2 hr)) |
| 73 | exact (h.congr_of_eventuallyEq he).differentiableAt |
| 74 | |
| 75 | end PoincareMT.M34 |