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.Ambient.NormalFlow |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Ambient.ClassicalExistence |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Ambient.ClosedSmoothness |
| 4 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Smooth.UnitSpeedParameter |
| 5 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Smooth.IntrinsicRestriction |
| 6 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.C2.Locality |
| 7 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Periodic.LabelFlow |
| 8 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Compact.EmbeddedRetraction |
| 9 | import Mathlib.Geometry.Manifold.WhitneyEmbedding |
| 10 | |
| 11 | /-! |
| 12 | # Actual smooth local curve shortening from the spectral engine |
| 13 | |
| 14 | Arclength normalization, the actual ambient spectral solution and |
| 15 | its positive moving labels construct the normal solution at the |
| 16 | original labels. MT2007 Claim 19.1, p. 437; |
| 17 | `2026-09-22-smooth-local-existence-assembly.md`, statements 2 and 3. |
| 18 | -/ |
| 19 | |
| 20 | set_option autoImplicit false |
| 21 | set_option backward.isDefEq.respectTransparency false |
| 22 | |
| 23 | open Set |
| 24 | open scoped Manifold ContDiff Bundle intervalIntegral |
| 25 | |
| 26 | universe u v |
| 27 | |
| 28 | namespace PoincareMT.M63 |
| 29 | |
| 30 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] [T2Space M] |
| 31 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 32 | {ι : Type v} [Fintype ι] {a b : ℝ} |
| 33 | |
| 34 | local notation "W" => EuclideanSpace ℝ ι |
| 35 | |
| 36 | /-- The actual smooth retraction and spectral engine construct a |
| 37 | normal local solution with the exact original initial labels and |
| 38 | all positive intrinsic jets. MT2007 Claim 19.1, p. 437; smooth local |
| 39 | existence assembly, statement 2. -/ |
| 40 | theorem exists_smooth_local_curve_of_retraction (F : RicciFlow n M (Icc a b)) |
| 41 | {e : M → W} (he : ContMDiff (𝓡 n) 𝓘(ℝ, W) ∞ e) |
| 42 | {U : Set W} (hU : IsOpen U) (heU : range e ⊆ U) {ρ : W → M} |
| 43 | (hρ : ContMDiffOn 𝓘(ℝ, W) (𝓡 n) ∞ ρ U) (hρe : ∀ p, ρ (e p) = p) |
| 44 | (gamma : ℝ → M) (hperiod : Function.Periodic gamma curvePeriod) |
| 45 | (hgamma : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) ∞ gamma) |
| 46 | (himm : ∀ x, curveVelocity (n := n) gamma x ≠ 0) : |
| 47 | ∃ T : ℝ, a < T ∧ T < b ∧ ∃ c : ℝ → ℝ → M, |
| 48 | M63SmoothShrinkingCurveOn F c (Icc a T) ∧ |
| 49 | (∀ x, c x a = gamma x) ∧ M63IntrinsicRegularityOn F c (Icc a T) ∧ |
| 50 | ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n) ∞ |
| 51 | (fun z : ℝ × ℝ => c z.1 z.2) (univ ×ˢ Icc a T) := by |
| 52 | classical |
| 53 | have hab : a < b := by |
| 54 | obtain ⟨s, hs, t, ht, hne⟩ := F.nontrivial |
| 55 | by_contra! h |
| 56 | apply hne |
| 57 | linarith [hs.1, hs.2, ht.1, ht.2] |
| 58 | let L := ∫ x in (0 : ℝ)..curvePeriod, curveSpeed F (fun y _ => gamma y) a x |
| 59 | obtain ⟨hL, σ, _hσformula, hσ, _hσinv, _hσzero, hσpos, _hσinvpos, hσshift, |
| 60 | _hσinvshift, hper0, hgamma0, himm0, _hunit0, hprincipal0, _hrecover⟩ := |
| 61 | exists_smooth_unit_speed_parameter F gamma a hperiod hgamma himm |
| 62 | let gamma0 := fun y => gamma (σ.symm y) |
| 63 | let fReal := fun y => e (gamma0 y) |
| 64 | have hfReal : ContDiff ℝ ∞ fReal := (he.comp hgamma0).contDiff |
| 65 | have hfper : Function.Periodic fReal L := hper0.comp e |
| 66 | let f : C(AddCircle L, W) := ⟨hfper.lift, |
| 67 | (QuotientAddGroup.isQuotientMap_mk (AddSubgroup.zmultiples L)).continuous_iff.mpr |
| 68 | hfReal.continuous⟩ |
| 69 | have hf : ContDiff ℝ ∞ (fun x : ℝ => f (x : AddCircle L)) := hfReal |
| 70 | have hρf : (fun y : ℝ => ρ (f (y : AddCircle L))) = gamma0 := |
| 71 | funext fun y => hρe (gamma0 y) |
| 72 | have hproject (x : ℝ) : |
| 73 | mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (f (x : AddCircle L)) |
| 74 | (deriv (fun y : ℝ => f (y : AddCircle L)) x) = |
| 75 | curveVelocity (n := n) gamma0 x := by |
| 76 | have hv : curveVelocity (n := n) (fun y : ℝ => ρ (f (y : AddCircle L))) x = |
| 77 | mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (f (x : AddCircle L)) |
| 78 | (deriv (fun y : ℝ => f (y : AddCircle L)) x) := by |
| 79 | change (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) (ρ ∘ fun y : ℝ => f (y : AddCircle L)) x) 1 = _ |
| 80 | erw [mfderiv_comp x |
| 81 | ((hρ.contMDiffAt (hU.mem_nhds (heU (mem_range_self _)))).mdifferentiableAt (by simp)) |
| 82 | ((hf.contMDiff x).mdifferentiableAt (by simp)), |
| 83 | ContinuousLinearMap.comp_apply, mfderiv_eq_fderiv] |
| 84 | rfl |
| 85 | rw [hρf] at hv |
| 86 | exact hv.symm |
| 87 | have hfguard (x : ℝ) : f (x : AddCircle L) ∈ U ∧ |
| 88 | mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (f (x : AddCircle L)) |
| 89 | (deriv (fun y : ℝ => f (y : AddCircle L)) x) ≠ 0 := by |
| 90 | refine ⟨heU (mem_range_self _), ?_⟩ |
| 91 | rw [hproject] |
| 92 | exact himm0 x |
| 93 | have hfunit (x : ℝ) : ambientCurvePrincipal F ρ a (f (x : AddCircle L)) |
| 94 | (deriv (fun y : ℝ => f (y : AddCircle L)) x) = 1 := by |
| 95 | unfold ambientCurvePrincipal |
| 96 | rw [hproject] |
| 97 | change ((F.metric a).inner (ρ (e (gamma0 x))) |
| 98 | (curveVelocity gamma0 x) (curveVelocity gamma0 x))⁻¹ = 1 |
| 99 | rw [hρe, ← M62.speed_sq F (fun y _ => gamma0 y) a x] |
| 100 | exact hprincipal0 x |
| 101 | have hffixed (x : ℝ) : f (x : AddCircle L) = e (ρ (f (x : AddCircle L))) := by |
| 102 | change e (gamma0 x) = e (ρ (e (gamma0 x))) |
| 103 | rw [hρe] |
| 104 | obtain ⟨T0, hT0, hTcap, _hT1, q, _hqc, hqper, hqzero, hqspace, hqjets, |
| 105 | hqguard, hqtime, _hqC1, hqfixed⟩ := |
| 106 | exists_ambient_classical_curve_of_unit_initial F he hU heU hρ hρe hL f hf |
| 107 | hfguard hfunit hffixed (Tcap := (b - a) / 2) (by linarith) (by linarith) |
| 108 | have hT0b : a + T0 < b := by linarith |
| 109 | have hjets (k : ℕ) : ContinuousOn |
| 110 | (fun z : ℝ × ℝ => iteratedDeriv k (q z.1) z.2) (Icc 0 T0 ×ˢ univ) := by |
| 111 | obtain ⟨J, hJ⟩ := hqjets k |
| 112 | have hcont : Continuous (fun z : ℝ × ℝ => |
| 113 | J (projIcc 0 T0 hT0.le z.1) (z.2 : AddCircle L)) := |
| 114 | continuous_eval.comp ((J.continuous.comp |
| 115 | (continuous_projIcc.comp continuous_fst)).prodMk |
| 116 | ((AddCircle.continuous_mk' L).comp continuous_snd)) |
| 117 | apply hcont.continuousOn.congr |
| 118 | intro z hz |
| 119 | change iteratedDeriv k (q z.1) z.2 = J (projIcc 0 T0 hT0.le z.1) (z.2 : AddCircle L) |
| 120 | rw [projIcc_of_mem hT0.le hz.1] |
| 121 | exact hJ ⟨z.1, hz.1⟩ z.2 |
| 122 | have hqjoint := ambientCurve_contDiffOn_infty_Icc F he hU hρ hL hT0 hT0b |
| 123 | (fun t _ => hqper t) (fun t _ => hqspace t) hjets hqguard hqtime |
| 124 | let A := fun t y => ambientCurvePrincipal F ρ (a + t) (q t y) (deriv (q t) y) |
| 125 | let w := fun t y => deriv (A t) y / 2 |
| 126 | obtain ⟨hw, hwper⟩ := ambientCurve_labelVelocity_regular F hU hρ hT0 hT0b.le |
| 127 | hqjoint (fun t _ => hqper t) hqguard |
| 128 | let v := fun t y => if t ∈ Icc 0 T0 then w t y else 0 |
| 129 | have hvper (t : ℝ) : Function.Periodic (v t) L := by |
| 130 | intro y |
| 131 | dsimp only [v] |
| 132 | split_ifs with ht |
| 133 | · exact hwper t ht y |
| 134 | · rfl |
| 135 | have hv : ContDiffOn ℝ ∞ (Function.uncurry v) (Ico 0 T0 ×ˢ univ) := by |
| 136 | apply (hw.mono (prod_mono Ico_subset_Icc_self Subset.rfl)).congr |
| 137 | intro z hz |
| 138 | exact if_pos ⟨hz.1.1, hz.1.2.le⟩ |
| 139 | obtain ⟨δ, hδ, hδT, _hδ1, ψ, hψzero, hψper, hψjoint, hψode, hψpos, _hψbij⟩ := |
| 140 | exists_smooth_periodic_label_flow hL hT0 v hvper hv |
| 141 | have hδT0 : δ < T0 := by linarith |
| 142 | have hψactual (t : ℝ) (ht : t ∈ Icc 0 δ) (y : ℝ) : |
| 143 | HasDerivWithinAt (fun s => ψ s y) |
| 144 | (deriv (A t) (ψ t y) / 2) (Icc 0 δ) t := by |
| 145 | have hm : t ∈ Icc 0 T0 := ⟨ht.1, ht.2.trans hδT0.le⟩ |
| 146 | simpa only [v, if_pos hm] using hψode t ht y |
| 147 | have htime (t : ℝ) (ht : t ∈ Ioo 0 T0) (y : ℝ) : |
| 148 | HasDerivAt (fun s => q s y) |
| 149 | (ambientCurvePrincipal F ρ (a + t) (q t y) (deriv (q t) y) • |
| 150 | deriv (deriv (q t)) y + |
| 151 | ambientCurveLower F e ρ (a + t) (q t y) (deriv (q t) y)) t := by |
| 152 | simpa only [iteratedDeriv_succ, iteratedDeriv_zero] using hqtime t ht y |
| 153 | obtain ⟨hc, hcinitial, hcjoint⟩ := ambientCurve_normal_solution_of_labels F he hU heU hρ hρe |
| 154 | hT0 hT0b.le hqjoint (fun t _ => hqper t) hqguard hqfixed htime |
| 155 | hσ hσpos hσshift hδ hδT0 hψzero hψjoint hψper hψpos hψactual |
| 156 | let c := fun x t => ρ (q (t - a) (ψ (t - a) (σ x))) |
| 157 | have hshort : Icc a (a + δ / 2) ⊆ Icc a (a + δ) := |
| 158 | fun t ht => ⟨ht.1, by linarith [ht.2]⟩ |
| 159 | refine ⟨a + δ / 2, by linarith, by linarith, c, |
| 160 | ⟨c2_restrict hc.1 hshort, hc.2.mono (prod_mono Subset.rfl (interior_mono hshort))⟩, |
| 161 | ?_, ?_, hcjoint.mono (prod_mono Subset.rfl hshort)⟩ |
| 162 | · intro x |
| 163 | calc c x a = ρ (q 0 (σ x)) := hcinitial x |
| 164 | _ = gamma x := ?_ |
| 165 | rw [hqzero] |
| 166 | change ρ (e (gamma (σ.symm (σ x)))) = gamma x |
| 167 | rw [hρe, σ.symm_apply_apply] |
| 168 | · exact intrinsic_regularity_on_shorter_smooth_slab F c |
| 169 | (by linarith) (by linarith) (by linarith) hc |
| 170 | |
| 171 | /-- A compact smooth ambient manifold supplies its own actual |
| 172 | embedding and retraction, hence an exact smooth normal local flow. |
| 173 | MT2007 Claim 19.1, p. 437; smooth existence assembly, statement 3. -/ |
| 174 | theorem exists_smooth_local_curve [CompactSpace M] (F : RicciFlow n M (Icc a b)) |
| 175 | (gamma : ℝ → M) (hperiod : Function.Periodic gamma curvePeriod) |
| 176 | (hgamma : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) ∞ gamma) |
| 177 | (himm : ∀ x, curveVelocity (n := n) gamma x ≠ 0) : |
| 178 | ∃ T : ℝ, a < T ∧ T < b ∧ ∃ c : ℝ → ℝ → M, |
| 179 | M63SmoothShrinkingCurveOn F c (Icc a T) ∧ |
| 180 | (∀ x, c x a = gamma x) ∧ M63IntrinsicRegularityOn F c (Icc a T) ∧ |
| 181 | ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n) ∞ |
| 182 | (fun z : ℝ × ℝ => c z.1 z.2) (univ ×ˢ Icc a T) := by |
| 183 | let : Nonempty M := ⟨gamma 0⟩ |
| 184 | obtain ⟨N, e, he, hemb, hinj⟩ := exists_embedding_euclidean_of_compact (I := 𝓡 n) (M := M) |
| 185 | obtain ⟨U, ρ, hU, heU, hρ, hρe, _hmin, _huniq⟩ := |
| 186 | exists_smooth_compact_embedded_retraction e hemb he hinj |
| 187 | exact exists_smooth_local_curve_of_retraction F he hU heU hρ hρe gamma hperiod hgamma himm |
| 188 | |
| 189 | end PoincareMT.M63 |