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.Riemannian.Connection |
| 2 | import Mathlib.Geometry.Manifold.VectorBundle.LocalFrame |
| 3 | |
| 4 | /-! |
| 5 | # The connection in a differentiable local frame |
| 6 | |
| 7 | Finite-section linearity and the actual Leibniz rule give a local |
| 8 | coefficient formula, with differentiability retained for germ congruence. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open scoped Manifold ContDiff Bundle BigOperators Topology |
| 14 | |
| 15 | open Filter |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.ReducedLength |
| 20 | |
| 21 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 23 | [IsManifold (𝓡 n) ∞ M] {g : RiemannianMetric n M} |
| 24 | |
| 25 | theorem connection_finset_sum (D : LeviCivitaData g) {ι : Type*} (S : Finset ι) |
| 26 | (σ : ι → (q : M) → TangentSpace (𝓡 n) q) (q : M) |
| 27 | (hσ : ∀ i ∈ S, MDifferentiableAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) (T% (σ i)) q) |
| 28 | (X : TangentSpace (𝓡 n) q) : |
| 29 | D.connection (fun x ↦ ∑ i ∈ S, σ i x) q X = ∑ i ∈ S, D.connection (σ i) q X := by |
| 30 | classical |
| 31 | induction S using Finset.induction_on with |
| 32 | | empty => |
| 33 | simp only [Finset.sum_empty] |
| 34 | exact congrArg (fun f : (x : M) → TangentSpace (𝓡 n) x →L[ℝ] |
| 35 | TangentSpace (𝓡 n) x ↦ f q X) D.connection.zero |
| 36 | | insert a S ha ih => |
| 37 | simp only [Finset.mem_insert, forall_eq_or_imp] at hσ |
| 38 | simp only [Finset.sum_insert ha] |
| 39 | change D.connection (σ a + (fun x ↦ ∑ i ∈ S, σ i x)) q X = _ |
| 40 | rw [D.connection.isCovariantDerivativeOnUniv.add hσ.1 |
| 41 | (MDifferentiableAt.sum_section hσ.2)] |
| 42 | simp only [add_apply] |
| 43 | rw [ih hσ.2] |
| 44 | |
| 45 | theorem connection_germ_expansion (D : LeviCivitaData g) {ι : Type*} [Fintype ι] |
| 46 | (σ : (q : M) → TangentSpace (𝓡 n) q) |
| 47 | (frame : ι → (q : M) → TangentSpace (𝓡 n) q) (c : ι → M → ℝ) |
| 48 | (q : M) (X : TangentSpace (𝓡 n) q) |
| 49 | (hσ : MDifferentiableAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) (T% σ) q) |
| 50 | (hframe : ∀ i, MDifferentiableAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) (T% (frame i)) q) |
| 51 | (hc : ∀ i, MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) (c i) q) |
| 52 | (heq : σ =ᶠ[𝓝 q] (fun x ↦ ∑ i, c i x • frame i x)) : |
| 53 | D.connection σ q X = |
| 54 | ∑ i, (c i q • D.connection (frame i) q X + |
| 55 | mvfderiv (𝓡 n) (c i) q X • frame i q) := by |
| 56 | have hterm (i : ι) := (hc i).smul_section (hframe i) |
| 57 | have hcongr := D.connection.isCovariantDerivativeOnUniv.congr_of_eventuallyEq |
| 58 | hσ (MDifferentiableAt.sum_section (fun i _ ↦ hterm i)) (by simp) heq |
| 59 | rw [hcongr, connection_finset_sum D Finset.univ _ q (fun i _ ↦ hterm i)] |
| 60 | apply Finset.sum_congr rfl |
| 61 | intro i _ |
| 62 | change D.connection ((c i) • frame i) q X = _ |
| 63 | rw [D.connection.isCovariantDerivativeOnUniv.leibniz (hframe i) (hc i)] |
| 64 | rfl |
| 65 | |
| 66 | theorem connection_localFrame (D : LeviCivitaData g) {ι : Type*} [Fintype ι] |
| 67 | (b : Module.Basis ι ℝ (EuclideanSpace ℝ (Fin n))) (p q : M) |
| 68 | (hq : q ∈ (trivializationAt (EuclideanSpace ℝ (Fin n)) |
| 69 | (TangentSpace (𝓡 n) : M → Type _) p).baseSet) |
| 70 | (σ : (x : M) → TangentSpace (𝓡 n) x) |
| 71 | (hσ : MDifferentiableAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) (T% σ) q) |
| 72 | (X : TangentSpace (𝓡 n) q) : |
| 73 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) |
| 74 | (TangentSpace (𝓡 n) : M → Type _) p |
| 75 | D.connection σ q X = ∑ i, |
| 76 | ((e.localFrameCoeff (𝓡 n) b i q (σ q)) • D.connection (e.localFrame b i) q X + |
| 77 | mvfderiv (𝓡 n) (fun x ↦ e.localFrameCoeff (𝓡 n) b i x (σ x)) q X • |
| 78 | e.localFrame b i q) := by |
| 79 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) |
| 80 | (TangentSpace (𝓡 n) : M → Type _) p |
| 81 | apply connection_germ_expansion D σ (e.localFrame b) |
| 82 | (fun i x ↦ e.localFrameCoeff (𝓡 n) b i x (σ x)) q X hσ |
| 83 | · intro i |
| 84 | exact (contMDiffAt_localFrame_of_mem 1 e b i hq).mdifferentiableAt (by simp) |
| 85 | · intro i |
| 86 | exact mdifferentiableAt_localFrameCoeff b hq hσ i |
| 87 | · exact e.eventually_eq_localFrame_sum_coeff_smul b hq |
| 88 | |
| 89 | end PoincareMT.ReducedLength |