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.PlaneLift |
| 2 | |
| 3 | /-! # Reflection of height with fixed horizontal coordinates -/ |
| 4 | |
| 5 | noncomputable section |
| 6 | set_option autoImplicit false |
| 7 | |
| 8 | open Set |
| 9 | open scoped Manifold ContDiff |
| 10 | |
| 11 | namespace Poincare.Geometry.Euclidean |
| 12 | |
| 13 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace Real E] |
| 14 | [FiniteDimensional Real E] {v : E} |
| 15 | |
| 16 | /-- Reverse height and preserve the orthogonal projection to the horizontal plane. -/ |
| 17 | def heightReflection (hv : ‖v‖ = 1) : |
| 18 | Diffeomorph 𝓘(Real, E) 𝓘(Real, E) E E ∞ := |
| 19 | liftPlaneDiffeomorph hv 0 (-1) (by norm_num) |
| 20 | (Diffeomorph.refl 𝓘(Real, (Real ∙ v)ᗮ) (Real ∙ v)ᗮ ∞) |
| 21 | |
| 22 | @[simp] theorem inner_heightReflection (hv : ‖v‖ = 1) (x : E) : |
| 23 | inner Real v (heightReflection hv x) = -inner Real v x := by |
| 24 | exact (inner_liftPlaneDiffeomorph hv 0 (-1) (by norm_num) _ x).trans (by ring) |
| 25 | |
| 26 | @[simp] theorem projection_heightReflection (hv : ‖v‖ = 1) (x : E) : |
| 27 | (Real ∙ v)ᗮ.orthogonalProjectionOnto (heightReflection hv x) = |
| 28 | (Real ∙ v)ᗮ.orthogonalProjectionOnto x := by |
| 29 | exact projection_liftPlaneDiffeomorph hv 0 (-1) (by norm_num) _ x |
| 30 | |
| 31 | @[simp] theorem heightReflection_heightReflection (hv : ‖v‖ = 1) (x : E) : |
| 32 | heightReflection hv (heightReflection hv x) = x := by |
| 33 | apply (heightCoordinates hv).symm.injective |
| 34 | apply Prod.ext |
| 35 | · change inner Real v (heightReflection hv (heightReflection hv x)) = inner Real v x |
| 36 | simp |
| 37 | · change (Real ∙ v)ᗮ.orthogonalProjectionOnto (heightReflection hv (heightReflection hv x)) = |
| 38 | (Real ∙ v)ᗮ.orthogonalProjectionOnto x |
| 39 | simp |
| 40 | |
| 41 | @[simp] theorem heightReflection_height_add_plane (hv : ‖v‖ = 1) |
| 42 | (t : Real) (x : (Real ∙ v)ᗮ) : |
| 43 | heightReflection hv (t • v + (x : E)) = (-t) • v + (x : E) := by |
| 44 | rw [heightReflection, liftPlaneDiffeomorph_apply] |
| 45 | simp [inner_add_right, inner_smul_right, hv, |
| 46 | Submodule.mem_orthogonal_singleton_iff_inner_right.mp x.property, |
| 47 | Submodule.starProjection_eq_self_iff.mpr (Submodule.mem_span_singleton_self v)] |
| 48 | |
| 49 | @[simp] theorem heightReflection_liftPlaneDiffeomorph (hv : ‖v‖ = 1) |
| 50 | (c s : Real) (hs : s ≠ 0) |
| 51 | (A : Diffeomorph 𝓘(Real, (Real ∙ v)ᗮ) 𝓘(Real, (Real ∙ v)ᗮ) |
| 52 | (Real ∙ v)ᗮ (Real ∙ v)ᗮ ∞) (x : E) : |
| 53 | heightReflection hv (liftPlaneDiffeomorph hv c s hs A x) = |
| 54 | liftPlaneDiffeomorph hv (-c) (-s) (neg_ne_zero.mpr hs) A x := by |
| 55 | rw [liftPlaneDiffeomorph_apply, heightReflection_height_add_plane, |
| 56 | liftPlaneDiffeomorph_apply] |
| 57 | congr 2 |
| 58 | ring |
| 59 | |
| 60 | theorem image_heightReflection_liftPlaneDiffeomorph (hv : ‖v‖ = 1) |
| 61 | (c s : Real) (hs : s ≠ 0) |
| 62 | (A : Diffeomorph 𝓘(Real, (Real ∙ v)ᗮ) 𝓘(Real, (Real ∙ v)ᗮ) |
| 63 | (Real ∙ v)ᗮ (Real ∙ v)ᗮ ∞) (S : Set E) : |
| 64 | heightReflection hv '' (liftPlaneDiffeomorph hv c s hs A '' S) = |
| 65 | liftPlaneDiffeomorph hv (-c) (-s) (neg_ne_zero.mpr hs) A '' S := by |
| 66 | rw [image_image] |
| 67 | apply image_congr |
| 68 | intro x _ |
| 69 | exact heightReflection_liftPlaneDiffeomorph hv c s hs A x |
| 70 | |
| 71 | end Poincare.Geometry.Euclidean |