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.Analysis.Calculus.Sard.Coordinate |
| 2 | import PoincareLib.Analysis.Calculus.Sard.FlatResidual |
| 3 | import PoincareLib.Analysis.Calculus.Sard.HigherDerivativeWitness |
| 4 | import Mathlib.LinearAlgebra.Dual.Lemmas |
| 5 | |
| 6 | /-! |
| 7 | # Scalar Sard induction |
| 8 | |
| 9 | Critical values of a smooth scalar function on an open finite-dimensional |
| 10 | domain have Lebesgue measure zero. The proof uses regular-level coordinates |
| 11 | to decrease the source dimension and Taylor's estimate on the flat stratum. |
| 12 | This specializes Lee, Theorem 6.10, proof Steps 2 and 3, printed pp. 130-131. |
| 13 | -/ |
| 14 | |
| 15 | open MeasureTheory Set Function |
| 16 | open scoped ContDiff Topology |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace Poincare.Analysis |
| 21 | |
| 22 | /-- The scalar critical values on an open finite-dimensional domain are null. -/ |
| 23 | theorem scalarCriticalImage_null_on |
| 24 | {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 25 | [FiniteDimensional ℝ E] {V : Set E} (hV : IsOpen V) |
| 26 | {f : E → ℝ} (hf : ContDiffOn ℝ ∞ f V) : |
| 27 | volume (f '' {x | x ∈ V ∧ fderiv ℝ f x = 0}) = 0 := by |
| 28 | classical |
| 29 | have local_null {E : Type u} [TopologicalSpace E] [SecondCountableTopology E] |
| 30 | (f : E → ℝ) (s : Set E) |
| 31 | (h : ∀ x ∈ s, ∃ t ∈ nhdsWithin x s, volume (f '' t) = 0) : |
| 32 | volume (f '' s) = 0 := by |
| 33 | apply (IsLindelof.of_coe (s := s)).induction_on |
| 34 | (p := fun t => volume (f '' t) = 0) |
| 35 | · intro s t hst ht |
| 36 | exact measure_mono_null (image_mono hst) ht |
| 37 | · intro S hS hzero |
| 38 | rw [image_sUnion, measure_sUnion_null_iff (hS.image _)] |
| 39 | rintro _ ⟨s, hs, rfl⟩ |
| 40 | exact hzero s hs |
| 41 | · exact h |
| 42 | induction hm : Module.finrank ℝ E using Nat.strong_induction_on generalizing E with |
| 43 | | h m ih => |
| 44 | let C : ℕ → Set E := fun k => |
| 45 | {x | x ∈ V ∧ fderiv ℝ f x = 0 ∧ |
| 46 | ∀ j, 1 ≤ j → j ≤ k → iteratedFDeriv ℝ j f x = 0} |
| 47 | have strata_null (k : ℕ) (hk : 1 ≤ k) : volume (f '' (C k \ C (k + 1))) = 0 := by |
| 48 | apply local_null f |
| 49 | intro a ha |
| 50 | have haV : a ∈ V := ha.1.1 |
| 51 | have hka : iteratedFDeriv ℝ k f a = 0 := ha.1.2.2 k hk le_rfl |
| 52 | have hnext : iteratedFDeriv ℝ (k + 1) f a ≠ 0 := by |
| 53 | intro hz |
| 54 | apply ha.2 |
| 55 | refine ⟨haV, ha.1.2.1, ?_⟩ |
| 56 | intro j hj hjk |
| 57 | by_cases he : j = k + 1 |
| 58 | · subst j |
| 59 | exact hz |
| 60 | · exact ha.1.2.2 j hj (by omega) |
| 61 | obtain ⟨g, hg, hga, hreg, hgzero⟩ := |
| 62 | exists_regular_scalar_of_iteratedFDeriv_ne_zero hV hf haV hka hnext |
| 63 | obtain ⟨W, U, p, q, hW, haW, hWV, hU, h0U, hp, hq, hp0, |
| 64 | hbij, hqp, hpq, hfp, hcritical⟩ := |
| 65 | exists_regular_level_parametrization hV hf hg haV hga hreg |
| 66 | let F := (fderiv ℝ g a).ker |
| 67 | have hLne : (fderiv ℝ g a).toLinearMap ≠ 0 := by |
| 68 | intro hz |
| 69 | obtain ⟨v, hv⟩ := hreg 1 |
| 70 | change (fderiv ℝ g a).toLinearMap v = 1 at hv |
| 71 | simp [hz] at hv |
| 72 | have hdim : Module.finrank ℝ F < m := by |
| 73 | have hd := Module.Dual.finrank_ker_add_one_of_ne_zero hLne |
| 74 | change Module.finrank ℝ F + 1 = Module.finrank ℝ E at hd |
| 75 | omega |
| 76 | have hrestricted : volume ((f ∘ p) '' |
| 77 | {u | u ∈ U ∧ fderiv ℝ (f ∘ p) u = 0}) = 0 := |
| 78 | ih (Module.finrank ℝ F) hdim hU hfp rfl |
| 79 | refine ⟨W ∩ (C k \ C (k + 1)), |
| 80 | Filter.inter_mem (mem_nhdsWithin_of_mem_nhds (hW.mem_nhds haW)) self_mem_nhdsWithin, ?_⟩ |
| 81 | apply measure_mono_null _ hrestricted |
| 82 | rintro _ ⟨x, ⟨hxW, hxC, hxnext⟩, rfl⟩ |
| 83 | have hgx : g x = 0 := hgzero x (hxC.2.2 k hk le_rfl) |
| 84 | obtain ⟨u, hu, hpu⟩ := hbij.surjOn ⟨hxW, hgx⟩ |
| 85 | refine ⟨u, ⟨hu, hcritical u hu ?_⟩, ?_⟩ |
| 86 | · simpa [hpu] using hxC.2.1 |
| 87 | · exact congrArg f hpu |
| 88 | have hbase : volume (f '' C (m + 1)) = 0 := by |
| 89 | have hsubset : C (m + 1) ⊆ {x | x ∈ V ∧ ∀ k, 1 ≤ k → k ≤ m + 1 → |
| 90 | iteratedFDeriv ℝ k f x = 0} := by |
| 91 | intro x hx |
| 92 | exact ⟨hx.1, hx.2.2⟩ |
| 93 | exact measure_mono_null (image_mono hsubset) |
| 94 | (scalarCriticalImage_null_flat_residual hV hf (n := m + 1) (by omega)) |
| 95 | have descending (j : ℕ) (hj : j ≤ m) : volume (f '' C (m + 1 - j)) = 0 := by |
| 96 | induction j with |
| 97 | | zero => simpa using hbase |
| 98 | | succ j hind => |
| 99 | have hk : 1 ≤ m + 1 - (j + 1) := by omega |
| 100 | have hprev := hind (by omega) |
| 101 | apply measure_mono_null (image_mono (s := C (m + 1 - (j + 1))) |
| 102 | (t := (C (m + 1 - (j + 1)) \ C (m + 1 - j)) ∪ C (m + 1 - j)) |
| 103 | (fun x hx => by |
| 104 | by_cases hn : x ∈ C (m + 1 - j) |
| 105 | · exact Or.inr hn |
| 106 | · exact Or.inl ⟨hx, hn⟩)) |
| 107 | rw [image_union] |
| 108 | apply measure_union_null _ hprev |
| 109 | have he : m + 1 - j = (m + 1 - (j + 1)) + 1 := by omega |
| 110 | rw [he] |
| 111 | exact strata_null _ hk |
| 112 | have hC1 : C 1 = {x | x ∈ V ∧ fderiv ℝ f x = 0} := by |
| 113 | ext x |
| 114 | constructor |
| 115 | · exact fun hx => ⟨hx.1, hx.2.1⟩ |
| 116 | · intro hx |
| 117 | refine ⟨hx.1, hx.2, ?_⟩ |
| 118 | intro j hj hj1 |
| 119 | have hjone : j = 1 := by omega |
| 120 | subst j |
| 121 | ext v |
| 122 | simp [iteratedFDeriv_one_apply, hx.2] |
| 123 | simpa [hC1] using descending m le_rfl |
| 124 | |
| 125 | end Poincare.Analysis |
| 126 |