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.AlgebraicTopology.HomotopyGroup.LoopSpace.Comparison.ChartPatch |
| 2 | import PoincareLib.AlgebraicTopology.HomotopyGroup.LoopSpace.Comparison.CompactMapControl |
| 3 | import PoincareLib.AlgebraicTopology.HomotopyGroup.LoopSpace.Comparison.CoordinateApproximation |
| 4 | |
| 5 | /-! |
| 6 | # Controlled approximation in one manifold chart |
| 7 | |
| 8 | Approximate the coordinates near a compactly supported cutoff, then apply |
| 9 | the chart replacement. Uniform local control keeps all coordinate segments |
| 10 | inside the chart and bounds the manifold error. The prescribed value and |
| 11 | all prior smoothness are preserved. Source: MT Claim 18.16, printed p. 430, |
| 12 | finite-chart approximation derivation. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set Filter Function |
| 18 | open scoped Manifold ContDiff Topology |
| 19 | |
| 20 | namespace PoincareMT.Proofs.M59 |
| 21 | |
| 22 | variable {E H X F K M : Type*} |
| 23 | [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] |
| 24 | [TopologicalSpace H] (I : ModelWithCorners ℝ E H) |
| 25 | [TopologicalSpace X] [ChartedSpace H X] [IsManifold I ∞ X] |
| 26 | [T2Space X] [NormalSpace X] [SigmaCompactSpace X] |
| 27 | [NormedAddCommGroup F] [NormedSpace ℝ F] [TopologicalSpace K] |
| 28 | (J : ModelWithCorners ℝ F K) [J.Boundaryless] |
| 29 | [MetricSpace M] [ChartedSpace K M] [IsManifold J ∞ M] |
| 30 | |
| 31 | /-- A single chart replacement has arbitrarily small error, fixes one value, |
| 32 | preserves prior smoothness and is smooth on the cutoff plateau. |
| 33 | Source: the based C1 approximation in MT Claim 18.16, p. 430. -/ |
| 34 | theorem exists_local_chart_approximation |
| 35 | (c : M) (b : X → ℝ) (hb : ContMDiff I 𝓘(ℝ, ℝ) ∞ b) |
| 36 | (hbc : HasCompactSupport b) (hbI : ∀ x, b x ∈ Icc (0 : ℝ) 1) |
| 37 | (f : X → M) (hf : Continuous f) |
| 38 | (hsource : ∀ x ∈ tsupport b, f x ∈ (extChartAt J c).source) |
| 39 | (p : M) {epsilon : ℝ} (he : 0 < epsilon) : |
| 40 | ∃ g : X → M, Continuous g ∧ (∀ x, dist (g x) (f x) < epsilon) ∧ |
| 41 | (∀ x, f x = p → g x = p) ∧ |
| 42 | (∀ x, ContMDiffAt I J ∞ f x → ContMDiffAt I J ∞ g x) ∧ |
| 43 | ∀ x, b =ᶠ[𝓝 x] 1 → ContMDiffAt I J ∞ g x := by |
| 44 | let e := extChartAt J c |
| 45 | let coords : X → F := fun x => e (f x) |
| 46 | let U : Set X := f ⁻¹' e.source |
| 47 | have hU : IsOpen U := (isOpen_extChartAt_source c).preimage hf |
| 48 | have hcoords : ContinuousOn coords U := by |
| 49 | intro x hx |
| 50 | exact (((contMDiffAt_extChartAt' (by |
| 51 | change f x ∈ (extChartAt J c).source at hx |
| 52 | simpa only [extChartAt_source] using hx) : |
| 53 | ContMDiffAt J 𝓘(ℝ, F) ∞ e (f x)).continuousAt).comp |
| 54 | (f := f) hf.continuousAt).continuousWithinAt |
| 55 | have hsub : tsupport b ⊆ U := hsource |
| 56 | have hcompact : IsCompact (coords '' tsupport b) := hbc.image_of_continuousOn (hcoords.mono hsub) |
| 57 | have htarget : coords '' tsupport b ⊆ e.target := by |
| 58 | rintro _ ⟨x, hx, rfl⟩ |
| 59 | exact e.map_source (hsource x hx) |
| 60 | have hinv : ∀ z ∈ coords '' tsupport b, ContinuousAt e.symm z := by |
| 61 | intro z hz |
| 62 | exact ((contMDiffOn_extChartAt_symm c).contMDiffAt |
| 63 | ((isOpen_extChartAt_target c).mem_nhds (htarget hz)) : |
| 64 | ContMDiffAt 𝓘(ℝ, F) J ∞ e.symm z).continuousAt |
| 65 | obtain ⟨delta, hd, hcontrol⟩ := exists_uniform_compact_map_control e.symm hcompact |
| 66 | (isOpen_extChartAt_target c) htarget hinv he |
| 67 | obtain ⟨v, hv, hvclose, hvfix⟩ := exists_coordinate_approximation_preserving_value I |
| 68 | hbc hU hsub coords hcoords (e p) hd |
| 69 | have hcoordDist (x : X) (hx : x ∈ tsupport b) : |
| 70 | dist ((1 - b x) • coords x + b x • v x) (coords x) < delta := by |
| 71 | have heq : (1 - b x) • coords x + b x • v x - coords x = b x • (v x - coords x) := by |
| 72 | simp only [sub_smul, one_smul, smul_sub] |
| 73 | abel |
| 74 | rw [dist_eq_norm, heq, norm_smul, Real.norm_eq_abs, abs_of_nonneg (hbI x).1] |
| 75 | exact (mul_le_of_le_one_left (norm_nonneg _) (hbI x).2).trans_lt |
| 76 | (by simpa only [dist_eq_norm] using hvclose x hx) |
| 77 | have hc (x : X) (hx : x ∈ tsupport b) : |
| 78 | (1 - b x) • coords x + b x • v x ∈ e.target ∧ |
| 79 | dist (e.symm ((1 - b x) • coords x + b x • v x)) (f x) < epsilon := by |
| 80 | have h := hcontrol (coords x) ⟨x, hx, rfl⟩ _ (hcoordDist x hx) |
| 81 | simpa only [coords, e.left_inv (hsource x hx)] using h |
| 82 | refine ⟨chartPatch J c b v f, |
| 83 | continuous_chartPatch J c b v f hb.continuous hv.continuous hf hsource |
| 84 | (fun x hx => (hc x hx).1), ?_, ?_, ?_, ?_⟩ |
| 85 | · intro x |
| 86 | by_cases hx : b x = 0 |
| 87 | · rw [chartPatch_of_weight_zero J c b v f hx, dist_self] |
| 88 | exact he |
| 89 | · simpa only [chartPatch, hx, if_false] using (hc x (subset_closure hx)).2 |
| 90 | · intro x hx |
| 91 | exact chartPatch_preserves_value J c b v f hsource p |
| 92 | (fun y hy hyp => hvfix y hy (congrArg e hyp)) hx |
| 93 | · intro x hx |
| 94 | exact contMDiffAt_chartPatch_of_contMDiffAt I J c b v f hb hv hsource |
| 95 | (fun y hy => (hc y hy).1) hx |
| 96 | · intro x hx |
| 97 | exact contMDiffAt_chartPatch_of_plateau I J c b v f hv hf hsource |
| 98 | (fun y hy => (hc y hy).1) hx |
| 99 | |
| 100 | end PoincareMT.Proofs.M59 |