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.Standard.Radial.RadialDifferential |
| 2 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.DistLEIntegral |
| 3 | import Mathlib.Topology.Order.Compact |
| 4 | |
| 5 | /-! |
| 6 | # Intrinsic distance from the standard cap tip |
| 7 | |
| 8 | The radial path gives the upper bound. For the lower bound, take the |
| 9 | last zero of a C1 path starting at the tip. Radial arclength is smooth |
| 10 | on the remaining open interval and its derivative is bounded by metric |
| 11 | speed. The integral estimate permits nondifferentiability at the last |
| 12 | zero, so it applies without assuming smoothness of the distance at the tip. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle ENNReal Topology |
| 18 | open MeasureTheory |
| 19 | |
| 20 | namespace PoincareMT.MetricSurgery |
| 21 | |
| 22 | theorem radialArclength_le_pathELength (g₀ : StandardInitialMetric) |
| 23 | {gamma : ℝ → StandardCapSpace} |
| 24 | (hgamma : ContMDiff 𝓘(ℝ, ℝ) (𝓡 3) 1 gamma) (hzero : gamma 0 = 0) : |
| 25 | ENNReal.ofReal (radialArclength g₀ ‖gamma 1‖) ≤ |
| 26 | g₀.metric.pathELength gamma 0 1 := by |
| 27 | let Z : Set ℝ := Set.Icc 0 1 ∩ gamma ⁻¹' {0} |
| 28 | have hcompact : IsCompact Z := |
| 29 | isCompact_Icc.inter_right (isClosed_singleton.preimage hgamma.continuous) |
| 30 | have hZ : Z.Nonempty := ⟨0, ⟨⟨le_rfl, zero_le_one⟩, hzero⟩⟩ |
| 31 | obtain ⟨a, ha, hmax⟩ := hcompact.exists_isGreatest hZ |
| 32 | have ha0 : 0 ≤ a := ha.1.1 |
| 33 | have ha1 : a ≤ 1 := ha.1.2 |
| 34 | have hga : gamma a = 0 := ha.2 |
| 35 | have haway : ∀ t ∈ Set.Ioo a 1, gamma t ≠ 0 := by |
| 36 | intro t ht heq |
| 37 | have hta : t ≤ a := hmax ⟨⟨ha0.trans ht.1.le, ht.2.le⟩, heq⟩ |
| 38 | exact (not_lt_of_ge hta) ht.1 |
| 39 | have hdiff : Differentiable ℝ gamma := hgamma.contDiff.differentiable one_ne_zero |
| 40 | have hbound := norm_sub_le_integral_of_norm_deriv_le_of_le ha1 |
| 41 | (((radialArclength_contDiff g₀).continuous.comp hgamma.continuous.norm).continuousOn) |
| 42 | (show DifferentiableOn ℝ (fun t => radialArclength g₀ ‖gamma t‖) |
| 43 | (Set.Ioo a 1) from fun t ht => |
| 44 | (radial_path_hasDerivAt g₀ (hdiff t).hasDerivAt (haway t ht)).differentiableAt |
| 45 | |>.differentiableWithinAt) |
| 46 | (Filter.Eventually.of_forall fun t ht => |
| 47 | radial_path_deriv_bound g₀ (hdiff t) (haway t ht)) |
| 48 | ((metricPathSpeed_continuous g₀.metric hgamma).intervalIntegrable a 1) |
| 49 | have hnonneg : 0 ≤ radialArclength g₀ ‖gamma 1‖ := by |
| 50 | simpa only [radialArclength_zero] using |
| 51 | (radialArclength_strictMono g₀).monotone (norm_nonneg (gamma 1)) |
| 52 | simp only [Function.comp_apply, hga, norm_zero, radialArclength_zero, sub_zero, Real.norm_eq_abs, |
| 53 | abs_of_nonneg hnonneg] at hbound |
| 54 | calc |
| 55 | _ ≤ ENNReal.ofReal (∫ t in a..1, metricPathSpeed g₀.metric gamma t) := |
| 56 | ENNReal.ofReal_le_ofReal hbound |
| 57 | _ = g₀.metric.pathELength gamma a 1 := |
| 58 | (pathELength_eq_integral_speed g₀.metric hgamma ha1).symm |
| 59 | _ ≤ g₀.metric.pathELength gamma 0 1 := by |
| 60 | let : Bundle.RiemannianBundle |
| 61 | (TangentSpace (𝓡 3) : StandardCapSpace → Type _) := |
| 62 | ⟨g₀.metric.toRiemannianMetric⟩ |
| 63 | exact Manifold.pathELength_mono ha0 le_rfl |
| 64 | |
| 65 | theorem radialArclength_le_edist (g₀ : StandardInitialMetric) (x : StandardCapSpace) : |
| 66 | ENNReal.ofReal (radialArclength g₀ ‖x‖) ≤ g₀.metric.edist 0 x := by |
| 67 | by_contra h |
| 68 | have hlt := lt_of_not_ge h |
| 69 | let : Bundle.RiemannianBundle |
| 70 | (TangentSpace (𝓡 3) : StandardCapSpace → Type _) := |
| 71 | ⟨g₀.metric.toRiemannianMetric⟩ |
| 72 | obtain ⟨gamma, hzero, hx, hgamma, hlen, _, _⟩ := |
| 73 | Manifold.exists_lt_locally_constant_of_riemannianEDist_lt hlt zero_lt_one |
| 74 | have hlow := radialArclength_le_pathELength g₀ hgamma hzero |
| 75 | rw [hx] at hlow |
| 76 | exact (not_lt_of_ge hlow) hlen |
| 77 | |
| 78 | theorem unit_ray_metric (g₀ : StandardInitialMetric) |
| 79 | (u : StandardCapSpace) (hu : ‖u‖ = 1) (t : ℝ) : |
| 80 | g₀.metric.inner (t • u) u u = axisRadialCoefficient g₀ t := by |
| 81 | obtain ⟨L, hdet, hLu⟩ := exists_axis_isometry u hu |
| 82 | have hp : L (axisPoint t) = t • u := by rw [axisPoint_eq_smul, map_smul, hLu] |
| 83 | have h := standardInitialMetric_isometry_inner g₀ L hdet |
| 84 | (axisPoint t) (axisBasis 0) (axisBasis 0) |
| 85 | rw [hp, hLu] at h |
| 86 | exact h |
| 87 | |
| 88 | theorem metricPathSpeed_unit_ray (g₀ : StandardInitialMetric) |
| 89 | (u : StandardCapSpace) (hu : ‖u‖ = 1) (t : ℝ) : |
| 90 | metricPathSpeed g₀.metric (fun s : ℝ => s • u) t = radialSpeed g₀ t := by |
| 91 | have hd : HasDerivAt (fun s : ℝ => s • u) u t := by |
| 92 | convert! (hasDerivAt_id t).smul_const u using 1 |
| 93 | simp |
| 94 | have hm : mfderiv 𝓘(ℝ, ℝ) (𝓡 3) (fun s : ℝ => s • u) t 1 = u := by |
| 95 | rw [mfderiv_eq_fderiv] |
| 96 | exact hd.deriv |
| 97 | unfold metricPathSpeed RiemannianMetric.tangentNorm |
| 98 | rw [hm, unit_ray_metric g₀ u hu] |
| 99 | rfl |
| 100 | |
| 101 | theorem edist_le_radialArclength (g₀ : StandardInitialMetric) (x : StandardCapSpace) : |
| 102 | g₀.metric.edist 0 x ≤ ENNReal.ofReal (radialArclength g₀ ‖x‖) := by |
| 103 | let : Bundle.RiemannianBundle |
| 104 | (TangentSpace (𝓡 3) : StandardCapSpace → Type _) := |
| 105 | ⟨g₀.metric.toRiemannianMetric⟩ |
| 106 | by_cases hx : x = 0 |
| 107 | · subst x |
| 108 | change Manifold.riemannianEDist (𝓡 3) 0 0 ≤ _ |
| 109 | rw [Manifold.riemannianEDist_self] |
| 110 | exact bot_le |
| 111 | let u : StandardCapSpace := ‖x‖⁻¹ • x |
| 112 | have hu : ‖u‖ = 1 := by simp [u, norm_smul, norm_ne_zero_iff.mpr hx] |
| 113 | have hgamma : ContMDiff 𝓘(ℝ, ℝ) (𝓡 3) 1 (fun t : ℝ => t • u) := |
| 114 | (contDiff_id.smul contDiff_const).contMDiff |
| 115 | have hxend : ‖x‖ • u = x := by simp [u, smul_smul, norm_ne_zero_iff.mpr hx] |
| 116 | have hle : g₀.metric.edist 0 x ≤ |
| 117 | g₀.metric.pathELength (fun t : ℝ => t • u) 0 ‖x‖ := |
| 118 | Manifold.riemannianEDist_le_pathELength hgamma.contMDiffOn |
| 119 | (zero_smul ℝ u) hxend (norm_nonneg x) |
| 120 | apply hle.trans_eq |
| 121 | rw [pathELength_eq_integral_speed g₀.metric hgamma (norm_nonneg x)] |
| 122 | simp_rw [metricPathSpeed_unit_ray g₀ u hu] |
| 123 | rfl |
| 124 | |
| 125 | theorem standard_edist_zero (g₀ : StandardInitialMetric) (x : StandardCapSpace) : |
| 126 | g₀.metric.edist 0 x = ENNReal.ofReal (radialArclength g₀ ‖x‖) := |
| 127 | le_antisymm (edist_le_radialArclength g₀ x) (radialArclength_le_edist g₀ x) |
| 128 | |
| 129 | end PoincareMT.MetricSurgery |