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.Curvature.Calculus |
| 2 | import PoincareLib.Geometry.RicciFlow.Harnack.Matrix.Positivity.Global |
| 3 | import PoincareLib.Geometry.RicciFlow.TimeTranslation |
| 4 | |
| 5 | /-! # Time origins for the Hamilton block |
| 6 | |
| 7 | Smooth exhaustions transport along affine time translation. Positivity is |
| 8 | closed under limits of nonzero elapsed times, allowing the time origin to |
| 9 | approach an endpoint of the flow interval. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | |
| 15 | open Set Filter Matrix |
| 16 | open scoped Manifold ContDiff Bundle BigOperators Topology |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.RicciFlow |
| 21 | |
| 22 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 24 | {J K : Set ℝ} |
| 25 | |
| 26 | /-- Retain the exhaustion function and bound under affine time translation. -/ |
| 27 | def SmoothExhaustion.translate {F : RicciFlow n M J} {O : M} |
| 28 | (S : SmoothExhaustion F O) (c : ℝ) |
| 29 | (hKJ : (fun t : ℝ => t + c) '' K ⊆ J) (hK : K.OrdConnected) (hne : K.Nontrivial) : |
| 30 | SmoothExhaustion (F.translate c hKJ hK hne) O where |
| 31 | toFun := S.toFun |
| 32 | smooth := S.smooth |
| 33 | bound := S.bound |
| 34 | bound_nonneg := S.bound_nonneg |
| 35 | distance_lower t ht := S.distance_lower (t + c) (hKJ ⟨t, ht, rfl⟩) |
| 36 | distance_upper t ht := S.distance_upper (t + c) (hKJ ⟨t, ht, rfl⟩) |
| 37 | gradient_bound t ht := S.gradient_bound (t + c) (hKJ ⟨t, ht, rfl⟩) |
| 38 | hessian_bound t ht := S.hessian_bound (t + c) (hKJ ⟨t, ht, rfl⟩) |
| 39 | |
| 40 | end PoincareMT.RicciFlow |
| 41 | |
| 42 | namespace Poincare.RicciFlow.Harnack |
| 43 | |
| 44 | open PoincareMT |
| 45 | |
| 46 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 47 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 48 | |
| 49 | lemma hamiltonBlockPos_translate {a b a' b' : ℝ} (F : RicciFlow n M (Ioo a b)) |
| 50 | (c : ℝ) (hKJ : (fun t : ℝ => t + c) '' Ioo a' b' ⊆ Ioo a b) |
| 51 | (hK : (Ioo a' b').OrdConnected) (hne : (Ioo a' b').Nontrivial) |
| 52 | (t : ℝ) (x : M) (τ : ℝ) : |
| 53 | HamiltonBlockPos (F.translate c hKJ hK hne) t x τ ↔ |
| 54 | HamiltonBlockPos F (t + c) x τ := Iff.rfl |
| 55 | |
| 56 | /-- The exhaustion argument on an open spatial set with an arbitrary time origin. -/ |
| 57 | theorem hamiltonBlockPos_on_open_set_of_smoothExhaustion_time_origin [T2Space M] |
| 58 | (hC : RicciFlowCurvatureCalculus.{u}) {a b c T : ℝ} |
| 59 | (F : RicciFlow n M (Ioo a b)) (O : M) (S : RicciFlow.SmoothExhaustion F O) |
| 60 | (V : Set M) (hV : IsOpen V) |
| 61 | (hproper : ∀ r : ℝ, IsCompact {x | S.toFun x ≤ r ∧ x ∈ V}) |
| 62 | (hcT : c < T) (hJ : Ioc c T ⊆ Ioo a b) {K : ℝ} (hK : 0 ≤ K) |
| 63 | (hbound : ∀ t ∈ Ioc c T, ∀ x ∈ V, ∀ j ≤ 2, |
| 64 | (F.connection t).curvatureDerivativeNorm j x ≤ K) |
| 65 | (hcurv : ∀ t ∈ Ioc c T, ∀ x ∈ V, (F.connection t).NonnegativeCurvatureOperator x) : |
| 66 | ∀ t ∈ Ioc c T, ∀ x ∈ V, HamiltonBlockPos F t x (t - c) := by |
| 67 | have hmap : (fun s : ℝ => s + c) '' Ioo (a - c) (b - c) ⊆ Ioo a b := by |
| 68 | rintro _ ⟨s, hs, rfl⟩ |
| 69 | constructor <;> linarith [hs.1, hs.2] |
| 70 | have hne : (Ioo (a - c) (b - c)).Nontrivial := by |
| 71 | obtain ⟨s, hs, r, hr, hsr⟩ := F.nontrivial |
| 72 | refine ⟨s - c, ⟨by linarith [hs.1], by linarith [hs.2]⟩, |
| 73 | r - c, ⟨by linarith [hr.1], by linarith [hr.2]⟩, ?_⟩ |
| 74 | intro h |
| 75 | apply hsr |
| 76 | linarith |
| 77 | let G := F.translate c hmap ordConnected_Ioo hne |
| 78 | let S' := S.translate c hmap ordConnected_Ioo hne |
| 79 | have hshift {s : ℝ} (hs : s ∈ Ioc 0 (T - c)) : s + c ∈ Ioc c T := by |
| 80 | constructor <;> linarith [hs.1, hs.2] |
| 81 | have hJ' : Ioc 0 (T - c) ⊆ Ioo (a - c) (b - c) := by |
| 82 | intro s hs |
| 83 | have hm := hJ (hshift hs) |
| 84 | constructor <;> linarith [hm.1, hm.2] |
| 85 | have hp := hamiltonBlockPos_on_open_set_of_smoothExhaustion hC G O S' V hV hproper |
| 86 | (sub_pos.mpr hcT) hJ' hK |
| 87 | (fun s hs => hbound (s + c) (hshift hs)) |
| 88 | (fun s hs => hcurv (s + c) (hshift hs)) |
| 89 | intro t ht x hx |
| 90 | have htime : t - c ∈ Ioc 0 (T - c) := ⟨sub_pos.mpr ht.1, sub_le_sub_right ht.2 c⟩ |
| 91 | have h := hp (t - c) htime x hx |
| 92 | rw [hamiltonBlockPos_translate] at h |
| 93 | simpa only [sub_add_cancel] using h |
| 94 | |
| 95 | /-- The global exhaustion argument with an arbitrary time origin. -/ |
| 96 | theorem hamiltonBlockPos_of_smoothExhaustion_time_origin [T2Space M] |
| 97 | (hC : RicciFlowCurvatureCalculus.{u}) {a b c T : ℝ} |
| 98 | (F : RicciFlow n M (Ioo a b)) (O : M) (S : RicciFlow.SmoothExhaustion F O) |
| 99 | (hproper : ∀ r : ℝ, IsCompact {x | S.toFun x ≤ r}) |
| 100 | (hcT : c < T) (hJ : Ioc c T ⊆ Ioo a b) {K : ℝ} (hK : 0 ≤ K) |
| 101 | (hbound : ∀ t ∈ Ioc c T, ∀ x, ∀ j ≤ 2, |
| 102 | (F.connection t).curvatureDerivativeNorm j x ≤ K) |
| 103 | (hcurv : ∀ t ∈ Ioc c T, ∀ x, (F.connection t).NonnegativeCurvatureOperator x) : |
| 104 | ∀ t ∈ Ioc c T, ∀ x, HamiltonBlockPos F t x (t - c) := by |
| 105 | intro t ht x |
| 106 | apply hamiltonBlockPos_on_open_set_of_smoothExhaustion_time_origin hC F O S |
| 107 | univ isOpen_univ (by simpa only [mem_univ, and_true] using hproper) hcT hJ hK |
| 108 | (fun s hs y _ => hbound s hs y) (fun s hs y _ => hcurv s hs y) t ht x (mem_univ x) |
| 109 | |
| 110 | private lemma posSemidef_of_tendsto_entries {ι κ : Type*} [Fintype ι] |
| 111 | {l : Filter κ} [l.NeBot] {A : κ → Matrix ι ι ℝ} {B : Matrix ι ι ℝ} |
| 112 | (hlim : ∀ i j, Tendsto (fun q => A q i j) l (𝓝 (B i j))) |
| 113 | (hpos : ∀ᶠ q in l, (A q).PosSemidef) : B.PosSemidef := by |
| 114 | apply Matrix.PosSemidef.of_dotProduct_mulVec_nonneg |
| 115 | · apply Matrix.IsHermitian.ext |
| 116 | intro i j |
| 117 | simp only [star_trivial] |
| 118 | apply tendsto_nhds_unique_of_eventuallyEq (hlim j i) (hlim i j) |
| 119 | filter_upwards [hpos] with q hq |
| 120 | simpa only [star_trivial] using hq.1.apply i j |
| 121 | · intro v |
| 122 | have hquad : Tendsto (fun q => star v ⬝ᵥ (A q *ᵥ v)) l |
| 123 | (𝓝 (star v ⬝ᵥ (B *ᵥ v))) := by |
| 124 | simp only [dotProduct, Matrix.mulVec] |
| 125 | apply tendsto_finsetSum |
| 126 | intro i _ |
| 127 | apply tendsto_const_nhds.mul |
| 128 | apply tendsto_finsetSum |
| 129 | intro j _ |
| 130 | exact (hlim i j).mul_const (v j) |
| 131 | exact ge_of_tendsto hquad (hpos.mono fun q hq => hq.dotProduct_mulVec_nonneg v) |
| 132 | |
| 133 | /-- Hamilton block positivity is closed under a nonzero elapsed-time limit. |
| 134 | The spatial tensors and frame are fixed; only the reciprocal-time term varies. -/ |
| 135 | theorem hamiltonBlockPos_of_tendsto_elapsedTime {a b : ℝ} |
| 136 | (F : RicciFlow n M (Ioo a b)) (t : ℝ) (x : M) |
| 137 | {ι : Type*} {l : Filter ι} [l.NeBot] {f : ι → ℝ} {τ : ℝ} |
| 138 | (hf : Tendsto f l (𝓝 τ)) (hτ : τ ≠ 0) |
| 139 | (hpos : ∀ᶠ q in l, HamiltonBlockPos F t x (f q)) : |
| 140 | HamiltonBlockPos F t x τ := by |
| 141 | let e := (F.metric t).orthonormalBasis x |
| 142 | let Q (r : ℝ) := Matrix.fromBlocks |
| 143 | (fun ac bd : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) × |
| 144 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) => |
| 145 | (F.connection t).curvatureTensor x (e ac.1) (e ac.2) (e bd.1) (e bd.2)) |
| 146 | (fun ac d => hamiltonP (F.connection t) x (e ac.1) (e ac.2) (e d)) |
| 147 | (fun c bd => hamiltonP (F.connection t) x (e bd.1) (e bd.2) (e c)) |
| 148 | (fun a b => hamiltonM (F.connection t) r x (e a) (e b)) |
| 149 | change (Q τ).PosSemidef |
| 150 | apply posSemidef_of_tendsto_entries (A := fun q => Q (f q)) _ hpos |
| 151 | intro i j |
| 152 | have hentry : ContinuousAt (fun r => Q r i j) τ := by |
| 153 | rcases i with ac | a <;> rcases j with bd | b |
| 154 | · exact continuousAt_const |
| 155 | · exact continuousAt_const |
| 156 | · exact continuousAt_const |
| 157 | · change ContinuousAt (fun r : ℝ => _ + _ / (2 * r)) τ |
| 158 | exact continuousAt_const.add (continuousAt_const.div |
| 159 | (continuousAt_const.mul continuousAt_id) (mul_ne_zero two_ne_zero hτ)) |
| 160 | exact hentry.tendsto.comp hf |
| 161 | |
| 162 | /-- Estimates from all later origins pass to an initial endpoint strictly |
| 163 | before the observation time. -/ |
| 164 | theorem hamiltonBlockPos_of_time_origin_limit {T₀ T₁ a : ℝ} |
| 165 | (F : RicciFlow n M (Ioo T₀ T₁)) (t : ℝ) (x : M) (hat : a < t) |
| 166 | (hpos : ∀ c ∈ Ioo a t, HamiltonBlockPos F t x (t - c)) : |
| 167 | HamiltonBlockPos F t x (t - a) := by |
| 168 | apply hamiltonBlockPos_of_tendsto_elapsedTime F t x |
| 169 | ((continuousAt_const.sub continuousAt_id).tendsto.mono_left |
| 170 | (nhdsWithin_le_nhds : 𝓝[>] a ≤ 𝓝 a)) (sub_pos.mpr hat).ne' |
| 171 | filter_upwards [Ioo_mem_nhdsGT hat] with c hc |
| 172 | exact hpos c hc |
| 173 | |
| 174 | end Poincare.RicciFlow.Harnack |