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 | # Compact comparison with derivatives only at interior times |
| 5 | |
| 6 | Reuse M05's compact maximum comparison, the scalar argument in Morgan--Tian |
| 7 | Theorems 4.7-4.8, p. 66, on each smaller closed slab. Continuity supplies |
| 8 | the final endpoint. This is the time-regularity form needed by Corollary |
| 9 | 19.13 and corrected Lemma 19.14, MT2007 pp. 446-447 and the 2015 correction |
| 10 | pp. 8-9. Spatial differential inequalities enter through the contact bound. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set |
| 16 | |
| 17 | namespace Poincare.Parabolic |
| 18 | |
| 19 | /-- The compact maximum comparison needs no derivative at either endpoint |
| 20 | when the family is jointly continuous on the closed slab. This adapts M05 |
| 21 | for Corollary 19.13 and corrected Lemma 19.14, MT2007 pp. 446-447. -/ |
| 22 | theorem nonpos_of_deriv_le_mul_at_max_interior |
| 23 | {A : Type*} [TopologicalSpace A] [CompactSpace A] |
| 24 | {F V : A → ℝ → ℝ} {K a b : ℝ} (hab : a < b) |
| 25 | (hF : ContinuousOn (Function.uncurry F) (univ ×ˢ Icc a b)) |
| 26 | (hderiv : ∀ q t, t ∈ Ioo a b → HasDerivAt (F q) (V q t) t) |
| 27 | (hmax : ∀ q t, t ∈ Ioo a b → 0 < F q t → |
| 28 | (∀ p, F p t ≤ F q t) → V q t ≤ K * F q t) |
| 29 | (hinit : ∀ q, F q a ≤ 0) : |
| 30 | ∀ q t, t ∈ Icc a b → F q t ≤ 0 := by |
| 31 | have hbefore : ∀ q t, t ∈ Ico a b → F q t ≤ 0 := by |
| 32 | intro q t ht |
| 33 | have hsub : Icc a t ⊆ Icc a b := Icc_subset_Icc_right ht.2.le |
| 34 | have h := nonpos_of_deriv_le_mul_at_max |
| 35 | (hF.mono (Set.prod_mono Subset.rfl hsub)) |
| 36 | (fun p s hs => (hderiv p s ⟨hs.1, hs.2.trans_lt ht.2⟩).hasDerivWithinAt) |
| 37 | (fun p s hs => hmax p s ⟨hs.1, hs.2.trans_lt ht.2⟩) hinit |
| 38 | exact h q t ⟨ht.1, le_rfl⟩ |
| 39 | intro q t ht |
| 40 | have hq : ContinuousOn (F q) (Icc a b) := |
| 41 | hF.comp (continuous_const.prodMk continuous_id).continuousOn |
| 42 | (fun s hs => ⟨mem_univ q, hs⟩) |
| 43 | have hclosure : t ∈ closure (Ico a b) := by |
| 44 | rw [closure_Ico hab.ne] |
| 45 | exact ht |
| 46 | exact ContinuousWithinAt.closure_le hclosure |
| 47 | ((hq t ht).mono Ico_subset_Icc_self) continuousWithinAt_const (hbefore q) |
| 48 | |
| 49 | end Poincare.Parabolic |