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.Analysis.Distribution.AEEqOfIntegralContDiff |
| 2 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic |
| 3 | import Mathlib.MeasureTheory.Measure.OpenPos |
| 4 | |
| 5 | /-! |
| 6 | # Continuous functions detected by interior test integrals |
| 7 | |
| 8 | The fundamental test-function argument used after Morgan-Tian Lemma 6.4, |
| 9 | pp. 107-108. Mathlib's distribution theorem and positivity of Lebesgue |
| 10 | measure upgrade vanishing interior test integrals to pointwise vanishing |
| 11 | on a nondegenerate closed interval. This is the generic analytic part |
| 12 | of the proof pattern in M08 IndexKernel. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set Filter MeasureTheory |
| 18 | open scoped ContDiff Topology intervalIntegral |
| 19 | |
| 20 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] |
| 21 | |
| 22 | /-- A continuous function on a nondegenerate closed interval is zero |
| 23 | if all its smooth interior test integrals vanish, the fundamental lemma |
| 24 | used after Morgan-Tian Lemma 6.4, pp. 107-108. -/ |
| 25 | theorem ContinuousOn.eq_zero_of_intervalIntegral_contDiff_smul {a b : ℝ} |
| 26 | (hab : a < b) {f : ℝ → E} (hf : ContinuousOn f (Icc a b)) |
| 27 | (htest : ∀ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ → HasCompactSupport ψ → |
| 28 | tsupport ψ ⊆ Ioo a b → (∫ s in a..b, ψ s • f s) = 0) : |
| 29 | EqOn f 0 (Icc a b) := by |
| 30 | have hae := isOpen_Ioo.ae_eq_zero_of_integral_contDiff_smul_eq_zero (μ := volume) |
| 31 | ((hf.mono Ioo_subset_Icc_self).locallyIntegrableOn (μ := volume) measurableSet_Ioo) |
| 32 | (fun ψ hψ hψc hψs => by |
| 33 | rw [← intervalIntegral.integral_eq_integral_of_support_subset |
| 34 | (f := fun s => ψ s • f s) |
| 35 | ((Function.support_smul_subset_left ψ f).trans |
| 36 | ((subset_tsupport ψ).trans (hψs.trans Ioo_subset_Ioc_self)))] |
| 37 | exact htest ψ hψ hψc hψs) |
| 38 | have hrestricted : f =ᵐ[volume.restrict (Icc a b)] 0 := by |
| 39 | change ∀ᵐ s ∂volume.restrict (Icc a b), f s = 0 |
| 40 | rw [← restrict_Ioo_eq_restrict_Icc, ae_restrict_iff' measurableSet_Ioo] |
| 41 | exact hae |
| 42 | exact Measure.eqOn_Icc_of_ae_eq volume hab.ne hrestricted hf continuousOn_const |