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.Topology.UniformSpace.HeineCantor |
| 2 | import Mathlib.Topology.MetricSpace.Pseudo.Lemmas |
| 3 | import Mathlib.Topology.Instances.Real.Lemmas |
| 4 | |
| 5 | /-! |
| 6 | # A uniform time modulus on a compact product |
| 7 | |
| 8 | Joint continuity on a compact time-space product gives one time |
| 9 | modulus valid at every point of its spatial compact set. This is |
| 10 | used to freeze the model sphere at the terminal time in Morgan--Tian, |
| 11 | Corollary 16.9 and Claim 16.10, pp. 373-375; M44 derivation 89. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set |
| 17 | |
| 18 | /-- The time modulus of a continuous function on a compact product |
| 19 | is uniform in its spatial argument. Source: the terminal model step |
| 20 | in Claim 16.10; M44 derivation 89. -/ |
| 21 | theorem ContinuousOn.exists_uniform_time_delta |
| 22 | {X Y : Type*} [PseudoMetricSpace X] [PseudoMetricSpace Y] |
| 23 | {I : Set ℝ} {K : Set X} {f : ℝ × X → Y} |
| 24 | (hf : ContinuousOn f (I ×ˢ K)) (hI : IsCompact I) (hK : IsCompact K) |
| 25 | {epsilon : ℝ} (hepsilon : 0 < epsilon) : |
| 26 | ∃ delta : ℝ, 0 < delta ∧ ∀ s ∈ I, ∀ t ∈ I, |s - t| < delta → |
| 27 | ∀ x ∈ K, dist (f (s, x)) (f (t, x)) < epsilon := by |
| 28 | obtain ⟨delta, hdelta, hmod⟩ := Metric.uniformContinuousOn_iff.mp |
| 29 | ((hI.prod hK).uniformContinuousOn_of_continuous hf) epsilon hepsilon |
| 30 | refine ⟨delta, hdelta, ?_⟩ |
| 31 | intro s hs t ht hst x hx |
| 32 | apply hmod (s, x) ⟨hs, hx⟩ (t, x) ⟨ht, hx⟩ |
| 33 | simpa only [Prod.dist_eq, dist_self, Real.dist_eq, max_eq_left (abs_nonneg (s - t))] |
| 34 | using hst |