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.Riemannian.Metric.Gradient |
| 2 | import PoincareLib.Geometry.Riemannian.ScalarOperators.Scaling |
| 3 | import Mathlib.Geometry.Manifold.Algebra.Structures |
| 4 | import Mathlib.Topology.Algebra.GroupWithZero |
| 5 | import Mathlib.Topology.Maps.Proper.Basic |
| 6 | import Mathlib.Tactic.Linarith |
| 7 | import Mathlib.Tactic.Positivity |
| 8 | |
| 9 | /-! |
| 10 | # Normalizing the gradient bound of a regular distance slab |
| 11 | |
| 12 | Positive scaling of the defining function preserves the proper regular slab. |
| 13 | The factor `1 / (2 * max r 1)` bounds both its gradient and twice its scaled |
| 14 | radius by one, while retaining the scaled approximation and Hessian bounds. |
| 15 | -/ |
| 16 | |
| 17 | noncomputable section |
| 18 | set_option autoImplicit false |
| 19 | |
| 20 | open Set Topology |
| 21 | open scoped Manifold ContDiff Bundle |
| 22 | |
| 23 | namespace PoincareMT |
| 24 | |
| 25 | private theorem isProperMap_restrictPreimage_const_mul |
| 26 | {X : Type*} [TopologicalSpace X] {f : X → ℝ} {a b c : ℝ} |
| 27 | (hc : 0 < c) (hf : IsProperMap ((Ioo a b).restrictPreimage f)) : |
| 28 | IsProperMap ((Ioo (c * a) (c * b)).restrictPreimage (fun x => c * f x)) := by |
| 29 | let target : Ioo a b ≃ₜ Ioo (c * a) (c * b) := |
| 30 | (Homeomorph.mulLeft₀ c hc.ne').subtype (fun x => by |
| 31 | change x ∈ Ioo a b ↔ c * x ∈ Ioo (c * a) (c * b) |
| 32 | simp only [mem_Ioo, mul_lt_mul_iff_right₀ hc]) |
| 33 | let source : ((fun x => c * f x) ⁻¹' Ioo (c * a) (c * b)) ≃ₜ |
| 34 | (f ⁻¹' Ioo a b) := |
| 35 | (Homeomorph.refl X).subtype (fun x => by |
| 36 | change c * f x ∈ Ioo (c * a) (c * b) ↔ f x ∈ Ioo a b |
| 37 | simp only [mem_Ioo, mul_lt_mul_iff_right₀ hc]) |
| 38 | exact (target.isProperMap.comp hf).comp source.isProperMap |
| 39 | |
| 40 | namespace LeviCivitaData |
| 41 | |
| 42 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 43 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 44 | {g : RiemannianMetric n M} |
| 45 | |
| 46 | private theorem gradient_const_mul (D : LeviCivitaData g) |
| 47 | (c : ℝ) (f : M → ℝ) (x : M) : |
| 48 | D.gradient (fun y => c * f y) x = c • D.gradient f x := by |
| 49 | apply (g.inner_isInvertible x).injective |
| 50 | ext v |
| 51 | rw [D.inner_gradient, mvfderiv_const_mul] |
| 52 | simp only [map_smul, smul_apply, smul_eq_mul, D.inner_gradient] |
| 53 | |
| 54 | private theorem tangentNorm_gradient_const_mul (D : LeviCivitaData g) |
| 55 | {c : ℝ} (hc : 0 ≤ c) (f : M → ℝ) (x : M) : |
| 56 | g.tangentNorm x (D.gradient (fun y => c * f y) x) = |
| 57 | c * g.tangentNorm x (D.gradient f x) := by |
| 58 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 59 | ⟨g.toRiemannianMetric⟩ |
| 60 | rw [gradient_const_mul] |
| 61 | change ‖c • D.gradient f x‖ = c * ‖D.gradient f x‖ |
| 62 | rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg hc] |
| 63 | |
| 64 | /-- A wider distance slab can be normalized to have gradient norm at most one, |
| 65 | without changing the ambient metric or the annulus containing its value band. -/ |
| 66 | theorem normalized_wide_regular_slab (D : LeviCivitaData g) |
| 67 | {f : M → ℝ} (hf : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ f) |
| 68 | {r ε H : ℝ} (hr : 0 < r) (hε : 0 < ε) (hεr : ε < r / 128) (hH : 0 < H) |
| 69 | (p : M) |
| 70 | (hproper : IsProperMap ((Ioo (9 * r / 8) (15 * r / 8)).restrictPreimage f)) |
| 71 | (hband : ∀ x : M, f x ∈ Ioo (9 * r / 8) (15 * r / 8) → |
| 72 | r < (g.edist p x).toReal ∧ (g.edist p x).toReal < 2 * r) |
| 73 | (hbounds : ∀ x : M, r < (g.edist p x).toReal → (g.edist p x).toReal < 2 * r → |
| 74 | |f x - (g.edist p x).toReal| ≤ ε ∧ |
| 75 | (1 : ℝ) / 4 ≤ g.tangentNorm x (D.gradient f x) ∧ |
| 76 | g.tangentNorm x (D.gradient f x) ≤ 2 ∧ |
| 77 | ∀ v : TangentSpace (𝓡 n) x, D.hessian f x v v ≤ H * g.inner x v v) : |
| 78 | let τ := 1 / (2 * max r 1) |
| 79 | let F := fun x => τ * f x |
| 80 | 0 < τ ∧ τ ≤ 1 / 2 ∧ 0 < τ * r ∧ τ * r ≤ 1 / 2 ∧ |
| 81 | 0 < τ * ε ∧ τ * ε < τ * r / 128 ∧ 0 < τ * H ∧ |
| 82 | ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ F ∧ |
| 83 | IsProperMap ((Ioo (τ * (9 * r / 8)) (τ * (15 * r / 8))).restrictPreimage F) ∧ |
| 84 | (∀ x : M, F x ∈ Ioo (τ * (9 * r / 8)) (τ * (15 * r / 8)) → |
| 85 | mfderiv (𝓡 n) 𝓘(ℝ, ℝ) F x ≠ 0) ∧ |
| 86 | (∀ x : M, F x ∈ Ioo (τ * (9 * r / 8)) (τ * (15 * r / 8)) → |
| 87 | r < (g.edist p x).toReal ∧ (g.edist p x).toReal < 2 * r) ∧ |
| 88 | ∀ x : M, r < (g.edist p x).toReal → (g.edist p x).toReal < 2 * r → |
| 89 | |F x - τ * (g.edist p x).toReal| ≤ τ * ε ∧ |
| 90 | τ / 4 ≤ g.tangentNorm x (D.gradient F x) ∧ |
| 91 | g.tangentNorm x (D.gradient F x) ≤ 1 ∧ |
| 92 | ∀ v : TangentSpace (𝓡 n) x, D.hessian F x v v ≤ τ * H * g.inner x v v := by |
| 93 | let τ := 1 / (2 * max r 1) |
| 94 | let F := fun x => τ * f x |
| 95 | have hmax : 0 < max r 1 := zero_lt_one.trans_le (le_max_right r 1) |
| 96 | have hτ : 0 < τ := by dsimp only [τ]; positivity |
| 97 | have hτhalf : τ ≤ 1 / 2 := by |
| 98 | dsimp only [τ] |
| 99 | apply (div_le_iff₀ (mul_pos (by norm_num) hmax)).2 |
| 100 | linarith [le_max_right r 1] |
| 101 | have hτrhalf : τ * r ≤ 1 / 2 := by |
| 102 | have hmul : τ * r ≤ τ * max r 1 := |
| 103 | mul_le_mul_of_nonneg_left (le_max_left r 1) hτ.le |
| 104 | have heq : τ * max r 1 = 1 / 2 := by |
| 105 | dsimp only [τ] |
| 106 | field_simp |
| 107 | exact hmul.trans_eq heq |
| 108 | have hεsmall : τ * ε < τ * r / 128 := by |
| 109 | simpa only [mul_div_assoc] using mul_lt_mul_of_pos_left hεr hτ |
| 110 | have hF : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ F := contMDiff_const.mul hf |
| 111 | have hbandF (x : M) |
| 112 | (hx : F x ∈ Ioo (τ * (9 * r / 8)) (τ * (15 * r / 8))) : |
| 113 | r < (g.edist p x).toReal ∧ (g.edist p x).toReal < 2 * r := by |
| 114 | apply hband x |
| 115 | simpa only [F, mem_Ioo, mul_lt_mul_iff_right₀ hτ] using hx |
| 116 | have hboundsF (x : M) (hx : r < (g.edist p x).toReal) |
| 117 | (hx' : (g.edist p x).toReal < 2 * r) : |
| 118 | |F x - τ * (g.edist p x).toReal| ≤ τ * ε ∧ |
| 119 | τ / 4 ≤ g.tangentNorm x (D.gradient F x) ∧ |
| 120 | g.tangentNorm x (D.gradient F x) ≤ 1 ∧ |
| 121 | ∀ v : TangentSpace (𝓡 n) x, D.hessian F x v v ≤ τ * H * g.inner x v v := by |
| 122 | obtain ⟨hvalue, hlower, hupper, hhessian⟩ := hbounds x hx hx' |
| 123 | have hnorm : g.tangentNorm x (D.gradient F x) = |
| 124 | τ * g.tangentNorm x (D.gradient f x) := |
| 125 | tangentNorm_gradient_const_mul D hτ.le f x |
| 126 | refine ⟨?_, ?_, ?_, ?_⟩ |
| 127 | · change |τ * f x - τ * (g.edist p x).toReal| ≤ τ * ε |
| 128 | rw [← mul_sub, abs_mul, abs_of_pos hτ] |
| 129 | exact mul_le_mul_of_nonneg_left hvalue hτ.le |
| 130 | · rw [hnorm] |
| 131 | simpa only [mul_one_div] using mul_le_mul_of_nonneg_left hlower hτ.le |
| 132 | · rw [hnorm] |
| 133 | exact (mul_le_mul_of_nonneg_left hupper hτ.le).trans (by linarith only [hτhalf]) |
| 134 | · intro v |
| 135 | change D.hessian (fun y => τ * f y) x v v ≤ τ * H * g.inner x v v |
| 136 | rw [D.hessian_const_mul] |
| 137 | simpa only [mul_assoc] using mul_le_mul_of_nonneg_left (hhessian v) hτ.le |
| 138 | refine ⟨hτ, hτhalf, mul_pos hτ hr, hτrhalf, mul_pos hτ hε, hεsmall, |
| 139 | mul_pos hτ hH, hF, isProperMap_restrictPreimage_const_mul hτ hproper, ?_, hbandF, |
| 140 | hboundsF⟩ |
| 141 | intro x hx |
| 142 | apply (g.tangentNorm_gradient_pos_iff F x).mp |
| 143 | have hlower := (hboundsF x (hbandF x hx).1 (hbandF x hx).2).2.1 |
| 144 | exact (div_pos hτ (by norm_num)).trans_le hlower |
| 145 | |
| 146 | end LeviCivitaData |
| 147 | |
| 148 | end PoincareMT |