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 Mathlib.Analysis.Calculus.IteratedDeriv.FaaDiBruno |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.CPolynomial |
| 3 | import Mathlib.Analysis.Calculus.ContDiff.Operations |
| 4 | import Mathlib.Analysis.Normed.Module.Multilinear.Curry |
| 5 | |
| 6 | /-! |
| 7 | # Finite-order regularity of evaluated spatial jet compositions |
| 8 | |
| 9 | The actual finite-partition chain rule and multilinear evaluation give |
| 10 | parameter regularity from the evaluated input jets. MT2007 |
| 11 | Claim 19.1, p. 437; |
| 12 | `2026-09-22-finite-order-spatial-jet-composition.md`. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set |
| 18 | open scoped ContDiff |
| 19 | |
| 20 | /-- Evaluated spatial jets of a composition inherit parameter |
| 21 | regularity with the exact outer derivative order loss. The parameter |
| 22 | and target spaces have independent universes. MT2007 Claim 19.1, |
| 23 | p. 437; finite-order spatial jet composition derivation. -/ |
| 24 | theorem contDiffOn_iteratedDeriv_comp_of_spatial_jets |
| 25 | {Z E F : Type*} |
| 26 | [NormedAddCommGroup Z] [NormedSpace ℝ Z] |
| 27 | [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 28 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 29 | {S : Set Z} {U : Set E} (hU : IsOpen U) {Φ : E → F} |
| 30 | {n m : ℕ∞} {k : ℕ} (horder : n + k ≤ m) |
| 31 | (hΦ : ContDiffOn ℝ m Φ U) {f : Z → ℝ → E} {x : Z → ℝ} |
| 32 | (hf : ∀ z ∈ S, ContDiffAt ℝ ∞ (f z) (x z)) |
| 33 | (hmem : ∀ z ∈ S, f z (x z) ∈ U) |
| 34 | (hjets : ∀ j : ℕ, ContDiffOn ℝ n |
| 35 | (fun z => iteratedDeriv j (f z) (x z)) S) : |
| 36 | ContDiffOn ℝ n (fun z => iteratedDeriv k (Φ ∘ f z) (x z)) S := by |
| 37 | classical |
| 38 | have horder' : (n : ℕ∞ω) + (k : ℕ∞ω) ≤ (m : ℕ∞ω) := by exact_mod_cast horder |
| 39 | have hkm : (k : ℕ∞ω) ≤ (m : ℕ∞ω) := |
| 40 | (le_add_of_nonneg_left (show (0 : ℕ∞ω) ≤ n from bot_le)).trans horder' |
| 41 | have hzero : ContDiffOn ℝ n (fun z => f z (x z)) S := by |
| 42 | simpa only [iteratedDeriv_zero] using hjets 0 |
| 43 | have hterm (c : OrderedFinpartition k) : ContDiffOn ℝ n |
| 44 | (fun z => iteratedFDeriv ℝ c.length Φ (f z (x z)) |
| 45 | (fun j => iteratedDeriv (c.partSize j) (f z) (x z))) S := by |
| 46 | have hlength : (c.length : ℕ∞ω) ≤ (k : ℕ∞ω) := by exact_mod_cast c.length_le |
| 47 | have houter : ContDiffOn ℝ n (iteratedFDeriv ℝ c.length Φ) U := by |
| 48 | intro y hy |
| 49 | exact ((hΦ.contDiffAt (hU.mem_nhds hy)).iteratedFDeriv_right |
| 50 | ((add_le_add le_rfl hlength).trans horder')).contDiffWithinAt |
| 51 | let B : (E [×c.length]→L[ℝ] F) →L[ℝ] (E [×c.length]→L[ℝ] F) := |
| 52 | ContinuousLinearMap.id ℝ _ |
| 53 | have htuple : ContDiffOn ℝ n (fun z => fun _ : Option (Fin c.length) => |
| 54 | (iteratedFDeriv ℝ c.length Φ (f z (x z)), |
| 55 | fun j => iteratedDeriv (c.partSize j) (f z) (x z))) S := |
| 56 | contDiffOn_pi.mpr fun _ => (houter.comp hzero hmem).prodMk |
| 57 | (contDiffOn_pi.mpr fun j => hjets (c.partSize j)) |
| 58 | exact B.continuousMultilinearMapOption.contDiff.comp_contDiffOn htuple |
| 59 | have hsum := ContDiffOn.sum (s := Finset.univ) (fun c _ => hterm c) |
| 60 | apply hsum.congr |
| 61 | intro z hz |
| 62 | exact iteratedDeriv_vcomp_eq_sum_orderedFinpartition |
| 63 | (hΦ.contDiffAt (hU.mem_nhds (hmem z hz))) ((hf z hz).of_le (by simp)) hkm |