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.CurveShortening.Connection.CurvaturePairing |
| 2 | import PoincareLib.Geometry.RicciFlow.Spacetime.Product.SpatialConnection |
| 3 | import PoincareLib.Geometry.RicciFlow.Curvature.Calculus.Tensors.RicciRegularity |
| 4 | |
| 5 | /-! |
| 6 | # Codazzi identity for the actual spacetime metric |
| 7 | |
| 8 | The scalar connection-pairing formula, followed by pair exchange, identifies |
| 9 | the time/spatial curvature component with the actual spatial covariant |
| 10 | derivative of Ricci. This follows MT2015Correction (0.1)-(0.2), p. 2, and |
| 11 | Lemma 0.2, pp. 4-6. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Bundle Manifold Set Topology Filter |
| 18 | open scoped Manifold ContDiff Bundle |
| 19 | |
| 20 | noncomputable section |
| 21 | |
| 22 | namespace PoincareMT.M62.SpacetimeData |
| 23 | |
| 24 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 26 | {a b : ℝ} |
| 27 | |
| 28 | set_option maxHeartbeats 800000 in |
| 29 | -- Normalizing the dependent three-field Ricci derivative tuple needs this budget. |
| 30 | /-- The actual mixed spacetime curvature is the difference of spatial Ricci |
| 31 | derivatives; MT2015Correction (0.1)-(0.2), p. 2, and Lemma 0.2, pp. 4-6. -/ |
| 32 | theorem codazzi {F : RicciFlow n M (Set.Icc a b)} |
| 33 | (G : SpacetimeData F) (q : G.charts.Point) |
| 34 | (B C D : TangentSpace (𝓡 n) q.1) : |
| 35 | G.connection.curvatureTensor q (G.charts.timeVector q) |
| 36 | (G.charts.horizontal q B) (G.charts.horizontal q C) (G.charts.horizontal q D) = |
| 37 | (F.connection q.2).covariantTensorDerivative (F.connection q.2).ricciEvaluation |
| 38 | q.1 ![C, B, D] - |
| 39 | (F.connection q.2).covariantTensorDerivative (F.connection q.2).ricciEvaluation |
| 40 | q.1 ![D, B, C] := by |
| 41 | let := G.charts.chartedSpace |
| 42 | let S := G.charts |
| 43 | let E := EuclideanSpace ℝ (Fin n) |
| 44 | let p := q.1 |
| 45 | let Dt := F.connection q.2 |
| 46 | let K := Dt.covariantTensorDerivative Dt.ricciEvaluation |
| 47 | let X := fun v : E => PoincareMT.ReducedLengthMinimum.Variation.Geometry.chartVectorField p v |
| 48 | let H := fun v : E => S.productChartField p v 0 |
| 49 | let T := S.timeVector |
| 50 | have hp : p ∈ (chartAt E p).source := mem_chart_source E p |
| 51 | have hO : IsOpen {r : S.Point | r.1 ∈ (chartAt E p).source} := |
| 52 | (chartAt E p).open_source.preimage S.contMDiff_space.continuous |
| 53 | have hX (v : E) : ContMDiffOn (𝓡 n) (𝓡 n).tangent ∞ (T% (X v)) |
| 54 | (chartAt E p).source := PoincareMT.ReducedLengthMinimum.Variation.Geometry.chartVectorField_smooth p v |
| 55 | have hH (v : E) : ContMDiffOn (𝓡 (n + 1)) (𝓡 (n + 1)).tangent ∞ (T% (H v)) |
| 56 | {r : S.Point | r.1 ∈ (chartAt E p).source} := S.productChartField_contMDiffOn p v 0 |
| 57 | have hT : ContMDiff (𝓡 (n + 1)) (𝓡 (n + 1)).tangent ∞ (T% T) := S.timeVector_smooth |
| 58 | have hfield (v : E) : S.liftSpatialField (fun _ : ℝ => X v) = H v := by |
| 59 | funext r |
| 60 | simp [H, X, SpacetimeCharts.liftSpatialField, SpacetimeCharts.productChartField] |
| 61 | have hdir (v : E) (r : S.Point) : H v r = S.horizontal r (X v r.1) := by |
| 62 | simp [H, X, SpacetimeCharts.productChartField] |
| 63 | have hconn (u v : E) (r : S.Point) (hr : r.1 ∈ (chartAt E p).source) : |
| 64 | G.charts.split r (G.connection.connection (H v) r (H u r)) = |
| 65 | ((F.connection r.2).connection (X v) r.1 (X u r.1), |
| 66 | (F.connection r.2).ricci r.1 (X u r.1) (X v r.1)) := by |
| 67 | have hreg : ContMDiffAt (𝓡 (n + 1)) (𝓡 (n + 1)).tangent ∞ |
| 68 | (T% (S.liftSpatialField (fun _ : ℝ => X v))) r := by |
| 69 | rw [hfield] |
| 70 | exact (hH v).contMDiffAt (hO.mem_nhds hr) |
| 71 | have h := G.spatial_connection_at (fun _ : ℝ => X v) r hreg (X u r.1) |
| 72 | rw [hfield] at h |
| 73 | simpa only [hdir] using h |
| 74 | have hcross (u v w : E) : |
| 75 | G.metric.inner q (G.connection.connection (H v) q (H u q)) |
| 76 | (G.connection.connection T q (H w q)) = |
| 77 | -Dt.ricci p (X w p) (Dt.connection (X v) p (X u p)) := by |
| 78 | have he := S.horizontal_time_decomposition q |
| 79 | (G.connection.connection (H v) q (H u q)) |
| 80 | rw [hconn u v q hp] at he |
| 81 | rw [G.metric.symm, ← he] |
| 82 | simp only [S, T, map_add, map_smul, G.inner_time, G.time_covariant_vertical, |
| 83 | smul_eq_mul, mul_zero, add_zero] |
| 84 | rw [hdir] |
| 85 | exact G.spatial_time_pairing q (X w p) (Dt.connection (X v) p (X u p)) |
| 86 | have hd (u v w : E) : |
| 87 | mvfderiv (𝓡 (n + 1)) |
| 88 | (fun r => G.metric.inner r (G.connection.connection (H w) r (H v r)) (T r)) |
| 89 | q (H u q) = |
| 90 | mvfderiv (𝓡 n) (fun x => Dt.ricci x (X w x) (X v x)) p (X u p) := by |
| 91 | have hf := (RicciFlowAnalysis.contMDiffOn_connection_pairing G.connection hO |
| 92 | (hH v) (hH w) hT.contMDiffOn).contMDiffAt (hO.mem_nhds hp) |
| 93 | have hs := S.mvfderiv_space_slice |
| 94 | (fun r => G.metric.inner r (G.connection.connection (H w) r (H v r)) (T r)) q |
| 95 | (hf.mdifferentiableAt (by simp)) (X u p) |
| 96 | have heq : (fun x : M => G.metric.inner (x, q.2) |
| 97 | (G.connection.connection (H w) (x, q.2) (H v (x, q.2))) (T (x, q.2))) =ᶠ[𝓝 p] |
| 98 | (fun x => Dt.ricci x (X w x) (X v x)) := by |
| 99 | filter_upwards [(chartAt E p).open_source.mem_nhds hp] with x hx |
| 100 | change G.metric.inner (x, q.2) |
| 101 | (G.connection.connection (H w) (x, q.2) (H v (x, q.2))) |
| 102 | (G.charts.timeVector (x, q.2)) = _ |
| 103 | rw [G.inner_time, hconn v w (x, q.2) hx] |
| 104 | exact RicciFlowAnalysis.ricci_symm Dt x (X v x) (X w x) |
| 105 | have heq' := congrArg (fun L => L (X u p)) |
| 106 | (heq.mfderiv_eq (I := 𝓡 n) (I' := 𝓘(ℝ, ℝ))) |
| 107 | rw [hdir] |
| 108 | exact hs.trans heq' |
| 109 | have hRicDiff (u v w : E) : |
| 110 | mvfderiv (𝓡 n) (fun x => Dt.ricci x (X v x) (X w x)) p (X u p) = |
| 111 | K p ![X u p, X v p, X w p] + |
| 112 | Dt.ricci p (Dt.connection (X v) p (X u p)) (X w p) + |
| 113 | Dt.ricci p (X v p) (Dt.connection (X w) p (X u p)) := by |
| 114 | have he := RicciFlowAnalysis.covariantTensorDerivativeOnFields_eq Dt |
| 115 | (RicciFlowAnalysis.isSmoothCovariantTensor_ricciEvaluation Dt) (chartAt E p).open_source |
| 116 | (X := ![X u, X v, X w]) |
| 117 | (by |
| 118 | intro i |
| 119 | fin_cases i |
| 120 | · exact hX u |
| 121 | · exact hX v |
| 122 | · exact hX w) hp |
| 123 | simp only [RicciFlowAnalysis.covariantTensorDerivativeOnFields, Fin.sum_univ_succ] at he |
| 124 | change mvfderiv (𝓡 n) (fun x => Dt.ricci x (X v x) (X w x)) p (X u p) - |
| 125 | (Dt.ricci p (Dt.connection (X v) p (X u p)) (X w p) + |
| 126 | (Dt.ricci p (X v p) (Dt.connection (X w) p (X u p)) + 0)) = |
| 127 | K p ![X u p, X v p, X w p] at he |
| 128 | linarith only [he] |
| 129 | have hformula (u v w : E) : |
| 130 | G.connection.curvatureTensor q (H u q) (H v q) (T q) (H w q) = |
| 131 | K p ![X u p, X w p, X v p] - K p ![X v p, X w p, X u p] := by |
| 132 | have hh := curvatureTensor_pairing_of_commuting G.connection hO |
| 133 | (hH u) (hH v) hT.contMDiffOn (hH w) hp |
| 134 | (S.productChartField_bracket p u v 0 0 q hp) |
| 135 | rw [hd, hcross, hd, hcross, hRicDiff, hRicDiff] at hh |
| 136 | have hc := RicciFlowAnalysis.connection_commutator Dt |
| 137 | (((hX u).contMDiffAt ((chartAt E p).open_source.mem_nhds hp)).mdifferentiableAt (by simp)) |
| 138 | (((hX v).contMDiffAt ((chartAt E p).open_source.mem_nhds hp)).mdifferentiableAt (by simp)) |
| 139 | have hc' : Dt.connection (X v) p (X u p) = Dt.connection (X u) p (X v p) := by |
| 140 | apply sub_eq_zero.mp |
| 141 | exact hc.trans |
| 142 | (PoincareMT.ReducedLengthMinimum.Variation.Geometry.chartVectorField_bracket p u v p hp) |
| 143 | rw [RicciFlowAnalysis.ricci_symm Dt p (Dt.connection (X w) p (X u p)) (X v p), |
| 144 | RicciFlowAnalysis.ricci_symm Dt p (Dt.connection (X w) p (X v p)) (X u p), hc'] at hh |
| 145 | linarith only [hh] |
| 146 | let L := (mdifferentiable_chart (I := 𝓡 n) p).mfderiv hp |
| 147 | have hvalue (V : TangentSpace (𝓡 n) p) : X (L V) p = V := by |
| 148 | have hi : (mfderiv (𝓡 n) (𝓡 n) (chartAt E p) p).IsInvertible := ⟨L, rfl⟩ |
| 149 | exact hi.inverse_apply_self V |
| 150 | have hpoint (V : TangentSpace (𝓡 n) p) : H (L V) q = S.horizontal q V := by |
| 151 | rw [hdir, hvalue] |
| 152 | rw [RicciFlowAnalysis.curvatureTensor_pair_exchange] |
| 153 | simpa only [hpoint, hvalue] using hformula (L C) (L D) (L B) |
| 154 | |
| 155 | end PoincareMT.M62.SpacetimeData |