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.Bochner.Set |
| 2 | |
| 3 | /-! |
| 4 | # Nonnegative integrals on finite covers and cutoff plateaus |
| 5 | |
| 6 | Measurable finite covers bound a nonnegative integral by the sum of the |
| 7 | cover integrals. A cutoff equal to one on a tested set bounds its integral |
| 8 | by the global square-weighted integral. All integrability hypotheses are |
| 9 | explicit. These steps serve Morgan-Tian Section 12.5, pp. 309-319 and |
| 10 | actual-density-integrals.md. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set MeasureTheory |
| 16 | open scoped BigOperators |
| 17 | |
| 18 | namespace MeasureTheory |
| 19 | |
| 20 | /-- A measurable finite cover bounds the integral of a nonnegative field |
| 21 | by the sum of its integrals on the cover sets (Section 12.5, pp. 309-319). -/ |
| 22 | theorem setIntegral_le_finsetSum_of_cover |
| 23 | {X I : Type*} [MeasurableSpace X] {μ : Measure X} (s : Finset I) |
| 24 | {K : Set X} {Q : I → Set X} {f : X → ℝ} |
| 25 | (hK : MeasurableSet K) (hQ : ∀ i ∈ s, MeasurableSet (Q i)) |
| 26 | (hfK : IntegrableOn f K μ) (hfQ : ∀ i ∈ s, IntegrableOn f (Q i) μ) |
| 27 | (hf0 : ∀ x, 0 ≤ f x) (hcover : K ⊆ ⋃ i ∈ s, Q i) : |
| 28 | (∫ x in K, f x ∂μ) ≤ ∑ i ∈ s, ∫ x in Q i, f x ∂μ := by |
| 29 | classical |
| 30 | have hi (i : I) (hi : i ∈ s) : Integrable ((Q i).indicator f) μ := |
| 31 | (hfQ i hi).integrable_indicator (hQ i hi) |
| 32 | have h0 (i : I) (x : X) : 0 ≤ (Q i).indicator f x := by |
| 33 | by_cases hx : x ∈ Q i <;> simp [hx, hf0 x] |
| 34 | calc |
| 35 | (∫ x in K, f x ∂μ) = ∫ x, K.indicator f x ∂μ := (integral_indicator hK).symm |
| 36 | _ ≤ ∫ x, ∑ i ∈ s, (Q i).indicator f x ∂μ := by |
| 37 | apply integral_mono (hfK.integrable_indicator hK) (integrable_finsetSum _ hi) |
| 38 | intro x |
| 39 | by_cases hx : x ∈ K |
| 40 | · obtain ⟨i, hxi⟩ := mem_iUnion.mp (hcover hx) |
| 41 | obtain ⟨his, hxi⟩ := mem_iUnion.mp hxi |
| 42 | rw [indicator_of_mem hx] |
| 43 | calc |
| 44 | f x = (Q i).indicator f x := (indicator_of_mem hxi f).symm |
| 45 | _ ≤ ∑ j ∈ s, (Q j).indicator f x := Finset.single_le_sum (fun j _ => h0 j x) his |
| 46 | · rw [indicator_of_notMem hx] |
| 47 | exact Finset.sum_nonneg (fun i _ => h0 i x) |
| 48 | _ = ∑ i ∈ s, ∫ x, (Q i).indicator f x ∂μ := integral_finsetSum s hi |
| 49 | _ = ∑ i ∈ s, ∫ x in Q i, f x ∂μ := |
| 50 | Finset.sum_congr rfl (fun i hi => integral_indicator (hQ i hi)) |
| 51 | |
| 52 | /-- A cutoff plateau controls a set integral by the genuinely integrable |
| 53 | square-weighted global integral (Section 12.5, pp. 309-319). -/ |
| 54 | theorem setIntegral_le_cutoff_sq_integral |
| 55 | {X : Type*} [MeasurableSpace X] {μ : Measure X} |
| 56 | {Q : Set X} (hQ : MeasurableSet Q) {φ f : X → ℝ} |
| 57 | (hi : Integrable (fun x => φ x ^ 2 * f x) μ) |
| 58 | (hf0 : ∀ x, 0 ≤ f x) (hφ : ∀ x ∈ Q, φ x = 1) : |
| 59 | (∫ x in Q, f x ∂μ) ≤ ∫ x, φ x ^ 2 * f x ∂μ := by |
| 60 | calc |
| 61 | (∫ x in Q, f x ∂μ) = ∫ x in Q, φ x ^ 2 * f x ∂μ := by |
| 62 | apply setIntegral_congr_fun hQ |
| 63 | intro x hx |
| 64 | change f x = φ x ^ 2 * f x |
| 65 | rw [hφ x hx, one_pow, one_mul] |
| 66 | _ ≤ ∫ x, φ x ^ 2 * f x ∂μ := |
| 67 | setIntegral_le_integral hi (Filter.Eventually.of_forall (fun x => |
| 68 | mul_nonneg (sq_nonneg _) (hf0 x))) |
| 69 | |
| 70 | end MeasureTheory |