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.Surgery.StandardCap.Existence.Analysis.Basic.SmoothTransitionSpeed |
| 2 | import Mathlib.Analysis.Calculus.Deriv.Mul |
| 3 | |
| 4 | /-! |
| 5 | # Smooth segments with controlled speed |
| 6 | |
| 7 | The standard smooth transition parametrizes the segment from zero to a |
| 8 | vector, remaining constant before and after a prescribed interval. |
| 9 | These elementary estimates supply the connector in Morgan-Tian |
| 10 | Proposition 12.13, pp. 304-306. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open scoped ContDiff |
| 16 | |
| 17 | namespace Real |
| 18 | |
| 19 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 20 | |
| 21 | /-- A smooth parametrization of the segment from zero to `z`, used in |
| 22 | the connector of Proposition 12.13, pp. 304-306. -/ |
| 23 | noncomputable def smoothSegment (a b : ℝ) (z : E) (s : ℝ) : E := |
| 24 | smoothTransition ((s - a) / (b - a)) • z |
| 25 | |
| 26 | /-- The entire parametrized segment stays within the endpoint norm |
| 27 | (Proposition 12.13, pp. 304-306). -/ |
| 28 | theorem smoothSegment_norm_le (a b : ℝ) (z : E) (s : ℝ) : |
| 29 | ‖smoothSegment a b z s‖ ≤ ‖z‖ := by |
| 30 | rw [smoothSegment, norm_smul, Real.norm_eq_abs, |
| 31 | abs_of_nonneg (smoothTransition.nonneg _)] |
| 32 | exact mul_le_of_le_one_left (norm_nonneg z) (smoothTransition.le_one _) |
| 33 | |
| 34 | /-- The smooth segment starts at zero (Proposition 12.13, pp. 304-306). -/ |
| 35 | theorem smoothSegment_left (a b : ℝ) (z : E) : smoothSegment a b z a = 0 := by |
| 36 | simp [smoothSegment] |
| 37 | |
| 38 | /-- A nondegenerate smooth segment reaches its specified endpoint |
| 39 | (Proposition 12.13, pp. 304-306). -/ |
| 40 | theorem smoothSegment_right {a b : ℝ} (hab : a ≠ b) (z : E) : |
| 41 | smoothSegment a b z b = z := by |
| 42 | simp [smoothSegment, sub_ne_zero.mpr hab.symm] |
| 43 | |
| 44 | /-- The segment is smooth on the whole real line, including its joins |
| 45 | (Proposition 12.13, pp. 304-306). -/ |
| 46 | theorem smoothSegment_contDiff (a b : ℝ) (z : E) : |
| 47 | ContDiff ℝ ∞ (smoothSegment a b z) := by |
| 48 | exact ((smoothTransition.contDiff (n := (⊤ : ℕ∞))).comp |
| 49 | ((contDiff_id.sub contDiff_const).div_const _)).smul contDiff_const |
| 50 | |
| 51 | /-- The actual derivative of the smooth segment |
| 52 | (Proposition 12.13, pp. 304-306). -/ |
| 53 | theorem smoothSegment_hasDerivAt (a b : ℝ) (z : E) (s : ℝ) : |
| 54 | HasDerivAt (smoothSegment a b z) |
| 55 | ((deriv smoothTransition ((s - a) / (b - a)) / (b - a)) • z) s := by |
| 56 | have ht := (smoothTransition.contDiff (n := (⊤ : ℕ∞))).differentiable |
| 57 | (by simp) |
| 58 | have harg := ((hasDerivAt_id s).sub_const a).div_const (b - a) |
| 59 | change HasDerivAt (fun r => smoothTransition ((r - a) / (b - a)) • z) _ s |
| 60 | simpa only [Function.comp_apply, id_eq, one_div, div_eq_mul_inv, |
| 61 | one_mul] using |
| 62 | ((ht _).hasDerivAt.comp s harg).smul_const z |
| 63 | |
| 64 | /-- A global transition-derivative bound gives the expected inverse-length |
| 65 | speed bound, including both joins (Proposition 12.13, pp. 304-306). -/ |
| 66 | theorem smoothSegment_deriv_norm_le {a b C : ℝ} (hab : a < b) |
| 67 | (hC : ∀ x : ℝ, |deriv smoothTransition x| ≤ C) (z : E) (s : ℝ) : |
| 68 | ‖deriv (smoothSegment a b z) s‖ ≤ (C / (b - a)) * ‖z‖ := by |
| 69 | rw [(smoothSegment_hasDerivAt a b z s).deriv, norm_smul, Real.norm_eq_abs, |
| 70 | abs_div, abs_of_pos (sub_pos.mpr hab)] |
| 71 | exact mul_le_mul_of_nonneg_right |
| 72 | (div_le_div_of_nonneg_right (hC _) (sub_pos.mpr hab).le) (norm_nonneg z) |
| 73 | |
| 74 | end Real |