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.Coordinates.CenteredCoordinateDifferential |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Coordinates.SquareChartPairing |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Calculus.TimeSpaceDerivative |
| 4 | |
| 5 | /-! |
| 6 | # Spatial derivatives of the actual square-time metric partial |
| 7 | |
| 8 | The flow equation gives four times square time times Ricci. Differentiation |
| 9 | on the open chart target retains this identity also at square time zero. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option maxSynthPendingDepth 3 |
| 14 | set_option maxHeartbeats 800000 |
| 15 | |
| 16 | open scoped Manifold ContDiff Bundle Topology |
| 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] |
| 26 | |
| 27 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 28 | |
| 29 | theorem centeredChartRicci_contDiffOn (hM04 : RicciFlowCurvatureTheory.{u}) |
| 30 | {g : RiemannianMetric n M} (D : LeviCivitaData g) (p : M) (V W : E) : |
| 31 | ContDiffOn ℝ ∞ (fun y : E ↦ D.ricci ((chartAt E p).symm y) |
| 32 | (chartVectorField p V ((chartAt E p).symm y)) |
| 33 | (chartVectorField p W ((chartAt E p).symm y))) (chartAt E p).target := by |
| 34 | have hf : ContMDiffOn (𝓡 n) (𝓘(ℝ, ℝ)) ∞ |
| 35 | (fun q : M ↦ D.ricci q (chartVectorField p V q) (chartVectorField p W q)) |
| 36 | (chartAt E p).source := by |
| 37 | have h := (hM04.tensor_calculus n M g D).2.1.2 |
| 38 | (chartAt E p).source (chartAt E p).open_source |
| 39 | (fun i : Fin 2 ↦ chartVectorField p (![V, W] i)) |
| 40 | (fun i ↦ chartVectorField_smooth p (![V, W] i)) |
| 41 | simpa [LeviCivitaData.ricciEvaluation] using h |
| 42 | exact (hf.comp contMDiffOn_chart_symm |
| 43 | (fun y hy ↦ (chartAt E p).map_target hy)).contDiffOn |
| 44 | |
| 45 | set_option backward.isDefEq.respectTransparency false in |
| 46 | theorem squareChartMetric_time_at_center {J : Set ℝ} (F : RicciFlow n M J) |
| 47 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 48 | (p : M) (s : ℝ) (hs : s ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) (V W : E) : |
| 49 | fderiv ℝ (squareChartMetric F T p) (s, (chartAt E p) p) (1, 0) V W = |
| 50 | 4 * s * (F.connection (T - s ^ 2)).ricci p V W := by |
| 51 | have hy := (chartAt E p).map_source (mem_chart_source E p) |
| 52 | have h := squareChartMetric_time_pairing F T b hb hwindow p s hs ((chartAt E p) p) V W hy |
| 53 | rw [← chartVectorField_at_inverse p V ((chartAt E p) p) hy, |
| 54 | ← chartVectorField_at_inverse p W ((chartAt E p) p) hy] at h |
| 55 | rw [(chartAt E p).left_inv (mem_chart_source E p)] at h |
| 56 | simpa only [chartVectorField_self] using h |
| 57 | |
| 58 | theorem squareChartMetric_time_space_at_center {J : Set ℝ} (F : RicciFlow n M J) |
| 59 | (hM04 : RicciFlowCurvatureTheory.{u}) |
| 60 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 61 | (p : M) (s : ℝ) (hs : s ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) (U V W : E) : |
| 62 | fderiv ℝ (fun y : E ↦ fderiv ℝ (squareChartMetric F T p) (s, y) (1, 0)) |
| 63 | ((chartAt E p) p) U V W = |
| 64 | 4 * s * fderiv ℝ (fun y : E ↦ (F.connection (T - s ^ 2)).ricci |
| 65 | ((chartAt E p).symm y) (chartVectorField p V ((chartAt E p).symm y)) |
| 66 | (chartVectorField p W ((chartAt E p).symm y))) ((chartAt E p) p) U := by |
| 67 | let H : E → E →L[ℝ] E →L[ℝ] ℝ := fun y ↦ |
| 68 | fderiv ℝ (squareChartMetric F T p) (s, y) (1, 0) |
| 69 | let r : E → ℝ := fun y ↦ (F.connection (T - s ^ 2)).ricci ((chartAt E p).symm y) |
| 70 | (chartVectorField p V ((chartAt E p).symm y)) |
| 71 | (chartVectorField p W ((chartAt E p).symm y)) |
| 72 | have hy := (chartAt E p).map_source (mem_chart_source E p) |
| 73 | have hH : DifferentiableAt ℝ H ((chartAt E p) p) := by |
| 74 | have hG : ContDiffAt ℝ ∞ (squareChartMetric F T p) (s, (chartAt E p) p) := |
| 75 | (squareChartMetric_smooth F T b hb hwindow p).contDiffAt |
| 76 | ((isOpen_Ioo.prod (chartAt E p).open_target).mem_nhds ⟨hs, hy⟩) |
| 77 | exact (((hG.fderiv_right (m := ∞) (by simp)).differentiableAt (by simp)).comp |
| 78 | ((chartAt E p) p) ((hasFDerivAt_const s ((chartAt E p) p)).prodMk |
| 79 | (hasFDerivAt_id ((chartAt E p) p))).differentiableAt).clm_apply |
| 80 | (differentiableAt_const ((1, 0) : ℝ × E)) |
| 81 | have hr : DifferentiableAt ℝ r ((chartAt E p) p) := |
| 82 | ((centeredChartRicci_contDiffOn hM04 (F.connection (T - s ^ 2)) p V W).contDiffAt |
| 83 | ((chartAt E p).open_target.mem_nhds hy)).differentiableAt (by simp) |
| 84 | have heq : (fun y ↦ H y V W) =ᶠ[𝓝 ((chartAt E p) p)] (fun y ↦ (4 * s) * r y) := by |
| 85 | filter_upwards [(chartAt E p).open_target.mem_nhds hy] with y hy' |
| 86 | dsimp only [H, r] |
| 87 | rw [squareChartMetric_time_pairing F T b hb hwindow p s hs y V W hy', |
| 88 | chartVectorField_at_inverse p V y hy', chartVectorField_at_inverse p W y hy'] |
| 89 | have hleft := (hH.hasFDerivAt.clm_apply (hasFDerivAt_const V ((chartAt E p) p))).clm_apply |
| 90 | (hasFDerivAt_const W ((chartAt E p) p)) |
| 91 | have hright := hr.hasFDerivAt.const_mul (4 * s) |
| 92 | have h := (hleft.congr_of_eventuallyEq heq.symm).unique hright |
| 93 | simpa using congrArg (fun L : E →L[ℝ] ℝ ↦ L U) h |
| 94 | |
| 95 | end PoincareMT.ReducedLength |