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.Maximum.CompactDomain |
| 2 | |
| 3 | /-! Adapted from Mapher06/Poincare-MorganTian, `PoincareMT/Proofs/M04/ShiBarrierMaximum.lean`, |
| 4 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. See the curvature import record under |
| 5 | `references/ricci-flow/mapher/curvature/`. -/ |
| 6 | |
| 7 | /-! |
| 8 | # Compact comparison from local upper spacetime supports |
| 9 | |
| 10 | This is the analytic maximum-principle interface used by a Calabi-type Shi |
| 11 | cutoff. A negative minimum is tested against an upper support that is smooth |
| 12 | only at the contact time and has a within-past time derivative. The support |
| 13 | is allowed an arbitrarily small velocity error, which is the form produced by |
| 14 | an approximate distance majorant. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | |
| 19 | open scoped Manifold ContDiff Bundle |
| 20 | open Set Topology Filter |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.RicciFlowAnalysis |
| 25 | |
| 26 | theorem compact_subset_min_velocity_nonnegative_of_upper_support |
| 27 | {M : Type u} [TopologicalSpace M] {C : Set M} (hC : IsCompact C) |
| 28 | {T K : ℝ} (hT : 0 < T) (f : ℝ → M → ℝ) |
| 29 | (hinit : ∀ x ∈ C, 0 ≤ f 0 x) |
| 30 | (hboundary : ∀ t ∈ Icc 0 T, ∀ x ∈ C \ interior C, 0 ≤ f t x) |
| 31 | (hf : ContinuousOn (Function.uncurry f) (Icc 0 T ×ˢ C)) |
| 32 | (hsupport : ∀ t ∈ Ioc 0 T, ∀ x ∈ interior C, |
| 33 | (∀ y ∈ C, f t x ≤ f t y) → f t x < 0 → |
| 34 | ∀ δ > 0, ∃ ψ : ℝ → ℝ, ∃ v : ℝ, |
| 35 | ψ t = f t x ∧ |
| 36 | (∀ᶠ s in 𝓝[Icc 0 t] t, f s x ≤ ψ s) ∧ |
| 37 | HasDerivWithinAt ψ v (Icc 0 t) t ∧ |
| 38 | -K * f t x - δ ≤ v) : |
| 39 | ∀ t ∈ Icc 0 T, ∀ x ∈ C, 0 ≤ f t x := by |
| 40 | intro t ht x hx |
| 41 | by_contra hbad |
| 42 | have hbad' : f t x < 0 := lt_of_not_ge hbad |
| 43 | let q := Real.exp (K * t) * f t x |
| 44 | have hq : q < 0 := mul_neg_of_pos_of_neg (Real.exp_pos _) hbad' |
| 45 | let ε := -q / (T + 1) |
| 46 | have hε : 0 < ε := div_pos (neg_pos.mpr hq) (by linarith) |
| 47 | have hεeq : ε * (T + 1) = -q := |
| 48 | div_mul_cancel₀ (-q) (ne_of_gt (by linarith : 0 < T + 1)) |
| 49 | let w : ℝ → M → ℝ := fun s y ↦ Real.exp (K * s) * f s y + ε * s |
| 50 | have hwbad : w t x < 0 := by |
| 51 | have hlt := mul_lt_mul_of_pos_left (show t < T + 1 by linarith [ht.2]) hε |
| 52 | change q + ε * t < 0 |
| 53 | linarith |
| 54 | let S : Set (ℝ × M) := Icc 0 t ×ˢ C |
| 55 | have hsub : S ⊆ Icc 0 T ×ˢ C := |
| 56 | fun p hp ↦ ⟨⟨hp.1.1, hp.1.2.trans ht.2⟩, hp.2⟩ |
| 57 | have hwc : ContinuousOn (Function.uncurry w) S := |
| 58 | ((Real.continuous_exp.comp (continuous_const.mul continuous_fst)).continuousOn.mul |
| 59 | (hf.mono hsub)).add (continuous_const.mul continuous_fst).continuousOn |
| 60 | obtain ⟨⟨s, y⟩, hsy, hminw⟩ := (isCompact_Icc.prod hC).exists_isMinOn |
| 61 | (show S.Nonempty from ⟨(0, x), ⟨⟨le_rfl, ht.1⟩, hx⟩⟩) hwc |
| 62 | change (s ∈ Icc 0 t) ∧ y ∈ C at hsy |
| 63 | have hwy : w s y < 0 := |
| 64 | (hminw (show (t, x) ∈ S from ⟨⟨ht.1, le_rfl⟩, hx⟩)).trans_lt hwbad |
| 65 | have hspos : 0 < s := by |
| 66 | rcases lt_or_eq_of_le hsy.1.1 with hs | hs |
| 67 | · exact hs |
| 68 | · have hzero : w s y = f 0 y := by simp [w, ← hs] |
| 69 | rw [hzero] at hwy |
| 70 | exact False.elim ((not_lt_of_ge (hinit y hsy.2)) hwy) |
| 71 | have hsJ : s ∈ Icc 0 T := ⟨hspos.le, hsy.1.2.trans ht.2⟩ |
| 72 | have hspace : ∀ z ∈ C, f s y ≤ f s z := by |
| 73 | intro z hz |
| 74 | have h := hminw (show (s, z) ∈ S from ⟨⟨hspos.le, hsy.1.2⟩, hz⟩) |
| 75 | change Real.exp (K * s) * f s y + ε * s ≤ |
| 76 | Real.exp (K * s) * f s z + ε * s at h |
| 77 | exact le_of_mul_le_mul_left (add_le_add_iff_right (ε * s) |>.mp h) |
| 78 | (Real.exp_pos _) |
| 79 | have hfneg : f s y < 0 := by |
| 80 | by_contra h |
| 81 | have hprod := mul_nonneg (Real.exp_pos (K * s)).le (le_of_not_gt h) |
| 82 | have htime := mul_nonneg hε.le hspos.le |
| 83 | change Real.exp (K * s) * f s y + ε * s < 0 at hwy |
| 84 | linarith |
| 85 | have hyint : y ∈ interior C := by |
| 86 | by_contra hn |
| 87 | exact (not_lt_of_ge (hboundary s hsJ y ⟨hsy.2, hn⟩)) hfneg |
| 88 | obtain ⟨ψ, v, hψ, hψtime, hψderiv, hv⟩ := |
| 89 | hsupport s ⟨hspos, hsy.1.2.trans ht.2⟩ y |
| 90 | hyint hspace hfneg (ε / (2 * Real.exp (K * s))) (by positivity) |
| 91 | have htime : IsLocalMinOn |
| 92 | (fun r ↦ Real.exp (K * r) * ψ r + ε * r) (Icc 0 s) s := by |
| 93 | rw [IsLocalMinOn] |
| 94 | filter_upwards [hψtime, self_mem_nhdsWithin] with r hr hrs |
| 95 | have hmin := hminw (show (r, y) ∈ S from |
| 96 | ⟨⟨hrs.1, hrs.2.trans hsy.1.2⟩, hsy.2⟩) |
| 97 | have hle : Real.exp (K * r) * f r y + ε * r ≤ |
| 98 | Real.exp (K * r) * ψ r + ε * r := by |
| 99 | have := mul_le_mul_of_nonneg_left hr (Real.exp_pos (K * r)).le |
| 100 | linarith |
| 101 | calc |
| 102 | Real.exp (K * s) * ψ s + ε * s = |
| 103 | Real.exp (K * s) * f s y + ε * s := by rw [hψ] |
| 104 | _ ≤ Real.exp (K * r) * f r y + ε * r := hmin |
| 105 | _ ≤ Real.exp (K * r) * ψ r + ε * r := hle |
| 106 | have hcone : 0 - s ∈ posTangentConeAt (Icc 0 s) s := |
| 107 | sub_mem_posTangentConeAt_of_segment_subset |
| 108 | (by rw [segment_symm, segment_eq_Icc hspos.le]) |
| 109 | have hdexp : HasDerivAt (fun r : ℝ ↦ Real.exp (K * r)) |
| 110 | (Real.exp (K * s) * K) s := by |
| 111 | simpa only [id_eq, mul_one] using ((hasDerivAt_id s).const_mul K).exp |
| 112 | have hde : HasDerivWithinAt (fun r : ℝ ↦ ε * r) ε (Icc 0 s) s := by |
| 113 | simpa only [id_eq, mul_one] using |
| 114 | (((hasDerivAt_id s).const_mul ε).hasDerivWithinAt) |
| 115 | have hdw : HasDerivWithinAt |
| 116 | (fun r ↦ Real.exp (K * r) * ψ r + ε * r) |
| 117 | (Real.exp (K * s) * (v + K * ψ s) + ε) (Icc 0 s) s := by |
| 118 | convert! (hdexp.hasDerivWithinAt.mul hψderiv).add hde using 1 |
| 119 | ring |
| 120 | have hsign : 0 ≤ (0 - s) * |
| 121 | (Real.exp (K * s) * (v + K * ψ s) + ε) := by |
| 122 | simpa only [ContinuousLinearMap.toSpanSingleton_apply, smul_eq_mul] |
| 123 | using htime.hasFDerivWithinAt_nonneg hdw hcone |
| 124 | have he : 0 < Real.exp (K * s) := Real.exp_pos _ |
| 125 | have hsum : 0 < v + K * f s y + ε / Real.exp (K * s) := by |
| 126 | have hle : ε / (2 * Real.exp (K * s)) ≤ |
| 127 | v + K * f s y + ε / Real.exp (K * s) := by |
| 128 | calc |
| 129 | ε / (2 * Real.exp (K * s)) = |
| 130 | (-K * f s y - ε / (2 * Real.exp (K * s))) + |
| 131 | (K * f s y + ε / Real.exp (K * s)) := by |
| 132 | field_simp [ne_of_gt he] |
| 133 | ring |
| 134 | _ ≤ v + K * f s y + ε / Real.exp (K * s) := by |
| 135 | nlinarith [hv] |
| 136 | exact lt_of_lt_of_le (by positivity) hle |
| 137 | have hpos : 0 < Real.exp (K * s) * (v + K * ψ s) + ε := by |
| 138 | rw [hψ] |
| 139 | have heq : Real.exp (K * s) * (v + K * f s y) + ε = |
| 140 | Real.exp (K * s) * (v + K * f s y + ε / Real.exp (K * s)) := by |
| 141 | field_simp [ne_of_gt he] |
| 142 | rw [heq] |
| 143 | exact mul_pos he hsum |
| 144 | exact (not_lt_of_ge hsign) |
| 145 | (mul_neg_of_neg_of_pos (sub_neg.mpr hspos) hpos) |
| 146 | |
| 147 | end PoincareMT.RicciFlowAnalysis |