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.Calculus.InverseFunctionTheorem.FiniteDimensional |
| 2 | |
| 3 | /-! |
| 4 | # A time-preserving homeomorphism extension |
| 5 | |
| 6 | Extending only the spatial error in Mathlib's finite-dimensional |
| 7 | Lipschitz-extension proof preserves the time component exactly. This |
| 8 | is the topological relative inverse step for Morgan-Tian Proposition |
| 9 | 6.28, p. 117; see tasks/M14/derivations/2026-09-21-relative-inverse.md. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set |
| 15 | open scoped NNReal |
| 16 | |
| 17 | namespace PoincareMT.M14 |
| 18 | |
| 19 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 20 | {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [FiniteDimensional ℝ F] |
| 21 | |
| 22 | set_option backward.isDefEq.respectTransparency false in |
| 23 | /-- A sufficiently small perturbation of a time-preserving linear |
| 24 | equivalence extends to a time-preserving homeomorphism. Only the |
| 25 | spatial error is extended, so the same physical slab is preserved. |
| 26 | Relative inverse step for Proposition 6.28, p. 117; see the derivation |
| 27 | 2026-09-21-relative-inverse.md. -/ |
| 28 | theorem exists_timePreserving_homeomorph_extension |
| 29 | {f : E × ℝ → F × ℝ} {L : (E × ℝ) ≃L[ℝ] (F × ℝ)} |
| 30 | {S : Set (E × ℝ)} {c : ℝ≥0} |
| 31 | (hf : ApproximatesLinearOn f (L : (E × ℝ) →L[ℝ] (F × ℝ)) S c) |
| 32 | (hft : ∀ z ∈ S, (f z).2 = z.2) (hLt : ∀ z, (L z).2 = z.2) |
| 33 | (hc : lipschitzExtensionConstant F * c < |
| 34 | ‖(L.symm : (F × ℝ) →L[ℝ] (E × ℝ))‖₊⁻¹) : |
| 35 | ∃ g : (E × ℝ) ≃ₜ (F × ℝ), EqOn f g S ∧ ∀ z, (g z).2 = z.2 := by |
| 36 | have hsp : LipschitzOnWith c (fun z => (f z - L z).1) S := by |
| 37 | rw [lipschitzOnWith_iff_norm_sub_le] |
| 38 | intro z hz w hw |
| 39 | exact (norm_fst_le ((f z - L z) - (f w - L w))).trans |
| 40 | ((lipschitzOnWith_iff_norm_sub_le.mp hf.lipschitzOnWith) hz hw) |
| 41 | obtain ⟨u, hu, heq⟩ := hsp.extend_finite_dimension |
| 42 | let g : E × ℝ → F × ℝ := fun z => L z + (u z, 0) |
| 43 | have hgf : EqOn f g S := by |
| 44 | intro z hz |
| 45 | apply Prod.ext |
| 46 | · change (f z).1 = (L z).1 + u z |
| 47 | rw [← heq hz] |
| 48 | change (f z).1 = (L z).1 + ((f z).1 - (L z).1) |
| 49 | abel |
| 50 | · change (f z).2 = (L z).2 + 0 |
| 51 | rw [add_zero, hft z hz, hLt z] |
| 52 | have herror : LipschitzWith (lipschitzExtensionConstant F * c) |
| 53 | (fun z => (u z, (0 : ℝ))) := by |
| 54 | simpa only [max_eq_left (zero_le : 0 ≤ lipschitzExtensionConstant F * c)] using |
| 55 | hu.prodMk (LipschitzWith.const (0 : ℝ)) |
| 56 | have hg : ApproximatesLinearOn g (L : (E × ℝ) →L[ℝ] (F × ℝ)) univ |
| 57 | (lipschitzExtensionConstant F * c) := by |
| 58 | apply LipschitzOnWith.approximatesLinearOn |
| 59 | rw [lipschitzOnWith_univ] |
| 60 | convert! herror using 1 |
| 61 | funext z |
| 62 | exact add_sub_cancel_left (L z) (u z, 0) |
| 63 | let : FiniteDimensional ℝ (E × ℝ) := L.symm.finiteDimensional |
| 64 | exact ⟨hg.toHomeomorph g (Or.inr hc), hgf, fun z => by |
| 65 | change (L z).2 + 0 = z.2 |
| 66 | rw [add_zero, hLt z]⟩ |
| 67 | |
| 68 | end PoincareMT.M14 |