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.GradientCompactness.Coercivity |
| 2 | |
| 3 | /-! |
| 4 | # Uniform bounds for the two-test energy remainder |
| 5 | |
| 6 | On a set of finite measure, bounded fluxes and weak divergence sources turn |
| 7 | the comparison identity into an estimate proportional to the uniform error. |
| 8 | -/ |
| 9 | |
| 10 | noncomputable section |
| 11 | set_option backward.isDefEq.respectTransparency false |
| 12 | |
| 13 | open Set MeasureTheory Filter |
| 14 | open scoped Topology ENNReal NNReal BigOperators |
| 15 | |
| 16 | namespace Poincare.Analysis.Elliptic |
| 17 | |
| 18 | variable {d : ℕ} |
| 19 | local notation "E" => EuclideanSpace ℝ (Fin d) |
| 20 | |
| 21 | /-- Bounded fluxes and sources give a uniform quantitative flux comparison. -/ |
| 22 | theorem weak_flux_comparison_energy_le_of_bound |
| 23 | {O : Set E} (hO : IsOpen O) [IsFiniteMeasure (volume.restrict O)] |
| 24 | {F G : Fin d → E → ℝ} {f g u v φ : E → ℝ} |
| 25 | (hF : ∀ i, MemLp (F i) 2 (volume.restrict O)) |
| 26 | (hG : ∀ i, MemLp (G i) 2 (volume.restrict O)) |
| 27 | (hf : MemLp f 2 (volume.restrict O)) (hg : MemLp g 2 (volume.restrict O)) |
| 28 | (hleF : ∀ ψ : E → ℝ, ContDiff ℝ (⊤ : ℕ∞) ψ → HasCompactSupport ψ → |
| 29 | tsupport ψ ⊆ O → (∀ x, 0 ≤ ψ x) → |
| 30 | (∫ x in O, ∑ i, F i x * fderiv ℝ ψ x (EuclideanSpace.single i 1)) ≤ |
| 31 | ∫ x in O, f x * ψ x) |
| 32 | (hleG : ∀ ψ : E → ℝ, ContDiff ℝ (⊤ : ℕ∞) ψ → HasCompactSupport ψ → |
| 33 | tsupport ψ ⊆ O → (∀ x, 0 ≤ ψ x) → |
| 34 | (∫ x in O, ∑ i, G i x * fderiv ℝ ψ x (EuclideanSpace.single i 1)) ≤ |
| 35 | ∫ x in O, g x * ψ x) |
| 36 | {A B ε : ℝ≥0} (hu : LipschitzOnWith A u O) (hv : LipschitzOnWith B v O) |
| 37 | (herr : ∀ x ∈ O, |u x - v x| ≤ ε) |
| 38 | (hφ : ContDiff ℝ (⊤ : ℕ∞) φ) (hφc : HasCompactSupport φ) |
| 39 | (hφO : tsupport φ ⊆ O) (hφ0 : ∀ x, 0 ≤ φ x) (hφ1 : ∀ x, φ x ≤ 1) |
| 40 | {C D : ℝ} (hC : 0 ≤ C) (hD : 0 ≤ D) |
| 41 | (hfC : ∀ x ∈ O, |f x| ≤ C) (hgC : ∀ x ∈ O, |g x| ≤ C) |
| 42 | (hFC : ∀ i x, x ∈ O → |F i x| ≤ C) |
| 43 | (hGC : ∀ i x, x ∈ O → |G i x| ≤ C) |
| 44 | (hdφ : ∀ i x, x ∈ O → |fderiv ℝ φ x (EuclideanSpace.single i 1)| ≤ D) : |
| 45 | (∫ x in O, φ x * ∑ i, (G i x - F i x) * |
| 46 | (fderiv ℝ u x (EuclideanSpace.single i 1) - |
| 47 | fderiv ℝ v x (EuclideanSpace.single i 1))) ≤ |
| 48 | 4 * ε * C * (1 + (d : ℝ) * D) * volume.real O := by |
| 49 | let w := fun x => v x - u x + (ε : ℝ) |
| 50 | let z := fun x => u x - v x + (ε : ℝ) |
| 51 | let dp := fun i x => fderiv ℝ φ x (EuclideanSpace.single i 1) |
| 52 | have hwbound (x) (hx : x ∈ O) : |w x| ≤ 2 * ε := by |
| 53 | have h := abs_le.mp (herr x hx) |
| 54 | dsimp only [w] |
| 55 | exact abs_le.mpr ⟨by linarith [ε.coe_nonneg], by linarith⟩ |
| 56 | have hzbound (x) (hx : x ∈ O) : |z x| ≤ 2 * ε := by |
| 57 | have h := abs_le.mp (herr x hx) |
| 58 | dsimp only [z] |
| 59 | exact abs_le.mpr ⟨by linarith [ε.coe_nonneg], by linarith⟩ |
| 60 | have hw : MemLp w ∞ (volume.restrict O) := by |
| 61 | apply memLp_top_of_bound |
| 62 | (((hv.continuousOn.sub hu.continuousOn).add continuousOn_const).aestronglyMeasurable |
| 63 | hO.measurableSet) (2 * (ε : ℝ)) |
| 64 | filter_upwards [ae_restrict_mem hO.measurableSet] with x hx |
| 65 | exact (Real.norm_eq_abs _).symm ▸ hwbound x hx |
| 66 | have hz : MemLp z ∞ (volume.restrict O) := by |
| 67 | apply memLp_top_of_bound |
| 68 | (((hu.continuousOn.sub hv.continuousOn).add continuousOn_const).aestronglyMeasurable |
| 69 | hO.measurableSet) (2 * (ε : ℝ)) |
| 70 | filter_upwards [ae_restrict_mem hO.measurableSet] with x hx |
| 71 | exact (Real.norm_eq_abs _).symm ▸ hzbound x hx |
| 72 | have hp : MemLp φ ∞ (volume.restrict O) := |
| 73 | (hφ.continuous.memLp_of_hasCompactSupport hφc).restrict O |
| 74 | have hdp (i) : MemLp (dp i) ∞ (volume.restrict O) := by |
| 75 | have h := (hφ.fderiv_right (m := (⊤ : ℕ∞)) (by norm_cast)).clm_apply |
| 76 | (contDiff_const (c := EuclideanSpace.single i (1 : ℝ))) |
| 77 | exact (h.continuous.memLp_of_hasCompactSupport (hφc.fderiv_apply (𝕜 := ℝ) _)).restrict O |
| 78 | let R₁ := fun x => f x * (φ x * w x) |
| 79 | let R₂ := fun x => g x * (φ x * z x) |
| 80 | let bd := fun x => ∑ i, (w x * F i x + z x * G i x) * dp i x |
| 81 | have hwp : MemLp (fun x => φ x * w x) ∞ (volume.restrict O) := hw.mul' hp |
| 82 | have hzp : MemLp (fun x => φ x * z x) ∞ (volume.restrict O) := hz.mul' hp |
| 83 | have hR₁ : MemLp R₁ 2 (volume.restrict O) := hwp.mul' hf |
| 84 | have hR₂ : MemLp R₂ 2 (volume.restrict O) := hzp.mul' hg |
| 85 | have hbd : MemLp bd 2 (volume.restrict O) := by |
| 86 | apply memLp_finsetSum |
| 87 | intro i _ |
| 88 | have hfirst : MemLp (fun x => w x * F i x) 2 (volume.restrict O) := (hF i).mul' hw |
| 89 | have hsecond : MemLp (fun x => z x * G i x) 2 (volume.restrict O) := (hG i).mul' hz |
| 90 | exact (hdp i).mul' (hfirst.add hsecond) |
| 91 | have hR := (hR₁.add hR₂).sub hbd |
| 92 | have hbound : (∫ x in O, R₁ x + R₂ x - bd x) ≤ |
| 93 | 4 * ε * C * (1 + (d : ℝ) * D) * volume.real O := by |
| 94 | have h := integral_mono_ae (hR.integrable (by norm_num)) |
| 95 | (integrable_const (4 * (ε : ℝ) * C * (1 + (d : ℝ) * D))) ?_ |
| 96 | · simpa only [Pi.sub_apply, Pi.add_apply, integral_const, smul_eq_mul, measureReal_restrict_apply_univ, |
| 97 | mul_comm] using h |
| 98 | · filter_upwards [ae_restrict_mem hO.measurableSet] with x hx |
| 99 | exact flux_comparison_remainder_le ε.coe_nonneg hC hD |
| 100 | (hfC x hx) (hgC x hx) (fun i => hFC i x hx) (fun i => hGC i x hx) |
| 101 | (fun i => hdφ i x hx) (by rw [abs_of_nonneg (hφ0 x)]; exact hφ1 x) |
| 102 | (hwbound x hx) (hzbound x hx) |
| 103 | have hflux := weak_flux_comparison_energy_le hO hF hG hf hg hleF hleG |
| 104 | hu hv herr hφ hφc hφO hφ0 hφ1 |
| 105 | change _ ≤ (∫ x in O, R₁ x) + (∫ x in O, R₂ x) - ∫ x in O, bd x at hflux |
| 106 | have hsum : IntegrableOn (fun x => R₁ x + R₂ x) O := |
| 107 | (hR₁.integrable (by norm_num)).add (hR₂.integrable (by norm_num)) |
| 108 | rw [integral_sub hsum (hbd.integrable (by norm_num)), |
| 109 | integral_add (hR₁.integrable (by norm_num)) (hR₂.integrable (by norm_num))] at hbound |
| 110 | exact hflux.trans hbound |
| 111 | |
| 112 | end Poincare.Analysis.Elliptic |