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.Evolution.Flow |
| 2 | import Mathlib.Analysis.SpecialFunctions.Sqrt |
| 3 | import Mathlib.Tactic.Linarith |
| 4 | |
| 5 | /-! |
| 6 | # Positive regularization at curvature zeros |
| 7 | |
| 8 | The 2015 correction, pp. 6-7, replaces the curvature norm by |
| 9 | `sqrt (k^2 + epsilon^2)`. The comparisons below do not differentiate the |
| 10 | norm at a zero. The error estimate supplies the limit in Lemma 0.4, pp. 7-8. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.M62 |
| 20 | |
| 21 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 23 | {a b : ℝ} (F : RicciFlow n M (Set.Icc a b)) (c : ℝ → ℝ → M) |
| 24 | |
| 25 | /-- The actual curvature self-pairing is nonnegative; correction p. 3. -/ |
| 26 | theorem curvatureSquared_nonneg (t x : ℝ) : 0 ≤ m62CurvatureSquared F c t x := by |
| 27 | exact ((F.metric t).toRiemannianMetric.toCore (c x t)).re_inner_nonneg _ |
| 28 | |
| 29 | /-- The curvature norm is nonnegative, even at its zeros; correction p. 3. -/ |
| 30 | theorem curvature_nonneg (t x : ℝ) : 0 ≤ m62Curvature F c t x := |
| 31 | Real.sqrt_nonneg _ |
| 32 | |
| 33 | /-- Squaring the curvature norm recovers its self-pairing; correction pp. 3, 6. -/ |
| 34 | theorem curvature_sq (t x : ℝ) : |
| 35 | m62Curvature F c t x ^ 2 = m62CurvatureSquared F c t x := |
| 36 | Real.sq_sqrt (curvatureSquared_nonneg F c t x) |
| 37 | |
| 38 | /-- The regularized radicand is positive without a curvature lower bound; correction p. 6. -/ |
| 39 | theorem regularized_radicand_pos {ε : ℝ} (hε : 0 < ε) (t x : ℝ) : |
| 40 | 0 < m62CurvatureSquared F c t x + ε ^ 2 := |
| 41 | add_pos_of_nonneg_of_pos (curvatureSquared_nonneg F c t x) (sq_pos_of_pos hε) |
| 42 | |
| 43 | /-- Positive regularization never vanishes, including at endpoints; correction p. 6. -/ |
| 44 | theorem regularized_pos {ε : ℝ} (hε : 0 < ε) (t x : ℝ) : |
| 45 | 0 < m62RegularizedCurvature F c ε t x := |
| 46 | Real.sqrt_pos.mpr (regularized_radicand_pos F c hε t x) |
| 47 | |
| 48 | /-- The regularization has its displayed square for every epsilon; correction p. 6. -/ |
| 49 | theorem regularized_sq (ε t x : ℝ) : |
| 50 | m62RegularizedCurvature F c ε t x ^ 2 = m62CurvatureSquared F c t x + ε ^ 2 := |
| 51 | Real.sq_sqrt (add_nonneg (curvatureSquared_nonneg F c t x) (sq_nonneg ε)) |
| 52 | |
| 53 | /-- Regularization increases the curvature norm; correction p. 6. -/ |
| 54 | theorem curvature_le_regularized (ε t x : ℝ) : |
| 55 | m62Curvature F c t x ≤ m62RegularizedCurvature F c ε t x := |
| 56 | Real.sqrt_le_sqrt (le_add_of_nonneg_right (sq_nonneg ε)) |
| 57 | |
| 58 | /-- The increase is strict for positive epsilon; correction p. 6. -/ |
| 59 | theorem curvature_lt_regularized {ε : ℝ} (hε : 0 < ε) (t x : ℝ) : |
| 60 | m62Curvature F c t x < m62RegularizedCurvature F c ε t x := |
| 61 | Real.sqrt_lt_sqrt (curvatureSquared_nonneg F c t x) |
| 62 | (lt_add_of_pos_right _ (sq_pos_of_pos hε)) |
| 63 | |
| 64 | /-- The pointwise error is at most epsilon; correction Lemma 0.4, pp. 7-8. -/ |
| 65 | theorem regularized_sub_curvature_le {ε : ℝ} (hε : 0 ≤ ε) (t x : ℝ) : |
| 66 | m62RegularizedCurvature F c ε t x - m62Curvature F c t x ≤ ε := by |
| 67 | have hk := curvature_nonneg F c t x |
| 68 | have hk2 := curvature_sq F c t x |
| 69 | have hupper : m62RegularizedCurvature F c ε t x ≤ m62Curvature F c t x + ε := by |
| 70 | apply Real.sqrt_le_iff.mpr |
| 71 | exact ⟨add_nonneg hk hε, by nlinarith [mul_nonneg hk hε]⟩ |
| 72 | linarith |
| 73 | |
| 74 | /-- Smooth squared curvature gives smooth positive regularization; correction pp. 6-7. -/ |
| 75 | theorem regularized_smooth {ε : ℝ} (hε : 0 < ε) |
| 76 | (hq : ContDiffOn ℝ ∞ (fun z : ℝ × ℝ ↦ m62CurvatureSquared F c z.2 z.1) |
| 77 | (Set.univ ×ˢ Set.Ioo a b)) : |
| 78 | ContDiffOn ℝ ∞ (fun z : ℝ × ℝ ↦ m62RegularizedCurvature F c ε z.2 z.1) |
| 79 | (Set.univ ×ˢ Set.Ioo a b) := by |
| 80 | exact (hq.add contDiffOn_const).sqrt |
| 81 | (fun z _ ↦ (regularized_radicand_pos F c hε z.2 z.1).ne') |
| 82 | |
| 83 | /-- Time differentiation of the positive regularization retains a witness; correction p. 7. -/ |
| 84 | theorem regularized_hasDerivAt_time {ε t x q' : ℝ} (hε : 0 < ε) |
| 85 | (hq : HasDerivAt (fun s ↦ m62CurvatureSquared F c s x) q' t) : |
| 86 | HasDerivAt (fun s ↦ m62RegularizedCurvature F c ε s x) |
| 87 | (q' / (2 * m62RegularizedCurvature F c ε t x)) t := by |
| 88 | exact (hq.add_const (ε ^ 2)).sqrt (regularized_radicand_pos F c hε t x).ne' |
| 89 | |
| 90 | /-- Parameter differentiation also avoids differentiating the norm; correction p. 6. -/ |
| 91 | theorem regularized_hasDerivAt_parameter {ε t x q' : ℝ} (hε : 0 < ε) |
| 92 | (hq : HasDerivAt (m62CurvatureSquared F c t) q' x) : |
| 93 | HasDerivAt (m62RegularizedCurvature F c ε t) |
| 94 | (q' / (2 * m62RegularizedCurvature F c ε t x)) x := by |
| 95 | exact (hq.add_const (ε ^ 2)).sqrt (regularized_radicand_pos F c hε t x).ne' |
| 96 | |
| 97 | end PoincareMT.M62 |