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.ReducedGeometry.LGeometry.Minimization.Charts.PathRecovery |
| 2 | |
| 3 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/ChartPerturbation.lean` at |
| 4 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 5 | |
| 6 | |
| 7 | set_option autoImplicit false |
| 8 | set_option backward.isDefEq.respectTransparency false |
| 9 | |
| 10 | open MeasureTheory Set Filter Topology |
| 11 | open scoped Manifold ContDiff Bundle intervalIntegral |
| 12 | |
| 13 | namespace PoincareMT.LGeometry |
| 14 | |
| 15 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] |
| 16 | |
| 17 | theorem exists_uniform_affine_tube {a b : ℝ} (u η : ℝ → E) |
| 18 | (hu : ContinuousOn u (Icc a b)) (hη : ContinuousOn η (Icc a b)) |
| 19 | {K : Set E} (huK : u '' Icc a b ⊆ interior K) : |
| 20 | ∃ δ : ℝ, 0 < δ ∧ δ ≤ 1 ∧ ∀ ε : ℝ, |ε| < δ → |
| 21 | MapsTo (fun s ↦ u s + ε • η s) (Icc a b) K := by |
| 22 | obtain ⟨r, hr, hmargin⟩ := (isCompact_Icc.image_of_continuousOn hu).exists_cthickening_subset_open |
| 23 | isOpen_interior huK |
| 24 | obtain ⟨D, hD⟩ := isCompact_Icc.exists_bound_of_continuousOn hη |
| 25 | let C := max D 0 |
| 26 | have hC : 0 ≤ C := le_max_right _ _ |
| 27 | have hCp : 0 < C + 1 := by positivity |
| 28 | let δ := min 1 (r / (C + 1)) |
| 29 | have hδ : 0 < δ := lt_min zero_lt_one (div_pos hr hCp) |
| 30 | have hδr : δ * (C + 1) ≤ r := (le_div_iff₀ hCp).mp (min_le_right _ _) |
| 31 | refine ⟨δ, hδ, min_le_left _ _, ?_⟩ |
| 32 | intro ε hε s hs |
| 33 | have hηbound : ‖η s‖ ≤ C := (hD s hs).trans (le_max_left _ _) |
| 34 | have hnorm : ‖ε • η s‖ < r := by |
| 35 | rw [norm_smul, Real.norm_eq_abs] |
| 36 | have hmul := mul_le_mul_of_nonneg_left hηbound (abs_nonneg ε) |
| 37 | have hmul' := mul_le_mul_of_nonneg_right hε.le hC |
| 38 | nlinarith |
| 39 | apply interior_subset (hmargin ?_) |
| 40 | apply Metric.mem_cthickening_of_dist_le _ (u s) _ _ (mem_image_of_mem u hs) |
| 41 | simpa only [dist_eq_norm, add_sub_cancel_left] using hnorm.le |
| 42 | |
| 43 | theorem chartL2_affine_primitive {a b : ℝ} (hab : a ≤ b) |
| 44 | (u : ℝ → E) (w : ChartL2 E a b) |
| 45 | (hw : ∀ s ∈ Icc a b, u s = u a + ∫ r in a..s, w r) |
| 46 | (η ν : ℝ → E) (hη : ContinuousOn η (Icc a b)) |
| 47 | (hd : ∀ s ∈ Ioo a b, HasDerivAt η (ν s) s) |
| 48 | (hν : MemLp ν 2 (volume.restrict (Icc a b))) (ε : ℝ) : |
| 49 | ∃ v : ChartL2 E a b, |
| 50 | (v : ℝ → E) =ᵐ[volume.restrict (Icc a b)] (fun s ↦ w s + ε • ν s) ∧ |
| 51 | ∀ s ∈ Icc a b, u s + ε • η s = u a + ε • η a + ∫ r in a..s, v r := by |
| 52 | have hLp : MemLp (fun s ↦ w s + ε • ν s) 2 (volume.restrict (Icc a b)) := |
| 53 | (Lp.memLp w).add (hν.const_smul ε) |
| 54 | let v := hLp.toLp (fun s ↦ w s + ε • ν s) |
| 55 | refine ⟨v, hLp.coeFn_toLp, ?_⟩ |
| 56 | intro s hs |
| 57 | have hsub : uIcc a s ⊆ uIcc a b := by |
| 58 | rw [uIcc_of_le hs.1, uIcc_of_le hab] |
| 59 | exact Icc_subset_Icc_right hs.2 |
| 60 | have hwint0 : IntervalIntegrable w volume a b := |
| 61 | (intervalIntegrable_iff_integrableOn_Icc_of_le hab).mpr ((Lp.memLp w).integrable (by norm_num)) |
| 62 | have hwint := hwint0.mono_set hsub |
| 63 | have hνint : IntervalIntegrable ν volume a s := by |
| 64 | apply (intervalIntegrable_iff_integrableOn_Icc_of_le hs.1).mpr |
| 65 | exact IntegrableOn.mono_set (hν.integrable (by norm_num)) (Icc_subset_Icc_right hs.2) |
| 66 | have heq : (∫ r in a..s, v r) = ∫ r in a..s, w r + ε • ν r := by |
| 67 | apply intervalIntegral.integral_congr_ae_restrict |
| 68 | rw [uIoc_of_le hs.1] |
| 69 | exact ae_mono (Measure.restrict_mono |
| 70 | (Ioc_subset_Icc_self.trans (Icc_subset_Icc_right hs.2)) le_rfl) hLp.coeFn_toLp |
| 71 | have hFTC := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le hs.1 |
| 72 | (hη.mono (Icc_subset_Icc_right hs.2)) |
| 73 | (fun r hr ↦ hd r ⟨hr.1, hr.2.trans_le hs.2⟩) hνint |
| 74 | have hεν : IntervalIntegrable (fun r ↦ ε • ν r) volume a s := hνint.smul ε |
| 75 | rw [heq, intervalIntegral.integral_add hwint hεν, |
| 76 | intervalIntegral.integral_smul, hFTC, hw s hs, smul_sub] |
| 77 | abel |
| 78 | |
| 79 | universe uM |
| 80 | |
| 81 | variable {n : ℕ} {M : Type uM} [MetricSpace M] |
| 82 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 83 | |
| 84 | theorem exists_chart_affine_buffer {a b : ℝ} (x : M) |
| 85 | (γ : ℝ → M) (hγ : ContinuousOn γ (Icc a b)) |
| 86 | (hsrc : MapsTo γ (Icc a b) (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 87 | (η : ℝ → EuclideanSpace ℝ (Fin n)) (hη : ContinuousOn η (Icc a b)) : |
| 88 | ∃ K : Set (EuclideanSpace ℝ (Fin n)), IsCompact K ∧ |
| 89 | K ⊆ (extChartAt (𝓡 n) x).target ∧ |
| 90 | (extChartAt (𝓡 n) x ∘ γ) '' Icc a b ⊆ interior K ∧ |
| 91 | ∃ δ : ℝ, 0 < δ ∧ δ ≤ 1 ∧ ∀ ε : ℝ, |ε| < δ → |
| 92 | MapsTo (fun s ↦ extChartAt (𝓡 n) x (γ s) + ε • η s) (Icc a b) K := by |
| 93 | let e := extChartAt (𝓡 n) x |
| 94 | have hsrc' : MapsTo γ (Icc a b) e.source := by |
| 95 | simpa only [e, extChartAt_source] using hsrc |
| 96 | have hu : ContinuousOn (e ∘ γ) (Icc a b) := |
| 97 | (continuousOn_extChartAt (I := 𝓡 n) x).comp hγ hsrc' |
| 98 | have htarget : (e ∘ γ) '' Icc a b ⊆ e.target := by |
| 99 | rintro _ ⟨s, hs, rfl⟩ |
| 100 | exact e.map_source (hsrc' hs) |
| 101 | obtain ⟨K, hK, huK, hKt⟩ := exists_compact_between |
| 102 | (isCompact_Icc.image_of_continuousOn hu) (isOpen_extChartAt_target (I := 𝓡 n) x) htarget |
| 103 | obtain ⟨δ, hδ, hδ1, hδK⟩ := exists_uniform_affine_tube (e ∘ γ) η hu hη huK |
| 104 | exact ⟨K, hK, hKt, huK, δ, hδ, hδ1, hδK⟩ |
| 105 | |
| 106 | theorem chart_affine_competitor {a b : ℝ} (hab : a ≤ b) |
| 107 | (x : M) (γ : ℝ → M) (hγ : ContinuousOn γ (Icc a b)) |
| 108 | (hsrc : MapsTo γ (Icc a b) (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 109 | (w : ChartL2 (EuclideanSpace ℝ (Fin n)) a b) |
| 110 | (hw : ∀ s ∈ Icc a b, extChartAt (𝓡 n) x (γ s) = |
| 111 | extChartAt (𝓡 n) x (γ a) + ∫ r in a..s, w r) |
| 112 | (η ν : ℝ → EuclideanSpace ℝ (Fin n)) |
| 113 | (hη : ContinuousOn η (Icc a b)) (hd : ∀ s ∈ Ioo a b, HasDerivAt η (ν s) s) |
| 114 | (hν : MemLp ν 2 (volume.restrict (Icc a b))) |
| 115 | (hηa : η a = 0) (hηb : η b = 0) (ε : ℝ) |
| 116 | (htarget : MapsTo (fun s ↦ extChartAt (𝓡 n) x (γ s) + ε • η s) (Icc a b) |
| 117 | (extChartAt (𝓡 n) x).target) : |
| 118 | ∃ (ξ : ℝ → M) (v : ChartL2 (EuclideanSpace ℝ (Fin n)) a b), |
| 119 | ContinuousOn ξ (Icc a b) ∧ ξ a = γ a ∧ ξ b = γ b ∧ |
| 120 | MapsTo ξ (Icc a b) (chartAt (EuclideanSpace ℝ (Fin n)) x).source ∧ |
| 121 | (∀ s, ξ s = (extChartAt (𝓡 n) x).symm (extChartAt (𝓡 n) x (γ s) + ε • η s)) ∧ |
| 122 | ((v : ℝ → EuclideanSpace ℝ (Fin n)) =ᵐ[volume.restrict (Icc a b)] |
| 123 | (fun s ↦ w s + ε • ν s)) ∧ |
| 124 | (∀ s ∈ Icc a b, extChartAt (𝓡 n) x (ξ s) = |
| 125 | extChartAt (𝓡 n) x (γ s) + ε • η s) ∧ |
| 126 | ∀ s ∈ Icc a b, extChartAt (𝓡 n) x (ξ s) = |
| 127 | extChartAt (𝓡 n) x (ξ a) + ∫ r in a..s, v r := by |
| 128 | let e := extChartAt (𝓡 n) x |
| 129 | let u : ℝ → EuclideanSpace ℝ (Fin n) := e ∘ γ |
| 130 | have hsrc' : MapsTo γ (Icc a b) e.source := by |
| 131 | simpa only [e, extChartAt_source] using hsrc |
| 132 | have hu : ContinuousOn u (Icc a b) := |
| 133 | (continuousOn_extChartAt (I := 𝓡 n) x).comp hγ hsrc' |
| 134 | obtain ⟨v, hv, hprimitive⟩ := chartL2_affine_primitive hab u w hw η ν hη hd hν ε |
| 135 | let ξ : ℝ → M := fun s ↦ e.symm (u s + ε • η s) |
| 136 | have hξ : ContinuousOn ξ (Icc a b) := |
| 137 | (continuousOn_extChartAt_symm (I := 𝓡 n) x).comp (hu.add (hη.const_smul ε)) htarget |
| 138 | have hξa : ξ a = γ a := by |
| 139 | simp only [ξ, hηa, smul_zero, add_zero] |
| 140 | exact e.left_inv (hsrc' ⟨le_rfl, hab⟩) |
| 141 | have hξb : ξ b = γ b := by |
| 142 | simp only [ξ, hηb, smul_zero, add_zero] |
| 143 | exact e.left_inv (hsrc' ⟨hab, le_rfl⟩) |
| 144 | have hξsrc : MapsTo ξ (Icc a b) (chartAt (EuclideanSpace ℝ (Fin n)) x).source := by |
| 145 | intro s hs |
| 146 | simpa only [ξ, u, Function.comp_apply, e, extChartAt_source] using e.map_target (htarget hs) |
| 147 | have hcoord (s : ℝ) (hs : s ∈ Icc a b) : e (ξ s) = u s + ε • η s := |
| 148 | e.right_inv (htarget hs) |
| 149 | refine ⟨ξ, v, hξ, hξa, hξb, hξsrc, fun _ ↦ rfl, hv, hcoord, ?_⟩ |
| 150 | intro s hs |
| 151 | change e (ξ s) = e (ξ a) + _ |
| 152 | rw [hcoord s hs, hcoord a ⟨le_rfl, hab⟩] |
| 153 | exact hprimitive s hs |
| 154 | |
| 155 | end PoincareMT.LGeometry |