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.Calculus.ImplicitFunction.RegularScalar |
| 2 | |
| 3 | open Set Function |
| 4 | open scoped Topology ContDiff |
| 5 | |
| 6 | namespace Poincare.Analysis |
| 7 | |
| 8 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 9 | [FiniteDimensional ℝ E] |
| 10 | |
| 11 | /-- A regular hypersurface has smooth kernel coordinates preserving critical points. -/ |
| 12 | theorem exists_regular_level_parametrization {V : Set E} (hV : IsOpen V) |
| 13 | {f g : E → ℝ} (hf : ContDiffOn ℝ ∞ f V) (hg : ContDiffOn ℝ ∞ g V) |
| 14 | {a : E} (ha : a ∈ V) (hga : g a = 0) |
| 15 | (hreg : Surjective (fderiv ℝ g a)) : |
| 16 | let F := (fderiv ℝ g a).ker |
| 17 | ∃ (W : Set E) (U : Set F) (p : F → E) (q : E → F), |
| 18 | IsOpen W ∧ a ∈ W ∧ W ⊆ V ∧ IsOpen U ∧ (0 : F) ∈ U ∧ |
| 19 | ContDiffOn ℝ ∞ p U ∧ ContDiffOn ℝ ∞ q W ∧ p 0 = a ∧ |
| 20 | BijOn p U (W ∩ {x | g x = 0}) ∧ |
| 21 | (∀ u ∈ U, q (p u) = u) ∧ |
| 22 | (∀ x ∈ W, g x = 0 → p (q x) = x) ∧ |
| 23 | ContDiffOn ℝ ∞ (f ∘ p) U ∧ |
| 24 | ∀ u ∈ U, fderiv ℝ f (p u) = 0 → fderiv ℝ (f ∘ p) u = 0 := by |
| 25 | dsimp only |
| 26 | obtain ⟨e, hea, heV, hepoint, he, hei, hefirst, helevel⟩ := |
| 27 | exists_smooth_superlevel_chart hV hg ha hreg |
| 28 | let F := (fderiv ℝ g a).ker |
| 29 | let U : Set F := (fun u => ((0 : ℝ), u)) ⁻¹' e.target |
| 30 | let p : F → E := fun u => e.symm (0, u) |
| 31 | let q : E → F := fun x => (e x).2 |
| 32 | have hU : IsOpen U := e.open_target.preimage (continuous_const.prodMk continuous_id) |
| 33 | have hpoint : e a = (0, 0) := by simpa [hga] using hepoint |
| 34 | have h0 : (0 : F) ∈ U := by |
| 35 | change (0, (0 : F)) ∈ e.target |
| 36 | rw [← hpoint] |
| 37 | exact e.map_source hea |
| 38 | have hp : ContDiffOn ℝ ∞ p U := |
| 39 | hei.comp (contDiff_const.prodMk contDiff_id).contDiffOn (fun u hu => hu) |
| 40 | have hq : ContDiffOn ℝ ∞ q e.source := contDiff_snd.comp_contDiffOn he |
| 41 | have hps : MapsTo p U (e.source ∩ {x | g x = 0}) := by |
| 42 | intro u hu |
| 43 | refine ⟨e.map_target hu, ?_⟩ |
| 44 | change g (e.symm (0, u)) = 0 |
| 45 | rw [← hefirst _ (e.map_target hu)] |
| 46 | exact congrArg Prod.fst (e.right_inv hu) |
| 47 | have hqp : ∀ u ∈ U, q (p u) = u := by |
| 48 | intro u hu |
| 49 | exact congrArg Prod.snd (e.right_inv hu) |
| 50 | have hezero : ∀ x ∈ e.source, g x = 0 → (0, (e x).2) = e x := by |
| 51 | intro x hx hgx |
| 52 | ext |
| 53 | · exact (hefirst x hx).trans hgx |>.symm |
| 54 | · rfl |
| 55 | have hpq : ∀ x ∈ e.source, g x = 0 → p (q x) = x := by |
| 56 | intro x hx hgx |
| 57 | change e.symm (0, (e x).2) = x |
| 58 | rw [hezero x hx hgx, e.left_inv hx] |
| 59 | have hb : BijOn p U (e.source ∩ {x | g x = 0}) := by |
| 60 | refine ⟨hps, ?_, ?_⟩ |
| 61 | · intro u hu v hv huv |
| 62 | rw [← hqp u hu, ← hqp v hv, huv] |
| 63 | · intro x hx |
| 64 | refine ⟨q x, ?_, hpq x hx.1 hx.2⟩ |
| 65 | change (0, (e x).2) ∈ e.target |
| 66 | rw [hezero x hx.1 hx.2] |
| 67 | exact e.map_source hx.1 |
| 68 | have hpV : MapsTo p U V := fun u hu => heV (hps hu).1 |
| 69 | refine ⟨e.source, U, p, q, e.open_source, hea, heV, hU, h0, hp, hq, |
| 70 | ?_, hb, hqp, hpq, hf.comp hp hpV, ?_⟩ |
| 71 | · change e.symm (0, 0) = a |
| 72 | rw [← hpoint, e.left_inv hea] |
| 73 | · intro u hu hcrit |
| 74 | have hfu := ((hf (p u) (hpV hu)).contDiffAt |
| 75 | (hV.mem_nhds (hpV hu))).differentiableAt (by simp) |
| 76 | have hpu := ((hp u hu).contDiffAt (hU.mem_nhds hu)).differentiableAt (by simp) |
| 77 | rw [fderiv_comp u hfu hpu, hcrit, ContinuousLinearMap.zero_comp] |
| 78 | |
| 79 | end Poincare.Analysis |
| 80 |