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.DerivativeTest |
| 2 | import Mathlib.Analysis.Calculus.LocalExtr.Basic |
| 3 | import Mathlib.Topology.Order.Compact |
| 4 | |
| 5 | /-! |
| 6 | # The strict upper-contact minimum principle |
| 7 | |
| 8 | Morgan-Tian Claim 7.18, with the concavity correction for Corollary 7.19. |
| 9 | A continuous upper contact with negative second derivative excludes a local |
| 10 | minimum. Compact minimization then bounds a continuous interval function |
| 11 | below by the smaller endpoint value. No differentiability of that function |
| 12 | is required. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set Filter |
| 18 | open scoped Topology |
| 19 | |
| 20 | namespace PoincareMT.ReducedVolume |
| 21 | |
| 22 | /-- A negative-second-derivative upper contact is incompatible with a local minimum. -/ |
| 23 | theorem not_isLocalMin_of_strict_upper_contact {f B : ℝ → ℝ} {c : ℝ} |
| 24 | (hcontact : B c = f c) (hupper : ∀ᶠ t in 𝓝 c, f t ≤ B t) |
| 25 | (hcont : ContinuousAt B c) (hsecond : deriv (deriv B) c < 0) : |
| 26 | ¬ IsLocalMin f c := by |
| 27 | intro hmin |
| 28 | have hBmin : IsLocalMin B c := by |
| 29 | filter_upwards [hmin, hupper] with t ht htB |
| 30 | exact hcontact.trans_le (ht.trans htB) |
| 31 | have hBmax := isLocalMax_of_deriv_deriv_neg hsecond hBmin.deriv_eq_zero hcont |
| 32 | have heq : B =ᶠ[𝓝 c] (fun _ ↦ B c) := by |
| 33 | filter_upwards [hBmin, hBmax] with t ht₁ ht₂ |
| 34 | exact le_antisymm ht₂ ht₁ |
| 35 | have hzero : deriv (deriv B) c = 0 := by |
| 36 | simpa only [deriv_const', deriv_const] using heq.deriv.deriv_eq |
| 37 | linarith only [hsecond, hzero] |
| 38 | |
| 39 | /-- Strictly concave upper contacts force the endpoint minimum bound on a compact interval. -/ |
| 40 | theorem min_endpoints_le_of_strict_upper_contacts {f : ℝ → ℝ} {a b : ℝ} |
| 41 | (hab : a < b) (hf : ContinuousOn f (Icc a b)) |
| 42 | (hcontacts : ∀ c ∈ Ioo a b, ∃ B : ℝ → ℝ, |
| 43 | B c = f c ∧ (∀ᶠ t in 𝓝 c, f t ≤ B t) ∧ |
| 44 | ContinuousAt B c ∧ deriv (deriv B) c < 0) |
| 45 | {x : ℝ} (hx : x ∈ Icc a b) : min (f a) (f b) ≤ f x := by |
| 46 | by_contra! hbad |
| 47 | obtain ⟨c, hc, hmin⟩ := isCompact_Icc.exists_isMinOn (nonempty_Icc.mpr hab.le) hf |
| 48 | have hcx : f c ≤ f x := hmin hx |
| 49 | have hca : c ≠ a := by |
| 50 | intro heq |
| 51 | subst c |
| 52 | exact (not_lt_of_ge (hcx.trans' (min_le_left _ _))) hbad |
| 53 | have hcb : c ≠ b := by |
| 54 | intro heq |
| 55 | subst c |
| 56 | exact (not_lt_of_ge (hcx.trans' (min_le_right _ _))) hbad |
| 57 | have hcint : c ∈ Ioo a b := ⟨lt_of_le_of_ne hc.1 hca.symm, lt_of_le_of_ne hc.2 hcb⟩ |
| 58 | obtain ⟨B, hcontact, hupper, hcont, hsecond⟩ := hcontacts c hcint |
| 59 | exact not_isLocalMin_of_strict_upper_contact hcontact hupper hcont hsecond |
| 60 | (hmin.isLocalMin (Icc_mem_nhds hcint.1 hcint.2)) |
| 61 | |
| 62 | end PoincareMT.ReducedVolume |