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.Volume.Surgery.Measure.Distance.CurveCalculus |
| 2 | import PoincareLib.Geometry.RicciFlow.Volume.Surgery.Measure.Distance.SupportIntegral |
| 3 | |
| 4 | /-! |
| 5 | Adapted from Mapher `PoincareMT/Proofs/M10/PathSupports.lean` at |
| 6 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. |
| 7 | |
| 8 | # Upper supports control variation along Riemannian paths |
| 9 | |
| 10 | Touching spatial supports are pulled back along actual C1 paths. Their |
| 11 | directional derivative bounds integrate to the selected metric's path |
| 12 | length. Reversal gives a two-sided endpoint estimate. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open MeasureTheory Set Filter |
| 18 | open scoped Manifold ContDiff Bundle Topology ENNReal |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.SurgeryVolume.Measure |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 26 | {γ : ℝ → M} |
| 27 | |
| 28 | /-- An upper-support differential bound controls growth along a C1 path. -/ |
| 29 | theorem sub_le_integral_speed_of_upper_supports |
| 30 | (g : RiemannianMetric n M) {f : M → ℝ} {U : Set M} |
| 31 | (hf : ContinuousOn f U) {C : ℝ} |
| 32 | (hsupport : ∀ q ∈ U, ∃ B : M → ℝ, |
| 33 | MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) B q ∧ B q = f q ∧ |
| 34 | (∀ᶠ x in 𝓝 q, f x ≤ B x) ∧ ∀ v : TangentSpace (𝓡 n) q, |
| 35 | |mvfderiv (𝓡 n) B q v| ≤ C * g.tangentNorm q v) |
| 36 | (hγ : ContMDiff (𝓘(ℝ, ℝ)) (𝓡 n) 1 γ) {a b : ℝ} (hab : a ≤ b) |
| 37 | (hγU : MapsTo γ (Icc a b) U) : |
| 38 | f (γ b) - f (γ a) ≤ C * ∫ t in a..b, g.tangentNorm (γ t) (curveVelocity γ t) := by |
| 39 | have h := sub_le_integral_of_upper_supports (f := f ∘ γ) |
| 40 | (h := fun t ↦ C * g.tangentNorm (γ t) (curveVelocity γ t)) hab |
| 41 | (hf.comp hγ.continuous.continuousOn hγU) |
| 42 | (continuous_const.mul (continuous_tangentNorm_curveVelocity g hγ)) (fun t ht ↦ ?_) |
| 43 | · simpa only [Function.comp_apply, intervalIntegral.integral_const_mul] using h |
| 44 | obtain ⟨B, hB, htouch, hdom, hbound⟩ := hsupport (γ t) (hγU (Ico_subset_Icc_self ht)) |
| 45 | refine ⟨B ∘ γ, mvfderiv (𝓡 n) B (γ t) (curveVelocity γ t), |
| 46 | hasDerivAt_comp_curve hB (hγ.mdifferentiable one_ne_zero t), htouch, |
| 47 | hγ.continuous.continuousAt hdom, ?_⟩ |
| 48 | exact (le_abs_self _).trans (hbound _) |
| 49 | |
| 50 | /-- The same comparison in extended nonnegative units uses the actual path length. -/ |
| 51 | theorem ofReal_sub_le_pathELength_of_upper_supports |
| 52 | (g : RiemannianMetric n M) {f : M → ℝ} {U : Set M} |
| 53 | (hf : ContinuousOn f U) {C : ℝ} (hC : 0 ≤ C) |
| 54 | (hsupport : ∀ q ∈ U, ∃ B : M → ℝ, |
| 55 | MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) B q ∧ B q = f q ∧ |
| 56 | (∀ᶠ x in 𝓝 q, f x ≤ B x) ∧ ∀ v : TangentSpace (𝓡 n) q, |
| 57 | |mvfderiv (𝓡 n) B q v| ≤ C * g.tangentNorm q v) |
| 58 | (hγ : ContMDiff (𝓘(ℝ, ℝ)) (𝓡 n) 1 γ) {a b : ℝ} (hab : a ≤ b) |
| 59 | (hγU : MapsTo γ (Icc a b) U) : |
| 60 | ENNReal.ofReal (f (γ b) - f (γ a)) ≤ ENNReal.ofReal C * g.pathELength γ a b := by |
| 61 | have h := ENNReal.ofReal_le_ofReal |
| 62 | (sub_le_integral_speed_of_upper_supports g hf hsupport hγ hab hγU) |
| 63 | rwa [ENNReal.ofReal_mul hC, ← pathELength_eq_ofReal_integral_tangentNorm g hγ hab] at h |
| 64 | |
| 65 | /-- Reversing a unit-interval path preserves its selected-metric length. -/ |
| 66 | theorem pathELength_reverse_unit (g : RiemannianMetric n M) |
| 67 | (hγ : ContMDiff (𝓘(ℝ, ℝ)) (𝓡 n) 1 γ) : |
| 68 | g.pathELength (γ ∘ fun t : ℝ ↦ 1 - t) 0 1 = g.pathELength γ 0 1 := by |
| 69 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 70 | ⟨g.toRiemannianMetric⟩ |
| 71 | delta RiemannianMetric.pathELength |
| 72 | simpa only [sub_self, sub_zero] using |
| 73 | (Manifold.pathELength_comp_of_antitoneOn (I := 𝓡 n) (γ := γ) |
| 74 | (f := fun t : ℝ ↦ 1 - t) zero_le_one |
| 75 | (fun _ _ _ _ h ↦ sub_le_sub_left h 1) |
| 76 | ((differentiable_const (1 : ℝ)).sub differentiable_id).differentiableOn |
| 77 | (hγ.mdifferentiable one_ne_zero).mdifferentiableOn) |
| 78 | |
| 79 | /-- Upper supports at every path point give a two-sided endpoint estimate. -/ |
| 80 | theorem edist_le_pathELength_of_upper_supports |
| 81 | (g : RiemannianMetric n M) {f : M → ℝ} {U : Set M} |
| 82 | (hf : ContinuousOn f U) {C : ℝ} (hC : 0 ≤ C) |
| 83 | (hsupport : ∀ q ∈ U, ∃ B : M → ℝ, |
| 84 | MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) B q ∧ B q = f q ∧ |
| 85 | (∀ᶠ x in 𝓝 q, f x ≤ B x) ∧ ∀ v : TangentSpace (𝓡 n) q, |
| 86 | |mvfderiv (𝓡 n) B q v| ≤ C * g.tangentNorm q v) |
| 87 | (hγ : ContMDiff (𝓘(ℝ, ℝ)) (𝓡 n) 1 γ) |
| 88 | (hγU : MapsTo γ (Icc 0 1) U) : |
| 89 | edist (f (γ 0)) (f (γ 1)) ≤ ENNReal.ofReal C * g.pathELength γ 0 1 := by |
| 90 | have hforward := ofReal_sub_le_pathELength_of_upper_supports g hf hC hsupport hγ |
| 91 | zero_le_one hγU |
| 92 | have hreverse : ContMDiff (𝓘(ℝ, ℝ)) (𝓡 n) 1 (γ ∘ fun t : ℝ ↦ 1 - t) := |
| 93 | hγ.comp ((contMDiff_const.sub contMDiff_id) : |
| 94 | ContMDiff (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ)) 1 (fun t : ℝ ↦ 1 - t)) |
| 95 | have hreverseU : MapsTo (γ ∘ fun t : ℝ ↦ 1 - t) (Icc 0 1) U := by |
| 96 | intro t ht |
| 97 | apply hγU |
| 98 | constructor <;> linarith [ht.1, ht.2] |
| 99 | have hback := ofReal_sub_le_pathELength_of_upper_supports g hf hC hsupport hreverse |
| 100 | zero_le_one hreverseU |
| 101 | rw [pathELength_reverse_unit g hγ] at hback |
| 102 | simp only [Function.comp_apply, sub_self, sub_zero] at hback |
| 103 | rw [edist_dist, Real.dist_eq, abs_eq_max_neg, ENNReal.ofReal_max, neg_sub] |
| 104 | exact max_le hback hforward |
| 105 | |
| 106 | end PoincareMT.SurgeryVolume.Measure |