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.Positivity.Scalar.MovingBarrier |
| 2 | import PoincareLib.Analysis.Parabolic.Maximum.CompactSlab |
| 3 | |
| 4 | /-! Adapted from Mapher06/Poincare-MorganTian, `PoincareMT/Proofs/M04/LocalScalarBarrier.lean`, |
| 5 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. See the curvature import record under |
| 6 | `references/ricci-flow/mapher/curvature/`. -/ |
| 7 | |
| 8 | /-! |
| 9 | # Scalar barriers on a closed time slab |
| 10 | |
| 11 | The scalar operator is linear on smooth germs. The actual metric |
| 12 | coefficients construct a decay constant for the shifted expanding profile. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle |
| 18 | open Set Topology Filter |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.RicciFlowAnalysis |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 26 | |
| 27 | set_option maxHeartbeats 1000000 in |
| 28 | -- Expanding the Hessian difference and its metric trace needs extra elaboration. |
| 29 | set_option backward.isDefEq.respectTransparency false in |
| 30 | theorem laplacian_sub_of_contMDiffOn {g : RiemannianMetric n M} |
| 31 | (D : LeviCivitaData g) {U : Set M} (hU : IsOpen U) {f q : M → ℝ} |
| 32 | (hf : ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ f U) |
| 33 | (hq : ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ q U) {x : M} (hx : x ∈ U) : |
| 34 | D.laplacian (fun y ↦ f y - q y) x = D.laplacian f x - D.laplacian q x := by |
| 35 | have hfd {y : M} (hy : y ∈ U) : MDifferentiableAt (𝓡 n) 𝓘(ℝ, ℝ) f y := |
| 36 | (hf.contMDiffAt (hU.mem_nhds hy)).mdifferentiableAt (by simp) |
| 37 | have hqd {y : M} (hy : y ∈ U) : MDifferentiableAt (𝓡 n) 𝓘(ℝ, ℝ) q y := |
| 38 | (hq.contMDiffAt (hU.mem_nhds hy)).mdifferentiableAt (by simp) |
| 39 | have hH (a b : TangentSpace (𝓡 n) x) : |
| 40 | D.hessian (fun y ↦ f y - q y) x a b = D.hessian f x a b - D.hessian q x a b := by |
| 41 | let X := FiberBundle.extend (EuclideanSpace ℝ (Fin n)) a |
| 42 | let Y := FiberBundle.extend (EuclideanSpace ℝ (Fin n)) b |
| 43 | let df := fun y ↦ mvfderiv (𝓡 n) f y (Y y) |
| 44 | let dq := fun y ↦ mvfderiv (𝓡 n) q y (Y y) |
| 45 | have hdf : MDifferentiableAt (𝓡 n) 𝓘(ℝ, ℝ) df x := |
| 46 | (contMDiffAt_directional_derivative (hf.contMDiffAt (hU.mem_nhds hx)) |
| 47 | (FiberBundle.contMDiffAt_extend (k := ∞) (𝓡 n) |
| 48 | (EuclideanSpace ℝ (Fin n)) b)).mdifferentiableAt (by simp) |
| 49 | have hdq : MDifferentiableAt (𝓡 n) 𝓘(ℝ, ℝ) dq x := |
| 50 | (contMDiffAt_directional_derivative (hq.contMDiffAt (hU.mem_nhds hx)) |
| 51 | (FiberBundle.contMDiffAt_extend (k := ∞) (𝓡 n) |
| 52 | (EuclideanSpace ℝ (Fin n)) b)).mdifferentiableAt (by simp) |
| 53 | have heq : (fun y ↦ mvfderiv (𝓡 n) (fun z ↦ f z - q z) y (Y y)) =ᶠ[𝓝 x] |
| 54 | (fun y ↦ df y - dq y) := by |
| 55 | filter_upwards [hU.mem_nhds hx] with y hy |
| 56 | erw [mvfderiv_sub (hfd hy) (hqd hy)] |
| 57 | rfl |
| 58 | have he : mvfderiv (𝓡 n) (fun y ↦ mvfderiv (𝓡 n) (fun z ↦ f z - q z) y (Y y)) x = |
| 59 | mvfderiv (𝓡 n) (fun y ↦ df y - dq y) x := heq.mfderiv_eq |
| 60 | change mvfderiv (𝓡 n) |
| 61 | (fun y ↦ mvfderiv (𝓡 n) (fun z ↦ f z - q z) y (Y y)) x (X x) - |
| 62 | mvfderiv (𝓡 n) (fun z ↦ f z - q z) x (D.connection Y x (X x)) = |
| 63 | (mvfderiv (𝓡 n) df x (X x) - mvfderiv (𝓡 n) f x (D.connection Y x (X x))) - |
| 64 | (mvfderiv (𝓡 n) dq x (X x) - mvfderiv (𝓡 n) q x (D.connection Y x (X x))) |
| 65 | rw [he] |
| 66 | erw [mvfderiv_sub hdf hdq, mvfderiv_sub (hfd hx) (hqd hx)] |
| 67 | simp only [sub_apply] |
| 68 | ring |
| 69 | simp only [LeviCivitaData.laplacian, hH, Finset.sum_sub_distrib] |
| 70 | |
| 71 | set_option maxHeartbeats 1000000 in |
| 72 | -- The closed-time barrier estimates and spacetime regularity need extra elaboration. |
| 73 | set_option backward.isDefEq.respectTransparency false in |
| 74 | theorem exists_moving_scalar_barrier_decay_Icc [T2Space M] |
| 75 | {J : Set ℝ} (F : RicciFlow n M J) {a b : ℝ} (hJ : Icc a b ⊆ J) |
| 76 | {U : Set M} (hU : IsOpen U) {q : M → ℝ} |
| 77 | (hq : ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ q U) |
| 78 | {C : Set M} (hC : IsCompact C) (hCU : C ⊆ U) {speed : ℝ} |
| 79 | (hcritical : ∀ t ∈ Icc a b, ∀ x ∈ C, |
| 80 | q x + speed * (t - a) = 0 → mfderiv (𝓡 n) 𝓘(ℝ, ℝ) q x ≠ 0) : |
| 81 | ∃ A : ℝ, 0 < A ∧ ∀ epsilon : ℝ, 0 ≤ epsilon → ∀ t ∈ Icc a b, ∀ x ∈ C, |
| 82 | epsilon * Real.exp (-A * (t - a)) * |
| 83 | (-A * expNegInvGlue (q x + speed * (t - a)) + |
| 84 | speed * deriv expNegInvGlue (q x + speed * (t - a))) ≤ |
| 85 | (F.connection t).laplacian |
| 86 | (fun y ↦ epsilon * Real.exp (-A * (t - a)) * |
| 87 | expNegInvGlue (q y + speed * (t - a))) x := by |
| 88 | have hK : IsCompact (Icc a b ×ˢ C) := isCompact_Icc.prod hC |
| 89 | have hqP : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 90 | (fun p : ℝ × M ↦ q p.2) (Icc a b ×ˢ U) := |
| 91 | hq.comp contMDiffOn_snd (fun _ hp ↦ hp.2) |
| 92 | have hQ : ContinuousOn (fun p : ℝ × M ↦ q p.2 + speed * (p.1 - a)) |
| 93 | (Icc a b ×ˢ C) := |
| 94 | (hqP.continuousOn.mono (prod_mono Subset.rfl hCU)).add |
| 95 | (continuous_const.mul (continuous_fst.sub continuous_const)).continuousOn |
| 96 | have hL : ContinuousOn (fun p : ℝ × M ↦ (F.connection p.1).laplacian q p.2) |
| 97 | (Icc a b ×ˢ C) := |
| 98 | (continuousOn_flow_laplacian F hU hq).mono (prod_mono hJ hCU) |
| 99 | have hG : ContinuousOn (fun p : ℝ × M ↦ scalarGradientSq (F.metric p.1) q p.2) |
| 100 | (Icc a b ×ˢ C) := |
| 101 | (continuousOn_flow_scalarGradientSq F hU hq).mono (prod_mono hJ hCU) |
| 102 | have hGzero : ∀ p ∈ Icc a b ×ˢ C, |
| 103 | q p.2 + speed * (p.1 - a) = 0 → 0 < scalarGradientSq (F.metric p.1) q p.2 := by |
| 104 | intro p hp hz |
| 105 | exact (scalarGradientSq_pos_iff (F.metric p.1) q p.2).2 |
| 106 | (hcritical p.1 hp.1 p.2 hp.2 hz) |
| 107 | obtain ⟨A, hA, hbar⟩ := exists_exponential_barrier_decay (X := ℝ × M) |
| 108 | (q := fun p : ℝ × M ↦ q p.2 + speed * (p.1 - a)) |
| 109 | (L := fun p : ℝ × M ↦ (F.connection p.1).laplacian q p.2) |
| 110 | (G := fun p : ℝ × M ↦ scalarGradientSq (F.metric p.1) q p.2) |
| 111 | hK hQ hL hG hGzero speed |
| 112 | refine ⟨A, hA, ?_⟩ |
| 113 | intro epsilon hepsilon t ht x hx |
| 114 | have hc : 0 ≤ epsilon * Real.exp (-A * (t - a)) := |
| 115 | mul_nonneg hepsilon (Real.exp_pos _).le |
| 116 | have hineq := hbar (t, x) ⟨ht, hx⟩ |
| 117 | have hmul := mul_le_mul_of_nonneg_left hineq hc |
| 118 | rw [laplacian_moving_scalar_barrier (F.connection t) hU hq A speed epsilon |
| 119 | (t - a) (hCU hx)] |
| 120 | nlinarith [hmul] |
| 121 | |
| 122 | set_option maxHeartbeats 1000000 in |
| 123 | -- The compact-domain cutoff and moving-metric derivative bounds need extra elaboration. |
| 124 | set_option backward.isDefEq.respectTransparency false in |
| 125 | theorem ricciFlow_compactDomain_moving_barrier [T2Space M] |
| 126 | {J : Set ℝ} {a b : ℝ} (hab : a < b) (F : RicciFlow n M J) |
| 127 | (hJ : Icc a b ⊆ J) {U C : Set M} |
| 128 | (hU : IsOpen U) (hC : IsCompact C) (hCU : C ⊆ U) |
| 129 | {q : M → ℝ} (hq : ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ q U) {speed : ℝ} |
| 130 | (hcritical : ∀ t ∈ Icc a b, ∀ x ∈ C, |
| 131 | q x + speed * (t - a) = 0 → mfderiv (𝓡 n) 𝓘(ℝ, ℝ) q x ≠ 0) |
| 132 | (f v : ℝ → M → ℝ) |
| 133 | (hf : ContinuousOn (Function.uncurry f) (Icc a b ×ˢ C)) |
| 134 | (hderiv : ∀ t ∈ Icc a b, ∀ x ∈ C, |
| 135 | HasDerivWithinAt (fun s ↦ f s x) (v t x) (Icc a b) t) |
| 136 | (hsmooth : ∀ t ∈ Icc a b, ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ (f t) U) |
| 137 | (hnonneg : ∀ t ∈ Icc a b, ∀ x ∈ C, 0 ≤ f t x) |
| 138 | (hevol : ∀ t ∈ Ioc a b, ∀ x ∈ interior C, |
| 139 | (F.connection t).laplacian (f t) x ≤ v t x) |
| 140 | (hboundary : ∀ t ∈ Icc a b, ∀ x ∈ C \ interior C, |
| 141 | q x + speed * (t - a) ≤ 0) : |
| 142 | ∃ A : ℝ, 0 < A ∧ ∀ epsilon : ℝ, 0 ≤ epsilon → |
| 143 | (∀ x ∈ C, epsilon * expNegInvGlue (q x) ≤ f a x) → |
| 144 | ∀ t ∈ Icc a b, ∀ x ∈ C, |
| 145 | epsilon * Real.exp (-A * (t - a)) * |
| 146 | expNegInvGlue (q x + speed * (t - a)) ≤ f t x := by |
| 147 | obtain ⟨A, hA, hbar⟩ := exists_moving_scalar_barrier_decay_Icc F hJ hU hq hC hCU hcritical |
| 148 | refine ⟨A, hA, ?_⟩ |
| 149 | intro epsilon hepsilon hinit |
| 150 | let B : ℝ → M → ℝ := fun t x ↦ epsilon * Real.exp (-A * (t - a)) * |
| 151 | expNegInvGlue (q x + speed * (t - a)) |
| 152 | let Bd : ℝ → M → ℝ := fun t x ↦ epsilon * Real.exp (-A * (t - a)) * |
| 153 | (-A * expNegInvGlue (q x + speed * (t - a)) + |
| 154 | speed * deriv expNegInvGlue (q x + speed * (t - a))) |
| 155 | have hqC : ContinuousOn (fun p : ℝ × M ↦ q p.2) (Icc a b ×ˢ C) := |
| 156 | hq.continuousOn.comp continuous_snd.continuousOn (fun _ hp ↦ hCU hp.2) |
| 157 | have hBC : ContinuousOn (Function.uncurry B) (Icc a b ×ˢ C) := |
| 158 | (continuousOn_const.mul |
| 159 | ((continuous_const.mul (continuous_fst.sub continuous_const)).rexp.continuousOn)).mul |
| 160 | ((expNegInvGlue.contDiff (n := (⊤ : ℕ∞))).continuous.comp_continuousOn |
| 161 | (hqC.add (continuous_const.mul (continuous_fst.sub continuous_const)).continuousOn)) |
| 162 | have hBs (t : ℝ) : ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ (B t) U := |
| 163 | contMDiffOn_const.mul |
| 164 | (expNegInvGlue.contDiff.contMDiff.comp_contMDiffOn (hq.add contMDiffOn_const)) |
| 165 | have hBd (t : ℝ) (x : M) : |
| 166 | HasDerivAt (fun s ↦ B s x) (Bd t x) t := by |
| 167 | have h := (hasDerivAt_moving_scalar_barrier q A speed epsilon (t - a) x).comp t |
| 168 | ((hasDerivAt_id t).sub_const a) |
| 169 | simpa only [Function.comp_def, id_eq, mul_one] using h |
| 170 | have hwc : ContinuousOn (fun p : ℝ × M ↦ f p.1 p.2 - B p.1 p.2) |
| 171 | (Icc a b ×ˢ C) := hf.sub hBC |
| 172 | have hwd : ∀ t ∈ Icc a b, ∀ x ∈ C, |
| 173 | HasDerivWithinAt (fun s ↦ f s x - B s x) (v t x - Bd t x) (Icc a b) t := by |
| 174 | intro t ht x hx |
| 175 | exact (hderiv t ht x hx).sub (hBd t x).hasDerivWithinAt |
| 176 | have hwi : ∀ x ∈ C, 0 ≤ f a x - B a x := by |
| 177 | intro x hx |
| 178 | simpa only [B, sub_self, mul_zero, Real.exp_zero, mul_one, add_zero] using |
| 179 | sub_nonneg.mpr (hinit x hx) |
| 180 | have hws : ∀ t ∈ Icc a b, |
| 181 | ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun x ↦ f t x - B t x) U := by |
| 182 | intro t ht |
| 183 | exact (hsmooth t ht).sub (hBs t) |
| 184 | have hwb : ∀ t ∈ Icc a b, ∀ x ∈ C \ interior C, 0 ≤ f t x - B t x := by |
| 185 | intro t ht x hx |
| 186 | have hz := expNegInvGlue.zero_of_nonpos (hboundary t ht x hx) |
| 187 | simpa only [B, hz, mul_zero, sub_zero] using hnonneg t ht x hx.1 |
| 188 | have hwe : ∀ t ∈ Ioc a b, ∀ x ∈ interior C, |
| 189 | (F.connection t).laplacian (fun y ↦ f t y - B t y) x - |
| 190 | 0 * (f t x - B t x) ≤ v t x - Bd t x := by |
| 191 | intro t ht x hx |
| 192 | have ht' : t ∈ Icc a b := ⟨ht.1.le, ht.2⟩ |
| 193 | have hx' : x ∈ C := interior_subset hx |
| 194 | rw [laplacian_sub_of_contMDiffOn (F.connection t) hU (hsmooth t ht') |
| 195 | (hBs t) (hCU hx'), zero_mul, sub_zero] |
| 196 | have hb : Bd t x ≤ (F.connection t).laplacian (B t) x := |
| 197 | hbar epsilon hepsilon t ht' x hx' |
| 198 | linarith [hevol t ht x hx] |
| 199 | have hw := ricciFlow_compactDomain_supersolution_nonnegative_Icc |
| 200 | (K := 0) hab F hJ hU hC hCU (fun t x ↦ f t x - B t x) |
| 201 | (fun t x ↦ v t x - Bd t x) hwc hwd hwi hws hwb hwe |
| 202 | intro t ht x hx |
| 203 | exact sub_nonneg.mp (hw t ht x hx) |
| 204 | |
| 205 | end PoincareMT.RicciFlowAnalysis |
| 206 |