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.BasisContractions |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Tensor.ContractedBianchi |
| 3 | |
| 4 | /-! |
| 5 | # Curvature contractions in any selected-metric orthonormal basis |
| 6 | |
| 7 | Pointwise multilinear witnesses suffice for all changes of basis. The |
| 8 | actual Ricci endomorphism is supplied by finite-dimensional Riesz duality. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option maxSynthPendingDepth 3 |
| 13 | |
| 14 | open scoped Manifold ContDiff Bundle BigOperators RealInnerProductSpace |
| 15 | |
| 16 | universe u |
| 17 | |
| 18 | namespace PoincareMT.ReducedLength |
| 19 | |
| 20 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 21 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 22 | [IsManifold (𝓡 n) ∞ M] {g : RiemannianMetric n M} |
| 23 | |
| 24 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 25 | |
| 26 | noncomputable def ricciOperator (hM04 : RicciFlowCurvatureTheory.{u}) |
| 27 | (D : LeviCivitaData g) (p : M) : TangentSpace (𝓡 n) p →L[ℝ] TangentSpace (𝓡 n) p := by |
| 28 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := ⟨g.toRiemannianMetric⟩ |
| 29 | letI : FiniteDimensional ℝ (TangentSpace (𝓡 n) p) := |
| 30 | VectorBundle.finiteDimensional ℝ E (TangentSpace (𝓡 n) : M → Type _) p |
| 31 | exact formOperator (tensorBilinear g D.ricciEvaluation (hM04.tensor_calculus n M g D).2.1 p) |
| 32 | |
| 33 | theorem ricciOperator_pairing (hM04 : RicciFlowCurvatureTheory.{u}) |
| 34 | (D : LeviCivitaData g) (p : M) (v w : TangentSpace (𝓡 n) p) : |
| 35 | g.inner p (ricciOperator hM04 D p v) w = D.ricci p v w := by |
| 36 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := ⟨g.toRiemannianMetric⟩ |
| 37 | letI : FiniteDimensional ℝ (TangentSpace (𝓡 n) p) := |
| 38 | VectorBundle.finiteDimensional ℝ E (TangentSpace (𝓡 n) : M → Type _) p |
| 39 | exact (formOperator_pairing _ v w).trans |
| 40 | (tensorBilinear_apply g D.ricciEvaluation (hM04.tensor_calculus n M g D).2.1 p v w) |
| 41 | |
| 42 | variable {ι : Type*} [Fintype ι] |
| 43 | |
| 44 | theorem ricci_orthonormal_trace (hM04 : RicciFlowCurvatureTheory.{u}) |
| 45 | (D : LeviCivitaData g) (p : M) : |
| 46 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := ⟨g.toRiemannianMetric⟩ |
| 47 | ∀ e : OrthonormalBasis ι ℝ (TangentSpace (𝓡 n) p), |
| 48 | (∑ i, D.ricci p (e i) (e i)) = D.scalarCurvature p := by |
| 49 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := ⟨g.toRiemannianMetric⟩ |
| 50 | letI : FiniteDimensional ℝ (TangentSpace (𝓡 n) p) := |
| 51 | VectorBundle.finiteDimensional ℝ E (TangentSpace (𝓡 n) : M → Type _) p |
| 52 | intro e |
| 53 | have h := bilinear_trace_basis_eq |
| 54 | (tensorBilinear g D.ricciEvaluation (hM04.tensor_calculus n M g D).2.1 p) |
| 55 | e (g.orthonormalBasis p) |
| 56 | simpa only [tensorBilinear_apply, LeviCivitaData.ricciEvaluation, |
| 57 | Matrix.cons_val_zero, Matrix.cons_val_one, LeviCivitaData.scalarCurvature] using h |
| 58 | |
| 59 | theorem ricciOperator_orthonormal_square (hM04 : RicciFlowCurvatureTheory.{u}) |
| 60 | (D : LeviCivitaData g) (p : M) : |
| 61 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := ⟨g.toRiemannianMetric⟩ |
| 62 | ∀ e : OrthonormalBasis ι ℝ (TangentSpace (𝓡 n) p), |
| 63 | (∑ i, g.inner p (ricciOperator hM04 D p (e i)) (ricciOperator hM04 D p (e i))) = |
| 64 | D.ricciNormSq p := by |
| 65 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := ⟨g.toRiemannianMetric⟩ |
| 66 | letI : FiniteDimensional ℝ (TangentSpace (𝓡 n) p) := |
| 67 | VectorBundle.finiteDimensional ℝ E (TangentSpace (𝓡 n) : M → Type _) p |
| 68 | intro e |
| 69 | let B := tensorBilinear g D.ricciEvaluation (hM04.tensor_calculus n M g D).2.1 p |
| 70 | have h := bilinear_square_basis_eq B e (g.orthonormalBasis p) |
| 71 | simp_rw [bilinear_square_contraction B e] at h |
| 72 | simpa only [B, tensorBilinear_apply, LeviCivitaData.ricciEvaluation, |
| 73 | Matrix.cons_val_zero, Matrix.cons_val_one, LeviCivitaData.ricciNormSq, |
| 74 | ricciOperator] using! h |
| 75 | |
| 76 | theorem curvature_orthonormal_index_trace (hM04 : RicciFlowCurvatureTheory.{u}) |
| 77 | (D : LeviCivitaData g) (p : M) (A : TangentSpace (𝓡 n) p) : |
| 78 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := ⟨g.toRiemannianMetric⟩ |
| 79 | ∀ e : OrthonormalBasis ι ℝ (TangentSpace (𝓡 n) p), |
| 80 | (∑ i, D.curvatureTensor p (e i) A A (e i)) = -D.ricci p A A := by |
| 81 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := ⟨g.toRiemannianMetric⟩ |
| 82 | letI : FiniteDimensional ℝ (TangentSpace (𝓡 n) p) := |
| 83 | VectorBundle.finiteDimensional ℝ E (TangentSpace (𝓡 n) : M → Type _) p |
| 84 | intro e |
| 85 | have h := bilinear_trace_basis_eq |
| 86 | (curvatureSliceBilinear D (hM04.tensor_calculus n M g D).1 p A A) |
| 87 | e (g.orthonormalBasis p) |
| 88 | simp only [curvatureSliceBilinear_apply] at h |
| 89 | calc |
| 90 | _ = ∑ i, -D.curvatureTensor p A (e i) A (e i) := |
| 91 | Finset.sum_congr rfl fun i _ ↦ curvatureTensor_first_antisymm hM04 D p (e i) A A (e i) |
| 92 | _ = -D.ricci p A A := by rw [Finset.sum_neg_distrib, h]; rfl |
| 93 | |
| 94 | theorem covariantRicci_direction_orthonormal_trace (hM04 : RicciFlowCurvatureTheory.{u}) |
| 95 | (D : LeviCivitaData g) (p : M) (A : TangentSpace (𝓡 n) p) : |
| 96 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := ⟨g.toRiemannianMetric⟩ |
| 97 | ∀ e : OrthonormalBasis ι ℝ (TangentSpace (𝓡 n) p), |
| 98 | (∑ i, ricciDerivativePairing D p A (e i) (e i)) = |
| 99 | mvfderiv (𝓡 n) D.scalarCurvature p A := by |
| 100 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := ⟨g.toRiemannianMetric⟩ |
| 101 | letI : FiniteDimensional ℝ (TangentSpace (𝓡 n) p) := |
| 102 | VectorBundle.finiteDimensional ℝ E (TangentSpace (𝓡 n) : M → Type _) p |
| 103 | intro e |
| 104 | have hRic := (hM04.tensor_calculus n M g D).2.1 |
| 105 | have hD := (hM04.tensor_calculus n M g D).2.2.1 2 D.ricciEvaluation hRic |
| 106 | let B := bilinearOfMultilinear ((hD.1 p).choose.curryLeft A) |
| 107 | have hB (v w : TangentSpace (𝓡 n) p) : B v w = ricciDerivativePairing D p A v w := by |
| 108 | dsimp only [B] |
| 109 | rw [bilinearOfMultilinear_apply] |
| 110 | change (hD.1 p).choose ![A, v, w] = _ |
| 111 | exact ((hD.1 p).choose_spec ![A, v, w]).symm |
| 112 | have he := bilinear_trace_basis_eq B e (g.orthonormalBasis p) |
| 113 | simp only [hB] at he |
| 114 | have h := tensorMetricTrace_mvfderiv D D.ricciEvaluation hRic p A |
| 115 | exact he.trans h.symm |
| 116 | |
| 117 | theorem covariantRicci_divergence_trace_basis_eq (hM04 : RicciFlowCurvatureTheory.{u}) |
| 118 | (D : LeviCivitaData g) (p : M) (A : TangentSpace (𝓡 n) p) : |
| 119 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := ⟨g.toRiemannianMetric⟩ |
| 120 | ∀ e : OrthonormalBasis ι ℝ (TangentSpace (𝓡 n) p), |
| 121 | (∑ i, ricciDerivativePairing D p (e i) A (e i)) = |
| 122 | ∑ j, ricciDerivativePairing D p (g.orthonormalBasis p j) A (g.orthonormalBasis p j) := by |
| 123 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := ⟨g.toRiemannianMetric⟩ |
| 124 | letI : FiniteDimensional ℝ (TangentSpace (𝓡 n) p) := |
| 125 | VectorBundle.finiteDimensional ℝ E (TangentSpace (𝓡 n) : M → Type _) p |
| 126 | intro e |
| 127 | have hRic := (hM04.tensor_calculus n M g D).2.1 |
| 128 | have hD := (hM04.tensor_calculus n M g D).2.2.1 2 D.ricciEvaluation hRic |
| 129 | let B := bilinearOfMultilinear ((hD.1 p).choose.curryMid (1 : Fin 3) A) |
| 130 | have hB (v w : TangentSpace (𝓡 n) p) : B v w = ricciDerivativePairing D p v A w := by |
| 131 | dsimp only [B] |
| 132 | rw [bilinearOfMultilinear_apply] |
| 133 | change (hD.1 p).choose ((1 : Fin 3).insertNth A ![v, w]) = _ |
| 134 | have heq : (1 : Fin 3).insertNth A ![v, w] = ![v, A, w] := by |
| 135 | funext i |
| 136 | fin_cases i <;> simp [Fin.insertNth, Fin.succAboveCases] |
| 137 | rw [heq] |
| 138 | exact ((hD.1 p).choose_spec ![v, A, w]).symm |
| 139 | have h := bilinear_trace_basis_eq B e (g.orthonormalBasis p) |
| 140 | simpa only [hB] using h |
| 141 | |
| 142 | theorem squareTime_covariantRicci_divergence_orthonormal_trace |
| 143 | {J : Set ℝ} (F : RicciFlow n M J) (hM04 : RicciFlowCurvatureTheory.{u}) |
| 144 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 145 | (p : M) (s : ℝ) (hs : s ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) |
| 146 | (A : TangentSpace (𝓡 n) p) : |
| 147 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 148 | ⟨(F.metric (T - s ^ 2)).toRiemannianMetric⟩ |
| 149 | ∀ e : OrthonormalBasis ι ℝ (TangentSpace (𝓡 n) p), |
| 150 | (∑ i, ricciDerivativePairing (F.connection (T - s ^ 2)) p (e i) A (e i)) = |
| 151 | mvfderiv (𝓡 n) (F.connection (T - s ^ 2)).scalarCurvature p A / 2 := by |
| 152 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 153 | ⟨(F.metric (T - s ^ 2)).toRiemannianMetric⟩ |
| 154 | intro e |
| 155 | rw [covariantRicci_divergence_trace_basis_eq hM04 (F.connection (T - s ^ 2)) p A e] |
| 156 | have h := squareTime_scalarCurvature_mvfderiv_contracted_bianchi F hM04 T b hb hwindow p s hs A |
| 157 | dsimp only at h |
| 158 | linarith |
| 159 | |
| 160 | end PoincareMT.ReducedLength |