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 | # Identification of strong gradient limits |
| 5 | |
| 6 | The actual derivatives of Lipschitz functions are weak derivatives. L2 |
| 7 | completeness and uniqueness of weak derivatives therefore identify a Cauchy |
| 8 | gradient sequence with the derivative of its uniform function limit. |
| 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 | /-- Local Lipschitz regularity identifies the actual total derivative with |
| 24 | the distributional coordinate derivative. -/ |
| 25 | theorem hasWeakPartialDeriv_fderiv_of_lipschitzOn |
| 26 | {O : Set E} (hO : IsOpen O) {u : E → ℝ} {L : ℝ≥0} |
| 27 | (hu : LipschitzOnWith L u O) (i : Fin d) : |
| 28 | HasWeakPartialDeriv i (fun x => fderiv ℝ u x (EuclideanSpace.single i 1)) u O := by |
| 29 | obtain ⟨v, hv, heq⟩ := hu.extend_real |
| 30 | have hae : (fun x => lineDeriv ℝ v x (EuclideanSpace.single i 1)) =ᵐ[volume.restrict O] |
| 31 | fun x => fderiv ℝ u x (EuclideanSpace.single i 1) := by |
| 32 | filter_upwards [ae_restrict_mem hO.measurableSet, |
| 33 | ae_restrict_of_ae (hv.ae_differentiableAt (μ := volume))] with x hx hdx |
| 34 | have hnear : u =ᶠ[𝓝 x] v := by |
| 35 | filter_upwards [hO.mem_nhds hx] with y hy |
| 36 | exact heq hy |
| 37 | rw [hdx.lineDeriv_eq_fderiv, hnear.fderiv_eq] |
| 38 | intro φ hφ hc hs |
| 39 | calc |
| 40 | (∫ x in O, u x * fderiv ℝ φ x (EuclideanSpace.single i 1)) = |
| 41 | ∫ x in O, v x * fderiv ℝ φ x (EuclideanSpace.single i 1) := by |
| 42 | apply setIntegral_congr_fun hO.measurableSet |
| 43 | intro x hx |
| 44 | dsimp only |
| 45 | rw [heq hx] |
| 46 | _ = -(∫ x in O, lineDeriv ℝ v x (EuclideanSpace.single i 1) * φ x) := |
| 47 | hasWeakPartialDeriv_lineDeriv_of_lipschitz hv i φ hφ hc hs |
| 48 | _ = -(∫ x in O, fderiv ℝ u x (EuclideanSpace.single i 1) * φ x) := by |
| 49 | congr 1 |
| 50 | apply integral_congr_ae |
| 51 | filter_upwards [hae] with x hx |
| 52 | rw [hx] |
| 53 | |
| 54 | /-- A uniform limit preserves a common local Lipschitz constant. -/ |
| 55 | theorem lipschitzOnWith_of_tendstoUniformlyOn |
| 56 | {O : Set E} {u : ℕ → E → ℝ} {v : E → ℝ} {L : ℝ≥0} |
| 57 | (hu : ∀ k, LipschitzOnWith L (u k) O) |
| 58 | (hv : TendstoUniformlyOn u v atTop O) : LipschitzOnWith L v O := by |
| 59 | rw [lipschitzOnWith_iff_dist_le_mul] |
| 60 | intro x hx y hy |
| 61 | exact le_of_tendsto ((hv.tendsto_at hx).dist (hv.tendsto_at hy)) |
| 62 | (Eventually.of_forall fun k => (hu k).dist_le_mul x hx y hy) |
| 63 | |
| 64 | /-- Uniform convergence on a finite-measure domain implies convergence of |
| 65 | the corresponding L2 classes. -/ |
| 66 | theorem tendsto_toLp_of_tendstoUniformlyOn |
| 67 | {X : Type*} [MeasurableSpace X] {μ : Measure X} {O : Set X} |
| 68 | (hO : MeasurableSet O) [IsFiniteMeasure (μ.restrict O)] |
| 69 | {u : ℕ → X → ℝ} {v : X → ℝ} |
| 70 | (hu : ∀ k, MemLp (u k) 2 (μ.restrict O)) (hv : MemLp v 2 (μ.restrict O)) |
| 71 | (hlim : TendstoUniformlyOn u v atTop O) : |
| 72 | Tendsto (fun k => (hu k).toLp (u k)) atTop (𝓝 (hv.toLp v)) := by |
| 73 | rw [Metric.tendsto_nhds] |
| 74 | intro ε hε |
| 75 | obtain ⟨a, ha, hsmall⟩ := exists_pos_mul_lt (sq_pos_of_pos hε) (μ.real O + 1) |
| 76 | let δ := min 1 a |
| 77 | have hδ : 0 < δ := lt_min (by norm_num) ha |
| 78 | have hδ1 : δ ≤ 1 := min_le_left _ _ |
| 79 | have hδa : δ ≤ a := min_le_right _ _ |
| 80 | have hδsq : δ ^ 2 ≤ δ := by nlinarith |
| 81 | have hbound : δ ^ 2 * μ.real O < ε ^ 2 := by |
| 82 | calc |
| 83 | _ ≤ δ * μ.real O := mul_le_mul_of_nonneg_right hδsq (measureReal_nonneg) |
| 84 | _ ≤ a * (μ.real O + 1) := by gcongr; linarith |
| 85 | _ < _ := by simpa only [mul_comm] using hsmall |
| 86 | filter_upwards [Metric.tendstoUniformlyOn_iff.mp hlim δ hδ] with k hk |
| 87 | have hsquare : Integrable (fun x => (u k x - v x) ^ 2) (μ.restrict O) := |
| 88 | (memLp_two_iff_integrable_sq ((hu k).sub hv).aestronglyMeasurable).mp ((hu k).sub hv) |
| 89 | have hI : (∫ x in O, (u k x - v x) ^ 2 ∂μ) ≤ δ ^ 2 * μ.real O := by |
| 90 | have h := integral_mono_ae hsquare (integrable_const (δ ^ 2)) ?_ |
| 91 | · simpa only [integral_const, smul_eq_mul, measureReal_restrict_apply_univ, |
| 92 | mul_comm] using h |
| 93 | · filter_upwards [ae_restrict_mem hO] with x hx |
| 94 | have h := hk x hx |
| 95 | rw [Real.dist_eq, abs_sub_comm] at h |
| 96 | nlinarith [sq_abs (u k x - v x), abs_nonneg (u k x - v x)] |
| 97 | rw [dist_eq_norm] |
| 98 | have hsq := (norm_toLp_sub_sq_eq_integral (hu k) hv).trans_le hI |
| 99 | have hs := hsq.trans_lt hbound |
| 100 | nlinarith only [hs, hε, norm_nonneg ((hu k).toLp (u k) - hv.toLp v)] |
| 101 | |
| 102 | /-- A Cauchy sequence of actual derivatives converges to the derivative of |
| 103 | the same uniform function limit, by uniqueness of weak derivatives. -/ |
| 104 | theorem tendsto_lipschitzPartialL2_of_cauchy |
| 105 | {O : Set E} (hO : IsOpen O) [IsFiniteMeasure (volume.restrict O)] |
| 106 | {u : ℕ → E → ℝ} {v : E → ℝ} {L : ℝ≥0} |
| 107 | (hu : ∀ k, LipschitzOnWith L (u k) O) (hv : LipschitzOnWith L v O) |
| 108 | (huLp : ∀ k, MemLp (u k) 2 (volume.restrict O)) (hvLp : MemLp v 2 (volume.restrict O)) |
| 109 | (hlim : TendstoUniformlyOn u v atTop O) (i : Fin d) |
| 110 | (hCauchy : CauchySeq (fun k => lipschitzPartialL2 hO (hu k) i)) : |
| 111 | Tendsto (fun k => lipschitzPartialL2 hO (hu k) i) atTop |
| 112 | (𝓝 (lipschitzPartialL2 hO hv i)) := by |
| 113 | obtain ⟨g, hg⟩ := cauchySeq_tendsto_of_complete hCauchy |
| 114 | have hfunctions := tendsto_toLp_of_tendstoUniformlyOn hO.measurableSet huLp hvLp hlim |
| 115 | have hweak : HasWeakPartialDeriv i g v O := by |
| 116 | have h := weak_partial_of_tendsto_L2 i hfunctions hg ?_ |
| 117 | · intro φ hφ hc hs |
| 118 | calc |
| 119 | (∫ x in O, v x * fderiv ℝ φ x (EuclideanSpace.single i 1)) = |
| 120 | ∫ x in O, hvLp.toLp v x * fderiv ℝ φ x (EuclideanSpace.single i 1) := by |
| 121 | apply integral_congr_ae |
| 122 | filter_upwards [hvLp.coeFn_toLp] with x hx |
| 123 | rw [hx] |
| 124 | _ = -(∫ x in O, g x * φ x) := h φ hφ hc hs |
| 125 | · intro k φ hφ hc hs |
| 126 | calc |
| 127 | (∫ x in O, (huLp k).toLp (u k) x * fderiv ℝ φ x (EuclideanSpace.single i 1)) = |
| 128 | ∫ x in O, u k x * fderiv ℝ φ x (EuclideanSpace.single i 1) := by |
| 129 | apply integral_congr_ae |
| 130 | filter_upwards [(huLp k).coeFn_toLp] with x hx |
| 131 | rw [hx] |
| 132 | _ = -(∫ x in O, fderiv ℝ (u k) x (EuclideanSpace.single i 1) * φ x) := |
| 133 | hasWeakPartialDeriv_fderiv_of_lipschitzOn hO (hu k) i φ hφ hc hs |
| 134 | _ = -(∫ x in O, lipschitzPartialL2 hO (hu k) i x * φ x) := by |
| 135 | congr 1 |
| 136 | apply integral_congr_ae |
| 137 | filter_upwards [coeFn_lipschitzPartialL2 hO (hu k) i] with x hx |
| 138 | rw [hx] |
| 139 | have hactual := hasWeakPartialDeriv_fderiv_of_lipschitzOn hO hv i |
| 140 | have heq := hweak.ae_eq hO hactual |
| 141 | ((Lp.memLp g).integrable (by norm_num)).locallyIntegrable |
| 142 | ((memLp_top_fderiv_apply_of_lipschitzOn hO hv _).integrable le_top).locallyIntegrable |
| 143 | have hgEq : g = lipschitzPartialL2 hO hv i := |
| 144 | Lp.ext (heq.trans (coeFn_lipschitzPartialL2 hO hv i).symm) |
| 145 | exact hgEq ▸ hg |
| 146 | |
| 147 | end Poincare.Analysis.Elliptic |