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.Analysis.ODE.LocalFlow.Smooth |
| 2 | |
| 3 | /-! # Uniqueness for smooth fields on open domains -/ |
| 4 | |
| 5 | namespace Poincare.ODE |
| 6 | |
| 7 | open Set Filter |
| 8 | open scoped ContDiff Topology |
| 9 | |
| 10 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 11 | |
| 12 | /-- Local uniqueness needs smoothness only near the common value. -/ |
| 13 | theorem eq_nhds_of_hasDerivAt |
| 14 | {F : E → E} {γ η : ℝ → E} {t : ℝ} |
| 15 | (hF : ContDiffAt ℝ 1 F (γ t)) |
| 16 | (hγ : ∀ᶠ s in 𝓝 t, HasDerivAt γ (F (γ s)) s) |
| 17 | (hη : ∀ᶠ s in 𝓝 t, HasDerivAt η (F (η s)) s) |
| 18 | (heq : γ t = η t) : γ =ᶠ[𝓝 t] η := by |
| 19 | obtain ⟨K, S, hS, hLip⟩ := hF.exists_lipschitzOnWith |
| 20 | have hmemγ : ∀ᶠ s in 𝓝 t, γ s ∈ S := |
| 21 | hγ.self_of_nhds.continuousAt.preimage_mem_nhds hS |
| 22 | have hmemη : ∀ᶠ s in 𝓝 t, η s ∈ S := |
| 23 | hη.self_of_nhds.continuousAt.preimage_mem_nhds (heq ▸ hS) |
| 24 | exact ODE_solution_unique_of_eventually (v := fun _ => F) (s := fun _ => S) |
| 25 | (Eventually.of_forall (fun _ => hLip)) (hγ.and hmemγ) (hη.and hmemη) heq |
| 26 | |
| 27 | /-- Two solutions of a smooth field agree throughout their common connected |
| 28 | open time domain if they agree at one time. -/ |
| 29 | theorem eqOn_of_hasDerivAt |
| 30 | {F : E → E} {U : Set E} (hU : IsOpen U) (hF : ContDiffOn ℝ ∞ F U) |
| 31 | {γ η : ℝ → E} {J : Set ℝ} (hJ : IsOpen J) (hconn : IsPreconnected J) |
| 32 | (hγ : ∀ t ∈ J, γ t ∈ U ∧ HasDerivAt γ (F (γ t)) t) |
| 33 | (hη : ∀ t ∈ J, η t ∈ U ∧ HasDerivAt η (F (η t)) t) |
| 34 | {a : ℝ} (ha : a ∈ J) (heq : γ a = η a) : EqOn γ η J := by |
| 35 | have hlocal (t : ℝ) (ht : t ∈ J) (he : γ t = η t) : γ =ᶠ[𝓝 t] η := |
| 36 | eq_nhds_of_hasDerivAt |
| 37 | ((hF.contDiffAt (hU.mem_nhds (hγ t ht).1)).of_le (by simp)) |
| 38 | (Filter.Eventually.mono (hJ.mem_nhds ht) fun s hs => (hγ s hs).2) |
| 39 | (Filter.Eventually.mono (hJ.mem_nhds ht) fun s hs => (hη s hs).2) he |
| 40 | let G : Set ℝ := {t | γ =ᶠ[𝓝 t] η} |
| 41 | have hopen : IsOpen G := isOpen_setOfPred_eventually_nhds |
| 42 | have hclosed : closure G ∩ J ⊆ G := by |
| 43 | intro t ht |
| 44 | have hfreq : ∃ᶠ s in 𝓝 t, s ∈ G := mem_closure_iff_frequently.mp ht.1 |
| 45 | apply hlocal t ht.2 |
| 46 | exact tendsto_nhds_unique_of_frequently_eq (hγ t ht.2).2.continuousAt |
| 47 | (hη t ht.2).2.continuousAt (hfreq.mono fun s hs => hs.self_of_nhds) |
| 48 | have hall := hconn.subset_of_closure_inter_subset hopen ⟨a, ha, hlocal a ha heq⟩ hclosed |
| 49 | exact fun t ht => (hall ht).self_of_nhds |
| 50 | |
| 51 | /-- A solution reaching an equilibrium is constant on its connected open |
| 52 | time domain. This rules out finite-time arrival at an equilibrium. -/ |
| 53 | theorem eqOn_const_of_solution_hits_equilibrium |
| 54 | {F : E → E} {U : Set E} (hU : IsOpen U) (hF : ContDiffOn ℝ ∞ F U) |
| 55 | {γ : ℝ → E} {J : Set ℝ} (hJ : IsOpen J) (hconn : IsPreconnected J) |
| 56 | (hγ : ∀ t ∈ J, γ t ∈ U ∧ HasDerivAt γ (F (γ t)) t) |
| 57 | {a : ℝ} (ha : a ∈ J) (hzero : F (γ a) = 0) : |
| 58 | EqOn γ (fun _ => γ a) J := by |
| 59 | apply eqOn_of_hasDerivAt hU hF hJ hconn hγ |
| 60 | (fun t _ => ⟨(hγ a ha).1, ?_⟩) ha rfl |
| 61 | simpa only [hzero] using hasDerivAt_const t (γ a) |
| 62 | |
| 63 | end Poincare.ODE |