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.StandardCap.Existence.InitialMetric.Rotations |
| 2 | import Mathlib.LinearAlgebra.Matrix.Determinant.Basic |
| 3 | |
| 4 | /-! |
| 5 | # The metric on a fixed rotation axis |
| 6 | |
| 7 | Morgan-Tian Lemma 12.3, pp. 294-295. At a point on the first coordinate |
| 8 | axis, the half turn about that axis removes radial-angular mixed terms. |
| 9 | The quarter turn removes the remaining angular mixed term and equates |
| 10 | the two angular diagonal entries. Both rotations fix the basepoint. |
| 11 | This is the first step of the arbitrary rotational normal form in the |
| 12 | arbitrary-initial-estimates derivation. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Matrix |
| 18 | open scoped Manifold ContDiff |
| 19 | |
| 20 | namespace PoincareMT.M34 |
| 21 | |
| 22 | /-- The orientation-preserving half turn about the first coordinate axis |
| 23 | (Lemma 12.3, pp. 294-295). -/ |
| 24 | def capAxisHalfTurn : Matrix.specialOrthogonalGroup (Fin 3) ℝ := by |
| 25 | refine ⟨!![1, 0, 0; 0, -1, 0; 0, 0, -1], mem_specialOrthogonalGroup_iff.mpr ⟨?_, ?_⟩⟩ |
| 26 | · rw [mem_orthogonalGroup_iff] |
| 27 | ext i j |
| 28 | fin_cases i <;> fin_cases j <;> |
| 29 | norm_num [Matrix.mul_apply, Fin.sum_univ_three, Matrix.cons_val_two] |
| 30 | · norm_num [Matrix.det_fin_three, Matrix.cons_val_two] |
| 31 | |
| 32 | /-- The orientation-preserving quarter turn about the first coordinate |
| 33 | axis (Lemma 12.3, pp. 294-295). -/ |
| 34 | def capAxisQuarterTurn : Matrix.specialOrthogonalGroup (Fin 3) ℝ := by |
| 35 | refine ⟨!![1, 0, 0; 0, 0, -1; 0, 1, 0], mem_specialOrthogonalGroup_iff.mpr ⟨?_, ?_⟩⟩ |
| 36 | · rw [mem_orthogonalGroup_iff] |
| 37 | ext i j |
| 38 | fin_cases i <;> fin_cases j <;> |
| 39 | norm_num [Matrix.mul_apply, Fin.sum_univ_three, Matrix.cons_val_two] |
| 40 | · norm_num [Matrix.det_fin_three, Matrix.cons_val_two] |
| 41 | |
| 42 | /-- The literal half-turn matrix acts by changing the two angular signs |
| 43 | (Lemma 12.3, pp. 294-295). -/ |
| 44 | theorem capAxisHalfTurn_apply (x : StandardCapSpace) : |
| 45 | standardRotation capAxisHalfTurn x = |
| 46 | (EuclideanSpace.equiv (Fin 3) ℝ).symm ![x 0, -x 1, -x 2] := by |
| 47 | apply (EuclideanSpace.equiv (Fin 3) ℝ).injective |
| 48 | ext i |
| 49 | fin_cases i <;> simp [standardRotation, capAxisHalfTurn, |
| 50 | dotProduct, Fin.sum_univ_three] |
| 51 | |
| 52 | /-- The literal quarter-turn matrix rotates the two angular coordinates |
| 53 | (Lemma 12.3, pp. 294-295). -/ |
| 54 | theorem capAxisQuarterTurn_apply (x : StandardCapSpace) : |
| 55 | standardRotation capAxisQuarterTurn x = |
| 56 | (EuclideanSpace.equiv (Fin 3) ℝ).symm ![x 0, -x 2, x 1] := by |
| 57 | apply (EuclideanSpace.equiv (Fin 3) ℝ).injective |
| 58 | ext i |
| 59 | fin_cases i <;> simp [standardRotation, capAxisQuarterTurn, |
| 60 | dotProduct, Fin.sum_univ_three] |
| 61 | |
| 62 | set_option backward.isDefEq.respectTransparency false in |
| 63 | /-- The supplied metric's actual rotational invariance can be evaluated |
| 64 | on constant ambient vectors (Lemma 12.3, pp. 294-295). -/ |
| 65 | theorem initialMetric_inner_rotation (g₀ : StandardInitialMetric) |
| 66 | (A : Matrix.specialOrthogonalGroup (Fin 3) ℝ) (x u v : StandardCapSpace) : |
| 67 | g₀.metric.inner (standardRotation A x) (standardRotation A u) (standardRotation A v) = |
| 68 | g₀.metric.inner x u v := by |
| 69 | have h := g₀.rotation_invariant A x u v |
| 70 | erw [standardRotation_mfderiv] at h |
| 71 | exact h |
| 72 | |
| 73 | private theorem halfTurn_single (i : Fin 3) (r : ℝ) : |
| 74 | standardRotation capAxisHalfTurn (EuclideanSpace.single i r) = |
| 75 | if i = 0 then EuclideanSpace.single i r else -EuclideanSpace.single i r := by |
| 76 | rw [capAxisHalfTurn_apply] |
| 77 | ext j |
| 78 | fin_cases i <;> fin_cases j <;> simp |
| 79 | |
| 80 | private theorem quarterTurn_axis (r : ℝ) : |
| 81 | standardRotation capAxisQuarterTurn (EuclideanSpace.single (0 : Fin 3) r) = |
| 82 | EuclideanSpace.single (0 : Fin 3) r := by |
| 83 | rw [capAxisQuarterTurn_apply] |
| 84 | ext j |
| 85 | fin_cases j <;> simp |
| 86 | |
| 87 | private theorem quarterTurn_first : |
| 88 | standardRotation capAxisQuarterTurn (EuclideanSpace.single (1 : Fin 3) (1 : ℝ)) = |
| 89 | EuclideanSpace.single (2 : Fin 3) (1 : ℝ) := by |
| 90 | rw [capAxisQuarterTurn_apply] |
| 91 | ext j |
| 92 | fin_cases j <;> simp |
| 93 | |
| 94 | private theorem quarterTurn_second : |
| 95 | standardRotation capAxisQuarterTurn (EuclideanSpace.single (2 : Fin 3) (1 : ℝ)) = |
| 96 | -EuclideanSpace.single (1 : Fin 3) (1 : ℝ) := by |
| 97 | rw [capAxisQuarterTurn_apply] |
| 98 | ext j |
| 99 | fin_cases j <;> simp |
| 100 | |
| 101 | set_option backward.isDefEq.respectTransparency false in |
| 102 | /-- On the fixed first axis the metric has no mixed coefficients, and |
| 103 | its two angular diagonal coefficients agree (Lemma 12.3, pp. 294-295). -/ |
| 104 | theorem initialMetric_axis_coefficients (g₀ : StandardInitialMetric) (r : ℝ) : |
| 105 | let x := EuclideanSpace.single (0 : Fin 3) r |
| 106 | let b := fun i : Fin 3 => EuclideanSpace.single i (1 : ℝ) |
| 107 | g₀.metric.inner x (b 0) (b 1) = 0 ∧ |
| 108 | g₀.metric.inner x (b 0) (b 2) = 0 ∧ |
| 109 | g₀.metric.inner x (b 1) (b 2) = 0 ∧ |
| 110 | g₀.metric.inner x (b 2) (b 2) = g₀.metric.inner x (b 1) (b 1) := by |
| 111 | let x : StandardCapSpace := EuclideanSpace.single 0 r |
| 112 | let b := fun i : Fin 3 => EuclideanSpace.single i (1 : ℝ) |
| 113 | change g₀.metric.inner x (b 0) (b 1) = 0 ∧ |
| 114 | g₀.metric.inner x (b 0) (b 2) = 0 ∧ g₀.metric.inner x (b 1) (b 2) = 0 ∧ |
| 115 | g₀.metric.inner x (b 2) (b 2) = g₀.metric.inner x (b 1) (b 1) |
| 116 | have hxH : standardRotation capAxisHalfTurn x = x := by simp [x, halfTurn_single] |
| 117 | have hbH0 : standardRotation capAxisHalfTurn (b 0) = b 0 := by simp [b, halfTurn_single] |
| 118 | have hbH1 : standardRotation capAxisHalfTurn (b 1) = -b 1 := by simp [b, halfTurn_single] |
| 119 | have hbH2 : standardRotation capAxisHalfTurn (b 2) = -b 2 := by simp [b, halfTurn_single] |
| 120 | have h01 := initialMetric_inner_rotation g₀ capAxisHalfTurn x (b 0) (b 1) |
| 121 | have h02 := initialMetric_inner_rotation g₀ capAxisHalfTurn x (b 0) (b 2) |
| 122 | erw [hxH, hbH0, hbH1, map_neg] at h01 |
| 123 | erw [hxH, hbH0, hbH2, map_neg] at h02 |
| 124 | have hxQ : standardRotation capAxisQuarterTurn x = x := quarterTurn_axis r |
| 125 | have h12 := initialMetric_inner_rotation g₀ capAxisQuarterTurn x (b 1) (b 2) |
| 126 | erw [hxQ, quarterTurn_first, quarterTurn_second, map_neg] at h12 |
| 127 | have hsym := g₀.metric.symm x (b 2) (b 1) |
| 128 | have h22 := initialMetric_inner_rotation g₀ capAxisQuarterTurn x (b 1) (b 1) |
| 129 | erw [hxQ, quarterTurn_first] at h22 |
| 130 | exact ⟨by linarith, by linarith, by linarith, h22⟩ |
| 131 | |
| 132 | set_option backward.isDefEq.respectTransparency false in |
| 133 | /-- The complete bilinear form at an axis point has one radial coefficient |
| 134 | and a common angular coefficient (Lemma 12.3, pp. 294-295). -/ |
| 135 | theorem initialMetric_axis_inner (g₀ : StandardInitialMetric) (r : ℝ) |
| 136 | (u v : StandardCapSpace) : |
| 137 | let x := EuclideanSpace.single (0 : Fin 3) r |
| 138 | let b := fun i : Fin 3 => EuclideanSpace.single i (1 : ℝ) |
| 139 | g₀.metric.inner x u v = g₀.metric.inner x (b 0) (b 0) * u 0 * v 0 + |
| 140 | g₀.metric.inner x (b 1) (b 1) * (u 1 * v 1 + u 2 * v 2) := by |
| 141 | let x : StandardCapSpace := EuclideanSpace.single 0 r |
| 142 | let b := fun i : Fin 3 => EuclideanSpace.single i (1 : ℝ) |
| 143 | obtain ⟨h01, h02, h12, h22⟩ := initialMetric_axis_coefficients g₀ r |
| 144 | change g₀.metric.inner x (b 0) (b 1) = 0 at h01 |
| 145 | change g₀.metric.inner x (b 0) (b 2) = 0 at h02 |
| 146 | change g₀.metric.inner x (b 1) (b 2) = 0 at h12 |
| 147 | change g₀.metric.inner x (b 2) (b 2) = g₀.metric.inner x (b 1) (b 1) at h22 |
| 148 | have h10 : g₀.metric.inner x (b 1) (b 0) = 0 := |
| 149 | (g₀.metric.symm x (b 1) (b 0)).trans h01 |
| 150 | have h20 : g₀.metric.inner x (b 2) (b 0) = 0 := |
| 151 | (g₀.metric.symm x (b 2) (b 0)).trans h02 |
| 152 | have h21 : g₀.metric.inner x (b 2) (b 1) = 0 := |
| 153 | (g₀.metric.symm x (b 2) (b 1)).trans h12 |
| 154 | have hsum (w : StandardCapSpace) : ∑ i, w i • b i = w := by |
| 155 | simpa only [EuclideanSpace.basisFun_repr, EuclideanSpace.basisFun_apply] using |
| 156 | (EuclideanSpace.basisFun (Fin 3) ℝ).sum_repr w |
| 157 | let B : StandardCapSpace →L[ℝ] StandardCapSpace →L[ℝ] ℝ := g₀.metric.inner x |
| 158 | change B (b 0) (b 1) = 0 at h01 |
| 159 | change B (b 0) (b 2) = 0 at h02 |
| 160 | change B (b 1) (b 2) = 0 at h12 |
| 161 | change B (b 1) (b 0) = 0 at h10 |
| 162 | change B (b 2) (b 0) = 0 at h20 |
| 163 | change B (b 2) (b 1) = 0 at h21 |
| 164 | change B (b 2) (b 2) = B (b 1) (b 1) at h22 |
| 165 | change B u v = B (b 0) (b 0) * u 0 * v 0 + |
| 166 | B (b 1) (b 1) * (u 1 * v 1 + u 2 * v 2) |
| 167 | calc |
| 168 | B u v = B (∑ i, u i • b i) (∑ i, v i • b i) := by rw [hsum, hsum] |
| 169 | _ = _ := by |
| 170 | simp only [map_add, _root_.add_apply, map_smul, _root_.smul_apply, smul_eq_mul, |
| 171 | Fin.sum_univ_three, h01, h02, h12, h10, h20, h21, h22] |
| 172 | ring |
| 173 | |
| 174 | end PoincareMT.M34 |