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.Fixed.LabelSpatialSmoothness |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Embedded.NormalSmoothness |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Initial.ArclengthGauge |
| 4 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Terminal.C2SpeedJetBounds |
| 5 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Terminal.CurvatureJetClosure |
| 6 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Compact.EmbeddedRetraction |
| 7 | import Mathlib.Geometry.Manifold.WhitneyEmbedding |
| 8 | |
| 9 | /-! |
| 10 | # Closing an actual intrinsic prefix |
| 11 | |
| 12 | Fixed positive labels give one smooth open slab. Concrete curvature, |
| 13 | speed-gradient and all-order bounds then identify its included terminal |
| 14 | jets before returning to the original labels. MT2007 Claim 19.1, |
| 15 | p. 437, and Lemma 19.24, pp. 454-455; |
| 16 | `2026-09-23-maximal-prefix-intrinsic-regularity.md`, statement 1. |
| 17 | -/ |
| 18 | |
| 19 | set_option autoImplicit false |
| 20 | set_option backward.isDefEq.respectTransparency false |
| 21 | |
| 22 | open Set |
| 23 | open scoped Manifold ContDiff Bundle intervalIntegral |
| 24 | |
| 25 | universe u |
| 26 | |
| 27 | namespace PoincareMT.M63 |
| 28 | |
| 29 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 30 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 31 | {a b : ℝ} |
| 32 | |
| 33 | /-- An intrinsic half-open prefix of an actual closed C2 curve closes |
| 34 | at its included endpoint, with genuine spatial C1 witnesses for every |
| 35 | terminal jet. MT2007 Claim 19.1, p. 437; maximal-prefix derivation. -/ |
| 36 | theorem intrinsic_closed_prefix_of_half_open |
| 37 | [T2Space M] (F : RicciFlow n M (Icc a b)) |
| 38 | (hcompact : IsCompact (univ : Set M)) |
| 39 | {S : ℝ} (haS : a < S) (hSb : S ≤ b) |
| 40 | {c : ℝ → ℝ → M} |
| 41 | (hc : M63C2ShrinkingCurveOn F c (Icc a S)) |
| 42 | (hi : M63IntrinsicRegularityOn F c (Ico a S)) : |
| 43 | M63IntrinsicRegularityOn F c (Icc a S) ∧ |
| 44 | ∀ i, ContMDiff 𝓘(ℝ, ℝ) ((𝓡 n).prod (𝓡 n)) 1 |
| 45 | (fun x => (⟨c x S, m63CurvatureJet F c i S x⟩ : |
| 46 | TangentBundle (𝓡 n) M)) := by |
| 47 | classical |
| 48 | let : CompactSpace M := isCompact_univ_iff.mp hcompact |
| 49 | let : Nonempty M := ⟨c 0 a⟩ |
| 50 | obtain ⟨N, e, he, hemb, hinj⟩ := exists_embedding_euclidean_of_compact (I := 𝓡 n) (M := M) |
| 51 | obtain ⟨U, ρ, hU, heU, hρ, hρe, _hmin, _huniq⟩ := |
| 52 | exists_smooth_compact_embedded_retraction e hemb he hinj |
| 53 | have hcopen : M63C2ShrinkingCurveOn F c (Ico a S) := |
| 54 | c2_restrict hc Ico_subset_Icc_self |
| 55 | have hclose (r : ℝ) (har : a < r) (hrS : r ≤ S) : |
| 56 | (∀ i, ContMDiff 𝓘(ℝ, ℝ) ((𝓡 n).prod (𝓡 n)) 1 |
| 57 | (fun x => (⟨c x S, m63CurvatureJet F c i S x⟩ : |
| 58 | TangentBundle (𝓡 n) M))) ∧ |
| 59 | ∀ i, ContinuousOn |
| 60 | (fun z : ℝ × ℝ => |
| 61 | (⟨c z.1 z.2, m63CurvatureJet F c i z.2 z.1⟩ : |
| 62 | TangentBundle (𝓡 n) M)) (univ ×ˢ Icc r S) := by |
| 63 | obtain ⟨alpha, haa, har'⟩ := exists_between har |
| 64 | obtain ⟨tau, hat, htr⟩ := exists_between har' |
| 65 | have htS : tau < S := htr.trans_le hrS |
| 66 | have haS' : alpha < S := hat.trans htS |
| 67 | have halpha : alpha ∈ Icc a S := ⟨haa.le, haS'.le⟩ |
| 68 | let ell := ∫ x in (0 : ℝ)..curvePeriod, |
| 69 | curveSpeed F (fun y _ => c y alpha) alpha x |
| 70 | obtain ⟨hell, phi, _hformula, hphi, hpsi, _hzero, hpos, hpsipos, |
| 71 | _hshift, hpsishift, _hper, _hreg, _himm, hanchor, _hprincipal⟩ := |
| 72 | exists_c2_constant_speed_relabeling F (fun x => c x alpha) alpha |
| 73 | (hc.periodic alpha halpha) (hc.spatial_regular alpha halpha) |
| 74 | (hc.immersed alpha halpha) |
| 75 | let d : ℝ → ℝ → M := fun x t => c (phi.symm x) t |
| 76 | let v0 : ℝ := ell / curvePeriod |
| 77 | have hv0 : 0 < v0 := div_pos hell Real.two_pi_pos |
| 78 | have hinitial (x : ℝ) : curveSpeed F d alpha x = v0 := by |
| 79 | change curveSpeed F (fun y _ => c (phi.symm y) alpha) alpha x = _ |
| 80 | exact hanchor x |
| 81 | have hd : M63C2ShrinkingCurveOn F d (Icc alpha S) := |
| 82 | c2_restrict (c2ShrinkingCurve_fixedLabel_comp F hc hpsi hpsipos hpsishift) |
| 83 | (Icc_subset_Icc_left haa.le) |
| 84 | have hsmooth (s : ℝ) (hs : s ∈ Ioo alpha S) : |
| 85 | M63SmoothShrinkingCurveOn F d (Icc alpha s) := by |
| 86 | have hslab : Icc alpha s ⊆ Ico a S := |
| 87 | fun t ht => ⟨haa.le.trans ht.1, ht.2.trans_lt hs.2⟩ |
| 88 | obtain ⟨_Q, _hQvalue, _hQ, hspace, hjets⟩ := |
| 89 | fixedLabel_embedded_path_smooth_of_constant_speed F hcopen hi haa hs.1 |
| 90 | hslab hpsi hpsipos hpsishift hinitial he hU heU hρ hρe |
| 91 | exact c2ShrinkingCurve_smooth_of_embedded_spatial_jets F hs.1 |
| 92 | (c2_restrict hd (Icc_subset_Icc_right hs.2.le)) he hU heU hρ hρe |
| 93 | (fun t ht => (he.comp (hspace t (Ioo_subset_Icc_self ht))).contDiff) |
| 94 | (fun k => (hjets k).mono (prod_mono Subset.rfl Ioo_subset_Icc_self)) |
| 95 | have hdSmooth : M63SmoothShrinkingCurveOn F d (Icc alpha S) := by |
| 96 | refine ⟨hd, ?_⟩ |
| 97 | rw [interior_Icc] |
| 98 | intro z hz |
| 99 | obtain ⟨s, hzs, hsS⟩ := exists_between hz.2.2 |
| 100 | have hs : s ∈ Ioo alpha S := ⟨hz.2.1.trans hzs, hsS⟩ |
| 101 | have hzsmall : z ∈ univ ×ˢ interior (Icc alpha s) := |
| 102 | ⟨mem_univ _, by rw [interior_Icc]; exact ⟨hz.2.1, hzs⟩⟩ |
| 103 | exact (((hsmooth s hs).2 z hzsmall).contMDiffAt |
| 104 | ((isOpen_univ.prod isOpen_interior).mem_nhds hzsmall)).contMDiffWithinAt |
| 105 | let F0 := m63RestrictClosedFlow F alpha S (Icc_subset_Icc haa.le hSb) haS' |
| 106 | have hd0 : M62ShrinkingCurve F0 d := |
| 107 | m63SmoothRestriction hdSmooth alpha S Subset.rfl haS' |
| 108 | have hcurvCont : ContinuousOn |
| 109 | (fun z : ℝ × ℝ => m62CurvatureSquared F d z.2 z.1) |
| 110 | (univ ×ˢ Icc alpha S) := M62.curvatureSquared_continuousOn F0 d hd0 |
| 111 | have hrect : IsCompact (Icc (0 : ℝ) curvePeriod ×ˢ Icc alpha S) := |
| 112 | isCompact_Icc.prod isCompact_Icc |
| 113 | obtain ⟨R0, hR0⟩ := hrect.bddAbove_image |
| 114 | (hcurvCont.mono (prod_mono (subset_univ _) Subset.rfl)) |
| 115 | let R : ℝ := max R0 0 |
| 116 | have hR : 0 ≤ R := le_max_right _ _ |
| 117 | have hcurv (t : ℝ) (ht : t ∈ Ioo alpha S) (x : ℝ) : |
| 118 | m62CurvatureSquared F d t x ≤ R := by |
| 119 | have hp : Function.Periodic (m62CurvatureSquared F d t) curvePeriod := |
| 120 | M62.curvatureSquared_periodic F0 d hd0 ht |
| 121 | obtain ⟨y, hy, hxy⟩ := hp.exists_mem_Ico₀ Real.two_pi_pos x |
| 122 | rw [hxy] |
| 123 | exact (hR0 ⟨(y, t), ⟨Ico_subset_Icc_self hy, Ioo_subset_Icc_self ht⟩, rfl⟩).trans |
| 124 | (le_max_left _ _) |
| 125 | obtain ⟨_K, _J, _m, _V, G, _J1, _J2, _hK, _hBounds, _hJ, _hm, |
| 126 | _hV, hG, _hJ1, _hJ2, _hshort, _hspeed, hgrad, _htail, _hprimitive⟩ := |
| 127 | exists_terminal_speed_jet_bounds F hcompact haa.le hat htS hSb |
| 128 | hsmooth hR hv0 hinitial hcurv |
| 129 | have hjets : ∀ i : ℕ, ∃ K : ℝ, 0 ≤ K ∧ ∀ t ∈ Ioo tau S, ∀ x, |
| 130 | (F.metric t).tangentNorm (d x t) (m63CurvatureJet F d i t x) ≤ K := by |
| 131 | intro i |
| 132 | obtain ⟨C, _hC, hcap⟩ := m63CurvatureJetSquared_bound_uniform_upper_cutoff F hcompact i |
| 133 | haa.le haS' hSb hR (sub_pos.mpr hat) |
| 134 | refine ⟨Real.sqrt C, Real.sqrt_nonneg _, fun t ht x => ?_⟩ |
| 135 | have hb := hcap S haS' le_rfl d hdSmooth hcurv t |
| 136 | ⟨hat.trans ht.1, ht.2⟩ (sub_le_sub_right ht.1.le alpha) x |
| 137 | exact Real.sqrt_le_sqrt hb |
| 138 | have hgradient : ∃ G : ℝ, 0 ≤ G ∧ ∀ t ∈ Ioo tau S, ∀ x, |
| 139 | |deriv (curveSpeed F d t) x| ≤ G := |
| 140 | ⟨G, hG, fun t ht x => hgrad t ⟨(hat.trans ht.1).le, ht.2⟩ x⟩ |
| 141 | obtain ⟨_eta, _heta, _hrec, hspatial, hclosed⟩ := |
| 142 | exists_terminal_embeddedCurvatureJets F hcompact haa.le hat htS hSb |
| 143 | he hU heU hρ hρe hdSmooth hjets hgradient |
| 144 | have hback : (fun x t => d (phi x) t) = c := by |
| 145 | funext x t |
| 146 | exact congrArg (fun y => c y t) (phi.symm_apply_apply x) |
| 147 | have htransport (i : ℕ) (t : ℝ) (ht : t ∈ Icc tau S) (x : ℝ) : |
| 148 | (⟨c x t, m63CurvatureJet F c i t x⟩ : TangentBundle (𝓡 n) M) = |
| 149 | (⟨d (phi x) t, m63CurvatureJet F d i t (phi x)⟩ : |
| 150 | TangentBundle (𝓡 n) M) := by |
| 151 | have ht' : t ∈ Icc alpha S := ⟨hat.le.trans ht.1, ht.2⟩ |
| 152 | have hjet := curvatureJet_comp F d |
| 153 | ((hd.spatial_regular t ht').mdifferentiable (by norm_num)) |
| 154 | (hphi.differentiable (by norm_num)) hpos |
| 155 | (fun y => (unitTangent_contMDiff_of_c2 F d (hd.spatial_regular t ht') |
| 156 | (hd.immersed t ht') (phi y)).mdifferentiableAt (by norm_num)) |
| 157 | (fun k y => (hspatial k ⟨t, ht⟩ (phi y)).mdifferentiableAt (by norm_num)) i x |
| 158 | calc |
| 159 | _ = (⟨d (phi x) t, m63CurvatureJet F (fun y s => d (phi y) s) i t x⟩ : |
| 160 | TangentBundle (𝓡 n) M) := |
| 161 | congrArg (fun f : ℝ → ℝ → M => |
| 162 | (⟨f x t, m63CurvatureJet F f i t x⟩ : TangentBundle (𝓡 n) M)) hback.symm |
| 163 | _ = _ := by rw [hjet] |
| 164 | refine ⟨?_, ?_⟩ |
| 165 | · intro i |
| 166 | have hp := (hspatial i ⟨S, htS.le, le_rfl⟩).comp |
| 167 | (hphi.of_le (by norm_num)).contMDiff |
| 168 | exact hp.congr (fun x => htransport i S ⟨htS.le, le_rfl⟩ x) |
| 169 | · intro i |
| 170 | let B : ℝ × ℝ → ℝ × ℝ := fun z => (phi z.1, z.2) |
| 171 | have hB : Continuous B := (hphi.continuous.comp continuous_fst).prodMk continuous_snd |
| 172 | have hp := (hclosed i).comp (s := univ ×ˢ Icc tau S) (f := B) |
| 173 | hB.continuousOn (fun _ hz => ⟨mem_univ _, hz.2⟩) |
| 174 | have hnew : ContinuousOn |
| 175 | (fun z : ℝ × ℝ => |
| 176 | (⟨c z.1 z.2, m63CurvatureJet F c i z.2 z.1⟩ : TangentBundle (𝓡 n) M)) |
| 177 | (univ ×ˢ Icc tau S) := |
| 178 | hp.congr (fun z hz => htransport i z.2 hz.2 z.1) |
| 179 | exact hnew.mono (prod_mono Subset.rfl (Icc_subset_Icc_left htr.le)) |
| 180 | refine ⟨{ interior_jets := ?_, closed_positive_jets := ?_ }, (hclose S haS le_rfl).1⟩ |
| 181 | · intro i |
| 182 | simpa only [interior_Ico, interior_Icc] using hi.interior_jets i |
| 183 | · intro r t har hrt hslab i |
| 184 | have hrS : r ≤ S := (hslab ⟨le_rfl, hrt⟩).2 |
| 185 | have htS : t ≤ S := (hslab ⟨hrt, le_rfl⟩).2 |
| 186 | exact ((hclose r har hrS).2 i).mono |
| 187 | (prod_mono Subset.rfl (Icc_subset_Icc_right htS)) |
| 188 | |
| 189 | end PoincareMT.M63 |