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.Approximation |
| 3 | |
| 4 | /-! |
| 5 | # Sobolev tests for a weak divergence equation |
| 6 | |
| 7 | The equation initially holds for smooth compactly supported functions. |
| 8 | Density extends it to compactly supported functions with square-integrable |
| 9 | weak first derivatives. |
| 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 : ℕ} [NeZero d] |
| 21 | local notation "E" => EuclideanSpace ℝ (Fin d) |
| 22 | |
| 23 | omit [NeZero d] in |
| 24 | theorem weakEquation_of_memW01p |
| 25 | {O : Set E} (hO : IsOpen O) {F : Fin d → E → ℝ} {f v : E → ℝ} |
| 26 | {q : Fin d → E → ℝ} |
| 27 | (hF : ∀ i, MemLp (F i) 2 (volume.restrict O)) |
| 28 | (hf : MemLp f 2 (volume.restrict O)) |
| 29 | (heq : ∀ φ : E → ℝ, ContDiff ℝ (⊤ : ℕ∞) φ → HasCompactSupport φ → |
| 30 | tsupport φ ⊆ O → |
| 31 | (∫ x in O, ∑ i, F i x * fderiv ℝ φ x (EuclideanSpace.single i 1)) = |
| 32 | ∫ x in O, f x * φ x) |
| 33 | (hv : MemW01p 2 v O) |
| 34 | (hq : ∀ i, MemLp (q i) 2 (volume.restrict O)) |
| 35 | (hwq : ∀ i, HasWeakPartialDeriv i (q i) v O) : |
| 36 | (∫ x in O, ∑ i, F i x * q i x) = ∫ x in O, f x * v x := by |
| 37 | rcases hv with ⟨hv, w, φ, hφ, hφc, hφO, hφlim, hgradlim⟩ |
| 38 | have hqeq (i : Fin d) : (fun x => w.weakGrad x i) =ᵐ[volume.restrict O] q i := |
| 39 | (w.isWeakGrad i).ae_eq hO (hwq i) |
| 40 | ((w.weakGrad_component_memLp i).locallyIntegrable (by norm_num)) |
| 41 | ((hq i).locallyIntegrable (by norm_num)) |
| 42 | have hφLp (n : ℕ) : MemLp (φ n) 2 (volume.restrict O) := |
| 43 | ((hφ n).continuous.memLp_of_hasCompactSupport (hφc n)).restrict O |
| 44 | have hdφLp (n : ℕ) (i : Fin d) : |
| 45 | MemLp (fun x => fderiv ℝ (φ n) x (EuclideanSpace.single i 1)) |
| 46 | 2 (volume.restrict O) := by |
| 47 | have hdφ := ((hφ n).fderiv_right (m := (⊤ : ℕ∞)) (by norm_cast)).clm_apply |
| 48 | (contDiff_const (c := EuclideanSpace.single i (1 : ℝ))) |
| 49 | exact (hdφ.continuous.memLp_of_hasCompactSupport |
| 50 | ((hφc n).fderiv_apply (𝕜 := ℝ) _)).restrict O |
| 51 | have hlim (i : Fin d) : Tendsto |
| 52 | (fun n => ∫ x in O, F i x * fderiv ℝ (φ n) x (EuclideanSpace.single i 1)) |
| 53 | atTop (𝓝 (∫ x in O, F i x * q i x)) := by |
| 54 | have ht := tendsto_integral_mul_of_eLpNorm_sub (hF i) |
| 55 | (w.weakGrad_component_memLp i) (fun n => hdφLp n i) (hgradlim i) |
| 56 | have he : (∫ x in O, F i x * w.weakGrad x i) = ∫ x in O, F i x * q i x := by |
| 57 | apply integral_congr_ae |
| 58 | filter_upwards [hqeq i] with x hx |
| 59 | rw [hx] |
| 60 | rwa [he] at ht |
| 61 | have hleft : Tendsto |
| 62 | (fun n => ∫ x in O, ∑ i, F i x * fderiv ℝ (φ n) x (EuclideanSpace.single i 1)) |
| 63 | atTop (𝓝 (∫ x in O, ∑ i, F i x * q i x)) := by |
| 64 | have hsumq : (∫ x in O, ∑ i, F i x * q i x) = |
| 65 | ∑ i, ∫ x in O, F i x * q i x := by |
| 66 | simpa using integral_finsetSum Finset.univ |
| 67 | (fun i _ => (hF i).integrable_mul (hq i)) |
| 68 | rw [hsumq] |
| 69 | convert tendsto_finsetSum Finset.univ (fun i _ => hlim i) using 1 |
| 70 | ext n |
| 71 | simpa using integral_finsetSum Finset.univ |
| 72 | (fun i _ => (hF i).integrable_mul (hdφLp n i)) |
| 73 | have hright := tendsto_integral_mul_of_eLpNorm_sub hf hv.1 hφLp hφlim |
| 74 | exact tendsto_nhds_unique hleft (by |
| 75 | simpa only [heq _ (hφ _) (hφc _) (hφO _)] using hright) |
| 76 | |
| 77 | theorem weakEquation_of_compact_memW1p |
| 78 | {O : Set E} (hO : IsOpen O) {F : Fin d → E → ℝ} {f v : E → ℝ} |
| 79 | {q : Fin d → E → ℝ} |
| 80 | (hF : ∀ i, MemLp (F i) 2 (volume.restrict O)) |
| 81 | (hf : MemLp f 2 (volume.restrict O)) |
| 82 | (heq : ∀ φ : E → ℝ, ContDiff ℝ (⊤ : ℕ∞) φ → HasCompactSupport φ → |
| 83 | tsupport φ ⊆ O → |
| 84 | (∫ x in O, ∑ i, F i x * fderiv ℝ φ x (EuclideanSpace.single i 1)) = |
| 85 | ∫ x in O, f x * φ x) |
| 86 | (hv : MemLp v 2 (volume.restrict O)) |
| 87 | (hq : ∀ i, MemLp (q i) 2 (volume.restrict O)) |
| 88 | (hwq : ∀ i, HasWeakPartialDeriv i (q i) v O) |
| 89 | (hvc : HasCompactSupport v) (hvO : tsupport v ⊆ O) : |
| 90 | (∫ x in O, ∑ i, F i x * q i x) = ∫ x in O, f x * v x := by |
| 91 | have hv1 : MemW1p 2 v O := ⟨hv, fun i => ⟨q i, hq i, hwq i⟩⟩ |
| 92 | have hv0 : MemW01p 2 v O := by |
| 93 | simpa using memW01p_of_memW1p_of_tsupport_subset hO |
| 94 | (p := (2 : ℝ)) (by norm_num) (by simpa using hv1) hvc hvO |
| 95 | exact weakEquation_of_memW01p hO hF hf heq hv0 hq hwq |
| 96 | |
| 97 | end Poincare.Analysis.Elliptic |