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.ReducedGeometry.LGeometry.Continuation.ContinuationCurve |
| 2 | |
| 3 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/ContinuationEnvelope.lean` at |
| 4 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 5 | |
| 6 | |
| 7 | set_option autoImplicit false |
| 8 | set_option backward.isDefEq.respectTransparency false |
| 9 | |
| 10 | noncomputable section |
| 11 | |
| 12 | open Set Filter Topology |
| 13 | open scoped Manifold ContDiff Bundle |
| 14 | |
| 15 | universe u |
| 16 | |
| 17 | namespace PoincareMT.LGeometry |
| 18 | |
| 19 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 20 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 21 | [T2Space M] |
| 22 | |
| 23 | theorem continuationCurve_eqOn_of_tail {J : Set ℝ} (F : RicciFlow n M J) |
| 24 | (hM04 : RicciFlowCurvatureTheory.{u}) (T : ℝ) {d e c b : ℝ} |
| 25 | (hd : 0 ≤ d) (he : 0 ≤ e) (hdc : d < c) (hec : e < c) (hcb : c < b) |
| 26 | (htime : ∀ s ∈ Ioo 0 b, T - s ^ 2 ∈ J) {α β γ : ℝ → M} |
| 27 | (hα : IsContinuationCurve F T α (Ioo d b)) |
| 28 | (hβ : IsContinuationCurve F T β (Ioo e b)) |
| 29 | (hαγ : EqOn α γ (Ioo c b)) (hβγ : EqOn β γ (Ioo c b)) : |
| 30 | EqOn α β (Ioo (max d e) b) := by |
| 31 | have hsubd : Ioo (max d e) b ⊆ Ioo d b := Ioo_subset_Ioo (le_max_left _ _) le_rfl |
| 32 | have hsube : Ioo (max d e) b ⊆ Ioo e b := Ioo_subset_Ioo (le_max_right _ _) le_rfl |
| 33 | let s := (c + b) / 2 |
| 34 | have hs : s ∈ Ioo c b := ⟨by dsimp only [s]; linarith, by dsimp only [s]; linarith⟩ |
| 35 | apply continuationCurve_eqOn_of_germ F hM04 T isOpen_Ioo isPreconnected_Ioo |
| 36 | (fun r hr ↦ htime r ⟨hd.trans_lt ((le_max_left d e).trans_lt hr.1), hr.2⟩) |
| 37 | (hα.mono hsubd) (hβ.mono hsube) |
| 38 | (show s ∈ Ioo (max d e) b from ⟨(max_lt hdc hec).trans hs.1, hs.2⟩) |
| 39 | exact eventuallyEq_of_mem (isOpen_Ioo.mem_nhds hs) |
| 40 | (fun r hr ↦ (hαγ hr).trans (hβγ hr).symm) |
| 41 | |
| 42 | set_option maxHeartbeats 1400000 in |
| 43 | theorem exists_continuation_envelope {J : Set ℝ} (F : RicciFlow n M J) |
| 44 | (hM04 : RicciFlowCurvatureTheory.{u}) (T : ℝ) {a₀ c b : ℝ} |
| 45 | (ha₀ : 0 ≤ a₀) (ha₀c : a₀ < c) (hcb : c < b) |
| 46 | (htime : ∀ s ∈ Ioo 0 b, T - s ^ 2 ∈ J) (α₀ : ℝ → M) |
| 47 | (hα₀ : IsContinuationCurve F T α₀ (Ioo a₀ b)) : |
| 48 | ∃ a : ℝ, 0 ≤ a ∧ a < c ∧ ∃ α : ℝ → M, |
| 49 | IsContinuationCurve F T α (Ioo a b) ∧ EqOn α α₀ (Ioo c b) ∧ |
| 50 | ∀ d : ℝ, 0 ≤ d → d < c → ∀ β : ℝ → M, |
| 51 | IsContinuationCurve F T β (Ioo d b) → EqOn β α₀ (Ioo c b) → a ≤ d := by |
| 52 | classical |
| 53 | let S : Set ℝ := {d | 0 ≤ d ∧ d < c ∧ ∃ β : ℝ → M, |
| 54 | IsContinuationCurve F T β (Ioo d b) ∧ EqOn β α₀ (Ioo c b)} |
| 55 | have hS₀ : a₀ ∈ S := ⟨ha₀, ha₀c, α₀, hα₀, fun _ _ ↦ rfl⟩ |
| 56 | have hSne : S.Nonempty := ⟨a₀, hS₀⟩ |
| 57 | have hSbdd : BddBelow S := ⟨0, fun d hd ↦ hd.1⟩ |
| 58 | let a := sInf S |
| 59 | have ha : 0 ≤ a := le_csInf hSne (fun d hd ↦ hd.1) |
| 60 | have hac : a < c := (csInf_le hSbdd hS₀).trans_lt ha₀c |
| 61 | have hex (r : Ioo a b) : ∃ d : ℝ, 0 ≤ d ∧ d < c ∧ ∃ β : ℝ → M, |
| 62 | IsContinuationCurve F T β (Ioo d b) ∧ EqOn β α₀ (Ioo c b) ∧ d < r := by |
| 63 | obtain ⟨d, hd, hdr⟩ := exists_lt_of_csInf_lt hSne r.property.1 |
| 64 | obtain ⟨hd0, hdc, β, hβ, hβtail⟩ := hd |
| 65 | exact ⟨d, hd0, hdc, β, hβ, hβtail, hdr⟩ |
| 66 | choose d hd0 hdc β hβ hβtail hdr using hex |
| 67 | let α : ℝ → M := fun r ↦ if h : r ∈ Ioo a b then β ⟨r, h⟩ r else α₀ r |
| 68 | have hnear (r : Ioo a b) : α =ᶠ[𝓝 (r : ℝ)] β r := by |
| 69 | filter_upwards [isOpen_Ioo.mem_nhds r.property, |
| 70 | isOpen_Ioo.mem_nhds (show (r : ℝ) ∈ Ioo (d r) b from ⟨hdr r, r.property.2⟩)] |
| 71 | with t ht htd |
| 72 | have hcomp := continuationCurve_eqOn_of_tail F hM04 T (hd0 ⟨t, ht⟩) (hd0 r) |
| 73 | (hdc ⟨t, ht⟩) (hdc r) hcb htime (hβ ⟨t, ht⟩) (hβ r) |
| 74 | (hβtail ⟨t, ht⟩) (hβtail r) |
| 75 | change (if h : t ∈ Ioo a b then β ⟨t, h⟩ t else α₀ t) = β r t |
| 76 | rw [dif_pos ht] |
| 77 | exact hcomp ⟨max_lt (hdr ⟨t, ht⟩) htd.1, ht.2⟩ |
| 78 | have hα : IsContinuationCurve F T α (Ioo a b) := by |
| 79 | refine ⟨?_, ?_⟩ |
| 80 | · intro r hr |
| 81 | have hr' : r ∈ Ioo (d ⟨r, hr⟩) b := ⟨hdr ⟨r, hr⟩, hr.2⟩ |
| 82 | exact ((((hβ ⟨r, hr⟩).smooth r hr').contMDiffAt |
| 83 | (isOpen_Ioo.mem_nhds hr')).congr_of_eventuallyEq (hnear ⟨r, hr⟩)).contMDiffWithinAt |
| 84 | · intro r hr x hx |
| 85 | have hr' : r ∈ Ioo (d ⟨r, hr⟩) b := ⟨hdr ⟨r, hr⟩, hr.2⟩ |
| 86 | have hbase := (hnear ⟨r, hr⟩).self_of_nhds |
| 87 | have hp := continuationCurvePhase_eventuallyEq F T x (hnear ⟨r, hr⟩) |
| 88 | have heq := (hβ ⟨r, hr⟩).phase r hr' x (by rwa [← hbase]) |
| 89 | rw [← hp.self_of_nhds] at heq |
| 90 | exact heq.congr_of_eventuallyEq hp |
| 91 | refine ⟨a, ha, hac, α, hα, ?_, ?_⟩ |
| 92 | · intro r hr |
| 93 | have hr' : r ∈ Ioo a b := ⟨hac.trans hr.1, hr.2⟩ |
| 94 | change (if h : r ∈ Ioo a b then β ⟨r, h⟩ r else α₀ r) = α₀ r |
| 95 | rw [dif_pos hr'] |
| 96 | exact hβtail ⟨r, hr'⟩ hr |
| 97 | · intro e he hec γ hγ hγtail |
| 98 | exact csInf_le hSbdd (show e ∈ S from ⟨he, hec, γ, hγ, hγtail⟩) |
| 99 | |
| 100 | end PoincareMT.LGeometry |