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 PoincareLib.Analysis.Elliptic.Regularity.WeakInequalityExtension |
| 2 | import PoincareLib.Analysis.Elliptic.Regularity.Sobolev.Weak.Lipschitz |
| 3 | |
| 4 | /-! |
| 5 | # Compact Lipschitz tests for weak inequalities |
| 6 | |
| 7 | Rademacher's theorem and positive Sobolev approximation admit literal |
| 8 | nonnegative compact Lipschitz functions into a smooth-test inequality. |
| 9 | The final statement uses their actual almost-everywhere classical derivative. |
| 10 | -/ |
| 11 | |
| 12 | noncomputable section |
| 13 | |
| 14 | open Set MeasureTheory Filter |
| 15 | open scoped Topology ENNReal NNReal |
| 16 | |
| 17 | namespace Poincare.Analysis.Sobolev.Weak |
| 18 | |
| 19 | variable {d : ℕ} |
| 20 | local notation "E" => EuclideanSpace ℝ (Fin d) |
| 21 | |
| 22 | /-- Compact support makes all line derivatives of a Lipschitz function |
| 23 | globally `L^p`, including the endpoint exponents. -/ |
| 24 | theorem memLp_lineDeriv_of_hasCompactSupport {v : E → ℝ} {C : ℝ≥0} |
| 25 | (hv : LipschitzWith C v) (hvc : HasCompactSupport v) (p : ℝ≥0∞) (w : E) : |
| 26 | MemLp (fun x => lineDeriv ℝ v x w) p volume := by |
| 27 | let K := tsupport v |
| 28 | let q := fun x => lineDeriv ℝ v x w |
| 29 | let : IsFiniteMeasure (volume.restrict K) := ⟨by |
| 30 | simpa only [Measure.restrict_apply_univ] using hvc.measure_lt_top (μ := volume)⟩ |
| 31 | have hq : MemLp q p (volume.restrict K) := |
| 32 | (hv.memLp_lineDeriv (μ := volume.restrict K) w).mono_exponent le_top |
| 33 | have heq : K.indicator q = q := by |
| 34 | funext x |
| 35 | by_cases hx : x ∈ K |
| 36 | · exact indicator_of_mem hx _ |
| 37 | · rw [indicator_of_notMem hx] |
| 38 | have hgerm : v =ᶠ[𝓝 x] 0 := notMem_tsupport_iff_eventuallyEq.mp hx |
| 39 | have hz := hgerm.lineDeriv_eq (𝕜 := ℝ) (v := w) |
| 40 | simpa only [q, lineDeriv, Pi.zero_apply, deriv_const] using hz.symm |
| 41 | have hi : MemLp (K.indicator q) p volume := |
| 42 | (memLp_indicator_iff_restrict hvc.measurableSet).mpr hq |
| 43 | rwa [heq] at hi |
| 44 | |
| 45 | end Poincare.Analysis.Sobolev.Weak |
| 46 | |
| 47 | namespace Poincare.Analysis.Elliptic |
| 48 | |
| 49 | open Poincare.Analysis.Sobolev.Weak |
| 50 | |
| 51 | variable {d : ℕ} |
| 52 | local notation "E" => EuclideanSpace ℝ (Fin d) |
| 53 | |
| 54 | /-- Smooth nonnegative tests suffice for a weak inequality on every |
| 55 | nonnegative compactly supported Lipschitz test in its open domain. -/ |
| 56 | theorem weakInequality_of_nonneg_compact_lipschitz |
| 57 | {O : Set E} (hO : IsOpen O) {F : Fin d → E → ℝ} {f v : E → ℝ} |
| 58 | (hF : ∀ i, MemLp (F i) 2 (volume.restrict O)) |
| 59 | (hf : MemLp f 2 (volume.restrict O)) |
| 60 | (hle : ∀ φ : E → ℝ, ContDiff ℝ (⊤ : ℕ∞) φ → HasCompactSupport φ → |
| 61 | tsupport φ ⊆ O → (∀ x, 0 ≤ φ x) → |
| 62 | (∫ x in O, ∑ i, F i x * fderiv ℝ φ x (EuclideanSpace.single i 1)) ≤ |
| 63 | ∫ x in O, f x * φ x) |
| 64 | {C : ℝ≥0} (hv : LipschitzWith C v) (hv0 : ∀ x, 0 ≤ v x) |
| 65 | (hvc : HasCompactSupport v) (hvO : tsupport v ⊆ O) : |
| 66 | (∫ x in O, ∑ i, F i x * fderiv ℝ v x (EuclideanSpace.single i 1)) ≤ |
| 67 | ∫ x in O, f x * v x := by |
| 68 | have h := weakInequality_of_nonneg_compact_memW1p_univ hO hF hf hle |
| 69 | (hv.continuous.memLp_of_hasCompactSupport hvc) |
| 70 | (fun i => memLp_lineDeriv_of_hasCompactSupport hv hvc 2 (EuclideanSpace.single i 1)) |
| 71 | (fun i => hasWeakPartialDeriv_lineDeriv_of_lipschitz hv i) hv0 hvc hvO |
| 72 | convert h using 1 |
| 73 | apply integral_congr_ae |
| 74 | filter_upwards [MeasureTheory.ae_restrict_of_ae hv.ae_differentiableAt] with x hx |
| 75 | simp only [hx.lineDeriv_eq_fderiv] |
| 76 | |
| 77 | end Poincare.Analysis.Elliptic |