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.MFDeriv.SpecificFunctions |
| 2 | import Mathlib.Geometry.Manifold.ContMDiff.NormedSpace |
| 3 | import Mathlib.Analysis.InnerProductSpace.Projection.FiniteDimensional |
| 4 | |
| 5 | /-! # Orthogonal coordinates for maps into a fixed affine hyperplane -/ |
| 6 | |
| 7 | noncomputable section |
| 8 | set_option autoImplicit false |
| 9 | set_option backward.isDefEq.respectTransparency false |
| 10 | set_option linter.unusedSectionVars false |
| 11 | |
| 12 | open Set Function |
| 13 | open scoped Manifold ContDiff RealInnerProductSpace |
| 14 | |
| 15 | namespace Poincare.Geometry.Manifold |
| 16 | |
| 17 | variable {E F H M : Type*} |
| 18 | [NormedAddCommGroup E] [InnerProductSpace Real E] [FiniteDimensional Real E] |
| 19 | [NormedAddCommGroup F] [NormedSpace Real F] |
| 20 | [TopologicalSpace H] [TopologicalSpace M] [ChartedSpace H M] |
| 21 | {I : ModelWithCorners Real F H} |
| 22 | |
| 23 | /-- Projection to the orthogonal plane retains all information in a map |
| 24 | whose height is constant. -/ |
| 25 | theorem eq_height_smul_add_projection |
| 26 | {v : E} (hv : ‖v‖ = 1) {c : Real} {f : M -> E} |
| 27 | (hheight : ∀ p, inner Real v (f p) = c) (p : M) : |
| 28 | f p = c • v + (((Real ∙ v)ᗮ.orthogonalProjectionOnto (f p) : (Real ∙ v)ᗮ) : E) := by |
| 29 | nth_rw 1 [← ((Real ∙ v).starProjection_add_starProjection_orthogonal (f p))] |
| 30 | rw [Submodule.starProjection_unit_singleton Real hv, hheight] |
| 31 | rfl |
| 32 | |
| 33 | /-- A map in a fixed affine hyperplane has an injective planar projection |
| 34 | whenever the original map is injective. -/ |
| 35 | theorem injective_projection_of_height_eq |
| 36 | {v : E} (hv : ‖v‖ = 1) {c : Real} {f : M -> E} |
| 37 | (hheight : ∀ p, inner Real v (f p) = c) (hinj : Injective f) : |
| 38 | Injective (fun p => (Real ∙ v)ᗮ.orthogonalProjectionOnto (f p)) := by |
| 39 | intro p q hpq |
| 40 | change (Real ∙ v)ᗮ.orthogonalProjectionOnto (f p) = |
| 41 | (Real ∙ v)ᗮ.orthogonalProjectionOnto (f q) at hpq |
| 42 | apply hinj |
| 43 | rw [eq_height_smul_add_projection hv hheight p, |
| 44 | eq_height_smul_add_projection hv hheight q, hpq] |
| 45 | |
| 46 | /-- An injective differential stays injective after orthogonal projection |
| 47 | when the map lies in a fixed affine hyperplane. -/ |
| 48 | theorem injective_mfderiv_projection_of_height_eq |
| 49 | {v : E} (hv : ‖v‖ = 1) {c : Real} {f : M -> E} |
| 50 | (hf : ContMDiff I 𝓘(Real, E) ∞ f) |
| 51 | (hheight : ∀ p, inner Real v (f p) = c) |
| 52 | (hinj : ∀ p, Injective (mfderiv I 𝓘(Real, E) f p)) (p : M) : |
| 53 | Injective (mfderiv I 𝓘(Real, (Real ∙ v)ᗮ) |
| 54 | (fun p => (Real ∙ v)ᗮ.orthogonalProjectionOnto (f p)) p) := by |
| 55 | let q : M -> (Real ∙ v)ᗮ := fun p => (Real ∙ v)ᗮ.orthogonalProjectionOnto (f p) |
| 56 | let L : (Real ∙ v)ᗮ -> E := fun x => c • v + (x : E) |
| 57 | have hq : ContMDiff I 𝓘(Real, (Real ∙ v)ᗮ) ∞ q := |
| 58 | (Real ∙ v)ᗮ.orthogonalProjectionOnto.contMDiff.comp hf |
| 59 | have hL : ContMDiff 𝓘(Real, (Real ∙ v)ᗮ) 𝓘(Real, E) ∞ L := |
| 60 | (contDiff_const.add (Real ∙ v)ᗮ.subtypeL.contDiff).contMDiff |
| 61 | have heq : f = L ∘ q := funext (eq_height_smul_add_projection hv hheight) |
| 62 | have hcomp := hinj p |
| 63 | rw [heq, mfderiv_comp p ((hL (q p)).mdifferentiableAt (by simp)) |
| 64 | ((hq p).mdifferentiableAt (by simp))] at hcomp |
| 65 | intro u w huw |
| 66 | apply hcomp |
| 67 | exact congrArg (mfderiv 𝓘(Real, (Real ∙ v)ᗮ) 𝓘(Real, E) L (q p)) huw |
| 68 | |
| 69 | end Poincare.Geometry.Manifold |