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.LGeometry.Regularity.SmoothEndpointExtension |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Regularity.ChartEulerEquation |
| 3 | import Mathlib.Topology.Order.ProjIcc |
| 4 | |
| 5 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/ManifoldEndpointExtension.lean` at |
| 6 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 7 | |
| 8 | |
| 9 | set_option autoImplicit false |
| 10 | set_option backward.isDefEq.respectTransparency false |
| 11 | |
| 12 | open Set Filter Topology |
| 13 | open scoped Manifold ContDiff Bundle |
| 14 | |
| 15 | universe u |
| 16 | |
| 17 | namespace PoincareMT.LGeometry |
| 18 | |
| 19 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 20 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 21 | |
| 22 | theorem exists_smooth_chart_extension_Icc {a b : ℝ} (hab : a < b) |
| 23 | (x : M) (α : ℝ → M) (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ α (Icc a b)) |
| 24 | (hsrc : MapsTo α (Icc a b) (chartAt (EuclideanSpace ℝ (Fin n)) x).source) : |
| 25 | ∃ (β : ℝ → M) (U : Set ℝ), IsOpen U ∧ Icc a b ⊆ U ∧ |
| 26 | ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ β U ∧ EqOn β α (Icc a b) := by |
| 27 | let e := extChartAt (𝓡 n) x |
| 28 | have hu : ContDiffOn ℝ ∞ (e ∘ α) (Icc a b) := chart_curve_contDiffOn x α hα hsrc |
| 29 | obtain ⟨v, hv, hvα⟩ := exists_smooth_extension_Icc hab (e ∘ α) hu |
| 30 | let U := v ⁻¹' e.target |
| 31 | have hU : IsOpen U := (isOpen_extChartAt_target (I := 𝓡 n) x).preimage hv.continuous |
| 32 | have hsrc' : MapsTo α (Icc a b) e.source := by simpa only [e, extChartAt_source] using hsrc |
| 33 | have hsub : Icc a b ⊆ U := by |
| 34 | intro s hs |
| 35 | change v s ∈ e.target |
| 36 | rw [hvα hs] |
| 37 | exact e.map_source (hsrc' hs) |
| 38 | refine ⟨e.symm ∘ v, U, hU, hsub, ?_, ?_⟩ |
| 39 | · exact (contMDiffOn_extChartAt_symm (I := 𝓡 n) x).comp hv.contMDiff.contMDiffOn |
| 40 | (fun s hs ↦ hs) |
| 41 | · intro s hs |
| 42 | change e.symm (v s) = α s |
| 43 | rw [hvα hs] |
| 44 | exact e.left_inv (hsrc' hs) |
| 45 | |
| 46 | theorem endpoint_chart_intervals {a b : ℝ} (hab : a < b) (α : ℝ → M) |
| 47 | (hα : ContinuousOn α (Icc a b)) : |
| 48 | ∃ c d : ℝ, a < c ∧ c < b ∧ a < d ∧ d < b ∧ |
| 49 | MapsTo α (Icc a c) (chartAt (EuclideanSpace ℝ (Fin n)) (α a)).source ∧ |
| 50 | MapsTo α (Icc d b) (chartAt (EuclideanSpace ℝ (Fin n)) (α b)).source := by |
| 51 | let f : Icc a b → M := fun s ↦ α s |
| 52 | have hf : Continuous f := continuousOn_iff_continuous_domRestrict.mp hα |
| 53 | let γ := f ∘ projIcc a b hab.le |
| 54 | have hγ : Continuous γ := hf.comp continuous_projIcc |
| 55 | have hγα : EqOn γ α (Icc a b) := by |
| 56 | intro s hs |
| 57 | simp only [γ, Function.comp_apply, projIcc_of_mem hab.le hs, f] |
| 58 | have hleft : γ ⁻¹' (chartAt (EuclideanSpace ℝ (Fin n)) (α a)).source ∈ 𝓝 a := by |
| 59 | apply hγ.continuousAt.preimage_mem_nhds |
| 60 | apply (chartAt (EuclideanSpace ℝ (Fin n)) (α a)).open_source.mem_nhds |
| 61 | rw [hγα ⟨le_rfl, hab.le⟩] |
| 62 | exact mem_chart_source _ _ |
| 63 | have hright : γ ⁻¹' (chartAt (EuclideanSpace ℝ (Fin n)) (α b)).source ∈ 𝓝 b := by |
| 64 | apply hγ.continuousAt.preimage_mem_nhds |
| 65 | apply (chartAt (EuclideanSpace ℝ (Fin n)) (α b)).open_source.mem_nhds |
| 66 | rw [hγα ⟨hab.le, le_rfl⟩] |
| 67 | exact mem_chart_source _ _ |
| 68 | obtain ⟨l, r, ⟨hla, har⟩, hL⟩ := mem_nhds_iff_exists_Ioo_subset.mp hleft |
| 69 | obtain ⟨l', r', ⟨hlb, hbr⟩, hR⟩ := mem_nhds_iff_exists_Ioo_subset.mp hright |
| 70 | obtain ⟨c, hac, hcm⟩ := exists_between (lt_min hab har) |
| 71 | obtain ⟨d, hmd, hdb⟩ := exists_between (max_lt hab hlb) |
| 72 | have hcb := hcm.trans_le (min_le_left b r) |
| 73 | have had := (le_max_left a l').trans_lt hmd |
| 74 | refine ⟨c, d, hac, hcb, had, hdb, ?_, ?_⟩ |
| 75 | · intro s hs |
| 76 | have h := hL ⟨hla.trans_le hs.1, hs.2.trans_lt (hcm.trans_le (min_le_right b r))⟩ |
| 77 | change γ s ∈ (chartAt (EuclideanSpace ℝ (Fin n)) (α a)).source at h |
| 78 | rwa [hγα ⟨hs.1, hs.2.trans hcb.le⟩] at h |
| 79 | · intro s hs |
| 80 | have h := hR ⟨((le_max_right a l').trans_lt hmd).trans_le hs.1, hs.2.trans_lt hbr⟩ |
| 81 | change γ s ∈ (chartAt (EuclideanSpace ℝ (Fin n)) (α b)).source at h |
| 82 | rwa [hγα ⟨had.le.trans hs.1, hs.2⟩] at h |
| 83 | |
| 84 | set_option maxHeartbeats 800000 in |
| 85 | theorem exists_smooth_manifold_extension_Icc {a b : ℝ} (hab : a < b) |
| 86 | (α : ℝ → M) (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ α (Icc a b)) : |
| 87 | ∃ (β : ℝ → M) (U : Set ℝ), IsOpen U ∧ Icc a b ⊆ U ∧ |
| 88 | ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ β U ∧ EqOn β α (Icc a b) := by |
| 89 | classical |
| 90 | obtain ⟨c, d, hac, hcb, had, hdb, hsrcL, hsrcR⟩ := |
| 91 | endpoint_chart_intervals (n := n) hab α hα.continuousOn |
| 92 | obtain ⟨L, UL, hUL, hsubL, hL, hagL⟩ := exists_smooth_chart_extension_Icc hac (α a) α |
| 93 | (hα.mono (Icc_subset_Icc le_rfl hcb.le)) hsrcL |
| 94 | obtain ⟨R, UR, hUR, hsubR, hR, hagR⟩ := exists_smooth_chart_extension_Icc hdb (α b) α |
| 95 | (hα.mono (Icc_subset_Icc had.le le_rfl)) hsrcR |
| 96 | let β : ℝ → M := fun s ↦ if s ≤ a then L s else if b ≤ s then R s else α s |
| 97 | let U := ((Iio c ∩ UL) ∪ Ioo a b) ∪ (Ioi d ∩ UR) |
| 98 | have hβL : EqOn β L (Iio c) := by |
| 99 | intro s hs |
| 100 | dsimp only [β] |
| 101 | split_ifs with hsa hbs |
| 102 | · rfl |
| 103 | · exact False.elim ((lt_of_lt_of_le hs hcb.le).not_ge hbs) |
| 104 | · exact (hagL ⟨(lt_of_not_ge hsa).le, hs.le⟩).symm |
| 105 | have hβR : EqOn β R (Ioi d) := by |
| 106 | intro s hs |
| 107 | have has : a < s := had.trans hs |
| 108 | dsimp only [β] |
| 109 | rw [if_neg has.not_ge] |
| 110 | split_ifs with hbs |
| 111 | · rfl |
| 112 | · exact (hagR ⟨hs.le, (lt_of_not_ge hbs).le⟩).symm |
| 113 | have hβα : EqOn β α (Ioo a b) := by |
| 114 | intro s hs |
| 115 | simp only [β, if_neg hs.1.not_ge, if_neg hs.2.not_ge] |
| 116 | refine ⟨β, U, ((isOpen_Iio.inter hUL).union isOpen_Ioo).union |
| 117 | (isOpen_Ioi.inter hUR), ?_, ?_, ?_⟩ |
| 118 | · intro s hs |
| 119 | rcases eq_or_lt_of_le hs.1 with hsa | has |
| 120 | · subst s |
| 121 | exact Or.inl (Or.inl ⟨hac, hsubL ⟨le_rfl, hac.le⟩⟩) |
| 122 | · rcases eq_or_lt_of_le hs.2 with hsb | hsb |
| 123 | · subst s |
| 124 | exact Or.inr ⟨hdb, hsubR ⟨hdb.le, le_rfl⟩⟩ |
| 125 | · exact Or.inl (Or.inr ⟨has, hsb⟩) |
| 126 | · intro s hs |
| 127 | rcases hs with (hs | hs) | hs |
| 128 | · exact (((hL s hs.2).contMDiffAt (hUL.mem_nhds hs.2)).congr_of_eventuallyEq |
| 129 | (eventuallyEq_of_mem (isOpen_Iio.mem_nhds hs.1) hβL)).contMDiffWithinAt |
| 130 | · exact (((hα s (Ioo_subset_Icc_self hs)).contMDiffAt (Icc_mem_nhds hs.1 hs.2)).congr_of_eventuallyEq |
| 131 | (eventuallyEq_of_mem (isOpen_Ioo.mem_nhds hs) hβα)).contMDiffWithinAt |
| 132 | · exact (((hR s hs.2).contMDiffAt (hUR.mem_nhds hs.2)).congr_of_eventuallyEq |
| 133 | (eventuallyEq_of_mem (isOpen_Ioi.mem_nhds hs.1) hβR)).contMDiffWithinAt |
| 134 | · intro s hs |
| 135 | rcases eq_or_lt_of_le hs.1 with hsa | has |
| 136 | · subst s |
| 137 | exact (hβL hac).trans (hagL ⟨le_rfl, hac.le⟩) |
| 138 | · rcases eq_or_lt_of_le hs.2 with hsb | hsb |
| 139 | · subst s |
| 140 | exact (hβR hdb).trans (hagR ⟨hdb.le, le_rfl⟩) |
| 141 | · exact hβα ⟨has, hsb⟩ |
| 142 | |
| 143 | end PoincareMT.LGeometry |