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.InnerProductSpace.Projection.Minimal |
| 2 | import Mathlib.Analysis.InnerProductSpace.Calculus |
| 3 | import Mathlib.Analysis.Normed.Module.FiniteDimension |
| 4 | import Mathlib.Analysis.Calculus.LocalExtr.Basic |
| 5 | import Mathlib.Topology.MetricSpace.HausdorffDistance |
| 6 | |
| 7 | /-! |
| 8 | # Supporting normals for closed convex carriers |
| 9 | |
| 10 | Nearest points produce unit supporting normals attaining the distance to a |
| 11 | closed convex carrier. Bounding the contact points gives a compact support |
| 12 | parameter even when the carrier is unbounded. The final estimates extract |
| 13 | inwardness from preserved trajectories and bound the reaction at active |
| 14 | supports. These are the fiberwise convex ingredients of Morgan--Tian, |
| 15 | Theorems 4.7--4.8, printed p. 66. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | |
| 20 | open Set Filter |
| 21 | open scoped InnerProductSpace Topology NNReal |
| 22 | |
| 23 | namespace Poincare.Parabolic |
| 24 | |
| 25 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 26 | [FiniteDimensional ℝ E] |
| 27 | |
| 28 | /-- The point in a nonempty closed convex carrier nearest to `v`. -/ |
| 29 | noncomputable def nearestPoint (K : Set E) (hne : K.Nonempty) |
| 30 | (hclosed : IsClosed K) (hconv : Convex ℝ K) (v : E) : E := by |
| 31 | letI : CompleteSpace E := FiniteDimensional.complete ℝ E |
| 32 | exact Classical.choose (exists_norm_eq_iInf_of_complete_convex |
| 33 | hne hclosed.isComplete hconv v) |
| 34 | |
| 35 | lemma nearestPoint_mem (K : Set E) (hne : K.Nonempty) |
| 36 | (hclosed : IsClosed K) (hconv : Convex ℝ K) (v : E) : |
| 37 | nearestPoint K hne hclosed hconv v ∈ K := by |
| 38 | let : CompleteSpace E := FiniteDimensional.complete ℝ E |
| 39 | exact (Classical.choose_spec (exists_norm_eq_iInf_of_complete_convex |
| 40 | hne hclosed.isComplete hconv v)).1 |
| 41 | |
| 42 | lemma norm_sub_nearestPoint (K : Set E) (hne : K.Nonempty) |
| 43 | (hclosed : IsClosed K) (hconv : Convex ℝ K) (v : E) : |
| 44 | ‖v - nearestPoint K hne hclosed hconv v‖ = Metric.infDist v K := by |
| 45 | let : CompleteSpace E := FiniteDimensional.complete ℝ E |
| 46 | rw [Metric.infDist_eq_iInf] |
| 47 | simpa only [nearestPoint, dist_eq_norm] using |
| 48 | (Classical.choose_spec (exists_norm_eq_iInf_of_complete_convex |
| 49 | hne hclosed.isComplete hconv v)).2 |
| 50 | |
| 51 | lemma nearestPoint_support (K : Set E) (hne : K.Nonempty) |
| 52 | (hclosed : IsClosed K) (hconv : Convex ℝ K) (v z : E) (hz : z ∈ K) : |
| 53 | ⟪v - nearestPoint K hne hclosed hconv v, |
| 54 | z - nearestPoint K hne hclosed hconv v⟫_ℝ ≤ 0 := by |
| 55 | apply (norm_eq_iInf_iff_real_inner_le_zero hconv |
| 56 | (nearestPoint_mem K hne hclosed hconv v)).mp ?_ z hz |
| 57 | simpa only [Metric.infDist_eq_iInf, dist_eq_norm] using |
| 58 | norm_sub_nearestPoint K hne hclosed hconv v |
| 59 | |
| 60 | /-- A contact point and unit outward supporting normal. -/ |
| 61 | def unitSupportSet (K : Set E) : Set (E × E) := |
| 62 | {q | q.1 ∈ K ∧ ‖q.2‖ = 1 ∧ ∀ z ∈ K, ⟪q.2, z - q.1⟫_ℝ ≤ 0} |
| 63 | |
| 64 | /-- Bound the contact points without truncating the original carrier. -/ |
| 65 | def boundedUnitSupportSet (K : Set E) (R : ℝ) : Set (E × E) := |
| 66 | unitSupportSet K ∩ {q | ‖q.1‖ ≤ R} |
| 67 | |
| 68 | omit [FiniteDimensional ℝ E] in |
| 69 | lemma isClosed_unitSupportSet (K : Set E) (hK : IsClosed K) : |
| 70 | IsClosed (unitSupportSet K) := by |
| 71 | have hsupport : IsClosed {q : E × E | ∀ z ∈ K, ⟪q.2, z - q.1⟫_ℝ ≤ 0} := by |
| 72 | simp only [ofPred_forall] |
| 73 | exact isClosed_iInter fun z => isClosed_iInter fun _ => |
| 74 | isClosed_le (continuous_snd.inner (continuous_const.sub continuous_fst)) continuous_const |
| 75 | exact (hK.preimage continuous_fst).inter |
| 76 | ((isClosed_eq (continuous_norm.comp continuous_snd) continuous_const).inter hsupport) |
| 77 | |
| 78 | lemma isCompact_boundedUnitSupportSet (K : Set E) (R : ℝ) (hK : IsClosed K) : |
| 79 | IsCompact (boundedUnitSupportSet K R) := by |
| 80 | have hc : IsClosed (boundedUnitSupportSet K R) := |
| 81 | (isClosed_unitSupportSet K hK).inter |
| 82 | (isClosed_le (continuous_norm.comp continuous_fst) continuous_const) |
| 83 | apply ((isCompact_closedBall (0 : E) R).prod |
| 84 | (isCompact_closedBall (0 : E) 1)).of_isClosed_subset hc |
| 85 | intro q hq |
| 86 | exact ⟨by simpa only [Metric.mem_closedBall, dist_zero_right, mem_ofPred_eq] using hq.2, |
| 87 | by simp only [Metric.mem_closedBall, dist_zero_right, hq.1.2.1, le_refl]⟩ |
| 88 | |
| 89 | lemma unitSupport_eval_le_infDist {K : Set E} (hne : K.Nonempty) |
| 90 | (hclosed : IsClosed K) (hconv : Convex ℝ K) {q : E × E} |
| 91 | (hq : q ∈ unitSupportSet K) (v : E) : |
| 92 | ⟪q.2, v - q.1⟫_ℝ ≤ Metric.infDist v K := by |
| 93 | let p := nearestPoint K hne hclosed hconv v |
| 94 | have hs := hq.2.2 p (nearestPoint_mem K hne hclosed hconv v) |
| 95 | have hn : ⟪q.2, v - p⟫_ℝ ≤ ‖v - p‖ := by |
| 96 | simpa only [hq.2.1, one_mul] using real_inner_le_norm q.2 (v - p) |
| 97 | calc |
| 98 | ⟪q.2, v - q.1⟫_ℝ = ⟪q.2, v - p⟫_ℝ + ⟪q.2, p - q.1⟫_ℝ := by |
| 99 | rw [← inner_add_right] |
| 100 | congr 1 |
| 101 | abel |
| 102 | _ ≤ ‖v - p‖ := by linarith |
| 103 | _ = Metric.infDist v K := norm_sub_nearestPoint K hne hclosed hconv v |
| 104 | |
| 105 | lemma norm_nearestPoint_le {K : Set E} (hne : K.Nonempty) |
| 106 | (hclosed : IsClosed K) (hconv : Convex ℝ K) {z₀ v : E} |
| 107 | (hz₀ : z₀ ∈ K) {B : ℝ} (hv : ‖v‖ ≤ B) : |
| 108 | ‖nearestPoint K hne hclosed hconv v‖ ≤ 2 * B + ‖z₀‖ := by |
| 109 | let p := nearestPoint K hne hclosed hconv v |
| 110 | have hnear : ‖v - p‖ ≤ ‖v - z₀‖ := by |
| 111 | rw [norm_sub_nearestPoint] |
| 112 | simpa only [dist_eq_norm] using Metric.infDist_le_dist_of_mem (x := v) hz₀ |
| 113 | have hp : ‖p‖ ≤ ‖v‖ + ‖v - p‖ := by |
| 114 | simpa only [sub_sub_cancel] using norm_sub_le v (v - p) |
| 115 | have hz := norm_sub_le v z₀ |
| 116 | linarith |
| 117 | |
| 118 | /-- Every bounded exterior point has an active support in one fixed compact set. -/ |
| 119 | theorem exists_boundedUnitSupport_active {K : Set E} (hne : K.Nonempty) |
| 120 | (hclosed : IsClosed K) (hconv : Convex ℝ K) {z₀ v : E} |
| 121 | (hz₀ : z₀ ∈ K) {B : ℝ} (hvB : ‖v‖ ≤ B) (hv : v ∉ K) : |
| 122 | ∃ q ∈ boundedUnitSupportSet K (2 * B + ‖z₀‖), |
| 123 | ⟪q.2, v - q.1⟫_ℝ = Metric.infDist v K := by |
| 124 | let p := nearestPoint K hne hclosed hconv v |
| 125 | let r := ‖v - p‖ |
| 126 | have hr : 0 < r := by |
| 127 | rw [show r = Metric.infDist v K from norm_sub_nearestPoint K hne hclosed hconv v] |
| 128 | exact (hclosed.notMem_iff_infDist_pos hne).mp hv |
| 129 | refine ⟨(p, r⁻¹ • (v - p)), ⟨⟨nearestPoint_mem K hne hclosed hconv v, ?_, ?_⟩, |
| 130 | norm_nearestPoint_le hne hclosed hconv hz₀ hvB⟩, ?_⟩ |
| 131 | · change ‖r⁻¹ • (v - p)‖ = 1 |
| 132 | rw [norm_smul, Real.norm_eq_abs, abs_of_pos (inv_pos.mpr hr)] |
| 133 | exact inv_mul_cancel₀ hr.ne' |
| 134 | · intro z hz |
| 135 | change ⟪r⁻¹ • (v - p), z - p⟫_ℝ ≤ 0 |
| 136 | rw [real_inner_smul_left] |
| 137 | exact mul_nonpos_of_nonneg_of_nonpos (inv_nonneg.mpr hr.le) |
| 138 | (nearestPoint_support K hne hclosed hconv v z hz) |
| 139 | · change ⟪r⁻¹ • (v - p), v - p⟫_ℝ = Metric.infDist v K |
| 140 | rw [real_inner_smul_left, real_inner_self_eq_norm_sq] |
| 141 | change r⁻¹ * r ^ 2 = Metric.infDist v K |
| 142 | calc |
| 143 | r⁻¹ * r ^ 2 = r := by field_simp |
| 144 | _ = Metric.infDist v K := norm_sub_nearestPoint K hne hclosed hconv v |
| 145 | |
| 146 | /-- An active unit normal supports the carrier also at the nearest point. -/ |
| 147 | lemma unitSupport_at_nearestPoint_of_active {K : Set E} (hne : K.Nonempty) |
| 148 | (hclosed : IsClosed K) (hconv : Convex ℝ K) {q : E × E} |
| 149 | (hq : q ∈ unitSupportSet K) {v : E} |
| 150 | (hactive : ⟪q.2, v - q.1⟫_ℝ = Metric.infDist v K) : |
| 151 | (nearestPoint K hne hclosed hconv v, q.2) ∈ unitSupportSet K := by |
| 152 | let p := nearestPoint K hne hclosed hconv v |
| 153 | have hp := nearestPoint_mem K hne hclosed hconv v |
| 154 | have hs := hq.2.2 p hp |
| 155 | have hn : ⟪q.2, v - p⟫_ℝ ≤ Metric.infDist v K := by |
| 156 | rw [← norm_sub_nearestPoint K hne hclosed hconv v] |
| 157 | simpa only [hq.2.1, one_mul] using real_inner_le_norm q.2 (v - p) |
| 158 | have heq : ⟪q.2, v - q.1⟫_ℝ = ⟪q.2, v - p⟫_ℝ + ⟪q.2, p - q.1⟫_ℝ := by |
| 159 | rw [← inner_add_right] |
| 160 | congr 1 |
| 161 | abel |
| 162 | have hzero : ⟪q.2, p - q.1⟫_ℝ = 0 := by linarith |
| 163 | refine ⟨hp, hq.2.1, ?_⟩ |
| 164 | intro z hz |
| 165 | have h := hq.2.2 z hz |
| 166 | have heq' : ⟪q.2, z - p⟫_ℝ = ⟪q.2, z - q.1⟫_ℝ - ⟪q.2, p - q.1⟫_ℝ := by |
| 167 | rw [← inner_sub_right] |
| 168 | congr 1 |
| 169 | abel |
| 170 | linarith |
| 171 | |
| 172 | omit [FiniteDimensional ℝ E] in |
| 173 | /-- A trajectory lying in the carrier has inward initial velocity at every support. -/ |
| 174 | theorem support_inner_velocity_nonpos {K : Set E} {p n w : E} |
| 175 | (hsupport : ∀ z ∈ K, ⟪n, z - p⟫_ℝ ≤ 0) |
| 176 | {γ : ℝ → E} {a ε : ℝ} (hε : 0 < ε) (hγa : γ a = p) |
| 177 | (hγ : ∀ t ∈ Icc a (a + ε), γ t ∈ K) |
| 178 | (hd : HasDerivWithinAt γ w (Icc a (a + ε)) a) : ⟪n, w⟫_ℝ ≤ 0 := by |
| 179 | have hmax : IsMaxOn (fun t => ⟪n, γ t - p⟫_ℝ) (Icc a (a + ε)) a := by |
| 180 | intro t ht |
| 181 | change ⟪n, γ t - p⟫_ℝ ≤ ⟪n, γ a - p⟫_ℝ |
| 182 | simpa only [hγa, sub_self, inner_zero_right] using hsupport (γ t) (hγ t ht) |
| 183 | have hscalar : HasDerivWithinAt (fun t => ⟪n, γ t - p⟫_ℝ) |
| 184 | ⟪n, w⟫_ℝ (Icc a (a + ε)) a := by |
| 185 | simpa using (hasDerivWithinAt_const a (Icc a (a + ε)) n).inner ℝ (hd.sub_const p) |
| 186 | have hcone : (a + ε) - a ∈ posTangentConeAt (Icc a (a + ε)) a := |
| 187 | sub_mem_posTangentConeAt_of_segment_subset |
| 188 | ((convex_Icc a (a + ε)).segment_subset ⟨le_rfl, by linarith⟩ |
| 189 | ⟨by linarith, le_rfl⟩) |
| 190 | have h := hmax.localize.hasFDerivWithinAt_nonpos hscalar.hasFDerivWithinAt hcone |
| 191 | change ((a + ε) - a) * ⟪n, w⟫_ℝ ≤ 0 at h |
| 192 | nlinarith |
| 193 | |
| 194 | /-- The reaction at an active support is bounded by Lipschitz constant times |
| 195 | distance, using inwardness at the nearest point. -/ |
| 196 | theorem reaction_inner_le_mul_infDist {K S : Set E} (hne : K.Nonempty) |
| 197 | (hclosed : IsClosed K) (hconv : Convex ℝ K) {q : E × E} |
| 198 | (hq : q ∈ unitSupportSet K) {v : E} |
| 199 | (hactive : ⟪q.2, v - q.1⟫_ℝ = Metric.infDist v K) |
| 200 | {ψ : E → E} {C : ℝ≥0} (hψ : LipschitzOnWith C ψ S) |
| 201 | (hv : v ∈ S) (hp : nearestPoint K hne hclosed hconv v ∈ S) |
| 202 | (hinward : ∀ r ∈ unitSupportSet K, ⟪r.2, ψ r.1⟫_ℝ ≤ 0) : |
| 203 | ⟪q.2, ψ v⟫_ℝ ≤ C * Metric.infDist v K := by |
| 204 | let p := nearestPoint K hne hclosed hconv v |
| 205 | have hi := hinward (p, q.2) |
| 206 | (unitSupport_at_nearestPoint_of_active hne hclosed hconv hq hactive) |
| 207 | have hnorm : ⟪q.2, ψ v - ψ p⟫_ℝ ≤ ‖ψ v - ψ p‖ := by |
| 208 | simpa only [hq.2.1, one_mul] using real_inner_le_norm q.2 (ψ v - ψ p) |
| 209 | have hlip : ‖ψ v - ψ p‖ ≤ C * Metric.infDist v K := by |
| 210 | simpa only [dist_eq_norm, p, norm_sub_nearestPoint K hne hclosed hconv v] using |
| 211 | hψ.dist_le_mul v hv p hp |
| 212 | rw [inner_sub_right] at hnorm |
| 213 | change ⟪q.2, ψ p⟫_ℝ ≤ 0 at hi |
| 214 | linarith |
| 215 | |
| 216 | end Poincare.Parabolic |