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.CurveShortening.Ramp.LocalFlow.Intrinsic.ClosedPrefix |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Closed.SmoothSpatialJets |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Smooth.LocalExistence |
| 4 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Uniqueness.Fields |
| 5 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Intrinsic.RegularityFromSpatialLimits |
| 6 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.C2.SpeedPrimitive |
| 7 | |
| 8 | /-! |
| 9 | # Extending an actual intrinsic prefix through a smooth restart |
| 10 | |
| 11 | One fixed normalization gives a smooth terminal slice. Actual local |
| 12 | existence and uniqueness identify the right-hand jets, and the speed |
| 13 | primitive supplies joint regularity through the join. MT2007 Claim 19.1, |
| 14 | p. 437; `2026-09-23-maximal-prefix-intrinsic-regularity.md`, statement 2. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set |
| 21 | open scoped Manifold ContDiff Bundle intervalIntegral |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.M63 |
| 26 | |
| 27 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 29 | {a b : ℝ} |
| 30 | |
| 31 | /-- An actual intrinsic prefix extends strictly inside the given C2 |
| 32 | solution interval. MT2007 Claim 19.1, p. 437; maximal-prefix intrinsic |
| 33 | regularity, statement 2. The regularity at the join is produced by the |
| 34 | actual speed primitive and spatial-jet bridge. -/ |
| 35 | theorem exists_larger_intrinsic_closed_prefix |
| 36 | [T2Space M] (F : RicciFlow n M (Icc a b)) |
| 37 | (hcompact : IsCompact (univ : Set M)) |
| 38 | {S T : ℝ} (haS : a < S) (hST : S < T) (hTb : T ≤ b) |
| 39 | {c : ℝ → ℝ → M} |
| 40 | (hc : M63C2ShrinkingCurveOn F c (Icc a T)) |
| 41 | (hi : M63IntrinsicRegularityOn F c (Icc a S)) : |
| 42 | ∃ S' : ℝ, S < S' ∧ S' ≤ T ∧ M63IntrinsicRegularityOn F c (Icc a S') := by |
| 43 | classical |
| 44 | let : CompactSpace M := isCompact_univ_iff.mp hcompact |
| 45 | let : Nonempty M := ⟨c 0 a⟩ |
| 46 | have hcS := c2_restrict hc (Icc_subset_Icc_right hST.le) |
| 47 | have hiOpen : M63IntrinsicRegularityOn F c (Ico a S) := |
| 48 | { interior_jets := fun i => by |
| 49 | simpa only [interior_Icc, interior_Ico] using hi.interior_jets i |
| 50 | closed_positive_jets := fun r s har hrs hsub i => |
| 51 | hi.closed_positive_jets r s har hrs (hsub.trans Ico_subset_Icc_self) i } |
| 52 | have hterminal := (intrinsic_closed_prefix_of_half_open F hcompact haS |
| 53 | (hST.le.trans hTb) hcS hiOpen).2 |
| 54 | have hleftSpatial (i : ℕ) (t : ℝ) (hat : a < t) (htS : t ≤ S) : |
| 55 | ContMDiff 𝓘(ℝ, ℝ) ((𝓡 n).prod (𝓡 n)) 1 |
| 56 | (fun x => (⟨c x t, m63CurvatureJet F c i t x⟩ : TangentBundle (𝓡 n) M)) := by |
| 57 | rcases htS.eq_or_lt with rfl | htS |
| 58 | · exact hterminal i |
| 59 | · exact (hi.interior_jets i).comp_contMDiff |
| 60 | (contDiff_id.prodMk contDiff_const).contMDiff |
| 61 | (fun _ => ⟨mem_univ _, by rw [interior_Icc]; exact ⟨hat, htS⟩⟩) |
| 62 | obtain ⟨N, e, he, hemb, hinj⟩ := exists_embedding_euclidean_of_compact (I := 𝓡 n) (M := M) |
| 63 | obtain ⟨U, ρ, hU, heU, hρ, hρe, _hmin, _huniq⟩ := |
| 64 | exists_smooth_compact_embedded_retraction e hemb he hinj |
| 65 | obtain ⟨alpha, haa, haS'⟩ := exists_between haS |
| 66 | have halpha : alpha ∈ Icc a S := ⟨haa.le, haS'.le⟩ |
| 67 | obtain ⟨_hell, phi, _hformula, hphi, hpsi, _hzero, hpos, hpsipos, |
| 68 | hshift, hpsishift, _hperiod, _hregular, _himm, hanchor, _hprincipal⟩ := |
| 69 | exists_c2_constant_speed_relabeling F (fun x => c x alpha) alpha |
| 70 | (hcS.periodic alpha halpha) (hcS.spatial_regular alpha halpha) |
| 71 | (hcS.immersed alpha halpha) |
| 72 | let d : ℝ → ℝ → M := fun x t => c (phi.symm x) t |
| 73 | have hd : M63C2ShrinkingCurveOn F d (Icc a T) := |
| 74 | c2ShrinkingCurve_fixedLabel_comp F hc hpsi hpsipos hpsishift |
| 75 | have hinitial (x : ℝ) : curveSpeed F d alpha x = |
| 76 | (∫ y in (0 : ℝ)..curvePeriod, curveSpeed F (fun z _ => c z alpha) alpha y) / |
| 77 | curvePeriod := hanchor x |
| 78 | obtain ⟨_Q, _hQvalue, _hQ, hslice, _hjets⟩ := |
| 79 | fixedLabel_embedded_path_smooth_of_constant_speed F hcS hi haa haS' |
| 80 | (Icc_subset_Icc_left haa.le) hpsi hpsipos hpsishift hinitial he hU heU hρ hρe |
| 81 | have hS : S ∈ Icc a T := ⟨haS.le, hST.le⟩ |
| 82 | let FS := m63RestrictClosedFlow F S b (Icc_subset_Icc_left haS.le) (hST.trans_le hTb) |
| 83 | obtain ⟨Tq, hSTq, _hTqb, q, hq, hqinitial, hqi, hqjoint⟩ := |
| 84 | exists_smooth_local_curve_of_retraction FS he hU heU hρ hρe (fun x => d x S) |
| 85 | (hd.periodic S hS) (hslice S ⟨haS'.le, le_rfl⟩) (hd.immersed S hS) |
| 86 | let R : ℝ := min T Tq |
| 87 | have hSR : S < R := lt_min hST hSTq |
| 88 | have hRT : R ≤ T := min_le_left _ _ |
| 89 | have hRTq : R ≤ Tq := min_le_right _ _ |
| 90 | have hright : Icc S R ⊆ Icc a T := |
| 91 | fun t ht => ⟨haS.le.trans ht.1, ht.2.trans hRT⟩ |
| 92 | have hqr := c2_restrict hq.1 (Icc_subset_Icc_right hRTq) |
| 93 | have hqF : M63C2ShrinkingCurveOn F q (Icc S R) := |
| 94 | { domain_subset := fun t ht => ⟨haS.le.trans ht.1, ht.2.trans (hRT.trans hTb)⟩ |
| 95 | periodic := hqr.periodic |
| 96 | spatial_regular := hqr.spatial_regular |
| 97 | joint_c1 := hqr.joint_c1 |
| 98 | immersed := hqr.immersed |
| 99 | continuous := hqr.continuous |
| 100 | velocity_continuous := hqr.velocity_continuous |
| 101 | curvature_continuous := hqr.curvature_continuous |
| 102 | equation := hqr.equation } |
| 103 | have hqjets := c2ShrinkingCurve_closed_spatial_jets_of_joint_smooth F haS hSR |
| 104 | he hU heU hρ hρe hqF |
| 105 | (hqjoint.mono (prod_mono Subset.rfl (Icc_subset_Icc_right hRTq))) |
| 106 | have hqd := c2ShrinkingCurve_unique_closed F hcompact hqF (c2_restrict hd hright) |
| 107 | hqinitial |
| 108 | let f : ℝ → ℝ → M := fun x t => q (phi x) t |
| 109 | have hf : M63C2ShrinkingCurveOn F f (Icc S R) := |
| 110 | c2ShrinkingCurve_fixedLabel_comp F hqF hphi hpos hshift |
| 111 | have hcf (t : ℝ) (ht : t ∈ Icc S R) (x : ℝ) : c x t = f x t := by |
| 112 | change c x t = q (phi x) t |
| 113 | rw [hqd t ht (phi x)] |
| 114 | change c x t = c (phi.symm (phi x)) t |
| 115 | rw [phi.symm_apply_apply] |
| 116 | have freeze (g : ℝ → ℝ → M) (i : ℕ) (t : ℝ) : |
| 117 | (fun x => m63CurvatureJet F g i t x) = |
| 118 | (fun x => m63CurvatureJet F (fun y _ => g y t) i t x) := by |
| 119 | induction i with |
| 120 | | zero => rfl |
| 121 | | succ i ih => |
| 122 | funext x |
| 123 | change m62SpatialDerivative F g t (fun y => m63CurvatureJet F g i t y) x = |
| 124 | m62SpatialDerivative F (fun y _ => g y t) t |
| 125 | (fun y => m63CurvatureJet F (fun z _ => g z t) i t y) x |
| 126 | rw [ih] |
| 127 | rfl |
| 128 | have bundleFreeze (g : ℝ → ℝ → M) (i : ℕ) (t x : ℝ) : |
| 129 | (⟨g x t, m63CurvatureJet F g i t x⟩ : TangentBundle (𝓡 n) M) = |
| 130 | (⟨g x t, m63CurvatureJet F (fun y _ => g y t) i t x⟩ : |
| 131 | TangentBundle (𝓡 n) M) := by rw [congrFun (freeze g i t) x] |
| 132 | have hcfJet (i : ℕ) (t : ℝ) (ht : t ∈ Icc S R) (x : ℝ) : |
| 133 | (⟨c x t, m63CurvatureJet F c i t x⟩ : TangentBundle (𝓡 n) M) = |
| 134 | (⟨f x t, m63CurvatureJet F f i t x⟩ : TangentBundle (𝓡 n) M) := |
| 135 | (bundleFreeze c i t x).trans |
| 136 | ((congrArg (fun gamma : ℝ → M => |
| 137 | (⟨gamma x, m63CurvatureJet F (fun y _ => gamma y) i t x⟩ : |
| 138 | TangentBundle (𝓡 n) M)) (funext (hcf t ht))).trans |
| 139 | (bundleFreeze f i t x).symm) |
| 140 | have htransport (i : ℕ) (t : ℝ) (ht : t ∈ Icc S R) (x : ℝ) : |
| 141 | (⟨c x t, m63CurvatureJet F c i t x⟩ : TangentBundle (𝓡 n) M) = |
| 142 | (⟨q (phi x) t, m63CurvatureJet F q i t (phi x)⟩ : |
| 143 | TangentBundle (𝓡 n) M) := by |
| 144 | rw [hcfJet i t ht x] |
| 145 | have hj := curvatureJet_comp F q |
| 146 | ((hqF.spatial_regular t ht).mdifferentiable (by norm_num)) |
| 147 | (hphi.differentiable (by norm_num)) hpos |
| 148 | (fun y => (unitTangent_contMDiff_of_c2 F q (hqF.spatial_regular t ht) |
| 149 | (hqF.immersed t ht) (phi y)).mdifferentiableAt (by norm_num)) |
| 150 | (fun k y => (hqjets.1 k ⟨t, ht⟩ (phi y)).mdifferentiableAt (by norm_num)) i x |
| 151 | change (⟨q (phi x) t, m63CurvatureJet F (fun y s => q (phi y) s) i t x⟩ : |
| 152 | TangentBundle (𝓡 n) M) = _ |
| 153 | rw [hj] |
| 154 | have hrightSpatial (i : ℕ) (t : ℝ) (ht : t ∈ Icc S R) : |
| 155 | ContMDiff 𝓘(ℝ, ℝ) ((𝓡 n).prod (𝓡 n)) 1 |
| 156 | (fun x => (⟨c x t, m63CurvatureJet F c i t x⟩ : TangentBundle (𝓡 n) M)) := |
| 157 | ((hqjets.1 i ⟨t, ht⟩).comp (hphi.of_le (by norm_num)).contMDiff).congr |
| 158 | (fun x => htransport i t ht x) |
| 159 | have hrightClosed (i : ℕ) : ContinuousOn |
| 160 | (fun z : ℝ × ℝ => |
| 161 | (⟨c z.1 z.2, m63CurvatureJet F c i z.2 z.1⟩ : TangentBundle (𝓡 n) M)) |
| 162 | (univ ×ˢ Icc S R) := by |
| 163 | let B : ℝ × ℝ → ℝ × ℝ := fun z => (phi z.1, z.2) |
| 164 | have hB : Continuous B := (hphi.continuous.comp continuous_fst).prodMk continuous_snd |
| 165 | exact ((hqjets.2 i).comp (s := univ ×ˢ Icc S R) (f := B) |
| 166 | hB.continuousOn (fun _ hz => ⟨mem_univ _, hz.2⟩)).congr |
| 167 | (fun z hz => htransport i z.2 hz.2 z.1) |
| 168 | have hrightH : ContMDiffOn 𝓘(ℝ, ℝ × ℝ) ((𝓡 n).prod (𝓡 n)) 1 |
| 169 | (fun z : ℝ × ℝ => |
| 170 | (⟨c z.1 z.2, m62CurvatureVector F c z.2 z.1⟩ : TangentBundle (𝓡 n) M)) |
| 171 | (univ ×ˢ interior (Icc S R)) := by |
| 172 | have hqH : ContMDiffOn 𝓘(ℝ, ℝ × ℝ) ((𝓡 n).prod (𝓡 n)) 1 |
| 173 | (fun z : ℝ × ℝ => |
| 174 | (⟨q z.1 z.2, m62CurvatureVector F q z.2 z.1⟩ : TangentBundle (𝓡 n) M)) |
| 175 | (univ ×ˢ interior (Icc S R)) := |
| 176 | (hqi.interior_jets 0).mono |
| 177 | (prod_mono Subset.rfl (interior_mono (Icc_subset_Icc_right hRTq))) |
| 178 | exact (c2ShrinkingCurve_fixedLabel_curvature_contMDiffOn F hqF hphi hpos hqH).congr |
| 179 | (fun z hz => hcfJet 0 z.2 (interior_subset hz.2) z.1) |
| 180 | have hspatial (i : ℕ) (t : ℝ) (hat : a < t) (htR : t ≤ R) : |
| 181 | ContMDiff 𝓘(ℝ, ℝ) ((𝓡 n).prod (𝓡 n)) 1 |
| 182 | (fun x => (⟨c x t, m63CurvatureJet F c i t x⟩ : TangentBundle (𝓡 n) M)) := by |
| 183 | by_cases htS : t ≤ S |
| 184 | · exact hleftSpatial i t hat htS |
| 185 | · exact hrightSpatial i t ⟨(lt_of_not_ge htS).le, htR⟩ |
| 186 | have hclosed (r t : ℝ) (har : a < r) (hrt : r ≤ t) (htR : t ≤ R) (i : ℕ) : |
| 187 | ContinuousOn |
| 188 | (fun z : ℝ × ℝ => |
| 189 | (⟨c z.1 z.2, m63CurvatureJet F c i z.2 z.1⟩ : TangentBundle (𝓡 n) M)) |
| 190 | (univ ×ˢ Icc r t) := by |
| 191 | by_cases htS : t ≤ S |
| 192 | · exact hi.closed_positive_jets r t har hrt |
| 193 | (fun u hu => ⟨har.le.trans hu.1, hu.2.trans htS⟩) i |
| 194 | by_cases hSr : S ≤ r |
| 195 | · exact (hrightClosed i).mono (prod_mono Subset.rfl (Icc_subset_Icc hSr htR)) |
| 196 | have hrS : r ≤ S := (lt_of_not_ge hSr).le |
| 197 | have hSt : S ≤ t := (lt_of_not_ge htS).le |
| 198 | have hl := hi.closed_positive_jets r S har hrS (Icc_subset_Icc_left har.le) i |
| 199 | have hr := (hrightClosed i).mono (prod_mono Subset.rfl (Icc_subset_Icc_right htR)) |
| 200 | have hu := hl.union_of_isClosed hr (isClosed_univ.prod isClosed_Icc) |
| 201 | (isClosed_univ.prod isClosed_Icc) |
| 202 | apply hu.mono |
| 203 | intro z hz |
| 204 | by_cases hzS : z.2 ≤ S |
| 205 | · exact Or.inl ⟨mem_univ _, hz.2.1, hzS⟩ |
| 206 | · exact Or.inr ⟨mem_univ _, (lt_of_not_ge hzS).le, hz.2.2⟩ |
| 207 | have hcRight := c2_restrict hc hright |
| 208 | have leftSpeed (r t : ℝ) (har : a ≤ r) (hrt : r ≤ t) (htS : t ≤ S) (x : ℝ) : |
| 209 | curveSpeed F c t x = curveSpeed F c r x * Real.exp |
| 210 | (-∫ u in r..t, m62TangentRicci F c u x + m62CurvatureSquared F c u x) := |
| 211 | c2ShrinkingCurve_speed_eq_exp_integral F hcS (hi.interior_jets 0) hrt |
| 212 | (Icc_subset_Icc har htS) x |
| 213 | have rightSpeed (r t : ℝ) (hSr : S ≤ r) (hrt : r ≤ t) (htR : t ≤ R) (x : ℝ) : |
| 214 | curveSpeed F c t x = curveSpeed F c r x * Real.exp |
| 215 | (-∫ u in r..t, m62TangentRicci F c u x + m62CurvatureSquared F c u x) := |
| 216 | c2ShrinkingCurve_speed_eq_exp_integral F hcRight hrightH hrt |
| 217 | (Icc_subset_Icc hSr htR) x |
| 218 | have hcR := c2_restrict hc (Icc_subset_Icc_right hRT) |
| 219 | have hspeed (r t : ℝ) (har : a < r) (hrt : r ≤ t) (htR : t ≤ R) (x : ℝ) : |
| 220 | curveSpeed F c t x = curveSpeed F c r x * Real.exp |
| 221 | (-∫ u in r..t, m62TangentRicci F c u x + m62CurvatureSquared F c u x) := by |
| 222 | by_cases htS : t ≤ S |
| 223 | · exact leftSpeed r t har.le hrt htS x |
| 224 | by_cases hSr : S ≤ r |
| 225 | · exact rightSpeed r t hSr hrt htR x |
| 226 | have hrS : r ≤ S := (lt_of_not_ge hSr).le |
| 227 | have hSt : S ≤ t := (lt_of_not_ge htS).le |
| 228 | have hA := (c2ShrinkingCurve_speed_normalization_continuousOn F hcR).2 |
| 229 | have hAleft : ContinuousOn |
| 230 | (fun u => m62TangentRicci F c u x + m62CurvatureSquared F c u x) (Icc r S) := |
| 231 | hA.comp (s := Icc r S) (f := fun u : ℝ => (x, u)) |
| 232 | (continuous_const.prodMk continuous_id).continuousOn |
| 233 | (fun _ hu => ⟨mem_univ _, har.le.trans hu.1, hu.2.trans hSR.le⟩) |
| 234 | have hAright : ContinuousOn |
| 235 | (fun u => m62TangentRicci F c u x + m62CurvatureSquared F c u x) (Icc S t) := |
| 236 | hA.comp (s := Icc S t) (f := fun u : ℝ => (x, u)) |
| 237 | (continuous_const.prodMk continuous_id).continuousOn |
| 238 | (fun _ hu => ⟨mem_univ _, haS.le.trans hu.1, hu.2.trans htR⟩) |
| 239 | have hint := intervalIntegral.integral_add_adjacent_intervals (μ := MeasureTheory.volume) |
| 240 | (ContinuousOn.intervalIntegrable_of_Icc hrS hAleft) |
| 241 | (ContinuousOn.intervalIntegrable_of_Icc hSt hAright) |
| 242 | rw [rightSpeed S t le_rfl hSt htR x, leftSpeed r S har.le hrS le_rfl x, |
| 243 | mul_assoc, ← Real.exp_add, ← neg_add, hint] |
| 244 | exact ⟨R, hSR, hRT, intrinsic_regularity_of_spatial_jets_and_speed_primitive F |
| 245 | (haS.trans hSR) hcR he hU heU hρ hρe hspatial hclosed hspeed⟩ |
| 246 | |
| 247 | end PoincareMT.M63 |