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.ReducedVolume.Regularity.Lipschitz.ChartLipschitz |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedVolume.Measure.Calibration.NullTransport |
| 3 | import Mathlib.Analysis.Calculus.Rademacher |
| 4 | |
| 5 | /-! |
| 6 | # Rademacher regularity for calibrated metric volume |
| 7 | |
| 8 | Fixed-chart Lipschitz representatives are differentiable outside a null set |
| 9 | for any selected smooth metric. Local null transport is assembled using |
| 10 | second countability, with no exceptional time parameter or positive-dimension |
| 11 | assumption. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open MeasureTheory Set Filter |
| 17 | open scoped Manifold ContDiff Bundle Topology NNReal ENNReal |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.ReducedVolume |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | [T3Space M] [SecondCountableTopology M] [MeasurableSpace M] [BorelSpace M] |
| 26 | |
| 27 | set_option backward.isDefEq.respectTransparency false in |
| 28 | /-- Coordinate local Lipschitz regularity gives actual differentiability almost everywhere. -/ |
| 29 | theorem calibratedMetricVolume_nondifferentiability_eq_zero |
| 30 | (g : RiemannianMetric n M) {f : M → ℝ} |
| 31 | (hf : ∀ q : M, |
| 32 | ∃ S : Set (EuclideanSpace ℝ (Fin n)), IsOpen S ∧ extChartAt (𝓡 n) q q ∈ S ∧ |
| 33 | S ⊆ (extChartAt (𝓡 n) q).target ∧ |
| 34 | ∃ K : ℝ≥0, LipschitzOnWith K (f ∘ (extChartAt (𝓡 n) q).symm) S) : |
| 35 | calibratedMetricVolume g {q | ¬ MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) f q} = 0 := by |
| 36 | apply measure_null_of_locally_null |
| 37 | intro q _hq |
| 38 | obtain ⟨S, hSopen, hqS, _hStarget, K, hLip⟩ := hf q |
| 39 | obtain ⟨r, hr, _hrtarget, C, hchart⟩ := inverseChart_local_lipschitz g q |
| 40 | let e := extChartAt (𝓡 n) q |
| 41 | let U := S ∩ Metric.ball (e q) r |
| 42 | have hUopen : IsOpen U := hSopen.inter Metric.isOpen_ball |
| 43 | have hqU : e q ∈ U := ⟨hqS, Metric.mem_ball_self hr⟩ |
| 44 | let B := {y | y ∈ U ∧ ¬ DifferentiableAt ℝ (f ∘ e.symm) y} |
| 45 | have hBnull : volume B = 0 := by |
| 46 | have hgood : ∀ᵐ y ∂volume, y ∈ U → DifferentiableAt ℝ (f ∘ e.symm) y := by |
| 47 | filter_upwards [LipschitzOnWith.ae_differentiableWithinAt_of_mem (μ := volume) |
| 48 | (hLip.mono (show U ⊆ S from inter_subset_left))] with y hy hyU |
| 49 | exact (hy hyU).differentiableAt (hUopen.mem_nhds hyU) |
| 50 | simpa only [Classical.not_imp] using ae_iff.mp hgood |
| 51 | have himage : calibratedMetricVolume g (e.symm '' B) = 0 := |
| 52 | calibratedMetricVolume_image_eq_zero_of_lipschitz g |
| 53 | (fun _ hy ↦ hy.1.2) hBnull hchart |
| 54 | let V := e.source ∩ e ⁻¹' U |
| 55 | have hV : V ∈ 𝓝 q := inter_mem (extChartAt_source_mem_nhds (I := 𝓡 n) q) |
| 56 | ((continuousAt_extChartAt (I := 𝓡 n) q).preimage_mem_nhds (hUopen.mem_nhds hqU)) |
| 57 | refine ⟨V ∩ {x | ¬ MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) f x}, |
| 58 | inter_mem (mem_nhdsWithin_of_mem_nhds hV) self_mem_nhdsWithin, ?_⟩ |
| 59 | apply measure_mono_null _ himage |
| 60 | intro x hx |
| 61 | refine ⟨e x, ⟨hx.1.2, ?_⟩, e.left_inv hx.1.1⟩ |
| 62 | intro hdiff |
| 63 | apply hx.2 |
| 64 | apply (mdifferentiableAt_iff_source_of_mem_source (I := 𝓡 n) |
| 65 | (I' := 𝓘(ℝ, ℝ)) (f := f) (x := q) |
| 66 | (by simpa only [← extChartAt_source (𝓡 n)] using hx.1.1)).mpr |
| 67 | simpa only [modelWithCornersSelf_coe, range_id, mdifferentiableWithinAt_univ] |
| 68 | using hdiff.mdifferentiableAt |
| 69 | |
| 70 | end PoincareMT.ReducedVolume |