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.RicciFlow.Surgery.Metric.Standard.Radial.AxisCoefficients |
| 2 | import Mathlib.Analysis.InnerProductSpace.Projection.FiniteDimensional |
| 3 | |
| 4 | /-! |
| 5 | # Rotations sending the first coordinate vector to any unit vector |
| 6 | |
| 7 | Two hyperplane reflections provide a determinant-one linear isometry. |
| 8 | Its matrix is the exact SO(3) action in the standard metric contract. |
| 9 | The construction is pointwise; no smooth choice of rotations is asserted. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open scoped RealInnerProductSpace |
| 15 | |
| 16 | namespace PoincareMT.MetricSurgery |
| 17 | |
| 18 | noncomputable def rotationOfIsometry (L : StandardCapSpace ≃ₗᵢ[ℝ] StandardCapSpace) |
| 19 | (hdet : LinearMap.det L.toLinearMap = 1) : |
| 20 | Matrix.specialOrthogonalGroup (Fin 3) ℝ := |
| 21 | ⟨L.toMatrix (EuclideanSpace.basisFun (Fin 3) ℝ).toBasis |
| 22 | (EuclideanSpace.basisFun (Fin 3) ℝ).toBasis, |
| 23 | Matrix.mem_specialOrthogonalGroup_iff.mpr ⟨ |
| 24 | L.toMatrix_mem_unitaryGroup _ _, by |
| 25 | rw [LinearMap.det_toMatrix] |
| 26 | exact hdet⟩⟩ |
| 27 | |
| 28 | theorem rotationOfIsometry_apply (L : StandardCapSpace ≃ₗᵢ[ℝ] StandardCapSpace) |
| 29 | (hdet : LinearMap.det L.toLinearMap = 1) (v : StandardCapSpace) : |
| 30 | standardRotation (rotationOfIsometry L hdet) v = L v := by |
| 31 | rw [standardRotation_eq_linear, Matrix.toEuclideanLin_eq_toLin_orthonormal] |
| 32 | change Matrix.toLin (EuclideanSpace.basisFun (Fin 3) ℝ).toBasis |
| 33 | (EuclideanSpace.basisFun (Fin 3) ℝ).toBasis |
| 34 | (LinearMap.toMatrix (EuclideanSpace.basisFun (Fin 3) ℝ).toBasis |
| 35 | (EuclideanSpace.basisFun (Fin 3) ℝ).toBasis L.toLinearMap) v = L v |
| 36 | rw [Matrix.toLin_toMatrix] |
| 37 | rfl |
| 38 | |
| 39 | theorem exists_axis_isometry (u : StandardCapSpace) (hu : ‖u‖ = 1) : |
| 40 | ∃ L : StandardCapSpace ≃ₗᵢ[ℝ] StandardCapSpace, |
| 41 | LinearMap.det L.toLinearMap = 1 ∧ L (axisBasis 0) = u := by |
| 42 | by_cases heq : axisBasis 0 = u |
| 43 | · refine ⟨LinearIsometryEquiv.refl ℝ StandardCapSpace, ?_, heq⟩ |
| 44 | simp |
| 45 | let D := (ℝ ∙ axisBasis 1)ᗮ.reflection |
| 46 | let H := (ℝ ∙ (axisBasis 0 - u))ᗮ.reflection |
| 47 | have hD : D (axisBasis 0) = axisBasis 0 := by |
| 48 | apply Submodule.reflection_mem_subspace_eq_self |
| 49 | rw [Submodule.mem_orthogonal_singleton_iff_inner_left] |
| 50 | simp [axisBasis, EuclideanSpace.inner_single_left] |
| 51 | have hH : H (axisBasis 0) = u := by |
| 52 | apply Submodule.reflection_sub |
| 53 | simpa [axisBasis] using hu.symm |
| 54 | have hDdet : LinearMap.det D.toLinearMap = -1 := by |
| 55 | dsimp [D] |
| 56 | rw [Submodule.det_reflection, Submodule.orthogonal_orthogonal, |
| 57 | finrank_span_singleton (axisBasis_ne_zero 1)] |
| 58 | norm_num |
| 59 | have hHdet : LinearMap.det H.toLinearMap = -1 := by |
| 60 | dsimp [H] |
| 61 | rw [Submodule.det_reflection, Submodule.orthogonal_orthogonal, |
| 62 | finrank_span_singleton (sub_ne_zero.mpr heq)] |
| 63 | norm_num |
| 64 | refine ⟨D.trans H, ?_, ?_⟩ |
| 65 | · change LinearMap.det (H.toLinearMap.comp D.toLinearMap) = 1 |
| 66 | rw [LinearMap.det_comp, hHdet, hDdet] |
| 67 | norm_num |
| 68 | · change H (D (axisBasis 0)) = u |
| 69 | rw [hD, hH] |
| 70 | |
| 71 | theorem standardInitialMetric_isometry_inner (g₀ : StandardInitialMetric) |
| 72 | (L : StandardCapSpace ≃ₗᵢ[ℝ] StandardCapSpace) |
| 73 | (hdet : LinearMap.det L.toLinearMap = 1) (x v w : StandardCapSpace) : |
| 74 | g₀.metric.inner (L x) (L v) (L w) = g₀.metric.inner x v w := by |
| 75 | have h := standardInitialMetric_rotation_inner g₀ (rotationOfIsometry L hdet) x v w |
| 76 | change g₀.metric.inner (standardRotation (rotationOfIsometry L hdet) x) |
| 77 | (standardRotation (rotationOfIsometry L hdet) v) |
| 78 | (standardRotation (rotationOfIsometry L hdet) w) = _ at h |
| 79 | let G : StandardCapSpace → StandardCapSpace →L[ℝ] StandardCapSpace →L[ℝ] ℝ := |
| 80 | g₀.metric.inner |
| 81 | change G (standardRotation (rotationOfIsometry L hdet) x) |
| 82 | (standardRotation (rotationOfIsometry L hdet) v) |
| 83 | (standardRotation (rotationOfIsometry L hdet) w) = G x v w at h |
| 84 | simp only [rotationOfIsometry_apply] at h |
| 85 | exact h |
| 86 | |
| 87 | end PoincareMT.MetricSurgery |