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.L2Pairing |
| 2 | import PoincareLib.Analysis.Elliptic.Regularity.Sobolev.Weak.NonnegativeApproximation |
| 3 | |
| 4 | /-! |
| 5 | # Nonnegative Sobolev tests for weak divergence inequalities |
| 6 | |
| 7 | Positive smooth approximation extends a weak inequality to nonnegative, |
| 8 | compactly supported Sobolev test functions. The vector and scalar coefficients |
| 9 | need only be square integrable on the open domain of integration. |
| 10 | -/ |
| 11 | |
| 12 | noncomputable section |
| 13 | |
| 14 | open Set MeasureTheory Filter |
| 15 | open scoped Topology ENNReal |
| 16 | open Poincare.Analysis.Sobolev.Weak |
| 17 | |
| 18 | namespace Poincare.Analysis.Elliptic |
| 19 | |
| 20 | variable {d : ℕ} |
| 21 | local notation "E" => EuclideanSpace ℝ (Fin d) |
| 22 | |
| 23 | /-- A distributional inequality remains valid on nonnegative compactly |
| 24 | supported global `W^{1,2}` tests whose support lies in its open domain. -/ |
| 25 | theorem weakInequality_of_nonneg_compact_memW1p_univ |
| 26 | {O : Set E} (hO : IsOpen O) {F : Fin d → E → ℝ} {f v : E → ℝ} |
| 27 | {q : Fin d → E → ℝ} |
| 28 | (hF : ∀ i, MemLp (F i) 2 (volume.restrict O)) |
| 29 | (hf : MemLp f 2 (volume.restrict O)) |
| 30 | (hle : ∀ φ : E → ℝ, ContDiff ℝ (⊤ : ℕ∞) φ → HasCompactSupport φ → |
| 31 | tsupport φ ⊆ O → (∀ x, 0 ≤ φ x) → |
| 32 | (∫ x in O, ∑ i, F i x * fderiv ℝ φ x (EuclideanSpace.single i 1)) ≤ |
| 33 | ∫ x in O, f x * φ x) |
| 34 | (hv : MemLp v 2 volume) (hq : ∀ i, MemLp (q i) 2 volume) |
| 35 | (hwq : ∀ i, HasWeakPartialDeriv i (q i) v univ) |
| 36 | (hv0 : ∀ x, 0 ≤ v x) (hvc : HasCompactSupport v) (hvO : tsupport v ⊆ O) : |
| 37 | (∫ x in O, ∑ i, F i x * q i x) ≤ ∫ x in O, f x * v x := by |
| 38 | obtain ⟨K, φ, hK, hKO, _, hφ, hφK, hφ0, hφlim, hgradlim⟩ := |
| 39 | exists_nonneg_smooth_compactSupport_approx (by norm_num : (1 : ℝ≥0∞) ≤ 2) |
| 40 | (by norm_num) hv hq hwq hv0 hvc hO hvO |
| 41 | have hφc (k : ℕ) : HasCompactSupport (φ k) := |
| 42 | hK.of_isClosed_subset (isClosed_tsupport _) (hφK k) |
| 43 | have hφLp (k : ℕ) : MemLp (φ k) 2 (volume.restrict O) := |
| 44 | ((hφ k).continuous.memLp_of_hasCompactSupport (hφc k)).restrict O |
| 45 | have hdφLp (k : ℕ) (i : Fin d) : |
| 46 | MemLp (fun x => fderiv ℝ (φ k) x (EuclideanSpace.single i 1)) |
| 47 | 2 (volume.restrict O) := by |
| 48 | have hdφ := ((hφ k).fderiv_right (m := (⊤ : ℕ∞)) (by norm_cast)).clm_apply |
| 49 | (contDiff_const (c := EuclideanSpace.single i (1 : ℝ))) |
| 50 | exact (hdφ.continuous.memLp_of_hasCompactSupport |
| 51 | ((hφc k).fderiv_apply (𝕜 := ℝ) _)).restrict O |
| 52 | have hrestrict {a : ℕ → E → ℝ} |
| 53 | (ha : Tendsto (fun k => eLpNorm (a k) 2 volume) atTop (𝓝 0)) : |
| 54 | Tendsto (fun k => eLpNorm (a k) 2 (volume.restrict O)) atTop (𝓝 0) := |
| 55 | tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds ha (fun _ => bot_le) |
| 56 | (fun k => eLpNorm_mono_measure (a k) Measure.restrict_le_self) |
| 57 | have hlim (i : Fin d) : Tendsto |
| 58 | (fun k => ∫ x in O, F i x * fderiv ℝ (φ k) x (EuclideanSpace.single i 1)) |
| 59 | atTop (𝓝 (∫ x in O, F i x * q i x)) := |
| 60 | tendsto_integral_mul_of_eLpNorm_sub (hF i) ((hq i).restrict O) |
| 61 | (fun k => hdφLp k i) (hrestrict (hgradlim i)) |
| 62 | have hleft : Tendsto |
| 63 | (fun k => ∫ x in O, ∑ i, F i x * fderiv ℝ (φ k) x (EuclideanSpace.single i 1)) |
| 64 | atTop (𝓝 (∫ x in O, ∑ i, F i x * q i x)) := by |
| 65 | have hsumq : (∫ x in O, ∑ i, F i x * q i x) = |
| 66 | ∑ i, ∫ x in O, F i x * q i x := by |
| 67 | simpa using integral_finsetSum Finset.univ |
| 68 | (fun i _ => (hF i).integrable_mul ((hq i).restrict O)) |
| 69 | rw [hsumq] |
| 70 | convert tendsto_finsetSum Finset.univ (fun i _ => hlim i) using 1 |
| 71 | ext k |
| 72 | simpa using integral_finsetSum Finset.univ |
| 73 | (fun i _ => (hF i).integrable_mul (hdφLp k i)) |
| 74 | have hright := tendsto_integral_mul_of_eLpNorm_sub hf (hv.restrict O) hφLp |
| 75 | (hrestrict hφlim) |
| 76 | exact le_of_tendsto_of_tendsto hleft hright <| |
| 77 | Filter.Eventually.of_forall fun k => hle _ (hφ k) (hφc k) ((hφK k).trans hKO) (hφ0 k) |
| 78 | |
| 79 | end Poincare.Analysis.Elliptic |