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 PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.NeckGeometry.NeckGraphIsotopy |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Cylinders.CylinderSphereCrossings |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Persistence.CapTopology.NeckCollar |
| 5 | |
| 6 | /-! |
| 7 | # Literal signed sides of an actual neck height graph |
| 8 | |
| 9 | Morgan--Tian, Proposition A.11, pp. 503--504. The same coordinate graph |
| 10 | used for sphere projection defines its actual signed height, exact zero |
| 11 | fibre and local crossing. All continuity and crossing claims are restricted |
| 12 | to the literal neck carrier. Coordinate perturbations supply both signs |
| 13 | near the graph without a separation premise. |
| 14 | -/ |
| 15 | |
| 16 | noncomputable section |
| 17 | set_option autoImplicit false |
| 18 | |
| 19 | open Set Filter |
| 20 | open scoped Manifold ContDiff Topology |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.M28 |
| 25 | |
| 26 | variable {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 28 | [IsManifold (𝓡 3) ∞ M] {g : RiemannianMetric 3 M} |
| 29 | |
| 30 | /-- The literal axial coordinate minus the actual graph height. It is |
| 31 | used only on the neck carrier; no regularity outside it is asserted. -/ |
| 32 | def neckGraphHeight (N : EpsilonNeck g) (f : UnitTwoSphere → ℝ) (x : M) : ℝ := |
| 33 | (N.coordinate_inverse x).2 - f (N.coordinate_inverse x).1 |
| 34 | |
| 35 | /-- The actual graph height is continuous on precisely the available |
| 36 | coordinate domain of the frozen neck. -/ |
| 37 | theorem continuousOn_neckGraphHeight (N : EpsilonNeck g) |
| 38 | {f : UnitTwoSphere → ℝ} (hf : ContMDiff (𝓡 2) 𝓘(ℝ, ℝ) ∞ f) : |
| 39 | ContinuousOn (neckGraphHeight N f) N.carrier := |
| 40 | (continuous_snd.comp_continuousOn N.coordinate_inverse_smooth.continuousOn).sub |
| 41 | (hf.continuous.comp_continuousOn |
| 42 | (continuous_fst.comp_continuousOn N.coordinate_inverse_smooth.continuousOn)) |
| 43 | |
| 44 | /-- On the literal valid strip the signed height is exactly the axial |
| 45 | coordinate minus the same graph function. -/ |
| 46 | theorem neckGraphHeight_coordinate_map (N : EpsilonNeck g) |
| 47 | (f : UnitTwoSphere → ℝ) (p : UnitTwoSphere) {s : ℝ} |
| 48 | (hs : s ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹) : |
| 49 | neckGraphHeight N f (N.coordinate_map (p, s)) = s - f p := by |
| 50 | unfold neckGraphHeight |
| 51 | rw [N.coordinate_inverse_coordinate_map ⟨mem_univ _, hs⟩] |
| 52 | |
| 53 | /-- The zero fibre inside the actual carrier is the literal graph image, |
| 54 | using both genuine inverse identities and the displayed strip condition. -/ |
| 55 | theorem neckGraphHeight_eq_zero_iff (N : EpsilonNeck g) |
| 56 | {f : UnitTwoSphere → ℝ} |
| 57 | (hdom : ∀ p, f p ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹) |
| 58 | {x : M} (hx : x ∈ N.carrier) : |
| 59 | neckGraphHeight N f x = 0 ↔ |
| 60 | x ∈ range (fun p : UnitTwoSphere => N.coordinate_map (p, f p)) := by |
| 61 | constructor |
| 62 | · intro hz |
| 63 | have heq : (N.coordinate_inverse x).2 = f (N.coordinate_inverse x).1 := |
| 64 | sub_eq_zero.mp hz |
| 65 | refine ⟨(N.coordinate_inverse x).1, ?_⟩ |
| 66 | change N.coordinate_map ((N.coordinate_inverse x).1, f (N.coordinate_inverse x).1) = x |
| 67 | rw [← heq] |
| 68 | exact N.coordinate_map_coordinate_inverse hx |
| 69 | · rintro ⟨p, rfl⟩ |
| 70 | rw [neckGraphHeight_coordinate_map N f p (hdom p), sub_self] |
| 71 | |
| 72 | /-- The actual negative and positive graph regions are open, disjoint, |
| 73 | and cover the carrier minus the literal graph. -/ |
| 74 | theorem neckGraphHeight_sides (N : EpsilonNeck g) |
| 75 | {f : UnitTwoSphere → ℝ} (hf : ContMDiff (𝓡 2) 𝓘(ℝ, ℝ) ∞ f) |
| 76 | (hdom : ∀ p, f p ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹) : |
| 77 | IsOpen (N.carrier ∩ neckGraphHeight N f ⁻¹' Iio 0) ∧ |
| 78 | IsOpen (N.carrier ∩ neckGraphHeight N f ⁻¹' Ioi 0) ∧ |
| 79 | Disjoint (N.carrier ∩ neckGraphHeight N f ⁻¹' Iio 0) |
| 80 | (N.carrier ∩ neckGraphHeight N f ⁻¹' Ioi 0) ∧ |
| 81 | (N.carrier ∩ neckGraphHeight N f ⁻¹' Iio 0) ∪ |
| 82 | (N.carrier ∩ neckGraphHeight N f ⁻¹' Ioi 0) = |
| 83 | N.carrier \ range (fun p : UnitTwoSphere => N.coordinate_map (p, f p)) := by |
| 84 | have hq := continuousOn_neckGraphHeight N hf |
| 85 | refine ⟨hq.isOpen_inter_preimage N.carrier_open isOpen_Iio, |
| 86 | hq.isOpen_inter_preimage N.carrier_open isOpen_Ioi, ?_, ?_⟩ |
| 87 | · apply disjoint_left.mpr |
| 88 | intro x hx hy |
| 89 | have hn : neckGraphHeight N f x < 0 := hx.2 |
| 90 | have hp : 0 < neckGraphHeight N f x := hy.2 |
| 91 | exact (not_lt_of_ge hn.le) hp |
| 92 | · ext x |
| 93 | constructor |
| 94 | · rintro (hx | hx) |
| 95 | · exact ⟨hx.1, fun hz => (ne_of_lt hx.2) |
| 96 | ((neckGraphHeight_eq_zero_iff N hdom hx.1).mpr hz)⟩ |
| 97 | · exact ⟨hx.1, fun hz => (ne_of_gt hx.2) |
| 98 | ((neckGraphHeight_eq_zero_iff N hdom hx.1).mpr hz)⟩ |
| 99 | · rintro ⟨hx, hxS⟩ |
| 100 | have hne : neckGraphHeight N f x ≠ 0 := |
| 101 | fun hz => hxS ((neckGraphHeight_eq_zero_iff N hdom hx).mp hz) |
| 102 | rcases lt_or_gt_of_ne hne with hneg | hpos |
| 103 | · exact Or.inl ⟨hx, hneg⟩ |
| 104 | · exact Or.inr ⟨hx, hpos⟩ |
| 105 | |
| 106 | /-- Every open neighborhood of a literal graph point has a point on |
| 107 | either prescribed signed side. The witness is an actual axial coordinate |
| 108 | perturbation, not an assumed side or a separating-sphere certificate. -/ |
| 109 | theorem exists_neckGraphHeight_negative_in_open (N : EpsilonNeck g) |
| 110 | (f : UnitTwoSphere → ℝ) {T : Set M} (hT : IsOpen T) |
| 111 | (p : UnitTwoSphere) (hp : N.coordinate_map (p, f p) ∈ T) |
| 112 | (hdom : f p ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹) |
| 113 | {kappa : ℝ} (hkappa : kappa = 1 ∨ kappa = -1) : |
| 114 | ∃ y ∈ T, y ∈ N.carrier ∧ kappa * neckGraphHeight N f y < 0 := by |
| 115 | let z : ℝ → RoundCylinderSpace := fun t => (p, f p - kappa * t) |
| 116 | let curve : ℝ → M := N.coordinate_map ∘ z |
| 117 | have hz : Continuous z := |
| 118 | continuous_const.prodMk (continuous_const.sub (continuous_const.mul continuous_id)) |
| 119 | have hz0 : z 0 ∈ univ ×ˢ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹ := by |
| 120 | change p ∈ univ ∧ f p - kappa * 0 ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹ |
| 121 | simpa only [mul_zero, sub_zero] using And.intro (mem_univ p) hdom |
| 122 | have hcurve : ContinuousAt curve 0 := |
| 123 | (N.coordinate_map_smooth.continuousOn.continuousAt |
| 124 | ((isOpen_univ.prod isOpen_Ioo).mem_nhds hz0)).comp hz.continuousAt |
| 125 | have hcurve0 : curve 0 ∈ T := by |
| 126 | simpa only [curve, Function.comp_apply, z, mul_zero, sub_zero] using hp |
| 127 | have hW : {t : ℝ | z t ∈ univ ×ˢ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹ ∧ curve t ∈ T} |
| 128 | ∈ 𝓝 (0 : ℝ) := |
| 129 | inter_mem (hz.continuousAt.preimage_mem_nhds |
| 130 | ((isOpen_univ.prod isOpen_Ioo).mem_nhds hz0)) |
| 131 | (hcurve.preimage_mem_nhds (hT.mem_nhds hcurve0)) |
| 132 | obtain ⟨delta, hdelta, hball⟩ := Metric.mem_nhds_iff.mp hW |
| 133 | have ht : delta / 2 ∈ Metric.ball (0 : ℝ) delta := by |
| 134 | rw [Metric.mem_ball, Real.dist_eq, sub_zero, abs_of_pos (by positivity)] |
| 135 | linarith |
| 136 | obtain ⟨hstrip, hmem⟩ := hball ht |
| 137 | refine ⟨curve (delta / 2), hmem, N.coordinate_map_mem hstrip, ?_⟩ |
| 138 | change kappa * neckGraphHeight N f (N.coordinate_map (p, f p - kappa * (delta / 2))) < 0 |
| 139 | rw [neckGraphHeight_coordinate_map N f p hstrip.2] |
| 140 | dsimp only [z] |
| 141 | rcases hkappa with rfl | rfl <;> nlinarith |
| 142 | |
| 143 | /-- Opposite signs of this same literal graph height force a crossing |
| 144 | of this graph on a tested path contained in the actual neck carrier. -/ |
| 145 | theorem exists_neck_graph_crossing (N : EpsilonNeck g) |
| 146 | {f : UnitTwoSphere → ℝ} (hf : ContMDiff (𝓡 2) 𝓘(ℝ, ℝ) ∞ f) |
| 147 | (hdom : ∀ p, f p ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹) |
| 148 | {γ : ℝ → M} {a b : ℝ} (hab : a ≤ b) |
| 149 | (hγ : ContinuousOn γ (Icc a b)) (hγN : MapsTo γ (Icc a b) N.carrier) |
| 150 | {kappa : ℝ} (hkappa : kappa = 1 ∨ kappa = -1) |
| 151 | (ha : kappa * neckGraphHeight N f (γ a) < 0) |
| 152 | (hb : 0 < kappa * neckGraphHeight N f (γ b)) : |
| 153 | ∃ t ∈ Ioo a b, |
| 154 | γ t ∈ range (fun p : UnitTwoSphere => N.coordinate_map (p, f p)) := by |
| 155 | apply exists_sphere_crossing_of_signed_height |
| 156 | (continuousOn_const.mul (continuousOn_neckGraphHeight N hf)) ?_ hab hγ hγN ha hb |
| 157 | intro x hx |
| 158 | have hne : kappa ≠ 0 := by rcases hkappa with rfl | rfl <;> norm_num |
| 159 | change kappa * neckGraphHeight N f x = 0 ↔ |
| 160 | x ∈ range (fun p : UnitTwoSphere => N.coordinate_map (p, f p)) |
| 161 | rw [mul_eq_zero, or_iff_right hne] |
| 162 | exact neckGraphHeight_eq_zero_iff N hdom hx |
| 163 | |
| 164 | end PoincareMT.M28 |