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.Basic |
| 2 | import Mathlib.Geometry.Manifold.ContMDiff.Basic |
| 3 | |
| 4 | /-! |
| 5 | # Finite smooth path gluing |
| 6 | |
| 7 | Constant endpoint germs join smooth chart recoveries, including repeated |
| 8 | subdivision values. The same finite subdivision telescopes action integrals. |
| 9 | |
| 10 | Adapted from Mapher `Proofs/M08/PathGluing.lean`, commit |
| 11 | `49331b7d7ecad38f53e4300c3b35d6a84b2cc648`. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Filter Topology |
| 17 | open scoped Manifold ContDiff |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.ReducedLengthMinimum.Variational |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | |
| 26 | theorem exists_smooth_fin_gluing (m : ℕ) (t : Fin (m + 1) → ℝ) (ht : Monotone t) |
| 27 | (γ : ℝ → M) (f : Fin m → ℝ → M) |
| 28 | (hf : ∀ i, ContMDiff (𝓘(ℝ, ℝ)) (𝓡 n) ∞ (f i)) |
| 29 | (hleft : ∀ i s, s ≤ t i.castSucc → f i s = γ (t i.castSucc)) |
| 30 | (hright : ∀ i s, t i.succ ≤ s → f i s = γ (t i.succ)) |
| 31 | (hleftgerm : ∀ i, f i =ᶠ[𝓝 (t i.castSucc)] fun _ ↦ γ (t i.castSucc)) |
| 32 | (hrightgerm : ∀ i, f i =ᶠ[𝓝 (t i.succ)] fun _ ↦ γ (t i.succ)) : |
| 33 | ∃ g : ℝ → M, ContMDiff (𝓘(ℝ, ℝ)) (𝓡 n) ∞ g ∧ |
| 34 | (∀ i, EqOn g (f i) (Icc (t i.castSucc) (t i.succ))) ∧ |
| 35 | (∀ s, s ≤ t 0 → g s = γ (t 0)) ∧ |
| 36 | (∀ s, t (Fin.last m) ≤ s → g s = γ (t (Fin.last m))) ∧ |
| 37 | (g =ᶠ[𝓝 (t 0)] fun _ ↦ γ (t 0)) ∧ |
| 38 | (g =ᶠ[𝓝 (t (Fin.last m))] fun _ ↦ γ (t (Fin.last m))) := by |
| 39 | classical |
| 40 | induction m with |
| 41 | | zero => |
| 42 | refine ⟨fun _ ↦ γ (t 0), contMDiff_const, ?_, fun _ _ ↦ rfl, |
| 43 | fun _ _ ↦ rfl, Filter.EventuallyEq.rfl, Filter.EventuallyEq.rfl⟩ |
| 44 | intro i |
| 45 | exact Fin.elim0 i |
| 46 | | succ m ih => |
| 47 | let t₀ : Fin (m + 1) → ℝ := fun i ↦ t i.castSucc |
| 48 | let f₀ : Fin m → ℝ → M := fun i ↦ f i.castSucc |
| 49 | have ht₀ : Monotone t₀ := fun _ _ hij ↦ ht hij |
| 50 | obtain ⟨g₀, hg₀, hpieces₀, hleft₀, hright₀, hlg₀, hrg₀⟩ := |
| 51 | ih t₀ ht₀ f₀ (fun i ↦ hf i.castSucc) |
| 52 | (fun i ↦ hleft i.castSucc) (fun i ↦ hright i.castSucc) |
| 53 | (fun i ↦ hleftgerm i.castSucc) (fun i ↦ hrightgerm i.castSucc) |
| 54 | let c := t (Fin.last m).castSucc |
| 55 | let d := t (Fin.last (m + 1)) |
| 56 | let f₁ := f (Fin.last m) |
| 57 | let g := (Iic c).piecewise g₀ f₁ |
| 58 | have hac : t 0 ≤ c := ht (Fin.zero_le _) |
| 59 | have hcd : c ≤ d := ht (Fin.castSucc_le_succ (Fin.last m)) |
| 60 | have hfg : g₀ =ᶠ[𝓝 c] f₁ := hrg₀.trans (hleftgerm (Fin.last m)).symm |
| 61 | have hg : ContMDiff (𝓘(ℝ, ℝ)) (𝓡 n) ∞ g := |
| 62 | hg₀.piecewise_Iic (hf (Fin.last m)) hfg |
| 63 | have heqleft (s : ℝ) (hs : s ≤ c) : g s = g₀ s := |
| 64 | piecewise_eq_of_mem (Iic c) g₀ f₁ hs |
| 65 | have heqright (s : ℝ) (hs : c ≤ s) : g s = f₁ s := by |
| 66 | by_cases hsc : s ≤ c |
| 67 | · have hsc' : s = c := le_antisymm hsc hs |
| 68 | rw [hsc', heqleft c le_rfl, hright₀ c le_rfl] |
| 69 | exact (hleft (Fin.last m) c le_rfl).symm |
| 70 | · exact piecewise_eq_of_notMem (Iic c) g₀ f₁ hsc |
| 71 | have hgc : g =ᶠ[𝓝 c] fun _ ↦ γ c := by |
| 72 | filter_upwards [hrg₀, hleftgerm (Fin.last m)] with s h₀ h₁ |
| 73 | simp only [g, piecewise] |
| 74 | split_ifs <;> assumption |
| 75 | refine ⟨g, hg, ?_, ?_, ?_, ?_, ?_⟩ |
| 76 | · intro i |
| 77 | refine Fin.lastCases ?_ (fun j ↦ ?_) i |
| 78 | · intro s hs |
| 79 | exact heqright s hs.1 |
| 80 | · intro s hs |
| 81 | have hs' : s ≤ c := hs.2.trans (ht (show j.castSucc.succ ≤ |
| 82 | (Fin.last m).castSucc from by simp only [Fin.succ_castSucc]; exact |
| 83 | Fin.castSucc_le_castSucc_iff.mpr (Fin.le_last j.succ))) |
| 84 | rw [heqleft s hs'] |
| 85 | exact hpieces₀ j hs |
| 86 | · intro s hs |
| 87 | exact (heqleft s (hs.trans hac)).trans (hleft₀ s hs) |
| 88 | · intro s hs |
| 89 | exact (heqright s (hcd.trans hs)).trans (hright (Fin.last m) s hs) |
| 90 | · rcases hac.lt_or_eq with hac | hac |
| 91 | · filter_upwards [hlg₀, Iio_mem_nhds hac] with s hs hsc |
| 92 | exact (heqleft s hsc.le).trans hs |
| 93 | · simpa only [hac] using hgc |
| 94 | · rcases hcd.lt_or_eq with hcd | hcd |
| 95 | · filter_upwards [hrightgerm (Fin.last m), Ioi_mem_nhds hcd] with s hs hsc |
| 96 | exact (heqright s hsc.le).trans hs |
| 97 | · simpa only [hcd] using hgc |
| 98 | |
| 99 | theorem mem_fin_partition {m : ℕ} (t : Fin (m + 1) → ℝ) (ht : Monotone t) |
| 100 | {s : ℝ} (hs : s ∈ Icc (t 0) (t (Fin.last m))) : |
| 101 | s = t 0 ∨ ∃ i : Fin m, s ∈ Icc (t i.castSucc) (t i.succ) := by |
| 102 | induction m with |
| 103 | | zero => exact Or.inl (le_antisymm hs.2 hs.1) |
| 104 | | succ m ih => |
| 105 | by_cases hsc : s ≤ t (Fin.last m).castSucc |
| 106 | · rcases ih (fun i ↦ t i.castSucc) (fun _ _ hij ↦ ht hij) ⟨hs.1, hsc⟩ with h | ⟨i, hi⟩ |
| 107 | · exact Or.inl h |
| 108 | · exact Or.inr ⟨i.castSucc, hi⟩ |
| 109 | · exact Or.inr ⟨Fin.last m, le_of_not_ge hsc, hs.2⟩ |
| 110 | |
| 111 | open MeasureTheory |
| 112 | open scoped intervalIntegral |
| 113 | |
| 114 | theorem integrable_sum_fin_partition {m : ℕ} (t : Fin (m + 1) → ℝ) (f : ℝ → ℝ) |
| 115 | (hf : ∀ i : Fin m, IntervalIntegrable f volume (t i.castSucc) (t i.succ)) : |
| 116 | IntervalIntegrable f volume (t 0) (t (Fin.last m)) ∧ |
| 117 | (∑ i : Fin m, ∫ s in t i.castSucc..t i.succ, f s) = |
| 118 | ∫ s in t 0..t (Fin.last m), f s := by |
| 119 | induction m with |
| 120 | | zero => simp |
| 121 | | succ m ih => |
| 122 | obtain ⟨hint, heq⟩ := ih (fun i ↦ t i.castSucc) (fun i ↦ hf i.castSucc) |
| 123 | refine ⟨hint.trans (hf (Fin.last m)), ?_⟩ |
| 124 | rw [Fin.sum_univ_castSucc] |
| 125 | change (∑ i : Fin m, ∫ s in t i.castSucc.castSucc..t i.castSucc.succ, f s) = |
| 126 | ∫ s in t 0..t (Fin.last m).castSucc, f s at heq |
| 127 | rw [heq] |
| 128 | exact intervalIntegral.integral_add_adjacent_intervals hint (hf (Fin.last m)) |
| 129 | |
| 130 | end PoincareMT.ReducedLengthMinimum.Variational |