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.InverseFunctionTheorem.ContDiff |
| 2 | import Mathlib.Analysis.Normed.Ring.Units |
| 3 | |
| 4 | /-! |
| 5 | # Smooth local inverse neighborhoods |
| 6 | |
| 7 | If a map is smooth throughout a neighborhood and has invertible derivative |
| 8 | at its center, the inverse-function construction is smooth throughout a |
| 9 | neighborhood of the image. The neighborhood assumption is retained explicitly: |
| 10 | infinite differentiability at one point alone is not an open condition. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Filter Set |
| 17 | open scoped ContDiff Topology |
| 18 | |
| 19 | namespace Poincare.Analysis.Calculus |
| 20 | |
| 21 | variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] |
| 22 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 23 | |
| 24 | /-- The inverse-function construction is smooth on a neighborhood when the |
| 25 | forward map is smooth on a neighborhood and nonsingular at the base point. -/ |
| 26 | theorem eventually_contDiffAt_localInverse |
| 27 | {f : E → F} {x : E} (hf : ∀ᶠ y in 𝓝 x, ContDiffAt ℝ ∞ f y) |
| 28 | (e : E ≃L[ℝ] F) (hd : HasFDerivAt f (e : E →L[ℝ] F) x) : |
| 29 | ∀ᶠ z in 𝓝 (f x), |
| 30 | ContDiffAt ℝ ∞ (hf.self_of_nhds.localInverse hd (by simp)) z := by |
| 31 | let G := hf.self_of_nhds.toOpenPartialHomeomorph f hd (by simp) |
| 32 | have hx : x ∈ G.source := hf.self_of_nhds.mem_toOpenPartialHomeomorph_source hd (by simp) |
| 33 | have hc : ContinuousAt (fun y => (e.symm : F →L[ℝ] E).comp (fderiv ℝ f y)) x := |
| 34 | continuousAt_const.clm_comp (hf.self_of_nhds.continuousAt_fderiv (by simp)) |
| 35 | have hu : IsUnit ((e.symm : F →L[ℝ] E).comp (fderiv ℝ f x)) := by |
| 36 | rw [hd.fderiv] |
| 37 | have he : (e.symm : F →L[ℝ] E).comp (e : E →L[ℝ] F) = 1 := by |
| 38 | ext v |
| 39 | simp [ContinuousLinearMap.one_def] |
| 40 | rw [he] |
| 41 | exact isUnit_one |
| 42 | have hnear : ∀ᶠ y in 𝓝 x, (fderiv ℝ f y).IsInvertible := by |
| 43 | filter_upwards [hc.eventually (Units.isOpen.mem_nhds hu)] with y hy |
| 44 | have hunit : ((e.symm : F →L[ℝ] E).comp (fderiv ℝ f y)).IsInvertible := |
| 45 | ⟨ContinuousLinearEquiv.ofUnit hy.unit, hy.unit_spec⟩ |
| 46 | exact ContinuousLinearMap.isInvertible_equiv_comp.mp hunit |
| 47 | have hmaps : Tendsto G.symm (𝓝 (f x)) (𝓝 x) := G.tendsto_symm hx |
| 48 | filter_upwards [hmaps.eventually hf, hmaps.eventually hnear, |
| 49 | G.open_target.mem_nhds (G.map_source hx)] with z hz hi hzt |
| 50 | obtain ⟨a, ha⟩ := hi |
| 51 | have hd' : HasFDerivAt f (a : E →L[ℝ] F) (G.symm z) := by |
| 52 | rw [ha] |
| 53 | exact (hz.differentiableAt (by simp)).hasFDerivAt |
| 54 | exact G.contDiffAt_symm hzt hd' hz |
| 55 | |
| 56 | end Poincare.Analysis.Calculus |