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 | /- |
| 2 | Adapted from AxelWorkspace revision f1cdb30cabdc8781d2d3dec86d3d99ab1820f30e. |
| 3 | Source and SHA-256: references/analysis/axel-workspace/weak-parabolic-regularity-sources.json. |
| 4 | Apache-2.0; see the license in that source directory. |
| 5 | -/ |
| 6 | import PoincareLib.Analysis.Parabolic.WeakRegularity.CanonicalEquation |
| 7 | import Mathlib.Analysis.Calculus.LineDeriv.IntegrationByParts |
| 8 | import Mathlib.Analysis.Distribution.AEEqOfIntegralContDiff |
| 9 | import Mathlib.MeasureTheory.Measure.OpenPos |
| 10 | |
| 11 | /-! |
| 12 | # Local parabolic integration by parts |
| 13 | |
| 14 | The coefficients and solution need only be smooth on the open region. Compact |
| 15 | test support supplies all integrability and eliminates exterior values. |
| 16 | |
| 17 | Reference: Morgan--Tian, Proposition 9.20, proof on p. 208. |
| 18 | -/ |
| 19 | |
| 20 | open MeasureTheory Set Filter |
| 21 | open scoped ContDiff Topology |
| 22 | |
| 23 | noncomputable section |
| 24 | |
| 25 | namespace Poincare.Analysis.Parabolic.WeakRegularity.Canonical |
| 26 | |
| 27 | variable {n : ℕ} {U : Set (Spacetime n)} |
| 28 | |
| 29 | local instance : (volume : Measure (Spacetime n)).IsAddHaarMeasure := by |
| 30 | change ((volume : Measure (Euclid n)).prod (volume : Measure ℝ)).IsAddHaarMeasure |
| 31 | infer_instance |
| 32 | |
| 33 | private theorem smooth_directional (hU : IsOpen U) {f : Spacetime n → ℝ} |
| 34 | (hf : ContDiffOn ℝ ∞ f U) (v : Spacetime n) : |
| 35 | ContDiffOn ℝ ∞ (fun z => fderiv ℝ f z v) U := |
| 36 | (hf.fderiv_of_isOpen hU (by simp)).clm_apply contDiffOn_const |
| 37 | |
| 38 | private theorem smooth_of_support (hU : IsOpen U) {f : Spacetime n → ℝ} |
| 39 | (hf : ContDiffOn ℝ ∞ f U) (hs : tsupport f ⊆ U) : ContDiff ℝ ∞ f := by |
| 40 | rw [contDiff_iff_contDiffAt] |
| 41 | intro z |
| 42 | by_cases hz : z ∈ tsupport f |
| 43 | · exact (hf z (hs hz)).contDiffAt (hU.mem_nhds (hs hz)) |
| 44 | · exact contDiffAt_const.congr_of_eventuallyEq |
| 45 | (notMem_tsupport_iff_eventuallyEq.mp hz) |
| 46 | |
| 47 | private theorem integrable_mul_test {f g : Spacetime n → ℝ} |
| 48 | (hf : ContinuousOn f U) (hg : ContinuousOn g U) |
| 49 | (hgc : HasCompactSupport g) (hgU : tsupport g ⊆ U) : |
| 50 | Integrable (fun z => f z * g z) := by |
| 51 | apply (integrableOn_iff_integrable_of_support_subset |
| 52 | ((Function.support_mul_subset_right f g).trans (subset_tsupport g))).mp |
| 53 | exact ((hf.mul hg).mono hgU).integrableOn_compact hgc |
| 54 | |
| 55 | private theorem integral_directional_test (hU : IsOpen U) |
| 56 | {f g : Spacetime n → ℝ} (hf : ContDiffOn ℝ ∞ f U) |
| 57 | (hg : ContDiff ℝ ∞ g) (hgc : HasCompactSupport g) (hgU : tsupport g ⊆ U) |
| 58 | (v : Spacetime n) : |
| 59 | (∫ z, f z * fderiv ℝ g z v) = -∫ z, fderiv ℝ f z v * g z := by |
| 60 | have hgd := smooth_directional hU hg.contDiffOn v |
| 61 | apply integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable |
| 62 | · exact integrable_mul_test (smooth_directional hU hf v).continuousOn |
| 63 | hg.continuous.continuousOn hgc hgU |
| 64 | · exact integrable_mul_test hf.continuousOn hgd.continuousOn |
| 65 | (hgc.fderiv_apply ℝ v) ((tsupport_fderiv_apply_subset ℝ v).trans hgU) |
| 66 | · exact integrable_mul_test hf.continuousOn hg.continuous.continuousOn hgc hgU |
| 67 | · intro z hz |
| 68 | exact ((hf z (hgU hz)).contDiffAt (hU.mem_nhds (hgU hz))).differentiableAt |
| 69 | (by simp) |
| 70 | · intro z _ |
| 71 | exact hg.differentiable (by simp) z |
| 72 | |
| 73 | private theorem integral_second_test (hU : IsOpen U) |
| 74 | {f g : Spacetime n → ℝ} (hf : ContDiffOn ℝ ∞ f U) |
| 75 | (hg : ContDiff ℝ ∞ g) (hgc : HasCompactSupport g) (hgU : tsupport g ⊆ U) |
| 76 | (v w : Spacetime n) : |
| 77 | (∫ z, f z * fderiv ℝ (fun y => fderiv ℝ g y v) z w) = |
| 78 | ∫ z, fderiv ℝ (fun y => fderiv ℝ f y w) z v * g z := by |
| 79 | have hgd : ContDiff ℝ ∞ (fun z => fderiv ℝ g z v) := |
| 80 | (hg.fderiv_right (by simp)).clm_apply contDiff_const |
| 81 | rw [integral_directional_test hU hf hgd (hgc.fderiv_apply ℝ v) |
| 82 | ((tsupport_fderiv_apply_subset ℝ v).trans hgU) w] |
| 83 | rw [integral_directional_test hU (smooth_directional hU hf w) hg hgc hgU v] |
| 84 | simp |
| 85 | |
| 86 | theorem integral_adjoint_eq {n : ℕ} {U : Set (Spacetime n)} (hU : IsOpen U) |
| 87 | (C : Coefficients n) (hC : C.IsSmoothOn U) |
| 88 | {u φ : Spacetime n → ℝ} (hu : ContDiffOn ℝ ∞ u U) |
| 89 | (hφ : ContDiff ℝ ∞ φ) (hφc : HasCompactSupport φ) (hφU : tsupport φ ⊆ U) : |
| 90 | (∫ z, u z * C.adjoint φ z) = ∫ z, φ z * C.operator u z := by |
| 91 | let A := fun i j z => C.principal i j z * φ z |
| 92 | let B := fun i z => C.drift i z * φ z |
| 93 | have hAU (i j) : tsupport (A i j) ⊆ U := tsupport_mul_subset_right.trans hφU |
| 94 | have hBU (i) : tsupport (B i) ⊆ U := tsupport_mul_subset_right.trans hφU |
| 95 | have hA (i j) : ContDiff ℝ ∞ (A i j) := |
| 96 | smooth_of_support hU ((hC.1 i j).mul hφ.contDiffOn) (hAU i j) |
| 97 | have hB (i) : ContDiff ℝ ∞ (B i) := |
| 98 | smooth_of_support hU ((hC.2.1 i).mul hφ.contDiffOn) (hBU i) |
| 99 | have hAc (i j) : HasCompactSupport (A i j) := hφc.mul_left |
| 100 | have hBc (i) : HasCompactSupport (B i) := hφc.mul_left |
| 101 | have hsd {f : Spacetime n → ℝ} (hf : ContDiffOn ℝ ∞ f U) (i : Fin n) : |
| 102 | ContDiffOn ℝ ∞ (spatialDeriv i f) U := smooth_directional hU hf _ |
| 103 | have htd {f : Spacetime n → ℝ} (hf : ContDiffOn ℝ ∞ f U) : |
| 104 | ContDiffOn ℝ ∞ (timeDeriv f) U := smooth_directional hU hf _ |
| 105 | have hLt : Integrable (fun z => u z * timeDeriv φ z) := |
| 106 | integrable_mul_test hu.continuousOn (htd hφ.contDiffOn).continuousOn |
| 107 | (hφc.fderiv_apply ℝ (0, 1)) ((tsupport_fderiv_apply_subset ℝ (0, 1)).trans hφU) |
| 108 | have hLa (i j) : Integrable (fun z => |
| 109 | u z * spatialDeriv j (spatialDeriv i (A i j)) z) := |
| 110 | integrable_mul_test hu.continuousOn |
| 111 | (hsd (hsd (hA i j).contDiffOn i) j).continuousOn |
| 112 | (((hAc i j).fderiv_apply ℝ (spatialDirection i)).fderiv_apply ℝ (spatialDirection j)) |
| 113 | ((tsupport_fderiv_apply_subset ℝ (spatialDirection j)).trans |
| 114 | ((tsupport_fderiv_apply_subset ℝ (spatialDirection i)).trans (hAU i j))) |
| 115 | have hLb (i) : Integrable (fun z => u z * spatialDeriv i (B i) z) := |
| 116 | integrable_mul_test hu.continuousOn (hsd (hB i).contDiffOn i).continuousOn |
| 117 | ((hBc i).fderiv_apply ℝ (spatialDirection i)) |
| 118 | ((tsupport_fderiv_apply_subset ℝ (spatialDirection i)).trans (hBU i)) |
| 119 | have hRt : Integrable (fun z => timeDeriv u z * φ z) := |
| 120 | integrable_mul_test (htd hu).continuousOn hφ.continuous.continuousOn hφc hφU |
| 121 | have hRa (i j) : Integrable (fun z => |
| 122 | spatialDeriv i (spatialDeriv j u) z * A i j z) := |
| 123 | integrable_mul_test (hsd (hsd hu j) i).continuousOn |
| 124 | (hA i j).continuous.continuousOn (hAc i j) (hAU i j) |
| 125 | have hRb (i) : Integrable (fun z => spatialDeriv i u z * B i z) := |
| 126 | integrable_mul_test (hsd hu i).continuousOn (hB i).continuous.continuousOn |
| 127 | (hBc i) (hBU i) |
| 128 | have hc : Integrable (fun z => (C.zeroth z * u z) * φ z) := |
| 129 | integrable_mul_test (hC.2.2.mul hu).continuousOn hφ.continuous.continuousOn hφc hφU |
| 130 | have sumI {ι : Type} [Fintype ι] (f : ι → Spacetime n → ℝ) |
| 131 | (hf : ∀ i, Integrable (f i)) : Integrable (fun z => ∑ i, f i z) := |
| 132 | integrable_finsetSum _ (fun i _ => hf i) |
| 133 | have hLas := sumI (ι := Fin n) _ (fun i => sumI (ι := Fin n) _ (hLa i)) |
| 134 | have hLbs := sumI (ι := Fin n) _ hLb |
| 135 | have hRas := sumI (ι := Fin n) _ (fun i => sumI (ι := Fin n) _ (hRa i)) |
| 136 | have hRbs := sumI (ι := Fin n) _ hRb |
| 137 | have ht : (∫ z, u z * timeDeriv φ z) = -∫ z, timeDeriv u z * φ z := |
| 138 | integral_directional_test hU hu hφ hφc hφU (0, 1) |
| 139 | have ha (i j) : (∫ z, u z * spatialDeriv j (spatialDeriv i (A i j)) z) = |
| 140 | ∫ z, spatialDeriv i (spatialDeriv j u) z * A i j z := |
| 141 | integral_second_test hU hu (hA i j) (hAc i j) (hAU i j) |
| 142 | (spatialDirection i) (spatialDirection j) |
| 143 | have hb (i) : (∫ z, u z * spatialDeriv i (B i) z) = |
| 144 | -∫ z, spatialDeriv i u z * B i z := |
| 145 | integral_directional_test hU hu (hB i) (hBc i) (hBU i) (spatialDirection i) |
| 146 | change (∫ z, u z * C.adjoint φ z) = ∫ z, φ z * C.operator u z |
| 147 | calc |
| 148 | (∫ z, u z * C.adjoint φ z) = |
| 149 | ∫ z, -(u z * timeDeriv φ z) - |
| 150 | (∑ i, ∑ j, u z * spatialDeriv j (spatialDeriv i (A i j)) z) - |
| 151 | (∑ i, u z * spatialDeriv i (B i) z) + (C.zeroth z * u z) * φ z := by |
| 152 | congr 1 |
| 153 | funext z |
| 154 | simp only [Coefficients.adjoint, A, B, mul_add, mul_sub, mul_neg, Finset.mul_sum] |
| 155 | ring |
| 156 | _ = -(∫ z, u z * timeDeriv φ z) - |
| 157 | (∑ i, ∑ j, ∫ z, u z * spatialDeriv j (spatialDeriv i (A i j)) z) - |
| 158 | (∑ i, ∫ z, u z * spatialDeriv i (B i) z) + ∫ z, (C.zeroth z * u z) * φ z := by |
| 159 | have h1 := integral_add ((hLt.neg.sub hLas).sub hLbs) hc |
| 160 | have h2 := integral_sub (hLt.neg.sub hLas) hLbs |
| 161 | have h3 := integral_sub hLt.neg hLas |
| 162 | simp only [Pi.sub_apply, Pi.neg_apply] at h1 h2 h3 |
| 163 | rw [h1, h2, h3, integral_neg] |
| 164 | rw [integral_finsetSum _ (fun i _ => sumI _ (hLa i)), |
| 165 | integral_finsetSum _ (fun i _ => hLb i)] |
| 166 | simp_rw [integral_finsetSum _ (fun j _ => hLa _ j)] |
| 167 | _ = (∫ z, timeDeriv u z * φ z) - |
| 168 | (∑ i, ∑ j, ∫ z, spatialDeriv i (spatialDeriv j u) z * A i j z) + |
| 169 | (∑ i, ∫ z, spatialDeriv i u z * B i z) + ∫ z, (C.zeroth z * u z) * φ z := by |
| 170 | simp only [ht, ha, hb, Finset.sum_neg_distrib] |
| 171 | ring |
| 172 | _ = ∫ z, timeDeriv u z * φ z - |
| 173 | (∑ i, ∑ j, spatialDeriv i (spatialDeriv j u) z * A i j z) + |
| 174 | (∑ i, spatialDeriv i u z * B i z) + (C.zeroth z * u z) * φ z := by |
| 175 | have h1 := integral_add ((hRt.sub hRas).add hRbs) hc |
| 176 | have h2 := integral_add (hRt.sub hRas) hRbs |
| 177 | have h3 := integral_sub hRt hRas |
| 178 | simp only [Pi.add_apply, Pi.sub_apply] at h1 h2 h3 |
| 179 | rw [h1, h2, h3] |
| 180 | rw [integral_finsetSum _ (fun i _ => sumI _ (hRa i)), |
| 181 | integral_finsetSum _ (fun i _ => hRb i)] |
| 182 | simp_rw [integral_finsetSum _ (fun j _ => hRa _ j)] |
| 183 | _ = ∫ z, φ z * C.operator u z := by |
| 184 | congr 1 |
| 185 | funext z |
| 186 | simp only [Coefficients.operator, A, B, mul_add, mul_sub, Finset.mul_sum] |
| 187 | simp only [mul_comm, mul_left_comm] |
| 188 | |
| 189 | theorem weakSolutionOn_iff_operator_eq_zero {n : ℕ} {U : Set (Spacetime n)} |
| 190 | (hU : IsOpen U) (C : Coefficients n) (hC : C.IsSmoothOn U) |
| 191 | {u : Spacetime n → ℝ} (hu : ContDiffOn ℝ ∞ u U) : |
| 192 | WeakSolutionOn C u U ↔ ∀ z ∈ U, C.operator u z = 0 := by |
| 193 | have hsd {f : Spacetime n → ℝ} (hf : ContDiffOn ℝ ∞ f U) (i : Fin n) : |
| 194 | ContDiffOn ℝ ∞ (spatialDeriv i f) U := smooth_directional hU hf _ |
| 195 | have ht : ContDiffOn ℝ ∞ (timeDeriv u) U := smooth_directional hU hu _ |
| 196 | have ha : ContDiffOn ℝ ∞ |
| 197 | (fun z => ∑ i, ∑ j, C.principal i j z * spatialDeriv i (spatialDeriv j u) z) U := by |
| 198 | apply ContDiffOn.sum |
| 199 | intro i _ |
| 200 | apply ContDiffOn.sum |
| 201 | intro j _ |
| 202 | exact (hC.1 i j).mul (hsd (hsd hu j) i) |
| 203 | have hb : ContDiffOn ℝ ∞ (fun z => ∑ i, C.drift i z * spatialDeriv i u z) U := by |
| 204 | apply ContDiffOn.sum |
| 205 | intro i _ |
| 206 | exact (hC.2.1 i).mul (hsd hu i) |
| 207 | have hp : ContinuousOn (C.operator u) U := |
| 208 | (((ht.sub ha).add hb).add (hC.2.2.mul hu)).continuousOn |
| 209 | constructor |
| 210 | · intro hw |
| 211 | have hae : ∀ᵐ z ∂volume, z ∈ U → C.operator u z = 0 := by |
| 212 | apply hU.ae_eq_zero_of_integral_contDiff_smul_eq_zero |
| 213 | (hp.locallyIntegrableOn hU.measurableSet) |
| 214 | intro φ hφ hφc hφU |
| 215 | simpa only [smul_eq_mul] using |
| 216 | (integral_adjoint_eq hU C hC hu hφ hφc hφU).symm.trans |
| 217 | (hw.2 φ hφ hφc hφU) |
| 218 | exact Measure.eqOn_open_of_ae_eq ((ae_restrict_iff' hU.measurableSet).2 hae) |
| 219 | hU hp continuousOn_const |
| 220 | · intro hz |
| 221 | refine ⟨hu.continuousOn.locallyIntegrableOn hU.measurableSet, ?_⟩ |
| 222 | intro φ hφ hφc hφU |
| 223 | rw [integral_adjoint_eq hU C hC hu hφ hφc hφU] |
| 224 | apply integral_eq_zero_of_ae |
| 225 | filter_upwards [] with z |
| 226 | by_cases hzu : z ∈ U |
| 227 | · simp only [hz z hzu, mul_zero, Pi.zero_apply] |
| 228 | · simp only [image_eq_zero_of_notMem_tsupport (fun hs => hzu (hφU hs)), |
| 229 | zero_mul, Pi.zero_apply] |
| 230 | |
| 231 | end Poincare.Analysis.Parabolic.WeakRegularity.Canonical |
| 232 |