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.Geometry.RicciFlow.Frame.Transport |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 3 | |
| 4 | /-! |
| 5 | # Linear transport on a half-open time interval |
| 6 | |
| 7 | Compact-interval solutions agree by uniqueness. Their values therefore define |
| 8 | one transport on the entire interval, including its initial endpoint. |
| 9 | This is the continuation step in Morgan--Tian, equation (3.9) and Claim 3.16, |
| 10 | printed p. 42. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | |
| 15 | open Set Filter |
| 16 | open scoped Topology NNReal ContDiff |
| 17 | |
| 18 | namespace PoincareMT.RicciFlow.Frame |
| 19 | |
| 20 | variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] |
| 21 | [CompleteSpace V] [FiniteDimensional ℝ V] |
| 22 | |
| 23 | private lemma exists_bound {A : ℝ → V →L[ℝ] V} {a b : ℝ} |
| 24 | (hA : ContinuousOn A (Icc a b)) : |
| 25 | ∃ K : ℝ≥0, ∀ t ∈ Icc a b, ‖A t‖₊ ≤ K := by |
| 26 | obtain ⟨K, hK⟩ := isCompact_Icc.bddAbove_image hA.nnnorm |
| 27 | exact ⟨K, fun t ht => hK (mem_image_of_mem _ ht)⟩ |
| 28 | |
| 29 | /-- Compact transport with the coefficient bound obtained by compactness. -/ |
| 30 | def compactTransport (A : ℝ → V →L[ℝ] V) {a b : ℝ} (hab : a ≤ b) |
| 31 | (hA : ContinuousOn A (Icc a b)) : ℝ → V →L[ℝ] V := |
| 32 | transportCurveOn A hab hA (exists_bound hA).choose_spec |
| 33 | |
| 34 | @[simp] theorem compactTransport_left |
| 35 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} (hab : a ≤ b) |
| 36 | (hA : ContinuousOn A (Icc a b)) : |
| 37 | compactTransport A hab hA a = ContinuousLinearMap.id ℝ V := |
| 38 | transportCurveOn_left A hab hA _ |
| 39 | |
| 40 | theorem compactTransport_hasDerivWithinAt |
| 41 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} (hab : a ≤ b) |
| 42 | (hA : ContinuousOn A (Icc a b)) {t : ℝ} (ht : t ∈ Icc a b) : |
| 43 | HasDerivWithinAt (compactTransport A hab hA) |
| 44 | ((A t).comp (compactTransport A hab hA t)) (Icc a b) t := |
| 45 | transportCurveOn_hasDerivWithinAt A hab hA _ ht |
| 46 | |
| 47 | theorem compactTransport_eqOn_of_le |
| 48 | (A : ℝ → V →L[ℝ] V) {a b c : ℝ} (hab : a ≤ b) (hbc : b ≤ c) |
| 49 | (hA : ContinuousOn A (Icc a b)) (hA' : ContinuousOn A (Icc a c)) : |
| 50 | EqOn (compactTransport A hab hA) |
| 51 | (compactTransport A (hab.trans hbc) hA') (Icc a b) := by |
| 52 | apply transportCurveOn_eqOn A hab hA _ (compactTransport_left A _ _) |
| 53 | intro t ht |
| 54 | exact (compactTransport_hasDerivWithinAt A (hab.trans hbc) hA' |
| 55 | ⟨ht.1, ht.2.trans hbc⟩).mono (Icc_subset_Icc le_rfl hbc) |
| 56 | |
| 57 | /-- The unique identity-initialized transport on the flow's half-open domain. -/ |
| 58 | def transportIco (A : ℝ → V →L[ℝ] V) (a b : ℝ) |
| 59 | (hA : ContinuousOn A (Ico a b)) (t : ℝ) : V →L[ℝ] V := |
| 60 | if ht : t ∈ Ico a b then |
| 61 | compactTransport A ht.1 (hA.mono (Icc_subset_Ico_right ht.2)) t |
| 62 | else ContinuousLinearMap.id ℝ V |
| 63 | |
| 64 | theorem transportIco_eq_compactTransport |
| 65 | (A : ℝ → V →L[ℝ] V) {a b c : ℝ} |
| 66 | (hA : ContinuousOn A (Ico a b)) (hac : a ≤ c) (hcb : c < b) : |
| 67 | EqOn (transportIco A a b hA) |
| 68 | (compactTransport A hac (hA.mono (Icc_subset_Ico_right hcb))) (Icc a c) := by |
| 69 | intro t ht |
| 70 | have htb : t < b := ht.2.trans_lt hcb |
| 71 | simp only [transportIco, dif_pos (show t ∈ Ico a b from ⟨ht.1, htb⟩)] |
| 72 | exact compactTransport_eqOn_of_le A ht.1 ht.2 _ _ ⟨ht.1, le_rfl⟩ |
| 73 | |
| 74 | @[simp] theorem transportIco_left |
| 75 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} (hab : a < b) |
| 76 | (hA : ContinuousOn A (Ico a b)) : |
| 77 | transportIco A a b hA a = ContinuousLinearMap.id ℝ V := by |
| 78 | simp only [transportIco, dif_pos (show a ∈ Ico a b from ⟨le_rfl, hab⟩), |
| 79 | compactTransport_left] |
| 80 | |
| 81 | theorem transportIco_hasDerivWithinAt |
| 82 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} |
| 83 | (hA : ContinuousOn A (Ico a b)) {t : ℝ} (ht : t ∈ Ico a b) : |
| 84 | HasDerivWithinAt (transportIco A a b hA) |
| 85 | ((A t).comp (transportIco A a b hA t)) (Ico a b) t := by |
| 86 | obtain ⟨c, htc, hcb⟩ := exists_between ht.2 |
| 87 | have hac : a ≤ c := ht.1.trans htc.le |
| 88 | have heq := transportIco_eq_compactTransport A hA hac hcb |
| 89 | have hset : (Icc a c : Set ℝ) =ᶠ[𝓝 t] Ico a b := by |
| 90 | filter_upwards [isOpen_Iio.mem_nhds htc] with s hs |
| 91 | exact propext ⟨fun h => ⟨h.1, h.2.trans_lt hcb⟩, fun h => ⟨h.1, hs.le⟩⟩ |
| 92 | have hd := compactTransport_hasDerivWithinAt A hac |
| 93 | (hA.mono (Icc_subset_Ico_right hcb)) (show t ∈ Icc a c from ⟨ht.1, htc.le⟩) |
| 94 | rw [heq ⟨ht.1, htc.le⟩] |
| 95 | apply (hd.congr_set hset).congr_of_eventuallyEq |
| 96 | · filter_upwards [nhdsWithin_le_nhds (isOpen_Iio.mem_nhds htc), |
| 97 | self_mem_nhdsWithin] with s hs hs' |
| 98 | exact heq ⟨hs'.1, hs.le⟩ |
| 99 | · exact heq ⟨ht.1, htc.le⟩ |
| 100 | |
| 101 | theorem transportIco_continuousOn |
| 102 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} |
| 103 | (hA : ContinuousOn A (Ico a b)) : |
| 104 | ContinuousOn (transportIco A a b hA) (Ico a b) := |
| 105 | fun _ ht => (transportIco_hasDerivWithinAt A hA ht).continuousWithinAt |
| 106 | |
| 107 | theorem transportIco_bijective |
| 108 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} |
| 109 | (hA : ContinuousOn A (Ico a b)) {t : ℝ} (ht : t ∈ Ico a b) : |
| 110 | Function.Bijective (transportIco A a b hA t) := by |
| 111 | simp only [transportIco, dif_pos ht, compactTransport] |
| 112 | exact transportCurveOn_bijective A ht.1 _ _ ⟨ht.1, le_rfl⟩ |
| 113 | |
| 114 | /-- Smooth coefficients give smooth time dependence, including the initial endpoint. -/ |
| 115 | theorem transportIco_contDiffOn |
| 116 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} |
| 117 | (hA : ContDiffOn ℝ ∞ A (Ico a b)) : |
| 118 | ContDiffOn ℝ ∞ (transportIco A a b hA.continuousOn) (Ico a b) := by |
| 119 | have hder := fun {t : ℝ} (ht : t ∈ Ico a b) => |
| 120 | transportIco_hasDerivWithinAt A hA.continuousOn ht |
| 121 | have hdiff : DifferentiableOn ℝ |
| 122 | (transportIco A a b hA.continuousOn) (Ico a b) := |
| 123 | fun _ ht => (hder ht).differentiableWithinAt |
| 124 | have heq : EqOn (derivWithin (transportIco A a b hA.continuousOn) (Ico a b)) |
| 125 | (fun t => (A t).comp (transportIco A a b hA.continuousOn t)) (Ico a b) := |
| 126 | fun t ht => (hder ht).derivWithin (uniqueDiffOn_Ico a b t ht) |
| 127 | rw [contDiffOn_infty] |
| 128 | intro k |
| 129 | induction k with |
| 130 | | zero => exact contDiffOn_zero.mpr (transportIco_continuousOn A hA.continuousOn) |
| 131 | | succ k ih => |
| 132 | rw [show ((k + 1 : ℕ) : WithTop ℕ∞) = (k : WithTop ℕ∞) + 1 by simp] |
| 133 | apply (contDiffOn_succ_iff_derivWithin (uniqueDiffOn_Ico a b)).mpr |
| 134 | refine ⟨hdiff, by simp, ?_⟩ |
| 135 | refine (hA.of_le (show (k : WithTop ℕ∞) ≤ ∞ from |
| 136 | WithTop.coe_le_coe.mpr le_top)).clm_comp ih |>.congr ?_ |
| 137 | intro t ht |
| 138 | exact heq ht |
| 139 | |
| 140 | /-- Metric preservation for the transport constructed on the whole flow domain. -/ |
| 141 | theorem transportIco_pairing |
| 142 | (A : ℝ → V →L[ℝ] V) {a b : ℝ} (hab : a < b) |
| 143 | (hA : ContinuousOn A (Ico a b)) |
| 144 | (g r : ℝ → V →L[ℝ] V →L[ℝ] ℝ) |
| 145 | (hg : ∀ t ∈ Ico a b, HasDerivWithinAt g ((-2 : ℝ) • r t) (Ico a b) t) |
| 146 | (hleft : ∀ t ∈ Ico a b, ∀ v w, g t (A t v) w = r t v w) |
| 147 | (hright : ∀ t ∈ Ico a b, ∀ v w, g t v (A t w) = r t v w) |
| 148 | {t : ℝ} (ht : t ∈ Ico a b) (v w : V) : |
| 149 | g t (transportIco A a b hA t v) (transportIco A a b hA t w) = g a v w := by |
| 150 | let Φ := transportIco A a b hA |
| 151 | let f := fun s => g s (Φ s v) (Φ s w) |
| 152 | have hzero : ∀ s ∈ Ico a b, HasDerivWithinAt f 0 (Ico a b) s := by |
| 153 | intro s hs |
| 154 | have hd := transportIco_hasDerivWithinAt A hA hs |
| 155 | have hv := hd.clm_apply (hasDerivWithinAt_const s (Ico a b) v) |
| 156 | have hw := hd.clm_apply (hasDerivWithinAt_const s (Ico a b) w) |
| 157 | have hp := ((hg s hs).clm_apply hv).clm_apply hw |
| 158 | apply hp.congr_deriv |
| 159 | simp only [add_apply, smul_apply, |
| 160 | ContinuousLinearMap.comp_apply, map_zero, add_zero] |
| 161 | rw [hleft s hs, hright s hs] |
| 162 | ring |
| 163 | obtain ⟨c, htc, hcb⟩ := exists_between ht.2 |
| 164 | have hac : a < c := ht.1.trans_lt htc |
| 165 | have hsub : Icc a c ⊆ Ico a b := Icc_subset_Ico_right hcb |
| 166 | have hdiff : DifferentiableOn ℝ f (Icc a c) := |
| 167 | fun s hs => ((hzero s (hsub hs)).mono hsub).differentiableWithinAt |
| 168 | have hderiv : ∀ s ∈ Ico a c, derivWithin f (Icc a c) s = 0 := |
| 169 | fun s hs => ((hzero s (hsub ⟨hs.1, hs.2.le⟩)).mono hsub).derivWithin |
| 170 | (uniqueDiffOn_Icc hac s ⟨hs.1, hs.2.le⟩) |
| 171 | have hconst := constant_of_derivWithin_zero hdiff hderiv t ⟨ht.1, htc.le⟩ |
| 172 | simpa only [f, Φ, transportIco_left A hab hA, ContinuousLinearMap.id_apply] using hconst |
| 173 | |
| 174 | end PoincareMT.RicciFlow.Frame |