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.Exponential.EndpointFamily |
| 2 | |
| 3 | /-! |
| 4 | # Jointly smooth motion of an interior point of a curve |
| 5 | |
| 6 | A chart translation supported near the marked time preserves both outer |
| 7 | endpoints. Choosing the original marked point recovers the entire base curve. |
| 8 | -/ |
| 9 | |
| 10 | set_option autoImplicit false |
| 11 | set_option maxHeartbeats 800000 |
| 12 | |
| 13 | open scoped Manifold ContDiff Topology |
| 14 | open Filter |
| 15 | |
| 16 | universe u v |
| 17 | |
| 18 | namespace PoincareMT.ReducedLength |
| 19 | |
| 20 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 21 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 22 | {E : Type v} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 23 | |
| 24 | local notation "C" => EuclideanSpace ℝ (Fin n) |
| 25 | |
| 26 | theorem exists_smooth_interior_endpoint_family (f : E × ℝ → M) (U : Set (E × ℝ)) |
| 27 | (hU : IsOpen U) (hf : ContMDiffOn (𝓘(ℝ, E × ℝ)) (𝓡 n) ∞ f U) |
| 28 | (x0 : E) (L c : ℝ) (hc : c ∈ Set.Ioo 0 L) |
| 29 | (hsegment : ∀ s ∈ Set.Icc 0 L, (x0, s) ∈ U) : |
| 30 | let e := chartAt C (f (x0, c)) |
| 31 | ∃ (Φ : (E × C) × ℝ → M) (Ω : Set ((E × C) × ℝ)) (N : Set (E × C)), |
| 32 | IsOpen Ω ∧ IsOpen N ∧ (x0, e (f (x0, c))) ∈ N ∧ |
| 33 | N ×ˢ Set.Icc 0 L ⊆ Ω ∧ ContMDiffOn (𝓘(ℝ, (E × C) × ℝ)) (𝓡 n) ∞ Φ Ω ∧ |
| 34 | (∀ z ∈ N, z.2 ∈ e.target ∧ ∀ s ∈ Set.Icc 0 L, (z.1, s) ∈ U) ∧ |
| 35 | (∀ x y, Φ ((x, y), 0) = f (x, 0)) ∧ |
| 36 | (∀ x y, Φ ((x, y), L) = f (x, L)) ∧ |
| 37 | (∀ x y, Φ ((x, y), c) = e.symm y) ∧ |
| 38 | ∀ z ∈ N, ∀ s ∈ Set.Icc 0 L, Φ ((z.1, e (f (z.1, c))), s) = f (z.1, s) := by |
| 39 | classical |
| 40 | let e := chartAt C (f (x0, c)) |
| 41 | let a : E → C := fun x ↦ e (f (x, c)) |
| 42 | let D := U ∩ f ⁻¹' e.source |
| 43 | have hD : IsOpen D := hf.continuousOn.isOpen_inter_preimage hU e.open_source |
| 44 | have hxc : (x0, c) ∈ D := |
| 45 | ⟨hsegment c (Set.Ioo_subset_Icc_self hc), mem_chart_source C (f (x0, c))⟩ |
| 46 | obtain ⟨V0, W0, hV0, hxV0, hW0, hcW0, hbox⟩ := |
| 47 | mem_nhds_prod_iff'.mp (hD.mem_nhds hxc) |
| 48 | obtain ⟨r, hr, hrsub⟩ := Metric.nhds_basis_closedBall.mem_iff.mp |
| 49 | ((hW0.inter isOpen_Ioo).mem_nhds (show c ∈ W0 ∩ Set.Ioo 0 L from ⟨hcW0, hc⟩)) |
| 50 | have hrI : Set.Icc (c - r) (c + r) ⊆ W0 ∩ Set.Ioo 0 L := by |
| 51 | simpa only [Real.closedBall_eq_Icc] using hrsub |
| 52 | have hrc : r < c := by |
| 53 | have h := (hrI (show c - r ∈ Set.Icc (c - r) (c + r) from ⟨le_rfl, by linarith⟩)).2.1 |
| 54 | linarith |
| 55 | have hcr : c + r < L := |
| 56 | (hrI (show c + r ∈ Set.Icc (c - r) (c + r) from ⟨by linarith, le_rfl⟩)).2.2 |
| 57 | have hnear : ∀ᶠ x in 𝓝 x0, ∀ s ∈ Set.Icc 0 L, (x, s) ∈ U := by |
| 58 | apply isCompact_Icc.eventually_forall_of_forall_eventually |
| 59 | intro s hs |
| 60 | exact hU.mem_nhds (hsegment s hs) |
| 61 | obtain ⟨V1, hV1sub, hV1, hxV1⟩ := mem_nhds_iff.mp hnear |
| 62 | let V := V0 ∩ V1 |
| 63 | have hV : IsOpen V := hV0.inter hV1 |
| 64 | have hxV : x0 ∈ V := ⟨hxV0, hxV1⟩ |
| 65 | have hfull (x : E) (hx : x ∈ V) (s : ℝ) (hs : s ∈ Set.Icc 0 L) : (x, s) ∈ U := |
| 66 | hV1sub hx.2 s hs |
| 67 | have hband (x : E) (hx : x ∈ V) (s : ℝ) (hs : s ∈ Set.Icc (c - r) (c + r)) : |
| 68 | (x, s) ∈ U ∧ f (x, s) ∈ e.source := hbox ⟨hx.1, (hrI hs).1⟩ |
| 69 | have hcI : c ∈ Set.Icc (c - r) (c + r) := ⟨by linarith, by linarith⟩ |
| 70 | have hdis : Disjoint (Set.Ioo (c - r / 2) (c + r / 2))ᶜ ({c} : Set ℝ) := by |
| 71 | apply Set.disjoint_left.mpr |
| 72 | intro s hs heq |
| 73 | rcases Set.mem_singleton_iff.mp heq with rfl |
| 74 | exact hs ⟨by linarith, by linarith⟩ |
| 75 | obtain ⟨χ, hzero, hone, _⟩ := exists_contMDiffMap_zero_one_nhds_of_isClosed |
| 76 | (𝓘(ℝ, ℝ)) isOpen_Ioo.isClosed_compl isClosed_singleton hdis (n := ⊤) |
| 77 | have hχzero (s : ℝ) (hs : s ∉ Set.Ioo (c - r / 2) (c + r / 2)) : χ s = 0 := by |
| 78 | have h : ∀ᶠ t in 𝓝 s, χ t = 0 := |
| 79 | (nhds_le_nhdsSet (show s ∈ (Set.Ioo (c - r / 2) (c + r / 2))ᶜ from hs)) hzero |
| 80 | exact h.self_of_nhds |
| 81 | have hχone : χ c = 1 := by |
| 82 | have h : ∀ᶠ t in 𝓝 c, χ t = 1 := |
| 83 | (nhds_le_nhdsSet (show c ∈ ({c} : Set ℝ) from Set.mem_singleton c)) hone |
| 84 | exact h.self_of_nhds |
| 85 | let k : (E × C) × ℝ → C := fun z ↦ e (f (z.1.1, z.2)) + χ z.2 • (z.1.2 - a z.1.1) |
| 86 | let Φ : (E × C) × ℝ → M := fun z ↦ |
| 87 | if z.2 ∈ Set.Ioo (c - r) (c + r) then e.symm (k z) else f (z.1.1, z.2) |
| 88 | let B : Set ((E × C) × ℝ) := (V ×ˢ Set.univ) ×ˢ Set.Ioo (c - r) (c + r) |
| 89 | have hB : IsOpen B := (hV.prod isOpen_univ).prod isOpen_Ioo |
| 90 | have hbase : ContMDiffOn (𝓘(ℝ, (E × C) × ℝ)) (𝓡 n) ∞ |
| 91 | (fun z ↦ f (z.1.1, z.2)) B := |
| 92 | hf.comp (contDiff_fst.fst.prodMk contDiff_snd).contMDiff.contMDiffOn |
| 93 | (fun z hz ↦ (hband z.1.1 hz.1.1 z.2 (Set.Ioo_subset_Icc_self hz.2)).1) |
| 94 | have hcoord : ContDiffOn ℝ ∞ (fun z : (E × C) × ℝ ↦ e (f (z.1.1, z.2))) B := |
| 95 | (contMDiffOn_chart.comp hbase |
| 96 | (fun z hz ↦ (hband z.1.1 hz.1.1 z.2 (Set.Ioo_subset_Icc_self hz.2)).2)).contDiffOn |
| 97 | have hac : ContDiffOn ℝ ∞ (fun z : (E × C) × ℝ ↦ a z.1.1) B := by |
| 98 | have hfc : ContMDiffOn (𝓘(ℝ, (E × C) × ℝ)) (𝓡 n) ∞ |
| 99 | (fun z ↦ f (z.1.1, c)) B := |
| 100 | hf.comp (contDiff_fst.fst.prodMk contDiff_const).contMDiff.contMDiffOn |
| 101 | (fun z hz ↦ (hband z.1.1 hz.1.1 c hcI).1) |
| 102 | exact (contMDiffOn_chart.comp hfc (fun z hz ↦ (hband z.1.1 hz.1.1 c hcI).2)).contDiffOn |
| 103 | have hχ : ContDiff ℝ ∞ (fun z : (E × C) × ℝ ↦ χ z.2) := |
| 104 | χ.contMDiff.contDiff.comp contDiff_snd |
| 105 | have hk : ContDiffOn ℝ ∞ k B := |
| 106 | hcoord.add (hχ.contDiffOn.smul (contDiff_fst.snd.contDiffOn.sub hac)) |
| 107 | let W := B ∩ k ⁻¹' e.target |
| 108 | have hW : IsOpen W := hk.continuousOn.isOpen_inter_preimage hB e.open_target |
| 109 | let A : Set ((E × C) × ℝ) := (Prod.fst ⁻¹' (V ×ˢ Set.univ)) ∩ |
| 110 | (fun z : (E × C) × ℝ ↦ (z.1.1, z.2)) ⁻¹' U |
| 111 | have hA : IsOpen A := ((hV.prod isOpen_univ).preimage continuous_fst).inter |
| 112 | (hU.preimage (continuous_fst.fst.prodMk continuous_snd)) |
| 113 | let O := A ∩ (Prod.snd ⁻¹' Set.Icc (c - r / 2) (c + r / 2))ᶜ |
| 114 | have hO : IsOpen O := hA.inter (isClosed_Icc.preimage continuous_snd).isOpen_compl |
| 115 | have hfO : ContMDiffOn (𝓘(ℝ, (E × C) × ℝ)) (𝓡 n) ∞ Φ O := by |
| 116 | have hbaseO : ContMDiffOn (𝓘(ℝ, (E × C) × ℝ)) (𝓡 n) ∞ |
| 117 | (fun z ↦ f (z.1.1, z.2)) O := |
| 118 | hf.comp (contDiff_fst.fst.prodMk contDiff_snd).contMDiff.contMDiffOn (fun z hz ↦ hz.1.2) |
| 119 | apply hbaseO.congr |
| 120 | intro z hz |
| 121 | change Φ z = f (z.1.1, z.2) |
| 122 | by_cases hs : z.2 ∈ Set.Ioo (c - r) (c + r) |
| 123 | · have hzχ : χ z.2 = 0 := hχzero z.2 (fun ht ↦ hz.2 (Set.Ioo_subset_Icc_self ht)) |
| 124 | simp only [Φ, if_pos hs, k, hzχ, zero_smul, add_zero] |
| 125 | exact e.left_inv (hband z.1.1 hz.1.1.1 z.2 (Set.Ioo_subset_Icc_self hs)).2 |
| 126 | · simp only [Φ, if_neg hs] |
| 127 | have hfW : ContMDiffOn (𝓘(ℝ, (E × C) × ℝ)) (𝓡 n) ∞ Φ W := by |
| 128 | have hcomp := (contMDiffOn_chart_symm (I := 𝓡 n) (x := f (x0, c))).comp |
| 129 | (hk.mono Set.inter_subset_left).contMDiffOn (fun z hz ↦ hz.2) |
| 130 | apply hcomp.congr |
| 131 | intro z hz |
| 132 | simp only [Φ, if_pos hz.1.2, Function.comp_apply] |
| 133 | rfl |
| 134 | let Ω := O ∪ W |
| 135 | have hΩ : IsOpen Ω := hO.union hW |
| 136 | have hΦ : ContMDiffOn (𝓘(ℝ, (E × C) × ℝ)) (𝓡 n) ∞ Φ Ω := |
| 137 | hfO.union_of_isOpen hfW hO hW |
| 138 | have hcenter (s : ℝ) (hs : s ∈ Set.Icc 0 L) : ((x0, a x0), s) ∈ Ω := by |
| 139 | by_cases hsb : s ∈ Set.Ioo (c - r) (c + r) |
| 140 | · refine Or.inr ⟨⟨⟨hxV, Set.mem_univ _⟩, hsb⟩, ?_⟩ |
| 141 | change k ((x0, a x0), s) ∈ e.target |
| 142 | simpa only [k, sub_self, smul_zero, add_zero] using |
| 143 | e.map_source (hband x0 hxV s (Set.Ioo_subset_Icc_self hsb)).2 |
| 144 | · refine Or.inl ⟨⟨⟨hxV, Set.mem_univ _⟩, hsegment s hs⟩, ?_⟩ |
| 145 | intro hsi |
| 146 | apply hsb |
| 147 | change s ∈ Set.Icc (c - r / 2) (c + r / 2) at hsi |
| 148 | exact ⟨by linarith [hsi.1], by linarith [hsi.2]⟩ |
| 149 | have hnearΩ : ∀ᶠ z : E × C in 𝓝 (x0, a x0), ∀ s ∈ Set.Icc 0 L, (z, s) ∈ Ω := by |
| 150 | apply isCompact_Icc.eventually_forall_of_forall_eventually |
| 151 | intro s hs |
| 152 | exact hΩ.mem_nhds (hcenter s hs) |
| 153 | obtain ⟨N0, hNsub, hN0, hxN0⟩ := mem_nhds_iff.mp hnearΩ |
| 154 | let N := N0 ∩ (V ×ˢ e.target) |
| 155 | have hxTarget : a x0 ∈ e.target := e.map_source (mem_chart_source C (f (x0, c))) |
| 156 | refine ⟨Φ, Ω, N, hΩ, hN0.inter (hV.prod e.open_target), ⟨hxN0, hxV, hxTarget⟩, |
| 157 | ?_, hΦ, ?_, ?_, ?_, ?_, ?_⟩ |
| 158 | · intro z hz |
| 159 | exact hNsub hz.1.1 z.2 hz.2 |
| 160 | · intro z hz |
| 161 | exact ⟨hz.2.2, fun s hs ↦ hfull z.1 hz.2.1 s hs⟩ |
| 162 | · intro x y |
| 163 | have h0 : (0 : ℝ) ∉ Set.Ioo (c - r) (c + r) := by |
| 164 | intro h |
| 165 | linarith [h.1] |
| 166 | simp only [Φ, if_neg h0] |
| 167 | · intro x y |
| 168 | have hL : L ∉ Set.Ioo (c - r) (c + r) := by |
| 169 | intro h |
| 170 | linarith [h.2] |
| 171 | simp only [Φ, if_neg hL] |
| 172 | · intro x y |
| 173 | have hcc : c ∈ Set.Ioo (c - r) (c + r) := ⟨by linarith, by linarith⟩ |
| 174 | simp only [Φ, if_pos hcc, k, hχone, one_smul, a, add_sub_cancel] |
| 175 | rfl |
| 176 | · intro z hz s _ |
| 177 | change Φ ((z.1, a z.1), s) = f (z.1, s) |
| 178 | by_cases hsb : s ∈ Set.Ioo (c - r) (c + r) |
| 179 | · simp only [Φ, if_pos hsb, k, sub_self, smul_zero, add_zero] |
| 180 | exact e.left_inv (hband z.1 hz.2.1 s (Set.Ioo_subset_Icc_self hsb)).2 |
| 181 | · simp only [Φ, if_neg hsb] |
| 182 | |
| 183 | end PoincareMT.ReducedLength |