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.ODE.Linear |
| 2 | import PoincareLib.Geometry.Riemannian.Metric |
| 3 | import Mathlib.Analysis.Calculus.Deriv.Basic |
| 4 | |
| 5 | /-! |
| 6 | # Orthonormal transport for an evolving metric |
| 7 | |
| 8 | The Ricci endomorphism equation is a finite-dimensional linear ODE in each |
| 9 | tangent fibre. This file gives the compact-time producer and the metric |
| 10 | pairing argument used to identify its transport with an isometry. The |
| 11 | coefficient/duality hypotheses are kept explicit because the foundational |
| 12 | `LeviCivitaData.ricci` definition is intentionally a raw evaluation. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set |
| 18 | open scoped NNReal |
| 19 | |
| 20 | noncomputable section |
| 21 | |
| 22 | namespace PoincareMT.RicciFlow.Frame |
| 23 | |
| 24 | variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] |
| 25 | [CompleteSpace V] [FiniteDimensional ℝ V] |
| 26 | |
| 27 | /-- A metric and its Ricci bilinear form, with the Ricci-flow time derivative. -/ |
| 28 | structure EvolvingMetricData (J : Set ℝ) where |
| 29 | metric : ℝ → V →L[ℝ] V →L[ℝ] ℝ |
| 30 | ricci : ℝ → V →L[ℝ] V →L[ℝ] ℝ |
| 31 | metric_deriv : ∀ t, HasDerivAt metric (-2 • ricci t) t |
| 32 | ricci_symm : ∀ t v w, ricci t v w = ricci t w v |
| 33 | |
| 34 | private noncomputable def finBasisOperatorEquiv : |
| 35 | (Fin (Module.finrank ℝ V) → V) ≃L[ℝ] (V →L[ℝ] V) := |
| 36 | (((Module.finBasis ℝ V).constr ℝ).trans |
| 37 | (LinearMap.toContinuousLinearMap (𝕜 := ℝ) (E := V) (F' := V))).toContinuousLinearEquiv |
| 38 | |
| 39 | private theorem finBasisOperatorEquiv_apply_basis |
| 40 | (f : Fin (Module.finrank ℝ V) → V) (i : Fin (Module.finrank ℝ V)) : |
| 41 | finBasisOperatorEquiv f ((Module.finBasis ℝ V) i) = f i := by |
| 42 | simp [finBasisOperatorEquiv] |
| 43 | |
| 44 | /-- The operator-valued solution obtained by solving the ODE on a compact interval. -/ |
| 45 | noncomputable def transportCurveOn |
| 46 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} (hab : a ≤ b) |
| 47 | (hcont : ContinuousOn A (Icc a b)) {K : ℝ≥0} |
| 48 | (hK : ∀ t ∈ Icc a b, ‖A t‖₊ ≤ K) (t : ℝ) : V →L[ℝ] V := |
| 49 | finBasisOperatorEquiv (fun i => |
| 50 | Poincare.ODE.Linear.solOf hab hcont hK ((Module.finBasis ℝ V) i) t) |
| 51 | |
| 52 | @[simp] theorem transportCurveOn_apply_of_mem |
| 53 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} (hab : a ≤ b) |
| 54 | (hcont : ContinuousOn A (Icc a b)) {K : ℝ≥0} |
| 55 | (hK : ∀ t ∈ Icc a b, ‖A t‖₊ ≤ K) {t : ℝ} (ht : t ∈ Icc a b) (v : V) : |
| 56 | transportCurveOn (V := V) A hab hcont hK t v = |
| 57 | Poincare.ODE.Linear.solOf hab hcont hK v t := by |
| 58 | have hmaps : transportCurveOn (V := V) A hab hcont hK t = |
| 59 | finBasisOperatorEquiv (fun i => |
| 60 | Poincare.ODE.Linear.solOf hab hcont hK ((Module.finBasis ℝ V) i) t) := by |
| 61 | apply ContinuousLinearMap.coe_injective |
| 62 | apply (Module.finBasis ℝ V).ext |
| 63 | intro i |
| 64 | simp [transportCurveOn, finBasisOperatorEquiv_apply_basis] |
| 65 | let S : V →ₗ[ℝ] V := |
| 66 | { toFun := fun x => Poincare.ODE.Linear.solOf hab hcont hK x t |
| 67 | map_add' := fun x y => Poincare.ODE.Linear.solOf_add hab hcont hK x y ht |
| 68 | map_smul' := fun c x => Poincare.ODE.Linear.solOf_smul hab hcont hK c x ht } |
| 69 | have hS : finBasisOperatorEquiv (fun i => |
| 70 | Poincare.ODE.Linear.solOf hab hcont hK ((Module.finBasis ℝ V) i) t) = |
| 71 | S.toContinuousLinearMap := by |
| 72 | apply ContinuousLinearMap.coe_injective |
| 73 | apply (Module.finBasis ℝ V).ext |
| 74 | intro i |
| 75 | simp [S, finBasisOperatorEquiv_apply_basis] |
| 76 | rw [hmaps, hS] |
| 77 | rfl |
| 78 | |
| 79 | /-- The transport solves the operator-valued ODE on the compact interval. -/ |
| 80 | theorem transportCurveOn_hasDerivWithinAt |
| 81 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} (hab : a ≤ b) |
| 82 | (hcont : ContinuousOn A (Icc a b)) {K : ℝ≥0} |
| 83 | (hK : ∀ t ∈ Icc a b, ‖A t‖₊ ≤ K) {t : ℝ} (ht : t ∈ Icc a b) : |
| 84 | HasDerivWithinAt (transportCurveOn (V := V) A hab hcont hK) |
| 85 | ((A t).comp (transportCurveOn (V := V) A hab hcont hK t)) (Icc a b) t := by |
| 86 | have hcoord : HasDerivWithinAt |
| 87 | (fun s : ℝ => fun i : Fin (Module.finrank ℝ V) => |
| 88 | Poincare.ODE.Linear.solOf hab hcont hK ((Module.finBasis ℝ V) i) s) |
| 89 | (fun i : Fin (Module.finrank ℝ V) => |
| 90 | A t (Poincare.ODE.Linear.solOf hab hcont hK ((Module.finBasis ℝ V) i) t)) |
| 91 | (Icc a b) t := by |
| 92 | rw [hasDerivWithinAt_pi] |
| 93 | intro i |
| 94 | exact Poincare.ODE.Linear.solOf_isSolOn hab hcont hK _ t ht |
| 95 | have hraw := |
| 96 | (finBasisOperatorEquiv (V := V)).hasFDerivAt.comp_hasDerivWithinAt t hcoord |
| 97 | convert hraw using 1 <;> try rfl |
| 98 | apply ContinuousLinearMap.coe_injective |
| 99 | apply (Module.finBasis ℝ V).ext |
| 100 | intro i |
| 101 | simp [transportCurveOn, finBasisOperatorEquiv_apply_basis] |
| 102 | |
| 103 | theorem transportCurveOn_continuousOn |
| 104 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} (hab : a ≤ b) |
| 105 | (hcont : ContinuousOn A (Icc a b)) {K : ℝ≥0} |
| 106 | (hK : ∀ t ∈ Icc a b, ‖A t‖₊ ≤ K) : |
| 107 | ContinuousOn (transportCurveOn (V := V) A hab hcont hK) (Icc a b) := |
| 108 | fun t ht => (transportCurveOn_hasDerivWithinAt A hab hcont hK ht).continuousWithinAt |
| 109 | |
| 110 | @[simp] theorem transportCurveOn_left |
| 111 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} (hab : a ≤ b) |
| 112 | (hcont : ContinuousOn A (Icc a b)) {K : ℝ≥0} |
| 113 | (hK : ∀ t ∈ Icc a b, ‖A t‖₊ ≤ K) : |
| 114 | transportCurveOn A hab hcont hK a = ContinuousLinearMap.id ℝ V := by |
| 115 | ext v |
| 116 | rw [transportCurveOn_apply_of_mem A hab hcont hK ⟨le_rfl, hab⟩] |
| 117 | exact Poincare.ODE.Linear.solOf_left hab hcont hK v |
| 118 | |
| 119 | /-- Uniqueness identifies the constructed transport with any operator solution. -/ |
| 120 | theorem transportCurveOn_eqOn |
| 121 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} (hab : a ≤ b) |
| 122 | (hcont : ContinuousOn A (Icc a b)) {K : ℝ≥0} |
| 123 | (hK : ∀ t ∈ Icc a b, ‖A t‖₊ ≤ K) |
| 124 | {Ψ : ℝ → V →L[ℝ] V} (hΨa : Ψ a = ContinuousLinearMap.id ℝ V) |
| 125 | (hΨ : ∀ t ∈ Icc a b, |
| 126 | HasDerivWithinAt Ψ ((A t).comp (Ψ t)) (Icc a b) t) : |
| 127 | EqOn (transportCurveOn A hab hcont hK) Ψ (Icc a b) := by |
| 128 | intro t ht |
| 129 | ext v |
| 130 | rw [transportCurveOn_apply_of_mem A hab hcont hK ht] |
| 131 | apply Poincare.ODE.Linear.IsSolOn.eqOn_of_left hK |
| 132 | (Poincare.ODE.Linear.solOf_isSolOn hab hcont hK v) (W := fun s => Ψ s v) _ _ ht |
| 133 | · intro s hs |
| 134 | simpa using (hΨ s hs).clm_apply (hasDerivWithinAt_const s (Icc a b) v) |
| 135 | · simp [Poincare.ODE.Linear.solOf_left, hΨa] |
| 136 | |
| 137 | /-- Compact interval choices give the same transport wherever both are defined. -/ |
| 138 | theorem transportCurveOn_eqOn_of_le |
| 139 | (A : ℝ → V →L[ℝ] V) {a b c : ℝ} (hab : a ≤ b) (hbc : b ≤ c) |
| 140 | (hcont : ContinuousOn A (Icc a c)) {K L : ℝ≥0} |
| 141 | (hK : ∀ t ∈ Icc a b, ‖A t‖₊ ≤ K) |
| 142 | (hL : ∀ t ∈ Icc a c, ‖A t‖₊ ≤ L) : |
| 143 | EqOn (transportCurveOn A hab (hcont.mono (Icc_subset_Icc le_rfl hbc)) hK) |
| 144 | (transportCurveOn A (hab.trans hbc) hcont hL) (Icc a b) := by |
| 145 | apply transportCurveOn_eqOn A hab _ hK (transportCurveOn_left A _ _ _) |
| 146 | intro t ht |
| 147 | exact (transportCurveOn_hasDerivWithinAt A (hab.trans hbc) hcont hL |
| 148 | ⟨ht.1, ht.2.trans hbc⟩).mono (Icc_subset_Icc le_rfl hbc) |
| 149 | |
| 150 | /-- Backward uniqueness proves invertibility without any metric assumptions. -/ |
| 151 | theorem transportCurveOn_bijective |
| 152 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} (hab : a ≤ b) |
| 153 | (hcont : ContinuousOn A (Icc a b)) {K : ℝ≥0} |
| 154 | (hK : ∀ t ∈ Icc a b, ‖A t‖₊ ≤ K) {t : ℝ} (ht : t ∈ Icc a b) : |
| 155 | Function.Bijective (transportCurveOn A hab hcont hK t) := by |
| 156 | suffices hi : Function.Injective (transportCurveOn A hab hcont hK t) from |
| 157 | ⟨hi, (LinearMap.injective_iff_surjective |
| 158 | (f := (transportCurveOn A hab hcont hK t).toLinearMap)).mp hi⟩ |
| 159 | intro v w hvw |
| 160 | have hsub : Icc a t ⊆ Icc a b := Icc_subset_Icc le_rfl ht.2 |
| 161 | have hsol (v : V) : Poincare.ODE.Linear.IsSolOn A a t |
| 162 | (Poincare.ODE.Linear.solOf hab hcont hK v) := |
| 163 | fun s hs => (Poincare.ODE.Linear.solOf_isSolOn hab hcont hK v s (hsub hs)).mono hsub |
| 164 | have heq := Poincare.ODE.Linear.IsSolOn.eqOn_of_right |
| 165 | (fun s hs => hK s (hsub hs)) (hsol v) (hsol w) |
| 166 | (by simpa only [transportCurveOn_apply_of_mem A hab hcont hK ht] using hvw) |
| 167 | (show a ∈ Icc a t from ⟨le_rfl, ht.1⟩) |
| 168 | simpa only [Poincare.ODE.Linear.solOf_left] using heq |
| 169 | |
| 170 | set_option maxHeartbeats 800000 in |
| 171 | private theorem pairing_deriv_zero {J : Set ℝ} (G : EvolvingMetricData (V := V) J) |
| 172 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} (hab : a ≤ b) |
| 173 | (hcont : ContinuousOn A (Icc a b)) {K : ℝ≥0} |
| 174 | (hK : ∀ t ∈ Icc a b, ‖A t‖₊ ≤ K) |
| 175 | (hleft : ∀ t ∈ Icc a b, ∀ v w, G.metric t (A t v) w = G.ricci t v w) |
| 176 | (hright : ∀ t ∈ Icc a b, ∀ v w, G.metric t v (A t w) = G.ricci t v w) |
| 177 | (v w : V) {t : ℝ} (ht : t ∈ Icc a b) : |
| 178 | HasDerivWithinAt |
| 179 | (fun s => G.metric s |
| 180 | (transportCurveOn (V := V) A hab hcont hK s v) |
| 181 | (transportCurveOn (V := V) A hab hcont hK s w)) 0 (Icc a b) t := by |
| 182 | let U := fun s => transportCurveOn (V := V) A hab hcont hK s v |
| 183 | let W := fun s => transportCurveOn (V := V) A hab hcont hK s w |
| 184 | have hmetric : HasDerivWithinAt G.metric (-2 • G.ricci t) (Icc a b) t := |
| 185 | @HasDerivAt.hasDerivWithinAt ℝ _ (V →L[ℝ] V →L[ℝ] ℝ) _ _ |
| 186 | G.metric (-2 • G.ricci t) t (Icc a b) (G.metric_deriv t) |
| 187 | have hU₀ := transportCurveOn_hasDerivWithinAt A hab hcont hK ht |
| 188 | have hW₀ := transportCurveOn_hasDerivWithinAt A hab hcont hK ht |
| 189 | have hU : HasDerivWithinAt U (A t (U t)) (Icc a b) t := by |
| 190 | have hh := hU₀.clm_apply |
| 191 | (hasDerivWithinAt_const (x := t) (s := Icc a b) (c := v)) |
| 192 | simpa [U] using hh |
| 193 | have hW : HasDerivWithinAt W (A t (W t)) (Icc a b) t := by |
| 194 | have hh := hW₀.clm_apply |
| 195 | (hasDerivWithinAt_const (x := t) (s := Icc a b) (c := w)) |
| 196 | simpa [W] using hh |
| 197 | have h₁ : HasDerivWithinAt |
| 198 | (fun s => G.metric s (U s)) |
| 199 | ((-2 • G.ricci t) (U t) + G.metric t (A t (U t))) |
| 200 | (Icc a b) t := |
| 201 | @HasDerivWithinAt.clm_apply ℝ _ V _ _ t (Icc a b) (V →L[ℝ] ℝ) _ _ |
| 202 | G.metric (-2 • G.ricci t) U (A t (U t)) hmetric hU |
| 203 | have h₂ : HasDerivWithinAt |
| 204 | (fun s => G.metric s (U s) (W s)) |
| 205 | (((-2 • G.ricci t) (U t) + G.metric t (A t (U t))) (W t) + |
| 206 | G.metric t (U t) (A t (W t))) |
| 207 | (Icc a b) t := |
| 208 | @HasDerivWithinAt.clm_apply ℝ _ V _ _ t (Icc a b) ℝ _ _ |
| 209 | (fun s => G.metric s (U s)) |
| 210 | ((-2 • G.ricci t) (U t) + G.metric t (A t (U t))) W |
| 211 | (A t (W t)) h₁ hW |
| 212 | apply h₂.congr_deriv |
| 213 | simp only [U, W, smul_apply, add_apply] |
| 214 | rw [hleft t ht, hright t ht] |
| 215 | ring |
| 216 | |
| 217 | /-- The transported pairing agrees with its left-endpoint value. -/ |
| 218 | theorem transport_pairing_eq_left {J : Set ℝ} (G : EvolvingMetricData (V := V) J) |
| 219 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} (hab : a < b) |
| 220 | (hcont : ContinuousOn A (Icc a b)) {K : ℝ≥0} |
| 221 | (hK : ∀ t ∈ Icc a b, ‖A t‖₊ ≤ K) |
| 222 | (hleft : ∀ t ∈ Icc a b, ∀ v w, G.metric t (A t v) w = G.ricci t v w) |
| 223 | (hright : ∀ t ∈ Icc a b, ∀ v w, G.metric t v (A t w) = G.ricci t v w) |
| 224 | (v w : V) {t : ℝ} (ht : t ∈ Icc a b) : |
| 225 | G.metric t (transportCurveOn (V := V) A hab.le hcont hK t v) |
| 226 | (transportCurveOn (V := V) A hab.le hcont hK t w) = G.metric a v w := by |
| 227 | let f : ℝ → ℝ := fun s => G.metric s |
| 228 | (transportCurveOn (V := V) A hab.le hcont hK s v) |
| 229 | (transportCurveOn (V := V) A hab.le hcont hK s w) |
| 230 | have hdiff : DifferentiableOn ℝ f (Icc a b) := by |
| 231 | intro s hs |
| 232 | exact (pairing_deriv_zero G A hab.le hcont hK hleft hright v w hs).differentiableWithinAt |
| 233 | have hderiv : ∀ s ∈ Ico a b, derivWithin f (Icc a b) s = 0 := by |
| 234 | intro s hs |
| 235 | exact (pairing_deriv_zero G A hab.le hcont hK hleft hright v w |
| 236 | ⟨hs.1, hs.2.le⟩).derivWithin ((uniqueDiffOn_Icc hab) s ⟨hs.1, hs.2.le⟩) |
| 237 | have hc := constant_of_derivWithin_zero hdiff hderiv t ht |
| 238 | have hva : transportCurveOn (V := V) A hab.le hcont hK a v = v := by |
| 239 | rw [transportCurveOn_apply_of_mem A hab.le hcont hK ⟨le_rfl, hab.le⟩] |
| 240 | exact Poincare.ODE.Linear.solOf_left hab.le hcont hK v |
| 241 | have hwa : transportCurveOn (V := V) A hab.le hcont hK a w = w := by |
| 242 | rw [transportCurveOn_apply_of_mem A hab.le hcont hK ⟨le_rfl, hab.le⟩] |
| 243 | exact Poincare.ODE.Linear.solOf_left hab.le hcont hK w |
| 244 | simpa [f, hva, hwa] using hc |
| 245 | |
| 246 | /-- The compact-time transport is an isometry from the left metric to the current metric. -/ |
| 247 | theorem transport_isometry_on {J : Set ℝ} (G : EvolvingMetricData (V := V) J) |
| 248 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} (hab : a < b) |
| 249 | (hcont : ContinuousOn A (Icc a b)) {K : ℝ≥0} |
| 250 | (hK : ∀ t ∈ Icc a b, ‖A t‖₊ ≤ K) |
| 251 | (hleft : ∀ t ∈ Icc a b, ∀ v w, G.metric t (A t v) w = G.ricci t v w) |
| 252 | (hright : ∀ t ∈ Icc a b, ∀ v w, G.metric t v (A t w) = G.ricci t v w) |
| 253 | (t : Icc a b) (v w : V) : |
| 254 | G.metric t (transportCurveOn (V := V) A hab.le hcont hK t v) |
| 255 | (transportCurveOn (V := V) A hab.le hcont hK t w) = G.metric a v w := |
| 256 | transport_pairing_eq_left G A hab hcont hK hleft hright v w t.2 |
| 257 | |
| 258 | /-- Metric preservation makes the transport injective when the initial metric is nondegenerate. -/ |
| 259 | theorem transport_injective_of_nondegenerate {J : Set ℝ} |
| 260 | (G : EvolvingMetricData (V := V) J) (A : ℝ → V →L[ℝ] V) |
| 261 | {a b : ℝ} (hab : a < b) (hcont : ContinuousOn A (Icc a b)) {K : ℝ≥0} |
| 262 | (hK : ∀ t ∈ Icc a b, ‖A t‖₊ ≤ K) |
| 263 | (hleft : ∀ t ∈ Icc a b, ∀ v w, G.metric t (A t v) w = G.ricci t v w) |
| 264 | (hright : ∀ t ∈ Icc a b, ∀ v w, G.metric t v (A t w) = G.ricci t v w) |
| 265 | (hnd : ∀ v, G.metric a v v = 0 → v = 0) (t : Icc a b) : |
| 266 | Function.Injective (transportCurveOn (V := V) A hab.le hcont hK t) := by |
| 267 | intro v w hvw |
| 268 | have hz := transport_isometry_on G A hab hcont hK hleft hright t (v - w) (v - w) |
| 269 | have hzero : transportCurveOn (V := V) A hab.le hcont hK t (v - w) = 0 := by |
| 270 | calc |
| 271 | transportCurveOn (V := V) A hab.le hcont hK t (v - w) = |
| 272 | transportCurveOn (V := V) A hab.le hcont hK t v - |
| 273 | transportCurveOn (V := V) A hab.le hcont hK t w := by rw [map_sub] |
| 274 | _ = 0 := sub_eq_zero.mpr hvw |
| 275 | have hz' := hz |
| 276 | rw [hzero] at hz' |
| 277 | exact sub_eq_zero.mp (hnd (v - w) (by simpa using hz'.symm)) |
| 278 | |
| 279 | end PoincareMT.RicciFlow.Frame |
| 280 | |
| 281 | end |