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 | import Mathlib.Topology.Order.IntermediateValue |
| 3 | |
| 4 | /-! |
| 5 | # Strict positivity from a first-contact argument |
| 6 | |
| 7 | Initial positivity and positivity outside a compact region confine a first |
| 8 | zero to a compact cylinder. Its left time derivative is nonpositive, so a |
| 9 | strictly positive derivative at every first zero preserves positivity. |
| 10 | |
| 11 | This is the topological first-contact step in Chow et al., Part II, |
| 12 | Section 15.4.5, printed p. 287, in the proof of Theorem 15.1. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set |
| 18 | |
| 19 | namespace Poincare.Parabolic |
| 20 | |
| 21 | /-- A family stays strictly positive if its first zero would have a positive |
| 22 | time derivative. All possible zeros must lie in one compact spatial set; |
| 23 | time derivatives are taken within the closed interval, including its end. -/ |
| 24 | theorem pos_of_deriv_pos_at_first_zero_of_pos_outside_compact |
| 25 | {X : Type*} [TopologicalSpace X] |
| 26 | {F F' : X → ℝ → ℝ} {a b : ℝ} {K : Set X} (hK : IsCompact K) |
| 27 | (hF : ContinuousOn (Function.uncurry F) (univ ×ˢ Icc a b)) |
| 28 | (hderiv : ∀ q t, t ∈ Ioc a b → |
| 29 | HasDerivWithinAt (F q) (F' q t) (Icc a b) t) |
| 30 | (hcontact : ∀ q t, t ∈ Ioc a b → F q t = 0 → |
| 31 | (∀ p, 0 ≤ F p t) → 0 < F' q t) |
| 32 | (hinit : ∀ q, 0 < F q a) |
| 33 | (houtside : ∀ q ∉ K, ∀ t ∈ Icc a b, 0 < F q t) : |
| 34 | ∀ q t, t ∈ Icc a b → 0 < F q t := by |
| 35 | let : CompactSpace K := isCompact_iff_compactSpace.mp hK |
| 36 | have htime (q : X) : ContinuousOn (F q) (Icc a b) := |
| 37 | hF.comp (continuous_const.prodMk continuous_id).continuousOn |
| 38 | (fun s hs => ⟨trivial, hs⟩) |
| 39 | have hroot (q : X) {t : ℝ} (ht : t ∈ Icc a b) (hqt : F q t ≤ 0) : |
| 40 | ∃ s ∈ Icc a t, F q s = 0 := |
| 41 | intermediate_value_Icc' ht.1 |
| 42 | ((htime q).mono (Icc_subset_Icc_right ht.2)) ⟨hqt, (hinit q).le⟩ |
| 43 | have hzero_mem (q : X) {t : ℝ} (ht : t ∈ Icc a b) (hz : F q t = 0) : |
| 44 | q ∈ K := by |
| 45 | by_contra hq |
| 46 | have hp := houtside q hq t ht |
| 47 | linarith |
| 48 | let Z : Set (K × Icc a b) := {z | F z.1 z.2 = 0} |
| 49 | have hcont : Continuous (fun z : K × Icc a b => F z.1 z.2) := |
| 50 | hF.comp_continuous |
| 51 | ((continuous_subtype_val.comp continuous_fst).prodMk |
| 52 | (continuous_subtype_val.comp continuous_snd)) |
| 53 | (fun z => ⟨trivial, z.2.property⟩) |
| 54 | have hZ : IsCompact Z := (isClosed_eq hcont continuous_const).isCompact |
| 55 | intro q t ht |
| 56 | by_contra hpos |
| 57 | obtain ⟨r, hr, hqr⟩ := hroot q ht (le_of_not_gt hpos) |
| 58 | have hr' : r ∈ Icc a b := ⟨hr.1, hr.2.trans ht.2⟩ |
| 59 | have hne : Z.Nonempty := ⟨(⟨q, hzero_mem q hr' hqr⟩, ⟨r, hr'⟩), hqr⟩ |
| 60 | obtain ⟨z, hz, hmin⟩ := hZ.exists_isMinOn hne |
| 61 | (continuous_subtype_val.comp continuous_snd).continuousOn |
| 62 | have haz : a < (z.2 : ℝ) := lt_of_le_of_ne z.2.property.1 (by |
| 63 | intro heq |
| 64 | have hp := hinit z.1 |
| 65 | change F z.1 z.2 = 0 at hz |
| 66 | rw [← heq] at hz |
| 67 | linarith) |
| 68 | have hnonneg (p : X) {s : ℝ} (hs : s ∈ Icc a (z.2 : ℝ)) : |
| 69 | 0 ≤ F p s := by |
| 70 | by_contra hp |
| 71 | have hneg : F p s < 0 := lt_of_not_ge hp |
| 72 | have hs' : s ∈ Icc a b := ⟨hs.1, hs.2.trans z.2.property.2⟩ |
| 73 | obtain ⟨r, hr, hpr⟩ := hroot p hs' hneg.le |
| 74 | have hrs : r < s := lt_of_le_of_ne hr.2 (by |
| 75 | intro heq |
| 76 | rw [heq] at hpr |
| 77 | linarith) |
| 78 | have hr' : r ∈ Icc a b := ⟨hr.1, hr.2.trans hs'.2⟩ |
| 79 | have hm := hmin (a := (⟨p, hzero_mem p hr' hpr⟩, ⟨r, hr'⟩)) hpr |
| 80 | exact (not_lt_of_ge hm) (hrs.trans_le hs.2) |
| 81 | have hzt : (z.2 : ℝ) ∈ Ioc a b := ⟨haz, z.2.property.2⟩ |
| 82 | have hder := (hderiv z.1 z.2 hzt).mono |
| 83 | (Icc_subset_Icc_right z.2.property.2) |
| 84 | have htime_min : IsMinOn (F z.1) (Icc a (z.2 : ℝ)) z.2 := by |
| 85 | intro s hs |
| 86 | change F z.1 z.2 ≤ F z.1 s |
| 87 | rw [show F z.1 z.2 = 0 from hz] |
| 88 | exact hnonneg z.1 hs |
| 89 | have hcone : a - (z.2 : ℝ) ∈ posTangentConeAt (Icc a (z.2 : ℝ)) z.2 := |
| 90 | sub_mem_posTangentConeAt_of_segment_subset |
| 91 | ((convex_Icc a (z.2 : ℝ)).segment_subset ⟨haz.le, le_rfl⟩ ⟨le_rfl, haz.le⟩) |
| 92 | have hd := htime_min.localize.hasFDerivWithinAt_nonneg hder.hasFDerivWithinAt hcone |
| 93 | change 0 ≤ (a - (z.2 : ℝ)) * F' z.1 z.2 at hd |
| 94 | have hp := hcontact z.1 z.2 hzt hz |
| 95 | (fun p => hnonneg p ⟨haz.le, le_rfl⟩) |
| 96 | nlinarith |
| 97 | |
| 98 | end Poincare.Parabolic |