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.Complex.SmoothLogarithm |
| 2 | import Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension |
| 3 | import Mathlib.Analysis.Complex.Isometry |
| 4 | |
| 5 | /-! |
| 6 | # Compact modifications of nonvanishing plane fields |
| 7 | |
| 8 | A global logarithm lets us replace a nowhere-zero planar field by a |
| 9 | constant outside a compact set while keeping its values on a prescribed |
| 10 | compact set. The new field is still smooth and nowhere zero. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Metric |
| 17 | open scoped ContDiff |
| 18 | |
| 19 | namespace Poincare.ODE.Plane |
| 20 | |
| 21 | private abbrev E2 := EuclideanSpace ℝ (Fin 2) |
| 22 | |
| 23 | /-- Preserve a nonvanishing smooth planar field on a prescribed compact |
| 24 | set while making it constant outside a larger compact set. -/ |
| 25 | theorem exists_nonvanishing_compact_modification |
| 26 | {V : E2 → E2} (hV : ContDiff ℝ ∞ V) (hne : ∀ x, V x ≠ 0) |
| 27 | {K : Set E2} (hK : IsCompact K) : |
| 28 | ∃ W : E2 → E2, ContDiff ℝ ∞ W ∧ (∀ x, W x ≠ 0) ∧ EqOn W V K ∧ |
| 29 | ∃ (S : Set E2) (v : E2), IsCompact S ∧ ∀ x, x ∉ S → W x = v := by |
| 30 | let e : E2 ≃L[ℝ] ℂ := Complex.orthonormalBasisOneI.repr.symm.toContinuousLinearEquiv |
| 31 | let f : E2 → ℂ := fun x => e (V x) |
| 32 | have hf : ContDiff ℝ ∞ f := e.contDiff.comp hV |
| 33 | have hfne (x : E2) : f x ≠ 0 := by simpa [f] using hne x |
| 34 | obtain ⟨L, hL, _, hexp⟩ := Poincare.Complex.exists_contDiff_logarithm hf hfne |
| 35 | 0 (Complex.log (f 0)) (Complex.exp_log (hfne 0)) |
| 36 | obtain ⟨R, hR, hKR⟩ := hK.isBounded.exists_pos_norm_le |
| 37 | let χ : ContDiffBump (0 : E2) := ⟨R, R + 1, hR, by linarith⟩ |
| 38 | let W : E2 → E2 := fun x => e.symm (Complex.exp (χ x • L x)) |
| 39 | refine ⟨W, e.symm.contDiff.comp ((χ.contDiff.smul hL).cexp), ?_, ?_, |
| 40 | closedBall 0 (R + 1), e.symm 1, isCompact_closedBall _ _, ?_⟩ |
| 41 | · intro x hx |
| 42 | have : Complex.exp (χ x • L x) = 0 := |
| 43 | e.symm.injective (hx.trans (map_zero e.symm).symm) |
| 44 | exact Complex.exp_ne_zero _ this |
| 45 | · intro x hx |
| 46 | have hχ : χ x = 1 := χ.one_of_mem_closedBall |
| 47 | (by simpa only [mem_closedBall, dist_zero_right] using hKR x hx) |
| 48 | simp [W, hχ, hexp, f] |
| 49 | · intro x hx |
| 50 | have hχ : χ x = 0 := χ.zero_of_le_dist (le_of_lt (lt_of_not_ge hx)) |
| 51 | simp [W, hχ] |
| 52 | |
| 53 | end Poincare.ODE.Plane |