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 | # Endpoint comparison families with a varying center |
| 5 | |
| 6 | A common terminal chart and cutoff preserve every nearby center curve. |
| 7 | Compactness supplies one open domain for all unit-interval comparisons. |
| 8 | -/ |
| 9 | |
| 10 | set_option autoImplicit false |
| 11 | set_option maxSynthPendingDepth 3 |
| 12 | |
| 13 | open scoped Manifold ContDiff Topology |
| 14 | open Set 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] |
| 22 | [IsManifold (𝓡 n) ∞ M] |
| 23 | {P : Type v} [NormedAddCommGroup P] [NormedSpace ℝ P] |
| 24 | |
| 25 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 26 | |
| 27 | set_option maxHeartbeats 1200000 in |
| 28 | -- Both occurrences of the moving curve remain in their actual smooth chart domains. |
| 29 | theorem exists_parametric_smooth_endpoint_family |
| 30 | (γ : P × ℝ → M) (D : Set (P × ℝ)) (hD : IsOpen D) |
| 31 | (hγ : ContMDiffOn (𝓘(ℝ, P × ℝ)) (𝓡 n) ∞ γ D) |
| 32 | (a0 : P) (hI : ∀ r ∈ Set.Icc (0 : ℝ) 1, (a0, r) ∈ D) : |
| 33 | let e := chartAt E (γ (a0, 1)) |
| 34 | ∃ (f : (P × E) × ℝ → M) (Ω : Set ((P × E) × ℝ)) |
| 35 | (V : Set (P × E)) (W : Set P), |
| 36 | IsOpen Ω ∧ IsOpen V ∧ IsOpen W ∧ a0 ∈ W ∧ |
| 37 | (a0, e (γ (a0, 1))) ∈ V ∧ V ⊆ W ×ˢ e.target ∧ |
| 38 | V ×ˢ Set.Icc (0 : ℝ) 1 ⊆ Ω ∧ |
| 39 | ContMDiffOn (𝓘(ℝ, (P × E) × ℝ)) (𝓡 n) ∞ f Ω ∧ |
| 40 | (∀ a y, f ((a, y), 0) = γ (a, 0)) ∧ |
| 41 | (∀ a y, f ((a, y), 1) = e.symm y) ∧ |
| 42 | W ×ˢ Set.Icc (0 : ℝ) 1 ⊆ D ∧ |
| 43 | (∀ a ∈ W, (a, e (γ (a, 1))) ∈ V) ∧ |
| 44 | ∀ a ∈ W, ∀ r ∈ Set.Icc (0 : ℝ) 1, |
| 45 | f ((a, e (γ (a, 1))), r) = γ (a, r) := by |
| 46 | classical |
| 47 | let e := chartAt E (γ (a0, 1)) |
| 48 | let y0 : E := e (γ (a0, 1)) |
| 49 | let D0 := D ∩ γ ⁻¹' e.source |
| 50 | have hD0 : IsOpen D0 := hγ.continuousOn.isOpen_inter_preimage hD e.open_source |
| 51 | have ha1 : (a0, (1 : ℝ)) ∈ D0 := |
| 52 | ⟨hI 1 ⟨zero_le_one, le_rfl⟩, mem_chart_source E (γ (a0, 1))⟩ |
| 53 | have h1 : (1 : ℝ) ∈ (fun r : ℝ ↦ (a0, r)) ⁻¹' D0 := ha1 |
| 54 | obtain ⟨l, u, hlu, hsub⟩ := mem_nhds_iff_exists_Ioo_subset.mp |
| 55 | ((hD0.preimage (continuous_const.prodMk continuous_id)).mem_nhds h1) |
| 56 | obtain ⟨d, hld, hd1⟩ := exists_between (max_lt (show (0 : ℝ) < 1 by norm_num) hlu.1) |
| 57 | have hd0 : 0 < d := (le_max_left 0 l).trans_lt hld |
| 58 | have hld' : l < d := (le_max_right 0 l).trans_lt hld |
| 59 | have htail : ∀ r ∈ Set.Icc d 1, (a0, r) ∈ D0 := |
| 60 | fun r hr ↦ hsub ⟨hld'.trans_le hr.1, hr.2.trans_lt hlu.2⟩ |
| 61 | have hdisjoint : Disjoint (Set.Iic d) ({1} : Set ℝ) := by |
| 62 | rw [Set.disjoint_left] |
| 63 | intro r hr hr1 |
| 64 | exact (not_le_of_gt hd1) ((Set.mem_singleton_iff.mp hr1) ▸ hr) |
| 65 | obtain ⟨χ, hzero, hone, _⟩ := |
| 66 | exists_contMDiffMap_zero_one_nhds_of_isClosed (𝓘(ℝ, ℝ)) |
| 67 | isClosed_Iic isClosed_singleton hdisjoint (n := ⊤) |
| 68 | have hχzero (r : ℝ) (hr : r ≤ d) : χ r = 0 := by |
| 69 | have h : ∀ᶠ t in 𝓝 r, χ t = 0 := |
| 70 | (nhds_le_nhdsSet (show r ∈ Set.Iic d from hr)) hzero |
| 71 | exact h.self_of_nhds |
| 72 | have hχone : χ (1 : ℝ) = 1 := by |
| 73 | have h : ∀ᶠ t in 𝓝 (1 : ℝ), χ t = 1 := |
| 74 | (nhds_le_nhdsSet (Set.mem_singleton 1)) hone |
| 75 | exact h.self_of_nhds |
| 76 | let k : (P × E) × ℝ → E := fun z ↦ |
| 77 | e (γ (z.1.1, z.2)) + χ z.2 • (z.1.2 - e (γ (z.1.1, 1))) |
| 78 | let f : (P × E) × ℝ → M := fun z ↦ |
| 79 | if d < z.2 then e.symm (k z) else γ (z.1.1, z.2) |
| 80 | let Ω0 : Set ((P × E) × ℝ) := |
| 81 | (fun z ↦ (z.1.1, z.2)) ⁻¹' D0 ∩ (fun z ↦ (z.1.1, (1 : ℝ))) ⁻¹' D0 |
| 82 | let Ω1 := Ω0 ∩ k ⁻¹' e.target |
| 83 | let L : Set ((P × E) × ℝ) := |
| 84 | (fun z ↦ (z.1.1, z.2)) ⁻¹' D ∩ Prod.snd ⁻¹' Set.Iio d |
| 85 | let Ω := L ∪ Ω1 |
| 86 | have hΩ0 : IsOpen Ω0 := |
| 87 | (hD0.preimage (continuous_fst.fst.prodMk continuous_snd)).inter |
| 88 | (hD0.preimage (continuous_fst.fst.prodMk continuous_const)) |
| 89 | have hbase : ContMDiffOn (𝓘(ℝ, (P × E) × ℝ)) (𝓡 n) ∞ |
| 90 | (fun z ↦ γ (z.1.1, z.2)) Ω0 := |
| 91 | hγ.comp (contDiff_fst.fst.prodMk contDiff_snd).contMDiff.contMDiffOn |
| 92 | (fun z hz ↦ hz.1.1) |
| 93 | have hend : ContMDiffOn (𝓘(ℝ, (P × E) × ℝ)) (𝓡 n) ∞ |
| 94 | (fun z ↦ γ (z.1.1, 1)) Ω0 := |
| 95 | hγ.comp (contDiff_fst.fst.prodMk contDiff_const).contMDiff.contMDiffOn |
| 96 | (fun z hz ↦ hz.2.1) |
| 97 | have hcoord : ContDiffOn ℝ ∞ (fun z : (P × E) × ℝ ↦ e (γ (z.1.1, z.2))) Ω0 := |
| 98 | (contMDiffOn_chart.comp hbase (fun z hz ↦ hz.1.2)).contDiffOn |
| 99 | have hcoordEnd : ContDiffOn ℝ ∞ (fun z : (P × E) × ℝ ↦ e (γ (z.1.1, 1))) Ω0 := |
| 100 | (contMDiffOn_chart.comp hend (fun z hz ↦ hz.2.2)).contDiffOn |
| 101 | have hχ : ContDiff ℝ ∞ (fun z : (P × E) × ℝ ↦ χ z.2) := |
| 102 | χ.contMDiff.contDiff.comp contDiff_snd |
| 103 | have hk : ContDiffOn ℝ ∞ k Ω0 := |
| 104 | hcoord.add (hχ.contDiffOn.smul (contDiff_fst.snd.contDiffOn.sub hcoordEnd)) |
| 105 | have hΩ1 : IsOpen Ω1 := hk.continuousOn.isOpen_inter_preimage hΩ0 e.open_target |
| 106 | have hL : IsOpen L := (hD.preimage (continuous_fst.fst.prodMk continuous_snd)).inter |
| 107 | (isOpen_Iio.preimage continuous_snd) |
| 108 | have hfL : ContMDiffOn (𝓘(ℝ, (P × E) × ℝ)) (𝓡 n) ∞ f L := by |
| 109 | apply (hγ.comp (contDiff_fst.fst.prodMk contDiff_snd).contMDiff.contMDiffOn |
| 110 | (fun z hz ↦ hz.1)).congr |
| 111 | intro z hz |
| 112 | have hzlt : z.2 < d := hz.2 |
| 113 | simp only [f, if_neg (not_lt.mpr hzlt.le), Function.comp_apply] |
| 114 | have hf1 : ContMDiffOn (𝓘(ℝ, (P × E) × ℝ)) (𝓡 n) ∞ f Ω1 := by |
| 115 | have hcomp := (contMDiffOn_chart_symm (I := 𝓡 n) (x := γ (a0, 1))).comp |
| 116 | (hk.mono Set.inter_subset_left).contMDiffOn (fun z hz ↦ hz.2) |
| 117 | apply hcomp.congr |
| 118 | intro z hz |
| 119 | change f z = e.symm (k z) |
| 120 | by_cases hr : d < z.2 |
| 121 | · simp only [f, if_pos hr] |
| 122 | · simp only [f, if_neg hr, k, hχzero z.2 (le_of_not_gt hr), zero_smul, add_zero] |
| 123 | exact (e.left_inv hz.1.1.2).symm |
| 124 | have hΩ : IsOpen Ω := hL.union hΩ1 |
| 125 | have hf : ContMDiffOn (𝓘(ℝ, (P × E) × ℝ)) (𝓡 n) ∞ f Ω := |
| 126 | hfL.union_of_isOpen hf1 hL hΩ1 |
| 127 | have hsegment : ∀ r ∈ Set.Icc (0 : ℝ) 1, ((a0, y0), r) ∈ Ω := by |
| 128 | intro r hr |
| 129 | by_cases hrd : r < d |
| 130 | · exact Or.inl ⟨hI r hr, hrd⟩ |
| 131 | · apply Or.inr |
| 132 | have hr0 := htail r ⟨le_of_not_gt hrd, hr.2⟩ |
| 133 | refine ⟨⟨hr0, ha1⟩, ?_⟩ |
| 134 | change k ((a0, y0), r) ∈ e.target |
| 135 | simpa only [k, y0, sub_self, smul_zero, add_zero] using e.map_source hr0.2 |
| 136 | have hnear : ∀ᶠ z : P × E in 𝓝 (a0, y0), |
| 137 | ∀ r ∈ Set.Icc (0 : ℝ) 1, (z, r) ∈ Ω := by |
| 138 | apply isCompact_Icc.eventually_forall_of_forall_eventually |
| 139 | intro r hr |
| 140 | exact hΩ.mem_nhds (hsegment r hr) |
| 141 | obtain ⟨V0, hVsub, hV0, hzV0⟩ := mem_nhds_iff.mp hnear |
| 142 | have hwhole : ∀ᶠ a in 𝓝 a0, ∀ r ∈ Set.Icc (0 : ℝ) 1, (a, r) ∈ D := by |
| 143 | apply isCompact_Icc.eventually_forall_of_forall_eventually |
| 144 | intro r hr |
| 145 | exact hD.mem_nhds (hI r hr) |
| 146 | have htailNear : ∀ᶠ a in 𝓝 a0, ∀ r ∈ Set.Icc d 1, (a, r) ∈ D0 := by |
| 147 | apply isCompact_Icc.eventually_forall_of_forall_eventually |
| 148 | intro r hr |
| 149 | exact hD0.mem_nhds (htail r hr) |
| 150 | have hendAt : ContMDiffAt (𝓘(ℝ, P)) (𝓡 n) ∞ (fun a ↦ γ (a, 1)) a0 := |
| 151 | (hγ.contMDiffAt (hD.mem_nhds ha1.1)).comp a0 |
| 152 | (contMDiffAt_id.prodMk_space contMDiffAt_const) |
| 153 | have hgraph : ContinuousAt (fun a : P ↦ (a, e (γ (a, 1)))) a0 := |
| 154 | continuousAt_id.prodMk ((contMDiffOn_chart.contMDiffAt |
| 155 | (e.open_source.mem_nhds ha1.2)).comp a0 hendAt).continuousAt |
| 156 | have hgraphNear : ∀ᶠ a in 𝓝 a0, (a, e (γ (a, 1))) ∈ V0 := |
| 157 | hgraph.preimage_mem_nhds (hV0.mem_nhds hzV0) |
| 158 | obtain ⟨W, hWsub, hW, haW⟩ := |
| 159 | mem_nhds_iff.mp (hwhole.and (htailNear.and hgraphNear)) |
| 160 | let V := V0 ∩ (W ×ˢ e.target) |
| 161 | have hV : IsOpen V := hV0.inter (hW.prod e.open_target) |
| 162 | have hzV : (a0, y0) ∈ V := ⟨hzV0, haW, e.map_source ha1.2⟩ |
| 163 | refine ⟨f, Ω, V, W, hΩ, hV, hW, haW, hzV, Set.inter_subset_right, |
| 164 | (fun z hz ↦ hVsub hz.1.1 z.2 hz.2), hf, ?_, ?_, ?_, ?_, ?_⟩ |
| 165 | · intro a y |
| 166 | simp only [f, if_neg (not_lt.mpr hd0.le)] |
| 167 | · intro a y |
| 168 | change f ((a, y), 1) = e.symm y |
| 169 | simp only [f, if_pos hd1, k, hχone, one_smul, add_sub_cancel] |
| 170 | · intro z hz |
| 171 | exact (hWsub hz.1).1 z.2 hz.2 |
| 172 | · intro a ha |
| 173 | exact ⟨(hWsub ha).2.2, ha, e.map_source ((hWsub ha).2.1 1 ⟨hd1.le, le_rfl⟩).2⟩ |
| 174 | · intro a ha r hr |
| 175 | change f ((a, e (γ (a, 1))), r) = γ (a, r) |
| 176 | by_cases hrd : d < r |
| 177 | · simp only [f, if_pos hrd, k, sub_self, smul_zero, add_zero] |
| 178 | exact e.left_inv ((hWsub ha).2.1 r ⟨hrd.le, hr.2⟩).2 |
| 179 | · simp only [f, if_neg hrd] |
| 180 | |
| 181 | end PoincareMT.ReducedLength |