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.Riemannian.Heat.Dirichlet.Maximum |
| 2 | import Mathlib.Analysis.Calculus.LocalExtr.Basic |
| 3 | |
| 4 | /-! |
| 5 | # Compact comparison for spatial lower heat contacts |
| 6 | |
| 7 | This is the lower-contact comparison argument from |
| 8 | AxelWorkspace, `HeatPropagation/LowerContacts/Comparison.lean`, adapted to |
| 9 | the retained `LeviCivitaData.laplacian`. It uses a compact spacetime maximum |
| 10 | and its derivative relative to the past; no spatial regularity of the |
| 11 | supersolution is assumed. |
| 12 | -/ |
| 13 | |
| 14 | noncomputable section |
| 15 | open Set Filter |
| 16 | open scoped ContDiff Manifold Topology |
| 17 | |
| 18 | namespace PoincareMT.RicciFlow.Splitting.MaximumPrinciple |
| 19 | |
| 20 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] [T2Space M] |
| 21 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 22 | |
| 23 | /-- A smooth spatial function touching from below admits a differentiable |
| 24 | upper time support whose derivative dominates its retained Laplacian. -/ |
| 25 | def HeatLowerContacts {g : ℝ → RiemannianMetric n M} |
| 26 | (D : ∀ t, LeviCivitaData (g t)) (U : Set M) |
| 27 | (J : Set ℝ) (v : M → ℝ → ℝ) : Prop := |
| 28 | ∀ x ∈ U, ∀ t ∈ J, ∀ (ψ : M → ℝ) (W : Set M), |
| 29 | IsOpen W → x ∈ W → ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ ψ W → |
| 30 | ψ x = v x t → (∀ᶠ y in 𝓝 x, ψ y ≤ v y t) → |
| 31 | ∃ (τ : ℝ → ℝ) (d : ℝ), HasDerivAt τ d t ∧ τ t = v x t ∧ |
| 32 | (∀ᶠ s in 𝓝 t, v x s ≤ τ s) ∧ |
| 33 | (D t).laplacian ψ x ≤ d |
| 34 | |
| 35 | theorem comparison_on_Icc |
| 36 | {D : Set M} (hD : IsCompact D) {g : ℝ → RiemannianMetric n M} |
| 37 | (conn : ∀ t, LeviCivitaData (g t)) |
| 38 | {a b : ℝ} (hab : a < b) {u v ut : M → ℝ → ℝ} |
| 39 | (hu : ContinuousOn (fun z : M × ℝ => u z.1 z.2) (D ×ˢ Icc a b)) |
| 40 | (hv : ContinuousOn (fun z : M × ℝ => v z.1 z.2) (D ×ˢ Icc a b)) |
| 41 | (hus : ∀ t ∈ Ioo a b, |
| 42 | ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun x => u x t) (interior D)) |
| 43 | (hud : ∀ x ∈ interior D, ∀ t ∈ Ioo a b, HasDerivAt (u x) (ut x t) t) |
| 44 | (hup : ∀ x ∈ interior D, ∀ t ∈ Ioo a b, |
| 45 | ut x t ≤ (conn t).laplacian (fun y => u y t) x) |
| 46 | (hvs : HeatLowerContacts conn (interior D) (Ioo a b) v) |
| 47 | (hinit : ∀ x ∈ D, u x a ≤ v x a) |
| 48 | (hlateral : ∀ x ∈ D, x ∉ interior D → ∀ t ∈ Icc a b, u x t ≤ v x t) : |
| 49 | ∀ x ∈ D, ∀ t ∈ Icc a b, u x t ≤ v x t := by |
| 50 | have hprior : ∀ x ∈ D, ∀ t ∈ Ico a b, u x t ≤ v x t := by |
| 51 | intro x hx t ht |
| 52 | by_contra hnot |
| 53 | have hpos : 0 < u x t - v x t := sub_pos.mpr (lt_of_not_ge hnot) |
| 54 | have htpos : a < t := by |
| 55 | rcases ht.1.eq_or_lt with heq | hlt |
| 56 | · exact False.elim ((not_lt_of_ge (hinit x hx)) (heq ▸ lt_of_not_ge hnot)) |
| 57 | · exact hlt |
| 58 | let ε : ℝ := (u x t - v x t) / (2 * (t - a)) |
| 59 | have hε : 0 < ε := div_pos hpos (mul_pos (by norm_num) (sub_pos.mpr htpos)) |
| 60 | let w : M × ℝ → ℝ := fun z => u z.1 z.2 - v z.1 z.2 - ε * (z.2 - a) |
| 61 | have hw : ContinuousOn w (D ×ˢ Icc a t) := |
| 62 | ((hu.sub hv).mono (prod_mono_right (Icc_subset_Icc_right ht.2.le))).sub |
| 63 | (by fun_prop) |
| 64 | obtain ⟨z, hz, hzmax⟩ := (hD.prod isCompact_Icc).exists_isMaxOn |
| 65 | (show (D ×ˢ Icc a t).Nonempty from ⟨(x, t), hx, htpos.le, le_rfl⟩) hw |
| 66 | have hwxt : 0 < w (x, t) := by |
| 67 | dsimp [w, ε] |
| 68 | have htne : t - a ≠ 0 := (sub_pos.mpr htpos).ne' |
| 69 | field_simp |
| 70 | nlinarith |
| 71 | have hwz : 0 < w z := hwxt.trans_le (hzmax ⟨hx, htpos.le, le_rfl⟩) |
| 72 | have hzT : z.2 ∈ Icc a b := ⟨hz.2.1, hz.2.2.trans ht.2.le⟩ |
| 73 | have hzpos : a < z.2 := by |
| 74 | by_contra hn |
| 75 | have hza : z.2 = a := le_antisymm (le_of_not_gt hn) hz.2.1 |
| 76 | have hi := hinit z.1 hz.1 |
| 77 | have hp : 0 < u z.1 a - v z.1 a := by simpa [w, hza] using hwz |
| 78 | linarith |
| 79 | have huz : v z.1 z.2 < u z.1 z.2 := by |
| 80 | have := mul_nonneg hε.le (sub_nonneg.mpr hz.2.1) |
| 81 | dsimp [w] at hwz |
| 82 | linarith |
| 83 | have hzU : z.1 ∈ interior D := by |
| 84 | by_contra hn |
| 85 | exact (not_lt_of_ge (hlateral z.1 hz.1 hn z.2 hzT)) huz |
| 86 | have hzI : z.2 ∈ Ioo a b := ⟨hzpos, hz.2.2.trans_lt ht.2⟩ |
| 87 | let C := u z.1 z.2 - v z.1 z.2 |
| 88 | let ψ : M → ℝ := fun y => u y z.2 - C |
| 89 | have hψs : ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ ψ (interior D) := |
| 90 | (hus z.2 hzI).sub contMDiffOn_const |
| 91 | have hψeq : ψ z.1 = v z.1 z.2 := by dsimp [ψ, C]; ring |
| 92 | have hψle : ∀ᶠ y in 𝓝 z.1, ψ y ≤ v y z.2 := by |
| 93 | filter_upwards [isOpen_interior.mem_nhds hzU] with y hy |
| 94 | have h := hzmax (show (y, z.2) ∈ D ×ˢ Icc a t from ⟨interior_subset hy, hz.2⟩) |
| 95 | dsimp [w, ψ, C] at * |
| 96 | linarith |
| 97 | obtain ⟨τ, d, hτd, hτeq, hτge, hψp⟩ := |
| 98 | hvs z.1 hzU z.2 hzI ψ (interior D) isOpen_interior hzU hψs hψeq hψle |
| 99 | have hψlap : (conn z.2).laplacian ψ z.1 = |
| 100 | (conn z.2).laplacian (fun y => u y z.2) z.1 := by |
| 101 | change (conn z.2).laplacian |
| 102 | (fun y => u y z.2 - C) z.1 = _ |
| 103 | rw [LeviCivitaData.Dirichlet.laplacian_sub_on (conn z.2) isOpen_interior |
| 104 | (hus z.2 hzI) (show ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ |
| 105 | (fun _ : M => C) (interior D) from contMDiffOn_const) hzU] |
| 106 | have hconst : (conn z.2).laplacian (fun _ : M => C) z.1 = 0 := by |
| 107 | simp [LeviCivitaData.laplacian, LeviCivitaData.hessian, |
| 108 | LeviCivitaData.hessianOnFields, mvfderiv_const] |
| 109 | rw [hconst, sub_zero] |
| 110 | rw [hψlap] at hψp |
| 111 | have hp := hup z.1 hzU z.2 hzI |
| 112 | have hd : HasDerivAt (fun s => u z.1 s - τ s - ε * (s - a)) |
| 113 | (ut z.1 z.2 - d - ε) z.2 := by |
| 114 | convert ((hud z.1 hzU z.2 hzI).sub hτd).sub |
| 115 | (((hasDerivAt_id z.2).sub_const a).const_mul ε) using 1 <;> |
| 116 | first | rfl | simp |
| 117 | have htm : IsLocalMaxOn (fun s => u z.1 s - τ s - ε * (s - a)) |
| 118 | (Icc a t) z.2 := by |
| 119 | filter_upwards [self_mem_nhdsWithin, hτge.filter_mono nhdsWithin_le_nhds] |
| 120 | with s hs hτs |
| 121 | have h := hzmax (show (z.1, s) ∈ D ×ˢ Icc a t from ⟨hz.1, hs⟩) |
| 122 | dsimp [w] at h |
| 123 | change u z.1 s - τ s - ε * (s - a) ≤ |
| 124 | u z.1 z.2 - τ z.2 - ε * (z.2 - a) |
| 125 | rw [hτeq] |
| 126 | linarith |
| 127 | have hcone : a - z.2 ∈ posTangentConeAt (Icc a t) z.2 := |
| 128 | sub_mem_posTangentConeAt_of_segment_subset |
| 129 | ((convex_Icc a t).segment_subset hz.2 ⟨le_rfl, htpos.le⟩) |
| 130 | have hdpos := htm.hasFDerivWithinAt_nonpos hd.hasDerivWithinAt.hasFDerivWithinAt hcone |
| 131 | simp only [ContinuousLinearMap.toSpanSingleton_apply, smul_eq_mul] at hdpos |
| 132 | nlinarith |
| 133 | intro x hx t ht |
| 134 | have huc : ContinuousOn (u x) (Icc a b) := |
| 135 | hu.comp (continuous_const.prodMk continuous_id).continuousOn (fun s hs => ⟨hx, hs⟩) |
| 136 | have hvc : ContinuousOn (v x) (Icc a b) := |
| 137 | hv.comp (continuous_const.prodMk continuous_id).continuousOn (fun s hs => ⟨hx, hs⟩) |
| 138 | have h := le_on_closure (hprior x hx) |
| 139 | (show ContinuousOn (u x) (closure (Ico a b)) by simpa [closure_Ico hab.ne] using huc) |
| 140 | (show ContinuousOn (v x) (closure (Ico a b)) by simpa [closure_Ico hab.ne] using hvc) |
| 141 | exact h (by simpa [closure_Ico hab.ne] using ht) |
| 142 | |
| 143 | end PoincareMT.RicciFlow.Splitting.MaximumPrinciple |
| 144 | |
| 145 | |
| 146 |