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 | # Local smoothness of sphere-valued maps |
| 5 | |
| 6 | The stereographic atlas detects smoothness by the sphere inclusion. |
| 7 | This local version of Mathlib's sphere codomain restriction lemma is |
| 8 | used for the polar inverse in Morgan-Tian Lemma 12.2, pp. 294-295. |
| 9 | See the M34 cylindrical-end derivation for its domain restrictions. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set Metric |
| 15 | open scoped Manifold ContDiff Topology InnerProductSpace |
| 16 | |
| 17 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 18 | {n : ℕ} [Fact (Module.finrank ℝ E = n + 1)] |
| 19 | {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 20 | {H : Type*} [TopologicalSpace H] {I : ModelWithCorners ℝ F H} |
| 21 | {M : Type*} [TopologicalSpace M] [ChartedSpace H M] |
| 22 | {m : WithTop ℕ∞} {f : M → sphere (0 : E) 1} {x : M} |
| 23 | |
| 24 | /-- Smoothness of the included sphere-valued map implies smoothness at |
| 25 | the same point. This is a local statement and permits a nonsmooth total |
| 26 | extension elsewhere (Lemma 12.2 polar inverse, pp. 294-295). -/ |
| 27 | theorem ContMDiffAt.of_coe_sphere |
| 28 | (hf : ContMDiffAt I 𝓘(ℝ, E) m (fun y => (f y : E)) x) : |
| 29 | ContMDiffAt I (𝓡 n) m f x := by |
| 30 | rw [contMDiffAt_iff_target] |
| 31 | refine ⟨tendsto_subtype_rng.mpr hf.continuousAt, ?_⟩ |
| 32 | let v := -(f x) |
| 33 | let U : _ ≃ₗᵢ[ℝ] _ := (OrthonormalBasis.fromOrthogonalSpanSingleton n |
| 34 | (ne_zero_of_mem_unit_sphere v)).repr |
| 35 | have hv : innerSL ℝ (v : E) (f x : E) ≠ 1 := by |
| 36 | have hnorm : ‖(f x : E)‖ = 1 := norm_eq_of_mem_sphere (f x) |
| 37 | simp only [v, coe_neg_sphere, innerSL_apply_apply, inner_neg_left, |
| 38 | real_inner_self_eq_norm_sq, hnorm] |
| 39 | norm_num |
| 40 | have hs : ContDiffAt ℝ m (stereoToFun (v : E)) (f x : E) := |
| 41 | contDiffOn_stereoToFun.contDiffAt |
| 42 | ((isOpen_ne.preimage (innerSL ℝ (v : E)).continuous).mem_nhds hv) |
| 43 | have h := (U.contDiff.contDiffAt.comp (f x : E) hs).contMDiffAt.comp x hf |
| 44 | convert! h using 1 |