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.Geometry.Manifold.Instances.Sphere |
| 2 | |
| 3 | /-! |
| 4 | # The stereographic inverse differential and its conformal factor |
| 5 | |
| 6 | The rational inverse stereographic map has an explicit derivative at |
| 7 | every point. On the orthogonal hyperplane of a unit pole its derivative |
| 8 | scales inner products by 16/(norm squared + 4)^2. These generic identities |
| 9 | identify the literal sphere charts used in Morgan-Tian Proposition 12.7, |
| 10 | pp. 298-299; see canonical-cylinder-model.md. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open scoped RealInnerProductSpace ContDiff |
| 16 | |
| 17 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 18 | |
| 19 | /-- The ordinary differential of inverse stereographic projection, |
| 20 | valid before imposing the pole and hyperplane constraints |
| 21 | (Proposition 12.7 sphere-coordinate calculation, pp. 298-299). -/ |
| 22 | theorem fderiv_stereoInvFunAux_apply (v w a : E) : |
| 23 | fderiv ℝ (stereoInvFunAux v) w a = |
| 24 | (4 / (‖w‖ ^ 2 + 4)) • a - |
| 25 | (8 * inner ℝ w a / (‖w‖ ^ 2 + 4) ^ 2) • w + |
| 26 | (16 * inner ℝ w a / (‖w‖ ^ 2 + 4) ^ 2) • v := by |
| 27 | have hne : ‖w‖ ^ 2 + 4 ≠ 0 := by positivity |
| 28 | have hn := (hasStrictFDerivAt_norm_sq w).hasFDerivAt |
| 29 | have hi := (hasDerivAt_inv hne).comp_hasFDerivAt w (hn.add_const 4) |
| 30 | have h := hi.smul (((hasFDerivAt_id w).const_smul (4 : ℝ)).add |
| 31 | ((hn.sub_const 4).smul_const v)) |
| 32 | change HasFDerivAt (stereoInvFunAux v) _ w at h |
| 33 | rw [h.fderiv] |
| 34 | simp only [add_apply, smul_apply, ContinuousLinearMap.smulRight_apply, |
| 35 | ContinuousLinearMap.id_apply, innerSL_apply_apply, smul_eq_mul, |
| 36 | Function.comp_apply, Pi.add_apply, Pi.smul_apply, id_eq] |
| 37 | match_scalars <;> field_simp <;> ring |
| 38 | |
| 39 | /-- On the orthogonal hyperplane of a unit pole, the stereographic |
| 40 | inverse differential has the exact round-sphere conformal factor |
| 41 | (Proposition 12.7, pp. 298-299). -/ |
| 42 | theorem inner_fderiv_stereoInvFunAux (v w a b : E) (hv : ‖v‖ = 1) |
| 43 | (hw : inner ℝ v w = 0) (ha : inner ℝ v a = 0) (hb : inner ℝ v b = 0) : |
| 44 | inner ℝ (fderiv ℝ (stereoInvFunAux v) w a) |
| 45 | (fderiv ℝ (stereoInvFunAux v) w b) = |
| 46 | 16 / (‖w‖ ^ 2 + 4) ^ 2 * inner ℝ a b := by |
| 47 | have hne : ‖w‖ ^ 2 + 4 ≠ 0 := by positivity |
| 48 | have hwv : inner ℝ w v = 0 := (real_inner_comm v w).trans hw |
| 49 | have hav : inner ℝ a v = 0 := (real_inner_comm v a).trans ha |
| 50 | rw [fderiv_stereoInvFunAux_apply, fderiv_stereoInvFunAux_apply] |
| 51 | simp only [inner_add_left, inner_add_right, inner_sub_left, inner_sub_right, |
| 52 | inner_smul_left, inner_smul_right, conj_trivial, hw, hb, hwv, hav, |
| 53 | real_inner_self_eq_norm_sq, hv, one_pow, mul_zero, sub_zero, zero_add, |
| 54 | add_zero, real_inner_comm a w] |
| 55 | field_simp |
| 56 | ring |
| 57 | |
| 58 | /-- Orthogonal isometric parameterizations retain the exact round-sphere |
| 59 | factor; neither finite dimension nor surjectivity is needed |
| 60 | (Proposition 12.7, pp. 298-299). -/ |
| 61 | theorem inner_fderiv_stereoInvFunAux_comp_linearIsometry |
| 62 | {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] |
| 63 | (L : F →ₗᵢ[ℝ] E) (v : E) (hv : ‖v‖ = 1) |
| 64 | (hL : ∀ a : F, inner ℝ v (L a) = 0) (x a b : F) : |
| 65 | inner ℝ (fderiv ℝ (fun y => stereoInvFunAux v (L y)) x a) |
| 66 | (fderiv ℝ (fun y => stereoInvFunAux v (L y)) x b) = |
| 67 | 16 / (‖x‖ ^ 2 + 4) ^ 2 * inner ℝ a b := by |
| 68 | have h := (((contDiff_stereoInvFunAux (m := ∞) (v := v)).differentiable |
| 69 | (by simp) (L x)).hasFDerivAt).comp x L.toContinuousLinearMap.hasFDerivAt |
| 70 | change HasFDerivAt (fun y => stereoInvFunAux v (L y)) _ x at h |
| 71 | rw [h.fderiv] |
| 72 | change inner ℝ (fderiv ℝ (stereoInvFunAux v) (L x) (L a)) |
| 73 | (fderiv ℝ (stereoInvFunAux v) (L x) (L b)) = _ |
| 74 | simpa only [L.norm_map, L.inner_map_map] using |
| 75 | inner_fderiv_stereoInvFunAux v (L x) (L a) (L b) hv (hL x) (hL a) (hL b) |