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.Compatibility.SourceNames |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.C2.TraceSpeedGradient |
| 3 | import PoincareLib.Geometry.RicciFlow.CurveShortening.Integral.Periodicity |
| 4 | import PoincareLib.Geometry.RicciFlow.CurveShortening.Evolution.Regularity |
| 5 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Variation.Second.SecondVariationCoordinates |
| 6 | import Mathlib.Analysis.Calculus.Deriv.Shift |
| 7 | import Mathlib.Analysis.Normed.Group.AddCircle |
| 8 | import Mathlib.Analysis.Normed.Group.Continuity |
| 9 | import Mathlib.Topology.CompactOpen |
| 10 | |
| 11 | /-! |
| 12 | # Closed paths of the actual spatial speed derivative |
| 13 | |
| 14 | The initial gradient modulus closes the interior derivative at the |
| 15 | initial slice. MT2007 Claim 19.1, p. 437; |
| 16 | `2026-09-23-closed-speed-gradient-path.md`. |
| 17 | -/ |
| 18 | |
| 19 | set_option autoImplicit false |
| 20 | |
| 21 | open Set Filter |
| 22 | open scoped Manifold ContDiff Bundle Topology |
| 23 | |
| 24 | universe u |
| 25 | |
| 26 | namespace PoincareMT.M63 |
| 27 | |
| 28 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 29 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 30 | {a b : ℝ} |
| 31 | |
| 32 | /-- The actual speed gradient is a closed compact path on any shorter |
| 33 | time interval. MT2007 Claim 19.1, p. 437; closed-gradient derivation. -/ |
| 34 | theorem exists_closed_curveSpeed_gradient_path [T2Space M] |
| 35 | (F : RicciFlow n M (Icc a b)) (c : ℝ → ℝ → M) |
| 36 | (hc : M62ShrinkingCurve F c) {K R J v0 : ℝ} |
| 37 | (hK : 0 ≤ K) (hR : 0 ≤ R) (hJ : 0 ≤ J) (hv0 : 0 < v0) |
| 38 | (hBounds : CurveEvolutionAmbientBounds F K K K) |
| 39 | (hInitial : ∀ y, curveSpeed F c a y = v0) |
| 40 | (hCurv : ∀ t ∈ Ioo a b, ∀ x, m62CurvatureSquared F c t x ≤ R) |
| 41 | (hJet : ∀ t ∈ Ioo a b, ∀ x, |
| 42 | (F.metric t).tangentNorm (c x t) (m63CurvatureJet F c 1 t x) ≤ |
| 43 | J / Real.sqrt (t - a)) |
| 44 | {s : ℝ} (_has : a ≤ s) (hsb : s < b) : |
| 45 | ∃ G : C(Icc a s, C(AddCircle curvePeriod, ℝ)), |
| 46 | ∀ (t : Icc a s) (x : ℝ), |
| 47 | G t (x : AddCircle curvePeriod) = |
| 48 | deriv (curveSpeed F c (t : ℝ)) x := by |
| 49 | classical |
| 50 | let v : ℝ × ℝ → ℝ := fun z => curveSpeed F c z.2 z.1 |
| 51 | let W : ℝ × ℝ → ℝ := fun z => deriv (curveSpeed F c z.2) z.1 |
| 52 | let Ω : Set (ℝ × ℝ) := univ ×ˢ Ioo a b |
| 53 | let D : Set (ℝ × ℝ) := univ ×ˢ Icc a s |
| 54 | have hΩ : IsOpen Ω := isOpen_univ.prod isOpen_Ioo |
| 55 | have hv : ContDiffOn ℝ ∞ v Ω := M62.speed_joint_contDiffOn F c hc |
| 56 | have hdx (t : ℝ) (ht : t ∈ Ioo a b) (x : ℝ) : |
| 57 | HasDerivAt (curveSpeed F c t) (M08.coordinatePartialS v (x, t)) x := |
| 58 | M08.coordinateSlice_fst_hasDerivAt v (p := (x, t)) |
| 59 | ((hv.contDiffAt (hΩ.mem_nhds ⟨mem_univ _, ht⟩)).differentiableAt (by simp)) |
| 60 | have hW : ContinuousOn W Ω := |
| 61 | ((M08.coordinatePartialS_contDiffOn hΩ v hv).congr |
| 62 | (fun z hz => (hdx z.2 hz.2 z.1).deriv)).continuousOn |
| 63 | have hzero (x : ℝ) : W (x, a) = 0 := by |
| 64 | change deriv (curveSpeed F c a) x = 0 |
| 65 | rw [show curveSpeed F c a = (fun _ : ℝ => v0) from funext hInitial] |
| 66 | exact deriv_const x v0 |
| 67 | let V := v0 * Real.exp ((K + R) * (b - a)) |
| 68 | let B : ℝ → ℝ := fun t => V ^ 2 * |
| 69 | ((K + 2 * K * Real.sqrt R) * (t - a) + |
| 70 | 4 * Real.sqrt R * J * Real.sqrt (t - a)) |
| 71 | have hB : Continuous B := by dsimp only [B]; fun_prop |
| 72 | have hBa : B a = 0 := by |
| 73 | simp only [B, sub_self, Real.sqrt_zero, mul_zero, add_zero] |
| 74 | have hbound (z : ℝ × ℝ) (hz : z ∈ D) : ‖W z‖ ≤ B z.2 := by |
| 75 | rw [Real.norm_eq_abs] |
| 76 | exact curveSpeed_spatial_abs_bound F c hc hK hR hJ hv0 hBounds hInitial hCurv hJet |
| 77 | ⟨hz.2.1, hz.2.2.trans hsb.le⟩ z.1 |
| 78 | have hclosed : ContinuousOn W D := by |
| 79 | intro z hz |
| 80 | by_cases ht : a < z.2 |
| 81 | · exact (hW.continuousAt (hΩ.mem_nhds |
| 82 | ⟨mem_univ _, ht, hz.2.2.trans_lt hsb⟩)).continuousWithinAt |
| 83 | · have hta : z.2 = a := le_antisymm (le_of_not_gt ht) hz.2.1 |
| 84 | have hwz : W z = 0 := by |
| 85 | change deriv (curveSpeed F c z.2) z.1 = 0 |
| 86 | rw [hta] |
| 87 | exact hzero z.1 |
| 88 | have hlim : Tendsto (fun p : ℝ × ℝ => B p.2) (𝓝[D] z) (𝓝 0) := by |
| 89 | have hcB : Continuous (fun p : ℝ × ℝ => B p.2) := hB.comp continuous_snd |
| 90 | have hlim0 : Tendsto (fun p : ℝ × ℝ => B p.2) (𝓝[D] z) (𝓝 (B z.2)) := |
| 91 | hcB.continuousAt.continuousWithinAt |
| 92 | simpa only [hta, hBa] using hlim0 |
| 93 | change Tendsto W (𝓝[D] z) (𝓝 (W z)) |
| 94 | rw [hwz] |
| 95 | exact squeeze_zero_norm' (by |
| 96 | filter_upwards [self_mem_nhdsWithin] with p hp |
| 97 | exact hbound p hp) hlim |
| 98 | have hper (t : Icc a s) : |
| 99 | Function.Periodic (fun x => W (x, (t : ℝ))) curvePeriod := by |
| 100 | have hp := M62.speed_periodic F c hc ⟨t.2.1, t.2.2.trans hsb.le⟩ |
| 101 | intro x |
| 102 | change deriv (curveSpeed F c t) (x + curvePeriod) = deriv (curveSpeed F c t) x |
| 103 | rw [← deriv_comp_add_const] |
| 104 | exact congrArg (fun f : ℝ → ℝ => deriv f x) (funext hp) |
| 105 | let Q : Icc a s → C(AddCircle curvePeriod, ℝ) := fun t => |
| 106 | ⟨(hper t).lift, |
| 107 | (QuotientAddGroup.isQuotientMap_mk (AddSubgroup.zmultiples curvePeriod)).continuous_iff.mpr |
| 108 | (hclosed.comp_continuous (continuous_id.prodMk continuous_const) |
| 109 | (fun _ => ⟨mem_univ _, t.2⟩))⟩ |
| 110 | have hrep (t : Icc a s) (x : ℝ) : Q t (x : AddCircle curvePeriod) = W (x, t) := by |
| 111 | simp only [Q, ContinuousMap.coe_mk, Function.Periodic.lift_coe] |
| 112 | have hQ : Continuous Q := by |
| 113 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 114 | have hquot : IsOpenQuotientMap |
| 115 | (fun p : Icc a s × ℝ => (p.1, (p.2 : AddCircle curvePeriod))) := |
| 116 | IsOpenQuotientMap.id.prodMap QuotientAddGroup.isOpenQuotientMap_mk |
| 117 | apply hquot.continuous_comp_iff.mp |
| 118 | have hcomp : Continuous (fun p : Icc a s × ℝ => W (p.2, (p.1 : ℝ))) := |
| 119 | hclosed.comp_continuous |
| 120 | (continuous_snd.prodMk (continuous_subtype_val.comp continuous_fst)) |
| 121 | (fun p => ⟨mem_univ _, p.1.2⟩) |
| 122 | exact hcomp.congr (fun p => (hrep p.1 p.2).symm) |
| 123 | exact ⟨⟨Q, hQ⟩, hrep⟩ |
| 124 | |
| 125 | end PoincareMT.M63 |