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.LocalL2 |
| 2 | |
| 3 | /-! |
| 4 | # Strong local compactness of elliptic gradients |
| 5 | |
| 6 | Uniform Cauchy control of the functions and elliptic coefficients, together |
| 7 | with bounded weak divergence sources, makes the actual partial derivatives |
| 8 | Cauchy in L2 on each smaller domain selected by a smooth cutoff. |
| 9 | -/ |
| 10 | |
| 11 | noncomputable section |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | open Set MeasureTheory Filter |
| 15 | open scoped Topology ENNReal NNReal BigOperators |
| 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 | /-- Uniform convergence of functions and coefficients upgrades to local L2 |
| 24 | Cauchy convergence of gradients for bounded elliptic subsolutions. -/ |
| 25 | theorem cauchySeq_lipschitzPartialL2_of_weak_divergence |
| 26 | {O U : Set E} (hO : IsOpen O) (hU : IsOpen U) (hUO : U ⊆ O) |
| 27 | [IsFiniteMeasure (volume.restrict O)] [IsFiniteMeasure (volume.restrict U)] |
| 28 | {u : ℕ → E → ℝ} {F : ℕ → Fin d → E → ℝ} {f : ℕ → E → ℝ} |
| 29 | {A : ℕ → E → Fin d → Fin d → ℝ} {L : ℝ≥0} {c C D : ℝ} |
| 30 | (hc : 0 < c) (hC : 0 ≤ C) (hD : 0 ≤ D) |
| 31 | (hu : ∀ k, LipschitzOnWith L (u k) O) |
| 32 | (huc : UniformCauchySeqOn u atTop O) (hAc : UniformCauchySeqOn A atTop O) |
| 33 | (hF : ∀ k i, MemLp (F k i) 2 (volume.restrict O)) |
| 34 | (hf : ∀ k, MemLp (f k) 2 (volume.restrict O)) |
| 35 | (hfC : ∀ k x, x ∈ O → |f k x| ≤ C) |
| 36 | (hFC : ∀ k i x, x ∈ O → |F k i x| ≤ C) |
| 37 | (hell : ∀ k x, x ∈ O → ∀ w : Fin d → ℝ, |
| 38 | c * ∑ i, (w i) ^ 2 ≤ ∑ i, ∑ j, A k x i j * w j * w i) |
| 39 | (hFid : ∀ k x, x ∈ O → ∀ i, F k i x = |
| 40 | -(∑ j, A k x i j * fderiv ℝ (u k) x (EuclideanSpace.single j 1))) |
| 41 | (hle : ∀ k (ψ : E → ℝ), ContDiff ℝ (⊤ : ℕ∞) ψ → HasCompactSupport ψ → |
| 42 | tsupport ψ ⊆ O → (∀ x, 0 ≤ ψ x) → |
| 43 | (∫ x in O, ∑ i, F k i x * fderiv ℝ ψ x (EuclideanSpace.single i 1)) ≤ |
| 44 | ∫ x in O, f k x * ψ x) |
| 45 | {φ : E → ℝ} (hφ : ContDiff ℝ (⊤ : ℕ∞) φ) (hφc : HasCompactSupport φ) |
| 46 | (hφO : tsupport φ ⊆ O) (hφ0 : ∀ x, 0 ≤ φ x) (hφ1 : ∀ x, φ x ≤ 1) |
| 47 | (hφU : ∀ x ∈ U, φ x = 1) |
| 48 | (hdφ : ∀ i x, x ∈ O → |fderiv ℝ φ x (EuclideanSpace.single i 1)| ≤ D) |
| 49 | (i : Fin d) : |
| 50 | CauchySeq (fun k => lipschitzPartialL2 hU ((hu k).mono hUO) i) := by |
| 51 | rw [Metric.cauchySeq_iff] |
| 52 | intro ε hε |
| 53 | let B := (4 * C * (1 + (d : ℝ) * D) + (d : ℝ) ^ 2 * (2 * (L : ℝ) ^ 2)) * |
| 54 | volume.real O |
| 55 | have hB : 0 ≤ B := by dsimp only [B]; positivity |
| 56 | let η := c * ε ^ 2 / (B + 1) |
| 57 | have hη : 0 < η := by dsimp only [η]; positivity |
| 58 | have hηeq : η * (B + 1) = c * ε ^ 2 := |
| 59 | div_mul_cancel₀ _ (by positivity : B + 1 ≠ 0) |
| 60 | have hsmall : η * B < c * ε ^ 2 := by nlinarith |
| 61 | obtain ⟨Nu, hNu⟩ := Metric.uniformCauchySeqOn_iff.mp huc η hη |
| 62 | obtain ⟨NA, hNA⟩ := Metric.uniformCauchySeqOn_iff.mp hAc η hη |
| 63 | refine ⟨max Nu NA, fun m hm n hn => ?_⟩ |
| 64 | have hmU : Nu ≤ m := le_trans (le_max_left _ _) hm |
| 65 | have hnU : Nu ≤ n := le_trans (le_max_left _ _) hn |
| 66 | have hmA : NA ≤ m := le_trans (le_max_right _ _) hm |
| 67 | have hnA : NA ≤ n := le_trans (le_max_right _ _) hn |
| 68 | have herr : ∀ x ∈ O, |u m x - u n x| ≤ (⟨η, hη.le⟩ : ℝ≥0) := by |
| 69 | intro x hx |
| 70 | exact (Real.dist_eq _ _ ▸ hNu m hmU n hnU x hx).le |
| 71 | have hcoeff : ∀ x ∈ O, ∀ j k, |A m x j k - A n x j k| ≤ η := by |
| 72 | intro x hx j k |
| 73 | rw [← Real.dist_eq] |
| 74 | exact ((dist_le_pi_dist (A m x j) (A n x j) k).trans |
| 75 | (dist_le_pi_dist (A m x) (A n x) j)).trans (hNA m hmA n hnA x hx).le |
| 76 | have hp : MemLp φ ∞ (volume.restrict O) := |
| 77 | (hφ.continuous.memLp_of_hasCompactSupport hφc).restrict O |
| 78 | have henergy := integral_partial_sq_le_flux_energy hO (hF m) (hF n) (hu m) (hu n) |
| 79 | hp (fun x _ => hφ0 x) (fun x _ => hφ1 x) hη.le hcoeff (hell m) (hFid m) (hFid n) |
| 80 | have hflux := weak_flux_comparison_energy_le_of_bound hO (hF m) (hF n) (hf m) (hf n) |
| 81 | (hle m) (hle n) (hu m) (hu n) herr hφ hφc hφO hφ0 hφ1 hC hD |
| 82 | (hfC m) (hfC n) (hFC m) (hFC n) hdφ |
| 83 | let q := fun x => φ x * ∑ j, |
| 84 | (fderiv ℝ (u m) x (EuclideanSpace.single j 1) - |
| 85 | fderiv ℝ (u n) x (EuclideanSpace.single j 1)) ^ 2 |
| 86 | have hq : MemLp q ∞ (volume.restrict O) := by |
| 87 | have hsum : MemLp (fun x => ∑ j, |
| 88 | (fderiv ℝ (u m) x (EuclideanSpace.single j 1) - |
| 89 | fderiv ℝ (u n) x (EuclideanSpace.single j 1)) ^ 2) ∞ (volume.restrict O) := by |
| 90 | apply memLp_finsetSum |
| 91 | intro j _ |
| 92 | have hd := (memLp_top_fderiv_apply_of_lipschitzOn hO (hu m) |
| 93 | (EuclideanSpace.single j 1)).sub |
| 94 | (memLp_top_fderiv_apply_of_lipschitzOn hO (hu n) (EuclideanSpace.single j 1)) |
| 95 | simpa only [pow_two, Pi.sub_apply] using hd.mul' (r := ∞) hd |
| 96 | exact hsum.mul' hp |
| 97 | have hnorm : ‖lipschitzPartialL2 hU ((hu m).mono hUO) i - |
| 98 | lipschitzPartialL2 hU ((hu n).mono hUO) i‖ ^ 2 ≤ ∫ x in O, q x := by |
| 99 | apply norm_toLp_sub_sq_le_integral hU.measurableSet hO.measurableSet hUO |
| 100 | _ _ (hq.integrable le_top) |
| 101 | · intro x _ |
| 102 | exact mul_nonneg (hφ0 x) (Finset.sum_nonneg fun _ _ => sq_nonneg _) |
| 103 | · intro x hx |
| 104 | dsimp only [q] |
| 105 | rw [hφU x hx, one_mul] |
| 106 | exact Finset.single_le_sum (f := fun j => |
| 107 | (fderiv ℝ (u m) x (EuclideanSpace.single j 1) - |
| 108 | fderiv ℝ (u n) x (EuclideanSpace.single j 1)) ^ 2) |
| 109 | (fun _ _ => sq_nonneg _) (Finset.mem_univ i) |
| 110 | have hsq : c * ‖lipschitzPartialL2 hU ((hu m).mono hUO) i - |
| 111 | lipschitzPartialL2 hU ((hu n).mono hUO) i‖ ^ 2 ≤ η * B := by |
| 112 | have hmul := mul_le_mul_of_nonneg_left hnorm hc.le |
| 113 | change c * (∫ x in O, q x) ≤ _ at henergy |
| 114 | have he := henergy.trans (add_le_add hflux le_rfl) |
| 115 | change c * (∫ x in O, q x) ≤ 4 * η * C * (1 + (d : ℝ) * D) * volume.real O + |
| 116 | (d : ℝ) ^ 2 * η * (2 * (L : ℝ) ^ 2) * volume.real O at he |
| 117 | have halg : 4 * η * C * (1 + (d : ℝ) * D) * volume.real O + |
| 118 | (d : ℝ) ^ 2 * η * (2 * (L : ℝ) ^ 2) * volume.real O = η * B := by |
| 119 | dsimp only [B] |
| 120 | ring |
| 121 | rw [halg] at he |
| 122 | exact hmul.trans he |
| 123 | rw [dist_eq_norm] |
| 124 | have hsq' := hsq.trans_lt hsmall |
| 125 | have hsq'' := (mul_lt_mul_iff_right₀ hc).mp hsq' |
| 126 | nlinarith only [hsq'', hε, norm_nonneg (lipschitzPartialL2 hU ((hu m).mono hUO) i - |
| 127 | lipschitzPartialL2 hU ((hu n).mono hUO) i)] |
| 128 | |
| 129 | end Poincare.Analysis.Elliptic |