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.CurveShortening.Comparison.IntrinsicComparison.Endpoint.Measure |
| 2 | |
| 3 | /-! |
| 4 | # Endpoint length on an arbitrary smooth target arc |
| 5 | |
| 6 | Morgan--Tian, Lemma 19.46, Case (ii), pp. 475-478, compares the retained |
| 7 | normal endpoints with both the circle and the returning geodesic. The |
| 8 | actual inverse lift and one-dimensional Jacobian give the same estimate |
| 9 | for a general target curve. A measurable height graph is sufficient. |
| 10 | See `derivations/2026-09-25-regional-first-exit-endpoints.md`. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set Filter MeasureTheory |
| 18 | open scoped Topology Manifold ContDiff Bundle Matrix ENNReal |
| 19 | |
| 20 | namespace PoincareMT |
| 21 | |
| 22 | attribute [local instance] normedAddCommGroupTangentSpaceVectorSpace |
| 23 | normedSpaceTangentSpaceVectorSpace |
| 24 | |
| 25 | /-- Differentiate an actual target-curve lift and discard the nonnegative |
| 26 | vertical term in the normal metric bound; Lemma 19.46, pp. 475-478. -/ |
| 27 | theorem m64Intrinsic_curve_lift_speed_le |
| 28 | (N : IntrinsicAnnulus) |
| 29 | {e : AnnulusCoordinates → AnnulusCoordinates} |
| 30 | {gamma target : ℝ → AnnulusCoordinates} {s c : ℝ} |
| 31 | (he : DifferentiableAt ℝ e (gamma s)) (hg : DifferentiableAt ℝ gamma s) |
| 32 | (hlift : (e ∘ gamma) =ᶠ[𝓝 s] target) |
| 33 | (hbound : ∀ v : AnnulusCoordinates, |
| 34 | c ^ 2 * (intrinsicBoundarySpeed N.metric 1 (gamma s 0) ^ 2 * (v 0) ^ 2 + |
| 35 | (v 1) ^ 2) ≤ N.metric.inner (e (gamma s)) |
| 36 | (fderiv ℝ e (gamma s) v) (fderiv ℝ e (gamma s) v)) : |
| 37 | c * intrinsicBoundarySpeed N.metric 1 (gamma s 0) * |deriv gamma s 0| ≤ |
| 38 | Real.sqrt (N.metric.inner (target s) (deriv target s) (deriv target s)) := by |
| 39 | have hchain : HasDerivAt (e ∘ gamma) (fderiv ℝ e (gamma s) (deriv gamma s)) s := |
| 40 | he.hasFDerivAt.comp_hasDerivAt s hg.hasDerivAt |
| 41 | have hd : fderiv ℝ e (gamma s) (deriv gamma s) = deriv target s := |
| 42 | (hchain.congr_of_eventuallyEq hlift.symm).deriv.symm |
| 43 | have hpoint : e (gamma s) = target s := hlift.self_of_nhds |
| 44 | have h := hbound (deriv gamma s) |
| 45 | rw [hd, hpoint] at h |
| 46 | apply Real.le_sqrt_of_sq_le |
| 47 | have hdiscard : 0 ≤ c ^ 2 * (deriv gamma s 1) ^ 2 := |
| 48 | mul_nonneg (sq_nonneg c) (sq_nonneg _) |
| 49 | rw [mul_pow, mul_pow, sq_abs] |
| 50 | nlinarith only [h, hdiscard] |
| 51 | |
| 52 | /-- The actual target speed bounds the base length of any measurable |
| 53 | injectively projected lift, including zero projected derivatives; |
| 54 | Lemma 19.46, pp. 475-478. -/ |
| 55 | theorem m64Intrinsic_lifted_curve_measure_le |
| 56 | (N : IntrinsicAnnulus) |
| 57 | {e : AnnulusCoordinates → AnnulusCoordinates} |
| 58 | {gamma target : ℝ → AnnulusCoordinates} |
| 59 | {J B : Set ℝ} (hJ : IsOpen J) (hg : ContDiffOn ℝ ∞ gamma J) |
| 60 | (he : ∀ s ∈ J, DifferentiableAt ℝ e (gamma s)) |
| 61 | (hlift : ∀ s ∈ J, e (gamma s) = target s) |
| 62 | (hB : MeasurableSet B) (hBJ : B ⊆ J) |
| 63 | (hinj : InjOn (fun s => gamma s 0) B) {c : ℝ} (hc : 0 ≤ c) |
| 64 | (hbound : ∀ s ∈ B, ∀ v : AnnulusCoordinates, |
| 65 | c ^ 2 * (intrinsicBoundarySpeed N.metric 1 (gamma s 0) ^ 2 * (v 0) ^ 2 + |
| 66 | (v 1) ^ 2) ≤ N.metric.inner (e (gamma s)) |
| 67 | (fderiv ℝ e (gamma s) v) (fderiv ℝ e (gamma s) v)) : |
| 68 | ENNReal.ofReal c * |
| 69 | (∫⁻ a in (fun s => gamma s 0) '' B, |
| 70 | ENNReal.ofReal (intrinsicBoundarySpeed N.metric 1 a)) ≤ |
| 71 | ∫⁻ s in B, ENNReal.ofReal |
| 72 | (Real.sqrt (N.metric.inner (target s) (deriv target s) (deriv target s))) := by |
| 73 | let f : ℝ → ℝ := fun s => gamma s 0 |
| 74 | let f' : ℝ → ℝ := fun s => deriv gamma s 0 |
| 75 | have hga (s : ℝ) (hs : s ∈ B) : ContDiffAt ℝ ∞ gamma s := |
| 76 | hg.contDiffAt (hJ.mem_nhds (hBJ hs)) |
| 77 | have hdf (s : ℝ) (hs : s ∈ B) : HasDerivAt f (f' s) s := |
| 78 | (PiLp.hasFDerivAt_apply (𝕜 := ℝ) 2 (gamma s) 0).comp_hasDerivAt s |
| 79 | ((hga s hs).differentiableAt (by simp)).hasDerivAt |
| 80 | have hchange := lintegral_image_eq_lintegral_abs_deriv_mul hB |
| 81 | (fun s hs => (hdf s hs).hasDerivWithinAt) hinj |
| 82 | (fun a => ENNReal.ofReal (intrinsicBoundarySpeed N.metric 1 a)) |
| 83 | rw [hchange, ← lintegral_const_mul' _ _ ENNReal.ofReal_ne_top] |
| 84 | apply setLIntegral_mono' hB |
| 85 | intro s hs |
| 86 | have hspeed := m64Intrinsic_curve_lift_speed_le N (he s (hBJ hs)) |
| 87 | ((hga s hs).differentiableAt (by simp)) (target := target) |
| 88 | (c := c) (hbound := hbound s hs) (by |
| 89 | filter_upwards [hJ.mem_nhds (hBJ hs)] with x hx |
| 90 | exact hlift x hx) |
| 91 | rw [← ENNReal.ofReal_mul (abs_nonneg _), ← ENNReal.ofReal_mul hc] |
| 92 | apply ENNReal.ofReal_le_ofReal |
| 93 | convert hspeed using 1 |
| 94 | dsimp only [f, f'] |
| 95 | ring |
| 96 | |
| 97 | /-- A measurable height graph makes its lifted base projection injective |
| 98 | whenever the actual target parameters are injective; Lemma 19.46, p. 477. -/ |
| 99 | theorem m64Intrinsic_lifted_curve_endpoint_graph_measure_le |
| 100 | (N : IntrinsicAnnulus) |
| 101 | {e : AnnulusCoordinates → AnnulusCoordinates} |
| 102 | {gamma target : ℝ → AnnulusCoordinates} |
| 103 | {J B T : Set ℝ} (hJ : IsOpen J) (hg : ContDiffOn ℝ ∞ gamma J) |
| 104 | (he : ∀ s ∈ J, DifferentiableAt ℝ e (gamma s)) |
| 105 | (hlift : ∀ s ∈ J, e (gamma s) = target s) |
| 106 | (hB : MeasurableSet B) (hBJ : B ⊆ J) (hBT : B ⊆ T) |
| 107 | (htargetInj : InjOn target T) |
| 108 | {height : ℝ → ℝ} (hgraph : ∀ s ∈ B, gamma s 1 = height (gamma s 0)) |
| 109 | {c : ℝ} (hc : 0 ≤ c) |
| 110 | (hbound : ∀ s ∈ B, ∀ v : AnnulusCoordinates, |
| 111 | c ^ 2 * (intrinsicBoundarySpeed N.metric 1 (gamma s 0) ^ 2 * (v 0) ^ 2 + |
| 112 | (v 1) ^ 2) ≤ N.metric.inner (e (gamma s)) |
| 113 | (fderiv ℝ e (gamma s) v) (fderiv ℝ e (gamma s) v)) : |
| 114 | ENNReal.ofReal c * |
| 115 | (∫⁻ a in (fun s => gamma s 0) '' B, |
| 116 | ENNReal.ofReal (intrinsicBoundarySpeed N.metric 1 a)) ≤ |
| 117 | ∫⁻ s in B, ENNReal.ofReal |
| 118 | (Real.sqrt (N.metric.inner (target s) (deriv target s) (deriv target s))) := by |
| 119 | apply m64Intrinsic_lifted_curve_measure_le N hJ hg he hlift hB hBJ ?_ hc hbound |
| 120 | intro x hx y hy hxy |
| 121 | change gamma x 0 = gamma y 0 at hxy |
| 122 | have hgamma : gamma x = gamma y := by |
| 123 | ext i |
| 124 | fin_cases i |
| 125 | · exact hxy |
| 126 | · change gamma x 1 = gamma y 1 |
| 127 | rw [hgraph x hx, hgraph y hy, hxy] |
| 128 | apply htargetInj (hBT hx) (hBT hy) |
| 129 | rw [← hlift x (hBJ hx), ← hlift y (hBJ hy), hgamma] |
| 130 | |
| 131 | end PoincareMT |