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 | import Mathlib.MeasureTheory.Function.Jacobian |
| 5 | |
| 6 | /-! |
| 7 | # Local exceptional sets for Corollary 6.67 |
| 8 | |
| 9 | Morgan--Tian Corollary 6.67 and Claims 6.68-6.69, printed pp. 139-140, |
| 10 | as used in Proposition 16.1, p. 394. Calibrated Rademacher nullity needs |
| 11 | local regularity only on the comparison region; calibrated Sard nullity |
| 12 | needs differentiability only on the survival domain. These are the local |
| 13 | forms of the chart arguments in the lower M10 library. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | -- The calibrated-volume chart transport uses the selected metric instances. |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open MeasureTheory Set Filter |
| 21 | open scoped Manifold ContDiff Bundle Topology NNReal ENNReal |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.M10 |
| 26 | export PoincareMT.ReducedVolume (inverseChart_local_lipschitz) |
| 27 | end PoincareMT.M10 |
| 28 | namespace PoincareMT.M10 |
| 29 | export PoincareMT.ReducedVolume (calibratedMetricVolume_image_eq_zero_of_lipschitz) |
| 30 | end PoincareMT.M10 |
| 31 | |
| 32 | namespace PoincareMT.Proofs.M46 |
| 33 | |
| 34 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 35 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 36 | [T3Space M] [SecondCountableTopology M] [MeasurableSpace M] [BorelSpace M] |
| 37 | |
| 38 | /-- Local chart Lipschitz regularity makes the nondifferentiability set |
| 39 | null within the selected comparison region, Corollary 6.67, p. 140. -/ |
| 40 | theorem comparison_nondifferentiability_null |
| 41 | (g : RiemannianMetric n M) {f : M → ℝ} (A : Set M) |
| 42 | (hf : ∀ q ∈ A, |
| 43 | ∃ S : Set (EuclideanSpace ℝ (Fin n)), IsOpen S ∧ extChartAt (𝓡 n) q q ∈ S ∧ |
| 44 | S ⊆ (extChartAt (𝓡 n) q).target ∧ |
| 45 | ∃ K : ℝ≥0, LipschitzOnWith K (f ∘ (extChartAt (𝓡 n) q).symm) S) : |
| 46 | calibratedMetricVolume g |
| 47 | {q | q ∈ A ∧ ¬ MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) f q} = 0 := by |
| 48 | apply measure_null_of_locally_null |
| 49 | intro q hq |
| 50 | obtain ⟨S, hSopen, hqS, _, K, hLip⟩ := hf q hq.1 |
| 51 | obtain ⟨r, hr, _, C, hchart⟩ := M10.inverseChart_local_lipschitz g q |
| 52 | let e := extChartAt (𝓡 n) q |
| 53 | let U := S ∩ Metric.ball (e q) r |
| 54 | have hUopen : IsOpen U := hSopen.inter Metric.isOpen_ball |
| 55 | have hqU : e q ∈ U := ⟨hqS, Metric.mem_ball_self hr⟩ |
| 56 | let B := {y | y ∈ U ∧ ¬ DifferentiableAt ℝ (f ∘ e.symm) y} |
| 57 | have hBnull : volume B = 0 := by |
| 58 | have hgood : ∀ᵐ y ∂volume, y ∈ U → DifferentiableAt ℝ (f ∘ e.symm) y := by |
| 59 | filter_upwards [LipschitzOnWith.ae_differentiableWithinAt_of_mem (μ := volume) |
| 60 | (hLip.mono (show U ⊆ S from inter_subset_left))] with y hy hyU |
| 61 | exact (hy hyU).differentiableAt (hUopen.mem_nhds hyU) |
| 62 | simpa only [Classical.not_imp] using ae_iff.mp hgood |
| 63 | have himage : calibratedMetricVolume g (e.symm '' B) = 0 := |
| 64 | M10.calibratedMetricVolume_image_eq_zero_of_lipschitz g |
| 65 | (fun _ hy => hy.1.2) hBnull hchart |
| 66 | let V := e.source ∩ e ⁻¹' U |
| 67 | have hV : V ∈ 𝓝 q := inter_mem (extChartAt_source_mem_nhds (I := 𝓡 n) q) |
| 68 | ((continuousAt_extChartAt (I := 𝓡 n) q).preimage_mem_nhds (hUopen.mem_nhds hqU)) |
| 69 | refine ⟨V ∩ {x | x ∈ A ∧ ¬ MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) f x}, |
| 70 | inter_mem (mem_nhdsWithin_of_mem_nhds hV) self_mem_nhdsWithin, ?_⟩ |
| 71 | apply measure_mono_null _ himage |
| 72 | intro x hx |
| 73 | refine ⟨e x, ⟨hx.1.2, ?_⟩, e.left_inv hx.1.1⟩ |
| 74 | intro hdiff |
| 75 | apply hx.2.2 |
| 76 | apply (mdifferentiableAt_iff_source_of_mem_source (I := 𝓡 n) |
| 77 | (I' := 𝓘(ℝ, ℝ)) (f := f) (x := q) |
| 78 | (by simpa only [← extChartAt_source (𝓡 n)] using hx.1.1)).mpr |
| 79 | simpa only [modelWithCornersSelf_coe, range_id, mdifferentiableWithinAt_univ] |
| 80 | using hdiff.mdifferentiableAt |
| 81 | |
| 82 | /-- Critical values coming from a specified differentiability domain |
| 83 | are null for the selected slice metric, Corollary 6.67, p. 140. -/ |
| 84 | theorem survival_criticalValues_null |
| 85 | (g : RiemannianMetric n M) {f : EuclideanSpace ℝ (Fin n) → M} |
| 86 | (D : Set (EuclideanSpace ℝ (Fin n))) |
| 87 | (hf : ∀ x ∈ D, MDifferentiableAt (𝓡 n) (𝓡 n) f x) : |
| 88 | calibratedMetricVolume g |
| 89 | (f '' {x | x ∈ D ∧ ¬ Function.Bijective (mfderiv (𝓡 n) (𝓡 n) f x)}) = 0 := by |
| 90 | apply measure_null_of_locally_null |
| 91 | intro q _ |
| 92 | obtain ⟨r, hr, _, C, hchart⟩ := M10.inverseChart_local_lipschitz g q |
| 93 | let e := extChartAt (𝓡 n) q |
| 94 | let U := Metric.ball (e q) r |
| 95 | let V := e.source ∩ e ⁻¹' U |
| 96 | have hV : V ∈ 𝓝 q := inter_mem (extChartAt_source_mem_nhds (I := 𝓡 n) q) |
| 97 | ((continuousAt_extChartAt (I := 𝓡 n) q).preimage_mem_nhds |
| 98 | (Metric.ball_mem_nhds _ hr)) |
| 99 | let A := {x | (x ∈ D ∧ ¬ Function.Bijective (mfderiv (𝓡 n) (𝓡 n) f x)) ∧ f x ∈ V} |
| 100 | have hcoord : ∀ x ∈ A, DifferentiableAt ℝ (e ∘ f) x := by |
| 101 | intro x hx |
| 102 | have he : MDifferentiableAt (𝓡 n) (𝓡 n) e (f x) := |
| 103 | mdifferentiableAt_extChartAt (by |
| 104 | simpa only [← extChartAt_source (𝓡 n)] using hx.2.1) |
| 105 | exact (he.comp x (hf x hx.1.1)).differentiableAt |
| 106 | have hdet : ∀ x ∈ A, (fderiv ℝ (e ∘ f) x).det = 0 := by |
| 107 | intro x hx |
| 108 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := |
| 109 | inferInstanceAs (FiniteDimensional ℝ (EuclideanSpace ℝ (Fin n))) |
| 110 | apply LinearMap.det_eq_zero_iff_ker_ne_bot.mpr |
| 111 | intro hker |
| 112 | have hinj : Function.Injective (fderiv ℝ (e ∘ f) x) := LinearMap.ker_eq_bot.mp hker |
| 113 | have he : MDifferentiableAt (𝓡 n) (𝓡 n) e (f x) := |
| 114 | mdifferentiableAt_extChartAt (by |
| 115 | simpa only [← extChartAt_source (𝓡 n)] using hx.2.1) |
| 116 | have hchain := mfderiv_comp x he (hf x hx.1.1) |
| 117 | rw [mfderiv_eq_fderiv] at hchain |
| 118 | have hdf : Function.Injective (mfderiv (𝓡 n) (𝓡 n) f x) := by |
| 119 | intro v w hvw |
| 120 | apply hinj |
| 121 | rw [hchain] |
| 122 | exact congrArg (mfderiv (𝓡 n) (𝓡 n) e (f x)) hvw |
| 123 | exact hx.1.2 ⟨hdf, LinearMap.injective_iff_surjective.mp hdf⟩ |
| 124 | have hnull : volume ((e ∘ f) '' A) = 0 := |
| 125 | addHaar_image_eq_zero_of_det_fderivWithin_eq_zero volume |
| 126 | (fun x hx => (hcoord x hx).hasFDerivAt.hasFDerivWithinAt) hdet |
| 127 | have himage : calibratedMetricVolume g (e.symm '' ((e ∘ f) '' A)) = 0 := |
| 128 | M10.calibratedMetricVolume_image_eq_zero_of_lipschitz g |
| 129 | (by rintro _ ⟨x, hx, rfl⟩; exact hx.2.2) hnull hchart |
| 130 | refine ⟨V ∩ f '' {x | x ∈ D ∧ ¬ Function.Bijective (mfderiv (𝓡 n) (𝓡 n) f x)}, |
| 131 | inter_mem (mem_nhdsWithin_of_mem_nhds hV) self_mem_nhdsWithin, ?_⟩ |
| 132 | apply measure_mono_null _ himage |
| 133 | rintro y ⟨hyV, x, hx, rfl⟩ |
| 134 | exact ⟨e (f x), ⟨x, ⟨hx, hyV⟩, rfl⟩, e.left_inv hyV.1⟩ |
| 135 | |
| 136 | end PoincareMT.Proofs.M46 |