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.SquareChartMetric |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Variation.Fields.ChartVectorField |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Coordinates.CoordinatePhase |
| 4 | import Mathlib.Analysis.Calculus.Deriv.Mul |
| 5 | import Mathlib.Analysis.Calculus.Deriv.Prod |
| 6 | import Mathlib.Analysis.Calculus.FDeriv.CompCLM |
| 7 | |
| 8 | /-! |
| 9 | # Coordinate derivatives identify the geometric regularized force |
| 10 | |
| 11 | Spatial derivatives of the pulled-back metric give the selected connection |
| 12 | through Koszul. Its time derivative is the actual `4s Ric` term, including |
| 13 | at square-root time zero. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | set_option maxSynthPendingDepth 3 |
| 18 | -- The metric evaluations contain nested bundle and operator instances. |
| 19 | set_option maxHeartbeats 800000 |
| 20 | |
| 21 | open scoped Manifold ContDiff Bundle Topology |
| 22 | open Filter |
| 23 | |
| 24 | universe u |
| 25 | |
| 26 | namespace PoincareMT.ReducedLength |
| 27 | |
| 28 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 29 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 30 | [IsManifold (𝓡 n) ∞ M] |
| 31 | |
| 32 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 33 | |
| 34 | theorem chartMetricPairing_smooth (g : RiemannianMetric n M) (p : M) (u v : E) : |
| 35 | ContMDiffOn (𝓡 n) (𝓘(ℝ, ℝ)) ∞ |
| 36 | (fun x ↦ g.inner x (chartVectorField p u x) (chartVectorField p v x)) |
| 37 | (chartAt E p).source := by |
| 38 | have heval := g.contMDiff.contMDiffOn.clm_bundle_apply₂ |
| 39 | (chartVectorField_smooth p u) (chartVectorField_smooth p v) |
| 40 | intro x hx |
| 41 | exact (Bundle.contMDiffWithinAt_totalSpace.mp (heval x hx)).2 |
| 42 | |
| 43 | theorem squareChartMetric_space_pairing {J : Set ℝ} (F : RicciFlow n M J) |
| 44 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 45 | (p : M) (s : ℝ) (hs : s ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) |
| 46 | (y u v w : E) (hy : y ∈ (chartAt E p).target) : |
| 47 | fderiv ℝ (squareChartMetric F T p) (s, y) (0, w) u v = |
| 48 | mvfderiv (𝓡 n) |
| 49 | (fun x ↦ (F.metric (T - s ^ 2)).inner x |
| 50 | (chartVectorField p u x) (chartVectorField p v x)) ((chartAt E p).symm y) |
| 51 | (mfderiv (𝓡 n) (𝓡 n) (chartAt E p).symm y w) := by |
| 52 | let f : M → ℝ := fun x ↦ (F.metric (T - s ^ 2)).inner x |
| 53 | (chartVectorField p u x) (chartVectorField p v x) |
| 54 | have hf : MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) f ((chartAt E p).symm y) := |
| 55 | ((chartMetricPairing_smooth (F.metric (T - s ^ 2)) p u v).contMDiffAt |
| 56 | ((chartAt E p).open_source.mem_nhds ((chartAt E p).map_target hy))).mdifferentiableAt |
| 57 | (by simp) |
| 58 | have hchain := mvfderiv_chartVectorField p f y w hy hf |
| 59 | rw [chartVectorField_at_inverse p w y hy] at hchain |
| 60 | have heq : (fun z : E ↦ f ((chartAt E p).symm z)) =ᶠ[𝓝 y] |
| 61 | (fun z ↦ squareChartMetric F T p (s, z) u v) := by |
| 62 | filter_upwards [(chartAt E p).open_target.mem_nhds hy] with z hz |
| 63 | dsimp [f] |
| 64 | rw [chartVectorField_at_inverse p u z hz, chartVectorField_at_inverse p v z hz] |
| 65 | rfl |
| 66 | rw [heq.fderiv_eq] at hchain |
| 67 | have hG : DifferentiableAt ℝ (squareChartMetric F T p) (s, y) := |
| 68 | ((squareChartMetric_smooth F T b hb hwindow p).contDiffAt |
| 69 | ((isOpen_Ioo.prod (chartAt E p).open_target).mem_nhds ⟨hs, hy⟩)).differentiableAt |
| 70 | (by simp) |
| 71 | have hslice := hG.hasFDerivAt.comp y |
| 72 | ((hasFDerivAt_const s y).prodMk (hasFDerivAt_id y)) |
| 73 | have heval := (hslice.clm_apply (hasFDerivAt_const u y)).clm_apply |
| 74 | (hasFDerivAt_const v y) |
| 75 | have hcoord : fderiv ℝ (fun z ↦ squareChartMetric F T p (s, z) u v) y w = |
| 76 | fderiv ℝ (squareChartMetric F T p) (s, y) (0, w) u v := by |
| 77 | simpa [Function.comp_def] using congrArg (fun L : E →L[ℝ] ℝ ↦ L w) heval.fderiv |
| 78 | exact hcoord.symm.trans hchain.symm |
| 79 | |
| 80 | theorem squareChartMetric_time_pairing {J : Set ℝ} (F : RicciFlow n M J) |
| 81 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 82 | (p : M) (s : ℝ) (hs : s ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) |
| 83 | (y u v : E) (hy : y ∈ (chartAt E p).target) : |
| 84 | fderiv ℝ (squareChartMetric F T p) (s, y) (1, 0) u v = |
| 85 | 4 * s * (F.connection (T - s ^ 2)).ricci ((chartAt E p).symm y) |
| 86 | (mfderiv (𝓡 n) (𝓡 n) (chartAt E p).symm y u) |
| 87 | (mfderiv (𝓡 n) (𝓡 n) (chartAt E p).symm y v) := by |
| 88 | have hG : DifferentiableAt ℝ (squareChartMetric F T p) (s, y) := |
| 89 | ((squareChartMetric_smooth F T b hb hwindow p).contDiffAt |
| 90 | ((isOpen_Ioo.prod (chartAt E p).open_target).mem_nhds ⟨hs, hy⟩)).differentiableAt |
| 91 | (by simp) |
| 92 | have hslice := hG.hasFDerivAt.comp_hasDerivAt s |
| 93 | ((hasDerivAt_id s).prodMk (hasDerivAt_const s y)) |
| 94 | have heval := (hslice.clm_apply (hasDerivAt_const s u)).clm_apply (hasDerivAt_const s v) |
| 95 | have hmetric := squareChartMetric_hasDerivAt F T b hb hwindow p s hs y u v |
| 96 | simpa using heval.unique hmetric |
| 97 | |
| 98 | set_option backward.isDefEq.respectTransparency false in |
| 99 | theorem squareChartScalar_space_pairing {J : Set ℝ} (F : RicciFlow n M J) |
| 100 | (hM04 : RicciFlowCurvatureTheory.{u}) |
| 101 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 102 | (p : M) (s : ℝ) (hs : s ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) |
| 103 | (y w : E) (hy : y ∈ (chartAt E p).target) : |
| 104 | fderiv ℝ (squareChartScalar F T p) (s, y) (0, w) = |
| 105 | mvfderiv (𝓡 n) (fun x ↦ (F.connection (T - s ^ 2)).scalarCurvature x) |
| 106 | ((chartAt E p).symm y) (mfderiv (𝓡 n) (𝓡 n) (chartAt E p).symm y w) := by |
| 107 | have hf : ContMDiff (𝓡 n) (𝓘(ℝ, ℝ)) ∞ |
| 108 | (fun x : M ↦ (F.connection (T - s ^ 2)).scalarCurvature x) := by |
| 109 | have hbase : ContMDiff (𝓡 n) ((𝓘(ℝ, ℝ)).prod (𝓡 n)) ∞ |
| 110 | (fun x : M ↦ (s, x)) := contMDiff_const.prodMk contMDiff_id |
| 111 | have hbaseOn : ContMDiffOn (𝓡 n) ((𝓘(ℝ, ℝ)).prod (𝓡 n)) ∞ |
| 112 | (fun x : M ↦ (s, x)) Set.univ := hbase.contMDiffOn |
| 113 | have h := (squareTime_scalar_smooth F hM04 T b hb hwindow).comp |
| 114 | hbaseOn (fun x _ ↦ ⟨hs, Set.mem_univ x⟩) |
| 115 | exact contMDiffOn_univ.mp h |
| 116 | have hchain := mvfderiv_chartVectorField p |
| 117 | (fun x ↦ (F.connection (T - s ^ 2)).scalarCurvature x) y w hy |
| 118 | ((hf _).mdifferentiableAt (by simp)) |
| 119 | rw [chartVectorField_at_inverse p w y hy] at hchain |
| 120 | have hR : DifferentiableAt ℝ (squareChartScalar F T p) (s, y) := |
| 121 | ((squareChartScalar_smooth F hM04 T b hb hwindow p).contDiffAt |
| 122 | ((isOpen_Ioo.prod (chartAt E p).open_target).mem_nhds ⟨hs, hy⟩)).differentiableAt |
| 123 | (by simp) |
| 124 | have hslice := hR.hasFDerivAt.comp y |
| 125 | ((hasFDerivAt_const s y).prodMk (hasFDerivAt_id y)) |
| 126 | have hcoord : fderiv ℝ (fun z ↦ squareChartScalar F T p (s, z)) y w = |
| 127 | fderiv ℝ (squareChartScalar F T p) (s, y) (0, w) := by |
| 128 | simpa [Function.comp_def] using congrArg (fun L : E →L[ℝ] ℝ ↦ L w) hslice.fderiv |
| 129 | exact hcoord.symm.trans hchain.symm |
| 130 | |
| 131 | set_option backward.isDefEq.respectTransparency false in |
| 132 | theorem regularizedCoordinatePhase_geometric_pairing {J : Set ℝ} (F : RicciFlow n M J) |
| 133 | (hM04 : RicciFlowCurvatureTheory.{u}) |
| 134 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 135 | (p : M) (s : ℝ) (hs : s ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) |
| 136 | (y v w : E) (hy : y ∈ (chartAt E p).target) : |
| 137 | (F.metric (T - s ^ 2)).inner ((chartAt E p).symm y) |
| 138 | ((mfderiv (𝓡 n) (𝓡 n) (chartAt E p).symm y) |
| 139 | (regularizedCoordinatePhase (squareChartMetric F T p) (squareChartScalar F T p) |
| 140 | (s, (y, v))).2 + |
| 141 | (F.connection (T - s ^ 2)).connection (chartVectorField p v) ((chartAt E p).symm y) |
| 142 | (mfderiv (𝓡 n) (𝓡 n) (chartAt E p).symm y v)) |
| 143 | (mfderiv (𝓡 n) (𝓡 n) (chartAt E p).symm y w) - |
| 144 | 2 * s ^ 2 * mvfderiv (𝓡 n) (fun x ↦ (F.connection (T - s ^ 2)).scalarCurvature x) |
| 145 | ((chartAt E p).symm y) (mfderiv (𝓡 n) (𝓡 n) (chartAt E p).symm y w) + |
| 146 | 4 * s * (F.connection (T - s ^ 2)).ricci ((chartAt E p).symm y) |
| 147 | (mfderiv (𝓡 n) (𝓡 n) (chartAt E p).symm y v) |
| 148 | (mfderiv (𝓡 n) (𝓡 n) (chartAt E p).symm y w) = 0 := by |
| 149 | have hphase := regularizedCoordinatePhase_pairing |
| 150 | (squareChartMetric F T p) (squareChartScalar F T p) (s, y) |
| 151 | (fun a ha ↦ squareChartMetric_pos F T p (s, y) hy a ha) v w |
| 152 | rw [squareChartMetric_time_pairing F T b hb hwindow p s hs y v w hy, |
| 153 | squareChartScalar_space_pairing F hM04 T b hb hwindow p s hs y w hy] at hphase |
| 154 | have hkoszul := chartVectorField_diagonal_koszul |
| 155 | (F.connection (T - s ^ 2)) p v w ((chartAt E p).symm y) ((chartAt E p).map_target hy) |
| 156 | rw [chartVectorField_at_inverse p v y hy, chartVectorField_at_inverse p w y hy] at hkoszul |
| 157 | rw [← squareChartMetric_space_pairing F T b hb hwindow p s hs y v w v hy, |
| 158 | ← squareChartMetric_space_pairing F T b hb hwindow p s hs y v v w hy] at hkoszul |
| 159 | change (F.metric (T - s ^ 2)).inner ((chartAt E p).symm y) |
| 160 | ((mfderiv (𝓡 n) (𝓡 n) (chartAt E p).symm y) |
| 161 | (regularizedCoordinatePhase (squareChartMetric F T p) (squareChartScalar F T p) |
| 162 | (s, (y, v))).2) |
| 163 | (mfderiv (𝓡 n) (𝓡 n) (chartAt E p).symm y w) = _ at hphase |
| 164 | rw [map_add, ContinuousLinearMap.add_apply] |
| 165 | linarith |
| 166 | |
| 167 | end PoincareMT.ReducedLength |