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.Euclidean.HeightCoordinates |
| 2 | |
| 3 | /-! # Lifting plane diffeomorphisms through orthogonal coordinates -/ |
| 4 | |
| 5 | noncomputable section |
| 6 | set_option autoImplicit false |
| 7 | |
| 8 | open scoped Manifold ContDiff |
| 9 | |
| 10 | namespace Poincare.Geometry.Euclidean |
| 11 | |
| 12 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace Real E] |
| 13 | [FiniteDimensional Real E] {v : E} |
| 14 | |
| 15 | /-- Apply a plane diffeomorphism horizontally and an affine change of height |
| 16 | vertically. -/ |
| 17 | def liftPlaneDiffeomorph (hv : ‖v‖ = 1) (c s : Real) (hs : s ≠ 0) |
| 18 | (A : Diffeomorph 𝓘(Real, (Real ∙ v)ᗮ) 𝓘(Real, (Real ∙ v)ᗮ) |
| 19 | (Real ∙ v)ᗮ (Real ∙ v)ᗮ ∞) : |
| 20 | Diffeomorph 𝓘(Real, E) 𝓘(Real, E) E E ∞ := by |
| 21 | let T : Diffeomorph 𝓘(Real, Real) 𝓘(Real, Real) Real Real ∞ := { |
| 22 | toEquiv := { |
| 23 | toFun := fun t => c + s * t |
| 24 | invFun := fun t => (t - c) / s |
| 25 | left_inv := by intro t; field_simp; ring |
| 26 | right_inv := by intro t; field_simp; ring } |
| 27 | contMDiff_toFun := (contDiff_const.add (contDiff_const.mul contDiff_id)).contMDiff |
| 28 | contMDiff_invFun := ((contDiff_id.sub contDiff_const).div_const s).contMDiff } |
| 29 | let H := (heightCoordinates hv).toDiffeomorph |
| 30 | let P : Diffeomorph 𝓘(Real, Real × (Real ∙ v)ᗮ) |
| 31 | 𝓘(Real, Real × (Real ∙ v)ᗮ) (Real × (Real ∙ v)ᗮ) (Real × (Real ∙ v)ᗮ) ∞ := { |
| 32 | toEquiv := T.toEquiv.prodCongr A.toEquiv |
| 33 | contMDiff_toFun := ((T.contMDiff.contDiff.comp contDiff_fst).prodMk |
| 34 | (A.contMDiff.contDiff.comp contDiff_snd)).contMDiff |
| 35 | contMDiff_invFun := ((T.symm.contMDiff.contDiff.comp contDiff_fst).prodMk |
| 36 | (A.symm.contMDiff.contDiff.comp contDiff_snd)).contMDiff } |
| 37 | exact (H.symm.trans P).trans H |
| 38 | |
| 39 | @[simp] theorem liftPlaneDiffeomorph_apply (hv : ‖v‖ = 1) (c s : Real) (hs : s ≠ 0) |
| 40 | (A : Diffeomorph 𝓘(Real, (Real ∙ v)ᗮ) 𝓘(Real, (Real ∙ v)ᗮ) |
| 41 | (Real ∙ v)ᗮ (Real ∙ v)ᗮ ∞) (x : E) : |
| 42 | liftPlaneDiffeomorph hv c s hs A x = |
| 43 | (c + s * inner Real v x) • v + |
| 44 | (A ((Real ∙ v)ᗮ.orthogonalProjectionOnto x) : E) := rfl |
| 45 | |
| 46 | @[simp] theorem inner_liftPlaneDiffeomorph (hv : ‖v‖ = 1) (c s : Real) (hs : s ≠ 0) |
| 47 | (A : Diffeomorph 𝓘(Real, (Real ∙ v)ᗮ) 𝓘(Real, (Real ∙ v)ᗮ) |
| 48 | (Real ∙ v)ᗮ (Real ∙ v)ᗮ ∞) (x : E) : |
| 49 | inner Real v (liftPlaneDiffeomorph hv c s hs A x) = c + s * inner Real v x := by |
| 50 | rw [liftPlaneDiffeomorph_apply] |
| 51 | simp [inner_add_right, inner_smul_right, hv, |
| 52 | Submodule.mem_orthogonal_singleton_iff_inner_right.mp (A _).property] |
| 53 | |
| 54 | @[simp] theorem projection_liftPlaneDiffeomorph (hv : ‖v‖ = 1) |
| 55 | (c s : Real) (hs : s ≠ 0) |
| 56 | (A : Diffeomorph 𝓘(Real, (Real ∙ v)ᗮ) 𝓘(Real, (Real ∙ v)ᗮ) |
| 57 | (Real ∙ v)ᗮ (Real ∙ v)ᗮ ∞) (x : E) : |
| 58 | (Real ∙ v)ᗮ.orthogonalProjectionOnto (liftPlaneDiffeomorph hv c s hs A x) = |
| 59 | A ((Real ∙ v)ᗮ.orthogonalProjectionOnto x) := by |
| 60 | rw [liftPlaneDiffeomorph_apply] |
| 61 | simp |
| 62 | |
| 63 | end Poincare.Geometry.Euclidean |