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.InteriorEstimates.Embedding.Profile |
| 2 | import PoincareLib.Analysis.Elliptic.Regularity.Iteration.TestCalculus |
| 3 | |
| 4 | /-! |
| 5 | # Elementary calculus for derivative profiles |
| 6 | -/ |
| 7 | |
| 8 | noncomputable section |
| 9 | |
| 10 | set_option maxHeartbeats 800000 |
| 11 | |
| 12 | open MeasureTheory Set |
| 13 | open scoped ENNReal |
| 14 | open Poincare.Analysis.Sobolev.Euclidean |
| 15 | open Poincare.Analysis.Elliptic.Iteration |
| 16 | |
| 17 | namespace Poincare.Analysis.Elliptic.InteriorEstimates |
| 18 | |
| 19 | variable {d : ℕ} |
| 20 | local notation "E" => EuclideanSpace ℝ (Fin d) |
| 21 | |
| 22 | theorem derivativeProfile_mono_order {Ω : Set E} {p : ℝ≥0∞} {r s : ℕ} |
| 23 | (hrs : r ≤ s) (u : E → ℝ) : |
| 24 | derivativeProfile p Ω r u ≤ derivativeProfile p Ω s u := by |
| 25 | unfold derivativeProfile |
| 26 | exact Finset.sum_le_sum_of_subset_of_nonneg |
| 27 | (Finset.range_subset_range.mpr (Nat.add_le_add_right hrs 1)) |
| 28 | (fun i hi hn => zero_le) |
| 29 | |
| 30 | theorem derivativeProfile_mono_set {V W : Set E} (hWV : W ⊆ V) |
| 31 | (p : ℝ≥0∞) (r : ℕ) (u : E → ℝ) : |
| 32 | derivativeProfile p W r u ≤ derivativeProfile p V r u := by |
| 33 | unfold derivativeProfile |
| 34 | exact Finset.sum_le_sum fun j hj => |
| 35 | eLpNorm_mono_measure _ (Measure.restrict_mono hWV le_rfl) |
| 36 | |
| 37 | theorem derivativeProfile_add_le [NeZero d] {Ω : Set E} (_hΩ : IsOpen Ω) |
| 38 | {p : ℝ≥0∞} (hp : 1 ≤ p) (r : ℕ) {u v : E → ℝ} |
| 39 | (hu : ContDiff ℝ (⊤ : ℕ∞) u) (hv : ContDiff ℝ (⊤ : ℕ∞) v) : |
| 40 | derivativeProfile p Ω r (fun x => u x + v x) ≤ |
| 41 | derivativeProfile p Ω r u + derivativeProfile p Ω r v := by |
| 42 | classical |
| 43 | unfold derivativeProfile |
| 44 | rw [← Finset.sum_add_distrib] |
| 45 | apply Finset.sum_le_sum |
| 46 | intro j hj |
| 47 | have huj : ContDiff ℝ j u := hu.of_le (by exact_mod_cast le_top) |
| 48 | have hvj : ContDiff ℝ j v := hv.of_le (by exact_mod_cast le_top) |
| 49 | have hsum : (fun x => ‖iteratedFDeriv ℝ j (fun y => u y + v y) x‖) = |
| 50 | (fun x => ‖iteratedFDeriv ℝ j u x + iteratedFDeriv ℝ j v x‖) := by |
| 51 | funext x |
| 52 | exact congrArg norm (fun_iteratedFDeriv_add_apply huj.contDiffAt hvj.contDiffAt) |
| 53 | rw [hsum, eLpNorm_norm, eLpNorm_norm, eLpNorm_norm] |
| 54 | exact eLpNorm_add_le |
| 55 | (hu.continuous_iteratedFDeriv (by exact_mod_cast le_top)).aestronglyMeasurable |
| 56 | (hv.continuous_iteratedFDeriv (by exact_mod_cast le_top)).aestronglyMeasurable hp |
| 57 | |
| 58 | theorem derivativeProfile_finset_sum_le [NeZero d] {Ω : Set E} (hΩ : IsOpen Ω) |
| 59 | {p : ℝ≥0∞} (hp : 1 ≤ p) (r : ℕ) {ι : Type*} (s : Finset ι) |
| 60 | {u : ι → E → ℝ} (hu : ∀ i ∈ s, ContDiff ℝ (⊤ : ℕ∞) (u i)) : |
| 61 | derivativeProfile p Ω r (fun x => ∑ i ∈ s, u i x) ≤ |
| 62 | ∑ i ∈ s, derivativeProfile p Ω r (u i) := by |
| 63 | classical |
| 64 | induction s using Finset.induction_on with |
| 65 | | empty => simp [derivativeProfile] |
| 66 | | @insert i s hi ih => |
| 67 | have hsum := derivativeProfile_add_le hΩ hp r |
| 68 | (hu i (Finset.mem_insert_self i s)) |
| 69 | (by |
| 70 | simpa only [Finset.sum_insert hi] using |
| 71 | ContDiff.sum (fun j hj => hu j (Finset.mem_insert_of_mem hj))) |
| 72 | simpa only [Finset.sum_insert hi] using hsum.trans (add_le_add le_rfl |
| 73 | (ih (fun j hj => hu j (Finset.mem_insert_of_mem hj)))) |
| 74 | |
| 75 | theorem derivativeProfile_partial_le [NeZero d] {Ω : Set E} |
| 76 | {p : ℝ≥0∞} (r : ℕ) (i : Fin d) {u : E → ℝ} |
| 77 | (hu : ContDiff ℝ (⊤ : ℕ∞) u) : |
| 78 | derivativeProfile p Ω r (Iteration.partialDeriv i u) ≤ |
| 79 | derivativeProfile p Ω (r + 1) u := by |
| 80 | classical |
| 81 | unfold derivativeProfile |
| 82 | calc |
| 83 | ∑ j ∈ Finset.range (r + 1), |
| 84 | eLpNorm (fun x => ‖iteratedFDeriv ℝ j (Iteration.partialDeriv i u) x‖) p |
| 85 | (volume.restrict Ω) ≤ |
| 86 | ∑ j ∈ Finset.range (r + 1), |
| 87 | eLpNorm (fun x => ‖iteratedFDeriv ℝ (j + 1) u x‖) p |
| 88 | (volume.restrict Ω) := by |
| 89 | apply Finset.sum_le_sum |
| 90 | intro j hj |
| 91 | apply eLpNorm_mono_ae |
| 92 | exact Filter.Eventually.of_forall fun x => by |
| 93 | rw [norm_norm, norm_norm] |
| 94 | change ‖iteratedFDeriv ℝ j (fun y => (fderiv ℝ u y) (EuclideanSpace.single i 1)) x‖ ≤ _ |
| 95 | exact norm_iteratedFDeriv_partial_le hu i j x |
| 96 | _ ≤ ∑ j ∈ Finset.range (r + 1 + 1), |
| 97 | eLpNorm (fun x => ‖iteratedFDeriv ℝ j u x‖) p (volume.restrict Ω) := by |
| 98 | rw [Finset.sum_range_succ' (n := r + 1)] |
| 99 | exact le_self_add |
| 100 | |
| 101 | /-- The full next derivative is controlled by the derivatives of the coordinate |
| 102 | partials. Expansion in the Euclidean basis gives the constant one. -/ |
| 103 | theorem norm_iteratedFDeriv_succ_le_sum_partial {u : E → ℝ} |
| 104 | (hu : ContDiff ℝ (⊤ : ℕ∞) u) (r : ℕ) (x : E) : |
| 105 | ‖iteratedFDeriv ℝ (r + 1) u x‖ ≤ |
| 106 | ∑ i : Fin d, ‖iteratedFDeriv ℝ r (Iteration.partialDeriv i u) x‖ := by |
| 107 | classical |
| 108 | have hfd : ContDiff ℝ (⊤ : ℕ∞) (fderiv ℝ u) := |
| 109 | hu.fderiv_right (m := (⊤ : ℕ∞)) (by simp) |
| 110 | rw [← norm_iteratedFDeriv_fderiv] |
| 111 | apply ContinuousMultilinearMap.opNorm_le_bound |
| 112 | (Finset.sum_nonneg (fun i hi => norm_nonneg _)) |
| 113 | intro v |
| 114 | apply ContinuousLinearMap.opNorm_le_bound (iteratedFDeriv ℝ r (fderiv ℝ u) x v) |
| 115 | (mul_nonneg (Finset.sum_nonneg (fun i hi => norm_nonneg _)) |
| 116 | (Finset.prod_nonneg (fun i hi => norm_nonneg _))) |
| 117 | intro w |
| 118 | have h_expand : w = ∑ i : Fin d, w i • EuclideanSpace.single i (1 : ℝ) := by |
| 119 | have h := (EuclideanSpace.basisFun (Fin d) ℝ).sum_repr w |
| 120 | rw [show (fun i : Fin d => w i • EuclideanSpace.single i (1 : ℝ)) = |
| 121 | (fun i : Fin d => (EuclideanSpace.basisFun (Fin d) ℝ).repr w i • |
| 122 | (EuclideanSpace.basisFun (Fin d) ℝ) i) from ?_, h] |
| 123 | funext i |
| 124 | rw [EuclideanSpace.basisFun_repr, EuclideanSpace.basisFun_apply] |
| 125 | have happly (i : Fin d) : |
| 126 | iteratedFDeriv ℝ r (fderiv ℝ u) x v (EuclideanSpace.single i 1) = |
| 127 | iteratedFDeriv ℝ r (Iteration.partialDeriv i u) x v := by |
| 128 | exact (iteratedFDeriv_clm_apply_const_apply hfd |
| 129 | (by exact_mod_cast le_top)).symm |
| 130 | calc |
| 131 | ‖(iteratedFDeriv ℝ r (fderiv ℝ u) x v) w‖ = |
| 132 | ‖∑ i : Fin d, w i • iteratedFDeriv ℝ r (Iteration.partialDeriv i u) x v‖ := by |
| 133 | conv_lhs => rw [h_expand] |
| 134 | rw [map_sum] |
| 135 | congr 1 |
| 136 | apply Finset.sum_congr rfl |
| 137 | intro i hi |
| 138 | rw [map_smul, happly] |
| 139 | _ ≤ ∑ i : Fin d, ‖w i • iteratedFDeriv ℝ r (Iteration.partialDeriv i u) x v‖ := |
| 140 | norm_sum_le _ _ |
| 141 | _ ≤ ∑ i : Fin d, ‖w‖ * |
| 142 | (‖iteratedFDeriv ℝ r (Iteration.partialDeriv i u) x‖ * ∏ a, ‖v a‖) := by |
| 143 | apply Finset.sum_le_sum |
| 144 | intro i hi |
| 145 | rw [norm_smul] |
| 146 | exact mul_le_mul (PiLp.norm_apply_le w i) |
| 147 | ((iteratedFDeriv ℝ r (Iteration.partialDeriv i u) x).le_opNorm v) |
| 148 | (norm_nonneg _) (norm_nonneg _) |
| 149 | _ = (∑ i : Fin d, ‖iteratedFDeriv ℝ r (Iteration.partialDeriv i u) x‖) * |
| 150 | (∏ a, ‖v a‖) * ‖w‖ := by |
| 151 | simp_rw [mul_assoc] |
| 152 | rw [Finset.sum_mul] |
| 153 | apply Finset.sum_congr rfl |
| 154 | intro i hi |
| 155 | ring |
| 156 | |
| 157 | /-- Reconstruct the full Sobolev profile from the zeroth-order norm and the |
| 158 | profiles of all first coordinate derivatives. -/ |
| 159 | theorem derivativeProfile_succ_le_sum_partial [NeZero d] {Ω : Set E} |
| 160 | {p : ℝ≥0∞} (hp : 1 ≤ p) (r : ℕ) {u : E → ℝ} |
| 161 | (hu : ContDiff ℝ (⊤ : ℕ∞) u) : |
| 162 | derivativeProfile p Ω (r + 1) u ≤ derivativeProfile p Ω 0 u + |
| 163 | ∑ i : Fin d, derivativeProfile p Ω r (Iteration.partialDeriv i u) := by |
| 164 | classical |
| 165 | have hbound (j : ℕ) : |
| 166 | eLpNorm (fun x => ‖iteratedFDeriv ℝ (j + 1) u x‖) p (volume.restrict Ω) ≤ |
| 167 | ∑ i : Fin d, eLpNorm (fun x => ‖iteratedFDeriv ℝ j (Iteration.partialDeriv i u) x‖) |
| 168 | p (volume.restrict Ω) := by |
| 169 | have hnorm : eLpNorm (fun x => ‖iteratedFDeriv ℝ (j + 1) u x‖) |
| 170 | p (volume.restrict Ω) ≤ |
| 171 | eLpNorm (fun x => ∑ i : Fin d, |
| 172 | ‖iteratedFDeriv ℝ j (Iteration.partialDeriv i u) x‖) p (volume.restrict Ω) := by |
| 173 | apply eLpNorm_mono_ae |
| 174 | exact Filter.Eventually.of_forall fun x => by |
| 175 | rw [norm_norm, Real.norm_eq_abs, |
| 176 | abs_of_nonneg (Finset.sum_nonneg (fun i hi => norm_nonneg _))] |
| 177 | exact norm_iteratedFDeriv_succ_le_sum_partial hu j x |
| 178 | apply hnorm.trans |
| 179 | have heq : (fun x => ∑ i : Fin d, ‖iteratedFDeriv ℝ j (Iteration.partialDeriv i u) x‖) = |
| 180 | ∑ i : Fin d, (fun x => ‖iteratedFDeriv ℝ j (Iteration.partialDeriv i u) x‖) := by |
| 181 | funext x |
| 182 | rw [Finset.sum_apply] |
| 183 | rw [heq] |
| 184 | apply eLpNorm_sum_le _ hp |
| 185 | intro i hi |
| 186 | exact ((contDiff_partial hu i).continuous_iteratedFDeriv |
| 187 | (by exact_mod_cast le_top)).norm.aestronglyMeasurable |
| 188 | unfold derivativeProfile |
| 189 | rw [Finset.sum_range_succ' (n := r + 1)] |
| 190 | norm_num only [Finset.sum_range_one] |
| 191 | apply (add_le_add (Finset.sum_le_sum (fun j hj => hbound j)) le_rfl).trans_eq |
| 192 | rw [Finset.sum_comm, add_comm] |
| 193 | |
| 194 | end Poincare.Analysis.Elliptic.InteriorEstimates |