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 | Provenance and modification notice (recorded 2026-09-29). |
| 3 | Notices for the adapted source: |
| 4 | Copyright 2026 The DifferentialGeometry contributors |
| 5 | Source: https://github.com/qinz1yang/differential-geometry |
| 6 | DifferentialGeometry/Analysis/Sobolev/Euclidean/ChainRule/CompChainRuleK.lean |
| 7 | Comparison revision: 1b535dd102b94cc42b107cca27059687888f08b3. |
| 8 | Changes: Imports, module paths, and namespaces were adapted to the subject-organized PoincareLib library. The local file extracts a subset of the upstream development. |
| 9 | License: Apache-2.0. Source licenses and notices are retained under |
| 10 | PoincareConjecture/provenance/2026-09-29/licenses/. |
| 11 | See PoincareConjecture/MODIFICATIONS.md for the reviewed source mapping. |
| 12 | -/ |
| 13 | |
| 14 | import PoincareLib.Analysis.Elliptic.Regularity.Sobolev.Density |
| 15 | |
| 16 | /-! |
| 17 | Adapted from Chow--Liao--Qin, revision `1b535dd102b94cc42b107cca27059687888f08b3`, |
| 18 | `DifferentialGeometry/Analysis/Sobolev/Euclidean/ChainRule/CompChainRuleK.lean`. |
| 19 | Apache-2.0; see `PoincareConjecture/provenance/2026-09-29/licenses/DifferentialGeometry/LICENSE`. |
| 20 | -/ |
| 21 | |
| 22 | noncomputable section |
| 23 | |
| 24 | open MeasureTheory Set Filter Topology Metric Function |
| 25 | open scoped ENNReal NNReal ContDiff |
| 26 | |
| 27 | namespace Poincare.Analysis.Sobolev.Euclidean |
| 28 | variable {d : ℕ} [NeZero d] |
| 29 | local notation "E" => EuclideanSpace ℝ (Fin d) |
| 30 | |
| 31 | omit [NeZero d] in |
| 32 | private lemma euclidean_coord_le_norm |
| 33 | (v : EuclideanSpace ℝ (Fin d)) (i : Fin d) : |
| 34 | |v i| ≤ ‖v‖ := by |
| 35 | classical |
| 36 | have h_sq : (v i)^2 ≤ ‖v‖^2 := by |
| 37 | rw [EuclideanSpace.real_norm_sq_eq] |
| 38 | have h_le := Finset.single_le_sum |
| 39 | (f := fun j : Fin d => (v j)^2) |
| 40 | (fun j _ => sq_nonneg _) (Finset.mem_univ i) |
| 41 | convert h_le |
| 42 | have hv_norm_nn : 0 ≤ ‖v‖ := norm_nonneg _ |
| 43 | have h_abs_sq : |v i|^2 = (v i)^2 := sq_abs _ |
| 44 | rw [show |v i| = Real.sqrt ((v i)^2) from (Real.sqrt_sq_eq_abs _).symm] |
| 45 | rw [show ‖v‖ = Real.sqrt (‖v‖^2) from (Real.sqrt_sq hv_norm_nn).symm] |
| 46 | exact Real.sqrt_le_sqrt h_sq |
| 47 | |
| 48 | omit [NeZero d] in |
| 49 | private lemma continuousMultilinearMap_norm_le_sum_basis |
| 50 | {n : ℕ} |
| 51 | (f : ContinuousMultilinearMap ℝ |
| 52 | (fun _ : Fin n => EuclideanSpace ℝ (Fin d)) ℝ) : |
| 53 | ‖f‖ ≤ ∑ β : Fin n → Fin d, |
| 54 | |f (fun i : Fin n => EuclideanSpace.single (β i) (1 : ℝ))| := by |
| 55 | classical |
| 56 | set M : ℝ := ∑ β : Fin n → Fin d, |
| 57 | |f (fun i : Fin n => EuclideanSpace.single (β i) (1 : ℝ))| with hM_def |
| 58 | have hM_nonneg : 0 ≤ M := |
| 59 | Finset.sum_nonneg (fun β _ => abs_nonneg _) |
| 60 | refine ContinuousMultilinearMap.opNorm_le_bound hM_nonneg ?_ |
| 61 | intro m |
| 62 | have h_expand : ∀ i : Fin n, m i = |
| 63 | ∑ α : Fin d, (m i α) • EuclideanSpace.single α (1 : ℝ) := by |
| 64 | intro i |
| 65 | have h := (EuclideanSpace.basisFun (Fin d) ℝ).sum_repr (m i) |
| 66 | rw [show (fun α : Fin d => (m i α) • EuclideanSpace.single α (1 : ℝ)) = |
| 67 | (fun α : Fin d => (EuclideanSpace.basisFun (Fin d) ℝ).repr (m i) α • |
| 68 | (EuclideanSpace.basisFun (Fin d) ℝ) α) from ?_, h] |
| 69 | funext α |
| 70 | rw [EuclideanSpace.basisFun_repr, EuclideanSpace.basisFun_apply] |
| 71 | have h_f_expand : |
| 72 | f m = ∑ β : Fin n → Fin d, |
| 73 | (∏ i : Fin n, m i (β i)) * |
| 74 | f (fun i : Fin n => EuclideanSpace.single (β i) (1 : ℝ)) := by |
| 75 | have h_step1 : f m = f (fun i : Fin n => |
| 76 | ∑ α : Fin d, (m i α) • EuclideanSpace.single α (1 : ℝ)) := by |
| 77 | congr; funext i; exact h_expand i |
| 78 | rw [h_step1] |
| 79 | have h_mult_sum : |
| 80 | (f.toMultilinearMap fun i : Fin n => |
| 81 | ∑ α : Fin d, (m i α) • EuclideanSpace.single α (1 : ℝ)) = |
| 82 | ∑ β : Fin n → Fin d, |
| 83 | f.toMultilinearMap fun i : Fin n => |
| 84 | (m i (β i)) • EuclideanSpace.single (β i) (1 : ℝ) := by |
| 85 | exact f.toMultilinearMap.map_sum |
| 86 | (fun (i : Fin n) (α : Fin d) => |
| 87 | (m i α) • EuclideanSpace.single α (1 : ℝ)) |
| 88 | change f.toMultilinearMap _ = _ |
| 89 | rw [h_mult_sum] |
| 90 | refine Finset.sum_congr rfl ?_ |
| 91 | intro β _ |
| 92 | rw [f.toMultilinearMap.map_smul_univ |
| 93 | (c := fun i : Fin n => m i (β i)) |
| 94 | (m := fun i : Fin n => EuclideanSpace.single (β i) (1 : ℝ))] |
| 95 | rw [smul_eq_mul] |
| 96 | rfl |
| 97 | rw [Real.norm_eq_abs] |
| 98 | rw [h_f_expand] |
| 99 | refine (Finset.abs_sum_le_sum_abs _ _).trans ?_ |
| 100 | have h_inner_bound : ∀ β : Fin n → Fin d, |
| 101 | |(∏ i : Fin n, m i (β i)) * |
| 102 | f (fun i : Fin n => EuclideanSpace.single (β i) (1 : ℝ))| ≤ |
| 103 | (∏ i : Fin n, ‖m i‖) * |
| 104 | |f (fun i : Fin n => EuclideanSpace.single (β i) (1 : ℝ))| := by |
| 105 | intro β |
| 106 | rw [abs_mul] |
| 107 | have h_prod_le : |∏ i : Fin n, m i (β i)| ≤ ∏ i : Fin n, ‖m i‖ := by |
| 108 | rw [Finset.abs_prod] |
| 109 | refine Finset.prod_le_prod ?_ ?_ |
| 110 | · intro i _; exact abs_nonneg _ |
| 111 | · intro i _; exact euclidean_coord_le_norm (d := d) (m i) (β i) |
| 112 | exact mul_le_mul_of_nonneg_right h_prod_le (abs_nonneg _) |
| 113 | refine (Finset.sum_le_sum (fun β _ => h_inner_bound β)).trans ?_ |
| 114 | have h_factor : |
| 115 | ∑ β : Fin n → Fin d, |
| 116 | (∏ i : Fin n, ‖m i‖) * |
| 117 | |f (fun i : Fin n => EuclideanSpace.single (β i) (1 : ℝ))| = |
| 118 | (∏ i : Fin n, ‖m i‖) * M := by |
| 119 | rw [← Finset.mul_sum] |
| 120 | rw [h_factor] |
| 121 | exact le_of_eq (mul_comm _ _) |
| 122 | |
| 123 | omit [NeZero d] in |
| 124 | private lemma norm_iteratedFDeriv_le_sum_basis |
| 125 | (n : ℕ) {ψ : E → ℝ} (y : E) : |
| 126 | ‖iteratedFDeriv ℝ n ψ y‖ ≤ |
| 127 | ∑ β : Fin n → Fin d, |
| 128 | |iteratedFDeriv ℝ n ψ y |
| 129 | (fun i : Fin n => EuclideanSpace.single (β i) (1 : ℝ))| := |
| 130 | continuousMultilinearMap_norm_le_sum_basis (d := d) (iteratedFDeriv ℝ n ψ y) |
| 131 | |
| 132 | omit [NeZero d] in |
| 133 | private lemma iteratedFDeriv_clm_apply_basis |
| 134 | {n : ℕ} {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 135 | {g : E → F →L[ℝ] ℝ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) |
| 136 | (v : F) |
| 137 | (β : Fin n → Fin d) (y : E) : |
| 138 | iteratedFDeriv ℝ n g y |
| 139 | (fun i : Fin n => EuclideanSpace.single (β i) (1 : ℝ)) v = |
| 140 | iteratedFDeriv ℝ n (fun y' => g y' v) y |
| 141 | (fun i : Fin n => EuclideanSpace.single (β i) (1 : ℝ)) := by |
| 142 | have h := iteratedFDeriv_clm_apply_const_apply (𝕜 := ℝ) |
| 143 | (n := (⊤ : ℕ∞)) (c := g) (u := v) (i := n) (x := y) |
| 144 | (m := fun i : Fin n => EuclideanSpace.single (β i) (1 : ℝ)) |
| 145 | hg (by exact_mod_cast (le_top : (n : ℕ∞) ≤ ⊤)) |
| 146 | exact h.symm |
| 147 | |
| 148 | omit [NeZero d] in |
| 149 | private lemma iteratedFDeriv_basis_eq_iterClassicalPartial_rev : |
| 150 | ∀ (n : ℕ) (β : Fin n → Fin d) {f : E → ℝ}, |
| 151 | ContDiff ℝ (⊤ : ℕ∞) f → ∀ y : E, |
| 152 | iteratedFDeriv ℝ n f y |
| 153 | (fun i : Fin n => EuclideanSpace.single (β i) (1 : ℝ)) = |
| 154 | iterClassicalPartial (d := d) n (fun i : Fin n => β i.rev) f y := by |
| 155 | intro n |
| 156 | induction n with |
| 157 | | zero => |
| 158 | intro β f _ y |
| 159 | simp [iteratedFDeriv_zero_apply, iterClassicalPartial_zero] |
| 160 | | succ n ih => |
| 161 | intro β f hf y |
| 162 | rw [show (fun i : Fin (n + 1) => EuclideanSpace.single (β i) (1 : ℝ)) = |
| 163 | Fin.snoc (fun i : Fin n => EuclideanSpace.single (β i.castSucc) (1 : ℝ)) |
| 164 | (EuclideanSpace.single (β (Fin.last n)) (1 : ℝ)) by |
| 165 | ext i |
| 166 | induction i using Fin.lastCases with |
| 167 | | last => simp |
| 168 | | cast j => simp] |
| 169 | rw [iteratedFDeriv_succ_apply_right] |
| 170 | rw [Fin.init_snoc, Fin.snoc_last] |
| 171 | have hfd : ContDiff ℝ (⊤ : ℕ∞) (fderiv ℝ f) := by |
| 172 | have hf_top : ContDiff ℝ ((⊤ : ℕ∞) : WithTop ℕ∞) f := by simpa using hf |
| 173 | have h := hf_top.fderiv_right (m := (⊤ : ℕ∞)) (by simp) |
| 174 | simpa using h |
| 175 | rw [iteratedFDeriv_clm_apply_basis (d := d) |
| 176 | (g := fderiv ℝ f) hfd (EuclideanSpace.single (β (Fin.last n)) (1 : ℝ)) |
| 177 | (β := fun i : Fin n => β i.castSucc) y] |
| 178 | have h_inner_smooth : ContDiff ℝ (⊤ : ℕ∞) |
| 179 | (fun y' : E => (fderiv ℝ f y') (EuclideanSpace.single (β (Fin.last n)) (1 : ℝ))) := |
| 180 | hfd.clm_apply contDiff_const |
| 181 | rw [ih (fun i : Fin n => β i.castSucc) h_inner_smooth y] |
| 182 | rw [iterClassicalPartial_succ] |
| 183 | have h_index_eq : |
| 184 | (fun i : Fin n => β i.rev.castSucc) = |
| 185 | (fun i : Fin n => β i.succ.rev) := by |
| 186 | funext i |
| 187 | rw [Fin.rev_succ] |
| 188 | have h_first_eq : β (Fin.last n) = β (Fin.rev 0) := by |
| 189 | rw [Fin.rev_zero] |
| 190 | rw [h_index_eq, h_first_eq] |
| 191 | |
| 192 | omit [NeZero d] in |
| 193 | private lemma norm_iteratedFDeriv_le_sum_iterClassicalPartial |
| 194 | (n : ℕ) {f : E → ℝ} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (y : E) : |
| 195 | ‖iteratedFDeriv ℝ n f y‖ ≤ |
| 196 | ∑ β : Fin n → Fin d, |iterClassicalPartial (d := d) n β f y| := by |
| 197 | classical |
| 198 | have h1 := norm_iteratedFDeriv_le_sum_basis (d := d) n (ψ := f) y |
| 199 | have h2 : ∀ β : Fin n → Fin d, |
| 200 | |iteratedFDeriv ℝ n f y |
| 201 | (fun i : Fin n => EuclideanSpace.single (β i) (1 : ℝ))| = |
| 202 | |iterClassicalPartial (d := d) n (fun i : Fin n => β i.rev) f y| := by |
| 203 | intro β |
| 204 | rw [iteratedFDeriv_basis_eq_iterClassicalPartial_rev (d := d) n β hf y] |
| 205 | have h3 : ∑ β : Fin n → Fin d, |
| 206 | |iteratedFDeriv ℝ n f y |
| 207 | (fun i : Fin n => EuclideanSpace.single (β i) (1 : ℝ))| = |
| 208 | ∑ β : Fin n → Fin d, |
| 209 | |iterClassicalPartial (d := d) n (fun i : Fin n => β i.rev) f y| := |
| 210 | Finset.sum_congr rfl (fun β _ => h2 β) |
| 211 | rw [h3] at h1 |
| 212 | have h_equiv : |
| 213 | ∑ β : Fin n → Fin d, |
| 214 | |iterClassicalPartial (d := d) n (fun i : Fin n => β i.rev) f y| = |
| 215 | ∑ β : Fin n → Fin d, |iterClassicalPartial (d := d) n β f y| := by |
| 216 | have h_invol : ∀ β : Fin n → Fin d, |
| 217 | (fun i : Fin n => (fun j : Fin n => β j.rev) i.rev) = β := by |
| 218 | intro β |
| 219 | funext i |
| 220 | simp [Fin.rev_rev] |
| 221 | refine Finset.sum_bij (fun β _ => fun i : Fin n => β i.rev) ?_ ?_ ?_ ?_ |
| 222 | · intro β _; exact Finset.mem_univ _ |
| 223 | · intro β1 _ β2 _ h |
| 224 | have h_apply : ∀ i : Fin n, |
| 225 | (fun j : Fin n => β1 j.rev) i = (fun j : Fin n => β2 j.rev) i := |
| 226 | fun i => congrFun h i |
| 227 | funext i |
| 228 | have := h_apply i.rev |
| 229 | simpa [Fin.rev_rev] using this |
| 230 | · intro β _ |
| 231 | refine ⟨fun i : Fin n => β i.rev, Finset.mem_univ _, ?_⟩ |
| 232 | funext i |
| 233 | simp [Fin.rev_rev] |
| 234 | · intro β _; rfl |
| 235 | rw [h_equiv] at h1 |
| 236 | exact h1 |
| 237 | |
| 238 | omit [NeZero d] in |
| 239 | private lemma eLpNorm_iteratedFDeriv_le_sum_iterClassicalPartial |
| 240 | (n : ℕ) {p : ℝ≥0∞} (hp : 1 ≤ p) |
| 241 | {f : E → ℝ} (hf_smooth : ContDiff ℝ (⊤ : ℕ∞) f) |
| 242 | (Ω : Set E) : |
| 243 | eLpNorm (fun y => ‖iteratedFDeriv ℝ n f y‖) p (volume.restrict Ω) ≤ |
| 244 | ∑ β : Fin n → Fin d, |
| 245 | eLpNorm (iterClassicalPartial (d := d) n β f) p (volume.restrict Ω) := by |
| 246 | classical |
| 247 | have h_pt : ∀ y, ‖iteratedFDeriv ℝ n f y‖ ≤ |
| 248 | ∑ β : Fin n → Fin d, |iterClassicalPartial (d := d) n β f y| := |
| 249 | fun y => norm_iteratedFDeriv_le_sum_iterClassicalPartial (d := d) n hf_smooth y |
| 250 | have h_eLp_le : |
| 251 | eLpNorm (fun y => ‖iteratedFDeriv ℝ n f y‖) p (volume.restrict Ω) ≤ |
| 252 | eLpNorm (fun y => ∑ β : Fin n → Fin d, |
| 253 | |iterClassicalPartial (d := d) n β f y|) p (volume.restrict Ω) := by |
| 254 | refine eLpNorm_mono_ae ?_ |
| 255 | refine Filter.Eventually.of_forall ?_ |
| 256 | intro y |
| 257 | rw [Real.norm_eq_abs, abs_of_nonneg (norm_nonneg _), |
| 258 | Real.norm_eq_abs, abs_of_nonneg] |
| 259 | · exact h_pt y |
| 260 | · exact Finset.sum_nonneg (fun β _ => abs_nonneg _) |
| 261 | refine h_eLp_le.trans ?_ |
| 262 | have h_strong_meas : ∀ β : Fin n → Fin d, |
| 263 | AEStronglyMeasurable |
| 264 | (fun y => |iterClassicalPartial (d := d) n β f y|) (volume.restrict Ω) := by |
| 265 | intro β |
| 266 | have h_smooth : ContDiff ℝ (⊤ : ℕ∞) |
| 267 | (iterClassicalPartial (d := d) n β f) := |
| 268 | contDiff_iterClassicalPartial (d := d) n β hf_smooth |
| 269 | have h_aem : AEStronglyMeasurable |
| 270 | (iterClassicalPartial (d := d) n β f) (volume.restrict Ω) := |
| 271 | h_smooth.continuous.aestronglyMeasurable |
| 272 | have h_norm := h_aem.norm |
| 273 | refine h_norm.congr (Filter.Eventually.of_forall ?_) |
| 274 | intro y |
| 275 | exact (Real.norm_eq_abs _).symm |
| 276 | have h_triangle : |
| 277 | eLpNorm (fun y => ∑ β : Fin n → Fin d, |
| 278 | |iterClassicalPartial (d := d) n β f y|) p (volume.restrict Ω) ≤ |
| 279 | ∑ β : Fin n → Fin d, |
| 280 | eLpNorm (fun y => |iterClassicalPartial (d := d) n β f y|) p (volume.restrict Ω) := by |
| 281 | have hsum := eLpNorm_sum_le |
| 282 | (μ := volume.restrict Ω) (p := p) |
| 283 | (s := (Finset.univ : Finset (Fin n → Fin d))) |
| 284 | (f := fun β y => |iterClassicalPartial (d := d) n β f y|) |
| 285 | (fun β _ => h_strong_meas β) hp |
| 286 | have h_eq : (fun y => ∑ β : Fin n → Fin d, |
| 287 | |iterClassicalPartial (d := d) n β f y|) = |
| 288 | ((Finset.univ : Finset (Fin n → Fin d)).sum |
| 289 | (fun β => fun y => |iterClassicalPartial (d := d) n β f y|)) := by |
| 290 | funext y; rw [Finset.sum_apply] |
| 291 | rw [h_eq] |
| 292 | exact hsum |
| 293 | refine h_triangle.trans ?_ |
| 294 | refine Finset.sum_le_sum (fun β _ => ?_) |
| 295 | refine eLpNorm_mono_ae ?_ |
| 296 | refine Filter.Eventually.of_forall ?_ |
| 297 | intro y |
| 298 | rw [Real.norm_eq_abs, abs_abs] |
| 299 | exact le_of_eq rfl |
| 300 | |
| 301 | omit [NeZero d] in |
| 302 | lemma eLpNorm_iteratedFDeriv_le_wkpNorm |
| 303 | {Ω : Set E} (hΩ_open : IsOpen Ω) |
| 304 | {p : ℝ≥0∞} (hp_one : 1 ≤ p) |
| 305 | (k : ℕ) |
| 306 | {ψ : E → ℝ} (hψ_smooth : ContDiff ℝ (⊤ : ℕ∞) ψ) |
| 307 | (hψ_cpt : HasCompactSupport ψ) (hψ_supp : tsupport ψ ⊆ Ω) : |
| 308 | ∑ n ∈ Finset.range (k + 1), |
| 309 | eLpNorm (fun y => ‖iteratedFDeriv ℝ n ψ y‖) p (volume.restrict Ω) ≤ |
| 310 | iteratedWeakSobolevNorm (d := d) k p ψ Ω := by |
| 311 | classical |
| 312 | have h_per_n : ∀ n, n ≤ k → |
| 313 | eLpNorm (fun y => ‖iteratedFDeriv ℝ n ψ y‖) p (volume.restrict Ω) ≤ |
| 314 | ∑ β : Fin n → Fin d, |
| 315 | eLpNorm (iterClassicalPartial (d := d) n β ψ) p (volume.restrict Ω) := fun n _ => |
| 316 | eLpNorm_iteratedFDeriv_le_sum_iterClassicalPartial (d := d) n hp_one |
| 317 | hψ_smooth Ω |
| 318 | have h_iter_eq : ∀ n β, |
| 319 | eLpNorm (iterClassicalPartial (d := d) n β ψ) p (volume.restrict Ω) = |
| 320 | eLpNorm (iterWeakPartial (d := d) p n β ψ Ω) p (volume.restrict Ω) := fun n β => by |
| 321 | refine eLpNorm_congr_ae ?_ |
| 322 | exact (iterWeakPartial_smooth_ae_eq_iterClassicalPartial |
| 323 | (d := d) hp_one hΩ_open n β hψ_smooth hψ_cpt hψ_supp).symm |
| 324 | unfold iteratedWeakSobolevNorm |
| 325 | refine Finset.sum_le_sum ?_ |
| 326 | intro n hn |
| 327 | have hn_le : n ≤ k := by rw [Finset.mem_range] at hn; omega |
| 328 | refine (h_per_n n hn_le).trans ?_ |
| 329 | refine Finset.sum_le_sum ?_ |
| 330 | intro β _ |
| 331 | rw [h_iter_eq] |
| 332 | |
| 333 | end Poincare.Analysis.Sobolev.Euclidean |