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.Analysis.Inner.ProductNormalConstraint |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Uniqueness.AmbientAcceleration |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Uniqueness.GraphComparison |
| 4 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Ambient.CurveCoefficients |
| 5 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Uniqueness.EmbeddedCurve |
| 6 | |
| 7 | /-! |
| 8 | # The actual normal graph equation |
| 9 | |
| 10 | The genuine embedded acceleration and differentiated normal constraint |
| 11 | give the scalar graph principal part. The pure-normal curve equation |
| 12 | then supplies its interior time derivative. MT2007 Claim 19.1, p. 437, |
| 13 | and Lemma 19.6, pp. 441-442; actual graph equation derivation of |
| 14 | 2026-09-22, statements 2-3. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set Filter |
| 21 | open scoped Manifold ContDiff Bundle Topology RealInnerProductSpace |
| 22 | |
| 23 | universe u v |
| 24 | |
| 25 | namespace PoincareMT.M63 |
| 26 | |
| 27 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 29 | {ι : Type v} [Fintype ι] {a b : ℝ} |
| 30 | |
| 31 | local notation "W" => EuclideanSpace ℝ ι |
| 32 | |
| 33 | /-- An actual C2 immersed normal graph has the projected curvature |
| 34 | equation, including at any time with the displayed spatial witnesses. |
| 35 | MT2007 Claim 19.1, p. 437; actual graph equation, statement 2. -/ |
| 36 | theorem normalGraph_curvature_projection |
| 37 | (F : RicciFlow n M (Icc a b)) {e : M → W} |
| 38 | (he : ContMDiff (𝓡 n) 𝓘(ℝ, W) ∞ e) |
| 39 | {N : Set W} (hN : IsOpen N) (heN : range e ⊆ N) {rho : W → M} |
| 40 | (hrho : ContMDiffOn 𝓘(ℝ, W) (𝓡 n) ∞ rho N) (hret : ∀ p, rho (e p) = p) |
| 41 | (q : ℝ → ℝ → M) {t : ℝ} |
| 42 | (hspace : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 2 (fun y => q y t)) |
| 43 | (himm : ∀ y, curveVelocity (n := n) (fun z => q z t) y ≠ 0) |
| 44 | {r : ℝ → W} (hr : ContDiff ℝ ∞ r) |
| 45 | (hnormal : ∀ y, ⟪e (q y t) - r y, deriv r y⟫ = 0) |
| 46 | (x : ℝ) (htrans : ⟪deriv (fun y => e (q y t)) x, deriv r x⟫ ≠ 0) : |
| 47 | let U : ℝ → W := fun y => e (q y t) - r y |
| 48 | let V := deriv (fun y => e (q y t)) x |
| 49 | let eta : W := mfderiv (𝓡 n) 𝓘(ℝ, W) e (q x t) (m62CurvatureVector F q t x) |
| 50 | let A := ambientCurvePrincipal F rho t (e (q x t)) V |
| 51 | let B0 := ambientCurveLower F e rho t (e (q x t)) V |
| 52 | eta - (⟪eta, deriv r x⟫ / ⟪V, deriv r x⟫) • V = |
| 53 | A • deriv (deriv U) x + curveGraphLower A B0 |
| 54 | (deriv r x) (deriv (deriv r) x) (deriv (deriv (deriv r)) x) |
| 55 | (U x) (deriv U x) := by |
| 56 | dsimp only |
| 57 | let f : ℝ → W := fun y => e (q y t) |
| 58 | let U : ℝ → W := fun y => f y - r y |
| 59 | let X := curveVelocity (n := n) (fun y => q y t) x |
| 60 | let V := deriv f x |
| 61 | let eta : W := mfderiv (𝓡 n) 𝓘(ℝ, W) e (q x t) (m62CurvatureVector F q t x) |
| 62 | let A := ambientCurvePrincipal F rho t (e (q x t)) V |
| 63 | let B0 := ambientCurveLower F e rho t (e (q x t)) V |
| 64 | have hf : ContDiff ℝ 2 f := |
| 65 | ((he.of_le (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2)).comp hspace).contDiff |
| 66 | have hr2 : ContDiff ℝ 2 r := hr.of_le (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2) |
| 67 | have hU : ContDiff ℝ 2 U := hf.sub hr2 |
| 68 | have hfirst : deriv U = fun y => deriv f y - deriv r y := |
| 69 | funext fun y => deriv_sub (hf.differentiable (by norm_num) y) |
| 70 | (hr2.differentiable (by norm_num) y) |
| 71 | have hV : V = deriv r x + deriv U x := by |
| 72 | rw [hfirst] |
| 73 | dsimp only [V] |
| 74 | abel |
| 75 | have hsecond : deriv (deriv f) x = deriv (deriv r) x + deriv (deriv U) x := by |
| 76 | rw [hfirst, deriv_fun_sub (hf.differentiable_deriv_two x) (hr2.differentiable_deriv_two x)] |
| 77 | abel |
| 78 | have hpush : V = mfderiv (𝓡 n) 𝓘(ℝ, W) e (q x t) X := by |
| 79 | have hchain : fderiv ℝ f x = |
| 80 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (q x t)).comp |
| 81 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) (fun y => q y t) x) := by |
| 82 | rw [← mfderiv_eq_fderiv] |
| 83 | exact mfderiv_comp x (he.mdifferentiable (by simp)).mdifferentiableAt |
| 84 | ((hspace x).mdifferentiableAt (by norm_num)) |
| 85 | exact congrArg (fun L : ℝ →L[ℝ] W => L 1) hchain |
| 86 | have hleft := (smooth_retraction_differentials he hN heN hrho hret).2.2 |
| 87 | have hA : A = (curveSpeed F q t x ^ 2)⁻¹ := by |
| 88 | dsimp only [A, ambientCurvePrincipal] |
| 89 | rw [hpush] |
| 90 | erw [hleft (q x t) X, hret (q x t)] |
| 91 | rw [M62.speed_sq] |
| 92 | have hB0 : B0 = -(A • coordinateHessian (F.connection t) e (q x t) X X) := by |
| 93 | dsimp only [B0, ambientCurveLower] |
| 94 | have hH : coordinateHessian (F.connection t) e (rho (e (q x t))) |
| 95 | (mfderiv 𝓘(ℝ, W) (𝓡 n) rho (e (q x t)) V) |
| 96 | (mfderiv 𝓘(ℝ, W) (𝓡 n) rho (e (q x t)) V) = |
| 97 | coordinateHessian (F.connection t) e (q x t) X X := by |
| 98 | rw [hpush] |
| 99 | erw [hleft (q x t) X, hret (q x t)] |
| 100 | rw [hH] |
| 101 | have hcurv : eta = A • (deriv (deriv r) x + deriv (deriv U) x) + B0 - |
| 102 | (deriv (curveSpeed F q t) x / curveSpeed F q t x ^ 3) • |
| 103 | (deriv r x + deriv U x) := by |
| 104 | have h := embedded_curvature_eq_acceleration_sub_tangent F he q hspace himm x |
| 105 | change eta = (curveSpeed F q t x ^ 2)⁻¹ • |
| 106 | (deriv (deriv f) x - coordinateHessian (F.connection t) e (q x t) X X) - |
| 107 | (deriv (curveSpeed F q t) x / curveSpeed F q t x ^ 3) • V at h |
| 108 | rw [← hA, hsecond, hV, smul_sub] at h |
| 109 | rw [hB0] |
| 110 | simpa only [sub_eq_add_neg, add_assoc] using h |
| 111 | have hden : ⟪deriv r x + deriv U x, deriv r x⟫ ≠ 0 := by |
| 112 | rw [← hV] |
| 113 | exact htrans |
| 114 | have hproj := graph_acceleration_projection hden |
| 115 | (secondDeriv_normal_constraint hU hr hnormal x) hcurv |
| 116 | rw [← hV] at hproj |
| 117 | exact hproj |
| 118 | |
| 119 | /-- The actual pure-normal solution gives a witnessed graph time |
| 120 | equation at an interior time. Spatial labels are frozen when computing |
| 121 | curvature. MT2007 Claim 19.1, p. 437; actual graph equation, statement 3. -/ |
| 122 | theorem normalGraph_hasDerivAt_time |
| 123 | {F : RicciFlow n M (Icc a b)} {e : M → W} |
| 124 | (he : ContMDiff (𝓡 n) 𝓘(ℝ, W) ∞ e) |
| 125 | {N : Set W} (hN : IsOpen N) (heN : range e ⊆ N) {rho : W → M} |
| 126 | (hrho : ContMDiffOn 𝓘(ℝ, W) (𝓡 n) ∞ rho N) (hret : ∀ p, rho (e p) = p) |
| 127 | {c : ℝ → ℝ → M} {J : Set ℝ} (hc : M63C2ShrinkingCurveOn F c J) |
| 128 | {r : ℝ → W} (hr : ContDiff ℝ ∞ r) (psi : ℝ → ℝ → ℝ) |
| 129 | {t x : ℝ} (ht : t ∈ interior J) |
| 130 | (hlabels : ContDiff ℝ 2 (fun y => psi y t)) |
| 131 | (hpos : ∀ y, 0 < deriv (fun z => psi z t) y) |
| 132 | (htime : DifferentiableAt ℝ (psi x) t) |
| 133 | (hnormal : ∀ s ∈ J, ∀ y, ⟪e (c (psi y s) s) - r y, deriv r y⟫ = 0) |
| 134 | (htrans : ⟪deriv (fun y => e (c (psi y t) t)) x, deriv r x⟫ ≠ 0) : |
| 135 | let q : ℝ → ℝ → M := fun y s => c (psi y s) s |
| 136 | let U : ℝ → ℝ → W := fun y s => e (q y s) - r y |
| 137 | let V := deriv (fun y => e (q y t)) x |
| 138 | let A := ambientCurvePrincipal F rho t (e (q x t)) V |
| 139 | let B0 := ambientCurveLower F e rho t (e (q x t)) V |
| 140 | HasDerivAt (U x) |
| 141 | (A • deriv (deriv (fun y => U y t)) x + curveGraphLower A B0 |
| 142 | (deriv r x) (deriv (deriv r) x) (deriv (deriv (deriv r)) x) |
| 143 | (U x t) (deriv (fun y => U y t) x)) t := by |
| 144 | dsimp only |
| 145 | let q : ℝ → ℝ → M := fun y s => c (psi y s) s |
| 146 | let U : ℝ → ℝ → W := fun y s => e (q y s) - r y |
| 147 | let V := deriv (fun y => e (q y t)) x |
| 148 | let eta : W := mfderiv (𝓡 n) 𝓘(ℝ, W) e (q x t) (m62CurvatureVector F q t x) |
| 149 | let A := ambientCurvePrincipal F rho t (e (q x t)) V |
| 150 | let B0 := ambientCurveLower F e rho t (e (q x t)) V |
| 151 | let delta := deriv (fun y => psi y t) x |
| 152 | let w := deriv (psi x) t |
| 153 | let beta := w / delta |
| 154 | let Y := deriv (fun y => e (c y t)) (psi x t) |
| 155 | have htJ : t ∈ J := interior_subset ht |
| 156 | have hspatial := hc.spatial_regular t htJ |
| 157 | have hlabelDiff : Differentiable ℝ (fun y => psi y t) := |
| 158 | hlabels.differentiable (by norm_num) |
| 159 | have hqspace : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 2 (fun y => q y t) := |
| 160 | hspatial.comp hlabels.contMDiff |
| 161 | have hqimm (y : ℝ) : curveVelocity (n := n) (fun z => q z t) y ≠ 0 := by |
| 162 | have hvel := curveVelocity_comp (phi := fun z => psi z t) (x := y) |
| 163 | ((hspatial (psi y t)).mdifferentiableAt (by norm_num)) |
| 164 | (hlabelDiff y).hasDerivAt |
| 165 | change curveVelocity (n := n) (fun z => q z t) y = _ at hvel |
| 166 | rw [hvel] |
| 167 | exact smul_ne_zero (hpos y).ne' (hc.immersed t htJ (psi y t)) |
| 168 | have hprojection := normalGraph_curvature_projection F he hN heN hrho hret q |
| 169 | hqspace hqimm hr (hnormal t htJ) x htrans |
| 170 | change eta - (⟪eta, deriv r x⟫ / ⟪V, deriv r x⟫) • V = |
| 171 | A • deriv (deriv (fun y => U y t)) x + curveGraphLower A B0 |
| 172 | (deriv r x) (deriv (deriv r) x) (deriv (deriv (deriv r)) x) |
| 173 | (U x t) (deriv (fun y => U y t) x) at hprojection |
| 174 | have hS := unitTangent_contMDiff_of_c2 F c hspatial (hc.immersed t htJ) |
| 175 | have hcurvature : m62CurvatureVector F q t x = m62CurvatureVector F c t (psi x t) := |
| 176 | curvatureVector_comp F c (hspatial.mdifferentiable (by norm_num)) |
| 177 | hlabelDiff hpos ((hS (psi x t)).mdifferentiableAt (by simp)) |
| 178 | have heta : eta = (mfderiv (𝓡 n) 𝓘(ℝ, W) e (c (psi x t) t) |
| 179 | (m62CurvatureVector F c t (psi x t)) : W) := by |
| 180 | dsimp only [eta, q] |
| 181 | rw [hcurvature] |
| 182 | obtain ⟨hC1, hCtime⟩ := c2ShrinkingCurve_embedded_interior_equation hc he |
| 183 | have hCspace : ContDiff ℝ 2 (fun y => e (c y t)) := |
| 184 | (c2ShrinkingCurve_embedded_closed_data hc he).1 t htJ |
| 185 | have hy : HasDerivAt (fun y => e (c y t)) Y (psi x t) := |
| 186 | (hCspace.differentiable (by norm_num) (psi x t)).hasDerivAt |
| 187 | have hV : V = delta • Y := by |
| 188 | have hd := hy.scomp (h := fun y => psi y t) x (hlabelDiff x).hasDerivAt |
| 189 | exact hd.deriv |
| 190 | let C : ℝ × ℝ → W := fun z => e (c z.1 z.2) |
| 191 | let D := fderiv ℝ C (psi x t, t) |
| 192 | have hD : HasFDerivAt C D (psi x t, t) := |
| 193 | ((hC1.contDiffAt ((isOpen_univ.prod isOpen_interior).mem_nhds |
| 194 | ⟨mem_univ _, ht⟩)).differentiableAt (by norm_num)).hasFDerivAt |
| 195 | have hDx : D (1, 0) = Y := |
| 196 | (hD.comp_hasDerivAt (f := fun y : ℝ => (y, t)) (psi x t) |
| 197 | ((hasDerivAt_id (psi x t)).prodMk (hasDerivAt_const (psi x t) t))).unique hy |
| 198 | have hDt : D (0, 1) = eta := by |
| 199 | have hd := (hD.comp_hasDerivAt (f := fun s : ℝ => (psi x t, s)) t |
| 200 | ((hasDerivAt_const t (psi x t)).prodMk (hasDerivAt_id t))).unique |
| 201 | (hCtime t ht (psi x t)) |
| 202 | exact hd.trans heta.symm |
| 203 | have hsum : D (w, 1) = w • Y + eta := by |
| 204 | have hp : (w, (1 : ℝ)) = w • ((1 : ℝ), (0 : ℝ)) + (0, 1) := by |
| 205 | ext <;> simp |
| 206 | rw [hp, map_add, map_smul, hDx, hDt] |
| 207 | have hbetaV : beta • V = w • Y := by |
| 208 | rw [hV, smul_smul] |
| 209 | dsimp only [beta] |
| 210 | rw [div_mul_cancel₀ w (hpos x).ne'] |
| 211 | have hUtime : HasDerivAt (U x) (eta + beta • V) t := by |
| 212 | have hd : HasDerivAt (fun s => e (q x s)) (D (w, 1)) t := |
| 213 | hD.comp_hasDerivAt (f := fun s => (psi x s, s)) t |
| 214 | (htime.hasDerivAt.prodMk (hasDerivAt_id t)) |
| 215 | apply (hd.sub_const (r x)).congr_deriv |
| 216 | rw [hsum, hbetaV, add_comm] |
| 217 | have hzero : HasDerivAt (fun s => ⟪U x s, deriv r x⟫) 0 t := by |
| 218 | apply (hasDerivAt_const t (0 : ℝ)).congr_of_eventuallyEq |
| 219 | filter_upwards [isOpen_interior.mem_nhds ht] with s hs |
| 220 | exact hnormal s (interior_subset hs) x |
| 221 | have hinner : ⟪eta, deriv r x⟫ + beta * ⟪V, deriv r x⟫ = 0 := by |
| 222 | have h := (hUtime.inner ℝ (hasDerivAt_const t (deriv r x))).unique hzero |
| 223 | simpa only [inner_zero_right, zero_add, inner_add_left, real_inner_smul_left] using h |
| 224 | have hbeta : beta = -(⟪eta, deriv r x⟫ / ⟪V, deriv r x⟫) := by |
| 225 | apply (eq_neg_iff_add_eq_zero).mpr |
| 226 | apply (mul_right_cancel₀ htrans) |
| 227 | rw [add_mul, div_mul_cancel₀ _ htrans, zero_mul] |
| 228 | linarith only [hinner] |
| 229 | apply hUtime.congr_deriv |
| 230 | rw [hbeta, neg_smul, ← sub_eq_add_neg] |
| 231 | exact hprojection |
| 232 | |
| 233 | end PoincareMT.M63 |