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.RicciFlow.Pinching.Region |
| 2 | import Mathlib.Analysis.InnerProductSpace.Spectrum |
| 3 | import Mathlib.LinearAlgebra.Charpoly.ToMatrix |
| 4 | import Mathlib.LinearAlgebra.Trace |
| 5 | |
| 6 | /-! Carrier properties for the Hamilton--Ivey region. -/ |
| 7 | |
| 8 | namespace Poincare.HamiltonIvey |
| 9 | |
| 10 | open Set |
| 11 | |
| 12 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 13 | [FiniteDimensional ℝ E] |
| 14 | |
| 15 | theorem mem_region_iff_rayleigh (hn : Module.finrank ℝ E = 3) |
| 16 | {t : ℝ} (ht : 0 ≤ t) (A : E →ₗ[ℝ] E) : |
| 17 | A ∈ region hn t ↔ A.IsSymmetric ∧ |
| 18 | ∀ v : E, ‖v‖ = 1 → |
| 19 | (LinearMap.trace ℝ E A, max (-inner ℝ v (A v)) 0) ∈ scalarRegion t := by |
| 20 | constructor |
| 21 | · rintro ⟨hA, hmem⟩ |
| 22 | refine ⟨hA, fun v hv => scalarRegion_downward ht hmem ?_⟩ |
| 23 | exact max_le_max (neg_le_neg (rayleigh_ge_least hA hn hv)) le_rfl |
| 24 | · rintro ⟨hA, hmem⟩ |
| 25 | refine ⟨hA, ?_⟩ |
| 26 | have h := hmem (hA.eigenvectorBasis hn 2) ((hA.eigenvectorBasis hn).orthonormal.1 2) |
| 27 | simpa [hA.apply_eigenvectorBasis hn, inner_smul_right, |
| 28 | (hA.eigenvectorBasis hn).orthonormal.1 2] using h |
| 29 | |
| 30 | theorem region_zero_mem (hn : Module.finrank ℝ E = 3) {t : ℝ} (ht : 0 ≤ t) : |
| 31 | (0 : E →ₗ[ℝ] E) ∈ region hn t := by |
| 32 | refine ⟨LinearMap.IsSymmetric.zero, ?_⟩ |
| 33 | let hzero : (0 : E →ₗ[ℝ] E).IsSymmetric := LinearMap.IsSymmetric.zero |
| 34 | have heig : hzero.eigenvalues hn 2 = 0 := by |
| 35 | have hev := hzero.hasEigenvalue_eigenvalues hn 2 |
| 36 | rw [Module.End.hasEigenvalue_iff] at hev |
| 37 | obtain ⟨v, hv, hv0⟩ := Submodule.exists_mem_ne_zero_of_ne_bot hev |
| 38 | rw [Module.End.eigenspace_def, LinearMap.mem_ker] at hv |
| 39 | have hv' : hzero.eigenvalues hn 2 = 0 ∨ v = 0 := by |
| 40 | simpa [hzero] using hv |
| 41 | exact hv'.resolve_right hv0 |
| 42 | change ((LinearMap.trace ℝ E) 0, max (-hzero.eigenvalues hn 2) 0) ∈ scalarRegion t |
| 43 | rw [show (LinearMap.trace ℝ E) 0 = 0 by simp, heig] |
| 44 | rw [mem_scalarRegion_iff ht] |
| 45 | rw [show max (-0 : ℝ) 0 = 0 by norm_num] |
| 46 | rw [clippedBarrier, max_eq_left (cutoff_pos ht).le, |
| 47 | logBarrier_cutoff ht] |
| 48 | exact div_nonpos_of_nonpos_of_nonneg (by norm_num) (by linarith) |
| 49 | |
| 50 | theorem region_nonempty (hn : Module.finrank ℝ E = 3) {t : ℝ} (ht : 0 ≤ t) : |
| 51 | (region hn t).Nonempty := ⟨0, region_zero_mem hn ht⟩ |
| 52 | |
| 53 | theorem clippedBarrier_scale {t X : ℝ} (ht : 0 ≤ t) : |
| 54 | clippedBarrier 0 ((1 + t) * X) = (1 + t) * clippedBarrier t X := by |
| 55 | have hc : 0 < 1 + t := by linarith |
| 56 | have hcut : cutoff 0 = (1 + t) * cutoff t := by |
| 57 | simp [cutoff] |
| 58 | field_simp |
| 59 | rw [clippedBarrier, clippedBarrier, hcut] |
| 60 | have hmax : max ((1 + t) * cutoff t) ((1 + t) * X) = |
| 61 | (1 + t) * max (cutoff t) X := by |
| 62 | apply le_antisymm |
| 63 | · apply max_le |
| 64 | · exact mul_le_mul_of_nonneg_left (le_max_left _ _) (le_of_lt hc) |
| 65 | · exact mul_le_mul_of_nonneg_left (le_max_right _ _) (le_of_lt hc) |
| 66 | · rcases le_total (cutoff t) X with h | h |
| 67 | · rw [max_eq_right h] |
| 68 | exact le_max_right _ _ |
| 69 | · rw [max_eq_left h] |
| 70 | exact le_max_left _ _ |
| 71 | rw [hmax] |
| 72 | have hpos : 0 < max (cutoff t) X := (cutoff_pos ht).trans_le (le_max_left _ _) |
| 73 | have hscaled : logBarrier 0 ((1 + t) * max (cutoff t) X) = |
| 74 | (1 + t) * logBarrier t (max (cutoff t) X) := by |
| 75 | have h := logBarrier_div ht |
| 76 | (show 0 < (1 + t) * max (cutoff t) X by positivity) |
| 77 | (x := (1 + t) * max (cutoff t) X) |
| 78 | field_simp at h ⊢ |
| 79 | simpa [mul_assoc, mul_left_comm, mul_comm] using h.symm |
| 80 | rw [hscaled] |
| 81 | |
| 82 | theorem scalarRegion_scale_iff {t S X : ℝ} (ht : 0 ≤ t) : |
| 83 | (S, X) ∈ scalarRegion t ↔ |
| 84 | ((1 + t) * S, (1 + t) * X) ∈ scalarRegion 0 := by |
| 85 | rw [mem_scalarRegion_iff ht, mem_scalarRegion_iff (by norm_num)] |
| 86 | rw [clippedBarrier_scale ht] |
| 87 | constructor <;> intro h <;> nlinarith [show 0 < 1 + t by linarith] |
| 88 | |
| 89 | theorem continuousOn_clippedBarrier : |
| 90 | ContinuousOn (fun p : ℝ × ℝ => clippedBarrier p.1 p.2) |
| 91 | {p | 0 ≤ p.1} := by |
| 92 | have hden : ∀ p : ℝ × ℝ, p ∈ {p | 0 ≤ p.1} → 1 + p.1 ≠ 0 := by |
| 93 | intro p hp |
| 94 | dsimp at hp |
| 95 | linarith |
| 96 | have hcut : ContinuousOn (fun p : ℝ × ℝ => cutoff p.1) {p | 0 ≤ p.1} := |
| 97 | continuousOn_const.div (continuousOn_const.add continuousOn_fst) hden |
| 98 | have hmax : ContinuousOn (fun p : ℝ × ℝ => max (cutoff p.1) p.2) {p | 0 ≤ p.1} := |
| 99 | fun p hp => (hcut p hp).max (continuousOn_snd p hp) |
| 100 | have hlog := (continuousOn_const.add continuousOn_fst).log hden |
| 101 | convert (Real.continuous_mul_log.comp_continuousOn hmax).add |
| 102 | (hmax.mul (hlog.sub (continuousOn_const (c := (3 : ℝ))))) using 1 |
| 103 | ext p |
| 104 | dsimp [clippedBarrier, logBarrier] |
| 105 | ring |
| 106 | |
| 107 | theorem continuous_clippedBarrier {t : ℝ} (ht : 0 ≤ t) : |
| 108 | Continuous (clippedBarrier t) := by |
| 109 | exact continuousOn_clippedBarrier.comp_continuous |
| 110 | (continuous_const.prodMk continuous_id) (fun _ => ht) |
| 111 | |
| 112 | theorem continuous_operatorTrace : |
| 113 | Continuous (fun A : E →L[ℝ] E => LinearMap.trace ℝ E A.toLinearMap) := by |
| 114 | exact ((LinearMap.trace ℝ E).comp |
| 115 | (LinearMap.toContinuousLinearMap : (E →ₗ[ℝ] E) ≃ₗ[ℝ] (E →L[ℝ] E)).symm.toLinearMap |
| 116 | ).continuous_of_finiteDimensional |
| 117 | |
| 118 | omit [FiniteDimensional ℝ E] in |
| 119 | theorem isClosed_symmetric_continuousLinearMap : |
| 120 | IsClosed {A : E →L[ℝ] E | A.toLinearMap.IsSymmetric} := by |
| 121 | simp only [LinearMap.IsSymmetric, ContinuousLinearMap.coe_coe, Set.ofPred_forall] |
| 122 | exact isClosed_iInter fun v => isClosed_iInter fun w => |
| 123 | isClosed_eq ((ContinuousLinearMap.apply ℝ E v).continuous.inner |
| 124 | (continuous_const : Continuous (fun _ : E →L[ℝ] E => w))) |
| 125 | ((continuous_const : Continuous (fun _ : E →L[ℝ] E => v)).inner |
| 126 | (ContinuousLinearMap.apply ℝ E w).continuous) |
| 127 | |
| 128 | /-- The original carrier in the canonical operator-norm representation. -/ |
| 129 | def continuousRegion (hn : Module.finrank ℝ E = 3) (t : ℝ) : |
| 130 | Set (E →L[ℝ] E) := {A | A.toLinearMap ∈ region hn t} |
| 131 | |
| 132 | @[simp] theorem mem_continuousRegion (hn : Module.finrank ℝ E = 3) |
| 133 | (t : ℝ) (A : E →L[ℝ] E) : |
| 134 | A ∈ continuousRegion hn t ↔ A.toLinearMap ∈ region hn t := Iff.rfl |
| 135 | |
| 136 | @[simp] theorem toContinuousLinearMap_mem_continuousRegion |
| 137 | (hn : Module.finrank ℝ E = 3) (t : ℝ) (A : E →ₗ[ℝ] E) : |
| 138 | A.toContinuousLinearMap ∈ continuousRegion hn t ↔ A ∈ region hn t := Iff.rfl |
| 139 | |
| 140 | theorem continuousRegion_nonempty (hn : Module.finrank ℝ E = 3) |
| 141 | {t : ℝ} (ht : 0 ≤ t) : (continuousRegion hn t).Nonempty := |
| 142 | ⟨0, region_zero_mem hn ht⟩ |
| 143 | |
| 144 | theorem isClosed_continuousRegion (hn : Module.finrank ℝ E = 3) |
| 145 | {t : ℝ} (ht : 0 ≤ t) : IsClosed (continuousRegion hn t) := by |
| 146 | have heq : continuousRegion hn t = |
| 147 | {A : E →L[ℝ] E | A.toLinearMap.IsSymmetric ∧ |
| 148 | ∀ v : E, ‖v‖ = 1 → |
| 149 | clippedBarrier t (max (-inner ℝ v (A v)) 0) ≤ LinearMap.trace ℝ E A.toLinearMap} := by |
| 150 | ext A |
| 151 | simp only [mem_continuousRegion, mem_region_iff_rayleigh hn ht, |
| 152 | mem_ofPred_eq, mem_scalarRegion_iff ht, ContinuousLinearMap.coe_coe] |
| 153 | rw [heq, ofPred_and] |
| 154 | simp only [ofPred_forall] |
| 155 | refine isClosed_symmetric_continuousLinearMap.inter |
| 156 | (isClosed_iInter fun v => isClosed_iInter fun _ => ?_) |
| 157 | exact isClosed_le ((continuous_clippedBarrier ht).comp |
| 158 | ((continuous_const.inner (ContinuousLinearMap.apply ℝ E v).continuous).neg.max |
| 159 | continuous_const)) continuous_operatorTrace |
| 160 | |
| 161 | theorem isClosed_continuousRegion_spacetime (hn : Module.finrank ℝ E = 3) : |
| 162 | IsClosed {p : ℝ × (E →L[ℝ] E) | 0 ≤ p.1 ∧ p.2 ∈ continuousRegion hn p.1} := by |
| 163 | let S : Set (ℝ × (E →L[ℝ] E)) := {p | 0 ≤ p.1} |
| 164 | have hS : IsClosed S := isClosed_le continuous_const continuous_fst |
| 165 | have heq : {p : ℝ × (E →L[ℝ] E) | 0 ≤ p.1 ∧ p.2 ∈ continuousRegion hn p.1} = |
| 166 | S ∩ {p | p.2.toLinearMap.IsSymmetric} ∩ |
| 167 | {p | ∀ v : E, ‖v‖ = 1 → p ∈ S ∧ |
| 168 | clippedBarrier p.1 (max (-inner ℝ v (p.2 v)) 0) ≤ |
| 169 | LinearMap.trace ℝ E p.2.toLinearMap} := by |
| 170 | ext p |
| 171 | simp only [mem_ofPred_eq, mem_inter_iff] |
| 172 | constructor |
| 173 | · rintro ⟨ht, hA⟩ |
| 174 | obtain ⟨hs, hA⟩ := (mem_region_iff_rayleigh hn ht p.2.toLinearMap).mp hA |
| 175 | exact ⟨⟨ht, hs⟩, fun v hv => ⟨ht, (mem_scalarRegion_iff ht).mp (hA v hv)⟩⟩ |
| 176 | · rintro ⟨⟨ht, hs⟩, hA⟩ |
| 177 | exact ⟨ht, (mem_region_iff_rayleigh hn ht p.2.toLinearMap).mpr |
| 178 | ⟨hs, fun v hv => (mem_scalarRegion_iff ht).mpr (hA v hv).2⟩⟩ |
| 179 | rw [heq] |
| 180 | simp only [ofPred_forall] |
| 181 | refine (hS.inter (isClosed_symmetric_continuousLinearMap.preimage continuous_snd)).inter |
| 182 | (isClosed_iInter fun v => isClosed_iInter fun _ => ?_) |
| 183 | apply hS.isClosed_le _ (continuous_operatorTrace.comp continuous_snd).continuousOn |
| 184 | exact continuousOn_clippedBarrier.comp |
| 185 | (continuous_fst.prodMk |
| 186 | ((continuous_const.inner ((ContinuousLinearMap.apply ℝ E v).continuous.comp |
| 187 | continuous_snd)).neg.max continuous_const)).continuousOn |
| 188 | (fun p hp => hp) |
| 189 | |
| 190 | /- Isometric identification of distinct fibers preserves the original carrier. -/ |
| 191 | theorem region_conj_equiv_iff |
| 192 | {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] |
| 193 | [FiniteDimensional ℝ F] (hn : Module.finrank ℝ E = 3) |
| 194 | (hm : Module.finrank ℝ F = 3) (e : E ≃ₗᵢ[ℝ] F) |
| 195 | {t : ℝ} (ht : 0 ≤ t) (A : E →ₗ[ℝ] E) : |
| 196 | e.toLinearEquiv.conj A ∈ region hm t ↔ A ∈ region hn t := by |
| 197 | rw [mem_region_iff_rayleigh hm ht, mem_region_iff_rayleigh hn ht] |
| 198 | have hsymm : (e.toLinearEquiv.conj A).IsSymmetric ↔ A.IsSymmetric := |
| 199 | LinearMap.isSymmetric_linearIsometryEquiv_conj_iff A e |
| 200 | rw [hsymm, LinearMap.trace_conj'] |
| 201 | refine and_congr_right fun _ => ⟨?_, ?_⟩ |
| 202 | · intro h v hv |
| 203 | simpa [LinearEquiv.conj_apply] using h (e v) (by simpa using hv) |
| 204 | · intro h v hv |
| 205 | simpa [LinearEquiv.conj_apply, LinearIsometryEquiv.inner_map_eq_flip] using |
| 206 | h (e.symm v) (by simpa using hv) |
| 207 | |
| 208 | theorem region_conj_iff (hn : Module.finrank ℝ E = 3) |
| 209 | (e : E ≃ₗᵢ[ℝ] E) {t : ℝ} (ht : 0 ≤ t) (A : E →ₗ[ℝ] E) : |
| 210 | e.toLinearEquiv.conj A ∈ region hn t ↔ A ∈ region hn t := |
| 211 | region_conj_equiv_iff hn hn e ht A |
| 212 | |
| 213 | theorem region_scale_iff (hn : Module.finrank ℝ E = 3) |
| 214 | {t : ℝ} (ht : 0 ≤ t) (A : E →ₗ[ℝ] E) : |
| 215 | A ∈ region hn t ↔ (1 + t) • A ∈ region hn 0 := by |
| 216 | have hc : 0 < 1 + t := by linarith |
| 217 | have hsymm : ((1 + t) • A).IsSymmetric ↔ A.IsSymmetric := by |
| 218 | constructor |
| 219 | · intro h v w |
| 220 | have h' := h v w |
| 221 | simpa only [LinearMap.smul_apply, inner_smul_left, inner_smul_right, |
| 222 | RCLike.conj_to_real, mul_eq_mul_left_iff, hc.ne', or_false] using h' |
| 223 | · exact fun h => h.smul (by simp) |
| 224 | rw [mem_region_iff_rayleigh hn ht, mem_region_iff_rayleigh hn (by norm_num), hsymm] |
| 225 | refine and_congr_right fun _ => forall_congr' fun v => imp_congr_right fun _ => ?_ |
| 226 | rw [scalarRegion_scale_iff ht] |
| 227 | simp only [map_smul, smul_eq_mul, LinearMap.smul_apply, inner_smul_right, |
| 228 | ← mul_neg, mul_max_of_nonneg _ _ hc.le, mul_zero] |
| 229 | |
| 230 | theorem convex_continuousRegion (hn : Module.finrank ℝ E = 3) |
| 231 | {t : ℝ} (ht : 0 ≤ t) : Convex ℝ (continuousRegion hn t) := by |
| 232 | intro A hA B hB a b ha hb hab |
| 233 | exact convex_region hn ht hA hB ha hb hab |
| 234 | |
| 235 | end Poincare.HamiltonIvey |