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.Distance.IntrinsicIsometry |
| 2 | |
| 3 | /-! |
| 4 | # Distance comparison on smooth portions of the collapse |
| 5 | |
| 6 | Claim 13.1, Morgan--Tian p.332, follows from the quadratic pullback |
| 7 | bound on smooth portions of the radial collapse. These lemmas compare |
| 8 | the actual C1 path integrals and their ambient or confined distances. |
| 9 | The nonsmooth tail boundary is handled separately by continuity. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open scoped Manifold ContDiff Bundle ENNReal Topology |
| 15 | open MeasureTheory |
| 16 | |
| 17 | universe u v |
| 18 | |
| 19 | namespace PoincareMT.MetricSurgery |
| 20 | |
| 21 | variable {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) X] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) Y] |
| 24 | [IsManifold (𝓡 3) ∞ X] [IsManifold (𝓡 3) ∞ Y] |
| 25 | |
| 26 | theorem metric_pathELength_mono (g : RiemannianMetric 3 X) (gamma : ℝ → X) |
| 27 | {a b c d : ℝ} (hac : a ≤ c) (hdb : d ≤ b) : |
| 28 | g.pathELength gamma c d ≤ g.pathELength gamma a b := by |
| 29 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : X → Type _) := |
| 30 | ⟨g.toRiemannianMetric⟩ |
| 31 | exact Manifold.pathELength_mono hac hdb |
| 32 | |
| 33 | theorem metric_pathELength_add (g : RiemannianMetric 3 X) (gamma : ℝ → X) |
| 34 | {a b c : ℝ} (hab : a ≤ b) (hbc : b ≤ c) : |
| 35 | g.pathELength gamma a b + g.pathELength gamma b c = g.pathELength gamma a c := by |
| 36 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : X → Type _) := |
| 37 | ⟨g.toRiemannianMetric⟩ |
| 38 | exact Manifold.pathELength_add hab hbc |
| 39 | |
| 40 | theorem metric_edist_le_pathELength (g : RiemannianMetric 3 X) {gamma : ℝ → X} |
| 41 | {a b : ℝ} (hab : a ≤ b) |
| 42 | (hgamma : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 gamma (Set.Icc a b)) : |
| 43 | g.edist (gamma a) (gamma b) ≤ g.pathELength gamma a b := by |
| 44 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : X → Type _) := |
| 45 | ⟨g.toRiemannianMetric⟩ |
| 46 | exact Manifold.riemannianEDist_le_pathELength hgamma rfl rfl hab |
| 47 | |
| 48 | theorem metric_edist_self (g : RiemannianMetric 3 X) (x : X) : g.edist x x = 0 := by |
| 49 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : X → Type _) := |
| 50 | ⟨g.toRiemannianMetric⟩ |
| 51 | exact Manifold.riemannianEDist_self |
| 52 | |
| 53 | theorem metric_edist_triangle (g : RiemannianMetric 3 X) (x y z : X) : |
| 54 | g.edist x z ≤ g.edist x y + g.edist y z := by |
| 55 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : X → Type _) := |
| 56 | ⟨g.toRiemannianMetric⟩ |
| 57 | exact Manifold.riemannianEDist_triangle |
| 58 | |
| 59 | theorem metric_edist_continuous [RegularSpace X] (g : RiemannianMetric 3 X) : |
| 60 | Continuous (fun z : X × X => g.edist z.1 z.2) := by |
| 61 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : X → Type _) := |
| 62 | ⟨g.toRiemannianMetric⟩ |
| 63 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin 3)) |
| 64 | (TangentSpace (𝓡 3) : X → Type _) := |
| 65 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ => rfl⟩⟩ |
| 66 | let : PseudoEMetricSpace X := PseudoEMetricSpace.ofRiemannianMetric (𝓡 3) X |
| 67 | exact continuous_fst.edist continuous_snd |
| 68 | |
| 69 | set_option backward.isDefEq.respectTransparency false in |
| 70 | theorem pathELength_comp_le_of_pullback_bound (g : RiemannianMetric 3 X) |
| 71 | (h : RiemannianMetric 3 Y) {f : X → Y} {U : Set X} |
| 72 | (hf : ∀ x ∈ U, ContMDiffAt (𝓡 3) (𝓡 3) ∞ f x) |
| 73 | (hmetric : ∀ x ∈ U, ∀ v : TangentSpace (𝓡 3) x, |
| 74 | h.inner (f x) (mfderiv (𝓡 3) (𝓡 3) f x v) (mfderiv (𝓡 3) (𝓡 3) f x v) ≤ |
| 75 | g.inner x v v) |
| 76 | {gamma : ℝ → X} {a b : ℝ} |
| 77 | (hgamma : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 gamma (Set.Icc a b)) |
| 78 | (hU : gamma '' Set.Icc a b ⊆ U) : |
| 79 | h.pathELength (f ∘ gamma) a b ≤ g.pathELength gamma a b := by |
| 80 | rw [pathELength_eq_lintegral_speed_Ioo, pathELength_eq_lintegral_speed_Ioo] |
| 81 | apply setLIntegral_mono' measurableSet_Ioo |
| 82 | intro t ht |
| 83 | have ht' : t ∈ Set.Icc a b := ⟨ht.1.le, ht.2.le⟩ |
| 84 | have hx := hU ⟨t, ht', rfl⟩ |
| 85 | have hgammaAt := ((hgamma t ht').contMDiffAt (Icc_mem_nhds ht.1 ht.2)).mdifferentiableAt |
| 86 | (by simp) |
| 87 | have hfAt := (hf (gamma t) hx).mdifferentiableAt (by simp) |
| 88 | change ENNReal.ofReal (Real.sqrt (h.inner (f (gamma t)) |
| 89 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 3) (f ∘ gamma) t 1) |
| 90 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 3) (f ∘ gamma) t 1))) ≤ |
| 91 | ENNReal.ofReal (Real.sqrt (g.inner (gamma t) |
| 92 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 3) gamma t 1) |
| 93 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 3) gamma t 1))) |
| 94 | rw [mfderiv_comp t hfAt hgammaAt] |
| 95 | apply ENNReal.ofReal_le_ofReal |
| 96 | apply Real.sqrt_le_sqrt |
| 97 | exact hmetric (gamma t) hx _ |
| 98 | |
| 99 | theorem edist_comp_le_pathELength_of_pullback_bound (g : RiemannianMetric 3 X) |
| 100 | (h : RiemannianMetric 3 Y) {f : X → Y} {U : Set X} |
| 101 | (hf : ∀ x ∈ U, ContMDiffAt (𝓡 3) (𝓡 3) ∞ f x) |
| 102 | (hmetric : ∀ x ∈ U, ∀ v : TangentSpace (𝓡 3) x, |
| 103 | h.inner (f x) (mfderiv (𝓡 3) (𝓡 3) f x v) (mfderiv (𝓡 3) (𝓡 3) f x v) ≤ |
| 104 | g.inner x v v) |
| 105 | {gamma : ℝ → X} {a b : ℝ} (hab : a ≤ b) |
| 106 | (hgamma : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 gamma (Set.Icc a b)) |
| 107 | (hU : gamma '' Set.Icc a b ⊆ U) : |
| 108 | h.edist (f (gamma a)) (f (gamma b)) ≤ g.pathELength gamma a b := by |
| 109 | have hc : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 (f ∘ gamma) (Set.Icc a b) := by |
| 110 | intro t ht |
| 111 | exact ((hf (gamma t) (hU ⟨t, ht, rfl⟩)).of_le (by simp)).comp_contMDiffWithinAt t |
| 112 | (hgamma t ht) |
| 113 | exact (metric_edist_le_pathELength h hab hc).trans |
| 114 | (pathELength_comp_le_of_pullback_bound g h hf hmetric hgamma hU) |
| 115 | |
| 116 | theorem edist_le_intrinsicEDist_of_pullback_bound (g : RiemannianMetric 3 X) |
| 117 | (h : RiemannianMetric 3 Y) {f : X → Y} {U : Set X} |
| 118 | (hf : ∀ x ∈ U, ContMDiffAt (𝓡 3) (𝓡 3) ∞ f x) |
| 119 | (hmetric : ∀ x ∈ U, ∀ v : TangentSpace (𝓡 3) x, |
| 120 | h.inner (f x) (mfderiv (𝓡 3) (𝓡 3) f x v) (mfderiv (𝓡 3) (𝓡 3) f x v) ≤ |
| 121 | g.inner x v v) (x y : X) : |
| 122 | h.edist (f x) (f y) ≤ intrinsicEDist g U x y := by |
| 123 | apply le_sInf |
| 124 | rintro L ⟨gamma, hgamma, hzero, hone, hU, rfl⟩ |
| 125 | have hle := edist_comp_le_pathELength_of_pullback_bound g h hf hmetric zero_le_one hgamma hU |
| 126 | simpa only [hzero, hone] using hle |
| 127 | |
| 128 | end PoincareMT.MetricSurgery |