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.Basic |
| 2 | |
| 3 | open MeasureTheory Set Filter |
| 4 | open scoped ContDiff Topology |
| 5 | |
| 6 | namespace Poincare.Analysis |
| 7 | |
| 8 | /-- A smooth scalar function maps its sufficiently flat stratum to a null set. -/ |
| 9 | theorem scalar_flat_image_null |
| 10 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 11 | [FiniteDimensional ℝ E] {V s : Set E} {f : E → ℝ} {n : ℕ} |
| 12 | (hV : IsOpen V) (hf : ContDiffOn ℝ ∞ f V) (hs : s ⊆ V) |
| 13 | (hdim : Module.finrank ℝ E ≤ n) |
| 14 | (hflat : ∀ x ∈ s, ∀ k, 1 ≤ k → k ≤ n → iteratedFDeriv ℝ k f x = 0) : |
| 15 | volume (f '' s) = 0 := by |
| 16 | let r : NNReal := ⟨(n + 1 : ℕ), by positivity⟩ |
| 17 | have hr : 0 < r := by |
| 18 | change (0 : ℝ) < ((n + 1 : ℕ) : ℝ) |
| 19 | positivity |
| 20 | have hholder : ∀ x ∈ s, ∃ C : NNReal, ∃ t ∈ nhdsWithin x s, |
| 21 | HolderOnWith C r f t := by |
| 22 | intro x hx |
| 23 | let C : ℝ := ‖iteratedFDeriv ℝ (n + 1) f x‖ + 1 |
| 24 | have hC : 0 ≤ C := by dsimp [C]; positivity |
| 25 | have hD : ContinuousAt (iteratedFDeriv ℝ (n + 1) f) x := |
| 26 | ((hf x (hs hx)).contDiffAt (hV.mem_nhds (hs hx))).continuousAt_iteratedFDeriv |
| 27 | (by exact_mod_cast (le_top : (n + 1 : ℕ∞) ≤ ⊤)) |
| 28 | have hbound : ∀ᶠ y in 𝓝 x, ‖iteratedFDeriv ℝ (n + 1) f y‖ < C := |
| 29 | hD.norm.eventually (gt_mem_nhds (lt_add_one _)) |
| 30 | obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.mp |
| 31 | (inter_mem (hV.mem_nhds (hs hx)) hbound) |
| 32 | refine ⟨⟨C / (Nat.factorial n : ℝ), by positivity⟩, |
| 33 | Metric.ball x ε ∩ s, ?_, ?_⟩ |
| 34 | · exact inter_mem (mem_nhdsWithin_of_mem_nhds (Metric.ball_mem_nhds x hε)) |
| 35 | self_mem_nhdsWithin |
| 36 | · apply holderOnWith_of_flat_iteratedFDeriv (convex_ball x ε) hC inter_subset_left |
| 37 | · intro z hz |
| 38 | exact ((hf z (hball hz).1).contDiffAt |
| 39 | (hV.mem_nhds (hball hz).1)).of_le |
| 40 | (by exact_mod_cast (le_top : (n + 1 : ℕ∞) ≤ ⊤)) |
| 41 | · intro z hz k hk hkn |
| 42 | exact hflat z hz.2 k hk hkn |
| 43 | · intro z hz |
| 44 | exact (hball hz).2.le |
| 45 | have hsource : dimH s ≤ (Module.finrank ℝ E : ENNReal) := by |
| 46 | rw [← Real.dimH_univ_eq_finrank E] |
| 47 | exact dimH_mono (subset_univ s) |
| 48 | have hquot : (Module.finrank ℝ E : ENNReal) / r < 1 := by |
| 49 | rw [ENNReal.div_lt_iff (Or.inl (by positivity)) (Or.inl (by simp)), one_mul] |
| 50 | change (Module.finrank ℝ E : ENNReal) < (n + 1 : ℕ) |
| 51 | exact_mod_cast Nat.lt_succ_of_le hdim |
| 52 | have himage : dimH (f '' s) < 1 := |
| 53 | ((dimH_image_le_of_locally_holder_on hr hholder).trans |
| 54 | (ENNReal.div_le_div_right hsource r)).trans_lt hquot |
| 55 | have hhausdorff : |
| 56 | Measure.hausdorffMeasure (Module.finrank ℝ ℝ : ℝ) (f '' s) = 0 := by |
| 57 | simpa using hausdorffMeasure_of_dimH_lt himage |
| 58 | rw [Measure.isAddLeftInvariant_eq_smul volume |
| 59 | (Measure.hausdorffMeasure (Module.finrank ℝ ℝ : ℝ))] |
| 60 | rw [Measure.smul_apply, hhausdorff] |
| 61 | simp |
| 62 | |
| 63 | end Poincare.Analysis |
| 64 |