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.LabelVelocity |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Uniqueness.AmbientAcceleration |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Retraction.TangentContinuity |
| 4 | |
| 5 | /-! |
| 6 | # Closed geometric fields of the actual ambient curve |
| 7 | |
| 8 | The literal pushed curvature expression and the retraction tangent |
| 9 | map recover the genuine closed velocity and curvature fields. |
| 10 | MT2007 Claim 19.1, p. 437 and Lemma 19.6, pp. 441-442; |
| 11 | `2026-09-22-closed-ambient-curve-fields.md`. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set |
| 18 | open scoped Manifold ContDiff Bundle |
| 19 | |
| 20 | universe u v |
| 21 | |
| 22 | namespace PoincareMT.M63 |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 26 | {ι : Type v} [Fintype ι] {a b : ℝ} |
| 27 | |
| 28 | local notation "W" => EuclideanSpace ℝ ι |
| 29 | |
| 30 | /-- The actual pushed curvature is the ambient second-order expression |
| 31 | with the precise tangential correction. MT2007 Lemma 19.6, pp. 441-442; |
| 32 | closed ambient curve-fields derivation, statement 1. -/ |
| 33 | theorem ambientCurve_embeddedCurvature_eq (F : RicciFlow n M (Icc a b)) |
| 34 | {e : M → W} (he : ContMDiff (𝓡 n) 𝓘(ℝ, W) ∞ e) |
| 35 | {U : Set W} (hU : IsOpen U) (_heU : range e ⊆ U) {ρ : W → M} |
| 36 | (hρ : ContMDiffOn 𝓘(ℝ, W) (𝓡 n) ∞ ρ U) (_hρe : ∀ p, ρ (e p) = p) |
| 37 | (t : ℝ) {f : ℝ → W} (hf : ContDiff ℝ 2 f) |
| 38 | (hguard : ∀ x, f x ∈ U ∧ mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (f x) (deriv f x) ≠ 0) |
| 39 | (hfixed : ∀ x, f x = e (ρ (f x))) : |
| 40 | let c := fun x (_ : ℝ) => ρ (f x) |
| 41 | let A := fun x => ambientCurvePrincipal F ρ t (f x) (deriv f x) |
| 42 | let B := fun x => ambientCurveLower F e ρ t (f x) (deriv f x) |
| 43 | ∀ x, mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (m62CurvatureVector F c t x) = |
| 44 | A x • deriv (deriv f) x + B x + (deriv A x / 2) • deriv f x := by |
| 45 | let c := fun x (_ : ℝ) => ρ (f x) |
| 46 | let A := fun x => ambientCurvePrincipal F ρ t (f x) (deriv f x) |
| 47 | let B := fun x => ambientCurveLower F e ρ t (f x) (deriv f x) |
| 48 | change ∀ x, mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (m62CurvatureVector F c t x) = |
| 49 | A x • deriv (deriv f) x + B x + (deriv A x / 2) • deriv f x |
| 50 | have hspace : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 2 (fun y => c y t) := |
| 51 | (hρ.of_le (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2)).comp_contMDiff |
| 52 | hf.contMDiff (fun x => (hguard x).1) |
| 53 | have hvel (x : ℝ) : curveVelocity (n := n) (fun y => c y t) x = |
| 54 | mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (f x) (deriv f x) := by |
| 55 | change (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) (ρ ∘ f) x) 1 = _ |
| 56 | erw [mfderiv_comp x |
| 57 | ((hρ.contMDiffAt (hU.mem_nhds (hguard x).1)).mdifferentiableAt (by simp)) |
| 58 | ((hf.contMDiff x).mdifferentiableAt (by norm_num)), |
| 59 | ContinuousLinearMap.comp_apply, mfderiv_eq_fderiv] |
| 60 | rfl |
| 61 | have himm (x : ℝ) : curveVelocity (n := n) (fun y => c y t) x ≠ 0 := by |
| 62 | rw [hvel] |
| 63 | exact (hguard x).2 |
| 64 | have heq : (fun y => e (c y t)) = f := funext fun y => (hfixed y).symm |
| 65 | have hA (x : ℝ) : A x = (curveSpeed F c t x ^ 2)⁻¹ := by |
| 66 | dsimp only [A, ambientCurvePrincipal] |
| 67 | rw [← hvel x] |
| 68 | exact congrArg (fun z : ℝ => z⁻¹) (M62.speed_sq F c t x).symm |
| 69 | have hB (x : ℝ) : B x = -(A x • coordinateHessian (F.connection t) e (c x t) |
| 70 | (curveVelocity (fun y => c y t) x) (curveVelocity (fun y => c y t) x)) := by |
| 71 | dsimp only [B, ambientCurveLower, A] |
| 72 | rw [hvel x] |
| 73 | intro x |
| 74 | have hcurv := embedded_curvature_eq_acceleration_sub_tangent F he c (t := t) hspace himm x |
| 75 | rw [heq, ← hA x] at hcurv |
| 76 | have hlabel := ambientCurve_labelVelocity_eq F hU hρ t hf hguard x |
| 77 | change deriv A x / 2 = -(deriv (curveSpeed F c t) x / curveSpeed F c t x ^ 3) |
| 78 | at hlabel |
| 79 | change mfderiv (𝓡 n) 𝓘(ℝ, W) e (c x t) (m62CurvatureVector F c t x) = |
| 80 | A x • deriv (deriv f) x + B x + (deriv A x / 2) • deriv f x |
| 81 | rw [hcurv, hB, hlabel, smul_sub, neg_smul] |
| 82 | abel |
| 83 | |
| 84 | /-- Closed smooth ambient jets give the actual projected spatial |
| 85 | immersion and both genuine continuous tangent fields. MT2007 Claim |
| 86 | 19.1, p. 437; closed ambient curve-fields derivation, statement 2. -/ |
| 87 | theorem ambientCurve_closed_fields (F : RicciFlow n M (Icc a b)) |
| 88 | {e : M → W} (he : ContMDiff (𝓡 n) 𝓘(ℝ, W) ∞ e) |
| 89 | {U : Set W} (hU : IsOpen U) (heU : range e ⊆ U) {ρ : W → M} |
| 90 | (hρ : ContMDiffOn 𝓘(ℝ, W) (𝓡 n) ∞ ρ U) (hρe : ∀ p, ρ (e p) = p) |
| 91 | {T : ℝ} (haT : a < T) (hTb : T ≤ b) {q : ℝ → ℝ → W} |
| 92 | (hq : ContDiffOn ℝ ∞ (Function.uncurry q) (Icc a T ×ˢ univ)) |
| 93 | (hguard : ∀ t ∈ Icc a T, ∀ x, q t x ∈ U ∧ |
| 94 | mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (q t x) (deriv (q t) x) ≠ 0) |
| 95 | (hfixed : ∀ t ∈ Icc a T, ∀ x, q t x = e (ρ (q t x))) : |
| 96 | let c := fun x t => ρ (q t x) |
| 97 | ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n) ∞ |
| 98 | (fun z : ℝ × ℝ => c z.1 z.2) (univ ×ˢ Icc a T) ∧ |
| 99 | (∀ t ∈ Icc a T, ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) ∞ (fun x => c x t)) ∧ |
| 100 | (∀ t ∈ Icc a T, ∀ x, curveVelocity (n := n) (fun y => c y t) x ≠ 0) ∧ |
| 101 | ContinuousOn (fun z : ℝ × ℝ => |
| 102 | (⟨c z.1 z.2, curveVelocity (n := n) (fun y => c y z.2) z.1⟩ : |
| 103 | TangentBundle (𝓡 n) M)) (univ ×ˢ Icc a T) ∧ |
| 104 | ContinuousOn (fun z : ℝ × ℝ => |
| 105 | (⟨c z.1 z.2, m62CurvatureVector F c z.2 z.1⟩ : |
| 106 | TangentBundle (𝓡 n) M)) (univ ×ˢ Icc a T) := by |
| 107 | let S : Set (ℝ × ℝ) := Icc a T ×ˢ univ |
| 108 | let c := fun x t => ρ (q t x) |
| 109 | let A := fun t x => ambientCurvePrincipal F ρ t (q t x) (deriv (q t) x) |
| 110 | let B := fun t x => ambientCurveLower F e ρ t (q t x) (deriv (q t) x) |
| 111 | have hqx := contDiffOn_spatial_deriv_of_uniqueDiffOn (uniqueDiffOn_Icc haT) |
| 112 | (m := ∞) (by simp) hq |
| 113 | have hqxx := contDiffOn_spatial_deriv_of_uniqueDiffOn (uniqueDiffOn_Icc haT) |
| 114 | (q := fun t => deriv (q t)) (m := ∞) (n := ∞) (by simp) hqx |
| 115 | have hspace (t : ℝ) (ht : t ∈ Icc a T) : ContDiff ℝ ∞ (q t) := |
| 116 | contDiffOn_univ.mp (hq.comp (contDiffOn_const.prodMk contDiffOn_id) |
| 117 | (fun _ _ => ⟨ht, mem_univ _⟩)) |
| 118 | have hcspace (t : ℝ) (ht : t ∈ Icc a T) : |
| 119 | ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) ∞ (fun x => c x t) := |
| 120 | hρ.comp_contMDiff (hspace t ht).contMDiff (fun x => (hguard t ht x).1) |
| 121 | have hc : ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n) ∞ |
| 122 | (fun z : ℝ × ℝ => c z.2 z.1) S := |
| 123 | hρ.comp hq.contMDiffOn (fun z hz => (hguard z.1 hz.1 z.2).1) |
| 124 | have hswap : ContDiff ℝ ∞ (Prod.swap : ℝ × ℝ → ℝ × ℝ) := |
| 125 | contDiff_snd.prodMk contDiff_fst |
| 126 | have hswapmem : MapsTo (Prod.swap : ℝ × ℝ → ℝ × ℝ) (univ ×ˢ Icc a T) S := |
| 127 | fun _ hz => ⟨hz.2, hz.1⟩ |
| 128 | have hcjoint : ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n) ∞ |
| 129 | (fun z : ℝ × ℝ => c z.1 z.2) (univ ×ˢ Icc a T) := |
| 130 | hc.comp hswap.contMDiff.contMDiffOn hswapmem |
| 131 | have hvel (t : ℝ) (ht : t ∈ Icc a T) (x : ℝ) : |
| 132 | curveVelocity (n := n) (fun y => c y t) x = |
| 133 | mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (q t x) (deriv (q t) x) := by |
| 134 | change (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) (ρ ∘ q t) x) 1 = _ |
| 135 | erw [mfderiv_comp x |
| 136 | ((hρ.contMDiffAt (hU.mem_nhds (hguard t ht x).1)).mdifferentiableAt (by simp)) |
| 137 | (((hspace t ht).contMDiff x).mdifferentiableAt (by simp)), |
| 138 | ContinuousLinearMap.comp_apply, mfderiv_eq_fderiv] |
| 139 | rfl |
| 140 | have himm (t : ℝ) (ht : t ∈ Icc a T) (x : ℝ) : |
| 141 | curveVelocity (n := n) (fun y => c y t) x ≠ 0 := by |
| 142 | rw [hvel t ht x] |
| 143 | exact (hguard t ht x).2 |
| 144 | have hparam : ContDiffOn ℝ ∞ (fun z : ℝ × ℝ => |
| 145 | ((z.1, q z.1 z.2), deriv (q z.1) z.2)) S := |
| 146 | (contDiffOn_fst.prodMk hq).prodMk hqx |
| 147 | have hmap : MapsTo (fun z : ℝ × ℝ => |
| 148 | ((z.1, q z.1 z.2), deriv (q z.1) z.2)) S |
| 149 | {z : (ℝ × W) × W | z.1.1 ∈ Icc a b ∧ z.1.2 ∈ U ∧ |
| 150 | mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.1.2 z.2 ≠ 0} := by |
| 151 | intro z hz |
| 152 | exact ⟨⟨hz.1.1, hz.1.2.trans hTb⟩, hguard z.1 hz.1 z.2⟩ |
| 153 | obtain ⟨hA0, hB0, _⟩ := ambientCurveCoefficients_contDiffOn F he hU hρ |
| 154 | have hA : ContDiffOn ℝ ∞ (Function.uncurry A) S := by |
| 155 | simpa only [Function.comp_def, Function.uncurry_def, A] using hA0.comp hparam hmap |
| 156 | have hB : ContDiffOn ℝ ∞ (Function.uncurry B) S := by |
| 157 | simpa only [Function.comp_def, Function.uncurry_def, B] using hB0.comp hparam hmap |
| 158 | have hAx := contDiffOn_spatial_deriv_of_uniqueDiffOn (uniqueDiffOn_Icc haT) |
| 159 | (q := A) (m := ∞) (n := ∞) (by simp) hA |
| 160 | have hpushH : ContinuousOn (fun z : ℝ × ℝ => |
| 161 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (c z.2 z.1) (m62CurvatureVector F c z.1 z.2)) S := by |
| 162 | apply (((hA.continuousOn.smul hqxx.continuousOn).add hB.continuousOn).add |
| 163 | ((hAx.div_const 2).continuousOn.smul hqx.continuousOn)).congr |
| 164 | intro z hz |
| 165 | exact ambientCurve_embeddedCurvature_eq F he hU heU hρ hρe z.1 |
| 166 | ((hspace z.1 hz.1).of_le (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2)) |
| 167 | (hguard z.1 hz.1) (hfixed z.1 hz.1) z.2 |
| 168 | have hpushX : ContinuousOn (fun z : ℝ × ℝ => |
| 169 | mfderiv (𝓡 n) 𝓘(ℝ, W) e (c z.2 z.1) |
| 170 | (curveVelocity (n := n) (fun y => c y z.1) z.2)) S := by |
| 171 | apply hqx.continuousOn.congr |
| 172 | intro z hz |
| 173 | have heq : (fun y => e (c y z.1)) = q z.1 := |
| 174 | funext fun y => (hfixed z.1 hz.1 y).symm |
| 175 | have hd : fderiv ℝ (fun y => e (c y z.1)) z.2 = |
| 176 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (c z.2 z.1)).comp |
| 177 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) (fun y => c y z.1) z.2) := by |
| 178 | rw [← mfderiv_eq_fderiv] |
| 179 | exact mfderiv_comp z.2 (he.mdifferentiable (by simp)).mdifferentiableAt |
| 180 | (((hcspace z.1 hz.1) z.2).mdifferentiableAt (by simp)) |
| 181 | rw [heq] at hd |
| 182 | exact (congrArg (fun D : ℝ →L[ℝ] W => D 1) hd).symm |
| 183 | refine ⟨hcjoint, hcspace, himm, ?_, ?_⟩ |
| 184 | · exact continuousOn_tangentSection_of_retraction_pushforward he hU heU hρ hρe |
| 185 | (fun z : ℝ × ℝ => c z.1 z.2) |
| 186 | (fun z => curveVelocity (n := n) (fun y => c y z.2) z.1) |
| 187 | hcjoint.continuousOn (hpushX.comp hswap.continuous.continuousOn hswapmem) |
| 188 | · exact continuousOn_tangentSection_of_retraction_pushforward he hU heU hρ hρe |
| 189 | (fun z : ℝ × ℝ => c z.1 z.2) (fun z => m62CurvatureVector F c z.2 z.1) |
| 190 | hcjoint.continuousOn (hpushH.comp hswap.continuous.continuousOn hswapmem) |
| 191 | |
| 192 | end PoincareMT.M63 |