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.Geometry.Manifold.Instances.Sphere |
| 3 | import Mathlib.Tactic |
| 4 | |
| 5 | /-! |
| 6 | # The metric of inverse stereographic projection |
| 7 | |
| 8 | The explicit sphere-chart calculation used for Morgan-Tian Definition 2.16, |
| 9 | p. 30, and Theorem 12.28, pp. 323-324. Differentiating Mathlib's actual inverse |
| 10 | stereographic formula gives its conformal factor on the orthogonal plane. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | namespace PoincareMT.M35 |
| 16 | |
| 17 | variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] |
| 18 | |
| 19 | /-- Definition 2.16, p. 30: differentiate the literal inverse stereographic |
| 20 | formula, whose denominator is positive at every point. -/ |
| 21 | theorem fderiv_stereoInvFunAux_apply (v w a : V) : |
| 22 | fderiv ℝ (stereoInvFunAux v) w a = |
| 23 | (‖w‖ ^ 2 + 4)⁻¹ • ((4 : ℝ) • a + (2 * inner ℝ w a) • v) + |
| 24 | (-((‖w‖ ^ 2 + 4) ^ 2)⁻¹ * (2 * inner ℝ w a)) • |
| 25 | ((4 : ℝ) • w + (‖w‖ ^ 2 - 4) • v) := by |
| 26 | have hd : ‖w‖ ^ 2 + 4 ≠ 0 := ne_of_gt (by positivity) |
| 27 | have hn := (hasStrictFDerivAt_norm_sq w).hasFDerivAt |
| 28 | have hi := (hasDerivAt_inv hd).comp_hasFDerivAt w (hn.add_const 4) |
| 29 | have hv := ((hasFDerivAt_id w).const_smul (4 : ℝ)).add |
| 30 | ((hn.sub_const 4).smul_const v) |
| 31 | have h := hi.smul hv |
| 32 | change HasFDerivAt (stereoInvFunAux v) _ w at h |
| 33 | simpa using congrArg (fun L : V →L[ℝ] V => L a) h.fderiv |
| 34 | |
| 35 | /-- Definition 2.16, p. 30: the inverse stereographic map is conformal on |
| 36 | the orthogonal plane, with its actual Euclidean-coordinate conformal factor. -/ |
| 37 | theorem inner_fderiv_stereoInvFunAux (v w a b : V) |
| 38 | (hv : ‖v‖ = 1) (hw : inner ℝ v w = 0) |
| 39 | (ha : inner ℝ v a = 0) (hb : inner ℝ v b = 0) : |
| 40 | inner ℝ (fderiv ℝ (stereoInvFunAux v) w a) |
| 41 | (fderiv ℝ (stereoInvFunAux v) w b) = |
| 42 | 16 / (‖w‖ ^ 2 + 4) ^ 2 * inner ℝ a b := by |
| 43 | have hd : ‖w‖ ^ 2 + 4 ≠ 0 := ne_of_gt (by positivity) |
| 44 | have hvw : inner ℝ w v = 0 := by rwa [real_inner_comm] |
| 45 | have hav : inner ℝ a v = 0 := by rwa [real_inner_comm] |
| 46 | rw [fderiv_stereoInvFunAux_apply, fderiv_stereoInvFunAux_apply] |
| 47 | simp only [inner_add_left, inner_add_right, real_inner_smul_left, |
| 48 | real_inner_smul_right, hw, hb, hvw, hav, real_inner_self_eq_norm_sq, hv] |
| 49 | rw [real_inner_comm a w] |
| 50 | field_simp |
| 51 | ring |
| 52 | |
| 53 | /-- Definition 2.16, p. 30: derivative of a scaled stereographic metric |
| 54 | factor, with the denominator kept in its everywhere-positive form. -/ |
| 55 | theorem hasFDerivAt_stereographicMetricFactor (K : ℝ) (w : V) : |
| 56 | HasFDerivAt (fun x : V => K / (‖x‖ ^ 2 + 4) ^ 2) |
| 57 | ((-4 * K / (‖w‖ ^ 2 + 4) ^ 3) • innerSL ℝ w) w := by |
| 58 | have hd : (‖w‖ ^ 2 + 4) ^ 2 ≠ 0 := ne_of_gt (by positivity) |
| 59 | have hn := (hasStrictFDerivAt_norm_sq w).hasFDerivAt |
| 60 | have h := ((hasDerivAt_inv hd).comp_hasFDerivAt w |
| 61 | ((hn.add_const 4).pow 2)).const_mul K |
| 62 | convert! h using 1 |
| 63 | ext a |
| 64 | simp |
| 65 | field_simp |
| 66 | ring |
| 67 | |
| 68 | end PoincareMT.M35 |