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 | import Mathlib.Topology.MetricSpace.Bounded |
| 3 | import Mathlib.Algebra.Order.Floor.Ring |
| 4 | import Mathlib.Tactic |
| 5 | |
| 6 | /-! |
| 7 | # Integrating over metric shells |
| 8 | |
| 9 | Countable shell estimates for nonnegative measurable functions. These supply |
| 10 | the measure-theoretic step in Gaussian moment estimates. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set MeasureTheory Function |
| 16 | open scoped ENNReal |
| 17 | |
| 18 | namespace Poincare.MeasureTheory.GaussianMoment |
| 19 | |
| 20 | variable {X : Type*} [MetricSpace X] [MeasurableSpace X] [BorelSpace X] |
| 21 | |
| 22 | /-- The half-open shell with inner radius `j * r`. -/ |
| 23 | def shell (x : X) (r : ℝ) (j : ℕ) : Set X := |
| 24 | {y | (j : ℝ) * r ≤ dist x y ∧ dist x y < ((j : ℝ) + 1) * r} |
| 25 | |
| 26 | theorem measurableSet_shell (x : X) (r : ℝ) (j : ℕ) : |
| 27 | MeasurableSet (shell x r j) := |
| 28 | (measurableSet_le measurable_const (continuous_const.dist continuous_id).measurable).inter |
| 29 | (measurableSet_lt (continuous_const.dist continuous_id).measurable measurable_const) |
| 30 | |
| 31 | omit [MeasurableSpace X] [BorelSpace X] in |
| 32 | theorem shell_subset_ball (x : X) (r : ℝ) (j : ℕ) : |
| 33 | shell x r j ⊆ Metric.ball x (((j : ℝ) + 1) * r) := by |
| 34 | intro y hy |
| 35 | simpa only [Metric.mem_ball, dist_comm] using hy.2 |
| 36 | |
| 37 | omit [MeasurableSpace X] [BorelSpace X] in |
| 38 | theorem iUnion_shell (x : X) {r : ℝ} (hr : 0 < r) : |
| 39 | ⋃ j : ℕ, shell x r j = univ := by |
| 40 | apply eq_univ_of_forall |
| 41 | intro y |
| 42 | refine mem_iUnion.mpr ⟨⌊dist x y / r⌋₊, ?_⟩ |
| 43 | constructor |
| 44 | · exact (le_div_iff₀ hr).mp (Nat.floor_le (div_nonneg dist_nonneg hr.le)) |
| 45 | · exact (div_lt_iff₀ hr).mp (Nat.lt_floor_add_one (dist x y / r)) |
| 46 | |
| 47 | omit [MeasurableSpace X] [BorelSpace X] in |
| 48 | theorem pairwiseDisjoint_shell (x : X) {r : ℝ} (hr : 0 < r) : |
| 49 | Pairwise (Disjoint on shell x r) := by |
| 50 | intro i j hij |
| 51 | apply disjoint_left.mpr |
| 52 | intro y hi hj |
| 53 | rcases lt_or_gt_of_ne hij with hij | hji |
| 54 | · have h : (i : ℝ) + 1 ≤ j := by exact_mod_cast hij |
| 55 | exact (not_lt_of_ge (hj.1.trans' (mul_le_mul_of_nonneg_right h hr.le))) hi.2 |
| 56 | · have h : (j : ℝ) + 1 ≤ i := by exact_mod_cast hji |
| 57 | exact (not_lt_of_ge (hi.1.trans' (mul_le_mul_of_nonneg_right h hr.le))) hj.2 |
| 58 | |
| 59 | /-- Summable integral majorants on shells imply global integrability and the |
| 60 | corresponding bound for the integral of the norm. -/ |
| 61 | theorem integrable_of_shell_bounds (μ : Measure X) (x : X) {r : ℝ} (hr : 0 < r) |
| 62 | {f : X → ℝ} (hf : AEStronglyMeasurable f μ) (K D : ℕ → ℝ) |
| 63 | (hfinite : ∀ j, μ (shell x r j) < ⊤) |
| 64 | (hbound : ∀ j, ∀ y ∈ shell x r j, ‖f y‖ ≤ K j) |
| 65 | (hKD : ∀ j, K j * μ.real (shell x r j) ≤ D j) |
| 66 | (hD : Summable D) : |
| 67 | Integrable f μ ∧ (∫ y, ‖f y‖ ∂μ) ≤ ∑' j, D j := by |
| 68 | have hi : ∀ j, IntegrableOn f (shell x r j) μ := by |
| 69 | intro j |
| 70 | apply IntegrableOn.of_bound (hfinite j) hf.restrict (K j) |
| 71 | exact (ae_restrict_iff' (measurableSet_shell x r j)).mpr |
| 72 | (Filter.Eventually.of_forall (hbound j)) |
| 73 | have hle : ∀ j, (∫ y in shell x r j, ‖f y‖ ∂μ) ≤ D j := by |
| 74 | intro j |
| 75 | calc |
| 76 | (∫ y in shell x r j, ‖f y‖ ∂μ) = |
| 77 | ‖∫ y in shell x r j, ‖f y‖ ∂μ‖ := |
| 78 | (Real.norm_of_nonneg (integral_nonneg (fun _ ↦ norm_nonneg _))).symm |
| 79 | _ ≤ K j * μ.real (shell x r j) := |
| 80 | norm_setIntegral_le_of_norm_le_const (hfinite j) |
| 81 | (fun y hy ↦ by simpa only [norm_norm] using hbound j y hy) |
| 82 | _ ≤ D j := hKD j |
| 83 | have hs : Summable (fun j ↦ ∫ y in shell x r j, ‖f y‖ ∂μ) := |
| 84 | hD.of_nonneg_of_le (fun _ ↦ integral_nonneg (fun _ ↦ norm_nonneg _)) hle |
| 85 | have hint := integrableOn_iUnion_of_summable_integral_norm hi hs |
| 86 | rw [iUnion_shell x hr, integrableOn_univ] at hint |
| 87 | refine ⟨hint, ?_⟩ |
| 88 | have heq := integral_iUnion (measurableSet_shell x r) |
| 89 | (pairwiseDisjoint_shell x hr) hint.norm.integrableOn |
| 90 | rw [iUnion_shell x hr, setIntegral_univ] at heq |
| 91 | rw [heq] |
| 92 | exact hs.tsum_le_tsum hle hD |
| 93 | |
| 94 | end Poincare.MeasureTheory.GaussianMoment |