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.StandardCap.Persistence.SourceNames.Metric |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Persistence.SourceNames.Normalization |
| 3 | import PoincareLib.Geometry.RicciFlow.Surgery.Metric.Distance.MetricComparison |
| 4 | import PoincareLib.Geometry.RicciFlow.Surgery.Metric.Standard.Radial.StandardBalls |
| 5 | import PoincareLib.Geometry.Riemannian.Normalization.Scaling.Distance |
| 6 | import PoincareLib.Geometry.Riemannian.ScalarOperators.Euclidean |
| 7 | |
| 8 | /-! |
| 9 | # Diameter of the actual transported standard birth ball |
| 10 | |
| 11 | A quadratic coordinate bound controls the lengths of straight |
| 12 | segments. Exact radial birth balls therefore give a diameter |
| 13 | bound in physical height units. Morgan--Tian, Claim 16.10, |
| 14 | p. 375; M44 derivation 76. |
| 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 | namespace PoincareMT.M44 |
| 24 | |
| 25 | local notation "E" => EuclideanSpace ℝ (Fin 3) |
| 26 | |
| 27 | attribute [local instance] normedAddCommGroupTangentSpaceVectorSpace |
| 28 | normedSpaceTangentSpaceVectorSpace |
| 29 | |
| 30 | /-- The Euclidean segment has its exact endpoint distance as |
| 31 | Riemannian path length. Source: the diameter estimate in |
| 32 | Claim 16.10, p. 375; M44 derivation 76. -/ |
| 33 | theorem euclidean_lineMap_pathELength (x y : E) : |
| 34 | (RiemannianMetric.euclideanMetric 3).pathELength |
| 35 | (ContinuousAffineMap.lineMap (R := ℝ) x y) 0 1 = edist x y := by |
| 36 | rw [M36.pathELength_eq_integral_speed _ |
| 37 | (contMDiff_iff_contDiff.mpr (ContinuousAffineMap.contDiff _)) zero_le_one] |
| 38 | have hspeed (t : ℝ) : M36.metricPathSpeed (RiemannianMetric.euclideanMetric 3) |
| 39 | (ContinuousAffineMap.lineMap (R := ℝ) x y) t = ‖y - x‖ := by |
| 40 | have hd : mfderiv 𝓘(ℝ, ℝ) (𝓡 3) (ContinuousAffineMap.lineMap (R := ℝ) x y) t = |
| 41 | (ContinuousLinearMap.id ℝ ℝ).smulRight (y - x) := by |
| 42 | rw [mfderiv_eq_fderiv, ContinuousAffineMap.fderiv] |
| 43 | apply ContinuousLinearMap.ext |
| 44 | intro a |
| 45 | change (AffineMap.lineMap (k := ℝ) x y).linear a = a • (y - x) |
| 46 | rw [AffineMap.lineMap_linear] |
| 47 | rfl |
| 48 | rw [M36.metricPathSpeed, RiemannianMetric.euclideanMetric_tangentNorm] |
| 49 | rw [hd] |
| 50 | change ‖(1 : ℝ) • (y - x)‖ = ‖y - x‖ |
| 51 | rw [one_smul] |
| 52 | simp only [hspeed, intervalIntegral.integral_const, sub_zero, one_smul, |
| 53 | edist_dist, dist_eq_norm, norm_sub_rev] |
| 54 | |
| 55 | variable {M : Type*} [TopologicalSpace M] [ChartedSpace E M] |
| 56 | [IsManifold (𝓡 3) ∞ M] |
| 57 | |
| 58 | /-- A quadratic pullback bound on a convex coordinate domain |
| 59 | controls actual ambient distance. Source: Claim 16.10, p. 375; |
| 60 | M44 derivation 76. -/ |
| 61 | theorem edist_image_le_of_convex_quadratic |
| 62 | (g : RiemannianMetric 3 M) {f : E → M} {U : Set E} |
| 63 | (hU : IsOpen U) (hconvex : Convex ℝ U) |
| 64 | (hf : ContMDiffOn (𝓡 3) (𝓡 3) ∞ f U) {L : ℝ} (hL : 0 < L) |
| 65 | (hmetric : ∀ x ∈ U, ∀ v : E, g.pullbackCoefficients f x v v ≤ L ^ 2 * ‖v‖ ^ 2) |
| 66 | {x y : E} (hx : x ∈ U) (hy : y ∈ U) : |
| 67 | g.edist (f x) (f y) ≤ ENNReal.ofReal (L * ‖x - y‖) := by |
| 68 | let gamma := ContinuousAffineMap.lineMap (R := ℝ) x y |
| 69 | let gE := m01RescaledMetric (RiemannianMetric.euclideanMetric 3) (L ^ 2) |
| 70 | (sq_pos_of_pos hL) |
| 71 | have hgamma : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 gamma (Icc 0 1) := |
| 72 | contMDiffOn_iff_contDiffOn.mpr gamma.contDiff.contDiffOn |
| 73 | have hmaps : gamma '' Icc 0 1 ⊆ U := by |
| 74 | simpa only [gamma, ContinuousAffineMap.coe_lineMap_eq, ← segment_eq_image_lineMap] using |
| 75 | hconvex.segment_subset hx hy |
| 76 | have hbound := M36.edist_comp_le_pathELength_of_pullback_bound gE g |
| 77 | (fun z hz => hf.contMDiffAt (hU.mem_nhds hz)) |
| 78 | (fun z hz v => by |
| 79 | change g.pullbackCoefficients f z v v ≤ L ^ 2 * @inner ℝ E _ v v |
| 80 | simpa only [real_inner_self_eq_norm_sq] using hmetric z hz v) |
| 81 | zero_le_one hgamma hmaps |
| 82 | rw [show gamma 0 = x by simp [gamma, ContinuousAffineMap.coe_lineMap_eq], |
| 83 | show gamma 1 = y by simp [gamma, ContinuousAffineMap.coe_lineMap_eq], |
| 84 | m01RescaledMetric_pathELength, euclidean_lineMap_pathELength, |
| 85 | Real.sqrt_sq hL.le, edist_dist, dist_eq_norm, ← ENNReal.ofReal_mul hL.le] at hbound |
| 86 | exact hbound |
| 87 | |
| 88 | /-- One coordinate upper bound yields a strict whole-ball |
| 89 | diameter bound in birth-height units. Source: Claim 16.10, |
| 90 | p. 375; M44 derivation 76. -/ |
| 91 | theorem standard_ball_image_diameter_lt |
| 92 | (g0 : StandardInitialMetric) (g : RiemannianMetric 3 M) |
| 93 | {R h L : ℝ} (hR : 0 < R) (hh : 0 < h) (hL : 0 < L) |
| 94 | {f : E → M} (hf : ContMDiffOn (𝓡 3) (𝓡 3) ∞ f (g0.metric.ball 0 R)) |
| 95 | (hmetric : ∀ x ∈ g0.metric.ball 0 R, ∀ v : E, |
| 96 | g.pullbackCoefficients f x v v ≤ (h * L) ^ 2 * ‖v‖ ^ 2) |
| 97 | {x y : E} (hx : x ∈ g0.metric.ball 0 R) (hy : y ∈ g0.metric.ball 0 R) : |
| 98 | g.edist (f x) (f y) < ENNReal.ofReal |
| 99 | (h * (2 * L * M36.radialEuclideanRadius g0 R)) := by |
| 100 | have hball := M36.standard_ball_eq_euclidean g0 hR |
| 101 | have hdist : ‖x - y‖ < 2 * M36.radialEuclideanRadius g0 R := by |
| 102 | rw [hball, Metric.mem_ball, dist_zero_right] at hx hy |
| 103 | exact (norm_sub_le x y).trans_lt (by linarith) |
| 104 | have hbound := edist_image_le_of_convex_quadratic g (hball ▸ Metric.isOpen_ball) |
| 105 | (hball ▸ convex_ball (0 : E) (M36.radialEuclideanRadius g0 R)) |
| 106 | hf (mul_pos hh hL) hmetric hx hy |
| 107 | apply hbound.trans_lt |
| 108 | apply ENNReal.ofReal_lt_ofReal_iff (by |
| 109 | have hrho := (M36.radialEuclideanRadius_pos_iff g0 R).mpr hR |
| 110 | positivity) |>.mpr |
| 111 | nlinarith only [mul_lt_mul_of_pos_left hdist (mul_pos hh hL)] |
| 112 | |
| 113 | end PoincareMT.M44 |