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.Geometry.RicciFlow.Local.Energy.Localization.CoordinateIntegration |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Existence.Imports.Geometry.RicciFlow.Local.Energy.Localization.CoordinateIntegration |
| 3 | |
| 4 | /-! |
| 5 | # A quantitative localized elliptic energy estimate |
| 6 | |
| 7 | This is the actual integration-by-parts calculation of lower M03's |
| 8 | LocalizedEllipticEnergy, with the cutoff-gradient contraction bound supplied |
| 9 | explicitly. Thus its constant precedes any family of coefficient fields. |
| 10 | It is used in the noncompact energy argument for Morgan-Tian Section 12.5, |
| 11 | pp. 309-319; see the countable-energy and rotation-invariance derivations. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open scoped ContDiff Topology BigOperators |
| 17 | open MeasureTheory Set PoincareMT.Proofs.M03 |
| 18 | |
| 19 | /-- An explicit cutoff-gradient contraction bound gives a localized elliptic |
| 20 | energy estimate with constant `(2 / lambda) * C0`, independently of any |
| 21 | index labeling the coefficients (Section 12.5, pp. 309-319). -/ |
| 22 | theorem localized_elliptic_energy_le_of_cutoff_bound |
| 23 | {n : ℕ} {V : Set (EuclideanSpace ℝ (Fin n))} (hV : IsOpen V) |
| 24 | {a : EuclideanSpace ℝ (Fin n) → Fin n → Fin n → ℝ} |
| 25 | (ha : ∀ i j, ContDiffOn ℝ 1 (fun x => a x i j) V) |
| 26 | {φ : EuclideanSpace ℝ (Fin n) → ℝ} |
| 27 | (hφ : ContDiff ℝ 1 φ) (hφc : HasCompactSupport φ) |
| 28 | (hφV : tsupport φ ⊆ V) {lambda C0 : ℝ} (hlambda : 0 < lambda) |
| 29 | (haell : ∀ x ∈ tsupport φ, ∀ z : Fin n → ℝ, |
| 30 | lambda * (∑ i, z i ^ 2) ≤ ∑ i, ∑ j, a x i j * z i * z j) |
| 31 | (hbound : ∀ x ∈ tsupport φ, |
| 32 | (∑ j, (∑ i, fderiv ℝ φ x (EuclideanSpace.single i 1) * a x i j) ^ 2) ≤ C0) |
| 33 | {f : EuclideanSpace ℝ (Fin n) → ℝ} (hf : ContDiffOn ℝ 2 f V) : |
| 34 | letI : MeasurableSpace (EuclideanSpace ℝ (Fin n)) := borel _ |
| 35 | letI : BorelSpace (EuclideanSpace ℝ (Fin n)) := ⟨rfl⟩ |
| 36 | (∫ x, φ x ^ 2 * f x * |
| 37 | ∑ i, fderiv ℝ |
| 38 | (fun y => ∑ j, a y i j * fderiv ℝ f y (EuclideanSpace.single j 1)) |
| 39 | x (EuclideanSpace.single i 1)) ≤ |
| 40 | -(lambda / 2) * (∫ x, φ x ^ 2 * |
| 41 | ∑ i, (fderiv ℝ f x (EuclideanSpace.single i 1)) ^ 2) + |
| 42 | ((2 / lambda) * C0) * (∫ x in tsupport φ, f x ^ 2) := by |
| 43 | let : MeasurableSpace (EuclideanSpace ℝ (Fin n)) := borel _ |
| 44 | let : BorelSpace (EuclideanSpace ℝ (Fin n)) := ⟨rfl⟩ |
| 45 | classical |
| 46 | let e (i : Fin n) : EuclideanSpace ℝ (Fin n) := EuclideanSpace.single i 1 |
| 47 | let B (j : Fin n) (x : EuclideanSpace ℝ (Fin n)) : ℝ := |
| 48 | ∑ i, fderiv ℝ φ x (e i) * a x i j |
| 49 | let S (x : EuclideanSpace ℝ (Fin n)) : ℝ := ∑ j, B j x ^ 2 |
| 50 | have hφd (i : Fin n) : Continuous (fun x => fderiv ℝ φ x (e i)) := |
| 51 | (hφ.continuous_fderiv (by decide)).clm_apply continuous_const |
| 52 | let C : ℝ := (2 / lambda) * C0 |
| 53 | let p (i : Fin n) (x : EuclideanSpace ℝ (Fin n)) : ℝ := fderiv ℝ f x (e i) |
| 54 | let q (i : Fin n) (x : EuclideanSpace ℝ (Fin n)) : ℝ := ∑ j, a x i j * p j x |
| 55 | have hp (i : Fin n) : ContDiffOn ℝ 1 (p i) V := |
| 56 | (hf.fderiv_of_isOpen hV (by norm_num)).clm_apply contDiffOn_const |
| 57 | have hq (i : Fin n) : ContDiffOn ℝ 1 (q i) V := |
| 58 | ContDiffOn.sum (fun j _ => (ha i j).mul (hp j)) |
| 59 | have hf1 : ContDiffOn ℝ 1 f V := hf.of_le (by norm_num) |
| 60 | have hpatch : ∀ Q : EuclideanSpace ℝ (Fin n) → ℝ, ContinuousOn Q V → |
| 61 | (∀ x ∉ tsupport φ, Q x = 0) → Integrable Q := by |
| 62 | intro Q hQ hzero |
| 63 | have hQc : HasCompactSupport Q := by |
| 64 | apply hφc.mono' |
| 65 | intro x hx |
| 66 | by_contra hxφ |
| 67 | exact hx (hzero x hxφ) |
| 68 | have hQc' : Continuous Q := by |
| 69 | apply continuous_iff_continuousAt.mpr |
| 70 | intro x |
| 71 | by_cases hx : x ∈ V |
| 72 | · exact hQ.continuousAt (hV.mem_nhds hx) |
| 73 | · have hxφ : x ∈ (tsupport φ)ᶜ := fun h => hx (hφV h) |
| 74 | apply (show ContinuousAt (fun _ : EuclideanSpace ℝ (Fin n) => (0 : ℝ)) x from |
| 75 | continuousAt_const).congr_of_eventuallyEq |
| 76 | filter_upwards [(isClosed_tsupport φ).isOpen_compl.mem_nhds hxφ] with y hy |
| 77 | exact hzero y hy |
| 78 | exact hQc'.integrable_of_hasCompactSupport hQc |
| 79 | let L (i : Fin n) (x : EuclideanSpace ℝ (Fin n)) : ℝ := |
| 80 | φ x ^ 2 * f x * fderiv ℝ (q i) x (e i) |
| 81 | let R (i : Fin n) (x : EuclideanSpace ℝ (Fin n)) : ℝ := |
| 82 | (φ x ^ 2 * p i x + 2 * φ x * fderiv ℝ φ x (e i) * f x) * q i x |
| 83 | let G (x : EuclideanSpace ℝ (Fin n)) : ℝ := φ x ^ 2 * ∑ i, p i x ^ 2 |
| 84 | have hLi (i : Fin n) : Integrable (L i) := hpatch _ |
| 85 | (((hφ.continuous.continuousOn.pow 2).mul hf.continuousOn).mul |
| 86 | (((hq i).continuousOn_fderiv_of_isOpen hV le_rfl).clm_apply continuousOn_const)) |
| 87 | (fun x hx => by simp [L, image_eq_zero_of_notMem_tsupport hx]) |
| 88 | have hRi (i : Fin n) : Integrable (R i) := hpatch _ |
| 89 | ((((hφ.continuous.continuousOn.pow 2).mul (hp i).continuousOn).add |
| 90 | (((continuousOn_const.mul hφ.continuous.continuousOn).mul |
| 91 | (hφd i).continuousOn).mul hf.continuousOn)).mul (hq i).continuousOn) |
| 92 | (fun x hx => by simp [R, image_eq_zero_of_notMem_tsupport hx]) |
| 93 | have hGi : Integrable G := hpatch _ |
| 94 | ((hφ.continuous.continuousOn.pow 2).mul |
| 95 | (continuousOn_finsetSum _ (fun i _ => (hp i).continuousOn.pow 2))) |
| 96 | (fun x hx => by simp [G, image_eq_zero_of_notMem_tsupport hx]) |
| 97 | have hKi : Integrable ((tsupport φ).indicator (fun x => f x ^ 2)) := |
| 98 | (ContinuousOn.integrableOn_compact hφc |
| 99 | ((hf.continuousOn.pow 2).mono hφV)).integrable_indicator (isClosed_tsupport φ).measurableSet |
| 100 | have hibp (i : Fin n) : (∫ x, L i x) = -(∫ x, R i x) := |
| 101 | integral_localized_mul_fderiv hV hf1 (hq i) hφ hφc hφV (e i) |
| 102 | have hsum : (∫ x, ∑ i, L i x) = -(∫ x, ∑ i, R i x) := by |
| 103 | rw [integral_finsetSum _ (fun i _ => hLi i), integral_finsetSum _ (fun i _ => hRi i)] |
| 104 | simp only [hibp, Finset.sum_neg_distrib] |
| 105 | have hRform (x : EuclideanSpace ℝ (Fin n)) : (∑ i, R i x) = |
| 106 | φ x ^ 2 * (∑ i, ∑ j, a x i j * p i x * p j x) + |
| 107 | 2 * φ x * f x * (∑ j, B j x * p j x) := by |
| 108 | have hcross : (∑ i, ∑ j, fderiv ℝ φ x (e i) * a x i j * p j x) = |
| 109 | ∑ j, B j x * p j x := by |
| 110 | rw [Finset.sum_comm] |
| 111 | simp only [B, Finset.sum_mul] |
| 112 | calc |
| 113 | (∑ i, R i x) = ∑ i, ∑ j, |
| 114 | (φ x ^ 2 * (a x i j * p i x * p j x) + |
| 115 | 2 * φ x * f x * (fderiv ℝ φ x (e i) * a x i j * p j x)) := by |
| 116 | apply Finset.sum_congr rfl |
| 117 | intro i _ |
| 118 | dsimp only [R, q] |
| 119 | rw [Finset.mul_sum] |
| 120 | apply Finset.sum_congr rfl |
| 121 | intro j _ |
| 122 | ring |
| 123 | _ = φ x ^ 2 * (∑ i, ∑ j, a x i j * p i x * p j x) + |
| 124 | 2 * φ x * f x * (∑ i, ∑ j, fderiv ℝ φ x (e i) * a x i j * p j x) := by |
| 125 | simp only [Finset.sum_add_distrib, Finset.mul_sum] |
| 126 | _ = _ := by rw [hcross] |
| 127 | have hyoung (u v : ℝ) : -2 * u * v ≤ lambda / 2 * u ^ 2 + (2 / lambda) * v ^ 2 := by |
| 128 | apply (mul_le_mul_iff_left₀ (show 0 < 2 * lambda by positivity)).mp |
| 129 | field_simp |
| 130 | nlinarith [sq_nonneg (lambda * u + 2 * v)] |
| 131 | have hpoint : ∀ x, -(∑ i, R i x) ≤ -(lambda / 2) * G x + |
| 132 | C * (tsupport φ).indicator (fun y => f y ^ 2) x := by |
| 133 | intro x |
| 134 | by_cases hx : x ∈ tsupport φ |
| 135 | · have hell := mul_le_mul_of_nonneg_left (haell x hx (fun i => p i x)) (sq_nonneg (φ x)) |
| 136 | have herror : -2 * φ x * f x * (∑ j, B j x * p j x) ≤ |
| 137 | lambda / 2 * G x + (2 / lambda) * f x ^ 2 * S x := by |
| 138 | calc |
| 139 | -2 * φ x * f x * (∑ j, B j x * p j x) = |
| 140 | ∑ j, -2 * (φ x * p j x) * (f x * B j x) := by |
| 141 | rw [Finset.mul_sum] |
| 142 | apply Finset.sum_congr rfl |
| 143 | intro j _ |
| 144 | ring |
| 145 | _ ≤ ∑ j, (lambda / 2 * (φ x * p j x) ^ 2 + |
| 146 | (2 / lambda) * (f x * B j x) ^ 2) := |
| 147 | Finset.sum_le_sum (fun j _ => hyoung (φ x * p j x) (f x * B j x)) |
| 148 | _ = _ := by |
| 149 | dsimp only [G, S] |
| 150 | simp only [mul_pow, Finset.sum_add_distrib, Finset.mul_sum] |
| 151 | congr 1 |
| 152 | apply Finset.sum_congr rfl |
| 153 | intro j _ |
| 154 | ring |
| 155 | have hrem : (2 / lambda) * f x ^ 2 * S x ≤ C * f x ^ 2 := by |
| 156 | have h := mul_le_mul_of_nonneg_left (hbound x hx) |
| 157 | (mul_nonneg (div_nonneg (by norm_num : (0 : ℝ) ≤ 2) hlambda.le) (sq_nonneg (f x))) |
| 158 | change (2 / lambda) * f x ^ 2 * S x ≤ (2 / lambda) * C0 * f x ^ 2 |
| 159 | change (2 / lambda * f x ^ 2) * S x ≤ (2 / lambda * f x ^ 2) * C0 at h |
| 160 | nlinarith only [h] |
| 161 | rw [hRform, indicator_of_mem hx] |
| 162 | dsimp only [G] at herror ⊢ |
| 163 | nlinarith only [hell, herror, hrem] |
| 164 | · simp [R, G, indicator_of_notMem hx, image_eq_zero_of_notMem_tsupport hx] |
| 165 | change (∫ x, φ x ^ 2 * f x * ∑ i, fderiv ℝ (q i) x (e i)) ≤ |
| 166 | -(lambda / 2) * (∫ x, G x) + C * (∫ x in tsupport φ, f x ^ 2) |
| 167 | have hleft : (∫ x, φ x ^ 2 * f x * ∑ i, fderiv ℝ (q i) x (e i)) = |
| 168 | ∫ x, ∑ i, L i x := by |
| 169 | apply integral_congr_ae |
| 170 | filter_upwards with x |
| 171 | simp only [L, Finset.mul_sum] |
| 172 | rw [hleft, hsum, ← integral_neg] |
| 173 | calc |
| 174 | (∫ x, -(∑ i, R i x)) ≤ ∫ x, -(lambda / 2) * G x + |
| 175 | C * (tsupport φ).indicator (fun y => f y ^ 2) x := |
| 176 | integral_mono (integrable_finsetSum _ (fun i _ => hRi i)).neg |
| 177 | ((hGi.const_mul _).add (hKi.const_mul _)) hpoint |
| 178 | _ = _ := by |
| 179 | rw [integral_add (hGi.const_mul _) (hKi.const_mul _), |
| 180 | integral_const_mul, integral_const_mul, |
| 181 | integral_indicator (isClosed_tsupport φ).measurableSet] |
| 182 | |
| 183 | /-- A single entry bound on any coefficient field gives a common bound on |
| 184 | its contraction with a fixed compact cutoff gradient. No regularity or |
| 185 | compactness of the coefficient family is needed (Section 12.5, pp. 309-319). -/ |
| 186 | theorem exists_uniform_cutoff_contraction_bound |
| 187 | {n : ℕ} {φ : EuclideanSpace ℝ (Fin n) → ℝ} |
| 188 | (hφ : ContDiff ℝ 1 φ) (hφc : HasCompactSupport φ) |
| 189 | {M : ℝ} (hM : 0 ≤ M) : |
| 190 | ∃ C0 : ℝ, 0 ≤ C0 ∧ |
| 191 | ∀ a : EuclideanSpace ℝ (Fin n) → Fin n → Fin n → ℝ, |
| 192 | (∀ x ∈ tsupport φ, ∀ i j, |a x i j| ≤ M) → ∀ x ∈ tsupport φ, |
| 193 | (∑ j, (∑ i, fderiv ℝ φ x (EuclideanSpace.single i 1) * a x i j) ^ 2) ≤ C0 := by |
| 194 | classical |
| 195 | let d (x : EuclideanSpace ℝ (Fin n)) (i : Fin n) := |
| 196 | fderiv ℝ φ x (EuclideanSpace.single i 1) |
| 197 | let S (x : EuclideanSpace ℝ (Fin n)) := ∑ i, d x i ^ 2 |
| 198 | have hd (i : Fin n) : Continuous (fun x => d x i) := |
| 199 | (hφ.continuous_fderiv (by decide)).clm_apply continuous_const |
| 200 | have hS : Continuous S := continuous_finsetSum _ (fun i _ => (hd i).pow 2) |
| 201 | obtain ⟨B, hB⟩ := hφc.exists_bound_of_continuousOn hS.continuousOn |
| 202 | let D := max B 0 |
| 203 | have hD : 0 ≤ D := le_max_right _ _ |
| 204 | have hSd (x : EuclideanSpace ℝ (Fin n)) (hx : x ∈ tsupport φ) : S x ≤ D := |
| 205 | (le_abs_self (S x)).trans ((hB x hx).trans (le_max_left _ _)) |
| 206 | refine ⟨(n : ℝ) ^ 2 * D * M ^ 2, by positivity, ?_⟩ |
| 207 | intro a ha x hx |
| 208 | have hcol (j : Fin n) : (∑ i, a x i j ^ 2) ≤ (n : ℝ) * M ^ 2 := by |
| 209 | calc |
| 210 | (∑ i, a x i j ^ 2) ≤ ∑ _i : Fin n, M ^ 2 := by |
| 211 | apply Finset.sum_le_sum |
| 212 | intro i _ |
| 213 | exact sq_le_sq.mpr (by simpa only [abs_of_nonneg hM] using ha x hx i j) |
| 214 | _ = _ := by simp |
| 215 | have hrow (j : Fin n) : (∑ i, d x i * a x i j) ^ 2 ≤ D * ((n : ℝ) * M ^ 2) := by |
| 216 | apply (Finset.sum_mul_sq_le_sq_mul_sq Finset.univ (d x) (fun i => a x i j)).trans |
| 217 | exact mul_le_mul (hSd x hx) (hcol j) (Finset.sum_nonneg (fun i _ => sq_nonneg _)) hD |
| 218 | change (∑ j, (∑ i, d x i * a x i j) ^ 2) ≤ _ |
| 219 | calc |
| 220 | _ ≤ ∑ _j : Fin n, D * ((n : ℝ) * M ^ 2) := Finset.sum_le_sum (fun j _ => hrow j) |
| 221 | _ = _ := by simp; ring |