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.RicciFlow.ReducedGeometry.ReducedLength.Barrier.SmoothJoinCutoff |
| 2 | import PoincareLib.Geometry.Riemannian.Metric |
| 3 | import Mathlib.Geometry.Manifold.ContMDiff.NormedSpace |
| 4 | |
| 5 | /-! |
| 6 | # Smooth gluing of curves through a chart |
| 7 | |
| 8 | The blend is used only in a fixed chart neighborhood. Its constant cutoff |
| 9 | regions give open overlaps with the original curves at both glue points. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open scoped Manifold ContDiff Topology |
| 15 | open Filter |
| 16 | |
| 17 | namespace PoincareMT.ReducedLength |
| 18 | |
| 19 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 20 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 21 | |
| 22 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 23 | |
| 24 | noncomputable def smoothChartJoin (α β : ℝ → M) (p : M) (c r d s : ℝ) : M := by |
| 25 | classical |
| 26 | let e := chartAt E p |
| 27 | exact if s < c - r then α s else if c + r < s then β s else |
| 28 | e.symm (smoothJoinBlend (fun t ↦ e (α t)) (fun t ↦ e (β t)) c d s) |
| 29 | |
| 30 | theorem smoothChartJoin_eq_middle (α β : ℝ → M) (p : M) (c r d s : ℝ) |
| 31 | (hs : s ∈ Set.Icc (c - r) (c + r)) : |
| 32 | smoothChartJoin (n := n) α β p c r d s = (chartAt E p).symm |
| 33 | (smoothJoinBlend (fun t ↦ (chartAt E p) (α t)) (fun t ↦ (chartAt E p) (β t)) c d s) := by |
| 34 | simp only [smoothChartJoin, if_neg (not_lt.mpr hs.1), if_neg (not_lt.mpr hs.2)] |
| 35 | |
| 36 | theorem smoothChartJoin_eq_left (α β : ℝ → M) (p : M) (c r d : ℝ) |
| 37 | (hr : 0 < r) (hd : 0 < d) |
| 38 | (hα : ∀ s ∈ Set.Icc (c - r) (c + r), α s ∈ (chartAt E p).source) |
| 39 | (s : ℝ) (hs : s ≤ c - d) : smoothChartJoin (n := n) α β p c r d s = α s := by |
| 40 | by_cases hsr : s < c - r |
| 41 | · simp only [smoothChartJoin, if_pos hsr] |
| 42 | · have hsr' : s ≤ c + r := by linarith |
| 43 | rw [smoothChartJoin_eq_middle (n := n) α β p c r d s ⟨le_of_not_gt hsr, hsr'⟩, |
| 44 | smoothJoinBlend_eq_left _ _ c hd hs] |
| 45 | exact (chartAt E p).left_inv (hα s ⟨le_of_not_gt hsr, hsr'⟩) |
| 46 | |
| 47 | theorem smoothChartJoin_eq_right (α β : ℝ → M) (p : M) (c r d : ℝ) |
| 48 | (hr : 0 < r) (hd : 0 < d) |
| 49 | (hβ : ∀ s ∈ Set.Icc (c - r) (c + r), β s ∈ (chartAt E p).source) |
| 50 | (s : ℝ) (hs : c + d ≤ s) : smoothChartJoin (n := n) α β p c r d s = β s := by |
| 51 | have hsr : ¬s < c - r := by linarith |
| 52 | by_cases hrs : c + r < s |
| 53 | · simp only [smoothChartJoin, if_neg hsr, if_pos hrs] |
| 54 | · rw [smoothChartJoin_eq_middle (n := n) α β p c r d s ⟨le_of_not_gt hsr, le_of_not_gt hrs⟩, |
| 55 | smoothJoinBlend_eq_right _ _ c hd hs] |
| 56 | exact (chartAt E p).left_inv (hβ s ⟨le_of_not_gt hsr, le_of_not_gt hrs⟩) |
| 57 | |
| 58 | theorem smoothChartJoin_contMDiffOn (α β : ℝ → M) (p : M) (c r d : ℝ) |
| 59 | (hr : 0 < r) (hd : 0 < d) (hdr : d < r) (D : Set ℝ) (hD : IsOpen D) |
| 60 | (hI : Set.Icc (c - r) (c + r) ⊆ D) |
| 61 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ α D) |
| 62 | (hβ : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ β D) |
| 63 | (hαs : ∀ s ∈ Set.Icc (c - r) (c + r), α s ∈ (chartAt E p).source) |
| 64 | (hβs : ∀ s ∈ Set.Icc (c - r) (c + r), β s ∈ (chartAt E p).source) |
| 65 | (hblend : ∀ s ∈ Set.Ioo (c - r) (c + r), |
| 66 | smoothJoinBlend (fun t ↦ (chartAt E p) (α t)) (fun t ↦ (chartAt E p) (β t)) c d s ∈ |
| 67 | (chartAt E p).target) : |
| 68 | ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ (smoothChartJoin (n := n) α β p c r d) D := by |
| 69 | have hac : ContDiffOn ℝ ∞ (fun t ↦ (chartAt E p) (α t)) (Set.Ioo (c - r) (c + r)) := |
| 70 | (contMDiffOn_chart.comp (hα.mono (Set.Ioo_subset_Icc_self.trans hI)) |
| 71 | (fun s hs ↦ hαs s (Set.Ioo_subset_Icc_self hs))).contDiffOn |
| 72 | have hbc : ContDiffOn ℝ ∞ (fun t ↦ (chartAt E p) (β t)) (Set.Ioo (c - r) (c + r)) := |
| 73 | (contMDiffOn_chart.comp (hβ.mono (Set.Ioo_subset_Icc_self.trans hI)) |
| 74 | (fun s hs ↦ hβs s (Set.Ioo_subset_Icc_self hs))).contDiffOn |
| 75 | have hmid := (contMDiffOn_chart_symm (I := 𝓡 n) (x := p)).comp |
| 76 | (smoothJoinBlend_contDiffOn _ _ c d _ hac hbc).contMDiffOn hblend |
| 77 | intro s hs |
| 78 | by_cases hl : s < c - d |
| 79 | · have heq : smoothChartJoin (n := n) α β p c r d =ᶠ[𝓝 s] α := by |
| 80 | filter_upwards [gt_mem_nhds hl] with t ht |
| 81 | exact smoothChartJoin_eq_left (n := n) α β p c r d hr hd hαs t ht.le |
| 82 | exact ((hα.contMDiffAt (hD.mem_nhds hs)).congr_of_eventuallyEq heq).contMDiffWithinAt |
| 83 | by_cases hh : c + d < s |
| 84 | · have heq : smoothChartJoin (n := n) α β p c r d =ᶠ[𝓝 s] β := by |
| 85 | filter_upwards [lt_mem_nhds hh] with t ht |
| 86 | exact smoothChartJoin_eq_right (n := n) α β p c r d hr hd hβs t ht.le |
| 87 | exact ((hβ.contMDiffAt (hD.mem_nhds hs)).congr_of_eventuallyEq heq).contMDiffWithinAt |
| 88 | have hsI : s ∈ Set.Ioo (c - r) (c + r) := ⟨by linarith, by linarith⟩ |
| 89 | have heq : smoothChartJoin (n := n) α β p c r d =ᶠ[𝓝 s] |
| 90 | (fun t ↦ (chartAt E p).symm |
| 91 | (smoothJoinBlend (fun t ↦ (chartAt E p) (α t)) (fun t ↦ (chartAt E p) (β t)) c d t)) := by |
| 92 | filter_upwards [isOpen_Ioo.mem_nhds hsI] with t ht |
| 93 | exact smoothChartJoin_eq_middle (n := n) α β p c r d t (Set.Ioo_subset_Icc_self ht) |
| 94 | exact ((hmid.contMDiffAt (isOpen_Ioo.mem_nhds hsI)).congr_of_eventuallyEq heq).contMDiffWithinAt |
| 95 | |
| 96 | end PoincareMT.ReducedLength |