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.Implicit |
| 2 | import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ContDiff |
| 3 | |
| 4 | /-! |
| 5 | # Smooth coordinates for regular superlevels |
| 6 | |
| 7 | The local implicit-function construction supporting Morgan--Tian, Chapter 2, |
| 8 | Section 4, Definition 2.12, p. 57. |
| 9 | -/ |
| 10 | |
| 11 | /-! Adapted from AxelWorkspace, `MorganTianLib/Foundations/RegularSuperlevelCharts.lean`, |
| 12 | revision `f1cdb30cabdc8781d2d3dec86d3d99ab1820f30e`. |
| 13 | See `references/analysis/axel-workspace/regular-domain-reuse.md`. -/ |
| 14 | |
| 15 | open Set Function Filter |
| 16 | open scoped Topology ContDiff |
| 17 | |
| 18 | namespace Poincare.Analysis |
| 19 | |
| 20 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 21 | [FiniteDimensional ℝ E] |
| 22 | |
| 23 | /-- A regular scalar function is the first coordinate in a smooth local chart. -/ |
| 24 | theorem exists_smooth_superlevel_chart {f : E → ℝ} {V : Set E} (hV : IsOpen V) |
| 25 | (hf : ContDiffOn ℝ ∞ f V) {a : E} (ha : a ∈ V) |
| 26 | (hreg : Surjective (fderiv ℝ f a)) : |
| 27 | ∃ e : OpenPartialHomeomorph E (ℝ × (fderiv ℝ f a).ker), |
| 28 | a ∈ e.source ∧ e.source ⊆ V ∧ e a = (f a, 0) ∧ |
| 29 | ContDiffOn ℝ ∞ e e.source ∧ ContDiffOn ℝ ∞ e.symm e.target ∧ |
| 30 | (∀ x ∈ e.source, (e x).1 = f x) ∧ |
| 31 | ∀ c : ℝ, e '' (e.source ∩ {x | c ≤ f x}) = e.target ∩ {y | c ≤ y.1} := by |
| 32 | letI : CompleteSpace E := FiniteDimensional.complete ℝ E |
| 33 | let L := fderiv ℝ f a |
| 34 | have hfa : ContDiffAt ℝ ∞ f a := (hf a ha).contDiffAt (hV.mem_nhds ha) |
| 35 | have hstrict : HasStrictFDerivAt f L a := hfa.hasStrictFDerivAt (by simp) |
| 36 | have hL : L.range = ⊤ := LinearMap.range_eq_top.mpr hreg |
| 37 | let P := L.ker_closedComplemented_of_finiteDimensional_range |
| 38 | let d := hstrict.implicitFunctionDataOfComplemented f L hL P |
| 39 | let g := d.prodFun |
| 40 | let e0 := d.toOpenPartialHomeomorph |
| 41 | have hg : ContDiffOn ℝ ∞ g V := by |
| 42 | exact hf.prodMk (((Classical.choose P).contDiff.comp |
| 43 | (contDiff_id.sub contDiff_const)).contDiffOn) |
| 44 | have hgderiv := d.hasStrictFDerivAt.hasFDerivAt |
| 45 | have hgInv : (fderiv ℝ g a).IsInvertible := d.isInvertible_fderiv_prodFun |
| 46 | let W := V ∩ (fderiv ℝ g) ⁻¹' range |
| 47 | ((↑) : (E ≃L[ℝ] (ℝ × L.ker)) → E →L[ℝ] (ℝ × L.ker)) |
| 48 | have hW : IsOpen W := |
| 49 | (hg.continuousOn_fderiv_of_isOpen hV (by simp)).isOpen_inter_preimage |
| 50 | hV ContinuousLinearEquiv.isOpen |
| 51 | have haW : a ∈ W := ⟨ha, hgInv⟩ |
| 52 | let e := e0.restrOpen W hW |
| 53 | have hes : e.source ⊆ V := fun x hx => hx.2.1 |
| 54 | have hecoe : (e : E → ℝ × L.ker) = g := rfl |
| 55 | have heforward : ContDiffOn ℝ ∞ e e.source := by |
| 56 | rw [hecoe] |
| 57 | exact hg.mono hes |
| 58 | refine ⟨e, ⟨d.pt_mem_toOpenPartialHomeomorph_source, haW⟩, hes, ?_, heforward, |
| 59 | ?_, ?_, ?_⟩ |
| 60 | · change (f a, (Classical.choose P) (a - a)) = (f a, 0) |
| 61 | simp |
| 62 | · intro y hy |
| 63 | have hys : e.symm y ∈ e.source := e.map_target hy |
| 64 | obtain ⟨A, hA⟩ := hys.2.2 |
| 65 | have hgAt := (hg (e.symm y) (hes hys)).contDiffAt (hV.mem_nhds (hes hys)) |
| 66 | apply (e.contDiffAt_symm hy (f₀' := A) ?_ ?_).contDiffWithinAt |
| 67 | · rw [hecoe, hA] |
| 68 | exact (hgAt.differentiableAt (by simp)).hasFDerivAt |
| 69 | · rw [hecoe] |
| 70 | exact hgAt |
| 71 | · intro x hx |
| 72 | rfl |
| 73 | · intro c |
| 74 | ext y |
| 75 | constructor |
| 76 | · rintro ⟨x, ⟨hx, hcx⟩, rfl⟩ |
| 77 | exact ⟨e.map_source hx, hcx⟩ |
| 78 | · rintro ⟨hy, hcy⟩ |
| 79 | refine ⟨e.symm y, ⟨e.map_target hy, ?_⟩, e.right_inv hy⟩ |
| 80 | have heq : f (e.symm y) = y.1 := congrArg Prod.fst (e.right_inv hy) |
| 81 | simpa [heq] using hcy |
| 82 | |
| 83 | |
| 84 | end Poincare.Analysis |
| 85 |