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 Mathlib.Analysis.SpecialFunctions.SmoothTransition |
| 2 | import Mathlib.Topology.Order.Compact |
| 3 | |
| 4 | /-! |
| 5 | # A uniform speed bound for the smooth transition |
| 6 | |
| 7 | The derivative is continuous and vanishes off a fixed compact interval. |
| 8 | This gives the uniform parameter-speed constant in the coordinate connector |
| 9 | for Morgan-Tian Proposition 12.13, pp. 304-306. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set Filter |
| 15 | open scoped Topology ContDiff |
| 16 | |
| 17 | namespace Real.smoothTransition |
| 18 | |
| 19 | /-- One fixed constant bounds the derivative on the whole real line |
| 20 | (Proposition 12.13, pp. 304-306, smooth connector). -/ |
| 21 | theorem exists_deriv_bound : ∃ C : ℝ, 1 ≤ C ∧ ∀ x : ℝ, |
| 22 | |deriv Real.smoothTransition x| ≤ C := by |
| 23 | have hcont : Continuous (deriv Real.smoothTransition) := |
| 24 | (Real.smoothTransition.contDiff (n := (⊤ : ℕ∞))).continuous_deriv (by simp) |
| 25 | obtain ⟨C, hC⟩ := (isCompact_Icc (a := (-1 : ℝ)) (b := 2)).exists_bound_of_continuousOn |
| 26 | hcont.continuousOn |
| 27 | refine ⟨max 1 C, le_max_left _ _, fun x => ?_⟩ |
| 28 | by_cases hx : x ∈ Icc (-1 : ℝ) 2 |
| 29 | · exact (hC x hx).trans (le_max_right _ _) |
| 30 | have hzero : deriv Real.smoothTransition x = 0 := by |
| 31 | simp only [mem_Icc, not_and_or, not_le] at hx |
| 32 | rcases hx with hx | hx |
| 33 | · apply HasDerivAt.deriv |
| 34 | apply (hasDerivAt_const x (0 : ℝ)).congr_of_eventuallyEq |
| 35 | filter_upwards [Iio_mem_nhds (show x < 0 by linarith)] with y hy |
| 36 | exact zero_of_nonpos hy.le |
| 37 | · apply HasDerivAt.deriv |
| 38 | apply (hasDerivAt_const x (1 : ℝ)).congr_of_eventuallyEq |
| 39 | filter_upwards [Ioi_mem_nhds (show 1 < x by linarith)] with y hy |
| 40 | exact one_of_one_le hy.le |
| 41 | rw [hzero, abs_zero] |
| 42 | exact zero_le_one.trans (le_max_left _ _) |
| 43 | |
| 44 | end Real.smoothTransition |