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.SourceGeometry.Ends.SourceTubeFreshSlab |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.NeckGeometry.NeckFrontierDistance |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Paths.PathCrossingDistance |
| 5 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Cylinders.CylinderSphereCrossings |
| 6 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.CriticalBall.CriticalBallRetainedPath |
| 7 | |
| 8 | /-! |
| 9 | # A positive intrinsic source margin from an actual crossing height |
| 10 | |
| 11 | The short central-to-slab competitor and the strictly interior collar |
| 12 | escape cost leave one eighth of the fresh axial scale. The height is |
| 13 | supplied by the separate source sphere-order construction. Source: |
| 14 | Morgan--Tian Claim 10.8, p. 254; M28 derivation 124. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set |
| 21 | open scoped Manifold ContDiff Topology ENNReal |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.M28 |
| 26 | |
| 27 | namespace SourceTubeData |
| 28 | |
| 29 | variable {epsilon C A D0 D : ℝ} |
| 30 | {E : SameTimeCounterexample.{u} epsilon C A D0 D} |
| 31 | {S : CounterexampleNeckSegment E} |
| 32 | |
| 33 | /-- An actual continuous crossing height gives an additive margin in |
| 34 | the raw intrinsic tube metric. Infinite endpoint distances are allowed. |
| 35 | Source: Claim 10.8, p. 254; M28 derivation 124. -/ |
| 36 | theorem intrinsic_edist_add_le_of_fresh_sphere_height (T : SourceTubeData S) |
| 37 | (hsmall : epsilon ≤ (1 / 10000 : ℝ)) (f : UnitTwoSphere → ℝ) |
| 38 | (hf : Continuous f) (hbound : ∀ q, |f q| < epsilon⁻¹ / 32) |
| 39 | (N : EpsilonNeck (E.flow.metric E.time)) (heps : N.epsilon = epsilon) |
| 40 | (hscale : N.scale ≤ (101 / 100 : ℝ) * (T.list.node 0).2.scale) |
| 41 | (hterminal : Disjoint N.carrier |
| 42 | (closure ((T.list.node ((T.list.nodes.length - 1 : ℕ) : ℤ)).2.carrier))) |
| 43 | (b p x : T.carrierOpen) (hx : x.val ∈ N.carrier) |
| 44 | (hheight : |(N.coordinate_inverse x.val).2| ≤ 3 * epsilon⁻¹ / 4) |
| 45 | (hp : p.val ∉ N.carrier) |
| 46 | (hside : ∀ y ∈ N.central_sphere, y ∉ (T.list.node 0).2.belowGraph_m28 f) |
| 47 | (height : T.carrierOpen → ℝ) (hcont : Continuous height) |
| 48 | (hzero : ∀ y : T.carrierOpen, height y = 0 ↔ y.val ∈ N.central_sphere) |
| 49 | (hbneg : height b < 0) (hppos : 0 < height p) : |
| 50 | (intrinsicOpenMetric (E.flow.metric E.time) T.carrierOpen).edist b x + |
| 51 | ENNReal.ofReal (N.scale * epsilon⁻¹ / 8) ≤ |
| 52 | (intrinsicOpenMetric (E.flow.metric E.time) T.carrierOpen).edist b p := by |
| 53 | have hepspos : 0 < epsilon := heps ▸ N.epsilon_pos |
| 54 | have hA : 0 < epsilon⁻¹ := inv_pos.mpr hepspos |
| 55 | have hN := N.scale_pos |
| 56 | have hroot : (999 / 1000 : ℝ) ≤ Real.sqrt (1 - epsilon) := by |
| 57 | have hs := Real.sq_sqrt (show 0 ≤ 1 - epsilon by linarith) |
| 58 | nlinarith [Real.sqrt_nonneg (1 - epsilon)] |
| 59 | apply (intrinsicOpenMetric (E.flow.metric E.time) T.carrierOpen).edist_add_le_of_path_crossing |
| 60 | (S := {y : T.carrierOpen | y.val ∈ N.central_sphere}) |
| 61 | (c := ENNReal.ofReal ((151 / 200 : ℝ) * N.scale * epsilon⁻¹)) |
| 62 | (e := ENNReal.ofReal ((998001 / 1000000 : ℝ) * N.scale * epsilon⁻¹)) |
| 63 | ENNReal.ofReal_ne_top |
| 64 | · rw [← ENNReal.ofReal_add (by positivity) (by positivity)] |
| 65 | apply ENNReal.ofReal_le_ofReal |
| 66 | nlinarith only [mul_pos hN hA] |
| 67 | · intro gamma h0 h1 hgamma |
| 68 | obtain ⟨t, ht, hmem⟩ := exists_sphere_crossing_of_signed_height |
| 69 | (U := univ) hcont.continuousOn (fun y _ => hzero y) zero_le_one |
| 70 | hgamma.continuousOn (mapsTo_univ _ _) (by rwa [h0]) (by rwa [h1]) |
| 71 | exact ⟨t, ⟨ht.1.le, ht.2.le⟩, hmem⟩ |
| 72 | · intro y hy |
| 73 | let w : ℝ := (999 / 1000 : ℝ) * epsilon⁻¹ |
| 74 | have hw : 0 < w := mul_pos (by norm_num) hA |
| 75 | have hwA : w < N.epsilon⁻¹ := by rw [heps]; dsimp only [w]; linarith |
| 76 | have hnot : p.val ∉ N.region (-w) w := fun hmem => hp hmem.1 |
| 77 | have hambient := N.edist_central_lower_of_not_mem_region hw hwA hy hnot |
| 78 | rw [heps] at hambient |
| 79 | have hcost : (998001 / 1000000 : ℝ) * N.scale * epsilon⁻¹ ≤ |
| 80 | (N.scale * Real.sqrt (1 - epsilon)) * w := by |
| 81 | have hh := mul_le_mul_of_nonneg_right |
| 82 | (mul_le_mul_of_nonneg_left hroot hN.le) hw.le |
| 83 | dsimp only [w] at hh ⊢ |
| 84 | nlinarith only [hh] |
| 85 | rw [intrinsicOpenMetric_edist] |
| 86 | exact ((ENNReal.ofReal_le_ofReal hcost).trans hambient).trans |
| 87 | (RiemannianMetric.edist_le_intrinsicEDist (E.flow.metric E.time) |
| 88 | (T.carrierOpen : Set _) y.val p.val) |
| 89 | · intro y hy |
| 90 | obtain ⟨gamma, h0, h1, hgamma, _, hgammaT, hlength⟩ := |
| 91 | T.exists_central_slab_competitor_in_tube hsmall f hf hbound N heps hscale |
| 92 | hy y.property (hside y.val hy) hterminal hx hheight |
| 93 | have hd := intrinsicEDist_le_pathELength (E.flow.metric E.time) |
| 94 | zero_le_one hgamma hgammaT |
| 95 | rw [h0, h1] at hd |
| 96 | rw [intrinsicOpenMetric_edist] |
| 97 | exact (hd.trans_lt hlength).le |
| 98 | |
| 99 | end SourceTubeData |
| 100 | |
| 101 | namespace CounterexampleNeckFamily |
| 102 | |
| 103 | variable {epsilon C A : ℝ} |
| 104 | {E : ∀ n : ℕ, SameTimeCounterexample.{u} epsilon C A |
| 105 | ((n : ℝ) + 1) ((n : ℝ) + 1)} |
| 106 | |
| 107 | /-- The crossing margin scales by the square root of the original base |
| 108 | scalar in the actual normalized tube, with no change of carrier. |
| 109 | Source: Claim 10.8, p. 254; M28 derivation 124. -/ |
| 110 | theorem tube_edist_add_le_of_fresh_sphere_height |
| 111 | (H : CounterexampleNeckFamily E) (T : ∀ k, SourceTubeData (H.segment k)) |
| 112 | (k : ℕ) (hsmall : epsilon ≤ (1 / 10000 : ℝ)) (f : UnitTwoSphere → ℝ) |
| 113 | (hf : Continuous f) (hbound : ∀ q, |f q| < epsilon⁻¹ / 32) |
| 114 | (N : EpsilonNeck ((E (k + H.shift)).flow.metric (E (k + H.shift)).time)) |
| 115 | (heps : N.epsilon = epsilon) |
| 116 | (hscale : N.scale ≤ (101 / 100 : ℝ) * ((T k).list.node 0).2.scale) |
| 117 | (hterminal : Disjoint N.carrier |
| 118 | (closure (((T k).list.node (((T k).list.nodes.length - 1 : ℕ) : ℤ)).2.carrier))) |
| 119 | (p x : (T k).carrierOpen) (hx : x.val ∈ N.carrier) |
| 120 | (hheight : |(N.coordinate_inverse x.val).2| ≤ 3 * epsilon⁻¹ / 4) |
| 121 | (hp : p.val ∉ N.carrier) |
| 122 | (hside : ∀ y ∈ N.central_sphere, y ∉ ((T k).list.node 0).2.belowGraph_m28 f) |
| 123 | (height : (T k).carrierOpen → ℝ) (hcont : Continuous height) |
| 124 | (hzero : ∀ y : (T k).carrierOpen, height y = 0 ↔ y.val ∈ N.central_sphere) |
| 125 | (hbneg : height (H.tubeBase T k) < 0) (hppos : 0 < height p) : |
| 126 | (H.tubeMetric T k).edist (H.tubeBase T k) x + |
| 127 | ENNReal.ofReal (Real.sqrt ((E (k + H.shift)).flow.scalar |
| 128 | ⟨(E (k + H.shift)).time, (E (k + H.shift)).basepoint⟩) * |
| 129 | N.scale * epsilon⁻¹ / 8) ≤ |
| 130 | (H.tubeMetric T k).edist (H.tubeBase T k) p := by |
| 131 | let Q := (E (k + H.shift)).flow.scalar |
| 132 | ⟨(E (k + H.shift)).time, (E (k + H.shift)).basepoint⟩ |
| 133 | have hh := (T k).intrinsic_edist_add_le_of_fresh_sphere_height |
| 134 | hsmall f hf hbound N heps hscale hterminal (H.tubeBase T k) p x hx hheight |
| 135 | hp hside height hcont hzero hbneg hppos |
| 136 | rw [intrinsicOpenMetric_edist, intrinsicOpenMetric_edist] at hh |
| 137 | rw [tubeMetric, intrinsicOpenMetric_edist, intrinsicOpenMetric_edist, |
| 138 | H.normalizedSlice_intrinsicEDist, H.normalizedSlice_intrinsicEDist] |
| 139 | have hfactor : ENNReal.ofReal (Real.sqrt Q * N.scale * epsilon⁻¹ / 8) = |
| 140 | ENNReal.ofReal (Real.sqrt Q) * ENNReal.ofReal (N.scale * epsilon⁻¹ / 8) := by |
| 141 | rw [← ENNReal.ofReal_mul (Real.sqrt_nonneg Q)] |
| 142 | congr 1 |
| 143 | ring |
| 144 | change ENNReal.ofReal (Real.sqrt Q) * _ + |
| 145 | ENNReal.ofReal (Real.sqrt Q * N.scale * epsilon⁻¹ / 8) ≤ |
| 146 | ENNReal.ofReal (Real.sqrt Q) * _ |
| 147 | rw [hfactor, ← mul_add] |
| 148 | exact mul_le_mul_right hh _ |
| 149 | |
| 150 | end CounterexampleNeckFamily |
| 151 | |
| 152 | end PoincareMT.M28 |