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.Riemannian.Curvature.Pullback |
| 2 | |
| 3 | /-! |
| 4 | # Ricci convergence from scalar metric jets |
| 5 | |
| 6 | The retained Ricci tensor is contracted in a fixed basis using the inverse |
| 7 | Gram matrix. This supplies the spatial part of the smooth-limit argument in |
| 8 | Morgan--Tian, Proposition 5.14, pp. 90--91. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | open scoped Manifold ContDiff Bundle BigOperators Topology |
| 15 | open Filter |
| 16 | |
| 17 | namespace PoincareMT.LeviCivitaData |
| 18 | |
| 19 | private def curvatureBilinear |
| 20 | {E : Type*} [AddCommGroup E] [Module ℝ E] |
| 21 | (A : MultilinearMap ℝ (fun _ : Fin 4 => E) ℝ) (u v : E) : |
| 22 | E →ₗ[ℝ] E →ₗ[ℝ] ℝ := by |
| 23 | have h1 (a b c : E) : Function.update ![u, a, v, b] 1 c = ![u, c, v, b] := by |
| 24 | ext i; fin_cases i <;> simp |
| 25 | have h3 (a b c : E) : Function.update ![u, a, v, b] 3 c = ![u, a, v, c] := by |
| 26 | ext i; fin_cases i <;> simp |
| 27 | exact LinearMap.mk₂ ℝ (fun a b => A ![u, a, v, b]) |
| 28 | (fun a a' b => by simpa only [MultilinearMap.toLinearMap_apply, h1] using |
| 29 | (A.toLinearMap ![u, a, v, b] 1).map_add a a') |
| 30 | (fun c a b => by simpa only [MultilinearMap.toLinearMap_apply, h1] using |
| 31 | (A.toLinearMap ![u, a, v, b] 1).map_smul c a) |
| 32 | (fun a b b' => by simpa only [MultilinearMap.toLinearMap_apply, h3] using |
| 33 | (A.toLinearMap ![u, a, v, b] 3).map_add b b') |
| 34 | (fun c a b => by simpa only [MultilinearMap.toLinearMap_apply, h3] using |
| 35 | (A.toLinearMap ![u, a, v, b] 3).map_smul c b) |
| 36 | |
| 37 | section Manifold |
| 38 | |
| 39 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 40 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 41 | {g : RiemannianMetric n M} |
| 42 | |
| 43 | /-- The retained Ricci trace in any fixed basis. -/ |
| 44 | theorem ricci_eq_inverse_gram (D : LeviCivitaData g) (x : M) |
| 45 | {ι : Type*} [Fintype ι] [DecidableEq ι] |
| 46 | (b : Module.Basis ι ℝ (TangentSpace (𝓡 n) x)) |
| 47 | (A : MultilinearMap ℝ (fun _ : Fin 4 => TangentSpace (𝓡 n) x) ℝ) |
| 48 | (hA : ∀ w, D.curvatureTensor x (w 0) (w 1) (w 2) (w 3) = A w) |
| 49 | (u v : TangentSpace (𝓡 n) x) : |
| 50 | D.ricci x u v = ∑ i, ∑ j, |
| 51 | (Matrix.of (fun i j => g.inner x (b i) (b j)))⁻¹ i j * |
| 52 | D.curvatureTensor x u (b i) v (b j) := by |
| 53 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 54 | ⟨g.toRiemannianMetric⟩ |
| 55 | have h := bilinear_sum_basis_eq_inverse_gram (curvatureBilinear A u v) |
| 56 | b (g.orthonormalBasis x) |
| 57 | change (∑ i, A ![u, g.orthonormalBasis x i, v, g.orthonormalBasis x i]) = |
| 58 | ∑ i, ∑ j, (Matrix.of (fun i j => g.inner x (b i) (b j)))⁻¹ i j * |
| 59 | A ![u, b i, v, b j] at h |
| 60 | simpa [← hA, ricci] using h |
| 61 | |
| 62 | /-- A tangent isometry intertwining curvature also intertwines Ricci. -/ |
| 63 | theorem ricci_eq_of_linearEquiv |
| 64 | {N : Type*} [TopologicalSpace N] |
| 65 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) N] [IsManifold (𝓡 n) ∞ N] |
| 66 | {h : RiemannianMetric n N} (D : LeviCivitaData g) (D' : LeviCivitaData h) |
| 67 | (x : M) (y : N) |
| 68 | (e : TangentSpace (𝓡 n) x ≃ₗ[ℝ] TangentSpace (𝓡 n) y) |
| 69 | (hmetric : ∀ u v, h.inner y (e u) (e v) = g.inner x u v) |
| 70 | (hcurv : ∀ u v w z, D'.curvatureTensor y (e u) (e v) (e w) (e z) = |
| 71 | D.curvatureTensor x u v w z) |
| 72 | (B : MultilinearMap ℝ (fun _ : Fin 4 => TangentSpace (𝓡 n) y) ℝ) |
| 73 | (hB : ∀ w, D'.curvatureTensor y (w 0) (w 1) (w 2) (w 3) = B w) |
| 74 | (u v : TangentSpace (𝓡 n) x) : |
| 75 | D.ricci x u v = D'.ricci y (e u) (e v) := by |
| 76 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 77 | ⟨g.toRiemannianMetric⟩ |
| 78 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : N → Type _) := |
| 79 | ⟨h.toRiemannianMetric⟩ |
| 80 | let e' := e.isometryOfInner hmetric |
| 81 | have hc := bilinear_sum_orthonormalBasis_eq (curvatureBilinear B (e u) (e v)) |
| 82 | ((g.orthonormalBasis x).map e') (h.orthonormalBasis y) |
| 83 | change (∑ i, B ![e u, e (g.orthonormalBasis x i), e v, |
| 84 | e (g.orthonormalBasis x i)]) = |
| 85 | ∑ i, B ![e u, h.orthonormalBasis y i, e v, h.orthonormalBasis y i] at hc |
| 86 | simpa [← hB, hcurv, ricci] using hc |
| 87 | |
| 88 | end Manifold |
| 89 | |
| 90 | variable {n : ℕ} {g : RiemannianMetric n (EuclideanSpace ℝ (Fin n))} |
| 91 | |
| 92 | /-- Second spatial scalar jets suffice for convergence of retained Ricci. -/ |
| 93 | theorem tendsto_ricci_of_scalar_metric_jets |
| 94 | {α : Type*} {l : Filter α} |
| 95 | {gseq : α → RiemannianMetric n (EuclideanSpace ℝ (Fin n))} |
| 96 | (Dseq : ∀ a, LeviCivitaData (gseq a)) (D : LeviCivitaData g) |
| 97 | (x u v : EuclideanSpace ℝ (Fin n)) |
| 98 | {ι : Type*} [Fintype ι] [DecidableEq ι] |
| 99 | (b : Module.Basis ι ℝ (EuclideanSpace ℝ (Fin n))) |
| 100 | (h : ∀ r : ℕ, r ≤ 2 → ∀ a c : ι, |
| 101 | Tendsto (fun i => iteratedFDeriv ℝ r |
| 102 | (fun y => (gseq i).inner y (b a) (b c)) x) l |
| 103 | (𝓝 (iteratedFDeriv ℝ r (fun y => g.inner y (b a) (b c)) x))) : |
| 104 | Tendsto (fun i => (Dseq i).ricci x u v) l (𝓝 (D.ricci x u v)) := by |
| 105 | classical |
| 106 | obtain ⟨hzero, hone, htwo⟩ := |
| 107 | RiemannianMetric.tendsto_euclideanCoefficients_of_scalar_jets x b h |
| 108 | let Gseq : α → Matrix ι ι ℝ := fun a i j => (gseq a).inner x (b i) (b j) |
| 109 | let G : Matrix ι ι ℝ := fun i j => g.inner x (b i) (b j) |
| 110 | have hmatrix : Tendsto Gseq l (𝓝 G) := by |
| 111 | apply tendsto_pi_nhds.mpr |
| 112 | intro i |
| 113 | apply tendsto_pi_nhds.mpr |
| 114 | intro j |
| 115 | exact ((ContinuousLinearMap.apply ℝ ℝ (b j)).continuous.continuousAt.tendsto.comp |
| 116 | ((ContinuousLinearMap.apply ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) (b i)).continuous.continuousAt.tendsto.comp hzero)) |
| 117 | have hdet : G.det ≠ 0 := by |
| 118 | let : Bundle.RiemannianBundle |
| 119 | (TangentSpace (𝓡 n) : EuclideanSpace ℝ (Fin n) → Type _) := |
| 120 | ⟨g.toRiemannianMetric⟩ |
| 121 | change (Matrix.gram ℝ (show Module.Basis ι ℝ (TangentSpace (𝓡 n) x) from b)).det ≠ 0 |
| 122 | exact Matrix.det_gram_ne_zero_iff_linearIndependent.mpr b.linearIndependent |
| 123 | have hinv : Tendsto (fun a => (Gseq a)⁻¹) l (𝓝 G⁻¹) := by |
| 124 | apply (continuousAt_matrix_inv G ?_).tendsto.comp hmatrix |
| 125 | rw [show (Ring.inverse : ℝ → ℝ) = Inv.inv from funext Ring.inverse_eq_inv] |
| 126 | exact continuousAt_inv₀ hdet |
| 127 | have heq (g' : RiemannianMetric n (EuclideanSpace ℝ (Fin n))) |
| 128 | (D' : LeviCivitaData g') := |
| 129 | D'.ricci_eq_inverse_gram x b (D'.exists_multilinear_curvatureTensor x).choose |
| 130 | (D'.exists_multilinear_curvatureTensor x).choose_spec u v |
| 131 | simp_rw [heq] |
| 132 | apply tendsto_finsetSum |
| 133 | intro i _ |
| 134 | apply tendsto_finsetSum |
| 135 | intro j _ |
| 136 | exact ((tendsto_pi_nhds.mp (tendsto_pi_nhds.mp hinv i)) j).mul |
| 137 | (tendsto_curvatureTensor_of_metric_jets Dseq D x u (b i) v (b j) hzero hone htwo) |
| 138 | |
| 139 | /-- Coordinate naturality identifies the scalar Ricci limit with retained Ricci. -/ |
| 140 | theorem ricci_eq_pullback_euclidean |
| 141 | {N : Type*} [TopologicalSpace N] |
| 142 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) N] [IsManifold (𝓡 n) ∞ N] |
| 143 | {h : RiemannianMetric n N} (D : LeviCivitaData g) (D' : LeviCivitaData h) |
| 144 | {f : EuclideanSpace ℝ (Fin n) → N} {x : EuclideanSpace ℝ (Fin n)} |
| 145 | (hf : ContMDiffAt (𝓡 n) (𝓡 n) ∞ f x) |
| 146 | (hinv : ∀ᶠ y in 𝓝 x, (mfderiv (𝓡 n) (𝓡 n) f y).IsInvertible) |
| 147 | (hmetric : ∀ᶠ y in 𝓝 x, ∀ u v : EuclideanSpace ℝ (Fin n), |
| 148 | g.inner y u v = h.inner (f y) (mfderiv (𝓡 n) (𝓡 n) f y u) |
| 149 | (mfderiv (𝓡 n) (𝓡 n) f y v)) |
| 150 | (u v : EuclideanSpace ℝ (Fin n)) : |
| 151 | D.ricci x u v = D'.ricci (f x) |
| 152 | (mfderiv (𝓡 n) (𝓡 n) f x u) (mfderiv (𝓡 n) (𝓡 n) f x v) := by |
| 153 | obtain ⟨e, he⟩ := hinv.self_of_nhds |
| 154 | obtain ⟨B, hB⟩ := D.exists_multilinear_curvatureTensor x |
| 155 | have h := D'.ricci_eq_of_linearEquiv D (f x) x e.symm.toLinearEquiv |
| 156 | (fun a b => by |
| 157 | rw [hmetric.self_of_nhds, ← he] |
| 158 | simp) |
| 159 | (fun a b c d => by |
| 160 | rw [D.curvatureTensor_eq_pullback_euclidean D' hf hinv hmetric, ← he] |
| 161 | simp) B hB (e u) (e v) |
| 162 | rw [← he] |
| 163 | simpa using h.symm |
| 164 | |
| 165 | end PoincareMT.LeviCivitaData |