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.MeanValue |
| 2 | import Mathlib.Analysis.Normed.Operator.BoundedLinearMaps |
| 3 | import Mathlib.Topology.UniformSpace.UniformConvergence |
| 4 | |
| 5 | /-! |
| 6 | # Injectivity of maps with derivative close to the identity |
| 7 | |
| 8 | The mean-value estimate gives a quantitative lower distance bound on |
| 9 | a convex set. Applied to the perturbed exponential composed with the |
| 10 | standard radial inverse, it gives injectivity for the exact-ball |
| 11 | adjustment in Morgan--Tian, Claim 16.6, pp. 371-372. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Topology |
| 18 | |
| 19 | /-- A derivative error bound from the identity gives a lower bound for |
| 20 | the distance between images of any two points in a convex set. -/ |
| 21 | theorem Convex.norm_image_sub_ge_of_norm_fderiv_sub_id_le |
| 22 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 23 | {f : E → E} {U : Set E} (hU : Convex ℝ U) {c : ℝ} |
| 24 | (hf : ∀ x ∈ U, DifferentiableAt ℝ f x) |
| 25 | (hbound : ∀ x ∈ U, ‖fderiv ℝ f x - ContinuousLinearMap.id ℝ E‖ ≤ c) |
| 26 | {x y : E} (hx : x ∈ U) (hy : y ∈ U) : |
| 27 | (1 - c) * ‖y - x‖ ≤ ‖f y - f x‖ := by |
| 28 | have h := hU.norm_image_sub_le_of_norm_fderiv_le' hf hbound hx hy |
| 29 | simp only [ContinuousLinearMap.id_apply] at h |
| 30 | have hn := norm_le_norm_sub_add (y - x) (f y - f x) |
| 31 | rw [norm_sub_rev (y - x) (f y - f x)] at hn |
| 32 | nlinarith |
| 33 | |
| 34 | /-- A differentiable map is injective on a convex set whenever its |
| 35 | derivative differs from the identity by an operator norm less than one. -/ |
| 36 | theorem Convex.injOn_of_norm_fderiv_sub_id_le |
| 37 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 38 | {f : E → E} {U : Set E} (hU : Convex ℝ U) {c : ℝ} (hc : c < 1) |
| 39 | (hf : ∀ x ∈ U, DifferentiableAt ℝ f x) |
| 40 | (hbound : ∀ x ∈ U, ‖fderiv ℝ f x - ContinuousLinearMap.id ℝ E‖ ≤ c) : |
| 41 | InjOn f U := by |
| 42 | intro x hx y hy hxy |
| 43 | have h := hU.norm_image_sub_ge_of_norm_fderiv_sub_id_le hf hbound hx hy |
| 44 | rw [hxy, sub_self, norm_zero] at h |
| 45 | have hn : ‖y - x‖ = 0 := by nlinarith [norm_nonneg (y - x)] |
| 46 | exact (sub_eq_zero.mp (norm_eq_zero.mp hn)).symm |
| 47 | |
| 48 | /-- Uniform convergence of derivatives to the identity implies eventual |
| 49 | injectivity on a convex set. No compactness or completeness is needed. -/ |
| 50 | theorem TendstoUniformlyOn.eventually_injOn_of_fderiv_tendsto_id |
| 51 | {E ι : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 52 | {l : Filter ι} {f : ι → E → E} {U : Set E} (hU : Convex ℝ U) |
| 53 | (hf : ∀ i x, x ∈ U → DifferentiableAt ℝ (f i) x) |
| 54 | (hlim : TendstoUniformlyOn (fun i x => fderiv ℝ (f i) x) |
| 55 | (fun _ => ContinuousLinearMap.id ℝ E) l U) : |
| 56 | ∀ᶠ i in l, InjOn (f i) U := by |
| 57 | have h := Metric.tendstoUniformlyOn_iff.mp hlim (1 / 2) (by norm_num) |
| 58 | filter_upwards [h] with i hi |
| 59 | apply hU.injOn_of_norm_fderiv_sub_id_le (c := 1 / 2) (by norm_num) (hf i) |
| 60 | intro x hx |
| 61 | simpa only [dist_eq_norm, norm_sub_rev] using (hi x hx).le |
| 62 | |
| 63 | /-- Uniform operator convergence to the identity gives eventual |
| 64 | bijectivity at every point of the controlled set. -/ |
| 65 | theorem TendstoUniformlyOn.eventually_bijective_of_tendsto_id |
| 66 | {E P ι : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] |
| 67 | {l : Filter ι} {L : ι → P → E →L[ℝ] E} {U : Set P} |
| 68 | (hlim : TendstoUniformlyOn L (fun _ => ContinuousLinearMap.id ℝ E) l U) : |
| 69 | ∀ᶠ i in l, ∀ x ∈ U, Function.Bijective (L i x) := by |
| 70 | filter_upwards [Metric.tendstoUniformlyOn_iff.mp hlim 1 zero_lt_one] with i hi |
| 71 | intro x hx |
| 72 | have hid : (1 : E →L[ℝ] E) = ContinuousLinearMap.id ℝ E := rfl |
| 73 | have hnorm : ‖(1 : E →L[ℝ] E) - L i x‖ < 1 := by |
| 74 | simpa only [hid, dist_eq_norm] using hi x hx |
| 75 | have hu : IsUnit (L i x) := by |
| 76 | simpa only [sub_sub_cancel] using isUnit_one_sub_of_norm_lt_one hnorm |
| 77 | have heq : ((ContinuousLinearEquiv.ofUnit hu.unit : E ≃L[ℝ] E) : E →L[ℝ] E) = |
| 78 | L i x := hu.unit_spec |
| 79 | exact heq ▸ (show Function.Bijective |
| 80 | (((ContinuousLinearEquiv.ofUnit hu.unit : E ≃L[ℝ] E) : E →L[ℝ] E)) from |
| 81 | (ContinuousLinearEquiv.ofUnit hu.unit).bijective) |