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.Blowup.Construction.LongTime.BackwardLimit.BackwardInterval |
| 2 | |
| 3 | /-! |
| 4 | # Gluing the interior flow to its closed terminal slab |
| 5 | |
| 6 | The actual metric and connection pairs of two compatible flows define one |
| 7 | flow on the backward domain, including its terminal time. This is the local |
| 8 | interval assembly of Morgan--Tian, Definitions 3.1--3.2, p. 35, and |
| 9 | Theorem 11.8, pp. 272--279. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set Filter |
| 15 | open scoped Manifold ContDiff Bundle ENNReal Topology |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.M30 |
| 20 | |
| 21 | /-- Compatible actual interior and terminal-slab flows define a flow on the |
| 22 | backward domain, retaining both metrics. Morgan--Tian, Definitions 3.1--3.2, |
| 23 | p. 35, and Theorem 11.8, pp. 272--279. -/ |
| 24 | theorem exists_backwardFlow_of_interior_and_closed |
| 25 | {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 27 | [IsManifold (𝓡 n) ∞ M] |
| 28 | {T0 : ℝ≥0∞} {τ : ℝ} (hτ : 0 < τ) |
| 29 | (hhorizon : ENNReal.ofReal τ < T0) |
| 30 | (Finterior : RicciFlow n M |
| 31 | {t : ℝ | t < 0 ∧ ENNReal.ofReal (-t) < T0}) |
| 32 | (Fclosed : RicciFlow n M (Icc (-τ) 0)) |
| 33 | (hcompat : ∀ t ∈ Ico (-τ) 0, |
| 34 | Finterior.metric t = Fclosed.metric t) : |
| 35 | ∃ F : RicciFlow n M (blowupBackwardInterval T0), |
| 36 | EqOn F.metric Finterior.metric |
| 37 | {t : ℝ | t < 0 ∧ ENNReal.ofReal (-t) < T0} ∧ |
| 38 | EqOn F.metric Fclosed.metric (Icc (-τ) 0) := by |
| 39 | classical |
| 40 | let W : Set ℝ := {t : ℝ | t < 0 ∧ ENNReal.ofReal (-t) < T0} |
| 41 | let J := blowupBackwardInterval T0 |
| 42 | let C := Icc (-τ) 0 |
| 43 | have hCJ : C ⊆ J := closedSlab_subset_blowupBackwardInterval hhorizon |
| 44 | have hJord : J.OrdConnected := by |
| 45 | refine ⟨?_⟩ |
| 46 | intro x hx y hy z hz |
| 47 | exact ⟨hz.2.trans hy.1, |
| 48 | (ENNReal.ofReal_le_ofReal (neg_le_neg hz.1)).trans_lt hx.2⟩ |
| 49 | let slice (t : ℝ) : Sigma (fun g : RiemannianMetric n M => LeviCivitaData g) := |
| 50 | if t < 0 then ⟨Finterior.metric t, Finterior.connection t⟩ |
| 51 | else ⟨Fclosed.metric t, Fclosed.connection t⟩ |
| 52 | let g (t : ℝ) := (slice t).1 |
| 53 | have hnegative (t : ℝ) (ht : t < 0) : g t = Finterior.metric t := by |
| 54 | simp only [g, slice, if_pos ht] |
| 55 | have hclosed : EqOn g Fclosed.metric C := by |
| 56 | intro t ht |
| 57 | by_cases ht0 : t < 0 |
| 58 | · exact (hnegative t ht0).trans (hcompat t ⟨ht.1, ht0⟩) |
| 59 | · simp only [g, slice, if_neg ht0] |
| 60 | have hWJ (t : ℝ) (ht : t < 0) : W =ᶠ[𝓝 t] J := by |
| 61 | filter_upwards [Iio_mem_nhds ht] with s hs |
| 62 | apply propext |
| 63 | exact ⟨fun h => ⟨h.1.le, h.2⟩, fun h => ⟨hs, h.2⟩⟩ |
| 64 | have hCJ0 : C =ᶠ[𝓝 (0 : ℝ)] J := by |
| 65 | filter_upwards [Ioi_mem_nhds (neg_lt_zero.mpr hτ)] with s hs |
| 66 | apply propext |
| 67 | exact ⟨fun h => hCJ h, fun h => ⟨hs.le, h.1⟩⟩ |
| 68 | have hg : RiemannianMetric.IsSmoothFamilyOn g J := by |
| 69 | intro p hp |
| 70 | by_cases ht : p.1 < 0 |
| 71 | · have hdom : W ×ˢ (univ : Set M) =ᶠ[𝓝 p] J ×ˢ univ := by |
| 72 | filter_upwards [(hWJ p.1 ht).comp_tendsto (continuous_fst.tendsto p)] with q hq |
| 73 | exact congrArg (fun a : Prop => a ∧ q.2 ∈ (univ : Set M)) hq |
| 74 | have hs := (Finterior.smooth p ⟨⟨ht, hp.1.2⟩, hp.2⟩).congr_set hdom |
| 75 | apply hs.congr_of_eventuallyEq_of_mem ?_ hp |
| 76 | filter_upwards [((continuous_fst.tendsto p).eventually |
| 77 | (Iio_mem_nhds ht)).filter_mono nhdsWithin_le_nhds] with q hq |
| 78 | rw [hnegative q.1 hq] |
| 79 | · have ht0 : p.1 = 0 := le_antisymm hp.1.1 (le_of_not_gt ht) |
| 80 | have hpc : p.1 ∈ C := by |
| 81 | change -τ ≤ p.1 ∧ p.1 ≤ 0 |
| 82 | rw [ht0] |
| 83 | exact ⟨neg_nonpos.mpr hτ.le, le_rfl⟩ |
| 84 | have htime : C =ᶠ[𝓝 p.1] J := by |
| 85 | rw [ht0] |
| 86 | exact hCJ0 |
| 87 | have hdom : C ×ˢ (univ : Set M) =ᶠ[𝓝 p] J ×ˢ univ := by |
| 88 | filter_upwards [htime.comp_tendsto (continuous_fst.tendsto p)] with q hq |
| 89 | exact congrArg (fun a : Prop => a ∧ q.2 ∈ (univ : Set M)) hq |
| 90 | have hs := (Fclosed.smooth p ⟨hpc, hp.2⟩).congr_set hdom |
| 91 | apply hs.congr_of_eventuallyEq_of_mem ?_ hp |
| 92 | filter_upwards [(htime.comp_tendsto (continuous_fst.tendsto p)).filter_mono |
| 93 | nhdsWithin_le_nhds, self_mem_nhdsWithin] with q hq hqJ |
| 94 | rw [hclosed (Eq.mpr hq hqJ.1)] |
| 95 | refine ⟨{ |
| 96 | metric := g |
| 97 | connection := fun t => (slice t).2 |
| 98 | interval := hJord |
| 99 | nontrivial := Fclosed.nontrivial.mono hCJ |
| 100 | smooth := hg |
| 101 | equation := ?_ }, ?_, hclosed⟩ |
| 102 | · intro t ht x v w |
| 103 | by_cases ht0 : t < 0 |
| 104 | · have hd := (Finterior.equation t ⟨ht0, ht.2⟩ x v w).congr_set (hWJ t ht0) |
| 105 | have hmetric : (fun s => (g s).inner x v w) =ᶠ[𝓝[J] t] |
| 106 | (fun s => (Finterior.metric s).inner x v w) := by |
| 107 | filter_upwards [mem_nhdsWithin_of_mem_nhds (Iio_mem_nhds ht0)] with s hs |
| 108 | rw [hnegative s hs] |
| 109 | have hderiv := hd.congr_of_eventuallyEq_of_mem hmetric ht |
| 110 | have hs : slice t = ⟨Finterior.metric t, Finterior.connection t⟩ := by |
| 111 | simp only [slice, if_pos ht0] |
| 112 | have hr := congrArg (fun q : Sigma (fun g : RiemannianMetric n M => |
| 113 | LeviCivitaData g) => q.2.ricci x v w) hs |
| 114 | change HasDerivWithinAt (fun s => (g s).inner x v w) |
| 115 | (-2 * (slice t).2.ricci x v w) J t |
| 116 | rw [hr] |
| 117 | exact hderiv |
| 118 | · have htzero : t = 0 := le_antisymm ht.1 (le_of_not_gt ht0) |
| 119 | subst t |
| 120 | have hmem : (0 : ℝ) ∈ C := ⟨neg_nonpos.mpr hτ.le, le_rfl⟩ |
| 121 | have hd := (Fclosed.equation 0 hmem x v w).congr_set hCJ0 |
| 122 | have hmetric : (fun s => (g s).inner x v w) =ᶠ[𝓝[J] (0 : ℝ)] |
| 123 | (fun s => (Fclosed.metric s).inner x v w) := by |
| 124 | filter_upwards [hCJ0.filter_mono nhdsWithin_le_nhds, |
| 125 | self_mem_nhdsWithin] with s hs hsJ |
| 126 | rw [hclosed (Eq.mpr hs hsJ)] |
| 127 | have hderiv := hd.congr_of_eventuallyEq_of_mem hmetric ht |
| 128 | have hs : slice 0 = ⟨Fclosed.metric 0, Fclosed.connection 0⟩ := by |
| 129 | simp only [slice, if_neg (lt_irrefl (0 : ℝ))] |
| 130 | have hr := congrArg (fun q : Sigma (fun g : RiemannianMetric n M => |
| 131 | LeviCivitaData g) => q.2.ricci x v w) hs |
| 132 | change HasDerivWithinAt (fun s => (g s).inner x v w) |
| 133 | (-2 * (slice 0).2.ricci x v w) J 0 |
| 134 | rw [hr] |
| 135 | exact hderiv |
| 136 | · intro t ht |
| 137 | exact hnegative t ht.1 |
| 138 | |
| 139 | end PoincareMT.M30 |