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.Volume.Surgery.Measure.Distance.BarrierLipschitz |
| 2 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus |
| 3 | |
| 4 | /-! |
| 5 | Adapted from Mapher `PoincareMT/Proofs/M10/SupportIntegral.lean` at |
| 6 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. |
| 7 | |
| 8 | # Integrating a continuous upper bound for contact derivatives |
| 9 | |
| 10 | The supported function need not be differentiable. Touching upper supports |
| 11 | bound its right slopes, and the one-dimensional comparison theorem applies |
| 12 | to the antiderivative of the continuous bound. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set Filter MeasureTheory |
| 18 | open scoped Topology |
| 19 | |
| 20 | namespace PoincareMT.SurgeryVolume.Measure |
| 21 | |
| 22 | /-- A differentiable comparison function bounds a function with touching upper supports. -/ |
| 23 | theorem image_le_of_upper_supports {f B B' : ℝ → ℝ} {a b : ℝ} |
| 24 | (hf : ContinuousOn f (Icc a b)) (hB : ContinuousOn B (Icc a b)) |
| 25 | (hB' : ∀ x ∈ Ico a b, HasDerivAt B (B' x) x) |
| 26 | (ha : f a ≤ B a) |
| 27 | (hsupport : ∀ x ∈ Ico a b, ∃ g : ℝ → ℝ, ∃ d : ℝ, |
| 28 | HasDerivAt g d x ∧ g x = f x ∧ |
| 29 | (∀ᶠ y in 𝓝 x, f y ≤ g y) ∧ d ≤ B' x) : |
| 30 | ∀ x ∈ Icc a b, f x ≤ B x := by |
| 31 | apply image_le_of_liminf_slope_right_le_deriv_boundary hf ha hB |
| 32 | (fun x hx ↦ (hB' x hx).hasDerivWithinAt) |
| 33 | intro x hx r hr |
| 34 | obtain ⟨g, d, hd, heq, hdom, hbound⟩ := hsupport x hx |
| 35 | exact frequently_slope_lt_of_upper_support hd heq hdom (hbound.trans_lt hr) |
| 36 | |
| 37 | /-- Continuous contact-derivative bounds can be integrated over an ordered interval. -/ |
| 38 | theorem sub_le_integral_of_upper_supports {f h : ℝ → ℝ} {a b : ℝ} |
| 39 | (hab : a ≤ b) (hf : ContinuousOn f (Icc a b)) (hh : Continuous h) |
| 40 | (hsupport : ∀ x ∈ Ico a b, ∃ g : ℝ → ℝ, ∃ d : ℝ, |
| 41 | HasDerivAt g d x ∧ g x = f x ∧ |
| 42 | (∀ᶠ y in 𝓝 x, f y ≤ g y) ∧ d ≤ h x) : |
| 43 | f b - f a ≤ ∫ x in a..b, h x := by |
| 44 | let B : ℝ → ℝ := fun t ↦ f a + ∫ x in a..t, h x |
| 45 | have hB : ∀ t, HasDerivAt B (h t) t := fun t ↦ |
| 46 | (intervalIntegral.integral_hasDerivAt_right (hh.intervalIntegrable a t) |
| 47 | hh.aestronglyMeasurable.stronglyMeasurableAtFilter hh.continuousAt).const_add _ |
| 48 | have hBa : f a ≤ B a := by simp [B] |
| 49 | have hcomp := image_le_of_upper_supports hf |
| 50 | (fun t _ ↦ (hB t).continuousAt.continuousWithinAt) (fun t _ ↦ hB t) hBa hsupport |
| 51 | b ⟨hab, le_rfl⟩ |
| 52 | exact sub_le_iff_le_add.mpr (by simpa only [B, add_comm] using hcomp) |
| 53 | |
| 54 | end PoincareMT.SurgeryVolume.Measure |