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.Module.FiniteDimension |
| 3 | |
| 4 | /-! |
| 5 | # A smooth inverse on a full open neighborhood |
| 6 | |
| 7 | Restrict the inverse-function chart to the open injective-derivative set. |
| 8 | Equal finite dimensions make all these derivatives invertible, so the |
| 9 | inverse is smooth at every point of the resulting target. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open scoped ContDiff |
| 15 | |
| 16 | namespace PoincareMT.ReducedLength |
| 17 | |
| 18 | variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 19 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 20 | [FiniteDimensional ℝ E] [FiniteDimensional ℝ F] |
| 21 | |
| 22 | theorem exists_smooth_local_inverse (f : E → F) (S : Set E) (hS : IsOpen S) |
| 23 | (hf : ContDiffOn ℝ ∞ f S) (x : E) (hx : x ∈ S) |
| 24 | (hbij : Function.Bijective (fderiv ℝ f x)) : |
| 25 | ∃ e : OpenPartialHomeomorph E F, x ∈ e.source ∧ e.source ⊆ S ∧ |
| 26 | (e : E → F) = f ∧ ContDiffOn ℝ ∞ e.symm e.target ∧ |
| 27 | ∀ y ∈ e.source, Function.Bijective (fderiv ℝ f y) := by |
| 28 | let L : E ≃L[ℝ] F := |
| 29 | (LinearEquiv.ofBijective (fderiv ℝ f x).toLinearMap hbij).toContinuousLinearEquiv |
| 30 | have hL : (L : E →L[ℝ] F) = fderiv ℝ f x := by ext v; rfl |
| 31 | have hfx : ContDiffAt ℝ ∞ f x := hf.contDiffAt (hS.mem_nhds hx) |
| 32 | have hdx : HasFDerivAt f (L : E →L[ℝ] F) x := by |
| 33 | rw [hL] |
| 34 | exact (hfx.differentiableAt (by simp)).hasFDerivAt |
| 35 | let e0 := hfx.toOpenPartialHomeomorph f hdx (by simp) |
| 36 | let V := S ∩ (fderiv ℝ f) ⁻¹' {L : E →L[ℝ] F | Function.Injective L} |
| 37 | have hV : IsOpen V := |
| 38 | (hf.continuousOn_fderiv_of_isOpen hS (by simp)).isOpen_inter_preimage hS |
| 39 | ContinuousLinearMap.isOpen_injective |
| 40 | have hxV : x ∈ V := ⟨hx, hbij.1⟩ |
| 41 | let e := e0.restrOpen V hV |
| 42 | have he : (e : E → F) = f := rfl |
| 43 | have hsub : e.source ⊆ S := fun y hy ↦ hy.2.1 |
| 44 | have hdimb : Module.finrank ℝ E = Module.finrank ℝ F := L.toLinearEquiv.finrank_eq |
| 45 | have hb (y : E) (hy : y ∈ e.source) : Function.Bijective (fderiv ℝ f y) := |
| 46 | ⟨hy.2.2, (LinearMap.injective_iff_surjective_of_finrank_eq_finrank |
| 47 | (f := (fderiv ℝ f y).toLinearMap) hdimb).mp hy.2.2⟩ |
| 48 | refine ⟨e, ⟨hfx.mem_toOpenPartialHomeomorph_source hdx (by simp), hxV⟩, |
| 49 | hsub, he, ?_, hb⟩ |
| 50 | intro y hy |
| 51 | have hx' : e.symm y ∈ S := hsub (e.map_target hy) |
| 52 | have hsmooth : ContDiffAt ℝ ∞ f (e.symm y) := hf.contDiffAt (hS.mem_nhds hx') |
| 53 | let L' : E ≃L[ℝ] F := (LinearEquiv.ofBijective (fderiv ℝ f (e.symm y)).toLinearMap |
| 54 | (hb (e.symm y) (e.map_target hy))).toContinuousLinearEquiv |
| 55 | have hL' : (L' : E →L[ℝ] F) = fderiv ℝ f (e.symm y) := by ext v; rfl |
| 56 | apply (e.contDiffAt_symm hy (f₀' := L') ?_ ?_).contDiffWithinAt |
| 57 | · rw [he, hL'] |
| 58 | exact (hsmooth.differentiableAt (by simp)).hasFDerivAt |
| 59 | · rwa [he] |
| 60 | |
| 61 | end PoincareMT.ReducedLength |