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.ContDiff.Comp |
| 2 | import Mathlib.Analysis.Normed.Module.FiniteDimension |
| 3 | import Mathlib.Topology.Order.IntermediateValue |
| 4 | |
| 5 | /-! |
| 6 | # Singular points of even maps in odd dimension |
| 7 | |
| 8 | On a connected symmetric set, the determinant of the derivative of a locally |
| 9 | even map is an odd continuous function. In odd dimension it must vanish. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Filter Set |
| 15 | open scoped Topology |
| 16 | |
| 17 | namespace Poincare.Manifold |
| 18 | |
| 19 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 20 | |
| 21 | /-- Local evenness makes the derivatives at antipodal points negatives. -/ |
| 22 | theorem fderiv_neg_of_eventually_even {f : E → E} {x : E} |
| 23 | (hf : DifferentiableAt ℝ f (-x)) |
| 24 | (heven : ∀ᶠ y in 𝓝 x, f (-y) = f y) : |
| 25 | fderiv ℝ f (-x) = -fderiv ℝ f x := by |
| 26 | have hd := (hf.hasFDerivAt.comp x (hasFDerivAt_id x).neg).congr_of_eventuallyEq |
| 27 | (heven.mono fun y hy => hy.symm) |
| 28 | have heq : fderiv ℝ f x = -fderiv ℝ f (-x) := by |
| 29 | simpa only [ContinuousLinearMap.comp_neg, ContinuousLinearMap.comp_id] using hd.fderiv |
| 30 | simpa only [neg_neg] using congrArg Neg.neg heq.symm |
| 31 | |
| 32 | /-- A locally even map on a nonempty connected symmetric set has a singular |
| 33 | derivative somewhere on that set when the dimension is odd. -/ |
| 34 | theorem exists_det_fderiv_eq_zero_of_locally_even [FiniteDimensional ℝ E] |
| 35 | (hdim : Odd (Module.finrank ℝ E)) {s : Set E} (hs : IsConnected s) |
| 36 | (hneg : ∀ x ∈ s, -x ∈ s) {f : E → E} |
| 37 | (hf : ∀ x ∈ s, ContDiffAt ℝ 1 f x) |
| 38 | (heven : ∀ x ∈ s, ∀ᶠ y in 𝓝 x, f (-y) = f y) : |
| 39 | ∃ x ∈ s, (fderiv ℝ f x).det = 0 := by |
| 40 | let d : E → ℝ := fun x => (fderiv ℝ f x).det |
| 41 | have hd : ContinuousOn d s := fun x hx => |
| 42 | (ContinuousLinearMap.continuous_det.continuousAt.comp |
| 43 | ((hf x hx).continuousAt_fderiv (by norm_num))).continuousWithinAt |
| 44 | have hodd : ∀ x ∈ s, d (-x) = -d x := by |
| 45 | intro x hx |
| 46 | dsimp only [d] |
| 47 | rw [fderiv_neg_of_eventually_even |
| 48 | ((hf (-x) (hneg x hx)).differentiableAt (by norm_num)) (heven x hx)] |
| 49 | change LinearMap.det (-((fderiv ℝ f x) : E →ₗ[ℝ] E)) = _ |
| 50 | rw [← neg_one_smul ℝ, LinearMap.det_smul, hdim.neg_one_pow] |
| 51 | simp only [neg_one_mul, ContinuousLinearMap.det] |
| 52 | obtain ⟨x, hx⟩ := hs.nonempty |
| 53 | obtain h | h := le_total (d x) 0 |
| 54 | · obtain ⟨y, hy, hyzero⟩ := hs.isPreconnected.intermediate_value hx (hneg x hx) hd |
| 55 | (show 0 ∈ Icc (d x) (d (-x)) by rw [hodd x hx]; exact ⟨h, neg_nonneg.mpr h⟩) |
| 56 | exact ⟨y, hy, hyzero⟩ |
| 57 | · obtain ⟨y, hy, hyzero⟩ := hs.isPreconnected.intermediate_value (hneg x hx) hx hd |
| 58 | (show 0 ∈ Icc (d (-x)) (d x) by rw [hodd x hx]; exact ⟨neg_nonpos.mpr h, h⟩) |
| 59 | exact ⟨y, hy, hyzero⟩ |
| 60 | |
| 61 | /-- A locally even map cannot have invertible derivatives everywhere on a |
| 62 | nonempty connected symmetric set in odd dimension. -/ |
| 63 | theorem not_forall_isInvertible_fderiv_of_locally_even [FiniteDimensional ℝ E] |
| 64 | (hdim : Odd (Module.finrank ℝ E)) {s : Set E} (hs : IsConnected s) |
| 65 | (hneg : ∀ x ∈ s, -x ∈ s) {f : E → E} |
| 66 | (hf : ∀ x ∈ s, ContDiffAt ℝ 1 f x) |
| 67 | (heven : ∀ x ∈ s, ∀ᶠ y in 𝓝 x, f (-y) = f y) : |
| 68 | ¬ ∀ x ∈ s, (fderiv ℝ f x).IsInvertible := by |
| 69 | intro hinv |
| 70 | obtain ⟨x, hx, hzero⟩ := exists_det_fderiv_eq_zero_of_locally_even hdim hs hneg hf heven |
| 71 | obtain ⟨e, he⟩ := hinv x hx |
| 72 | have hne := e.toLinearEquiv.isUnit_det'.ne_zero |
| 73 | apply hne |
| 74 | rw [← he] at hzero |
| 75 | convert hzero using 1 |
| 76 | congr 1 |
| 77 | |
| 78 | /-- An even `C¹` map on a connected symmetric open domain in odd dimension |
| 79 | cannot be a local diffeomorphism everywhere. -/ |
| 80 | theorem not_forall_isInvertible_fderiv_of_even [FiniteDimensional ℝ E] |
| 81 | (hdim : Odd (Module.finrank ℝ E)) {s : Set E} (hs : IsConnected s) |
| 82 | (hopen : IsOpen s) (hneg : ∀ x ∈ s, -x ∈ s) {f : E → E} |
| 83 | (hf : ContDiffOn ℝ 1 f s) (heven : ∀ x ∈ s, f (-x) = f x) : |
| 84 | ¬ ∀ x ∈ s, (fderiv ℝ f x).IsInvertible := by |
| 85 | apply not_forall_isInvertible_fderiv_of_locally_even hdim hs hneg |
| 86 | · exact fun x hx => hf.contDiffAt (hopen.mem_nhds hx) |
| 87 | · intro x hx |
| 88 | exact Filter.eventually_of_mem (hopen.mem_nhds hx) heven |
| 89 | |
| 90 | end Poincare.Manifold |