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.ReducedGeometry.ReducedLength.Tensor.CurvatureSlice |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Tensor.TensorTrace |
| 3 | import PoincareLib.Geometry.RicciFlow.Curvature.Theory |
| 4 | |
| 5 | /-! |
| 6 | # Covariant differentiation of the Ricci contraction |
| 7 | |
| 8 | Inverse metric trace differentiation cancels precisely the connection |
| 9 | corrections in the contracted second and fourth curvature slots. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option maxSynthPendingDepth 3 |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle BigOperators Topology RealInnerProductSpace |
| 16 | |
| 17 | open Filter |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.ReducedLength |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 25 | [IsManifold (𝓡 n) ∞ M] {g : RiemannianMetric n M} |
| 26 | |
| 27 | theorem frameCurvatureSlice_trace (D : LeviCivitaData g) |
| 28 | (hR : IsSmoothCovariantTensor D.riemannEvaluation) (p : M) |
| 29 | (v w : TangentSpace (𝓡 n) p) (q : M) |
| 30 | (hq : q ∈ (trivializationAt (EuclideanSpace ℝ (Fin n)) |
| 31 | (TangentSpace (𝓡 n) : M → Type _) p).baseSet) : |
| 32 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 33 | ⟨g.toRiemannianMetric⟩ |
| 34 | letI : FiniteDimensional ℝ (TangentSpace (𝓡 n) p) := |
| 35 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 36 | (TangentSpace (𝓡 n) : M → Type _) p |
| 37 | metricFormTrace (frameMetricForm g p q) (frameCurvatureSlice D hR p v w q) = |
| 38 | D.ricci q (extensionMap p q v) (extensionMap p q w) := by |
| 39 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 40 | ⟨g.toRiemannianMetric⟩ |
| 41 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) p) := |
| 42 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 43 | (TangentSpace (𝓡 n) : M → Type _) p |
| 44 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) q) := |
| 45 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 46 | (TangentSpace (𝓡 n) : M → Type _) q |
| 47 | have h := metricFormTrace_pullback (extensionEquiv p q hq) (frameMetricForm g p q) |
| 48 | (by intro a b; rw [frameMetricForm_apply]; rw [← extensionEquiv_coe p q hq]; rfl) |
| 49 | (curvatureSliceBilinear D hR q (extensionMap p q v) (extensionMap p q w)) |
| 50 | (g.orthonormalBasis q) |
| 51 | rw [extensionEquiv_coe] at h |
| 52 | simpa only [frameCurvatureSlice, curvatureSliceBilinear_apply, LeviCivitaData.ricci] |
| 53 | using! h |
| 54 | |
| 55 | theorem ricciExtension_mvfderiv (D : LeviCivitaData g) |
| 56 | (hR : IsSmoothCovariantTensor D.riemannEvaluation) (p : M) |
| 57 | (X v w : TangentSpace (𝓡 n) p) : |
| 58 | mvfderiv (𝓡 n) (fun q ↦ D.ricci q (extensionMap p q v) (extensionMap p q w)) p X = |
| 59 | (∑ i, D.covariantTensorDerivative D.riemannEvaluation p |
| 60 | ![X, v, g.orthonormalBasis p i, w, g.orthonormalBasis p i]) + |
| 61 | D.ricci p (frozenConnectionEndomorphism D p X v) w + |
| 62 | D.ricci p v (frozenConnectionEndomorphism D p X w) := by |
| 63 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 64 | ⟨g.toRiemannianMetric⟩ |
| 65 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) p) := |
| 66 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 67 | (TangentSpace (𝓡 n) : M → Type _) p |
| 68 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) p |
| 69 | have hp : e.baseSet ∈ 𝓝 p := |
| 70 | e.open_baseSet.mem_nhds (FiberBundle.mem_baseSet_trivializationAt' p) |
| 71 | let G := frameMetricForm g p |
| 72 | let B := frameCurvatureSlice D hR p v w |
| 73 | let P := frozenConnectionEndomorphism D p X |
| 74 | have hG := ((frameMetricForm_smooth g p).contMDiffAt hp).mdifferentiableAt (by simp) |
| 75 | have hB := ((frameCurvatureSlice_smooth D hR p v w).contMDiffAt hp).mdifferentiableAt |
| 76 | (by simp) |
| 77 | let C := mvfderiv (𝓡 n) B p X - |
| 78 | (B p).bilinearComp P (ContinuousLinearMap.id ℝ _) - |
| 79 | (B p).bilinearComp (ContinuousLinearMap.id ℝ _) P |
| 80 | have heval (f : M → TangentSpace (𝓡 n) p →L[ℝ] TangentSpace (𝓡 n) p →L[ℝ] ℝ) |
| 81 | (hf : MDifferentiableAt (𝓡 n) (𝓘(ℝ, TangentSpace (𝓡 n) p →L[ℝ] |
| 82 | TangentSpace (𝓡 n) p →L[ℝ] ℝ)) f p) (a b : TangentSpace (𝓡 n) p) : |
| 83 | mvfderiv (𝓡 n) (fun q ↦ f q a b) p X = mvfderiv (𝓡 n) f p X a b := by |
| 84 | exact mvfderiv_const_clm |
| 85 | ((ContinuousLinearMap.apply ℝ ℝ b).comp |
| 86 | (ContinuousLinearMap.apply ℝ (TangentSpace (𝓡 n) p →L[ℝ] ℝ) a)) f p hf X |
| 87 | have hC (a b : TangentSpace (𝓡 n) p) : |
| 88 | C a b = D.covariantTensorDerivative D.riemannEvaluation p ![X, v, a, w, b] + |
| 89 | D.curvatureTensor p (P v) a w b + D.curvatureTensor p v a (P w) b := by |
| 90 | dsimp only [C] |
| 91 | simp only [sub_apply, ContinuousLinearMap.bilinearComp_apply, ContinuousLinearMap.id_apply] |
| 92 | rw [← heval B hB, frameCurvatureSlice_derivative D hR] |
| 93 | simp only [B, frameCurvatureSlice_self, curvatureSliceBilinear_apply, P] |
| 94 | ring |
| 95 | have hunit : IsUnit (formOperator (G p)) := by |
| 96 | dsimp only [G] |
| 97 | rw [formOperator_frameMetricForm_self] |
| 98 | exact isUnit_one |
| 99 | have hder := metricFormTrace_mvfderiv G B p X hG hB hunit P C |
| 100 | (by |
| 101 | intro a b |
| 102 | rw [← heval G hG, frameMetricForm_derivative D] |
| 103 | simp only [G, frameMetricForm_self, P]) |
| 104 | (by |
| 105 | intro a b |
| 106 | dsimp only [C] |
| 107 | simp only [sub_apply, ContinuousLinearMap.bilinearComp_apply, ContinuousLinearMap.id_apply] |
| 108 | ring) |
| 109 | have heq : (fun q ↦ D.ricci q (extensionMap p q v) (extensionMap p q w)) =ᶠ[𝓝 p] |
| 110 | (fun q ↦ metricFormTrace (G q) (B q)) := by |
| 111 | filter_upwards [hp] with q hq |
| 112 | exact (frameCurvatureSlice_trace D hR p v w q hq).symm |
| 113 | rw [mvfderiv, heq.mfderiv_eq] |
| 114 | change mvfderiv (𝓡 n) (fun q ↦ metricFormTrace (G q) (B q)) p X = _ |
| 115 | rw [hder, metricFormTrace] |
| 116 | dsimp only [G] |
| 117 | rw [formOperator_frameMetricForm_self, Ring.inverse_one, one_mul, |
| 118 | continuousTrace_formOperator _ (g.orthonormalBasis p)] |
| 119 | simp_rw [hC, Finset.sum_add_distrib] |
| 120 | rfl |
| 121 | |
| 122 | theorem covariantRicci_eq_contraction (hM04 : RicciFlowCurvatureTheory.{u}) |
| 123 | (D : LeviCivitaData g) (p : M) (X v w : TangentSpace (𝓡 n) p) : |
| 124 | D.covariantTensorDerivative D.ricciEvaluation p ![X, v, w] = |
| 125 | ∑ i, D.covariantTensorDerivative D.riemannEvaluation p |
| 126 | ![X, v, g.orthonormalBasis p i, w, g.orthonormalBasis p i] := by |
| 127 | have hR := (hM04.tensor_calculus n M g D).1 |
| 128 | have hRic := (hM04.tensor_calculus n M g D).2.1 |
| 129 | have h := frameTensorForm_derivative D D.ricciEvaluation hRic p X v w |
| 130 | simp only [frameTensorForm_apply, LeviCivitaData.ricciEvaluation, |
| 131 | Matrix.cons_val_zero, Matrix.cons_val_one] at h |
| 132 | rw [ricciExtension_mvfderiv D hR] at h |
| 133 | linarith |
| 134 | |
| 135 | theorem scalarCurvature_mvfderiv_contraction (hM04 : RicciFlowCurvatureTheory.{u}) |
| 136 | (D : LeviCivitaData g) (p : M) (X : TangentSpace (𝓡 n) p) : |
| 137 | mvfderiv (𝓡 n) D.scalarCurvature p X = |
| 138 | ∑ i, ∑ j, D.covariantTensorDerivative D.riemannEvaluation p |
| 139 | ![X, g.orthonormalBasis p i, g.orthonormalBasis p j, |
| 140 | g.orthonormalBasis p i, g.orthonormalBasis p j] := by |
| 141 | have h := tensorMetricTrace_mvfderiv D D.ricciEvaluation |
| 142 | (hM04.tensor_calculus n M g D).2.1 p X |
| 143 | simp_rw [covariantRicci_eq_contraction hM04 D] at h |
| 144 | change mvfderiv (𝓡 n) D.scalarCurvature p X = _ at h |
| 145 | exact h |
| 146 | |
| 147 | end PoincareMT.ReducedLength |