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.Jacobi.JacobiAlongPair |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Variation.Extension.ClosedSectionExtension |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Jacobi.IntervalSolutionGluing |
| 4 | |
| 5 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/JacobiPairGluing.lean` at |
| 6 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 7 | |
| 8 | |
| 9 | set_option autoImplicit false |
| 10 | set_option backward.isDefEq.respectTransparency false |
| 11 | |
| 12 | noncomputable section |
| 13 | |
| 14 | open Set Filter Topology |
| 15 | open scoped Manifold ContDiff Bundle |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.LGeometry |
| 20 | |
| 21 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 23 | |
| 24 | theorem sectionPaste_contMDiffOn (α : ℝ → M) {a l c r : ℝ} |
| 25 | (hlc : l < c) (hcr : c < r) |
| 26 | (Y Z : ∀ s, TangentSpace (𝓡 n) (α s)) |
| 27 | (hY : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 28 | (fun s ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (α s) (Y s)) (Icc a c)) |
| 29 | (hZ : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 30 | (fun s ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (α s) (Z s)) (Icc l r)) |
| 31 | (heq : ∀ s ∈ Icc l c, Y s = Z s) : |
| 32 | ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 33 | (fun s ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (α s) |
| 34 | (if s ≤ c then Y s else Z s)) (Icc a r) := by |
| 35 | have hleft : ∀ s ∈ Icc a c, |
| 36 | Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (α s) |
| 37 | (if s ≤ c then Y s else Z s) = |
| 38 | Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (α s) (Y s) := by |
| 39 | intro s hs |
| 40 | rw [if_pos hs.2] |
| 41 | have hright : ∀ s ∈ Icc l r, |
| 42 | Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (α s) |
| 43 | (if s ≤ c then Y s else Z s) = |
| 44 | Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (α s) (Z s) := by |
| 45 | intro s hs |
| 46 | by_cases hsc : s ≤ c |
| 47 | · rw [if_pos hsc, heq s ⟨hs.1, hsc⟩] |
| 48 | · rw [if_neg hsc] |
| 49 | intro s hs |
| 50 | by_cases hsc : s < c |
| 51 | · have hsold : s ∈ Icc a c := ⟨hs.1, hsc.le⟩ |
| 52 | apply ((hY s hsold).congr_of_mem hleft hsold).mono_of_mem_nhdsWithin |
| 53 | apply mem_nhdsWithin_iff_exists_mem_nhds_inter.mpr |
| 54 | refine ⟨Iio c, Iio_mem_nhds hsc, ?_⟩ |
| 55 | intro t ht |
| 56 | exact ⟨ht.2.1, ht.1.le⟩ |
| 57 | · have hcs : c ≤ s := le_of_not_gt hsc |
| 58 | have hsnew : s ∈ Icc l r := ⟨hlc.le.trans hcs, hs.2⟩ |
| 59 | apply ((hZ s hsnew).congr_of_mem hright hsnew).mono_of_mem_nhdsWithin |
| 60 | apply mem_nhdsWithin_iff_exists_mem_nhds_inter.mpr |
| 61 | refine ⟨Ioi l, Ioi_mem_nhds (hlc.trans_le hcs), ?_⟩ |
| 62 | intro t ht |
| 63 | exact ⟨ht.1.le, ht.2.2⟩ |
| 64 | |
| 65 | set_option maxHeartbeats 1500000 in |
| 66 | theorem jacobiPairOn_paste {J S U : Set ℝ} (F : RicciFlow n M J) (T : ℝ) |
| 67 | (α : ℝ → M) (hU : IsOpen U) (hSU : S ⊆ U) |
| 68 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ α U) |
| 69 | {a l c r : ℝ} (hal : a ≤ l) (hlc : l < c) (hcr : c < r) |
| 70 | {f g : ℝ → EuclideanSpace ℝ (Fin n) × EuclideanSpace ℝ (Fin n)} |
| 71 | (hf : IsJacobiPairOn F T α S a c f) (hg : IsJacobiPairOn F T α S l r g) |
| 72 | (heq : EqOn f g (Icc l c)) : |
| 73 | IsJacobiPairOn F T α S a r (fun s ↦ if s ≤ c then f s else g s) := by |
| 74 | let q := fun s ↦ if s ≤ c then f s else g s |
| 75 | have har : a < r := (hal.trans_lt hlc).trans hcr |
| 76 | have hqS : Icc a r ⊆ S := by |
| 77 | intro s hs |
| 78 | by_cases hsc : s ≤ c |
| 79 | · exact hf.interval_subset ⟨hs.1, hsc⟩ |
| 80 | · exact hg.interval_subset ⟨hlc.le.trans (le_of_not_ge hsc), hs.2⟩ |
| 81 | have hqY : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 82 | (fun s ↦ Bundle.TotalSpace.mk' (E := TangentSpace (𝓡 n)) |
| 83 | (EuclideanSpace ℝ (Fin n)) (α s) (q s).1) (Icc a r) := by |
| 84 | have h := sectionPaste_contMDiffOn α hlc hcr (fun s ↦ (f s).1) (fun s ↦ (g s).1) |
| 85 | hf.first_smooth hg.first_smooth (fun s hs ↦ congrArg Prod.fst (heq hs)) |
| 86 | convert h using 1 |
| 87 | funext s |
| 88 | dsimp only [q] |
| 89 | split_ifs <;> rfl |
| 90 | have hqP : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 91 | (fun s ↦ Bundle.TotalSpace.mk' (E := TangentSpace (𝓡 n)) |
| 92 | (EuclideanSpace ℝ (Fin n)) (α s) (q s).2) (Icc a r) := by |
| 93 | have h := sectionPaste_contMDiffOn α hlc hcr (fun s ↦ (f s).2) (fun s ↦ (g s).2) |
| 94 | hf.second_smooth hg.second_smooth (fun s hs ↦ congrArg Prod.snd (heq hs)) |
| 95 | convert h using 1 |
| 96 | funext s |
| 97 | dsimp only [q] |
| 98 | split_ifs <;> rfl |
| 99 | obtain ⟨EY⟩ := exists_closedSectionExtension har hU (hqS.trans hSU) α hα |
| 100 | (fun s ↦ (q s).1) hqY |
| 101 | obtain ⟨EP⟩ := exists_closedSectionExtension har hU (hqS.trans hSU) α hα |
| 102 | (fun s ↦ (q s).2) hqP |
| 103 | have hαs (s : ℝ) (hs : s ∈ S) : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) α s := |
| 104 | ((hα s (hSU hs)).contMDiffAt (hU.mem_nhds (hSU hs))).mdifferentiableAt (by simp) |
| 105 | have hlocal {d e : ℝ} (hde : IsJacobiPairOn F T α S d e q) |
| 106 | (hsub : Icc d e ⊆ Icc a r) : |
| 107 | ∀ s ∈ Icc d e, |
| 108 | pullbackCovariantDerivative F (fun v ↦ T - v ^ 2) α |
| 109 | (fun v ↦ (q v).1) (Icc a r) EY s = (q s).2 ∧ |
| 110 | ∀ W : TangentSpace (𝓡 n) (α s), |
| 111 | jacobiPairResidual F T α S s (q s).1 (q s).2 |
| 112 | (pullbackCovariantDerivative F (fun v ↦ T - v ^ 2) α |
| 113 | (fun v ↦ (q v).2) (Icc a r) EP s) W = 0 := by |
| 114 | have hlocalEq := hde.equations_for_extensions |
| 115 | (fun s hs ↦ hαs s (hde.interval_subset hs)) |
| 116 | (restrictParametricSectionExtension hsub EY) (restrictParametricSectionExtension hsub EP) |
| 117 | intro s hs |
| 118 | have hDY := pullbackCovariantDerivative_restrict F (fun v ↦ T - v ^ 2) hsub EY |
| 119 | (uniqueDiffOn_Icc har s (hsub hs)) (uniqueDiffOn_Icc hde.ordered s hs) |
| 120 | (hαs s (hde.interval_subset hs)) |
| 121 | have hDP := pullbackCovariantDerivative_restrict F (fun v ↦ T - v ^ 2) hsub EP |
| 122 | (uniqueDiffOn_Icc har s (hsub hs)) (uniqueDiffOn_Icc hde.ordered s hs) |
| 123 | (hαs s (hde.interval_subset hs)) |
| 124 | refine ⟨hDY.trans (hlocalEq.1 s hs), ?_⟩ |
| 125 | intro W |
| 126 | rw [hDP] |
| 127 | exact hlocalEq.2 s hs W |
| 128 | have hleft : IsJacobiPairOn F T α S a c q := hf.congr (by |
| 129 | intro s hs |
| 130 | simp only [q, if_pos hs.2]) |
| 131 | have hright : IsJacobiPairOn F T α S l r q := hg.congr (by |
| 132 | intro s hs |
| 133 | dsimp only [q] |
| 134 | split_ifs with hsc |
| 135 | · exact (heq ⟨hs.1, hsc⟩).symm |
| 136 | · rfl) |
| 137 | have hpoint : ∀ s ∈ Icc a r, |
| 138 | pullbackCovariantDerivative F (fun v ↦ T - v ^ 2) α |
| 139 | (fun v ↦ (q v).1) (Icc a r) EY s = (q s).2 ∧ |
| 140 | ∀ W : TangentSpace (𝓡 n) (α s), |
| 141 | jacobiPairResidual F T α S s (q s).1 (q s).2 |
| 142 | (pullbackCovariantDerivative F (fun v ↦ T - v ^ 2) α |
| 143 | (fun v ↦ (q v).2) (Icc a r) EP s) W = 0 := by |
| 144 | intro s hs |
| 145 | by_cases hsc : s ≤ c |
| 146 | · exact hlocal hleft (Icc_subset_Icc le_rfl hcr.le) s ⟨hs.1, hsc⟩ |
| 147 | · exact hlocal hright (Icc_subset_Icc hal le_rfl) s |
| 148 | ⟨hlc.le.trans (le_of_not_ge hsc), hs.2⟩ |
| 149 | exact ⟨har, hqS, hqY, hqP, EY, EP, |
| 150 | fun s hs ↦ (hpoint s hs).1, fun s hs ↦ (hpoint s hs).2⟩ |
| 151 | |
| 152 | theorem jacobiPairOn_locality {J S U : Set ℝ} (F : RicciFlow n M J) (T : ℝ) |
| 153 | (α : ℝ → M) (hU : IsOpen U) (hSU : S ⊆ U) |
| 154 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ α U) : |
| 155 | IntervalSolutionLocality (IsJacobiPairOn F T α S) where |
| 156 | restrict hac hcd hdb h := h.restrict (fun s hs ↦ |
| 157 | ((hα s (hSU (h.interval_subset hs))).contMDiffAt |
| 158 | (hU.mem_nhds (hSU (h.interval_subset hs)))).mdifferentiableAt (by simp)) hac hcd hdb |
| 159 | paste hal hlc hcr hf hg heq := jacobiPairOn_paste F T α hU hSU hα hal hlc hcr hf hg heq |
| 160 | |
| 161 | end PoincareMT.LGeometry |