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 Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 3 | import Mathlib.Analysis.Calculus.Deriv.Mul |
| 4 | import Mathlib.Analysis.Calculus.Deriv.Slope |
| 5 | import Mathlib.Analysis.Calculus.Deriv.Inv |
| 6 | import Mathlib.Analysis.Calculus.Deriv.Pow |
| 7 | |
| 8 | /-! |
| 9 | # The signed scalar comparison on a finite radial interval |
| 10 | |
| 11 | Adapted from AxelWorkspace revision |
| 12 | `f1cdb30cabdc8781d2d3dec86d3d99ab1820f30e`, |
| 13 | `MorganTianLib/Ch02/BusemannSplitting/WeakBusemann/RadialIntegration/FiniteInterval.lean`. |
| 14 | See `references/analysis/axel-workspace/busemann-reuse.md`. |
| 15 | |
| 16 | The terminal value is retained with its sign. For nonnegative tests and |
| 17 | nonnegative terminal density, it can only improve Laplacian comparison. |
| 18 | Reference: Morgan--Tian, Proposition 2.3, pp. 21--23. |
| 19 | -/ |
| 20 | |
| 21 | open Set Filter MeasureTheory |
| 22 | open scoped Topology |
| 23 | |
| 24 | noncomputable section |
| 25 | |
| 26 | namespace Poincare.Analysis.RadialIntegration |
| 27 | |
| 28 | /-- Differentiating an antitone density-to-power ratio gives its logarithmic |
| 29 | derivative bound. -/ |
| 30 | theorem deriv_le_of_antitone_density_ratio {f : ℝ → ℝ} {t b : ℝ} {k : ℕ} |
| 31 | (ht : t ∈ Ioo (0 : ℝ) b) (hk : 0 < k) (hf : DifferentiableAt ℝ f t) |
| 32 | (hanti : AntitoneOn (fun s => f s / s ^ k) (Ioo (0 : ℝ) b)) : |
| 33 | deriv f t ≤ (k : ℝ) / t * f t := by |
| 34 | have hd := hf.hasDerivAt.div ((hasDerivAt_id t).pow k) (pow_ne_zero _ ht.1.ne') |
| 35 | change HasDerivAt (fun s => f s / s ^ k) |
| 36 | ((deriv f t * t ^ k - f t * ((k : ℝ) * t ^ (k - 1) * 1)) / (t ^ k) ^ 2) t at hd |
| 37 | have hnonpos := hanti.derivWithin_nonpos (x := t) |
| 38 | rw [derivWithin_of_isOpen isOpen_Ioo ht, hd.deriv] at hnonpos |
| 39 | have hn : deriv f t * t ^ k - f t * ((k : ℝ) * t ^ (k - 1)) ≤ 0 := by |
| 40 | simpa only [mul_one, zero_mul] using (div_le_iff₀ (sq_pos_of_pos |
| 41 | (pow_pos ht.1 k))).1 hnonpos |
| 42 | have hp : t ^ k = t ^ (k - 1) * t := by |
| 43 | conv_lhs => rw [show k = (k - 1) + 1 by omega] |
| 44 | rw [pow_succ] |
| 45 | rw [hp] at hn |
| 46 | have hmul : deriv f t * t ≤ (k : ℝ) * f t := |
| 47 | (mul_le_mul_iff_left₀ (pow_pos ht.1 (k - 1))).1 (by nlinarith [hn]) |
| 48 | calc deriv f t ≤ ((k : ℝ) * f t) / t := (le_div_iff₀ ht.1).2 hmul |
| 49 | _ = (k : ℝ) / t * f t := by ring |
| 50 | |
| 51 | /-- **Math.** A continuous test times a bounded radial density is integrable; |
| 52 | continuity is needed only inside the integration interval for the density. -/ |
| 53 | theorem integrableOn_test_mul_bounded_density {f rho : ℝ → ℝ} {c B : ℝ} |
| 54 | (hf : ContinuousOn f (Icc (0 : ℝ) c)) |
| 55 | (hrho : ContinuousOn rho (Ioo (0 : ℝ) c)) |
| 56 | (hbound : ∀ t ∈ Ioo (0 : ℝ) c, ‖rho t‖ ≤ B) : |
| 57 | IntegrableOn (fun t => f t * rho t) (Ioo (0 : ℝ) c) := by |
| 58 | obtain ⟨P, hP⟩ := isCompact_Icc.exists_bound_of_continuousOn hf |
| 59 | apply IntegrableOn.of_bound (by simp : volume (Ioo (0 : ℝ) c) < ⊤) |
| 60 | ((hf.mono Ioo_subset_Icc_self).mul hrho |>.aestronglyMeasurable measurableSet_Ioo) |
| 61 | (max P 0 * max B 0) |
| 62 | filter_upwards [ae_restrict_mem measurableSet_Ioo] with t ht |
| 63 | change ‖f t * rho t‖ ≤ _ |
| 64 | rw [norm_mul] |
| 65 | exact mul_le_mul ((hP t (Ioo_subset_Icc_self ht)).trans (le_max_left _ _)) |
| 66 | ((hbound t ht).trans (le_max_left _ _)) (norm_nonneg _) (le_max_right _ _) |
| 67 | |
| 68 | /-- **Math.** Integrate a density derivative upper bound with the actual |
| 69 | finite terminal value retained. Both integrands' integrability is derived from |
| 70 | the polynomial density bound; no integrability of the density derivative is used. -/ |
| 71 | theorem finite_radial_integral_comparison |
| 72 | {f rho : ℝ → ℝ} {c C d : ℝ} {k : ℕ} |
| 73 | (hc : 0 < c) (hC : 0 ≤ C) (hk : 0 < k) |
| 74 | (hf : ContDiff ℝ 1 f) (hfpos : ∀ t ∈ Ioo (0 : ℝ) c, 0 ≤ f t) |
| 75 | (hrho : ∀ t ∈ Ioo (0 : ℝ) c, DifferentiableAt ℝ rho t) |
| 76 | (hbound : ∀ t ∈ Ioo (0 : ℝ) c, 0 ≤ rho t ∧ rho t ≤ C * t ^ k) |
| 77 | (hderiv : ∀ t ∈ Ioo (0 : ℝ) c, |
| 78 | deriv rho t ≤ (k : ℝ) / t * rho t) |
| 79 | (hzero : Tendsto rho (𝓝[>] (0 : ℝ)) (𝓝 0)) |
| 80 | (hterminal : Tendsto rho (𝓝[<] c) (𝓝 d)) : |
| 81 | IntegrableOn (fun t => rho t * deriv f t) (Ioo (0 : ℝ) c) ∧ |
| 82 | IntegrableOn (fun t => (k : ℝ) / t * f t * rho t) (Ioo (0 : ℝ) c) ∧ |
| 83 | -(∫ t in Ioo (0 : ℝ) c, rho t * deriv f t) ≤ |
| 84 | (∫ t in Ioo (0 : ℝ) c, (k : ℝ) / t * f t * rho t) - f c * d := by |
| 85 | have hrcont : ContinuousOn rho (Ioo (0 : ℝ) c) := |
| 86 | fun t ht => (hrho t ht).continuousAt.continuousWithinAt |
| 87 | have hrB : ∀ t ∈ Ioo (0 : ℝ) c, ‖rho t‖ ≤ C * c ^ k := by |
| 88 | intro t ht |
| 89 | rw [Real.norm_eq_abs, abs_of_nonneg (hbound t ht).1] |
| 90 | exact (hbound t ht).2.trans |
| 91 | (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ ht.1.le ht.2.le k) hC) |
| 92 | have hdivB : ∀ t ∈ Ioo (0 : ℝ) c, ‖rho t / t‖ ≤ C * c ^ (k - 1) := by |
| 93 | intro t ht |
| 94 | rw [Real.norm_eq_abs, abs_of_nonneg (div_nonneg (hbound t ht).1 ht.1.le)] |
| 95 | calc rho t / t ≤ C * t ^ k / t := |
| 96 | div_le_div_of_nonneg_right (hbound t ht).2 ht.1.le |
| 97 | _ = C * t ^ (k - 1) := by |
| 98 | conv_lhs => rw [show k = (k - 1) + 1 by omega, pow_succ] |
| 99 | field_simp [ht.1.ne'] |
| 100 | _ ≤ C * c ^ (k - 1) := |
| 101 | mul_le_mul_of_nonneg_left (pow_le_pow_left₀ ht.1.le ht.2.le _) hC |
| 102 | have hi1 := integrableOn_test_mul_bounded_density |
| 103 | (hf.continuous_deriv le_rfl).continuousOn hrcont hrB |
| 104 | have hi2 := integrableOn_test_mul_bounded_density |
| 105 | ((continuousOn_const : ContinuousOn (fun _ : ℝ => (k : ℝ)) (Icc 0 c)).mul |
| 106 | hf.continuous.continuousOn) |
| 107 | (hrcont.div continuousOn_id (fun t ht => ht.1.ne')) hdivB |
| 108 | have hi1' : IntegrableOn (fun t => rho t * deriv f t) (Ioo (0 : ℝ) c) := by |
| 109 | simpa only [mul_comm] using hi1 |
| 110 | have hi2' : IntegrableOn (fun t => (k : ℝ) / t * f t * rho t) |
| 111 | (Ioo (0 : ℝ) c) := by |
| 112 | convert hi2 using 1 |
| 113 | ext t |
| 114 | change (k : ℝ) / t * f t * rho t = ((k : ℝ) * f t) * (rho t / t) |
| 115 | ring |
| 116 | refine ⟨hi1', hi2', ?_⟩ |
| 117 | let F := Function.update (Function.update (fun t => f t * rho t) 0 0) c (f c * d) |
| 118 | have hFderiv : ∀ t ∈ Ioo (0 : ℝ) c, |
| 119 | HasDerivAt F (deriv f t * rho t + f t * deriv rho t) t := by |
| 120 | intro t ht |
| 121 | apply ((hf.differentiable (by norm_num) t).hasDerivAt.mul |
| 122 | (hrho t ht).hasDerivAt).congr_of_eventuallyEq |
| 123 | filter_upwards [Ioo_mem_nhds ht.1 ht.2] with s hs |
| 124 | simp only [F, Function.update_of_ne hs.2.ne, Function.update_of_ne hs.1.ne', Pi.mul_apply] |
| 125 | have hFcont : ContinuousOn F (Icc (0 : ℝ) c) := by |
| 126 | rw [continuousOn_update_iff, continuousOn_update_iff, Icc_sdiff_right, Ico_sdiff_left] |
| 127 | refine ⟨⟨fun t ht => ((hf.differentiable (by norm_num) t).hasDerivAt.mul |
| 128 | (hrho t ht).hasDerivAt).continuousAt.continuousWithinAt, ?_⟩, ?_⟩ |
| 129 | · intro _ |
| 130 | have hz := ((hf.continuous.tendsto (0 : ℝ)).mono_left nhdsWithin_le_nhds).mul hzero |
| 131 | simp only [mul_zero] at hz |
| 132 | exact hz.mono_left (nhdsWithin_mono _ Ioo_subset_Ioi_self) |
| 133 | · intro _ |
| 134 | have hz := ((hf.continuous.tendsto c).mono_left nhdsWithin_le_nhds).mul hterminal |
| 135 | refine (hz.congr' ?_).mono_left (nhdsWithin_mono _ Ico_subset_Iio_self) |
| 136 | filter_upwards [Ioo_mem_nhdsLT hc] with t ht |
| 137 | simp [ht.1.ne'] |
| 138 | have hsum : IntegrableOn (fun t => deriv f t * rho t + (k : ℝ) / t * f t * rho t) |
| 139 | (Icc (0 : ℝ) c) := (integrableOn_Icc_iff_integrableOn_Ioo (by finiteness) |
| 140 | (by finiteness)).2 (hi1.add hi2') |
| 141 | have h := intervalIntegral.sub_le_integral_of_hasDeriv_right_of_le hc.le hFcont |
| 142 | (fun t ht => (hFderiv t ht).hasDerivWithinAt) hsum (fun t ht => by |
| 143 | have hh := mul_le_mul_of_nonneg_left (hderiv t ht) (hfpos t ht) |
| 144 | nlinarith) |
| 145 | have hii1 := (intervalIntegrable_iff_integrableOn_Ioo_of_le hc.le).2 hi1 |
| 146 | have hii2 := (intervalIntegrable_iff_integrableOn_Ioo_of_le hc.le).2 hi2' |
| 147 | rw [intervalIntegral.integral_add hii1 hii2, |
| 148 | intervalIntegral.integral_of_le hc.le, integral_Ioc_eq_integral_Ioo, |
| 149 | intervalIntegral.integral_of_le hc.le, integral_Ioc_eq_integral_Ioo] at h |
| 150 | simp [F, hc.ne] at h |
| 151 | have heq : (∫ t in Ioo (0 : ℝ) c, deriv f t * rho t) = |
| 152 | ∫ t in Ioo (0 : ℝ) c, rho t * deriv f t := by congr 1; ext t; ring |
| 153 | rw [heq] at h |
| 154 | linarith |
| 155 | |
| 156 | /-- A continuous nonnegative radial Jacobian, antitone before its terminal |
| 157 | radius, gives the signed radial comparison without any integrability input. |
| 158 | The finite terminal term has the favorable sign even when it is nonzero. -/ |
| 159 | theorem radial_integral_comparison_of_antitone |
| 160 | {f H : ℝ → ℝ} {c : ℝ} {k : ℕ} (hc : 0 < c) (hk : 0 < k) |
| 161 | (hf : ContDiff ℝ 1 f) (hfpos : ∀ t ∈ Icc (0 : ℝ) c, 0 ≤ f t) |
| 162 | (hH : ContinuousOn H (Icc (0 : ℝ) c)) |
| 163 | (hdiff : ∀ t ∈ Ioo (0 : ℝ) c, DifferentiableAt ℝ H t) |
| 164 | (hpos : ∀ t ∈ Icc (0 : ℝ) c, 0 ≤ H t) |
| 165 | (hanti : AntitoneOn H (Ioo (0 : ℝ) c)) : |
| 166 | IntegrableOn (fun t => (t ^ k * H t) * deriv f t) (Ioo (0 : ℝ) c) ∧ |
| 167 | IntegrableOn (fun t => (k : ℝ) / t * f t * (t ^ k * H t)) (Ioo (0 : ℝ) c) ∧ |
| 168 | -(∫ t in Ioo (0 : ℝ) c, (t ^ k * H t) * deriv f t) ≤ |
| 169 | ∫ t in Ioo (0 : ℝ) c, (k : ℝ) / t * f t * (t ^ k * H t) := by |
| 170 | obtain ⟨C, hC⟩ := isCompact_Icc.exists_bound_of_continuousOn hH |
| 171 | let rho := fun t : ℝ => t ^ k * H t |
| 172 | have hrho : ContinuousOn rho (Icc (0 : ℝ) c) := |
| 173 | (continuousOn_id.pow k).mul hH |
| 174 | have hd (t : ℝ) (ht : t ∈ Ioo (0 : ℝ) c) : DifferentiableAt ℝ rho t := |
| 175 | (differentiableAt_id.pow k).mul (hdiff t ht) |
| 176 | have hbound (t : ℝ) (ht : t ∈ Ioo (0 : ℝ) c) : |
| 177 | 0 ≤ rho t ∧ rho t ≤ max C 0 * t ^ k := by |
| 178 | have ht' := Ioo_subset_Icc_self ht |
| 179 | have hHle : H t ≤ max C 0 := |
| 180 | (le_abs_self _).trans ((hC t ht').trans (le_max_left _ _)) |
| 181 | exact ⟨mul_nonneg (pow_nonneg ht.1.le k) (hpos t ht'), by |
| 182 | simpa only [rho, mul_comm] using |
| 183 | mul_le_mul_of_nonneg_right hHle (pow_nonneg ht.1.le k)⟩ |
| 184 | have hratio : AntitoneOn (fun t => rho t / t ^ k) (Ioo (0 : ℝ) c) := by |
| 185 | intro x hx y hy hxy |
| 186 | simpa only [rho, mul_div_cancel_left₀ _ (pow_ne_zero _ hx.1.ne'), |
| 187 | mul_div_cancel_left₀ _ (pow_ne_zero _ hy.1.ne')] using hanti hx hy hxy |
| 188 | have hz : Tendsto rho (𝓝[>] (0 : ℝ)) (𝓝 0) := by |
| 189 | have h := (hrho 0 ⟨le_rfl, hc.le⟩).mono_of_mem_nhdsWithin (Icc_mem_nhdsGT hc) |
| 190 | change Tendsto rho (𝓝[>] (0 : ℝ)) (𝓝 (rho 0)) at h |
| 191 | simpa only [rho, zero_pow hk.ne', zero_mul] using h |
| 192 | have hend : Tendsto rho (𝓝[<] c) (𝓝 (rho c)) := |
| 193 | (hrho c ⟨hc.le, le_rfl⟩).mono_of_mem_nhdsWithin (Icc_mem_nhdsLT hc) |
| 194 | obtain ⟨hi1, hi2, hineq⟩ := finite_radial_integral_comparison hc (le_max_right _ _) hk |
| 195 | hf (fun t ht => hfpos t (Ioo_subset_Icc_self ht)) hd hbound |
| 196 | (fun t ht => deriv_le_of_antitone_density_ratio ht hk (hd t ht) hratio) hz hend |
| 197 | refine ⟨hi1, hi2, hineq.trans ?_⟩ |
| 198 | exact sub_le_self _ (mul_nonneg (hfpos c ⟨hc.le, le_rfl⟩) |
| 199 | (mul_nonneg (pow_nonneg hc.le k) (hpos c ⟨hc.le, le_rfl⟩))) |
| 200 | |
| 201 | end Poincare.Analysis.RadialIntegration |