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.ImplicitContDiff |
| 2 | |
| 3 | /-! |
| 4 | # Smooth implicit families on a common neighborhood |
| 5 | |
| 6 | Reapplying the implicit-function theorem at nearby graph points gives |
| 7 | smooth germs. Uniqueness in the original common neighborhood identifies |
| 8 | these germs with one family, proving smoothness on a fixed open set. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open scoped ContDiff Topology |
| 14 | open Set Filter |
| 15 | |
| 16 | namespace PoincareMT.ReducedLength |
| 17 | |
| 18 | variable {P Q R : Type*} |
| 19 | [NormedAddCommGroup P] [NormedSpace ℝ P] [CompleteSpace P] |
| 20 | [NormedAddCommGroup Q] [NormedSpace ℝ Q] [CompleteSpace Q] |
| 21 | [NormedAddCommGroup R] [NormedSpace ℝ R] [CompleteSpace R] |
| 22 | |
| 23 | theorem exists_smooth_implicit (H : P × Q → R) (hH : ContDiff ℝ ∞ H) (u : P × Q) |
| 24 | (hi : ((fderiv ℝ H u).comp (ContinuousLinearMap.inr ℝ P Q)).IsInvertible) : |
| 25 | ∃ (sigma : P → Q) (U : Set P) (W : Set (P × Q)), |
| 26 | IsOpen U ∧ u.1 ∈ U ∧ IsOpen W ∧ u ∈ W ∧ |
| 27 | sigma u.1 = u.2 ∧ ContDiffOn ℝ ∞ sigma U ∧ |
| 28 | (∀ p ∈ U, (p, sigma p) ∈ W ∧ H (p, sigma p) = H u) ∧ |
| 29 | ∀ z ∈ W, H z = H u ↔ sigma z.1 = z.2 := by |
| 30 | have hn : (∞ : ℕ∞ω) ≠ 0 := by simp |
| 31 | have hc : ContDiffAt ℝ ∞ H u := hH.contDiffAt |
| 32 | let sigma := hc.implicitFunction hn hi |
| 33 | have hsigma : sigma u.1 = u.2 := hc.implicitFunction_apply_self hn hi |
| 34 | have hsmooth : ContDiffAt ℝ ∞ sigma u.1 := hc.contDiffAt_implicitFunction hn hi |
| 35 | have hEquation := hc.eventually_apply_implicitFunction hn hi |
| 36 | have hgraph : Tendsto (fun p ↦ (p, sigma p)) (𝓝 u.1) (𝓝 u) := by |
| 37 | simpa only [hsigma, id_eq, Prod.mk.eta] using |
| 38 | (continuousAt_id.prodMk hsmooth.continuousAt).tendsto |
| 39 | obtain ⟨W, hW, hWopen, huW⟩ := |
| 40 | mem_nhds_iff.mp (hc.eventually_apply_eq_iff_implicitFunction hn hi) |
| 41 | have hD : Continuous (fun z : P × Q ↦ |
| 42 | (fderiv ℝ H z).comp (ContinuousLinearMap.inr ℝ P Q)) := |
| 43 | (hH.continuous_fderiv hn).clm_comp_const _ |
| 44 | obtain ⟨e, he⟩ := hi |
| 45 | have hInv : ∀ᶠ z in 𝓝 u, |
| 46 | ((fderiv ℝ H z).comp (ContinuousLinearMap.inr ℝ P Q)).IsInvertible := by |
| 47 | have heN : Set.range (fun e : Q ≃L[ℝ] R ↦ (e : Q →L[ℝ] R)) ∈ |
| 48 | 𝓝 ((fderiv ℝ H u).comp (ContinuousLinearMap.inr ℝ P Q)) := by |
| 49 | rw [← he] |
| 50 | exact e.nhds |
| 51 | exact hD.continuousAt.preimage_mem_nhds heN |
| 52 | have hnear : ∀ᶠ p in 𝓝 u.1, |
| 53 | (p, sigma p) ∈ W ∧ H (p, sigma p) = H u ∧ |
| 54 | ((fderiv ℝ H (p, sigma p)).comp (ContinuousLinearMap.inr ℝ P Q)).IsInvertible := |
| 55 | (hgraph.eventually (hWopen.mem_nhds huW)).and |
| 56 | (hEquation.and (hgraph.eventually hInv)) |
| 57 | obtain ⟨U, hU, hUopen, huU⟩ := mem_nhds_iff.mp hnear |
| 58 | refine ⟨sigma, U, W, hUopen, huU, hWopen, huW, hsigma, ?_, |
| 59 | fun p hp ↦ ⟨(hU hp).1, (hU hp).2.1⟩, hW⟩ |
| 60 | apply hUopen.contDiffOn_iff.mpr |
| 61 | intro p hp |
| 62 | have hcp : ContDiffAt ℝ ∞ H (p, sigma p) := hH.contDiffAt |
| 63 | let ip := (hU hp).2.2 |
| 64 | let rho := hcp.implicitFunction hn ip |
| 65 | have hrho : rho p = sigma p := hcp.implicitFunction_apply_self hn ip |
| 66 | have hrhos : ContDiffAt ℝ ∞ rho p := hcp.contDiffAt_implicitFunction hn ip |
| 67 | have hrhog : Tendsto (fun q ↦ (q, rho q)) (𝓝 p) (𝓝 (p, sigma p)) := by |
| 68 | simpa only [hrho, id_eq] using (continuousAt_id.prodMk hrhos.continuousAt).tendsto |
| 69 | have heq : sigma =ᶠ[𝓝 p] rho := by |
| 70 | filter_upwards [hcp.eventually_apply_implicitFunction hn ip, |
| 71 | hrhog.eventually (hWopen.mem_nhds (hU hp).1)] with q hq hqW |
| 72 | exact (hW hqW).mp (hq.trans (hU hp).2.1) |
| 73 | exact hrhos.congr_of_eventuallyEq heq |
| 74 | |
| 75 | end PoincareMT.ReducedLength |