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 Mathlib.Geometry.Manifold.IntegralCurve.ExistUnique |
| 2 | import Mathlib.Geometry.Manifold.Instances.Real |
| 3 | |
| 4 | /-! # Uniqueness and gluing in an open vector-field domain -/ |
| 5 | |
| 6 | noncomputable section |
| 7 | set_option autoImplicit false |
| 8 | set_option backward.isDefEq.respectTransparency false |
| 9 | |
| 10 | open Set Filter |
| 11 | open scoped Manifold ContDiff Bundle Topology |
| 12 | |
| 13 | namespace Poincare.Manifold |
| 14 | |
| 15 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] [T2Space M] |
| 16 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 17 | |
| 18 | /-- Integral curves of a smooth field agree on a connected open time domain |
| 19 | once they agree at one time. Only the first curve needs to stay in its domain. -/ |
| 20 | theorem eqOn_of_isMIntegralCurveOn |
| 21 | {X : (x : M) → TangentSpace (𝓡 n) x} {U : Set M} (hU : IsOpen U) |
| 22 | (hX : ContMDiffOn (𝓡 n) ((𝓡 n).prod (𝓡 n)) 1 (T% X) U) |
| 23 | {J : Set ℝ} (hJ : IsOpen J) (hc : IsPreconnected J) |
| 24 | {α β : ℝ → M} {t₀ : ℝ} (ht₀ : t₀ ∈ J) |
| 25 | (hαU : ∀ t ∈ J, α t ∈ U) |
| 26 | (hα : IsMIntegralCurveOn (I := 𝓡 n) α X J) |
| 27 | (hβ : IsMIntegralCurveOn (I := 𝓡 n) β X J) |
| 28 | (hinit : α t₀ = β t₀) : EqOn α β J := by |
| 29 | let S := {t | α t = β t} ∩ J |
| 30 | suffices hsub : J ⊆ S from fun t ht => (hsub ht).1 |
| 31 | apply hc.subset_of_closure_inter_subset (s := J) (u := S) _ |
| 32 | ⟨t₀, ⟨ht₀, ⟨hinit, ht₀⟩⟩⟩ |
| 33 | · dsimp only [S] |
| 34 | rw [inter_comm, ← Subtype.image_preimage_val, inter_comm, ← Subtype.image_preimage_val, |
| 35 | image_subset_image_iff Subtype.val_injective, preimage_ofPred_eq] |
| 36 | intro t ht |
| 37 | rw [mem_preimage, ← closure_subtype] at ht |
| 38 | revert ht t |
| 39 | apply IsClosed.closure_subset (isClosed_eq _ _) |
| 40 | · rw [continuous_iff_continuousAt] |
| 41 | rintro ⟨t, ht⟩ |
| 42 | exact ((hα.continuousWithinAt ht).continuousAt (hJ.mem_nhds ht)).comp |
| 43 | continuousAt_subtype_val |
| 44 | · rw [continuous_iff_continuousAt] |
| 45 | rintro ⟨t, ht⟩ |
| 46 | exact ((hβ.continuousWithinAt ht).continuousAt (hJ.mem_nhds ht)).comp |
| 47 | continuousAt_subtype_val |
| 48 | · rw [isOpen_iff_mem_nhds] |
| 49 | intro t ht |
| 50 | have hmem := hJ.mem_nhds ht.2 |
| 51 | have heq := isMIntegralCurveAt_eventuallyEq_of_contMDiffAt_boundaryless |
| 52 | (hX.contMDiffAt (hU.mem_nhds (hαU t ht.2))) |
| 53 | (hα.isMIntegralCurveAt hmem) (hβ.isMIntegralCurveAt hmem) ht.1 |
| 54 | exact (heq.and hmem).mono (fun _ hs => hs) |
| 55 | |
| 56 | /-- Two integral curves through a common point glue over overlapping open |
| 57 | convex time intervals while preserving their spatial domain. -/ |
| 58 | theorem exists_gluing_of_integralCurves |
| 59 | {X : (x : M) → TangentSpace (𝓡 n) x} {U : Set M} (hU : IsOpen U) |
| 60 | (hX : ContMDiffOn (𝓡 n) ((𝓡 n).prod (𝓡 n)) 1 (T% X) U) |
| 61 | {J₁ J₂ : Set ℝ} (hJ₁ : IsOpen J₁) (hJ₂ : IsOpen J₂) |
| 62 | (hc₁ : Convex ℝ J₁) (hc₂ : Convex ℝ J₂) {α β : ℝ → M} |
| 63 | (hαU : ∀ t ∈ J₁, α t ∈ U) (hβU : ∀ t ∈ J₂, β t ∈ U) |
| 64 | (hα : IsMIntegralCurveOn (I := 𝓡 n) α X J₁) |
| 65 | (hβ : IsMIntegralCurveOn (I := 𝓡 n) β X J₂) |
| 66 | {a : ℝ} (ha : a ∈ J₁ ∩ J₂) (hjoin : α a = β a) : |
| 67 | ∃ γ : ℝ → M, EqOn γ α J₁ ∧ EqOn γ β J₂ ∧ |
| 68 | (∀ t ∈ J₁ ∪ J₂, γ t ∈ U) ∧ |
| 69 | IsMIntegralCurveOn (I := 𝓡 n) γ X (J₁ ∪ J₂) := by |
| 70 | classical |
| 71 | have hagree := eqOn_of_isMIntegralCurveOn hU hX (hJ₁.inter hJ₂) |
| 72 | (hc₁.inter hc₂).isPreconnected ha (fun t ht => hαU t ht.1) |
| 73 | (hα.mono inter_subset_left) (hβ.mono inter_subset_right) hjoin |
| 74 | let γ : ℝ → M := fun t => if t ∈ J₁ then α t else β t |
| 75 | have heq₁ : EqOn γ α J₁ := fun _ ht => if_pos ht |
| 76 | have heq₂ : EqOn γ β J₂ := by |
| 77 | intro t ht |
| 78 | by_cases ht₁ : t ∈ J₁ |
| 79 | · exact (if_pos ht₁).trans (hagree ⟨ht₁, ht⟩) |
| 80 | · exact if_neg ht₁ |
| 81 | have hnear₁ {t : ℝ} (ht : t ∈ J₁) : γ =ᶠ[𝓝 t] α := |
| 82 | Filter.Eventually.mono (hJ₁.mem_nhds ht) fun _ hs => heq₁ hs |
| 83 | have hnear₂ {t : ℝ} (ht : t ∈ J₂) : γ =ᶠ[𝓝 t] β := |
| 84 | Filter.Eventually.mono (hJ₂.mem_nhds ht) fun _ hs => heq₂ hs |
| 85 | refine ⟨γ, heq₁, heq₂, ?_, ?_⟩ |
| 86 | · intro t ht |
| 87 | rcases ht with ht | ht |
| 88 | · rw [heq₁ ht]; exact hαU t ht |
| 89 | · rw [heq₂ ht]; exact hβU t ht |
| 90 | · intro t ht |
| 91 | rcases ht with ht | ht |
| 92 | · have hd := ((hα.isMIntegralCurveAt (hJ₁.mem_nhds ht)).hasMFDerivAt.congr_of_eventuallyEq |
| 93 | (hnear₁ ht)).hasMFDerivWithinAt (s := J₁ ∪ J₂) |
| 94 | convert hd using 1 |
| 95 | rw [heq₁ ht] |
| 96 | · have hd := ((hβ.isMIntegralCurveAt (hJ₂.mem_nhds ht)).hasMFDerivAt.congr_of_eventuallyEq |
| 97 | (hnear₂ ht)).hasMFDerivWithinAt (s := J₁ ∪ J₂) |
| 98 | convert hd using 1 |
| 99 | rw [heq₂ ht] |
| 100 | |
| 101 | end Poincare.Manifold |