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.Function.LocallyIntegrable |
| 2 | import Mathlib.MeasureTheory.Integral.Bochner.Basic |
| 3 | import Mathlib.Topology.Algebra.Support |
| 4 | |
| 5 | /-! |
| 6 | # Compact-cutoff integral comparison |
| 7 | |
| 8 | Local continuity on an open set containing the compact cutoff support |
| 9 | supplies genuine integrability. Pointwise finite-sum inequalities on that |
| 10 | support can then be integrated against a nonnegative cutoff. The domain |
| 11 | is an arbitrary topological measurable space with open sets measurable; |
| 12 | the measure need only be finite on compact sets. This is used in |
| 13 | Morgan-Tian Section 12.5, pp. 309-319 and canonical-local-integral-energy.md. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set MeasureTheory |
| 19 | open scoped BigOperators |
| 20 | |
| 21 | namespace MeasureTheory |
| 22 | |
| 23 | variable {X : Type*} [TopologicalSpace X] [MeasurableSpace X] [OpensMeasurableSpace X] |
| 24 | {μ : Measure X} [IsFiniteMeasureOnCompacts μ] |
| 25 | {U : Set X} {w f : X → ℝ} |
| 26 | |
| 27 | /-- A continuous compact cutoff makes a locally continuous real field |
| 28 | integrable when its support lies in the true open domain |
| 29 | (Section 12.5, pp. 309-319). -/ |
| 30 | theorem integrable_cutoff_mul (hU : IsOpen U) (hw : ContinuousOn w U) |
| 31 | (hwc : HasCompactSupport w) (hwU : tsupport w ⊆ U) (hf : ContinuousOn f U) : |
| 32 | Integrable (fun x => w x * f x) μ := by |
| 33 | have hc : Continuous (fun x => w x * f x) := |
| 34 | (hw.mul hf).continuous_of_tsupport_subset hU |
| 35 | (tsupport_mul_subset_left.trans hwU) |
| 36 | exact hc.integrable_of_hasCompactSupport (hwc.mul_right (f' := f)) |
| 37 | |
| 38 | /-- A finite pointwise inequality on the cutoff support gives the same |
| 39 | integral inequality. No sign on the tested fields is required |
| 40 | (Section 12.5, pp. 309-319). -/ |
| 41 | theorem integral_cutoff_mul_finsetSum_le {I : Type*} (s : Finset I) |
| 42 | (hU : IsOpen U) (hw : ContinuousOn w U) (hwc : HasCompactSupport w) |
| 43 | (hwU : tsupport w ⊆ U) (hw0 : ∀ x ∈ tsupport w, 0 ≤ w x) |
| 44 | {q : I → X → ℝ} {g : X → ℝ} |
| 45 | (hq : ∀ i ∈ s, ContinuousOn (q i) U) (hg : ContinuousOn g U) |
| 46 | (hpoint : ∀ x ∈ tsupport w, (∑ i ∈ s, q i x) ≤ g x) : |
| 47 | (∑ i ∈ s, ∫ x, w x * q i x ∂μ) ≤ ∫ x, w x * g x ∂μ := by |
| 48 | have hqi (i : I) (hi : i ∈ s) : Integrable (fun x => w x * q i x) μ := |
| 49 | integrable_cutoff_mul hU hw hwc hwU (hq i hi) |
| 50 | rw [← integral_finsetSum _ hqi] |
| 51 | apply integral_mono (integrable_finsetSum _ hqi) |
| 52 | (integrable_cutoff_mul hU hw hwc hwU hg) |
| 53 | intro x |
| 54 | by_cases hx : x ∈ tsupport w |
| 55 | · simpa only [Finset.mul_sum] using |
| 56 | mul_le_mul_of_nonneg_left (hpoint x hx) (hw0 x hx) |
| 57 | · simp only [image_eq_zero_of_notMem_tsupport hx, zero_mul, Finset.sum_const_zero, le_refl] |
| 58 | |
| 59 | end MeasureTheory |