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.Generalized.ReducedGeometry.Variation.Jacobi.JacobiPair |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Extension.ClosedFieldExtension |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.ODE.Extension.DependentIntervalSolution |
| 4 | |
| 5 | /-! |
| 6 | # Gluing actual horizontal Jacobi pairs |
| 7 | |
| 8 | Morgan-Tian Lemmas 6.10 and 6.12, pp. 109-110. Solutions agreeing |
| 9 | on an overlapping closed interval paste to smooth actual horizontal |
| 10 | fields. Closed pullback extensions and within derivative restriction |
| 11 | preserve their phase equations at every point, including endpoints. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Filter Topology |
| 17 | open scoped Manifold ContDiff Bundle |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.M14 |
| 22 | |
| 23 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 24 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 25 | |
| 26 | /-- Smooth horizontal fields agreeing on an overlap paste smoothly |
| 27 | within the full closed interval, Lemmas 6.10 and 6.12, pp. 109-110. -/ |
| 28 | theorem horizontalField_paste_contMDiffOn (γ : ℝ → G.Point) {a l c r : ℝ} |
| 29 | (hlc : l < c) (Y Z : ∀ s, G.Horizontal (γ s)) |
| 30 | (hY : ContMDiffOn (𝓘(ℝ, ℝ)) |
| 31 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 32 | (fun s => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (γ s) (Y s)) (Icc a c)) |
| 33 | (hZ : ContMDiffOn (𝓘(ℝ, ℝ)) |
| 34 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 35 | (fun s => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (γ s) (Z s)) (Icc l r)) |
| 36 | (heq : ∀ s ∈ Icc l c, Y s = Z s) : |
| 37 | ContMDiffOn (𝓘(ℝ, ℝ)) |
| 38 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 39 | (fun s => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (γ s) |
| 40 | (if s ≤ c then Y s else Z s)) (Icc a r) := by |
| 41 | have hleft : ∀ s ∈ Icc a c, |
| 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) (Y s) := by |
| 45 | intro s hs |
| 46 | rw [if_pos hs.2] |
| 47 | have hright : ∀ s ∈ Icc l r, |
| 48 | Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (γ s) |
| 49 | (if s ≤ c then Y s else Z s) = |
| 50 | Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (γ s) (Z s) := by |
| 51 | intro s hs |
| 52 | by_cases hsc : s ≤ c |
| 53 | · rw [if_pos hsc, heq s ⟨hs.1, hsc⟩] |
| 54 | · rw [if_neg hsc] |
| 55 | intro s hs |
| 56 | by_cases hsc : s < c |
| 57 | · have hsold : s ∈ Icc a c := ⟨hs.1, hsc.le⟩ |
| 58 | apply ((hY s hsold).congr_of_mem hleft hsold).mono_of_mem_nhdsWithin |
| 59 | apply mem_nhdsWithin_iff_exists_mem_nhds_inter.mpr |
| 60 | exact ⟨Iio c, Iio_mem_nhds hsc, fun _ ht => ⟨ht.2.1, ht.1.le⟩⟩ |
| 61 | · have hcs : c ≤ s := le_of_not_gt hsc |
| 62 | have hsnew : s ∈ Icc l r := ⟨hlc.le.trans hcs, hs.2⟩ |
| 63 | apply ((hZ s hsnew).congr_of_mem hright hsnew).mono_of_mem_nhdsWithin |
| 64 | apply mem_nhdsWithin_iff_exists_mem_nhds_inter.mpr |
| 65 | exact ⟨Ioi l, Ioi_mem_nhds (hlc.trans_le hcs), fun _ ht => ⟨ht.1.le, ht.2.2⟩⟩ |
| 66 | |
| 67 | variable {T τ₁ τ₂ : ℝ} {x y : G.Point} {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 68 | {R : M14SquareRootPath G p} |
| 69 | |
| 70 | /-- Actual Jacobi solutions agreeing on an overlapping interval |
| 71 | paste to an actual solution on the union, including all closed |
| 72 | endpoints, Lemmas 6.10 and 6.12, pp. 109-110. -/ |
| 73 | theorem horizontalJacobiPairOn_paste {a l c r : ℝ} |
| 74 | (hal : a ≤ l) (hlc : l < c) (hcr : c < r) |
| 75 | {f g : ∀ s, G.Horizontal (R.curve s) × G.Horizontal (R.curve s)} |
| 76 | (hf : IsHorizontalJacobiPairOn R a c f) (hg : IsHorizontalJacobiPairOn R l r g) |
| 77 | (heq : ∀ s ∈ Icc l c, f s = g s) : |
| 78 | IsHorizontalJacobiPairOn R a r (fun s => if s ≤ c then f s else g s) := by |
| 79 | let q := fun s => if s ≤ c then f s else g s |
| 80 | have har : a < r := (hal.trans_lt hlc).trans hcr |
| 81 | have hqC : Icc a r ⊆ M14SqrtParameterInterval τ₁ τ₂ := by |
| 82 | intro s hs |
| 83 | by_cases hsc : s ≤ c |
| 84 | · exact hf.interval_subset ⟨hs.1, hsc⟩ |
| 85 | · exact hg.interval_subset ⟨hlc.le.trans (le_of_not_ge hsc), hs.2⟩ |
| 86 | have hqY : ContMDiffOn (𝓘(ℝ, ℝ)) |
| 87 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 88 | (fun s => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (R.curve s) (q s).1) |
| 89 | (Icc a r) := by |
| 90 | have h := horizontalField_paste_contMDiffOn R.curve hlc (fun s => (f s).1) |
| 91 | (fun s => (g s).1) hf.first_smooth hg.first_smooth |
| 92 | (fun s hs => congrArg Prod.fst (heq s hs)) |
| 93 | convert h using 1 |
| 94 | funext s |
| 95 | dsimp only [q] |
| 96 | split_ifs <;> rfl |
| 97 | have hqP : ContMDiffOn (𝓘(ℝ, ℝ)) |
| 98 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 99 | (fun s => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (R.curve s) (q s).2) |
| 100 | (Icc a r) := by |
| 101 | have h := horizontalField_paste_contMDiffOn R.curve hlc (fun s => (f s).2) |
| 102 | (fun s => (g s).2) hf.second_smooth hg.second_smooth |
| 103 | (fun s hs => congrArg Prod.snd (heq s hs)) |
| 104 | convert h using 1 |
| 105 | funext s |
| 106 | dsimp only [q] |
| 107 | split_ifs <;> rfl |
| 108 | obtain ⟨EY⟩ := exists_pullbackExtension_Icc har hqY |
| 109 | obtain ⟨EP⟩ := exists_pullbackExtension_Icc har hqP |
| 110 | have hR := R.smooth.mono (hqC.trans R.interval_subset) |
| 111 | have hlocal {d e : ℝ} (hde : IsHorizontalJacobiPairOn R d e q) |
| 112 | (hsub : Icc d e ⊆ Icc a r) : |
| 113 | ∀ s ∈ Icc d e, |
| 114 | M14HorizontalCovariantDerivative G R.curve (Icc a r) |
| 115 | (fun v => (q v).1) EY s = (q s).2 ∧ |
| 116 | ∀ W : G.Horizontal (R.curve s), |
| 117 | horizontalJacobiPairResidual R s (q s).1 (q s).2 |
| 118 | (M14HorizontalCovariantDerivative G R.curve (Icc a r) |
| 119 | (fun v => (q v).2) EP s) W = 0 := by |
| 120 | have hEq := hde.equations_for_extensions |
| 121 | (pullbackExtensionRestrict EY hsub) (pullbackExtensionRestrict EP hsub) |
| 122 | intro s hs |
| 123 | have hDY := horizontalCovariantDerivative_restrict_subset EY hsub |
| 124 | (uniqueDiffOn_Icc hde.ordered s hs) ((hR s (hsub hs)).mdifferentiableWithinAt (by simp)) |
| 125 | have hDP := horizontalCovariantDerivative_restrict_subset EP hsub |
| 126 | (uniqueDiffOn_Icc hde.ordered s hs) ((hR s (hsub hs)).mdifferentiableWithinAt (by simp)) |
| 127 | exact ⟨hDY.trans (hEq.1 s hs), fun W => hDP ▸ hEq.2 s hs W⟩ |
| 128 | have hleft : IsHorizontalJacobiPairOn R a c q := hf.congr (by |
| 129 | intro s hs |
| 130 | simp only [q, if_pos hs.2]) |
| 131 | have hright : IsHorizontalJacobiPairOn R l r q := hg.congr (by |
| 132 | intro s hs |
| 133 | dsimp only [q] |
| 134 | split_ifs with hsc |
| 135 | · exact (heq s ⟨hs.1, hsc⟩).symm |
| 136 | · rfl) |
| 137 | have hpoint (s : ℝ) (hs : s ∈ Icc a r) := by |
| 138 | by_cases hsc : s ≤ c |
| 139 | · exact hlocal hleft (Icc_subset_Icc le_rfl hcr.le) s ⟨hs.1, hsc⟩ |
| 140 | · exact hlocal hright (Icc_subset_Icc hal le_rfl) s |
| 141 | ⟨hlc.le.trans (le_of_not_ge hsc), hs.2⟩ |
| 142 | exact ⟨har, hqC, hqY, hqP, EY, EP, |
| 143 | fun s hs => (hpoint s hs).1, fun s hs => (hpoint s hs).2⟩ |
| 144 | |
| 145 | /-- Horizontal Jacobi pairs satisfy the abstract dependent gluing |
| 146 | conditions on closed intervals, Lemmas 6.10 and 6.12, pp. 109-110. -/ |
| 147 | theorem horizontalJacobiPairOn_locality (R : M14SquareRootPath G p) : |
| 148 | DependentIntervalSolutionLocality (IsHorizontalJacobiPairOn R) where |
| 149 | restrict hac hcd hdb h := h.restrict hac hcd hdb |
| 150 | paste hal hlc hcr hf hg heq := horizontalJacobiPairOn_paste hal hlc hcr hf hg heq |
| 151 | |
| 152 | end PoincareMT.M14 |