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.Analysis.Elliptic.Regularity.EnergyEstimate.Coefficients |
| 2 | import Mathlib.LinearAlgebra.Matrix.PosDef |
| 3 | import Mathlib.Topology.Order.Compact |
| 4 | |
| 5 | /-! |
| 6 | # Localization of smooth elliptic coefficients |
| 7 | |
| 8 | Pointwise positivity becomes uniform on compact sets by minimizing the |
| 9 | quadratic form on the product with the unit sphere. Smooth cutoffs then extend |
| 10 | the coefficients to the whole Euclidean space. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | |
| 15 | open Set Metric Filter Topology |
| 16 | open scoped ContDiff BigOperators InnerProductSpace |
| 17 | |
| 18 | namespace Poincare.Analysis.Elliptic |
| 19 | |
| 20 | variable {n : ℕ} |
| 21 | |
| 22 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 23 | |
| 24 | open Poincare.Analysis.Sobolev.Weak (matMulE matMulE_ofLp) |
| 25 | open Poincare.Analysis.Sobolev.NirenbergEuclidean |
| 26 | |
| 27 | theorem inner_matMulE_eq_sum (A : Matrix (Fin n) (Fin n) ℝ) (v : E) : |
| 28 | ⟪v, matMulE A v⟫_ℝ = ∑ i, ∑ j, A i j * v i * v j := by |
| 29 | simp only [EuclideanSpace.inner_eq_star_dotProduct, matMulE_ofLp, |
| 30 | dotProduct, Matrix.mulVec, Pi.star_apply, star_trivial, Finset.sum_mul] |
| 31 | apply Finset.sum_congr rfl |
| 32 | intro i _ |
| 33 | apply Finset.sum_congr rfl |
| 34 | intro j _ |
| 35 | ring |
| 36 | |
| 37 | theorem matrix_energy_smul (A : Matrix (Fin n) (Fin n) ℝ) (v : E) (r : ℝ) : |
| 38 | ⟪r • v, matMulE A (r • v)⟫_ℝ = r ^ 2 * ⟪v, matMulE A v⟫_ℝ := by |
| 39 | simp only [inner_matMulE_eq_sum, PiLp.smul_apply, smul_eq_mul, |
| 40 | Finset.mul_sum] |
| 41 | apply Finset.sum_congr rfl |
| 42 | intro i _ |
| 43 | apply Finset.sum_congr rfl |
| 44 | intro j _ |
| 45 | ring |
| 46 | |
| 47 | /-- Continuous positive definite matrices have a common positive lower bound |
| 48 | on every compact set. -/ |
| 49 | theorem exists_uniform_matrix_lower_bound |
| 50 | {A : E → Matrix (Fin n) (Fin n) ℝ} {K : Set E} (hK : IsCompact K) |
| 51 | (hA : ∀ i j, ContinuousOn (fun x => A x i j) K) |
| 52 | (hpos : ∀ x ∈ K, (A x).PosDef) : |
| 53 | ∃ c : ℝ, 0 < c ∧ ∀ x ∈ K, ∀ v : E, |
| 54 | c * ‖v‖ ^ 2 ≤ ⟪v, matMulE (A x) v⟫_ℝ := by |
| 55 | have hcompact := hK.prod (isCompact_sphere (0 : E) 1) |
| 56 | have henergy : ContinuousOn (fun z : E × E => ⟪z.2, matMulE (A z.1) z.2⟫_ℝ) |
| 57 | (K ×ˢ Metric.sphere 0 1) := by |
| 58 | simp only [inner_matMulE_eq_sum] |
| 59 | apply continuousOn_finsetSum |
| 60 | intro i _ |
| 61 | apply continuousOn_finsetSum |
| 62 | intro j _ |
| 63 | exact (((hA i j).comp continuousOn_fst (fun z hz => hz.1)).mul |
| 64 | ((PiLp.continuous_apply 2 _ i).comp continuous_snd).continuousOn).mul |
| 65 | ((PiLp.continuous_apply 2 _ j).comp continuous_snd).continuousOn |
| 66 | obtain ⟨c, hc, hbound⟩ := hcompact.exists_forall_le' henergy (fun z hz => by |
| 67 | have hv : z.2.ofLp ≠ 0 := by |
| 68 | intro hv |
| 69 | have hz0 : z.2 = 0 := by ext i; exact congr_fun hv i |
| 70 | have hn : ‖z.2‖ = 1 := by simpa [Metric.mem_sphere] using hz.2 |
| 71 | simp [hz0] at hn |
| 72 | have hp := (hpos z.1 hz.1).dotProduct_mulVec_pos hv |
| 73 | simpa only [EuclideanSpace.inner_eq_star_dotProduct, matMulE_ofLp, |
| 74 | dotProduct_comm] using hp) |
| 75 | refine ⟨c, hc, fun x hx v => ?_⟩ |
| 76 | by_cases hv : v = 0 |
| 77 | · simp [hv, matMulE] |
| 78 | have hnorm : ‖(‖v‖⁻¹ : ℝ) • v‖ = 1 := norm_smul_inv_norm hv |
| 79 | have h := hbound (x, (‖v‖⁻¹ : ℝ) • v) |
| 80 | ⟨hx, by simpa [Metric.mem_sphere] using hnorm⟩ |
| 81 | calc |
| 82 | c * ‖v‖ ^ 2 ≤ |
| 83 | ⟪(‖v‖⁻¹ : ℝ) • v, matMulE (A x) ((‖v‖⁻¹ : ℝ) • v)⟫_ℝ * ‖v‖ ^ 2 := |
| 84 | mul_le_mul_of_nonneg_right h (sq_nonneg ‖v‖) |
| 85 | _ = ⟪v, matMulE (A x) v⟫_ℝ := by |
| 86 | rw [matrix_energy_smul] |
| 87 | field_simp [norm_ne_zero_iff.mpr hv] |
| 88 | |
| 89 | theorem contDiff_cutoff_mul {O : Set E} (hO : IsOpen O) {η f : E → ℝ} |
| 90 | (hη : ContDiff ℝ ∞ η) (hf : ContDiffOn ℝ ∞ f O) |
| 91 | (hsupp : tsupport η ⊆ O) : ContDiff ℝ ∞ (fun x => η x * f x) := by |
| 92 | rw [contDiff_iff_contDiffAt] |
| 93 | intro x |
| 94 | by_cases hx : x ∈ tsupport η |
| 95 | · exact hη.contDiffAt.mul (hf.contDiffAt (hO.mem_nhds (hsupp hx))) |
| 96 | · apply contDiffAt_const.congr_of_eventuallyEq (f := fun _ : E => (0 : ℝ)) |
| 97 | filter_upwards [notMem_tsupport_iff_eventuallyEq.mp hx] with y hy |
| 98 | simp [hy] |
| 99 | |
| 100 | theorem matrix_energy_add (A B : Matrix (Fin n) (Fin n) ℝ) (v : E) : |
| 101 | ⟪v, matMulE (A + B) v⟫_ℝ = ⟪v, matMulE A v⟫_ℝ + ⟪v, matMulE B v⟫_ℝ := by |
| 102 | simp [inner_matMulE_eq_sum, Matrix.add_apply, add_mul, Finset.sum_add_distrib] |
| 103 | |
| 104 | theorem matrix_energy_smul_left (A : Matrix (Fin n) (Fin n) ℝ) (v : E) (r : ℝ) : |
| 105 | ⟪v, matMulE (r • A) v⟫_ℝ = r * ⟪v, matMulE A v⟫_ℝ := by |
| 106 | simp [inner_matMulE_eq_sum, Matrix.smul_apply, smul_eq_mul, Finset.mul_sum, mul_assoc] |
| 107 | |
| 108 | theorem matrix_energy_one (v : E) : |
| 109 | ⟪v, matMulE (1 : Matrix (Fin n) (Fin n) ℝ) v⟫_ℝ = ‖v‖ ^ 2 := by |
| 110 | simp [matMulE] |
| 111 | |
| 112 | /-- Local smooth positive definite coefficients extend, near every compact |
| 113 | subset, to globally smooth uniformly elliptic coefficients. -/ |
| 114 | theorem exists_global_elliptic_extension [NeZero n] |
| 115 | {O K : Set E} (hO : IsOpen O) (hK : IsCompact K) (hKO : K ⊆ O) |
| 116 | (A : E → Matrix (Fin n) (Fin n) ℝ) (c : E → ℝ) |
| 117 | (hA : ∀ i j, ContDiffOn ℝ ∞ (fun x => A x i j) O) |
| 118 | (hpos : ∀ x ∈ O, (A x).PosDef) (hc : ContDiffOn ℝ ∞ c O) : |
| 119 | ∃ V : Set E, IsOpen V ∧ K ⊆ V ∧ IsCompact (closure V) ∧ closure V ⊆ O ∧ |
| 120 | ∃ B : SmoothEllipticBilinearForm n univ, EqOn B.a A V ∧ EqOn B.c c V := by |
| 121 | classical |
| 122 | obtain ⟨δ, hδ, hδO⟩ := hK.exists_cthickening_subset_open hO hKO |
| 123 | let V := Metric.thickening δ K |
| 124 | have hcl : closure V ⊆ Metric.cthickening δ K := |
| 125 | Metric.closure_thickening_subset_cthickening δ K |
| 126 | have hVcompact : IsCompact (closure V) := hK.cthickening.of_isClosed_subset |
| 127 | isClosed_closure hcl |
| 128 | obtain ⟨η, hη, hηcompact, hηrange, hηone, hηsupp⟩ := |
| 129 | SmoothEllipticBilinearForm.exists_cutoff hVcompact hO (hcl.trans hδO) |
| 130 | obtain ⟨lam, hlam, hlambound⟩ := exists_uniform_matrix_lower_bound hηcompact |
| 131 | (fun i j => (hA i j).continuousOn.mono hηsupp) (fun x hx => hpos x (hηsupp hx)) |
| 132 | let a : E → Matrix (Fin n) (Fin n) ℝ := fun x => |
| 133 | η x • A x + (1 - η x) • (1 : Matrix (Fin n) (Fin n) ℝ) |
| 134 | have hasymm : ∀ x i j, a x i j = a x j i := by |
| 135 | intro x i j |
| 136 | by_cases hx : x ∈ tsupport η |
| 137 | · have hs : A x i j = A x j i := by |
| 138 | simpa using ((hpos x (hηsupp hx)).isHermitian.apply j i) |
| 139 | simp only [a, Matrix.add_apply, Matrix.smul_apply, smul_eq_mul, hs] |
| 140 | congr 2 |
| 141 | simp [Matrix.one_apply, eq_comm] |
| 142 | · simp [a, image_eq_zero_of_notMem_tsupport hx, Matrix.one_apply, eq_comm] |
| 143 | have hasmooth : ∀ i j, ContDiff ℝ ∞ (fun x => a x i j) := by |
| 144 | intro i j |
| 145 | exact (contDiff_cutoff_mul hO hη (hA i j) hηsupp).add |
| 146 | ((contDiff_const.sub hη).mul contDiff_const) |
| 147 | have hcoercive : ∀ x : E, ∀ v : E, |
| 148 | min lam 1 * ‖v‖ ^ 2 ≤ ⟪v, matMulE (a x) v⟫_ℝ := by |
| 149 | intro x v |
| 150 | have hη0 : 0 ≤ η x := (hηrange (mem_range_self x)).1 |
| 151 | have hη1 : η x ≤ 1 := (hηrange (mem_range_self x)).2 |
| 152 | by_cases hx : x ∈ tsupport η |
| 153 | · have hb := mul_le_mul_of_nonneg_left (hlambound x hx v) hη0 |
| 154 | have hminlam := mul_le_mul_of_nonneg_right (min_le_left lam 1) (sq_nonneg ‖v‖) |
| 155 | have hmin1 := mul_le_mul_of_nonneg_right (min_le_right lam 1) (sq_nonneg ‖v‖) |
| 156 | have hleft := mul_le_mul_of_nonneg_left hminlam hη0 |
| 157 | have hright := mul_le_mul_of_nonneg_left hmin1 (sub_nonneg.mpr hη1) |
| 158 | simp only [a, matrix_energy_add, matrix_energy_smul_left, matrix_energy_one] |
| 159 | nlinarith |
| 160 | · simp only [a, image_eq_zero_of_notMem_tsupport hx, zero_smul, sub_zero, |
| 161 | one_smul, zero_add, matrix_energy_one] |
| 162 | exact (mul_le_mul_of_nonneg_right (min_le_right lam 1) (sq_nonneg ‖v‖)).trans_eq |
| 163 | (one_mul _) |
| 164 | let B : SmoothEllipticBilinearForm n univ := |
| 165 | { a := a |
| 166 | c := fun x => η x * c x |
| 167 | symm := hasymm |
| 168 | smooth_a := hasmooth |
| 169 | smooth_c := contDiff_cutoff_mul hO hη hc hηsupp |
| 170 | lam := min lam 1 |
| 171 | capLam := min lam 1 |
| 172 | hlam_pos := lt_min hlam zero_lt_one |
| 173 | hlam_le_capLam := le_rfl |
| 174 | coercive := fun x _ v => hcoercive x v } |
| 175 | refine ⟨V, Metric.isOpen_thickening, Metric.self_subset_thickening hδ K, |
| 176 | hVcompact, hcl.trans hδO, B, ?_, ?_⟩ |
| 177 | · intro x hx |
| 178 | change a x = A x |
| 179 | simp [a, hηone x (subset_closure hx)] |
| 180 | · intro x hx |
| 181 | change η x * c x = c x |
| 182 | simp [hηone x (subset_closure hx)] |
| 183 | |
| 184 | end Poincare.Analysis.Elliptic |