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.RicciFlow.CurveShortening.Evolution.Orthogonality |
| 2 | import PoincareLib.Geometry.RicciFlow.CurveShortening.Evolution.Regularity |
| 3 | import PoincareLib.Geometry.RicciFlow.CurveShortening.Regularization.Basic |
| 4 | import Mathlib.Analysis.InnerProductSpace.Basic |
| 5 | |
| 6 | /-! |
| 7 | # The spatial gradient of regularized curvature |
| 8 | |
| 9 | The calculation after Corollary 0.3 of the 2015 correction, pp. 6-7, |
| 10 | uses a positive regularization at every curvature zero. Here the actual |
| 11 | spatial normal projection is used, as required by the frozen contract. |
| 12 | See `references/ricci-flow/mapher/curve-evolution/derivations/2026-09-19-regularized-gradient.md`. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option maxSynthPendingDepth 3 |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open scoped Manifold ContDiff Bundle Topology |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.M62 |
| 24 | |
| 25 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 27 | {a b : ℝ} (F : RicciFlow n M (Set.Icc a b)) (c : ℝ → ℝ → M) |
| 28 | |
| 29 | /-- Differentiate squared curvature along the actual spatial parameter. |
| 30 | Correction pp. 6-7, after Corollary 0.3; valid also when curvature vanishes. -/ |
| 31 | theorem hasDerivAt_curvatureSquared_parameter (hc : M62ShrinkingCurve F c) |
| 32 | {t : ℝ} (ht : t ∈ Set.Ioo a b) (x : ℝ) : |
| 33 | HasDerivAt (m62CurvatureSquared F c t) |
| 34 | (2 * (F.metric t).inner (c x t) |
| 35 | (rampHorizontalCovariantDerivative (F.connection t) (fun y ↦ c y t) |
| 36 | (m62CurvatureVector F c t) x) |
| 37 | (m62CurvatureVector F c t x)) x := by |
| 38 | have hmem : (x, t) ∈ (Set.univ ×ˢ Set.Ioo a b : Set (ℝ × ℝ)) := ⟨Set.mem_univ _, ht⟩ |
| 39 | have hspace : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ × ℝ)) |
| 40 | (fun y : ℝ ↦ (y, t)) x := |
| 41 | (differentiableAt_id.prodMk (differentiableAt_const t)).mdifferentiableAt |
| 42 | have hH := ((((curvature_joint_contMDiff F c hc) (x, t) hmem).contMDiffAt |
| 43 | ((isOpen_univ.prod isOpen_Ioo).mem_nhds hmem)).mdifferentiableAt (by simp)).comp x hspace |
| 44 | have hγ := (hc.spatial_regular t (Set.Ioo_subset_Icc_self ht) x).mdifferentiableAt |
| 45 | (by norm_num) |
| 46 | have h := hasDerivAt_metric_pairing (F.connection t) (γ := fun y ↦ c y t) |
| 47 | (Y := m62CurvatureVector F c t) (Z := m62CurvatureVector F c t) hγ hH hH |
| 48 | apply h.congr_deriv |
| 49 | rw [(F.metric t).symm (c x t) (m62CurvatureVector F c t x) |
| 50 | (rampHorizontalCovariantDerivative (F.connection t) (fun y ↦ c y t) |
| 51 | (m62CurvatureVector F c t) x)] |
| 52 | ring |
| 53 | |
| 54 | /-- The regularized arclength derivative is a spatial-normal pairing divided |
| 55 | by positive regularized curvature; correction pp. 6-7. -/ |
| 56 | theorem regularized_arcDerivative_eq (hc : M62ShrinkingCurve F c) |
| 57 | {ε t : ℝ} (hε : 0 < ε) (ht : t ∈ Set.Ioo a b) (x : ℝ) : |
| 58 | m62ArcDerivative F c t (m62RegularizedCurvature F c ε t) x = |
| 59 | (F.metric t).inner (c x t) (m62SpatialNormalDerivative F c t x) |
| 60 | (m62CurvatureVector F c t x) / m62RegularizedCurvature F c ε t x := by |
| 61 | have h := regularized_hasDerivAt_parameter F c hε |
| 62 | (hasDerivAt_curvatureSquared_parameter F c hc ht x) |
| 63 | have horth : (F.metric t).inner (c x t) (spatialUnitTangent F c t x) |
| 64 | (m62CurvatureVector F c t x) = 0 := by |
| 65 | rw [(F.metric t).symm] |
| 66 | exact curvature_unitTangent_inner_zero F c hc (Set.Ioo_subset_Icc_self ht) x |
| 67 | have hh := (regularized_pos F c hε t x).ne' |
| 68 | have hv := (speed_pos F c hc (Set.Ioo_subset_Icc_self ht) x).ne' |
| 69 | rw [m62ArcDerivative, h.deriv] |
| 70 | simp only [m62SpatialNormalDerivative, m62SpatialDerivative, map_sub, sub_apply, map_smul, |
| 71 | smul_apply, smul_eq_mul, horth, mul_zero, sub_zero] |
| 72 | field_simp |
| 73 | |
| 74 | /-- The squared regularized gradient is bounded by the actual spatial |
| 75 | normal derivative norm; correction pp. 6-7, including curvature zeros. -/ |
| 76 | theorem regularized_gradient_le (hc : M62ShrinkingCurve F c) |
| 77 | {ε t : ℝ} (hε : 0 < ε) (ht : t ∈ Set.Ioo a b) (x : ℝ) : |
| 78 | let P := m62SpatialNormalDerivative F c t x |
| 79 | (m62ArcDerivative F c t (m62RegularizedCurvature F c ε t) x) ^ 2 ≤ |
| 80 | (F.metric t).inner (c x t) P P := by |
| 81 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 82 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 83 | let P := m62SpatialNormalDerivative F c t x |
| 84 | let H := m62CurvatureVector F c t x |
| 85 | have hCS : ((F.metric t).inner (c x t) P H) ^ 2 ≤ |
| 86 | (F.metric t).inner (c x t) P P * m62CurvatureSquared F c t x := by |
| 87 | change (inner ℝ P H) ^ 2 ≤ inner ℝ P P * inner ℝ H H |
| 88 | simpa only [pow_two] using real_inner_mul_inner_self_le P H |
| 89 | have hP : 0 ≤ (F.metric t).inner (c x t) P P := by |
| 90 | change 0 ≤ inner ℝ P P |
| 91 | exact real_inner_self_nonneg |
| 92 | have hk : m62CurvatureSquared F c t x ≤ m62RegularizedCurvature F c ε t x ^ 2 := by |
| 93 | rw [regularized_sq F c ε t x] |
| 94 | exact le_add_of_nonneg_right (sq_nonneg ε) |
| 95 | have hbound := hCS.trans (mul_le_mul_of_nonneg_left hk hP) |
| 96 | rw [regularized_arcDerivative_eq F c hc hε ht x, div_pow] |
| 97 | exact (div_le_iff₀ (sq_pos_of_pos (regularized_pos F c hε t x))).mpr hbound |
| 98 | |
| 99 | end PoincareMT.M62 |