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.Parabolic.WeakRegularity.CanonicalEquation |
| 2 | import PoincareLib.Analysis.Parabolic.WeakRegularity.Smooth |
| 3 | import Mathlib.Analysis.Calculus.FDeriv.CompCLM |
| 4 | import Mathlib.Analysis.Calculus.FDeriv.Mul |
| 5 | |
| 6 | /-! |
| 7 | # The canonical equation for a diffusion density |
| 8 | |
| 9 | Expanding the spatial divergences converts the weak forward equation into |
| 10 | the canonical parabolic equation. The adjoint is computed from the actual |
| 11 | coefficients, so its test pairing contains only derivatives of the test. |
| 12 | This is the coordinate density equation used in Morgan--Tian, |
| 13 | Proposition 9.20, Clay edition, pp. 188--198. |
| 14 | -/ |
| 15 | |
| 16 | noncomputable section |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Filter MeasureTheory |
| 20 | open scoped ContDiff Topology |
| 21 | |
| 22 | namespace Poincare.Analysis.Parabolic.WeakRegularity.Canonical |
| 23 | |
| 24 | variable {n : ℕ} {U : Set (Spacetime n)} |
| 25 | |
| 26 | private theorem smooth_spatial (hU : IsOpen U) {f : Spacetime n → ℝ} |
| 27 | (hf : ContDiffOn ℝ ∞ f U) (i : Fin n) : |
| 28 | ContDiffOn ℝ ∞ (spatialDeriv i f) U := |
| 29 | (hf.fderiv_of_isOpen hU (by simp)).clm_apply contDiffOn_const |
| 30 | |
| 31 | private theorem spatial_mul {f g : Spacetime n → ℝ} {z : Spacetime n} |
| 32 | (hf : DifferentiableAt ℝ f z) (hg : DifferentiableAt ℝ g z) (i : Fin n) : |
| 33 | spatialDeriv i (fun y => f y * g y) z = |
| 34 | spatialDeriv i f z * g z + f z * spatialDeriv i g z := by |
| 35 | simp only [spatialDeriv, fderiv_fun_mul hf hg, add_apply, |
| 36 | smul_apply, smul_eq_mul] |
| 37 | ring |
| 38 | |
| 39 | private theorem spatial_add {f g : Spacetime n → ℝ} {z : Spacetime n} |
| 40 | (hf : DifferentiableAt ℝ f z) (hg : DifferentiableAt ℝ g z) (i : Fin n) : |
| 41 | spatialDeriv i (fun y => f y + g y) z = |
| 42 | spatialDeriv i f z + spatialDeriv i g z := by |
| 43 | simp only [spatialDeriv, fderiv_fun_add hf hg, add_apply] |
| 44 | |
| 45 | private theorem spatial_mul_second (hU : IsOpen U) {f g : Spacetime n → ℝ} |
| 46 | (hf : ContDiffOn ℝ ∞ f U) (hg : ContDiffOn ℝ ∞ g U) |
| 47 | {z : Spacetime n} (hz : z ∈ U) (i j : Fin n) : |
| 48 | spatialDeriv j (spatialDeriv i (fun y => f y * g y)) z = |
| 49 | spatialDeriv j (spatialDeriv i f) z * g z + |
| 50 | spatialDeriv i f z * spatialDeriv j g z + |
| 51 | spatialDeriv j f z * spatialDeriv i g z + |
| 52 | f z * spatialDeriv j (spatialDeriv i g) z := by |
| 53 | have hdiff {v : Spacetime n → ℝ} (hv : ContDiffOn ℝ ∞ v U) : |
| 54 | DifferentiableAt ℝ v z := (hv.contDiffAt (hU.mem_nhds hz)).differentiableAt (by simp) |
| 55 | have heq : spatialDeriv i (fun y => f y * g y) =ᶠ[𝓝 z] |
| 56 | (fun y => spatialDeriv i f y * g y + f y * spatialDeriv i g y) := by |
| 57 | filter_upwards [hU.mem_nhds hz] with y hy |
| 58 | exact spatial_mul ((hf.contDiffAt (hU.mem_nhds hy)).differentiableAt (by simp)) |
| 59 | ((hg.contDiffAt (hU.mem_nhds hy)).differentiableAt (by simp)) i |
| 60 | unfold spatialDeriv at heq ⊢ |
| 61 | rw [heq.fderiv_eq] |
| 62 | change spatialDeriv j (fun y => spatialDeriv i f y * g y + |
| 63 | f y * spatialDeriv i g y) z = _ |
| 64 | rw [spatial_add (f := fun y => spatialDeriv i f y * g y) |
| 65 | (g := fun y => f y * spatialDeriv i g y) |
| 66 | ((hdiff (smooth_spatial hU hf i)).fun_mul (hdiff hg)) |
| 67 | ((hdiff hf).fun_mul (hdiff (smooth_spatial hU hg i))) j, |
| 68 | spatial_mul (hdiff (smooth_spatial hU hf i)) (hdiff hg), |
| 69 | spatial_mul (hdiff hf) (hdiff (smooth_spatial hU hg i))] |
| 70 | simp only [spatialDeriv] |
| 71 | change (fderiv ℝ (fun y => fderiv ℝ f y (spatialDirection i)) z (spatialDirection j)) * g z + |
| 72 | fderiv ℝ f z (spatialDirection i) * fderiv ℝ g z (spatialDirection j) + |
| 73 | (fderiv ℝ f z (spatialDirection j) * fderiv ℝ g z (spatialDirection i) + |
| 74 | f z * fderiv ℝ (fun y => fderiv ℝ g y (spatialDirection i)) z (spatialDirection j)) = _ |
| 75 | ring |
| 76 | |
| 77 | /-- Coefficients of the forward equation with diffusion matrix `a` and drift |
| 78 | `b`. The zeroth term is written using the divergence of the expanded drift. -/ |
| 79 | def forwardCoefficients (a : Fin n → Fin n → Spacetime n → ℝ) |
| 80 | (b : Fin n → Spacetime n → ℝ) : Coefficients n where |
| 81 | principal := a |
| 82 | drift i z := b i z - ∑ j, (spatialDeriv j (a i j) z + spatialDeriv j (a j i) z) |
| 83 | zeroth z := |
| 84 | (∑ i, spatialDeriv i (fun y => b i y - |
| 85 | ∑ j, (spatialDeriv j (a i j) y + spatialDeriv j (a j i) y)) z) + |
| 86 | ∑ i, ∑ j, spatialDeriv j (spatialDeriv i (a i j)) z |
| 87 | |
| 88 | theorem forwardCoefficients_smooth (hU : IsOpen U) |
| 89 | {a : Fin n → Fin n → Spacetime n → ℝ} {b : Fin n → Spacetime n → ℝ} |
| 90 | (ha : ∀ i j, ContDiffOn ℝ ∞ (a i j) U) |
| 91 | (hb : ∀ i, ContDiffOn ℝ ∞ (b i) U) : |
| 92 | (forwardCoefficients a b).IsSmoothOn U := by |
| 93 | have hd (i) : ContDiffOn ℝ ∞ ((forwardCoefficients a b).drift i) U := by |
| 94 | apply (hb i).sub |
| 95 | apply ContDiffOn.sum |
| 96 | intro j _ |
| 97 | exact (smooth_spatial hU (ha i j) j).add (smooth_spatial hU (ha j i) j) |
| 98 | refine ⟨ha, hd, ?_⟩ |
| 99 | apply ContDiffOn.add |
| 100 | · apply ContDiffOn.sum |
| 101 | intro i _ |
| 102 | exact smooth_spatial hU (hd i) i |
| 103 | · apply ContDiffOn.sum |
| 104 | intro i _ |
| 105 | apply ContDiffOn.sum |
| 106 | intro j _ |
| 107 | exact smooth_spatial hU (smooth_spatial hU (ha i j) i) j |
| 108 | |
| 109 | theorem forwardCoefficients_adjoint (hU : IsOpen U) |
| 110 | {a : Fin n → Fin n → Spacetime n → ℝ} {b : Fin n → Spacetime n → ℝ} |
| 111 | (ha : ∀ i j, ContDiffOn ℝ ∞ (a i j) U) |
| 112 | (hb : ∀ i, ContDiffOn ℝ ∞ (b i) U) |
| 113 | {φ : Spacetime n → ℝ} (hφ : ContDiffOn ℝ ∞ φ U) |
| 114 | {z : Spacetime n} (hz : z ∈ U) : |
| 115 | (forwardCoefficients a b).adjoint φ z = |
| 116 | -timeDeriv φ z - (∑ i, ∑ j, a i j z * spatialDeriv j (spatialDeriv i φ) z) - |
| 117 | ∑ i, b i z * spatialDeriv i φ z := by |
| 118 | have hd := (forwardCoefficients_smooth hU ha hb).2.1 |
| 119 | have hfirst (i) := spatial_mul |
| 120 | ((hd i).contDiffAt (hU.mem_nhds hz) |>.differentiableAt (by simp)) |
| 121 | (hφ.contDiffAt (hU.mem_nhds hz) |>.differentiableAt (by simp)) i |
| 122 | have hcross : (∑ i, ∑ j, spatialDeriv i (a i j) z * spatialDeriv j φ z) = |
| 123 | ∑ i, ∑ j, spatialDeriv j (a j i) z * spatialDeriv i φ z := by |
| 124 | rw [Finset.sum_comm] |
| 125 | simp only [Coefficients.adjoint, hfirst] |
| 126 | dsimp only [forwardCoefficients] |
| 127 | simp only [spatial_mul_second hU (ha _ _) hφ hz, Finset.sum_add_distrib, |
| 128 | Finset.sum_sub_distrib, Finset.sum_mul, sub_mul, add_mul] |
| 129 | rw [hcross] |
| 130 | ring |
| 131 | |
| 132 | /-- The adjoint is local even where its coefficient functions need not be |
| 133 | smooth: each term vanishes off the support of the test. -/ |
| 134 | theorem Coefficients.adjoint_eq_zero_of_notMem_tsupport (C : Coefficients n) |
| 135 | (φ : Spacetime n → ℝ) {z : Spacetime n} (hz : z ∉ tsupport φ) : |
| 136 | C.adjoint φ z = 0 := by |
| 137 | have hd {f : Spacetime n → ℝ} (hs : tsupport f ⊆ tsupport φ) |
| 138 | (v : Spacetime n) : fderiv ℝ f z v = 0 := |
| 139 | image_eq_zero_of_notMem_tsupport (f := fun x => fderiv ℝ f x v) (fun h => hz (hs |
| 140 | (tsupport_fderiv_apply_subset ℝ v h))) |
| 141 | have ha (i j : Fin n) : |
| 142 | spatialDeriv j (spatialDeriv i (fun y => C.principal i j y * φ y)) z = 0 := by |
| 143 | apply hd (v := spatialDirection j) |
| 144 | exact (tsupport_fderiv_apply_subset ℝ (spatialDirection i)).trans tsupport_mul_subset_right |
| 145 | have hb (i : Fin n) : spatialDeriv i (fun y => C.drift i y * φ y) z = 0 := |
| 146 | hd tsupport_mul_subset_right _ |
| 147 | simp only [Coefficients.adjoint, ha, hb, Finset.sum_const_zero, |
| 148 | timeDeriv, hd Subset.rfl, image_eq_zero_of_notMem_tsupport hz] |
| 149 | ring |
| 150 | |
| 151 | /-- A continuous weak forward density is smooth when the diffusion symbol |
| 152 | is pointwise positive. The pairing uses the diffusion test operator. -/ |
| 153 | theorem contDiffOn_of_weak_forward_equation (hU : IsOpen U) |
| 154 | {a : Fin n → Fin n → Spacetime n → ℝ} {b : Fin n → Spacetime n → ℝ} |
| 155 | (ha : ∀ i j, ContDiffOn ℝ ∞ (a i j) U) |
| 156 | (hb : ∀ i, ContDiffOn ℝ ∞ (b i) U) |
| 157 | (hpos : ∀ z ∈ U, ∀ ξ : Euclid n, ξ ≠ 0 → |
| 158 | 0 < ∑ i, ∑ j, a i j z * ξ i * ξ j) |
| 159 | {u : Spacetime n → ℝ} (hu : ContinuousOn u U) |
| 160 | (hw : ∀ φ : Spacetime n → ℝ, ContDiff ℝ ∞ φ → HasCompactSupport φ → |
| 161 | tsupport φ ⊆ U → |
| 162 | (∫ z in U, u z * (-timeDeriv φ z - |
| 163 | (∑ i, ∑ j, a i j z * spatialDeriv j (spatialDeriv i φ) z) - |
| 164 | ∑ i, b i z * spatialDeriv i φ z)) = 0) : |
| 165 | ContDiffOn ℝ ∞ u U := by |
| 166 | apply contDiffOn_of_continuous_weakSolution_positive hU |
| 167 | (C := forwardCoefficients a b) (forwardCoefficients_smooth hU ha hb) hpos hu |
| 168 | refine ⟨hu.locallyIntegrableOn hU.measurableSet, ?_⟩ |
| 169 | intro φ hφ hφc hφU |
| 170 | calc |
| 171 | (∫ z, u z * (forwardCoefficients a b).adjoint φ z) = |
| 172 | ∫ z in U, u z * (forwardCoefficients a b).adjoint φ z := by |
| 173 | symm |
| 174 | apply setIntegral_eq_integral_of_forall_compl_eq_zero |
| 175 | intro z hz |
| 176 | rw [Coefficients.adjoint_eq_zero_of_notMem_tsupport _ _ |
| 177 | (fun hs => hz (hφU hs)), mul_zero] |
| 178 | _ = ∫ z in U, u z * (-timeDeriv φ z - |
| 179 | (∑ i, ∑ j, a i j z * spatialDeriv j (spatialDeriv i φ) z) - |
| 180 | ∑ i, b i z * spatialDeriv i φ z) := by |
| 181 | apply setIntegral_congr_fun hU.measurableSet |
| 182 | intro z hz |
| 183 | dsimp only |
| 184 | rw [forwardCoefficients_adjoint hU ha hb hφ.contDiffOn hz] |
| 185 | _ = 0 := hw φ hφ hφc hφU |
| 186 | |
| 187 | end Poincare.Analysis.Parabolic.WeakRegularity.Canonical |