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.Terminal.C2FieldLimits |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Terminal.C2Reconstruction |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Fixed.LabelSpatialSmoothness |
| 4 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Embedded.NormalSmoothness |
| 5 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Initial.ArclengthGauge |
| 6 | import PoincareLib.Geometry.CurveShortening.Ramp.CurveEstimates.Relabeling.Scalars |
| 7 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Compact.EmbeddedRetraction |
| 8 | import Mathlib.Geometry.Manifold.WhitneyEmbedding |
| 9 | |
| 10 | /-! |
| 11 | # Closing a bounded-curvature C2 curve at its terminal time |
| 12 | |
| 13 | One fixed positive normalization supplies common actual bounds and |
| 14 | closed terminal fields. Returning to the original labels preserves |
| 15 | the entire original half-open curve. MT2007 Lemma 19.14, pp. 446-447; |
| 16 | `2026-09-23-bounded-curvature-c2-terminal-extension.md`. |
| 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 actual bounded-curvature intrinsic C2 curve has a closed C2 |
| 34 | endpoint in its original labels, including the final ambient time. |
| 35 | MT2007 Lemma 19.14, pp. 446-447; terminal C2 extension derivation. -/ |
| 36 | theorem exists_closed_c2_endpoint_of_intrinsic_bounded_curvature |
| 37 | [T2Space M] (F : RicciFlow n M (Icc a b)) |
| 38 | (hcompact : IsCompact (univ : Set M)) |
| 39 | {T : ℝ} (haT : a < T) (hTb : T ≤ b) |
| 40 | {c : ℝ → ℝ → M} |
| 41 | (hc : M63C2ShrinkingCurveOn F c (Ico a T)) |
| 42 | (hi : M63IntrinsicRegularityOn F c (Ico a T)) |
| 43 | {K : ℝ} (hK : 0 ≤ K) |
| 44 | (hcurv : ∀ t ∈ Ico a T, ∀ x, m62Curvature F c t x ≤ K) : |
| 45 | ∃ d : ℝ → ℝ → M, M63C2ShrinkingCurveOn F d (Icc a T) ∧ |
| 46 | ∀ t ∈ Ico a T, ∀ x, d x t = c x t := 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 | obtain ⟨alpha, haa, haT'⟩ := exists_between haT |
| 54 | obtain ⟨tau, hat, htT⟩ := exists_between haT' |
| 55 | have hat' : a < tau := haa.trans hat |
| 56 | have halpha : alpha ∈ Ico a T := ⟨haa.le, haT'⟩ |
| 57 | let ell := ∫ x in (0 : ℝ)..curvePeriod, |
| 58 | curveSpeed F (fun y _ => c y alpha) alpha x |
| 59 | obtain ⟨hell, phi, _hformula, hphi, hpsi, _hzero, hpos, hpsipos, |
| 60 | hshift, hpsishift, _hper, _hreg, _himm, hanchor, _hprincipal⟩ := |
| 61 | exists_c2_constant_speed_relabeling F (fun x => c x alpha) alpha |
| 62 | (hc.periodic alpha halpha) (hc.spatial_regular alpha halpha) |
| 63 | (hc.immersed alpha halpha) |
| 64 | let q : ℝ → ℝ → M := fun x t => c (phi.symm x) t |
| 65 | let v0 : ℝ := ell / curvePeriod |
| 66 | have hv0 : 0 < v0 := div_pos hell Real.two_pi_pos |
| 67 | have hinitial (x : ℝ) : curveSpeed F q alpha x = v0 := by |
| 68 | change curveSpeed F (fun y _ => c (phi.symm y) alpha) alpha x = _ |
| 69 | exact hanchor x |
| 70 | have hq : M63C2ShrinkingCurveOn F q (Ico alpha T) := |
| 71 | c2_restrict (c2ShrinkingCurve_fixedLabel_comp F hc hpsi hpsipos hpsishift) |
| 72 | (fun t ht => ⟨haa.le.trans ht.1, ht.2⟩) |
| 73 | have hsmooth (s : ℝ) (hs : s ∈ Ioo alpha T) : |
| 74 | M63SmoothShrinkingCurveOn F q (Icc alpha s) := by |
| 75 | have hslab : Icc alpha s ⊆ Ico a T := |
| 76 | fun t ht => ⟨haa.le.trans ht.1, ht.2.trans_lt hs.2⟩ |
| 77 | obtain ⟨_Q, _hQvalue, _hQ, hspace, hjets⟩ := |
| 78 | fixedLabel_embedded_path_smooth_of_constant_speed F hc hi haa hs.1 |
| 79 | hslab hpsi hpsipos hpsishift hinitial he hU heU hρ hρe |
| 80 | exact c2ShrinkingCurve_smooth_of_embedded_spatial_jets F hs.1 |
| 81 | (c2_restrict hq (fun t ht => ⟨ht.1, ht.2.trans_lt hs.2⟩)) he hU heU hρ hρe |
| 82 | (fun t ht => (he.comp (hspace t (Ioo_subset_Icc_self ht))).contDiff) |
| 83 | (fun k => (hjets k).mono (prod_mono Subset.rfl Ioo_subset_Icc_self)) |
| 84 | have hqcurv (t : ℝ) (ht : t ∈ Ioo alpha T) (x : ℝ) : |
| 85 | m62CurvatureSquared F q t x ≤ K ^ 2 := by |
| 86 | have htc : t ∈ Ico a T := ⟨(haa.trans ht.1).le, ht.2⟩ |
| 87 | have heq := curvature_comp F c |
| 88 | ((hc.spatial_regular t htc).mdifferentiable (by norm_num)) |
| 89 | (hpsi.differentiable (by norm_num)) hpsipos |
| 90 | ((unitTangent_contMDiff_of_c2 F c (hc.spatial_regular t htc) |
| 91 | (hc.immersed t htc) (phi.symm x)).mdifferentiableAt (by norm_num)) |
| 92 | have hkq : m62Curvature F q t x ≤ K := heq.trans_le (hcurv t htc (phi.symm x)) |
| 93 | rw [← M62.curvature_sq F q t x] |
| 94 | exact pow_le_pow_left₀ (M62.curvature_nonneg F q t x) hkq 2 |
| 95 | obtain ⟨K0, _J, m, V, G, J1, J2, hK0, hBounds, _hJ, hm, |
| 96 | hV, hG, hJ1, hJ2, _hshort, hspeed, hgradient, hjets, hprimitive⟩ := |
| 97 | exists_terminal_speed_jet_bounds F hcompact haa.le hat htT hTb hsmooth |
| 98 | (pow_nonneg hK 2) hv0 hinitial hqcurv |
| 99 | obtain ⟨r, s, h, v, g, hrep, hrange, hvlow, hfirst, hsecond, hvder⟩ := |
| 100 | exists_terminal_c2_fields F hcompact haa.le hat htT hTb he hU heU hρ hρe hsmooth |
| 101 | hK0 (pow_nonneg hK 2) hm hV hG hJ1 hJ2 hBounds hqcurv hspeed hgradient hjets hprimitive |
| 102 | obtain ⟨qbar, hqbar, hqagree⟩ := closed_c2_tail_of_terminal_fields F haa.le hat htT hTb |
| 103 | he hU heU hρ hρe hq r s h v g hrep hrange |
| 104 | (fun t z => hm.trans_le (hvlow t z)) hfirst hsecond hvder |
| 105 | let w : ℝ → ℝ → M := fun x t => qbar (phi x) t |
| 106 | have hw : M63C2ShrinkingCurveOn F w (Icc tau T) := |
| 107 | c2ShrinkingCurve_fixedLabel_comp F hqbar hphi hpos hshift |
| 108 | have hwagree (t : ℝ) (ht : t ∈ Ico tau T) (x : ℝ) : w x t = c x t := by |
| 109 | change qbar (phi x) t = c x t |
| 110 | rw [hqagree t ht] |
| 111 | exact congrArg (fun y => c y t) (phi.symm_apply_apply x) |
| 112 | let d : ℝ → ℝ → M := fun x t => if t < T then c x t else w x t |
| 113 | have hdagree (t : ℝ) (ht : t ∈ Ico a T) (x : ℝ) : d x t = c x t := by |
| 114 | simp only [d, if_pos ht.2] |
| 115 | have hdopen : M63C2ShrinkingCurveOn F d (Ico a T) := c2_congr hc hdagree |
| 116 | have hdhead : M63C2ShrinkingCurveOn F d (Icc a tau) := |
| 117 | c2_restrict hdopen (fun t ht => ⟨ht.1, ht.2.trans_lt htT⟩) |
| 118 | have hdtail : M63C2ShrinkingCurveOn F d (Icc tau T) := by |
| 119 | apply c2_congr hw |
| 120 | intro t ht x |
| 121 | by_cases ht' : t < T |
| 122 | · simp only [d, if_pos ht'] |
| 123 | exact (hwagree t ⟨ht.1, ht'⟩ x).symm |
| 124 | · simp only [d, if_neg ht'] |
| 125 | have hunion : (univ ×ˢ Icc a tau : Set (ℝ × ℝ)) ∪ (univ ×ˢ Icc tau T) = |
| 126 | univ ×ˢ Icc a T := by |
| 127 | rw [← prod_union, Icc_union_Icc_eq_Icc hat'.le htT.le] |
| 128 | refine ⟨d, ?_, hdagree⟩ |
| 129 | refine { domain_subset := Icc_subset_Icc le_rfl hTb |
| 130 | periodic := ?_ |
| 131 | spatial_regular := ?_ |
| 132 | joint_c1 := ?_ |
| 133 | immersed := ?_ |
| 134 | continuous := ?_ |
| 135 | velocity_continuous := ?_ |
| 136 | curvature_continuous := ?_ |
| 137 | equation := ?_ } |
| 138 | · intro t ht |
| 139 | by_cases htt : t ≤ tau |
| 140 | · exact hdhead.periodic t ⟨ht.1, htt⟩ |
| 141 | · exact hdtail.periodic t ⟨(lt_of_not_ge htt).le, ht.2⟩ |
| 142 | · intro t ht |
| 143 | by_cases htt : t ≤ tau |
| 144 | · exact hdhead.spatial_regular t ⟨ht.1, htt⟩ |
| 145 | · exact hdtail.spatial_regular t ⟨(lt_of_not_ge htt).le, ht.2⟩ |
| 146 | · simpa only [interior_Icc, interior_Ico] using hdopen.joint_c1 |
| 147 | · intro t ht |
| 148 | by_cases htt : t ≤ tau |
| 149 | · exact hdhead.immersed t ⟨ht.1, htt⟩ |
| 150 | · exact hdtail.immersed t ⟨(lt_of_not_ge htt).le, ht.2⟩ |
| 151 | · rw [← hunion] |
| 152 | exact hdhead.continuous.union_of_isClosed hdtail.continuous |
| 153 | (isClosed_univ.prod isClosed_Icc) (isClosed_univ.prod isClosed_Icc) |
| 154 | · rw [← hunion] |
| 155 | exact hdhead.velocity_continuous.union_of_isClosed hdtail.velocity_continuous |
| 156 | (isClosed_univ.prod isClosed_Icc) (isClosed_univ.prod isClosed_Icc) |
| 157 | · rw [← hunion] |
| 158 | exact hdhead.curvature_continuous.union_of_isClosed hdtail.curvature_continuous |
| 159 | (isClosed_univ.prod isClosed_Icc) (isClosed_univ.prod isClosed_Icc) |
| 160 | · intro t ht |
| 161 | exact hdopen.equation t (by simpa only [interior_Icc, interior_Ico] using ht) |
| 162 | |
| 163 | end PoincareMT.M63 |