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.Surgery.Metric.Distance.GlobalMetricBounds |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.Metric.Distance.BallDistanceComparison |
| 3 | |
| 4 | /-! |
| 5 | # The two cap-ball containments |
| 6 | |
| 7 | Morgan--Tian Lemma 13.4, pp.333-334. Global metric comparison gives |
| 8 | radial distance bounds for the actual output metric. A threshold fixed |
| 9 | from C and A0 alone makes the lower margin exceed A0+3 and the upper |
| 10 | margin less than A0+5. The cap image itself still has radius A0+4 in |
| 11 | the standard metric, as required by Definition 13.3. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open scoped Manifold ContDiff ENNReal Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.MetricSurgery |
| 22 | |
| 23 | variable {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 25 | {g : RiemannianMetric 3 M} |
| 26 | |
| 27 | theorem sqrt_div_scalar_eq_scale (N : EpsilonNeck g) {a : ℝ} (ha : 0 ≤ a) : |
| 28 | Real.sqrt (a / N.connection.scalarCurvature N.center) = Real.sqrt a * N.scale := by |
| 29 | rw [← neck_scale_inverse_sq N, Real.sqrt_div ha, Real.sqrt_sq (inv_pos.mpr N.scale_pos).le, |
| 30 | div_eq_mul_inv, inv_inv] |
| 31 | |
| 32 | theorem surgeryMetric_radial_distance_bounds (g₀ : StandardInitialMetric) |
| 33 | (N : EpsilonNeck g) (hcut : surgeryCapRadius g₀ < N.epsilon⁻¹) |
| 34 | (hsmall : N.epsilon < 1 / 200) {C : ℝ} (hC : 0 ≤ C) (q : ℝ) |
| 35 | {r : ℝ} (hr : 0 < r) (y : SurgeryBall.{u} g₀ (surgeryOuterRadius g₀ N.epsilon)) : |
| 36 | ENNReal.ofReal (Real.sqrt ((1 - 6 * N.epsilon) * Real.exp (-2 * C * N.epsilon)) * |
| 37 | N.scale * radialArclength g₀ ‖surgeryBallInclusion g₀ _ y‖) ≤ |
| 38 | (surgeryMetric g₀ N hcut C q (1 - 6 * N.epsilon) r N.scalar_center_pos |
| 39 | (neck_contraction_coefficient_pos N hsmall) hr).edist |
| 40 | (surgeryBallTip g₀ (surgeryOuterRadius_pos g₀ N)) y ∧ |
| 41 | (surgeryMetric g₀ N hcut C q (1 - 6 * N.epsilon) r N.scalar_center_pos |
| 42 | (neck_contraction_coefficient_pos N hsmall) hr).edist |
| 43 | (surgeryBallTip g₀ (surgeryOuterRadius_pos g₀ N)) y ≤ |
| 44 | ENNReal.ofReal (Real.sqrt (1 + 6 * N.epsilon) * |
| 45 | N.scale * radialArclength g₀ ‖surgeryBallInclusion g₀ _ y‖) := by |
| 46 | let G := surgeryMetric g₀ N hcut C q (1 - 6 * N.epsilon) r N.scalar_center_pos |
| 47 | (neck_contraction_coefficient_pos N hsmall) hr |
| 48 | have hbeta : 0 < (1 - 6 * N.epsilon) * Real.exp (-2 * C * N.epsilon) := |
| 49 | mul_pos (neck_contraction_coefficient_pos N hsmall) (Real.exp_pos _) |
| 50 | have hupper : 0 < 1 + 6 * N.epsilon := by have := N.epsilon_pos; positivity |
| 51 | constructor |
| 52 | · have hbound := surgeryBall_radial_distance_lower g₀ (surgeryOuterRadius_pos g₀ N) G |
| 53 | (div_pos hbeta N.scalar_center_pos) (fun z v => ?_) y |
| 54 | · rw [sqrt_div_scalar_eq_scale N hbeta.le] at hbound |
| 55 | exact hbound |
| 56 | · rw [div_mul_eq_mul_div] |
| 57 | apply (div_le_iff₀ N.scalar_center_pos).mpr |
| 58 | have hb := (surgeryMetric_global_bounds g₀ N hcut hsmall hC q hr z v).1 |
| 59 | exact hb.trans_eq (mul_comm _ _) |
| 60 | · have hbound := surgeryBall_radial_distance_upper g₀ (surgeryOuterRadius_pos g₀ N) G |
| 61 | (div_pos hupper N.scalar_center_pos) (fun z v => ?_) y |
| 62 | · rw [sqrt_div_scalar_eq_scale N hupper.le] at hbound |
| 63 | exact hbound |
| 64 | · rw [div_mul_eq_mul_div] |
| 65 | apply (le_div_iff₀ N.scalar_center_pos).mpr |
| 66 | have hb := (surgeryMetric_global_bounds g₀ N hcut hsmall hC q hr z v).2 |
| 67 | exact (mul_comm _ _).trans_le hb |
| 68 | |
| 69 | theorem surgeryMetric_cap_ball_bounds (g₀ : StandardInitialMetric) |
| 70 | (N : EpsilonNeck g) (hcut : surgeryCapRadius g₀ < N.epsilon⁻¹) |
| 71 | (hsmall : N.epsilon < 1 / 200) {C : ℝ} (hC : 0 ≤ C) (q : ℝ) |
| 72 | {r : ℝ} (hr : 0 < r) |
| 73 | (hsize : N.epsilon ≤ 1 / (surgeryCapRadius g₀ * (6 + 2 * C))) : |
| 74 | (surgeryMetric g₀ N hcut C q (1 - 6 * N.epsilon) r N.scalar_center_pos |
| 75 | (neck_contraction_coefficient_pos N hsmall) hr).ball |
| 76 | (surgeryBallTip g₀ (surgeryOuterRadius_pos g₀ N)) |
| 77 | (N.scale * (g₀.cylindrical_end.radius + 3)) ⊆ |
| 78 | surgeryBallChart g₀ (surgeryOuterRadius g₀ N.epsilon) '' |
| 79 | g₀.metric.ball 0 (surgeryCapRadius g₀) ∧ |
| 80 | surgeryBallChart g₀ (surgeryOuterRadius g₀ N.epsilon) '' |
| 81 | g₀.metric.ball 0 (surgeryCapRadius g₀) ⊆ |
| 82 | (surgeryMetric g₀ N hcut C q (1 - 6 * N.epsilon) r N.scalar_center_pos |
| 83 | (neck_contraction_coefficient_pos N hsmall) hr).ball |
| 84 | (surgeryBallTip g₀ (surgeryOuterRadius_pos g₀ N)) |
| 85 | (N.scale * (g₀.cylindrical_end.radius + 5)) := by |
| 86 | let A := surgeryCapRadius g₀ |
| 87 | let beta := (1 - 6 * N.epsilon) * Real.exp (-2 * C * N.epsilon) |
| 88 | let R := fun y : SurgeryBall.{u} g₀ (surgeryOuterRadius g₀ N.epsilon) => |
| 89 | radialArclength g₀ ‖surgeryBallInclusion g₀ _ y‖ |
| 90 | have hA : 1 < A := by dsimp [A, surgeryCapRadius]; linarith [g₀.cylindrical_end.radius_pos] |
| 91 | have hmargins := surgery_ball_factor_margins hA hC N.epsilon_pos.le |
| 92 | (neck_contraction_coefficient_pos N hsmall) hsize |
| 93 | change A - 1 < Real.sqrt beta * A ∧ Real.sqrt (1 + 6 * N.epsilon) * A < A + 1 at hmargins |
| 94 | have hbeta : 0 < beta := |
| 95 | mul_pos (neck_contraction_coefficient_pos N hsmall) (Real.exp_pos _) |
| 96 | have hupper : 0 < 1 + 6 * N.epsilon := by have := N.epsilon_pos; positivity |
| 97 | have hinner : g₀.cylindrical_end.radius + 3 = A - 1 := by dsimp [A, surgeryCapRadius]; ring |
| 98 | have houter : g₀.cylindrical_end.radius + 5 = A + 1 := by dsimp [A, surgeryCapRadius]; ring |
| 99 | rw [surgeryBallChart_image_standardBall g₀ _ (surgeryCapRadius_pos g₀) |
| 100 | (le_add_of_nonneg_right (inv_pos.mpr N.epsilon_pos).le), hinner, houter] |
| 101 | constructor |
| 102 | · intro y hy |
| 103 | change R y < A |
| 104 | have hlo := (surgeryMetric_radial_distance_bounds g₀ N hcut hsmall hC q hr y).1 |
| 105 | have hpos : 0 < N.scale * (A - 1) := mul_pos N.scale_pos (sub_pos.mpr hA) |
| 106 | have hlt : Real.sqrt beta * N.scale * R y < N.scale * (A - 1) := |
| 107 | (ENNReal.ofReal_lt_ofReal_iff hpos).mp (hlo.trans_lt hy) |
| 108 | by_contra hnot |
| 109 | have hge := le_of_not_gt hnot |
| 110 | have hR := mul_le_mul_of_nonneg_left hge |
| 111 | (mul_nonneg (Real.sqrt_nonneg beta) N.scale_pos.le) |
| 112 | have hmargin := mul_lt_mul_of_pos_left hmargins.1 N.scale_pos |
| 113 | nlinarith |
| 114 | · intro y hy |
| 115 | change R y < A at hy |
| 116 | change _ < ENNReal.ofReal (N.scale * (A + 1)) |
| 117 | apply lt_of_le_of_lt (surgeryMetric_radial_distance_bounds g₀ N hcut hsmall hC q hr y).2 |
| 118 | apply ENNReal.ofReal_lt_ofReal_iff (mul_pos N.scale_pos (by linarith)) |>.mpr |
| 119 | have hR := mul_lt_mul_of_pos_left hy |
| 120 | (mul_pos (Real.sqrt_pos.mpr hupper) N.scale_pos) |
| 121 | have hmargin := mul_lt_mul_of_pos_left hmargins.2 N.scale_pos |
| 122 | nlinarith |
| 123 | |
| 124 | end PoincareMT.MetricSurgery |