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.Comparison.Analysis.Monotone.PeriodicLipschitz |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Plateau.Free.BoundaryLiftAlgebra |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Arbitrary.C2IntrinsicRegularity |
| 4 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Fixed.RelabelingAssembly |
| 5 | import PoincareLib.Geometry.CurveShortening.Ramp.CurveEstimates.Relabeling.Geometry |
| 6 | import Mathlib.Analysis.Calculus.ContDiff.RCLike |
| 7 | |
| 8 | /-! M63's fixed smooth reference retains the actual C1 free labels and |
| 9 | the original curve's curvature velocity. Source: MT Lemma 19.15, |
| 10 | pp. 447-449; M64 finite-boundary-motion derivation. -/ |
| 11 | |
| 12 | noncomputable section |
| 13 | set_option autoImplicit false |
| 14 | set_option warningAsError true |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set Filter |
| 18 | open scoped Manifold ContDiff Topology |
| 19 | |
| 20 | namespace PoincareMT |
| 21 | |
| 22 | /-- A C1 increasing degree-one parameter change belongs to the literal Lipschitz lift class. |
| 23 | Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project |
| 24 | derivation |
| 25 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 26 | theorem m64DegreeOneLift_of_contDiff {phi : ℝ → ℝ} (hphi : ContDiff ℝ 1 phi) |
| 27 | (hm : Monotone phi) |
| 28 | (hshift : ∀ x, phi (x + curvePeriod) = phi x + curvePeriod) : |
| 29 | ∃ L : M64PeriodicDegreeOneLift, L.map = phi := by |
| 30 | obtain ⟨K, hK⟩ := hphi.contDiffOn.exists_lipschitzOnWith one_ne_zero |
| 31 | (convex_Icc (0 : ℝ) curvePeriod) isCompact_Icc |
| 32 | have hP : 0 < curvePeriod := by unfold curvePeriod; positivity |
| 33 | have hglobal := m64Monotone_lipschitz_of_periodic_interval hP hm hshift hK |
| 34 | refine ⟨⟨phi, hm, hshift, K, K.coe_nonneg, ?_⟩, rfl⟩ |
| 35 | intro x y |
| 36 | simpa only [Real.dist_eq] using hglobal.dist_le_mul x y |
| 37 | |
| 38 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] [T2Space M] [CompactSpace M] |
| 39 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 40 | {a b : ℝ} |
| 41 | |
| 42 | /-- Every original C2 evolution with a C1 free label has an actual smooth reference family |
| 43 | and a C1 degree-one label giving exactly its original moving trace and curvature velocity. |
| 44 | Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project |
| 45 | derivation |
| 46 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 47 | theorem m64C2ShrinkingCurve_exists_finite_reference |
| 48 | (F : RicciFlow n M (Icc a b)) {c : ℝ → ℝ → M} |
| 49 | (hc : M63C2ShrinkingCurveOn F c (Icc a b)) {t : ℝ} (ht : t ∈ Ioo a b) |
| 50 | (sigma : M64PeriodicDegreeOneLift) (hsigma : ContDiff ℝ 1 sigma.map) : |
| 51 | ∃ epsilon : ℝ, 0 < epsilon ∧ |
| 52 | (∀ z ∈ Ioo (-epsilon) epsilon, t + z ∈ Ioo a b) ∧ |
| 53 | ∃ L : M64PeriodicDegreeOneLift, ContDiff ℝ 1 L.map ∧ |
| 54 | ∃ f : ℝ → ℝ → M, |
| 55 | ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n) ∞ (Function.uncurry f) |
| 56 | (Ioo (-epsilon) epsilon ×ˢ univ) ∧ |
| 57 | (∀ z, Function.Periodic (f z) curvePeriod) ∧ |
| 58 | (∀ z ∈ Ioo (-epsilon) epsilon, ∀ x, f z (L.map x) = c (sigma.map x) (t + z)) ∧ |
| 59 | ∀ x, curveVelocity (n := n) (fun z => f z (L.map x)) 0 = |
| 60 | m62CurvatureVector F c t (sigma.map x) := by |
| 61 | classical |
| 62 | let : Nonempty M := ⟨c 0 t⟩ |
| 63 | have hi := M63.c2ShrinkingCurve_intrinsic_regularity F isCompact_univ |
| 64 | (ht.1.trans ht.2) le_rfl (Or.inl rfl) hc |
| 65 | let tau := (a + t) / 2 |
| 66 | let s := (t + b) / 2 |
| 67 | have hat : a < tau := by dsimp only [tau]; linarith [ht.1] |
| 68 | have htt : tau < t := by dsimp only [tau]; linarith [ht.1] |
| 69 | have hts : t < s := by dsimp only [s]; linarith [ht.2] |
| 70 | have hsb : s < b := by dsimp only [s]; linarith [ht.2] |
| 71 | have hslab : Icc tau s ⊆ Icc a b := Icc_subset_Icc hat.le hsb.le |
| 72 | obtain ⟨phi, d, hphi, -, hpos, hshift, hd, -, hrel⟩ := |
| 73 | M63.exists_fixed_smooth_relabeling F isCompact_univ hc hi hat (htt.trans hts) hslab |
| 74 | have hphi1 : ContDiff ℝ 1 phi := hphi.of_le (by norm_num) |
| 75 | obtain ⟨H, hH⟩ := m64DegreeOneLift_of_contDiff hphi1 |
| 76 | (strictMono_of_deriv_pos hpos).monotone hshift |
| 77 | let L := H.comp sigma |
| 78 | have hL (x : ℝ) : L.map x = phi (sigma.map x) := by |
| 79 | change H.map (sigma.map x) = _ |
| 80 | rw [hH] |
| 81 | have hLC1 : ContDiff ℝ 1 L.map := by |
| 82 | change ContDiff ℝ 1 (H.map ∘ sigma.map) |
| 83 | rw [hH] |
| 84 | exact hphi1.comp hsigma |
| 85 | let epsilon := min (t - tau) (s - t) / 2 |
| 86 | have hepsilon : 0 < epsilon := half_pos (lt_min (sub_pos.mpr htt) (sub_pos.mpr hts)) |
| 87 | have htime (z : ℝ) (hz : z ∈ Ioo (-epsilon) epsilon) : t + z ∈ Ioo tau s := by |
| 88 | dsimp only [epsilon] at hz |
| 89 | constructor <;> linarith [min_le_left (t - tau) (s - t), |
| 90 | min_le_right (t - tau) (s - t), hz.1, hz.2] |
| 91 | have hfull (z : ℝ) (hz : z ∈ Ioo (-epsilon) epsilon) : t + z ∈ Ioo a b := |
| 92 | ⟨hat.trans (htime z hz).1, (htime z hz).2.trans hsb⟩ |
| 93 | let f : ℝ → ℝ → M := fun z x => d x (if t + z ∈ Icc tau s then t + z else t) |
| 94 | have hfnear (z : ℝ) (hz : z ∈ Ioo (-epsilon) epsilon) (x : ℝ) : f z x = d x (t + z) := by |
| 95 | simp only [f, if_pos (Ioo_subset_Icc_self (htime z hz))] |
| 96 | have hdlocal : ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n) ∞ |
| 97 | (fun q : ℝ × ℝ => d q.1 q.2) (univ ×ˢ Ioo tau s) := by |
| 98 | simpa only [interior_Icc] using hd.2 |
| 99 | have hf : ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n) ∞ (Function.uncurry f) |
| 100 | (Ioo (-epsilon) epsilon ×ˢ univ) := |
| 101 | (hdlocal.comp (contDiff_snd.prodMk (contDiff_const.add contDiff_fst)).contMDiff.contMDiffOn |
| 102 | (fun q hq => ⟨mem_univ _, htime q.1 hq.1⟩)).congr |
| 103 | (fun q hq => hfnear q.1 hq.1 q.2) |
| 104 | have hperiod (z : ℝ) : Function.Periodic (f z) curvePeriod := by |
| 105 | intro x |
| 106 | unfold f |
| 107 | split_ifs with hz |
| 108 | · exact hd.1.periodic _ hz x |
| 109 | · exact hd.1.periodic t ⟨htt.le, hts.le⟩ x |
| 110 | have hagree (z : ℝ) (hz : z ∈ Ioo (-epsilon) epsilon) (x : ℝ) : |
| 111 | f z (L.map x) = c (sigma.map x) (t + z) := by |
| 112 | rw [hfnear z hz, hL] |
| 113 | exact (hrel (t + z) (Ioo_subset_Icc_self (htime z hz)) (sigma.map x)).symm |
| 114 | refine ⟨epsilon, hepsilon, hfull, L, hLC1, f, hf, hperiod, hagree, ?_⟩ |
| 115 | intro x |
| 116 | have hzero : (0 : ℝ) ∈ Ioo (-epsilon) epsilon := ⟨by linarith, hepsilon⟩ |
| 117 | have heq : (fun z => f z (L.map x)) =ᶠ[𝓝 (0 : ℝ)] |
| 118 | fun z => c (sigma.map x) (t + z) := by |
| 119 | filter_upwards [isOpen_Ioo.mem_nhds hzero] with z hz |
| 120 | exact hagree z hz x |
| 121 | have hvelocity : curveVelocity (n := n) (fun z => f z (L.map x)) 0 = |
| 122 | curveVelocity (n := n) (fun z => c (sigma.map x) (t + z)) 0 := |
| 123 | congrArg (fun D : ℝ →L[ℝ] EuclideanSpace ℝ (Fin n) => D 1) |
| 124 | (heq.mfderiv_eq (I := 𝓘(ℝ, ℝ)) (I' := 𝓡 n)) |
| 125 | have hcjoint : ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n) 1 |
| 126 | (fun q : ℝ × ℝ => c q.1 q.2) (univ ×ˢ Ioo a b) := by |
| 127 | simpa only [interior_Icc] using hc.joint_c1 |
| 128 | have hct : ContMDiffAt 𝓘(ℝ, ℝ) (𝓡 n) 1 (fun z => c (sigma.map x) z) t := |
| 129 | (hcjoint.contMDiffAt ((isOpen_univ.prod isOpen_Ioo).mem_nhds |
| 130 | ⟨mem_univ _, ht⟩)).comp t |
| 131 | ((contDiffAt_const (c := sigma.map x)).prodMk contDiffAt_id).contMDiffAt |
| 132 | have hchain := M63.curveVelocity_comp (gamma := fun z => c (sigma.map x) z) |
| 133 | (phi := fun z => t + z) |
| 134 | (by simpa only [add_zero] using hct.mdifferentiableAt one_ne_zero) |
| 135 | ((hasDerivAt_id (0 : ℝ)).const_add t) |
| 136 | have hchain' : curveVelocity (n := n) (fun z => c (sigma.map x) (t + z)) 0 = |
| 137 | curveVelocity (n := n) (fun z => c (sigma.map x) z) (t + 0) := by |
| 138 | simpa only [one_smul] using hchain |
| 139 | have ht0 := congrArg (fun z : ℝ => |
| 140 | (curveVelocity (n := n) (fun z => c (sigma.map x) z) z : EuclideanSpace ℝ (Fin n))) |
| 141 | (add_zero t) |
| 142 | exact hvelocity.trans (hchain'.trans |
| 143 | (ht0.trans (hc.equation t (by simpa only [interior_Icc] using ht) (sigma.map x)))) |
| 144 | |
| 145 | end PoincareMT |