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.Pullback.MetricHessian |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Smooth.RetractionDifferentials |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.CurveEstimates.Relabeling.Geometry |
| 4 | import Mathlib.Topology.ContinuousMap.Compact |
| 5 | |
| 6 | /-! |
| 7 | # Closed normal value and unit-tangent limits |
| 8 | |
| 9 | The actual immersed first-jet normalization and positive relabeling |
| 10 | give closed limits without differentiating the limiting labels. |
| 11 | MT2007 Claim 19.1, p. 437; Lemma 19.6, pp. 441-442; |
| 12 | `2026-09-22-c2-normal-value-tangent-limits.md`. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Manifold ContDiff Bundle Topology |
| 20 | |
| 21 | universe u v |
| 22 | |
| 23 | namespace PoincareMT.M63 |
| 24 | |
| 25 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 27 | {ι : Type v} [Fintype ι] {a b L S : ℝ} |
| 28 | |
| 29 | local notation "W" => EuclideanSpace ℝ ι |
| 30 | local notation "X" => C(AddCircle L, W) |
| 31 | local notation "XR" => C(AddCircle L, ℝ) |
| 32 | local notation "Y" => C(AddCircle curvePeriod, W) |
| 33 | |
| 34 | /-- The actual normal position and pushed unit tangent converge on the |
| 35 | closed slab from immersed first jets and continuous label displacements. |
| 36 | MT2007 Claim 19.1, p. 437; closed normal value/tangent derivation. -/ |
| 37 | theorem exists_closed_normal_value_unitTangent_limits |
| 38 | [Fact (0 < L)] |
| 39 | (F : RicciFlow n M (Icc a b)) (_hS : 0 < S) (hab : a + S ≤ b) |
| 40 | {e : M → W} (he : ContMDiff (𝓡 n) 𝓘(ℝ, W) ∞ e) |
| 41 | {U : Set W} (hU : IsOpen U) (heU : range e ⊆ U) {ρ : W → M} |
| 42 | (hρ : ContMDiffOn 𝓘(ℝ, W) (𝓡 n) ∞ ρ U) (hρe : ∀ z, ρ (e z) = z) |
| 43 | (Q P : ℕ → C(Icc (0 : ℝ) S, X)) (q p : C(Icc (0 : ℝ) S, X)) |
| 44 | (D : ℕ → C(Icc (0 : ℝ) S, XR)) (d : C(Icc (0 : ℝ) S, XR)) |
| 45 | (psi : ℕ → ℝ → ℝ → ℝ) (c : ℕ → ℝ → ℝ → M) |
| 46 | (hQ : Tendsto Q atTop (𝓝 q)) (hP : Tendsto P atTop (𝓝 p)) |
| 47 | (hD : Tendsto D atTop (𝓝 d)) |
| 48 | (hder : ∀ j (t : Icc (0 : ℝ) S) (x : ℝ), |
| 49 | HasDerivAt (fun y : ℝ => Q j t (y : AddCircle L)) (P j t (x : AddCircle L)) x) |
| 50 | (hguard : ∀ j (t : Icc (0 : ℝ) S) z, Q j t z ∈ U ∧ |
| 51 | mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (Q j t z) (P j t z) ≠ 0) |
| 52 | (hguard0 : ∀ (t : Icc (0 : ℝ) S) z, q t z ∈ U ∧ |
| 53 | mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (q t z) (p t z) ≠ 0) |
| 54 | (hfixed : ∀ j (t : Icc (0 : ℝ) S) z, Q j t z = e (ρ (Q j t z))) |
| 55 | (hpsi : ∀ j (t : Icc (0 : ℝ) S), ContDiff ℝ 1 (psi j t)) |
| 56 | (hpos : ∀ j (t : Icc (0 : ℝ) S) x, 0 < deriv (psi j t) x) |
| 57 | (hDrep : ∀ j (t : Icc (0 : ℝ) S) (x : ℝ), |
| 58 | D j t (x : AddCircle L) = psi j t x - x) |
| 59 | (hslice : ∀ j (t : Icc (0 : ℝ) S) x, |
| 60 | c j x (a + t) = ρ (Q j t ((psi j t ((L / curvePeriod) * x) : ℝ) : AddCircle L))) : |
| 61 | ∃ (R Sfield : ℕ → C(Icc (0 : ℝ) S, Y)) (r s : C(Icc (0 : ℝ) S, Y)), |
| 62 | Tendsto R atTop (𝓝 r) ∧ Tendsto Sfield atTop (𝓝 s) ∧ |
| 63 | (∀ j (t : Icc (0 : ℝ) S) (x : ℝ), |
| 64 | R j t (x : AddCircle curvePeriod) = e (c j x (a + t))) ∧ |
| 65 | (∀ j (t : Icc (0 : ℝ) S) (x : ℝ), Sfield j t (x : AddCircle curvePeriod) = |
| 66 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (c j x (a + t)) |
| 67 | (spatialUnitTangent F (c j) (a + t) x)) ∧ |
| 68 | ∀ (t : Icc (0 : ℝ) S) (x : ℝ), |
| 69 | let y : AddCircle L := ((L / curvePeriod) * x + |
| 70 | d t (((L / curvePeriod) * x : ℝ) : AddCircle L) : ℝ) |
| 71 | let z := q t y |
| 72 | let v := mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z (p t y) |
| 73 | let ell := Real.sqrt ((F.metric (a + t)).inner (ρ z) v v) |
| 74 | r t (x : AddCircle curvePeriod) = z ∧ |
| 75 | s t (x : AddCircle curvePeriod) = ell⁻¹ • p t y := by |
| 76 | classical |
| 77 | let : Fact (0 < curvePeriod) := ⟨by unfold curvePeriod; positivity⟩ |
| 78 | let κ := L / curvePeriod |
| 79 | have hκ : 0 < κ := div_pos (Fact.out : 0 < L) (Fact.out : 0 < curvePeriod) |
| 80 | let Z := Icc (0 : ℝ) S × AddCircle L |
| 81 | let Ω : Set (W × W) := {z | z.1 ∈ U ∧ mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.1 z.2 ≠ 0} |
| 82 | let A := Icc a b × Ω |
| 83 | have hmetric := (flow_pullback_metric_hessian_contDiffOn F hU hρ |
| 84 | (f := fun _ => 0) contMDiff_const).1.continuousOn |
| 85 | have hmap : Continuous (fun z : A => ((z.1.1, z.2.1.1), z.2.1.2)) := |
| 86 | ((continuous_subtype_val.comp continuous_fst).prodMk |
| 87 | (continuous_subtype_val.comp continuous_snd).fst).prodMk |
| 88 | (continuous_subtype_val.comp continuous_snd).snd |
| 89 | have hsq : Continuous (fun z : A => (F.metric z.1).inner (ρ z.2.1.1) |
| 90 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.2.1.1 z.2.1.2) |
| 91 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.2.1.1 z.2.1.2)) := |
| 92 | hmetric.comp_continuous hmap (fun z => ⟨⟨z.1.2, z.2.2.1⟩, mem_univ _⟩) |
| 93 | let N : C(A, W) := ⟨fun z => |
| 94 | (Real.sqrt ((F.metric z.1).inner (ρ z.2.1.1) |
| 95 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.2.1.1 z.2.1.2) |
| 96 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.2.1.1 z.2.1.2)))⁻¹ • z.2.1.2, |
| 97 | (hsq.sqrt.inv₀ (fun z => |
| 98 | (Real.sqrt_pos.mpr ((F.metric z.1).pos _ _ z.2.2.2)).ne')).smul |
| 99 | (continuous_subtype_val.comp continuous_snd).snd⟩ |
| 100 | let bundle (w : C(Z, W) × C(Z, W)) : C(Z, W × W) := w.1.prodMk w.2 |
| 101 | have hbundle : Continuous bundle := by |
| 102 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 103 | exact (continuous_fst.fst.eval continuous_snd).prodMk |
| 104 | (continuous_fst.snd.eval continuous_snd) |
| 105 | let J (j : ℕ) : C(Z, W × W) := bundle ((Q j).uncurry, (P j).uncurry) |
| 106 | let J0 : C(Z, W × W) := bundle (q.uncurry, p.uncurry) |
| 107 | have hQu := (ContinuousMap.continuous_uncurry.tendsto q).comp hQ |
| 108 | have hPu := (ContinuousMap.continuous_uncurry.tendsto p).comp hP |
| 109 | have hDu := (ContinuousMap.continuous_uncurry.tendsto d).comp hD |
| 110 | have hJ : Tendsto J atTop (𝓝 J0) := |
| 111 | (hbundle.tendsto _).comp (hQu.prodMk_nhds hPu) |
| 112 | let Jn (j : ℕ) : C(Z, Ω) := |
| 113 | ⟨fun z => ⟨J j z, hguard j z.1 z.2⟩, (J j).continuous.subtype_mk _⟩ |
| 114 | let j0 : C(Z, Ω) := |
| 115 | ⟨fun z => ⟨J0 z, hguard0 z.1 z.2⟩, J0.continuous.subtype_mk _⟩ |
| 116 | let inc : C(Ω, W × W) := ⟨Subtype.val, continuous_subtype_val⟩ |
| 117 | have hJn : Tendsto Jn atTop (𝓝 j0) := by |
| 118 | apply (inc.isEmbedding_postcomp Topology.IsEmbedding.subtypeVal).tendsto_nhds_iff.mpr |
| 119 | exact hJ |
| 120 | have htime (z : Z) : a + (z.1 : ℝ) ∈ Icc a b := |
| 121 | ⟨le_add_of_nonneg_right z.1.2.1, (add_le_add le_rfl z.1.2.2).trans hab⟩ |
| 122 | let T : C(Z, Icc a b) := ⟨fun z => ⟨a + z.1, htime z⟩, |
| 123 | (continuous_const.add (continuous_subtype_val.comp continuous_fst)).subtype_mk htime⟩ |
| 124 | let timed (w : C(Z, Ω)) : C(Z, A) := T.prodMk w |
| 125 | have htimed : Continuous timed := by |
| 126 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 127 | exact (T.continuous.comp continuous_snd).prodMk (continuous_fst.eval continuous_snd) |
| 128 | let Sn (j : ℕ) : C(Z, W) := N.comp (timed (Jn j)) |
| 129 | let s0 : C(Z, W) := N.comp (timed j0) |
| 130 | have hSn : Tendsto Sn atTop (𝓝 s0) := |
| 131 | (N.continuous_postcomp.tendsto _).comp ((htimed.tendsto _).comp hJn) |
| 132 | let labels (w : C(Z, ℝ)) : C(Z, Z) := ⟨fun z => (z.1, z.2 + (w z : AddCircle L)), |
| 133 | continuous_fst.prodMk |
| 134 | (continuous_snd.add (continuous_quotient_mk'.comp w.continuous))⟩ |
| 135 | have hlabels : Continuous labels := by |
| 136 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 137 | exact continuous_snd.fst.prodMk (continuous_snd.snd.add |
| 138 | (continuous_quotient_mk'.comp (continuous_fst.eval continuous_snd))) |
| 139 | let Ln (j : ℕ) := labels (D j).uncurry |
| 140 | let l0 := labels d.uncurry |
| 141 | have hLn : Tendsto Ln atTop (𝓝 l0) := (hlabels.tendsto _).comp hDu |
| 142 | let scaleH := AddCircle.homeomorphAddCircle curvePeriod L |
| 143 | (Fact.out : 0 < curvePeriod).ne' (Fact.out : 0 < L).ne' |
| 144 | let scale : C(AddCircle curvePeriod, AddCircle L) := ⟨scaleH, scaleH.continuous⟩ |
| 145 | have hscale (x : ℝ) : scale (x : AddCircle curvePeriod) = ((κ * x : ℝ) : AddCircle L) := by |
| 146 | change ((x * (curvePeriod⁻¹ * L) : ℝ) : AddCircle L) = _ |
| 147 | congr 1 |
| 148 | dsimp only [κ] |
| 149 | ring |
| 150 | let scaleT : C(Icc (0 : ℝ) S × AddCircle curvePeriod, Z) := |
| 151 | ⟨fun z => (z.1, scale z.2), continuous_fst.prodMk (scale.continuous.comp continuous_snd)⟩ |
| 152 | let Rn (j : ℕ) := (((Q j).uncurry.comp (Ln j)).comp scaleT).curry |
| 153 | let rn := ((q.uncurry.comp l0).comp scaleT).curry |
| 154 | let Sfn (j : ℕ) := (((Sn j).comp (Ln j)).comp scaleT).curry |
| 155 | let sf := ((s0.comp l0).comp scaleT).curry |
| 156 | have hRn : Tendsto Rn atTop (𝓝 rn) := |
| 157 | (ContinuousMap.continuous_curry.tendsto _).comp |
| 158 | ((scaleT.continuous_precomp.tendsto _).comp (hQu.compCM hLn)) |
| 159 | have hSfn : Tendsto Sfn atTop (𝓝 sf) := |
| 160 | (ContinuousMap.continuous_curry.tendsto _).comp |
| 161 | ((scaleT.continuous_precomp.tendsto _).comp (hSn.compCM hLn)) |
| 162 | have hlabel (j : ℕ) (t : Icc (0 : ℝ) S) (x : ℝ) : |
| 163 | Ln j (scaleT (t, (x : AddCircle curvePeriod))) = |
| 164 | (t, ((psi j t (κ * x) : ℝ) : AddCircle L)) := by |
| 165 | change (t, scale (x : AddCircle curvePeriod) + |
| 166 | ((D j t (scale (x : AddCircle curvePeriod)) : ℝ) : AddCircle L)) = |
| 167 | (t, ((psi j t (κ * x) : ℝ) : AddCircle L)) |
| 168 | apply congrArg (fun z : AddCircle L => (t, z)) |
| 169 | rw [hscale, hDrep, ← AddCircle.coe_add] |
| 170 | congr 1 |
| 171 | ring |
| 172 | have hgeom (j : ℕ) (t : Icc (0 : ℝ) S) (x : ℝ) : |
| 173 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (c j x (a + t)) |
| 174 | (spatialUnitTangent F (c j) (a + t) x) = |
| 175 | Sn j (t, ((psi j t (κ * x) : ℝ) : AddCircle L)) := by |
| 176 | let f : ℝ → W := fun y => Q j t (y : AddCircle L) |
| 177 | let f' : ℝ → W := fun y => P j t (y : AddCircle L) |
| 178 | let gamma : ℝ → M := fun y => ρ (f y) |
| 179 | let gammaT := fun y (_ : ℝ) => gamma y |
| 180 | let phi : ℝ → ℝ := fun y => psi j t (κ * y) |
| 181 | have hgam (y : ℝ) : MDifferentiableAt 𝓘(ℝ, ℝ) (𝓡 n) gamma y := |
| 182 | ((hρ.contMDiffAt (hU.mem_nhds (hguard j t (y : AddCircle L)).1)).mdifferentiableAt |
| 183 | (by simp)).comp y (hder j t y).differentiableAt.mdifferentiableAt |
| 184 | have hvel (y : ℝ) : curveVelocity (n := n) gamma y = |
| 185 | mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (f y) (f' y) := by |
| 186 | change (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) (ρ ∘ f) y) 1 = _ |
| 187 | erw [mfderiv_comp y |
| 188 | ((hρ.contMDiffAt (hU.mem_nhds (hguard j t (y : AddCircle L)).1)).mdifferentiableAt |
| 189 | (by simp)) (hder j t y).differentiableAt.mdifferentiableAt, |
| 190 | ContinuousLinearMap.comp_apply, mfderiv_eq_fderiv, |
| 191 | (hder j t y).hasFDerivAt.fderiv] |
| 192 | exact congrArg (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (f y)) |
| 193 | (ContinuousLinearMap.toSpanSingleton_apply_one ℝ (f' y)) |
| 194 | obtain ⟨hret, hretder, _⟩ := smooth_retraction_differentials he hU heU hρ hρe |
| 195 | have hpush (y : ℝ) : mfderiv (𝓡 n) 𝓘(ℝ, W) e (gamma y) |
| 196 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (f y) (f' y)) = f' y := by |
| 197 | have hchain := ((hret.contDiffAt |
| 198 | (hU.mem_nhds (hguard j t (y : AddCircle L)).1)).differentiableAt |
| 199 | (by simp)).hasFDerivAt.comp_hasDerivAt y (hder j t y) |
| 200 | have heq : (fun z : ℝ => (e ∘ ρ) (f z)) = f := |
| 201 | funext fun z => (hfixed j t (z : AddCircle L)).symm |
| 202 | change HasDerivAt (fun z : ℝ => (e ∘ ρ) (f z)) |
| 203 | (fderiv ℝ (e ∘ ρ) (f y) (f' y)) y at hchain |
| 204 | rw [heq] at hchain |
| 205 | rw [← hretder (f y) (hguard j t (y : AddCircle L)).1 (f' y)] |
| 206 | exact hchain.unique (hder j t y) |
| 207 | have hlin : HasDerivAt (fun y : ℝ => κ * y) κ x := by |
| 208 | simpa +instances only [id_eq, mul_one] using! (hasDerivAt_id x).const_mul κ |
| 209 | have hphi : HasDerivAt phi (deriv (psi j t) (κ * x) * κ) x := by |
| 210 | simpa only [phi, Function.comp_def, smul_eq_mul, mul_comm] using |
| 211 | ((hpsi j t).differentiable (by norm_num) (κ * x)).hasDerivAt.scomp x hlin |
| 212 | have hpositive : 0 < deriv (psi j t) (κ * x) * κ := mul_pos (hpos j t _) hκ |
| 213 | have hslice' : (fun y => c j y (a + t)) = fun y => gamma (phi y) := |
| 214 | funext (hslice j t) |
| 215 | have hpushSlice := congrArg (fun g : ℝ → M => |
| 216 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (g x) |
| 217 | (((F.metric (a + t)).tangentNorm (g x) (curveVelocity (n := n) g x))⁻¹ • |
| 218 | curveVelocity (n := n) g x) : W)) hslice' |
| 219 | change mfderiv (𝓡 n) 𝓘(ℝ, W) e (c j x (a + t)) |
| 220 | (spatialUnitTangent F (c j) (a + t) x) = |
| 221 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (gamma (phi x)) |
| 222 | (spatialUnitTangent F (fun y s => gammaT (phi y) s) (a + t) x) at hpushSlice |
| 223 | rw [hpushSlice, spatialUnitTangent_comp F gammaT (hgam (phi x)) hphi hpositive] |
| 224 | simp only [spatialUnitTangent, map_smul] |
| 225 | change (curveSpeed F gammaT (a + t) (phi x))⁻¹ • |
| 226 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (gamma (phi x)) (curveVelocity gamma (phi x)) = _ |
| 227 | rw [hvel, hpush] |
| 228 | change ((F.metric (a + t)).tangentNorm (gamma (phi x)) |
| 229 | (curveVelocity gamma (phi x)))⁻¹ • f' (phi x) = _ |
| 230 | rw [hvel] |
| 231 | rfl |
| 232 | refine ⟨Rn, Sfn, rn, sf, hRn, hSfn, ?_, ?_, ?_⟩ |
| 233 | · intro j t x |
| 234 | change (Q j).uncurry (Ln j (scaleT (t, (x : AddCircle curvePeriod)))) = _ |
| 235 | rw [hlabel] |
| 236 | change Q j t ((psi j t (κ * x) : ℝ) : AddCircle L) = _ |
| 237 | rw [hslice] |
| 238 | exact hfixed j t _ |
| 239 | · intro j t x |
| 240 | change Sn j (Ln j (scaleT (t, (x : AddCircle curvePeriod)))) = _ |
| 241 | rw [hlabel] |
| 242 | exact (hgeom j t x).symm |
| 243 | · intro t x |
| 244 | dsimp only |
| 245 | have heval : l0 (scaleT (t, (x : AddCircle curvePeriod))) = |
| 246 | (t, ((κ * x + d t ((κ * x : ℝ) : AddCircle L) : ℝ) : AddCircle L)) := by |
| 247 | change (t, scale (x : AddCircle curvePeriod) + |
| 248 | ((d t (scale (x : AddCircle curvePeriod)) : ℝ) : AddCircle L)) = _ |
| 249 | rw [hscale, ← AddCircle.coe_add] |
| 250 | change q.uncurry (l0 (scaleT (t, (x : AddCircle curvePeriod)))) = _ ∧ |
| 251 | s0 (l0 (scaleT (t, (x : AddCircle curvePeriod)))) = _ |
| 252 | rw [heval] |
| 253 | exact ⟨rfl, rfl⟩ |
| 254 | |
| 255 | end PoincareMT.M63 |