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.Geometry.Manifold.MFDeriv.Atlas |
| 2 | import Mathlib.Geometry.Manifold.MFDeriv.NormedSpace |
| 3 | import Mathlib.Analysis.Calculus.MeanValue |
| 4 | |
| 5 | /-! # Maps with vanishing manifold derivative -/ |
| 6 | |
| 7 | set_option autoImplicit false |
| 8 | |
| 9 | open scoped Manifold Topology |
| 10 | |
| 11 | namespace PoincareMT |
| 12 | |
| 13 | variable {E F H M : Type*} |
| 14 | [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 15 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 16 | [TopologicalSpace H] [TopologicalSpace M] |
| 17 | {I : ModelWithCorners ℝ E H} [I.Boundaryless] |
| 18 | [ChartedSpace H M] [IsManifold I 1 M] |
| 19 | |
| 20 | /-- A differentiable map into a real normed space is locally constant if its |
| 21 | manifold derivative vanishes. -/ |
| 22 | theorem isLocallyConstant_of_mfderiv_eq_zero {f : M → F} |
| 23 | (hf : MDifferentiable I 𝓘(ℝ, F) f) |
| 24 | (hzero : ∀ x, mfderiv I 𝓘(ℝ, F) f x = 0) : IsLocallyConstant f := by |
| 25 | rw [IsLocallyConstant.iff_eventually_eq] |
| 26 | intro x |
| 27 | let e := extChartAt I x |
| 28 | have hI : Set.range I = Set.univ := ModelWithCorners.Boundaryless.range_eq_univ |
| 29 | have hinv : ∀ z ∈ e.target, MDifferentiableAt 𝓘(ℝ, E) I e.symm z := by |
| 30 | intro z hz |
| 31 | simpa only [hI, mdifferentiableWithinAt_univ] using |
| 32 | mdifferentiableWithinAt_extChartAt_symm hz |
| 33 | have hd : ∀ z ∈ e.target, DifferentiableAt ℝ (f ∘ e.symm) z := by |
| 34 | intro z hz |
| 35 | exact ((hf _).comp z (hinv z hz)).differentiableAt |
| 36 | have hz : ∀ z ∈ e.target, fderiv ℝ (f ∘ e.symm) z = 0 := by |
| 37 | intro z hz |
| 38 | rw [← mfderiv_eq_fderiv, mfderiv_comp z (hf _) (hinv z hz), hzero] |
| 39 | rfl |
| 40 | obtain ⟨r, hr, hrsub⟩ := Metric.mem_nhds_iff.mp (extChartAt_target_mem_nhds (I := I) x) |
| 41 | have he : Filter.map e.symm (nhds (e x)) = nhds x := by |
| 42 | simpa only [hI, nhdsWithin_univ] using map_extChartAt_symm_nhdsWithin_range (I := I) x |
| 43 | rw [← he, Filter.eventually_map] |
| 44 | filter_upwards [Metric.ball_mem_nhds (e x) hr] with z hzball |
| 45 | have hc := (convex_ball (e x) r).is_const_of_fderivWithin_eq_zero |
| 46 | (fun y hy => (hd y (hrsub hy)).differentiableWithinAt) |
| 47 | (fun y hy => by rw [fderivWithin_of_isOpen Metric.isOpen_ball hy]; exact hz y (hrsub hy)) |
| 48 | hzball (Metric.mem_ball_self hr) |
| 49 | simpa only [Function.comp_apply, e, extChartAt_to_inv] using hc |
| 50 | |
| 51 | theorem eq_of_mfderiv_eq_zero [PreconnectedSpace M] {f : M → F} |
| 52 | (hf : MDifferentiable I 𝓘(ℝ, F) f) |
| 53 | (hzero : ∀ x, mfderiv I 𝓘(ℝ, F) f x = 0) (x y : M) : f x = f y := |
| 54 | (isLocallyConstant_of_mfderiv_eq_zero hf hzero).apply_eq_of_preconnectedSpace x y |
| 55 | |
| 56 | end PoincareMT |