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.Basic |
| 2 | import Mathlib.Tactic |
| 3 | |
| 4 | /-! |
| 5 | # Action error confined to a shrinking join interval |
| 6 | -/ |
| 7 | |
| 8 | set_option autoImplicit false |
| 9 | |
| 10 | open scoped intervalIntegral |
| 11 | |
| 12 | namespace PoincareMT.ReducedLength |
| 13 | |
| 14 | theorem integral_join_error_bound (f g h : ℝ → ℝ) (a b c d C : ℝ) |
| 15 | (hd : 0 < d) (hac : a ≤ c - d) (hcb : c + d ≤ b) |
| 16 | (hf : IntervalIntegrable f MeasureTheory.volume a b) |
| 17 | (hg : IntervalIntegrable g MeasureTheory.volume a b) |
| 18 | (hh : IntervalIntegrable h MeasureTheory.volume a b) |
| 19 | (hleft : Set.EqOn h f (Set.Ioo a (c - d))) |
| 20 | (hright : Set.EqOn h g (Set.Ioo (c + d) b)) |
| 21 | (hbound : ∀ s ∈ Set.Icc (c - d) (c + d), |f s| ≤ C ∧ |g s| ≤ C ∧ |h s| ≤ C) : |
| 22 | |(∫ s in a..b, h s) - ((∫ s in a..c, f s) + ∫ s in c..b, g s)| ≤ 4 * C * d := by |
| 23 | have hab : a ≤ b := by linarith |
| 24 | have ha : a ∈ Set.Icc a b := ⟨le_rfl, hab⟩ |
| 25 | have hb : b ∈ Set.Icc a b := ⟨hab, le_rfl⟩ |
| 26 | have hc : c ∈ Set.Icc a b := ⟨by linarith, by linarith⟩ |
| 27 | have hl : c - d ∈ Set.Icc a b := ⟨hac, by linarith⟩ |
| 28 | have hr : c + d ∈ Set.Icc a b := ⟨by linarith, hcb⟩ |
| 29 | have mono (k : ℝ → ℝ) (hk : IntervalIntegrable k MeasureTheory.volume a b) |
| 30 | (x y : ℝ) (hx : x ∈ Set.Icc a b) (hy : y ∈ Set.Icc a b) : |
| 31 | IntervalIntegrable k MeasureTheory.volume x y := by |
| 32 | exact hk.mono_set (Set.uIcc_subset_uIcc |
| 33 | (by simpa only [Set.uIcc_of_le hab] using hx) |
| 34 | (by simpa only [Set.uIcc_of_le hab] using hy)) |
| 35 | have hL : (∫ s in a..c - d, h s) = ∫ s in a..c - d, f s := |
| 36 | intervalIntegral.integral_congr_Ioo_of_le hac hleft |
| 37 | have hR : (∫ s in c + d..b, h s) = ∫ s in c + d..b, g s := |
| 38 | intervalIntegral.integral_congr_Ioo_of_le hcb hright |
| 39 | have hsplit := intervalIntegral.integral_add_adjacent_intervals |
| 40 | (mono h hh a c ha hc) (mono h hh c b hc hb) |
| 41 | have hsplitL := intervalIntegral.integral_add_adjacent_intervals |
| 42 | (mono h hh a (c - d) ha hl) (mono h hh (c - d) c hl hc) |
| 43 | have hsplitR := intervalIntegral.integral_add_adjacent_intervals |
| 44 | (mono h hh c (c + d) hc hr) (mono h hh (c + d) b hr hb) |
| 45 | have fsplit := intervalIntegral.integral_add_adjacent_intervals |
| 46 | (mono f hf a (c - d) ha hl) (mono f hf (c - d) c hl hc) |
| 47 | have gsplit := intervalIntegral.integral_add_adjacent_intervals |
| 48 | (mono g hg c (c + d) hc hr) (mono g hg (c + d) b hr hb) |
| 49 | have heq : (∫ s in a..b, h s) - ((∫ s in a..c, f s) + ∫ s in c..b, g s) = |
| 50 | (∫ s in c - d..c, h s - f s) + ∫ s in c..c + d, h s - g s := by |
| 51 | rw [intervalIntegral.integral_sub (mono h hh (c - d) c hl hc) (mono f hf (c - d) c hl hc), |
| 52 | intervalIntegral.integral_sub (mono h hh c (c + d) hc hr) (mono g hg c (c + d) hc hr)] |
| 53 | linarith |
| 54 | have hboundL : ‖∫ s in c - d..c, h s - f s‖ ≤ 2 * C * d := by |
| 55 | have h := intervalIntegral.norm_integral_le_of_norm_le_const |
| 56 | (a := c - d) (b := c) (C := 2 * C) (f := fun s ↦ h s - f s) (by |
| 57 | intro s hs |
| 58 | have hs' : s ∈ Set.Ioc (c - d) c := by |
| 59 | simpa only [Set.uIoc_of_le (by linarith : c - d ≤ c)] using hs |
| 60 | have hm : s ∈ Set.Icc (c - d) (c + d) := ⟨hs'.1.le, by linarith [hs'.2]⟩ |
| 61 | simpa only [Real.norm_eq_abs] using (norm_sub_le (h s) (f s)).trans |
| 62 | (by simpa only [Real.norm_eq_abs, ← two_mul] using |
| 63 | add_le_add (hbound s hm).2.2 (hbound s hm).1)) |
| 64 | simpa only [sub_sub_cancel, abs_of_pos hd] using h |
| 65 | have hboundR : ‖∫ s in c..c + d, h s - g s‖ ≤ 2 * C * d := by |
| 66 | have h := intervalIntegral.norm_integral_le_of_norm_le_const |
| 67 | (a := c) (b := c + d) (C := 2 * C) (f := fun s ↦ h s - g s) (by |
| 68 | intro s hs |
| 69 | have hs' : s ∈ Set.Ioc c (c + d) := by |
| 70 | simpa only [Set.uIoc_of_le (by linarith : c ≤ c + d)] using hs |
| 71 | have hm : s ∈ Set.Icc (c - d) (c + d) := ⟨by linarith [hs'.1], hs'.2⟩ |
| 72 | simpa only [Real.norm_eq_abs] using (norm_sub_le (h s) (g s)).trans |
| 73 | (by simpa only [Real.norm_eq_abs, ← two_mul] using |
| 74 | add_le_add (hbound s hm).2.2 (hbound s hm).2.1)) |
| 75 | simpa only [add_sub_cancel_left, abs_of_pos hd] using h |
| 76 | rw [heq, ← Real.norm_eq_abs] |
| 77 | exact (norm_add_le _ _).trans (by linarith) |
| 78 | |
| 79 | end PoincareMT.ReducedLength |