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 Mathlib.LinearAlgebra.Pi |
| 2 | import Mathlib.Data.Set.Card |
| 3 | |
| 4 | /-! |
| 5 | # Generating a finite subspace from vectors of minimal support |
| 6 | |
| 7 | Support elimination reduces finite incidence exactness to filling minimal |
| 8 | cycles in the regional Euler step of Morgan--Tian Proposition 19.35, |
| 9 | pp. 467-481. The algebraic argument is recorded in |
| 10 | `proof-work/tasks/M64/derivations/2026-09-25-minimal-cycle-support.md`. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | namespace Submodule |
| 16 | |
| 17 | /-- To contain a subspace of a finite coordinate space, it suffices to contain its nonzero |
| 18 | vectors with inclusion-minimal support. The support elimination proof is recorded in the M64 |
| 19 | minimal-cycle derivation. Source/construction: |
| 20 | proof-work/tasks/M64/derivations/2026-09-25-minimal-cycle-support.md. -/ |
| 21 | theorem le_of_mem_of_support_minimal |
| 22 | {k E : Type*} [Field k] [Finite E] (K L : Submodule k (E → k)) |
| 23 | (hminimal : ∀ x ∈ K, x ≠ 0 → |
| 24 | (∀ y ∈ K, y ≠ 0 → Function.support y ⊆ Function.support x → |
| 25 | Function.support x ⊆ Function.support y) → x ∈ L) : |
| 26 | K ≤ L := by |
| 27 | classical |
| 28 | suffices h : ∀ n : ℕ, ∀ x ∈ K, (Function.support x).ncard = n → x ∈ L by |
| 29 | exact fun x hx => h _ x hx rfl |
| 30 | intro n |
| 31 | induction n using Nat.strong_induction_on with |
| 32 | | h n ih => |
| 33 | intro x hx hn |
| 34 | by_cases hxzero : x = 0 |
| 35 | · simpa only [hxzero] using L.zero_mem |
| 36 | by_cases hmin : ∀ y ∈ K, y ≠ 0 → Function.support y ⊆ Function.support x → |
| 37 | Function.support x ⊆ Function.support y |
| 38 | · exact hminimal x hx hxzero hmin |
| 39 | push Not at hmin |
| 40 | obtain ⟨y, hy, hyzero, hyx, hnxy⟩ := hmin |
| 41 | have hysmall : (Function.support y).ncard < n := by |
| 42 | rw [← hn] |
| 43 | exact Set.ncard_lt_ncard ⟨hyx, hnxy⟩ |
| 44 | have hyL : y ∈ L := ih _ hysmall y hy rfl |
| 45 | obtain ⟨e, he⟩ : ∃ e, y e ≠ 0 := by |
| 46 | by_contra h |
| 47 | apply hyzero |
| 48 | funext e |
| 49 | push Not at h |
| 50 | exact h e |
| 51 | let c := x e / y e |
| 52 | let z := x - c • y |
| 53 | have hzK : z ∈ K := K.sub_mem hx (K.smul_mem c hy) |
| 54 | have hzx : Function.support z ⊆ Function.support x := by |
| 55 | intro i hzi |
| 56 | by_contra hxi |
| 57 | have hxi' : x i = 0 := not_not.mp hxi |
| 58 | have hyi : y i = 0 := by |
| 59 | by_contra hyi |
| 60 | exact hxi (hyx hyi) |
| 61 | exact hzi (by simp only [z, Pi.sub_apply, Pi.smul_apply, smul_eq_mul, |
| 62 | hxi', hyi, mul_zero, sub_self]) |
| 63 | have hze : z e = 0 := by |
| 64 | simp only [z, Pi.sub_apply, Pi.smul_apply, smul_eq_mul, c, |
| 65 | div_mul_cancel₀ _ he, sub_self] |
| 66 | have hzsmall : (Function.support z).ncard < n := by |
| 67 | rw [← hn] |
| 68 | refine Set.ncard_lt_ncard ⟨hzx, ?_⟩ (Set.toFinite _) |
| 69 | intro hxz |
| 70 | exact hxz (hyx he) hze |
| 71 | have hzL : z ∈ L := ih _ hzsmall z hzK rfl |
| 72 | have hsum : z + c • y = x := sub_add_cancel x (c • y) |
| 73 | exact hsum ▸ L.add_mem hzL (L.smul_mem c hyL) |
| 74 | |
| 75 | end Submodule |