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.Geometry.Riemannian.MinimalSurface.Sphere.Compatibility.ShortLoops |
| 2 | import Mathlib.Geometry.Manifold.BumpFunction |
| 3 | |
| 4 | /-! |
| 5 | # One chart replacement in manifold approximation |
| 6 | |
| 7 | A smooth cutoff replaces coordinates on its plateau and leaves the original |
| 8 | map unchanged off its support. Chart membership is an explicit hypothesis; |
| 9 | smoothness already obtained by earlier replacements is preserved. This is |
| 10 | the finite-chart approximation step used for MT Claim 18.16, printed p. 430. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set Filter Function |
| 16 | open scoped Manifold ContDiff Topology |
| 17 | |
| 18 | noncomputable section |
| 19 | |
| 20 | namespace PoincareMT.Proofs.M59 |
| 21 | |
| 22 | variable {E H X F K M : Type*} |
| 23 | [NormedAddCommGroup E] [NormedSpace ℝ E] [TopologicalSpace H] |
| 24 | (I : ModelWithCorners ℝ E H) |
| 25 | [TopologicalSpace X] [ChartedSpace H X] |
| 26 | [NormedAddCommGroup F] [NormedSpace ℝ F] [TopologicalSpace K] |
| 27 | (J : ModelWithCorners ℝ F K) |
| 28 | [TopologicalSpace M] [ChartedSpace K M] |
| 29 | |
| 30 | /-- Replace the coordinate map where the cutoff is nonzero. |
| 31 | Source: the finite-chart approximation derivation for MT Claim 18.16, p. 430. -/ |
| 32 | def chartPatch (c : M) (b : X → ℝ) (v : X → F) (f : X → M) (x : X) : M := |
| 33 | if b x = 0 then f x else |
| 34 | (extChartAt J c).symm ((1 - b x) • extChartAt J c (f x) + b x • v x) |
| 35 | |
| 36 | omit [TopologicalSpace X] in |
| 37 | /-- A zero cutoff leaves the complete value unchanged. |
| 38 | Source: MT Claim 18.16, p. 430, chart approximation derivation. -/ |
| 39 | theorem chartPatch_of_weight_zero (c : M) (b : X → ℝ) (v : X → F) (f : X → M) |
| 40 | {x : X} (hx : b x = 0) : chartPatch J c b v f x = f x := by |
| 41 | simp only [chartPatch, hx, if_true] |
| 42 | |
| 43 | /-- Off the closed support, replacement agrees locally with the original map. |
| 44 | Source: MT Claim 18.16, p. 430, chart approximation derivation. -/ |
| 45 | theorem chartPatch_eventually_of_not_mem_tsupport |
| 46 | (c : M) (b : X → ℝ) (v : X → F) (f : X → M) {x : X} (hx : x ∉ tsupport b) : |
| 47 | chartPatch J c b v f =ᶠ[𝓝 x] f := by |
| 48 | filter_upwards [(isClosed_tsupport b).isOpen_compl.mem_nhds hx] with y hy |
| 49 | apply chartPatch_of_weight_zero |
| 50 | exact notMem_support.mp (fun h => hy (subset_closure h)) |
| 51 | |
| 52 | /-- Near a point mapped into the chart source, both branches have the |
| 53 | same coordinate formula. Source: MT Claim 18.16, p. 430, chart approximation. -/ |
| 54 | theorem chartPatch_eventually_formula |
| 55 | (c : M) (b : X → ℝ) (v : X → F) (f : X → M) {x : X} |
| 56 | (hf : ContinuousAt f x) (hx : f x ∈ (extChartAt J c).source) : |
| 57 | chartPatch J c b v f =ᶠ[𝓝 x] |
| 58 | (fun y => (extChartAt J c).symm ((1 - b y) • extChartAt J c (f y) + b y • v y)) := by |
| 59 | filter_upwards [hf ((isOpen_extChartAt_source c).mem_nhds hx)] with y hy |
| 60 | unfold chartPatch |
| 61 | split_ifs with hb |
| 62 | · simpa only [hb, sub_zero, one_smul, zero_smul, add_zero] using |
| 63 | ((extChartAt J c).left_inv hy).symm |
| 64 | · rfl |
| 65 | |
| 66 | variable [J.Boundaryless] [IsManifold J ∞ M] |
| 67 | |
| 68 | /-- The replacement is continuous if its supported coordinate segments stay |
| 69 | inside the chart. Source: MT Claim 18.16, p. 430, chart approximation. -/ |
| 70 | theorem continuous_chartPatch (c : M) (b : X → ℝ) (v : X → F) (f : X → M) |
| 71 | (hb : Continuous b) (hv : Continuous v) (hf : Continuous f) |
| 72 | (hsource : ∀ x ∈ tsupport b, f x ∈ (extChartAt J c).source) |
| 73 | (htarget : ∀ x ∈ tsupport b, |
| 74 | (1 - b x) • extChartAt J c (f x) + b x • v x ∈ (extChartAt J c).target) : |
| 75 | Continuous (chartPatch J c b v f) := by |
| 76 | apply continuous_iff_continuousAt.mpr |
| 77 | intro x |
| 78 | by_cases hx : x ∈ tsupport b |
| 79 | · have hc : ContinuousAt (fun y => extChartAt J c (f y)) x := |
| 80 | ((contMDiffAt_extChartAt' (by simpa only [extChartAt_source] using hsource x hx) : |
| 81 | ContMDiffAt J 𝓘(ℝ, F) ∞ (extChartAt J c) (f x)).continuousAt).comp hf.continuousAt |
| 82 | have hi : ContinuousAt (fun y => (1 - b y) • extChartAt J c (f y) + b y • v y) x := |
| 83 | ((continuousAt_const.sub hb.continuousAt).smul hc).add (hb.continuousAt.smul hv.continuousAt) |
| 84 | have hmain : ContinuousAt (fun y => (extChartAt J c).symm |
| 85 | ((1 - b y) • extChartAt J c (f y) + b y • v y)) x := |
| 86 | (((contMDiffOn_extChartAt_symm c).contMDiffAt |
| 87 | ((isOpen_extChartAt_target c).mem_nhds (htarget x hx)) : |
| 88 | ContMDiffAt 𝓘(ℝ, F) J ∞ (extChartAt J c).symm _).continuousAt).comp |
| 89 | (f := fun y => (1 - b y) • extChartAt J c (f y) + b y • v y) hi |
| 90 | exact hmain.congr_of_eventuallyEq |
| 91 | (chartPatch_eventually_formula J c b v f hf.continuousAt (hsource x hx)) |
| 92 | · exact hf.continuousAt.congr_of_eventuallyEq |
| 93 | (chartPatch_eventually_of_not_mem_tsupport J c b v f hx) |
| 94 | |
| 95 | /-- A chart replacement preserves every point where the map is already smooth. |
| 96 | Source: the finite-chart induction for MT Claim 18.16, p. 430. -/ |
| 97 | theorem contMDiffAt_chartPatch_of_contMDiffAt |
| 98 | (c : M) (b : X → ℝ) (v : X → F) (f : X → M) |
| 99 | (hb : ContMDiff I 𝓘(ℝ, ℝ) ∞ b) (hv : ContMDiff I 𝓘(ℝ, F) ∞ v) |
| 100 | (hsource : ∀ x ∈ tsupport b, f x ∈ (extChartAt J c).source) |
| 101 | (htarget : ∀ x ∈ tsupport b, |
| 102 | (1 - b x) • extChartAt J c (f x) + b x • v x ∈ (extChartAt J c).target) |
| 103 | {x : X} (hf : ContMDiffAt I J ∞ f x) : |
| 104 | ContMDiffAt I J ∞ (chartPatch J c b v f) x := by |
| 105 | by_cases hx : x ∈ tsupport b |
| 106 | · have hc : ContMDiffAt I 𝓘(ℝ, F) ∞ (fun y => extChartAt J c (f y)) x := |
| 107 | (contMDiffAt_extChartAt' (by simpa only [extChartAt_source] using hsource x hx)).comp x hf |
| 108 | have hi : ContMDiffAt I 𝓘(ℝ, F) ∞ |
| 109 | (fun y => (1 - b y) • extChartAt J c (f y) + b y • v y) x := |
| 110 | ((contMDiffAt_const.sub hb.contMDiffAt).smul hc).add (hb.contMDiffAt.smul hv.contMDiffAt) |
| 111 | apply (((contMDiffOn_extChartAt_symm c).contMDiffAt |
| 112 | ((isOpen_extChartAt_target c).mem_nhds (htarget x hx))).comp x hi).congr_of_eventuallyEq |
| 113 | exact chartPatch_eventually_formula J c b v f hf.continuousAt (hsource x hx) |
| 114 | · exact hf.congr_of_eventuallyEq (chartPatch_eventually_of_not_mem_tsupport J c b v f hx) |
| 115 | |
| 116 | /-- On a plateau the new coordinate map supplies smoothness even if the |
| 117 | original map is only continuous. Source: MT Claim 18.16, p. 430, chart approximation. -/ |
| 118 | theorem contMDiffAt_chartPatch_of_plateau |
| 119 | (c : M) (b : X → ℝ) (v : X → F) (f : X → M) |
| 120 | (hv : ContMDiff I 𝓘(ℝ, F) ∞ v) (hf : Continuous f) |
| 121 | (hsource : ∀ x ∈ tsupport b, f x ∈ (extChartAt J c).source) |
| 122 | (htarget : ∀ x ∈ tsupport b, |
| 123 | (1 - b x) • extChartAt J c (f x) + b x • v x ∈ (extChartAt J c).target) |
| 124 | {x : X} (hb : b =ᶠ[𝓝 x] 1) : ContMDiffAt I J ∞ (chartPatch J c b v f) x := by |
| 125 | have hx : x ∈ tsupport b := subset_closure (by |
| 126 | change b x ≠ 0 |
| 127 | rw [hb.eq_of_nhds] |
| 128 | exact one_ne_zero) |
| 129 | have htx : v x ∈ (extChartAt J c).target := by |
| 130 | simpa only [hb.eq_of_nhds, Pi.one_apply, sub_self, zero_smul, one_smul, zero_add] |
| 131 | using htarget x hx |
| 132 | apply (((contMDiffOn_extChartAt_symm c).contMDiffAt |
| 133 | ((isOpen_extChartAt_target c).mem_nhds htx)).comp x hv.contMDiffAt).congr_of_eventuallyEq |
| 134 | filter_upwards [chartPatch_eventually_formula J c b v f hf.continuousAt (hsource x hx), hb] |
| 135 | with y hy hby |
| 136 | simpa only [hby, Pi.one_apply, sub_self, zero_smul, one_smul, zero_add, |
| 137 | Function.comp_apply] using hy |
| 138 | |
| 139 | omit [J.Boundaryless] [IsManifold J ∞ M] in |
| 140 | /-- Matching a fixed coordinate value preserves that value exactly. |
| 141 | Source: the constant-boundary clause for MT Claim 18.16, p. 430. -/ |
| 142 | theorem chartPatch_preserves_value |
| 143 | (c : M) (b : X → ℝ) (v : X → F) (f : X → M) |
| 144 | (hsource : ∀ x ∈ tsupport b, f x ∈ (extChartAt J c).source) |
| 145 | (p : M) (hp : ∀ x ∈ tsupport b, f x = p → v x = extChartAt J c p) |
| 146 | {x : X} (hx : f x = p) : chartPatch J c b v f x = p := by |
| 147 | by_cases hb : b x = 0 |
| 148 | · exact (chartPatch_of_weight_zero J c b v f hb).trans hx |
| 149 | · have hxs : x ∈ tsupport b := subset_closure hb |
| 150 | simp only [chartPatch, hb, if_false, hp x hxs hx, ← hx, ← add_smul, sub_add_cancel, one_smul] |
| 151 | exact (extChartAt J c).left_inv (hsource x hxs) |
| 152 | |
| 153 | end PoincareMT.Proofs.M59 |