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.Calculus.Sard.Basic |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.Comp |
| 3 | |
| 4 | /-! |
| 5 | # Regular scalar witnesses for non-flat strata |
| 6 | |
| 7 | Evaluating a nonzero higher derivative produces the regular scalar level used |
| 8 | in the dimension reduction of Lee's Theorem 6.10, Step 2, printed p. 130. |
| 9 | -/ |
| 10 | |
| 11 | open Set Function |
| 12 | open scoped ContDiff |
| 13 | |
| 14 | namespace Poincare.Analysis |
| 15 | |
| 16 | theorem exists_regular_scalar_of_iteratedFDeriv_ne_zero |
| 17 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 18 | {V : Set E} {f : E → ℝ} {a : E} {k : ℕ} |
| 19 | (hV : IsOpen V) (hf : ContDiffOn ℝ ∞ f V) (ha : a ∈ V) |
| 20 | (hzero : iteratedFDeriv ℝ k f a = 0) |
| 21 | (hne : iteratedFDeriv ℝ (k + 1) f a ≠ 0) : |
| 22 | ∃ g : E → ℝ, ContDiffOn ℝ ∞ g V ∧ g a = 0 ∧ |
| 23 | Surjective (fderiv ℝ g a) ∧ |
| 24 | ∀ x : E, iteratedFDeriv ℝ k f x = 0 → g x = 0 := by |
| 25 | have hex : ∃ v : Fin (k + 1) → E, iteratedFDeriv ℝ (k + 1) f a v ≠ 0 := by |
| 26 | by_contra! h |
| 27 | apply hne |
| 28 | ext v |
| 29 | simpa using h v |
| 30 | obtain ⟨v, hv⟩ := hex |
| 31 | let g : E → ℝ := fun x => iteratedFDeriv ℝ k f x (Fin.tail v) |
| 32 | have hD : ∀ x ∈ V, ContDiffAt ℝ ∞ (iteratedFDeriv ℝ k f) x := by |
| 33 | intro x hx |
| 34 | exact ((hf x hx).contDiffAt (hV.mem_nhds hx)).iteratedFDeriv_right |
| 35 | (by exact_mod_cast (le_top : (⊤ : ℕ∞) + k ≤ ⊤)) |
| 36 | have hg : ContDiffOn ℝ ∞ g V := by |
| 37 | intro x hx |
| 38 | exact ((ContinuousMultilinearMap.apply ℝ (fun _ : Fin k => E) ℝ |
| 39 | (Fin.tail v)).contDiff.contDiffAt.comp x (hD x hx)).contDiffWithinAt |
| 40 | refine ⟨g, hg, ?_, ?_, ?_⟩ |
| 41 | · simp [g, hzero] |
| 42 | · apply LinearMap.surjective (f := (fderiv ℝ g a).toLinearMap) |
| 43 | intro hz |
| 44 | apply hv |
| 45 | have hd := (hD a ha).differentiableAt (by simp) |
| 46 | rw [hd.iteratedFDeriv_succ_apply_left'] |
| 47 | change (fderiv ℝ g a).toLinearMap (v 0) = 0 |
| 48 | rw [hz] |
| 49 | rfl |
| 50 | · intro x hx |
| 51 | simp [g, hx] |
| 52 | |
| 53 | end Poincare.Analysis |
| 54 |