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.Parabolic.CompactMaximum |
| 2 | |
| 3 | /-! |
| 4 | # Localization of scalar parabolic comparison |
| 5 | |
| 6 | A family whose positive values are confined to a compact spatial set satisfies |
| 7 | the compact-family maximum principle without compactness of the ambient space. |
| 8 | Subtracting a positive proper exhaustion from a bounded family supplies this |
| 9 | localization. This is the scalar localization step in the noncompact Harnack |
| 10 | argument of Chow et al., Part II, Lemmas 15.23-15.24, pp. 283-287. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set |
| 16 | |
| 17 | namespace Poincare.Parabolic |
| 18 | |
| 19 | /-- Spatial compactness is needed only where the scalar family is positive. -/ |
| 20 | lemma nonpos_of_deriv_le_mul_at_max_of_nonpos_outside_compact |
| 21 | {X : Type*} [TopologicalSpace X] |
| 22 | {F F' : X → ℝ → ℝ} {c a b : ℝ} {K : Set X} (hK : IsCompact K) |
| 23 | (hF : ContinuousOn (Function.uncurry F) (univ ×ˢ Icc a b)) |
| 24 | (hderiv : ∀ q t, t ∈ Ioc a b → |
| 25 | HasDerivWithinAt (F q) (F' q t) (Icc a b) t) |
| 26 | (hmax : ∀ q t, t ∈ Ioc a b → 0 < F q t → |
| 27 | (∀ p, F p t ≤ F q t) → F' q t ≤ c * F q t) |
| 28 | (hinit : ∀ q, F q a ≤ 0) |
| 29 | (houtside : ∀ q ∉ K, ∀ t ∈ Icc a b, F q t ≤ 0) : |
| 30 | ∀ q t, t ∈ Icc a b → F q t ≤ 0 := by |
| 31 | let : CompactSpace K := isCompact_iff_compactSpace.mp hK |
| 32 | have hrestricted : ContinuousOn |
| 33 | (fun p : K × ℝ => F p.1 p.2) (univ ×ˢ Icc a b) := by |
| 34 | apply hF.comp |
| 35 | (((continuous_subtype_val.comp continuous_fst).prodMk continuous_snd).continuousOn) |
| 36 | exact fun p hp => ⟨trivial, hp.2⟩ |
| 37 | have hcompare := nonpos_of_deriv_le_mul_at_max |
| 38 | (F := fun (q : K) t => F q t) (F' := fun (q : K) t => F' q t) hrestricted |
| 39 | (fun q t ht => hderiv q t ht) (K := c) (fun q t ht hpos hsp => ?_) |
| 40 | (fun q => hinit q) |
| 41 | · intro q t ht |
| 42 | by_cases hq : q ∈ K |
| 43 | · exact hcompare ⟨q, hq⟩ t ht |
| 44 | · exact houtside q hq t ht |
| 45 | · apply hmax q t ht hpos |
| 46 | intro p |
| 47 | by_cases hp : p ∈ K |
| 48 | · exact hsp ⟨p, hp⟩ |
| 49 | · exact (houtside p hp t ⟨ht.1.le, ht.2⟩).trans hpos.le |
| 50 | |
| 51 | /-- A proper lower barrier confines the positive part of any uniformly bounded |
| 52 | scalar family to one compact set, uniformly in the time parameter. -/ |
| 53 | lemma exists_compact_nonpos_outside_of_barrier |
| 54 | {X I : Type*} [TopologicalSpace X] |
| 55 | {h : X → ℝ} (hproper : ∀ r, IsCompact {x | h x ≤ r}) |
| 56 | {u φ : X → I → ℝ} {B ε : ℝ} (hε : 0 < ε) |
| 57 | (hu : ∀ x t, u x t ≤ B) (hφ : ∀ x t, ε * h x ≤ φ x t) : |
| 58 | ∃ K : Set X, IsCompact K ∧ ∀ x ∉ K, ∀ t, u x t - φ x t ≤ 0 := by |
| 59 | refine ⟨{x | h x ≤ B / ε}, hproper _, ?_⟩ |
| 60 | intro x hx t |
| 61 | have hh : B / ε < h x := lt_of_not_ge hx |
| 62 | have hh' : B < ε * h x := by |
| 63 | simpa only [mul_comm] using (div_lt_iff₀ hε).mp hh |
| 64 | linarith [hu x t, hφ x t] |
| 65 | |
| 66 | end Poincare.Parabolic |