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.Tactic.Linarith |
| 3 | |
| 4 | /-! |
| 5 | # Passing an integrated inequality through a one-sided approximation |
| 6 | |
| 7 | The real-analysis limit used in the 2015 Morgan--Tian correction, Lemma 0.4, |
| 8 | pp. 7-8, with the integral-before-limit repair recorded in |
| 9 | `reviews/errata/2026-09-14-m62-curve-evolution.md`. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Filter MeasureTheory Set |
| 15 | open scoped Topology intervalIntegral |
| 16 | |
| 17 | namespace intervalIntegral |
| 18 | |
| 19 | /-- A one-sided error of size `epsilon * L` vanishes after integrating the |
| 20 | differential inequality. This is the limit step in corrected Lemma 0.4, |
| 21 | pp. 7-8; no derivative of the limiting function is asserted. -/ |
| 22 | theorem sub_le_integral_of_nonneg_approximation |
| 23 | {T L : ℝ → ℝ} {R : ℝ → ℝ → ℝ} {A B a b : ℝ} (hA : 0 ≤ A) |
| 24 | (hT : ContinuousOn T (Icc a b)) (hL : ContinuousOn L (Icc a b)) |
| 25 | (hR : ∀ ε : ℝ, 0 < ε → ContinuousOn (R ε) (Icc a b)) |
| 26 | (herror : ∀ ε : ℝ, 0 < ε → ∀ r ∈ Icc a b, |
| 27 | 0 ≤ R ε r - T r ∧ R ε r - T r ≤ ε * L r) |
| 28 | (hbound : ∀ ε : ℝ, 0 < ε → ∀ s t : ℝ, |
| 29 | s ∈ Icc a b → t ∈ Icc a b → s ≤ t → |
| 30 | R ε t - R ε s ≤ ∫ r in s..t, A * R ε r + B * L r) |
| 31 | {s t : ℝ} (hs : s ∈ Icc a b) (ht : t ∈ Icc a b) (hst : s ≤ t) : |
| 32 | T t - T s ≤ ∫ r in s..t, A * T r + B * L r := by |
| 33 | have hsub : Icc s t ⊆ Icc a b := Icc_subset_Icc hs.1 ht.2 |
| 34 | have hTi : IntervalIntegrable T volume s t := |
| 35 | (hT.mono (by simpa only [uIcc_of_le hst] using hsub)).intervalIntegrable |
| 36 | have hLi : IntervalIntegrable L volume s t := |
| 37 | (hL.mono (by simpa only [uIcc_of_le hst] using hsub)).intervalIntegrable |
| 38 | let I : ℝ := ∫ r in s..t, A * T r + B * L r |
| 39 | let C : ℝ := L s + A * ∫ r in s..t, L r |
| 40 | have happrox (ε : ℝ) (hε : 0 < ε) : T t - T s ≤ I + ε * C := by |
| 41 | have hRi : IntervalIntegrable (R ε) volume s t := |
| 42 | ((hR ε hε).mono (by simpa only [uIcc_of_le hst] using hsub)).intervalIntegrable |
| 43 | have hi : (∫ r in s..t, A * R ε r + B * L r) ≤ |
| 44 | I + (A * ε) * ∫ r in s..t, L r := by |
| 45 | calc |
| 46 | _ ≤ ∫ r in s..t, (A * T r + B * L r) + (A * ε) * L r := by |
| 47 | apply integral_mono_on hst ((hRi.const_mul A).add (hLi.const_mul B)) |
| 48 | (((hTi.const_mul A).add (hLi.const_mul B)).add (hLi.const_mul (A * ε))) |
| 49 | intro r hr |
| 50 | have he := mul_le_mul_of_nonneg_left (herror ε hε r (hsub hr)).2 hA |
| 51 | nlinarith |
| 52 | _ = I + (A * ε) * ∫ r in s..t, L r := by |
| 53 | rw [integral_add ((hTi.const_mul A).add (hLi.const_mul B)) |
| 54 | (hLi.const_mul (A * ε)), integral_const_mul] |
| 55 | have hb := hbound ε hε s t hs ht hst |
| 56 | have he_s := (herror ε hε s hs).2 |
| 57 | have he_t := (herror ε hε t ht).1 |
| 58 | dsimp only [C] |
| 59 | nlinarith |
| 60 | have hlim : Tendsto (fun ε : ℝ ↦ I + ε * C) (𝓝[>] 0) (𝓝 I) := by |
| 61 | have hlim0 : Tendsto (fun ε : ℝ ↦ I + ε * C) (𝓝 0) (𝓝 (I + 0 * C)) := |
| 62 | tendsto_const_nhds.add (tendsto_id.mul tendsto_const_nhds) |
| 63 | have hlim' : Tendsto (fun ε : ℝ ↦ I + ε * C) (𝓝[>] 0) (𝓝 (I + 0 * C)) := |
| 64 | hlim0.mono_left inf_le_left |
| 65 | simpa only [zero_mul, add_zero] using hlim' |
| 66 | apply le_of_tendsto_of_tendsto tendsto_const_nhds hlim |
| 67 | filter_upwards [self_mem_nhdsWithin] with ε hε |
| 68 | exact happrox ε hε |
| 69 | |
| 70 | end intervalIntegral |