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.Basic |
| 2 | import Mathlib.Geometry.Manifold.ContMDiff.Defs |
| 3 | import Mathlib.Tactic.Linarith |
| 4 | |
| 5 | /-! |
| 6 | # Gluing ordinary Ricci flows on an open overlap |
| 7 | |
| 8 | The metric and its dependent connection are selected together. Agreement of |
| 9 | the two metrics on their time overlap supplies joint smoothness across the |
| 10 | cut; the evolution equation uses the connection selected at the tested time. |
| 11 | No equality of the full connection records is needed. |
| 12 | |
| 13 | Source: Morgan--Tian Theorem 3.11, pp. 39-40, and Proposition 4.12, p. 68. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Manifold ContDiff Topology |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.M51Ordinary |
| 24 | |
| 25 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 27 | {a T B : ℝ} |
| 28 | |
| 29 | noncomputable def overlapData (F : RicciFlow n M (Ico 0 T)) |
| 30 | (G : RicciFlow n M (Ico a B)) (c t : ℝ) : |
| 31 | Σ g : RiemannianMetric n M, LeviCivitaData g := |
| 32 | if t < c then ⟨F.metric t, F.connection t⟩ else ⟨G.metric t, G.connection t⟩ |
| 33 | |
| 34 | noncomputable def overlapMetric (F : RicciFlow n M (Ico 0 T)) |
| 35 | (G : RicciFlow n M (Ico a B)) (c t : ℝ) : RiemannianMetric n M := |
| 36 | (overlapData F G c t).1 |
| 37 | |
| 38 | noncomputable def overlapConnection (F : RicciFlow n M (Ico 0 T)) |
| 39 | (G : RicciFlow n M (Ico a B)) (c t : ℝ) : |
| 40 | LeviCivitaData (overlapMetric F G c t) := |
| 41 | (overlapData F G c t).2 |
| 42 | |
| 43 | variable (F : RicciFlow n M (Ico 0 T)) (G : RicciFlow n M (Ico a B)) |
| 44 | (c : ℝ) |
| 45 | |
| 46 | theorem overlapMetric_eq_left (hac : a < c) |
| 47 | (hmetric : EqOn F.metric G.metric (Ico a T)) : |
| 48 | EqOn (overlapMetric F G c) F.metric (Ico 0 T) := by |
| 49 | intro t ht |
| 50 | by_cases htc : t < c |
| 51 | · simp only [overlapMetric, overlapData, if_pos htc] |
| 52 | · simpa only [overlapMetric, overlapData, if_neg htc] using |
| 53 | (hmetric ⟨hac.le.trans (le_of_not_gt htc), ht.2⟩).symm |
| 54 | |
| 55 | theorem overlapMetric_eq_right (hcT : c < T) |
| 56 | (hmetric : EqOn F.metric G.metric (Ico a T)) : |
| 57 | EqOn (overlapMetric F G c) G.metric (Ico a B) := by |
| 58 | intro t ht |
| 59 | by_cases htc : t < c |
| 60 | · simpa only [overlapMetric, overlapData, if_pos htc] using |
| 61 | hmetric ⟨ht.1, htc.trans hcT⟩ |
| 62 | · simp only [overlapMetric, overlapData, if_neg htc] |
| 63 | |
| 64 | theorem overlapConnection_ricci_left {t : ℝ} (htc : t < c) |
| 65 | (x : M) (v w : TangentSpace (𝓡 n) x) : |
| 66 | (overlapConnection F G c t).ricci x v w = (F.connection t).ricci x v w := by |
| 67 | have hd : overlapData F G c t = ⟨F.metric t, F.connection t⟩ := if_pos htc |
| 68 | exact congrArg (fun p : Σ g : RiemannianMetric n M, LeviCivitaData g => |
| 69 | p.2.ricci x v w) hd |
| 70 | |
| 71 | theorem overlapConnection_ricci_right {t : ℝ} (hct : c ≤ t) |
| 72 | (x : M) (v w : TangentSpace (𝓡 n) x) : |
| 73 | (overlapConnection F G c t).ricci x v w = (G.connection t).ricci x v w := by |
| 74 | have hd : overlapData F G c t = ⟨G.metric t, G.connection t⟩ := |
| 75 | if_neg (not_lt.mpr hct) |
| 76 | exact congrArg (fun p : Σ g : RiemannianMetric n M, LeviCivitaData g => |
| 77 | p.2.ricci x v w) hd |
| 78 | |
| 79 | theorem overlapMetric_smooth (hc : c ∈ Ioo a T) |
| 80 | (hmetric : EqOn F.metric G.metric (Ico a T)) : |
| 81 | RiemannianMetric.IsSmoothFamilyOn (overlapMetric F G c) (Ico 0 B) := by |
| 82 | unfold RiemannianMetric.IsSmoothFamilyOn |
| 83 | apply contMDiffOn_of_locally_contMDiffOn |
| 84 | intro p hp |
| 85 | by_cases hpc : p.1 < c |
| 86 | · let U : Set (ℝ × M) := {q | q.1 < T} |
| 87 | refine ⟨U, isOpen_Iio.preimage continuous_fst, hpc.trans hc.2, ?_⟩ |
| 88 | have hf := F.smooth |
| 89 | unfold RiemannianMetric.IsSmoothFamilyOn at hf |
| 90 | refine (hf.mono (t := (Ico 0 B ×ˢ univ) ∩ U) ?_).congr ?_ |
| 91 | · intro q hq |
| 92 | exact ⟨⟨hq.1.1.1, hq.2⟩, mem_univ _⟩ |
| 93 | · intro q hq |
| 94 | rw [overlapMetric_eq_left F G c hc.1 hmetric ⟨hq.1.1.1, hq.2⟩] |
| 95 | · let U : Set (ℝ × M) := {q | a < q.1} |
| 96 | refine ⟨U, isOpen_Ioi.preimage continuous_fst, |
| 97 | hc.1.trans_le (le_of_not_gt hpc), ?_⟩ |
| 98 | have hg := G.smooth |
| 99 | unfold RiemannianMetric.IsSmoothFamilyOn at hg |
| 100 | refine (hg.mono (t := (Ico 0 B ×ˢ univ) ∩ U) ?_).congr ?_ |
| 101 | · intro q hq |
| 102 | exact ⟨⟨hq.2.le, hq.1.1.2⟩, mem_univ _⟩ |
| 103 | · intro q hq |
| 104 | rw [overlapMetric_eq_right F G c hc.2 hmetric ⟨hq.2.le, hq.1.1.2⟩] |
| 105 | |
| 106 | theorem overlap_equation (hc : c ∈ Ioo a T) |
| 107 | (hmetric : EqOn F.metric G.metric (Ico a T)) |
| 108 | (t : ℝ) (ht : t ∈ Ico 0 B) (x : M) (v w : TangentSpace (𝓡 n) x) : |
| 109 | HasDerivWithinAt (fun s => (overlapMetric F G c s).inner x v w) |
| 110 | (-2 * (overlapConnection F G c t).ricci x v w) (Ico 0 B) t := by |
| 111 | by_cases htc : t < c |
| 112 | · have hlocal : Ico 0 T ∈ 𝓝[Ico 0 B] t := |
| 113 | mem_of_superset (inter_mem_nhdsWithin _ (Iio_mem_nhds (htc.trans hc.2))) |
| 114 | (fun _ hs => ⟨hs.1.1, hs.2⟩) |
| 115 | rw [overlapConnection_ricci_left F G c htc] |
| 116 | have he := F.equation t ⟨ht.1, htc.trans hc.2⟩ x v w |
| 117 | apply (he.mono_of_mem_nhdsWithin hlocal).congr_of_eventuallyEq_of_mem ?_ ht |
| 118 | filter_upwards [hlocal] with s hs |
| 119 | rw [overlapMetric_eq_left F G c hc.1 hmetric hs] |
| 120 | · have hct : c ≤ t := le_of_not_gt htc |
| 121 | have hlocal : Ico a B ∈ 𝓝[Ico 0 B] t := |
| 122 | mem_of_superset (inter_mem_nhdsWithin _ (Ioi_mem_nhds (hc.1.trans_le hct))) |
| 123 | (fun _ hs => ⟨hs.2.le, hs.1.2⟩) |
| 124 | rw [overlapConnection_ricci_right F G c hct] |
| 125 | have he := G.equation t ⟨hc.1.le.trans hct, ht.2⟩ x v w |
| 126 | apply (he.mono_of_mem_nhdsWithin hlocal).congr_of_eventuallyEq_of_mem ?_ ht |
| 127 | filter_upwards [hlocal] with s hs |
| 128 | rw [overlapMetric_eq_right F G c hc.2 hmetric hs] |
| 129 | |
| 130 | /-- Glue at a strictly interior overlap time, retaining the selected connection. -/ |
| 131 | noncomputable def glueOverlap (ha : 0 < a) (hc : c ∈ Ioo a T) (hTB : T < B) |
| 132 | (hmetric : EqOn F.metric G.metric (Ico a T)) : RicciFlow n M (Ico 0 B) where |
| 133 | metric := overlapMetric F G c |
| 134 | connection := overlapConnection F G c |
| 135 | interval := ordConnected_Ico |
| 136 | nontrivial := ⟨0, ⟨le_rfl, ha.trans (hc.1.trans (hc.2.trans hTB))⟩, |
| 137 | a, ⟨ha.le, hc.1.trans (hc.2.trans hTB)⟩, ha.ne⟩ |
| 138 | smooth := overlapMetric_smooth F G c hc hmetric |
| 139 | equation := overlap_equation F G c hc hmetric |
| 140 | |
| 141 | theorem glueOverlap_metric_left (ha : 0 < a) (hc : c ∈ Ioo a T) (hTB : T < B) |
| 142 | (hmetric : EqOn F.metric G.metric (Ico a T)) : |
| 143 | EqOn (glueOverlap F G c ha hc hTB hmetric).metric F.metric (Ico 0 T) := |
| 144 | overlapMetric_eq_left F G c hc.1 hmetric |
| 145 | |
| 146 | theorem glueOverlap_metric_right (ha : 0 < a) (hc : c ∈ Ioo a T) (hTB : T < B) |
| 147 | (hmetric : EqOn F.metric G.metric (Ico a T)) : |
| 148 | EqOn (glueOverlap F G c ha hc hTB hmetric).metric G.metric (Ico a B) := |
| 149 | overlapMetric_eq_right F G c hc.2 hmetric |
| 150 | |
| 151 | @[simp] theorem glueOverlap_initial_metric (ha : 0 < a) (hc : c ∈ Ioo a T) |
| 152 | (hTB : T < B) (hmetric : EqOn F.metric G.metric (Ico a T)) : |
| 153 | (glueOverlap F G c ha hc hTB hmetric).metric 0 = F.metric 0 := |
| 154 | glueOverlap_metric_left F G c ha hc hTB hmetric ⟨le_rfl, ha.trans (hc.1.trans hc.2)⟩ |
| 155 | |
| 156 | theorem glueOverlap_isLeast (ha : 0 < a) (hc : c ∈ Ioo a T) (hTB : T < B) : |
| 157 | IsLeast (Ico 0 B) 0 := |
| 158 | ⟨⟨le_rfl, ha.trans (hc.1.trans (hc.2.trans hTB))⟩, fun _ ht => ht.1⟩ |
| 159 | |
| 160 | end PoincareMT.M51Ordinary |