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.Compactness.Convergence.Volume.PathComparison |
| 2 | import PoincareLib.Geometry.Riemannian.Distance.CompleteBalls |
| 3 | |
| 4 | /-! |
| 5 | # Coverage by a metric-controlled embedding |
| 6 | |
| 7 | Lifting short paths through the inverse of an embedding gives source-ball |
| 8 | coverage when the comparison domain has compact closure. This is the |
| 9 | no-escape argument for Kleiner--Lott, Corollary 44.1, pp. 2682--2683, |
| 10 | and Appendix E, pp. 2848--2849. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set |
| 17 | open scoped Manifold ContDiff Bundle ENNReal Topology |
| 18 | |
| 19 | namespace PoincareMT.RiemannianMetric |
| 20 | |
| 21 | variable {n : ℕ} {M N : Type*} [TopologicalSpace M] [TopologicalSpace N] |
| 22 | [T3Space M] [T2Space N] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) N] [IsManifold (𝓡 n) ∞ N] |
| 25 | |
| 26 | /-- An inverse differential bound on a precompact ball forces coverage of |
| 27 | the smaller source ball. Source completeness is not needed. -/ |
| 28 | theorem ball_subset_image_ball_of_inverse_tangentNorm_le |
| 29 | (g : RiemannianMetric n M) (h : RiemannianMetric n N) |
| 30 | (e : OpenPartialHomeomorph M N) (p : M) {R r C : ℝ} |
| 31 | (hR : 0 < R) (hC : 0 < C) (hCr : C * r < R) |
| 32 | (hcompact : IsCompact (closure (g.ball p R))) |
| 33 | (hsource : closure (g.ball p R) ⊆ e.source) |
| 34 | (hinv : ∀ y ∈ e.target, ContMDiffAt (𝓡 n) (𝓡 n) 1 e.symm y) |
| 35 | (hbound : ∀ y ∈ e '' closure (g.ball p R), ∀ v : TangentSpace (𝓡 n) y, |
| 36 | g.tangentNorm (e.symm y) (mfderiv (𝓡 n) (𝓡 n) e.symm y v) ≤ |
| 37 | C * h.tangentNorm y v) : |
| 38 | h.ball (e p) r ⊆ e '' g.ball p (C * r) := by |
| 39 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 40 | ⟨g.toRiemannianMetric⟩ |
| 41 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 42 | (TangentSpace (𝓡 n) : M → Type _) := |
| 43 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ => rfl⟩⟩ |
| 44 | let : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 n) M |
| 45 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : N → Type _) := |
| 46 | ⟨h.toRiemannianMetric⟩ |
| 47 | have hp : p ∈ g.ball p R := by |
| 48 | change g.edist p p < ENNReal.ofReal R |
| 49 | simpa [edist, Manifold.riemannianEDist_self] using ENNReal.ofReal_pos.mpr hR |
| 50 | have hps : p ∈ e.source := hsource (subset_closure hp) |
| 51 | let V := g.ball p R |
| 52 | let W := e '' V |
| 53 | have hVo : IsOpen V := isOpen_lt (continuous_const.edist continuous_id) continuous_const |
| 54 | have hWo : IsOpen W := e.isOpen_image_of_subset_source hVo |
| 55 | (subset_closure.trans hsource) |
| 56 | have hclosed : IsClosed (e '' closure V) := |
| 57 | (hcompact.image_of_continuousOn (e.continuousOn.mono hsource)).isClosed |
| 58 | have hclosure : closure W ⊆ e '' closure V := |
| 59 | closure_minimal (image_mono subset_closure) hclosed |
| 60 | have himage : e '' closure V ⊆ e.target := by |
| 61 | rintro _ ⟨x, hx, rfl⟩ |
| 62 | exact e.map_source (hsource hx) |
| 63 | intro y hy |
| 64 | obtain ⟨γ, hγ0, hγ1, hγ, hlen, _⟩ := |
| 65 | Manifold.exists_lt_locally_constant_of_riemannianEDist_lt hy zero_lt_one |
| 66 | have hlength {c : ℝ} (hc : c ∈ Icc (0 : ℝ) 1) |
| 67 | (hmap : MapsTo γ (Icc 0 c) (e '' closure V)) : |
| 68 | g.edist p (e.symm (γ c)) ≤ ENNReal.ofReal C * h.pathELength γ 0 1 := by |
| 69 | have hreg : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) 1 (e.symm ∘ γ) (Icc 0 c) := by |
| 70 | intro u hu |
| 71 | exact ((hinv (γ u) (himage (hmap hu))).comp u |
| 72 | hγ.contMDiffAt).contMDiffWithinAt |
| 73 | have hdist : g.edist p (e.symm (γ c)) ≤ g.pathELength (e.symm ∘ γ) 0 c := |
| 74 | Manifold.riemannianEDist_le_pathELength hreg |
| 75 | (by simpa only [Function.comp_apply, hγ0] using e.left_inv hps) rfl hc.1 |
| 76 | apply hdist.trans |
| 77 | apply (h.pathELength_comp_le_of_tangentNorm_le_on_Icc g hC.le hγ |
| 78 | (fun u hu => hinv (γ u) (himage (hmap hu))) |
| 79 | (fun u hu => hbound (γ u) (hmap hu))).trans |
| 80 | exact mul_le_mul' le_rfl (show h.pathELength γ 0 c ≤ h.pathELength γ 0 1 from |
| 81 | Manifold.pathELength_mono le_rfl hc.2) |
| 82 | have hshort : ENNReal.ofReal C * h.pathELength γ 0 1 < ENNReal.ofReal (C * r) := by |
| 83 | rw [ENNReal.ofReal_mul hC.le] |
| 84 | exact ENNReal.mul_lt_mul_right (ENNReal.ofReal_pos.mpr hC).ne' |
| 85 | ENNReal.ofReal_ne_top hlen |
| 86 | have hstays : MapsTo γ (Icc (0 : ℝ) 1) W := by |
| 87 | by_contra hnot |
| 88 | have hend : γ 1 ∉ W ∨ ∃ c ∈ Icc (0 : ℝ) 1, γ c ∉ W := by |
| 89 | right |
| 90 | simpa only [MapsTo, not_forall, exists_prop] using hnot |
| 91 | obtain ⟨b, hb, hγb⟩ : ∃ b ∈ Icc (0 : ℝ) 1, γ b ∉ W := by |
| 92 | rcases hend with h | h |
| 93 | · exact ⟨1, by norm_num, h⟩ |
| 94 | · exact h |
| 95 | have hbpos : 0 < b := lt_of_le_of_ne hb.1 (by |
| 96 | intro heq |
| 97 | subst b |
| 98 | exact hγb (by rw [hγ0]; exact mem_image_of_mem e hp)) |
| 99 | let η : ℝ → N := fun u => γ (b * u) |
| 100 | obtain ⟨c, hc, hfront, hmap⟩ := PoincareMT.exists_first_exit_of_continuous |
| 101 | (γ := η) (hγ.continuous.comp (continuous_const.mul continuous_id)) hWo |
| 102 | (by change γ (b * 0) ∈ e '' g.ball p R |
| 103 | simpa only [mul_zero, hγ0] using mem_image_of_mem e hp) |
| 104 | (by simpa [η] using hγb) |
| 105 | have hbc : b * c ∈ Icc (0 : ℝ) 1 := |
| 106 | ⟨mul_nonneg hb.1 hc.1.le, (mul_le_of_le_one_right hb.1 hc.2).trans hb.2⟩ |
| 107 | have hmap' : MapsTo γ (Icc 0 (b * c)) (e '' closure V) := by |
| 108 | intro u hu |
| 109 | have huc : u / b ∈ Icc (0 : ℝ) c := |
| 110 | ⟨div_nonneg hu.1 hb.1, (div_le_iff₀ hbpos).mpr (by simpa [mul_comm] using hu.2)⟩ |
| 111 | have hh := hclosure (hmap huc) |
| 112 | simpa [η, mul_div_cancel₀ _ hbpos.ne'] using hh |
| 113 | have hinside : e.symm (γ (b * c)) ∈ V := |
| 114 | (hlength hbc hmap').trans_lt (hshort.trans_le (ENNReal.ofReal_le_ofReal hCr.le)) |
| 115 | have hw : η c ∈ W := by |
| 116 | exact ⟨e.symm (γ (b * c)), hinside, |
| 117 | e.right_inv (himage (hmap' ⟨hbc.1, le_rfl⟩))⟩ |
| 118 | rw [frontier, hWo.interior_eq] at hfront |
| 119 | exact hfront.2 hw |
| 120 | have hmap : MapsTo γ (Icc (0 : ℝ) 1) (e '' closure V) := |
| 121 | fun u hu => image_mono subset_closure (hstays hu) |
| 122 | refine ⟨e.symm y, ?_, e.right_inv (himage (by |
| 123 | simpa only [hγ1] using hmap (show (1 : ℝ) ∈ Icc (0 : ℝ) 1 by norm_num)))⟩ |
| 124 | have hd := (hlength (by norm_num : (1 : ℝ) ∈ Icc (0 : ℝ) 1) hmap).trans_lt hshort |
| 125 | change g.edist p (e.symm y) < ENNReal.ofReal (C * r) |
| 126 | simpa only [hγ1] using hd |
| 127 | |
| 128 | omit [T3Space M] [T2Space N] in |
| 129 | /-- Forward tangent comparison sends a reference ball into the enlarged |
| 130 | target ball, using only short paths within the reference ball. -/ |
| 131 | theorem image_ball_subset_ball_of_tangentNorm_le |
| 132 | (g : RiemannianMetric n M) (h : RiemannianMetric n N) |
| 133 | (e : OpenPartialHomeomorph M N) (p : M) {r C : ℝ} |
| 134 | (hC : 0 < C) (hsource : g.ball p r ⊆ e.source) |
| 135 | (he : ∀ x ∈ e.source, ContMDiffAt (𝓡 n) (𝓡 n) 1 e x) |
| 136 | (hbound : ∀ x ∈ g.ball p r, ∀ v : TangentSpace (𝓡 n) x, |
| 137 | h.tangentNorm (e x) (mfderiv (𝓡 n) (𝓡 n) e x v) ≤ C * g.tangentNorm x v) : |
| 138 | e '' g.ball p r ⊆ h.ball (e p) (C * r) := by |
| 139 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 140 | ⟨g.toRiemannianMetric⟩ |
| 141 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : N → Type _) := |
| 142 | ⟨h.toRiemannianMetric⟩ |
| 143 | rintro _ ⟨x, hx, rfl⟩ |
| 144 | obtain ⟨γ, hγ0, hγ1, hγ, hlen, _⟩ := |
| 145 | Manifold.exists_lt_locally_constant_of_riemannianEDist_lt hx zero_lt_one |
| 146 | have hmap : MapsTo γ (Icc (0 : ℝ) 1) (g.ball p r) := by |
| 147 | intro u hu |
| 148 | exact ((Manifold.riemannianEDist_le_pathELength |
| 149 | (hγ.contMDiffOn.mono (Icc_subset_Icc_right hu.2)) hγ0 rfl hu.1).trans |
| 150 | (Manifold.pathELength_mono le_rfl hu.2)).trans_lt hlen |
| 151 | have hreg : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) 1 (e ∘ γ) (Icc 0 1) := by |
| 152 | intro u hu |
| 153 | exact ((he (γ u) (hsource (hmap hu))).comp u hγ.contMDiffAt).contMDiffWithinAt |
| 154 | have hd : h.edist (e p) (e x) ≤ h.pathELength (e ∘ γ) 0 1 := |
| 155 | Manifold.riemannianEDist_le_pathELength hreg |
| 156 | (by simp only [Function.comp_apply, hγ0]) |
| 157 | (by simp only [Function.comp_apply, hγ1]) zero_le_one |
| 158 | apply (hd.trans (g.pathELength_comp_le_of_tangentNorm_le_on_Icc h hC.le hγ |
| 159 | (fun u hu => he (γ u) (hsource (hmap hu))) |
| 160 | (fun u hu => hbound (γ u) (hmap hu)))).trans_lt |
| 161 | rw [ENNReal.ofReal_mul hC.le] |
| 162 | exact ENNReal.mul_lt_mul_right (ENNReal.ofReal_pos.mpr hC).ne' |
| 163 | ENNReal.ofReal_ne_top hlen |
| 164 | |
| 165 | end PoincareMT.RiemannianMetric |