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 Mathlib.Analysis.Calculus.LocalExtr.Basic |
| 2 | import Mathlib.Analysis.SpecialFunctions.ExpDeriv |
| 3 | import Mathlib.Topology.Order.Compact |
| 4 | import Mathlib.Tactic.Linarith |
| 5 | import Mathlib.Tactic.FunProp |
| 6 | |
| 7 | /-! |
| 8 | # Comparison for a compact family |
| 9 | |
| 10 | A continuous compact family remains nonpositive if its time derivative is |
| 11 | bounded by a common linear reaction at positive spatial maxima. The proof |
| 12 | maximizes an exponentially weighted family on a compact spacetime cylinder. |
| 13 | Only derivatives within the time interval are needed, including at its right |
| 14 | endpoint. No differentiability of the maximum function is asserted. |
| 15 | |
| 16 | This is the scalar comparison step in Morgan--Tian, Theorems 4.7--4.8, |
| 17 | printed p. 66. The tensor contact estimate is a separate geometric step. |
| 18 | -/ |
| 19 | |
| 20 | set_option autoImplicit false |
| 21 | |
| 22 | open Set |
| 23 | open scoped Topology |
| 24 | |
| 25 | namespace Poincare.Parabolic |
| 26 | |
| 27 | private lemma nonneg_deriv_of_max_on_interval {f : ℝ → ℝ} {f' a b t : ℝ} |
| 28 | (ht : t ∈ Ioc a b) (hmax : IsMaxOn f (Icc a b) t) |
| 29 | (hd : HasDerivWithinAt f f' (Icc a b) t) : 0 ≤ f' := by |
| 30 | have hcone : a - t ∈ posTangentConeAt (Icc a b) t := |
| 31 | sub_mem_posTangentConeAt_of_segment_subset |
| 32 | ((convex_Icc a b).segment_subset ⟨ht.1.le, ht.2⟩ ⟨le_rfl, ht.1.le.trans ht.2⟩) |
| 33 | have h := hmax.localize.hasFDerivWithinAt_nonpos hd.hasFDerivWithinAt hcone |
| 34 | change (a - t) * f' ≤ 0 at h |
| 35 | nlinarith [ht.1] |
| 36 | |
| 37 | /-- A compact family with initially nonpositive values stays nonpositive when |
| 38 | every positive spatial maximum has time derivative at most `K` times its value. |
| 39 | The derivatives are taken within the closed time interval. -/ |
| 40 | theorem nonpos_of_deriv_le_mul_at_max |
| 41 | {A : Type*} [TopologicalSpace A] [CompactSpace A] |
| 42 | {F F' : A → ℝ → ℝ} {K a b : ℝ} |
| 43 | (hF : ContinuousOn (Function.uncurry F) (univ ×ˢ Icc a b)) |
| 44 | (hderiv : ∀ q t, t ∈ Ioc a b → |
| 45 | HasDerivWithinAt (F q) (F' q t) (Icc a b) t) |
| 46 | (hmax : ∀ q t, t ∈ Ioc a b → 0 < F q t → |
| 47 | (∀ p, F p t ≤ F q t) → F' q t ≤ K * F q t) |
| 48 | (hinit : ∀ q, F q a ≤ 0) : |
| 49 | ∀ q t, t ∈ Icc a b → F q t ≤ 0 := by |
| 50 | intro q t ht |
| 51 | by_contra hnonpos |
| 52 | have hpos : 0 < F q t := lt_of_not_ge hnonpos |
| 53 | let G : A × ℝ → ℝ := fun p => Real.exp (-(K + 1) * (p.2 - a)) * F p.1 p.2 |
| 54 | have hG : ContinuousOn G (univ ×ˢ Icc a b) := |
| 55 | (show Continuous (fun p : A × ℝ => Real.exp (-(K + 1) * (p.2 - a))) by |
| 56 | fun_prop).continuousOn.mul hF |
| 57 | obtain ⟨⟨p, s⟩, hs, hps⟩ := |
| 58 | (isCompact_univ.prod isCompact_Icc).exists_isMaxOn ⟨(q, t), trivial, ht⟩ hG |
| 59 | have hpsqt : G (q, t) ≤ G (p, s) := hps ⟨trivial, ht⟩ |
| 60 | have hGs : 0 < G (p, s) := |
| 61 | (mul_pos (Real.exp_pos _) hpos).trans_le hpsqt |
| 62 | have hFs : 0 < F p s := (mul_pos_iff_of_pos_left (Real.exp_pos _)).mp hGs |
| 63 | have has : a < s := lt_of_le_of_ne hs.2.1 (by |
| 64 | intro heq |
| 65 | subst s |
| 66 | exact (not_lt_of_ge (hinit p)) hFs) |
| 67 | have hs' : s ∈ Ioc a b := ⟨has, hs.2.2⟩ |
| 68 | have hspace : ∀ r, F r s ≤ F p s := by |
| 69 | intro r |
| 70 | have h := hps (a := (r, s)) ⟨trivial, hs.2⟩ |
| 71 | change G (r, s) ≤ G (p, s) at h |
| 72 | exact (mul_le_mul_iff_right₀ (Real.exp_pos _)).mp h |
| 73 | have htime : IsMaxOn (fun r => G (p, r)) (Icc a b) s := |
| 74 | fun r hr => hps (a := (p, r)) ⟨trivial, hr⟩ |
| 75 | have hexp : HasDerivAt (fun r : ℝ => Real.exp (-(K + 1) * (r - a))) |
| 76 | (Real.exp (-(K + 1) * (s - a)) * (-(K + 1))) s := |
| 77 | by simpa [id_eq] using (((hasDerivAt_id s).sub_const a).const_mul (-(K + 1))).exp |
| 78 | have hd := hexp.hasDerivWithinAt.mul (hderiv p s hs') |
| 79 | have hge := nonneg_deriv_of_max_on_interval hs' htime hd |
| 80 | have hle := hmax p s hs' hFs hspace |
| 81 | have hexppos := Real.exp_pos (-(K + 1) * (s - a)) |
| 82 | nlinarith |
| 83 | |
| 84 | end Poincare.Parabolic |