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 Mathlib.Analysis.Calculus.LineDeriv.IntegrationByParts |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.Basic |
| 3 | import Mathlib.MeasureTheory.Function.L2Space |
| 4 | import Mathlib.MeasureTheory.Function.LocallyIntegrable |
| 5 | import Mathlib.Analysis.Normed.Module.HahnBanach |
| 6 | import Mathlib.Analysis.Normed.Operator.Extend |
| 7 | import Mathlib.Analysis.InnerProductSpace.Dual |
| 8 | |
| 9 | /-! |
| 10 | # L2 construction and limits of weak coordinate derivatives |
| 11 | |
| 12 | The integration-by-parts identity is closed under strong L2 convergence of |
| 13 | both the function and its weak derivative. This adapts the p = 2 case of |
| 14 | Chow--Liao--Qin, `Analysis/Sobolev/Tools/WeakPartialLimit.lean`, revision |
| 15 | `1b535dd102b94cc42b107cca27059687888f08b3` (Apache-2.0), using continuity of |
| 16 | the L2 inner product. It supports the interior regularity step in Chow et al., |
| 17 | Part III, Theorem 24.30, Section 24.5.1, p. 290. |
| 18 | |
| 19 | A bounded derivative pairing also constructs an L2 weak derivative using |
| 20 | Hahn--Banach and Riesz representation. This is the functional-analytic step |
| 21 | behind the pinned source's `DifferenceQuotientWeakLimitLoc.lean`. |
| 22 | -/ |
| 23 | |
| 24 | set_option autoImplicit false |
| 25 | |
| 26 | open Set MeasureTheory Filter |
| 27 | open scoped ContDiff InnerProductSpace Topology |
| 28 | |
| 29 | namespace Poincare.Analysis.Elliptic |
| 30 | |
| 31 | variable {n : ℕ} |
| 32 | |
| 33 | /-- A smooth function on an open set satisfies the coordinate weak derivative |
| 34 | identity against tests supported in that set. -/ |
| 35 | theorem integral_mul_partial_test {Ω : Set (EuclideanSpace ℝ (Fin n))} |
| 36 | (hΩ : IsOpen Ω) {f : EuclideanSpace ℝ (Fin n) → ℝ} |
| 37 | (hf : ContDiffOn ℝ ∞ f Ω) (v : EuclideanSpace ℝ (Fin n)) |
| 38 | {φ : EuclideanSpace ℝ (Fin n) → ℝ} (hφ : ContDiff ℝ ∞ φ) |
| 39 | (hc : HasCompactSupport φ) (hs : tsupport φ ⊆ Ω) : |
| 40 | (∫ x in Ω, f x * fderiv ℝ φ x v) = -(∫ x in Ω, fderiv ℝ f x v * φ x) := by |
| 41 | have hdφ : Continuous (fun x => fderiv ℝ φ x v) := |
| 42 | (hφ.continuous_fderiv (by simp)).clm_apply continuous_const |
| 43 | have hdf : ContinuousOn (fun x => fderiv ℝ f x v) Ω := |
| 44 | (hf.continuousOn_fderiv_of_isOpen hΩ (by simp)).clm_apply continuousOn_const |
| 45 | have hfirst : Integrable (fun x => fderiv ℝ φ x v * f x) := by |
| 46 | apply Continuous.integrable_of_hasCompactSupport _ (hc.fderiv_apply ℝ v).mul_right |
| 47 | exact (hdφ.continuousOn.mul hf.continuousOn).continuous_of_tsupport_subset hΩ |
| 48 | (tsupport_mul_subset_left.trans ((tsupport_fderiv_apply_subset ℝ v).trans hs)) |
| 49 | have hsecond : Integrable (fun x => φ x * fderiv ℝ f x v) := by |
| 50 | apply Continuous.integrable_of_hasCompactSupport _ hc.mul_right |
| 51 | exact (hφ.continuous.continuousOn.mul hdf).continuous_of_tsupport_subset hΩ |
| 52 | (tsupport_mul_subset_left.trans hs) |
| 53 | have hprod : Integrable (fun x => φ x * f x) := by |
| 54 | apply Continuous.integrable_of_hasCompactSupport _ hc.mul_right |
| 55 | exact (hφ.continuous.continuousOn.mul hf.continuousOn).continuous_of_tsupport_subset hΩ |
| 56 | (tsupport_mul_subset_left.trans hs) |
| 57 | have hparts := integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable |
| 58 | hfirst hsecond hprod (fun x _ => hφ.differentiable (by simp) x) |
| 59 | (fun x hx => (hf.contDiffAt (hΩ.mem_nhds (hs hx))).differentiableAt (by simp)) |
| 60 | have hleft : (∫ x in Ω, f x * fderiv ℝ φ x v) = ∫ x, fderiv ℝ φ x v * f x := by |
| 61 | rw [setIntegral_eq_integral_of_forall_compl_eq_zero (fun x hx => by |
| 62 | rw [image_eq_zero_of_notMem_tsupport |
| 63 | (fun ht => hx (hs (tsupport_fderiv_apply_subset ℝ v ht))), mul_zero])] |
| 64 | exact integral_congr_ae (Eventually.of_forall fun _ => mul_comm _ _) |
| 65 | have hright : (∫ x in Ω, fderiv ℝ f x v * φ x) = ∫ x, φ x * fderiv ℝ f x v := by |
| 66 | rw [setIntegral_eq_integral_of_forall_compl_eq_zero (fun x hx => by |
| 67 | rw [image_eq_zero_of_notMem_tsupport (fun ht => hx (hs ht)), mul_zero])] |
| 68 | exact integral_congr_ae (Eventually.of_forall fun _ => mul_comm _ _) |
| 69 | rw [hleft, hright, hparts, neg_neg] |
| 70 | |
| 71 | /-- Pairing against a fixed L2 function is continuous in the other L2 argument. -/ |
| 72 | theorem tendsto_integral_mul_L2 {X : Type*} [MeasurableSpace X] {μ : Measure X} |
| 73 | {v : ℕ → Lp ℝ 2 μ} {u : Lp ℝ 2 μ} (hv : Tendsto v atTop (𝓝 u)) |
| 74 | {ψ : X → ℝ} (hψ : MemLp ψ 2 μ) : |
| 75 | Tendsto (fun k => ∫ x, v k x * ψ x ∂μ) atTop (𝓝 (∫ x, u x * ψ x ∂μ)) := by |
| 76 | have heq (w : Lp ℝ 2 μ) : |
| 77 | (∫ x, w x * ψ x ∂μ) = ⟪w, hψ.toLp ψ⟫_ℝ := by |
| 78 | rw [L2.inner_def] |
| 79 | apply integral_congr_ae |
| 80 | filter_upwards [hψ.coeFn_toLp] with x hx |
| 81 | rw [hx] |
| 82 | simp [mul_comm] |
| 83 | simp_rw [heq] |
| 84 | exact hv.inner tendsto_const_nhds |
| 85 | |
| 86 | /-- Strong L2 limits preserve the weak coordinate-derivative equation. -/ |
| 87 | theorem weak_partial_of_tendsto_L2 |
| 88 | {Ω : Set (EuclideanSpace ℝ (Fin n))} (i : Fin n) |
| 89 | {uSeq vSeq : ℕ → Lp ℝ 2 (volume.restrict Ω)} |
| 90 | {u v : Lp ℝ 2 (volume.restrict Ω)} |
| 91 | (hu : Tendsto uSeq atTop (𝓝 u)) (hv : Tendsto vSeq atTop (𝓝 v)) |
| 92 | (hweak : ∀ k (φ : EuclideanSpace ℝ (Fin n) → ℝ), |
| 93 | ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ Ω → |
| 94 | (∫ x in Ω, uSeq k x * fderiv ℝ φ x (EuclideanSpace.single i 1)) = |
| 95 | -(∫ x in Ω, vSeq k x * φ x)) : |
| 96 | ∀ φ : EuclideanSpace ℝ (Fin n) → ℝ, |
| 97 | ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ Ω → |
| 98 | (∫ x in Ω, u x * fderiv ℝ φ x (EuclideanSpace.single i 1)) = |
| 99 | -(∫ x in Ω, v x * φ x) := by |
| 100 | intro φ hφ hc hs |
| 101 | have hφLp : MemLp φ 2 (volume.restrict Ω) := |
| 102 | (hφ.continuous.memLp_of_hasCompactSupport hc).restrict Ω |
| 103 | have hdφLp : MemLp (fun x => fderiv ℝ φ x (EuclideanSpace.single i 1)) |
| 104 | 2 (volume.restrict Ω) := |
| 105 | (((hφ.continuous_fderiv (by simp)).clm_apply continuous_const).memLp_of_hasCompactSupport |
| 106 | (hc.fderiv_apply ℝ (EuclideanSpace.single i 1))).restrict Ω |
| 107 | have hl := tendsto_integral_mul_L2 hu hdφLp |
| 108 | have hr := (tendsto_integral_mul_L2 hv hφLp).neg |
| 109 | exact tendsto_nhds_unique hl (hr.congr' (Eventually.of_forall fun k => |
| 110 | (hweak k φ hφ hc hs).symm)) |
| 111 | |
| 112 | private theorem exists_inner_representation_of_bound |
| 113 | {V H : Type*} [AddCommGroup V] [Module ℝ V] |
| 114 | [NormedAddCommGroup H] [InnerProductSpace ℝ H] [CompleteSpace H] |
| 115 | (j : V →ₗ[ℝ] H) (F : V →ₗ[ℝ] ℝ) {C : ℝ} (hC : 0 ≤ C) |
| 116 | (hbound : ∀ v, ‖F v‖ ≤ C * ‖j v‖) : |
| 117 | ∃ w : H, ‖w‖ ≤ C ∧ ∀ v, F v = ⟪w, j v⟫_ℝ := by |
| 118 | let q := F.compLeftInverse j |
| 119 | have hq : ‖q‖ ≤ C := by |
| 120 | apply q.opNorm_le_bound hC |
| 121 | rintro ⟨y, v, rfl⟩ |
| 122 | change ‖F.compLeftInverse j ⟨j v, _⟩‖ ≤ C * ‖j v‖ |
| 123 | rw [LinearMap.compLeftInverse_apply_of_bdd F j ⟨C, hbound⟩ v (j v) rfl] |
| 124 | exact hbound v |
| 125 | obtain ⟨G, hG, hGn⟩ := exists_extension_norm_eq (LinearMap.range j) q |
| 126 | let w := (InnerProductSpace.toDual ℝ H).symm G |
| 127 | refine ⟨w, ?_, fun v => ?_⟩ |
| 128 | · change ‖(InnerProductSpace.toDual ℝ H).symm G‖ ≤ C |
| 129 | rw [LinearIsometryEquiv.norm_map, hGn] |
| 130 | exact hq |
| 131 | · have heq : G (j v) = F v := (hG ⟨j v, LinearMap.mem_range_self j v⟩).trans |
| 132 | (LinearMap.compLeftInverse_apply_of_bdd F j ⟨C, hbound⟩ v (j v) rfl) |
| 133 | rw [← heq] |
| 134 | exact congrArg (fun L : H →L[ℝ] ℝ => L (j v)) |
| 135 | ((InnerProductSpace.toDual ℝ H).apply_symm_apply G).symm |
| 136 | |
| 137 | private def compactSmoothTests (Ω : Set (EuclideanSpace ℝ (Fin n))) : |
| 138 | Submodule ℝ (EuclideanSpace ℝ (Fin n) → ℝ) where |
| 139 | carrier := {φ | ContDiff ℝ ∞ φ ∧ HasCompactSupport φ ∧ tsupport φ ⊆ Ω} |
| 140 | zero_mem' := ⟨contDiff_const, HasCompactSupport.zero, by simp⟩ |
| 141 | add_mem' := fun {f g} hf hg => ⟨hf.1.add hg.1, hf.2.1.add hg.2.1, |
| 142 | (tsupport_add (f := f) (g := g)).trans (union_subset hf.2.2 hg.2.2)⟩ |
| 143 | smul_mem' c φ hφ := by |
| 144 | refine ⟨contDiff_const.smul hφ.1, hφ.2.1.smul_left, ?_⟩ |
| 145 | apply subset_trans (closure_mono ?_) hφ.2.2 |
| 146 | intro x hx |
| 147 | simp only [Function.mem_support, Pi.smul_apply, smul_eq_mul] at hx ⊢ |
| 148 | exact (mul_ne_zero_iff.mp hx).2 |
| 149 | |
| 150 | private theorem compactSmoothTests_memLp {Ω : Set (EuclideanSpace ℝ (Fin n))} |
| 151 | (φ : compactSmoothTests Ω) : MemLp (φ : EuclideanSpace ℝ (Fin n) → ℝ) |
| 152 | 2 (volume.restrict Ω) := |
| 153 | (φ.2.1.continuous.memLp_of_hasCompactSupport φ.2.2.1).restrict Ω |
| 154 | |
| 155 | private noncomputable def compactSmoothTestsToL2 (Ω : Set (EuclideanSpace ℝ (Fin n))) : |
| 156 | compactSmoothTests Ω →ₗ[ℝ] Lp ℝ 2 (volume.restrict Ω) where |
| 157 | toFun φ := (compactSmoothTests_memLp φ).toLp φ |
| 158 | map_add' φ ψ := MemLp.toLp_add (compactSmoothTests_memLp φ) (compactSmoothTests_memLp ψ) |
| 159 | map_smul' c φ := MemLp.toLp_const_smul c (compactSmoothTests_memLp φ) |
| 160 | |
| 161 | private theorem compactSmoothTests_deriv_memLp {Ω : Set (EuclideanSpace ℝ (Fin n))} |
| 162 | (φ : compactSmoothTests Ω) (v : EuclideanSpace ℝ (Fin n)) : |
| 163 | MemLp (fun x => fderiv ℝ (φ : EuclideanSpace ℝ (Fin n) → ℝ) x v) |
| 164 | 2 (volume.restrict Ω) := |
| 165 | (((φ.2.1.continuous_fderiv (by simp)).clm_apply continuous_const).memLp_of_hasCompactSupport |
| 166 | (φ.2.2.1.fderiv_apply ℝ v)).restrict Ω |
| 167 | |
| 168 | private noncomputable def derivativeTestPairing {Ω : Set (EuclideanSpace ℝ (Fin n))} |
| 169 | {u : EuclideanSpace ℝ (Fin n) → ℝ} (hu : MemLp u 2 (volume.restrict Ω)) |
| 170 | (v : EuclideanSpace ℝ (Fin n)) : compactSmoothTests Ω →ₗ[ℝ] ℝ where |
| 171 | toFun φ := -(∫ x in Ω, u x * fderiv ℝ (φ : EuclideanSpace ℝ (Fin n) → ℝ) x v) |
| 172 | map_add' φ ψ := by |
| 173 | change -(∫ x in Ω, u x * fderiv ℝ (fun y => φ.1 y + ψ.1 y) x v) = _ |
| 174 | simp_rw [fderiv_fun_add (φ.2.1.differentiable (by simp) _) |
| 175 | (ψ.2.1.differentiable (by simp) _), add_apply, mul_add] |
| 176 | simpa only [Pi.mul_apply, neg_add] using congrArg Neg.neg |
| 177 | (integral_add (hu.integrable_mul (compactSmoothTests_deriv_memLp φ v)) |
| 178 | (hu.integrable_mul (compactSmoothTests_deriv_memLp ψ v))) |
| 179 | map_smul' c φ := by |
| 180 | change -(∫ x in Ω, u x * fderiv ℝ (fun y => c * φ.1 y) x v) = c * _ |
| 181 | simp_rw [fderiv_const_mul (φ.2.1.differentiable (by simp) _), |
| 182 | smul_apply, smul_eq_mul, ← mul_assoc, mul_comm (u _) c, mul_assoc] |
| 183 | rw [integral_const_mul, mul_neg] |
| 184 | |
| 185 | /-- A bound on derivative pairings with smooth compact tests constructs an |
| 186 | L2 weak derivative, with the same norm bound. Hahn--Banach and Riesz apply |
| 187 | to the actual image of the test space in L2, so no density assumption is needed. -/ |
| 188 | theorem exists_weak_partial_of_test_bound |
| 189 | {Ω : Set (EuclideanSpace ℝ (Fin n))} {u : EuclideanSpace ℝ (Fin n) → ℝ} |
| 190 | (hu : MemLp u 2 (volume.restrict Ω)) (v : EuclideanSpace ℝ (Fin n)) |
| 191 | {C : ℝ} (hC : 0 ≤ C) |
| 192 | (hbound : ∀ φ : EuclideanSpace ℝ (Fin n) → ℝ, |
| 193 | ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ Ω → |
| 194 | |∫ x in Ω, u x * fderiv ℝ φ x v| ≤ C * (eLpNorm φ 2 (volume.restrict Ω)).toReal) : |
| 195 | ∃ g : Lp ℝ 2 (volume.restrict Ω), ‖g‖ ≤ C ∧ |
| 196 | ∀ φ : EuclideanSpace ℝ (Fin n) → ℝ, |
| 197 | ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ Ω → |
| 198 | (∫ x in Ω, u x * fderiv ℝ φ x v) = -(∫ x in Ω, g x * φ x) := by |
| 199 | have hb (φ : compactSmoothTests Ω) : ‖derivativeTestPairing hu v φ‖ ≤ |
| 200 | C * ‖compactSmoothTestsToL2 Ω φ‖ := by |
| 201 | simpa only [derivativeTestPairing, LinearMap.coe_mk, AddHom.coe_mk, norm_neg, |
| 202 | Real.norm_eq_abs, compactSmoothTestsToL2, Lp.norm_toLp] using |
| 203 | hbound φ φ.2.1 φ.2.2.1 φ.2.2.2 |
| 204 | obtain ⟨g, hg, hrep⟩ := exists_inner_representation_of_bound (compactSmoothTestsToL2 Ω) |
| 205 | (derivativeTestPairing hu v) hC hb |
| 206 | refine ⟨g, hg, fun φ hφ hc hs => ?_⟩ |
| 207 | have h := hrep ⟨φ, hφ, hc, hs⟩ |
| 208 | have heq : ⟪g, compactSmoothTestsToL2 Ω ⟨φ, hφ, hc, hs⟩⟫_ℝ = |
| 209 | ∫ x in Ω, g x * φ x := by |
| 210 | rw [L2.inner_def] |
| 211 | apply integral_congr_ae |
| 212 | filter_upwards [(compactSmoothTests_memLp (⟨φ, hφ, hc, hs⟩ : compactSmoothTests Ω)).coeFn_toLp] |
| 213 | with x hx |
| 214 | change inner ℝ (g x) ((compactSmoothTestsToL2 Ω ⟨φ, hφ, hc, hs⟩) x) = g x * φ x |
| 215 | rw [show (compactSmoothTestsToL2 Ω ⟨φ, hφ, hc, hs⟩) x = φ x from hx] |
| 216 | simp [mul_comm] |
| 217 | rw [heq] at h |
| 218 | exact neg_eq_iff_eq_neg.mp h |
| 219 | |
| 220 | /-- Uniform L2 bounds on weak derivatives of a strongly convergent sequence |
| 221 | give a weak derivative of its limit. No convergence of the derivatives is |
| 222 | needed. In particular, this passes smooth approximation estimates to a weak |
| 223 | solution. -/ |
| 224 | theorem exists_weak_partial_of_bounded_approximation |
| 225 | {Ω : Set (EuclideanSpace ℝ (Fin n))} |
| 226 | {uSeq vSeq : ℕ → Lp ℝ 2 (volume.restrict Ω)} |
| 227 | {u : Lp ℝ 2 (volume.restrict Ω)} (hu : Tendsto uSeq atTop (𝓝 u)) |
| 228 | (v : EuclideanSpace ℝ (Fin n)) {C : ℝ} (hC : 0 ≤ C) |
| 229 | (hbound : ∀ k, ‖vSeq k‖ ≤ C) |
| 230 | (hweak : ∀ k (φ : EuclideanSpace ℝ (Fin n) → ℝ), |
| 231 | ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ Ω → |
| 232 | (∫ x in Ω, uSeq k x * fderiv ℝ φ x v) = -(∫ x in Ω, vSeq k x * φ x)) : |
| 233 | ∃ g : Lp ℝ 2 (volume.restrict Ω), ‖g‖ ≤ C ∧ |
| 234 | ∀ φ : EuclideanSpace ℝ (Fin n) → ℝ, |
| 235 | ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ Ω → |
| 236 | (∫ x in Ω, u x * fderiv ℝ φ x v) = -(∫ x in Ω, g x * φ x) := by |
| 237 | apply exists_weak_partial_of_test_bound (Lp.memLp u) v hC |
| 238 | intro φ hφ hc hs |
| 239 | have hφLp : MemLp φ 2 (volume.restrict Ω) := |
| 240 | (hφ.continuous.memLp_of_hasCompactSupport hc).restrict Ω |
| 241 | have hdφLp : MemLp (fun x => fderiv ℝ φ x v) 2 (volume.restrict Ω) := |
| 242 | (((hφ.continuous_fderiv (by simp)).clm_apply continuous_const).memLp_of_hasCompactSupport |
| 243 | (hc.fderiv_apply ℝ v)).restrict Ω |
| 244 | apply le_of_tendsto (tendsto_integral_mul_L2 hu hdφLp).abs |
| 245 | apply Eventually.of_forall |
| 246 | intro k |
| 247 | have heq : (∫ x in Ω, vSeq k x * φ x) = ⟪vSeq k, hφLp.toLp φ⟫_ℝ := by |
| 248 | rw [L2.inner_def] |
| 249 | apply integral_congr_ae |
| 250 | filter_upwards [hφLp.coeFn_toLp] with x hx |
| 251 | rw [hx] |
| 252 | simp [mul_comm] |
| 253 | rw [hweak k φ hφ hc hs, abs_neg, heq] |
| 254 | calc |
| 255 | |⟪vSeq k, hφLp.toLp φ⟫_ℝ| ≤ ‖vSeq k‖ * ‖hφLp.toLp φ‖ := |
| 256 | abs_real_inner_le_norm _ _ |
| 257 | _ ≤ C * ‖hφLp.toLp φ‖ := mul_le_mul_of_nonneg_right (hbound k) (norm_nonneg _) |
| 258 | _ = C * (eLpNorm φ 2 (volume.restrict Ω)).toReal := by rw [Lp.norm_toLp] |
| 259 | |
| 260 | end Poincare.Analysis.Elliptic |