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.Generalized.BoundedDistance.GeometryImports |
| 2 | import Mathlib.Topology.Order.Compact |
| 3 | import Mathlib.Topology.Instances.Real.Lemmas |
| 4 | import Mathlib.Tactic.Linarith |
| 5 | |
| 6 | /-! |
| 7 | # Compact avoidance by an actual subtype height |
| 8 | |
| 9 | If the ambient closure of a high-height side stays in the valid height |
| 10 | domain, every ambient compact set misses a sufficiently late tail. |
| 11 | Source: Morgan--Tian Claim 10.8, p. 254; M28 derivations 94 and 128. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set |
| 17 | |
| 18 | namespace Poincare |
| 19 | |
| 20 | /-- A continuous height below one on its actual subtype has compactly |
| 21 | avoiding high tails when the ambient closure of that side stays in the |
| 22 | subtype. Empty compact intersections are included. Source: derivation 128. -/ |
| 23 | theorem exists_height_tail_disjoint_compact |
| 24 | {M : Type*} [TopologicalSpace M] {U P : Set M} (h : U → ℝ) |
| 25 | (hh : Continuous h) (hupper : ∀ x, h x < 1) |
| 26 | (hclosure : closure P ⊆ U) (hside : ∀ x : U, (1 / 2 : ℝ) < h x → x.val ∈ P) |
| 27 | {K : Set M} (hK : IsCompact K) : |
| 28 | ∃ a : ℝ, 1 / 2 < a ∧ a < 1 ∧ ∀ x : U, a < h x → x.val ∉ K := by |
| 29 | let C : Set U := (Subtype.val : U → M) ⁻¹' (K ∩ closure P) |
| 30 | have hC : IsCompact C := |
| 31 | Topology.IsEmbedding.subtypeVal.isInducing.isCompact_preimage' |
| 32 | (hK.inter_right isClosed_closure) (by |
| 33 | intro x hx |
| 34 | exact ⟨⟨x, hclosure hx.2⟩, rfl⟩) |
| 35 | obtain ⟨m, hm, hbound⟩ := hC.exists_forall_le' |
| 36 | (continuous_const.sub hh).continuousOn (fun x _ => sub_pos.mpr (hupper x)) |
| 37 | obtain ⟨a, ha, ha1⟩ := exists_between |
| 38 | (max_lt (by norm_num : (1 / 2 : ℝ) < 1) (by linarith : 1 - m < 1)) |
| 39 | refine ⟨a, (le_max_left _ _).trans_lt ha, ha1, ?_⟩ |
| 40 | intro x hx hxK |
| 41 | have hxP := hside x (((le_max_left _ _).trans_lt ha).trans hx) |
| 42 | have hlow := hbound x ⟨hxK, subset_closure hxP⟩ |
| 43 | change m ≤ 1 - h x at hlow |
| 44 | have hhigh := (le_max_right (1 / 2 : ℝ) (1 - m)).trans_lt ha |
| 45 | linarith |
| 46 | |
| 47 | end Poincare |