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.Geometry.Manifold.PartitionOfUnity |
| 2 | import Mathlib.MeasureTheory.Integral.Bochner.Set |
| 3 | |
| 4 | /-! # Local nonpositivity of an integral on smooth compact tests -/ |
| 5 | |
| 6 | noncomputable section |
| 7 | set_option autoImplicit false |
| 8 | |
| 9 | open Set Filter MeasureTheory |
| 10 | open scoped Manifold ContDiff Topology |
| 11 | |
| 12 | namespace Poincare.Analysis |
| 13 | |
| 14 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 15 | [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] |
| 16 | |
| 17 | /-- A local operator additive on smooth tests has a nonpositive integral on |
| 18 | every nonnegative compact test when this holds in a neighborhood of each point. |
| 19 | The same finite partition also proves integrability of the global pairing. -/ |
| 20 | theorem integrableOn_integral_nonpos_of_locally_test_nonpos |
| 21 | (μ : Measure E) {D : Set E} (A : (E → ℝ) → E → ℝ) |
| 22 | (hadd : ∀ f g : E → ℝ, ContDiff ℝ ∞ f → ContDiff ℝ ∞ g → |
| 23 | A (fun x => f x + g x) = fun x => A f x + A g x) |
| 24 | (hzero : ∀ f : E → ℝ, ContDiff ℝ ∞ f → ∀ x ∉ tsupport f, A f x = 0) |
| 25 | (hlocal : ∀ x ∈ D, ∃ U : Set E, IsOpen U ∧ x ∈ U ∧ U ⊆ D ∧ |
| 26 | ∀ ψ : E → ℝ, ContDiff ℝ ∞ ψ → HasCompactSupport ψ → |
| 27 | tsupport ψ ⊆ U → (∀ y, 0 ≤ ψ y) → |
| 28 | IntegrableOn (A ψ) U μ ∧ (∫ y in U, A ψ y ∂μ) ≤ 0) |
| 29 | {φ : E → ℝ} (hφ : ContDiff ℝ ∞ φ) (hφc : HasCompactSupport φ) |
| 30 | (hφD : tsupport φ ⊆ D) (hφ0 : ∀ x, 0 ≤ φ x) : |
| 31 | IntegrableOn (A φ) D μ ∧ (∫ x in D, A φ x ∂μ) ≤ 0 := by |
| 32 | classical |
| 33 | choose U hUopen hUmem hUD hUtest using fun x : D => hlocal x x.property |
| 34 | have hcover : tsupport φ ⊆ ⋃ x : D, U x := by |
| 35 | intro x hx |
| 36 | exact mem_iUnion.mpr ⟨⟨x, hφD hx⟩, hUmem _⟩ |
| 37 | obtain ⟨ρ, hρ⟩ := SmoothPartitionOfUnity.exists_isSubordinate |
| 38 | 𝓘(ℝ, E) (isClosed_tsupport φ) U hUopen hcover |
| 39 | have hfinite := ρ.locallyFinite.finite_nonempty_inter_compact hφc.isCompact |
| 40 | let s : Finset D := hfinite.toFinset |
| 41 | let ψ : D → E → ℝ := fun i x => ρ i x * φ x |
| 42 | have hψ (i : D) : ContDiff ℝ ∞ (ψ i) := (ρ i).contMDiff.contDiff.mul hφ |
| 43 | have hψc (i : D) : HasCompactSupport (ψ i) := hφc.mul_left |
| 44 | have hψU (i : D) : tsupport (ψ i) ⊆ U i := tsupport_mul_subset_left.trans (hρ i) |
| 45 | have hψ0 (i : D) (x : E) : 0 ≤ ψ i x := mul_nonneg (ρ.nonneg i x) (hφ0 x) |
| 46 | have hsum : (fun x => ∑ i ∈ s, ψ i x) = φ := by |
| 47 | funext x |
| 48 | have hs : Function.support (fun i => ψ i x) ⊆ s := by |
| 49 | intro i hi |
| 50 | apply hfinite.mem_toFinset.mpr |
| 51 | exact ⟨x, (mul_ne_zero_iff.mp hi).1, subset_tsupport φ (mul_ne_zero_iff.mp hi).2⟩ |
| 52 | rw [← finsum_eq_sum_of_support_subset _ hs] |
| 53 | change (∑ᶠ i, ρ i x * φ x) = φ x |
| 54 | rw [← finsum_mul] |
| 55 | by_cases hx : x ∈ tsupport φ |
| 56 | · rw [ρ.sum_eq_one hx, one_mul] |
| 57 | · simp only [image_eq_zero_of_notMem_tsupport hx, mul_zero] |
| 58 | have hAsum (t : Finset D) : |
| 59 | A (fun x => ∑ i ∈ t, ψ i x) = fun x => ∑ i ∈ t, A (ψ i) x := by |
| 60 | induction t using Finset.induction_on with |
| 61 | | empty => |
| 62 | funext x |
| 63 | simp only [Finset.sum_empty] |
| 64 | exact hzero _ contDiff_const x (by simp) |
| 65 | | @insert i t hit ih => |
| 66 | simp only [Finset.sum_insert hit] |
| 67 | rw [hadd _ _ (hψ i) (ContDiff.sum (fun j _ => hψ j)), ih] |
| 68 | have hi (i : D) : Integrable (A (ψ i)) μ ∧ (∫ x, A (ψ i) x ∂μ) ≤ 0 := by |
| 69 | obtain ⟨hii, hineq⟩ := hUtest i (ψ i) (hψ i) (hψc i) (hψU i) (hψ0 i) |
| 70 | have hsupport : Function.support (A (ψ i)) ⊆ U i := by |
| 71 | intro x hx |
| 72 | by_contra hxU |
| 73 | exact hx (hzero _ (hψ i) x (fun h => hxU (hψU i h))) |
| 74 | have hz : ∀ x ∉ U i, A (ψ i) x = 0 := |
| 75 | fun x hx => hzero _ (hψ i) x (fun h => hx (hψU i h)) |
| 76 | exact ⟨(integrableOn_iff_integrable_of_support_subset hsupport).mp hii, |
| 77 | (setIntegral_eq_integral_of_forall_compl_eq_zero hz) ▸ hineq⟩ |
| 78 | have hglobal : Integrable (A φ) μ := by |
| 79 | rw [← hsum, hAsum] |
| 80 | exact integrable_finsetSum s (fun i _ => (hi i).1) |
| 81 | refine ⟨hglobal.integrableOn, ?_⟩ |
| 82 | rw [setIntegral_eq_integral_of_forall_compl_eq_zero |
| 83 | (fun x hx => hzero φ hφ x (fun h => hx (hφD h))), ← hsum, hAsum, |
| 84 | integral_finsetSum s (fun i _ => (hi i).1)] |
| 85 | exact Finset.sum_nonpos (fun i _ => (hi i).2) |
| 86 | |
| 87 | end Poincare.Analysis |