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.Cyclic.RetainedStripLosses |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Endpoint.Projection |
| 3 | |
| 4 | /-! Length comparison with outer endpoints outside a null exceptional set. |
| 5 | Source: MT Proposition 19.35, pp. 479-481; local-inverse-self-return |
| 6 | derivation, Section 5. Zeroed exceptional heights are not outer endpoints. -/ |
| 7 | |
| 8 | noncomputable section |
| 9 | set_option autoImplicit false |
| 10 | set_option backward.isDefEq.respectTransparency false |
| 11 | |
| 12 | open Set MeasureTheory |
| 13 | open scoped Manifold ContDiff Bundle Matrix ENNReal |
| 14 | |
| 15 | namespace PoincareMT |
| 16 | |
| 17 | attribute [local instance] normedAddCommGroupTangentSpaceVectorSpace |
| 18 | normedSpaceTangentSpaceVectorSpace |
| 19 | |
| 20 | /-- Cyclic retained-strip comparison only requires outer endpoints on a measurable set of |
| 21 | full measure. The final endpoint set is intersected with that set before applying |
| 22 | projection, preserving its actual integral. Source: MT Proposition 19.35; |
| 23 | local-inverse-self-return derivation, Section 5. Source/construction: |
| 24 | proof-work/tasks/M64/derivations/2026-09-27-local-inverse-self-return.md, Section 5. -/ |
| 25 | theorem m64Intrinsic_comparison_of_cyclic_retained_strip_ae_outer |
| 26 | (N : IntrinsicAnnulus) (e : AnnulusCoordinates → AnnulusCoordinates) |
| 27 | (he : ContDiff ℝ ∞ e) {height : ℝ → ℝ} (hh : Measurable height) |
| 28 | (hheight_nonneg : ∀ a, 0 ≤ height a) |
| 29 | {Good : Set ℝ} (hGood : MeasurableSet Good) (hGoodAE : Good =ᵐ[volume] univ) |
| 30 | {delta r alpha R rho kappa : ℝ} |
| 31 | (hdelta : 0 < delta) (hdeltaSmall : delta < 1 / 100) (hr : 0 < r) |
| 32 | (hfirst : r < intrinsicBoundaryLength N.metric 1 0 rampPeriod) |
| 33 | (hturn : N.SmallBoundaryTurning delta r) (halpha : 100 * delta / r ≤ alpha) |
| 34 | (hR : 0 < R) (hrho : 0 < rho) (hkappa : 0 < kappa) |
| 35 | (hangle : kappa * rho ≤ Real.pi / 4) |
| 36 | (hrhoSmall : rho ≤ 3 * r / (1600 * delta)) |
| 37 | (harea : intrinsicAnnulusArea N.metric < (1 - delta) ^ 2 * R * (r / 10)) |
| 38 | (hray : ∀ a ∈ Ico (0 : ℝ) rampPeriod, |
| 39 | intrinsicGeodesicCurvature N.metric N.connection 1 a ≤ alpha → |
| 40 | InjOn (fun t => e !₂[a, t]) (Icc 0 (height a))) |
| 41 | (hfocus : ∀ a ∈ Ico (0 : ℝ) rampPeriod, |
| 42 | intrinsicGeodesicCurvature N.metric N.connection 1 a ≤ alpha → |
| 43 | ∀ b ∈ Ico (0 : ℝ) rampPeriod, |
| 44 | intrinsicGeodesicCurvature N.metric N.connection 1 b ≤ alpha → a < b → |
| 45 | (∃ t ∈ Icc 0 (height a), ∃ s ∈ Icc 0 (height b), |
| 46 | e !₂[a, t] = e !₂[b, s]) → |
| 47 | (Real.cos (kappa * rho) * intrinsicBoundaryLength N.metric 1 a b ≤ |
| 48 | (Real.sin (kappa * rho) / kappa) * |
| 49 | intrinsicGeodesicCurvatureIntegral N.metric N.connection 1 a b) ∨ |
| 50 | (Real.cos (kappa * rho) * intrinsicBoundaryLength N.metric 1 b (a + rampPeriod) ≤ |
| 51 | (Real.sin (kappa * rho) / kappa) * |
| 52 | intrinsicGeodesicCurvatureIntegral N.metric N.connection 1 b (a + rampPeriod))) |
| 53 | (hmetric : ∀ x : AnnulusCoordinates, x 0 ∈ Ico (0 : ℝ) rampPeriod → |
| 54 | intrinsicGeodesicCurvature N.metric N.connection 1 (x 0) ≤ alpha → |
| 55 | x 1 ∈ Icc 0 (height (x 0)) → ∀ v : AnnulusCoordinates, |
| 56 | (1 - delta) ^ 2 * |
| 57 | (intrinsicBoundarySpeed N.metric 1 (x 0) ^ 2 * (v 0) ^ 2 + (v 1) ^ 2) ≤ |
| 58 | N.metric.inner (e x) (mfderiv (𝓡 2) (𝓡 2) e x v) |
| 59 | (mfderiv (𝓡 2) (𝓡 2) e x v)) |
| 60 | (himage : ∀ x : AnnulusCoordinates, x 0 ∈ Ico (0 : ℝ) rampPeriod → |
| 61 | intrinsicGeodesicCurvature N.metric N.connection 1 (x 0) ≤ alpha → |
| 62 | x 1 ∈ Icc 0 (height (x 0)) → e x ∈ standardAnnulusDomain) |
| 63 | (hendpoint_reg : ∀ a ∈ Ico (0 : ℝ) rampPeriod, |
| 64 | intrinsicGeodesicCurvature N.metric N.connection 1 a ≤ alpha → |
| 65 | height a < R → |
| 66 | Function.Injective (mfderiv (𝓡 2) (𝓡 2) e !₂[a, height a])) |
| 67 | (houter : ∀ a ∈ Ico (0 : ℝ) rampPeriod, |
| 68 | intrinsicGeodesicCurvature N.metric N.connection 1 a ≤ alpha → |
| 69 | height a < R → a ∈ Good → ‖e !₂[a, height a]‖ = 2) : |
| 70 | (3 / 4 : ℝ) * intrinsicBoundaryLength N.metric 1 0 rampPeriod < |
| 71 | intrinsicBoundaryLength N.metric 2 0 rampPeriod := by |
| 72 | obtain ⟨E, hE, hEsub, hfocusLoss, hS, hZ, hinj, _, hlong, hshort⟩ := |
| 73 | m64Intrinsic_exists_cyclic_retained_strip_three_losses N e |
| 74 | (he.differentiable (by simp)) hh |
| 75 | hdelta hdeltaSmall hr hfirst hturn halpha hR hrho hkappa hangle hrhoSmall harea |
| 76 | hray hfocus hmetric himage |
| 77 | let Z : Set ℝ := |
| 78 | ((Ico (0 : ℝ) rampPeriod ∩ |
| 79 | {s | intrinsicGeodesicCurvature N.metric N.connection 1 s ≤ alpha}) \ E) ∩ |
| 80 | {s | height s < R} |
| 81 | have hZeq : Z = ((Ico (0 : ℝ) rampPeriod ∩ |
| 82 | {s | intrinsicGeodesicCurvature N.metric N.connection 1 s ≤ alpha}) \ E) ∩ |
| 83 | {s | height s < R} := rfl |
| 84 | have hZsub : Z ⊆ Ico (0 : ℝ) rampPeriod := by |
| 85 | intro a ha |
| 86 | exact ha.1.1.1 |
| 87 | have hZend : ∀ a ∈ Z ∩ Good, ‖e !₂[a, height a]‖ = 2 := by |
| 88 | intro a ha |
| 89 | exact houter a ha.1.1.1.1 ha.1.1.1.2 ha.1.2 ha.2 |
| 90 | have hZinj : InjOn (fun a => e !₂[a, height a]) Z := by |
| 91 | intro a ha b hb hab |
| 92 | have hpair : !₂[a, height a] = !₂[b, height b] := by |
| 93 | apply hinj |
| 94 | · exact ⟨ha.1, ⟨hheight_nonneg a, le_rfl⟩⟩ |
| 95 | · exact ⟨hb.1, ⟨hheight_nonneg b, le_rfl⟩⟩ |
| 96 | · exact hab |
| 97 | have hcoord := congrArg (fun z : AnnulusCoordinates => z 0) hpair |
| 98 | simpa only [Matrix.cons_val_zero] using hcoord |
| 99 | have hZreg : ∀ a ∈ Z, |
| 100 | Function.Injective (mfderiv (𝓡 2) (𝓡 2) e !₂[a, height a]) := by |
| 101 | intro a ha |
| 102 | exact hendpoint_reg a ha.1.1.1 ha.1.1.2 ha.2 |
| 103 | have hZbound : ∀ a ∈ Z, ∀ v : AnnulusCoordinates, |
| 104 | (1 - delta) ^ 2 * |
| 105 | (intrinsicBoundarySpeed N.metric 1 a ^ 2 * (v 0) ^ 2 + (v 1) ^ 2) ≤ |
| 106 | N.metric.inner (e !₂[a, height a]) |
| 107 | (fderiv ℝ e !₂[a, height a] v) (fderiv ℝ e !₂[a, height a] v) := by |
| 108 | intro a ha v |
| 109 | convert hmetric !₂[a, height a] ha.1.1.1 ha.1.1.2 |
| 110 | ⟨hheight_nonneg a, le_rfl⟩ v using 1 <;> |
| 111 | simp only [mfderiv_eq_fderiv, Matrix.cons_val_zero] |
| 112 | all_goals rfl |
| 113 | have hproj := m64Intrinsic_endpoint_projection_length_le N e |
| 114 | he hh (hZ.inter hGood) (inter_subset_left.trans hZsub) |
| 115 | (hZinj.mono inter_subset_left) (fun a ha => hZreg a ha.1) hZend |
| 116 | (sub_nonneg.mpr (by linarith)) (fun a ha => hZbound a ha.1) |
| 117 | have hAE : (Z ∩ Good : Set ℝ) =ᵐ[volume] Z := inter_ae_eq_left_of_ae_eq_univ hGoodAE |
| 118 | rw [setIntegral_congr_set hAE] at hproj |
| 119 | have hproj' : (1 - delta) * |
| 120 | (∫ s in Z, intrinsicBoundarySpeed N.metric 1 s) ≤ |
| 121 | intrinsicBoundaryLength N.metric 2 0 rampPeriod := by |
| 122 | simpa only [hZeq] using hproj |
| 123 | have hshort' : (3 / 4 : ℝ) * |
| 124 | intrinsicBoundaryLength N.metric 1 0 rampPeriod < |
| 125 | (1 - delta) * (∫ s in Z, intrinsicBoundarySpeed N.metric 1 s) := by |
| 126 | simpa only [Z] using hshort |
| 127 | exact hshort'.trans_le hproj' |
| 128 | |
| 129 | end PoincareMT |