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.Harnack.Noncompact.CurvatureControl.Volume |
| 2 | import PoincareLib.Geometry.Riemannian.Measure.Green.ChangeOfVariables |
| 3 | import PoincareLib.Geometry.Riemannian.Curvature.Scalar.Regularity |
| 4 | |
| 5 | /-! |
| 6 | # Intrinsic volume evolution on fixed coordinate sets |
| 7 | |
| 8 | The Hausdorff-density formula transports the local Ricci-flow volume derivative |
| 9 | to the intrinsic volume measure on compact chart images and their measurable |
| 10 | subsets. This is the fixed-set volume identity used in Cabezas-Rivas--Wilking, |
| 11 | Proposition 4.3, equation (4.2), and Corollary 4.4, p. 3161. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set MeasureTheory Filter |
| 18 | open scoped Manifold ContDiff Bundle ENNReal Topology |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [MeasurableSpace M] [BorelSpace M] [T3Space M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 27 | |
| 28 | /-- The coordinate integral formula on any measurable subset of a smooth chart. -/ |
| 29 | theorem RiemannianMetric.integral_image_eq_integral_pullback_density |
| 30 | (g : RiemannianMetric n M) |
| 31 | (e : OpenPartialHomeomorph (EuclideanSpace ℝ (Fin n)) M) |
| 32 | (he : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e e.source) |
| 33 | (hei : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e.symm e.target) |
| 34 | {s : Set (EuclideanSpace ℝ (Fin n))} (hs : MeasurableSet s) |
| 35 | (hse : s ⊆ e.source) {f : M → ℝ} (hf : ContinuousOn f e.target) : |
| 36 | (∫ y in e '' s, f y ∂g.volumeMeasure) = |
| 37 | ∫ x in s, f (e x) * g.pullbackVolumeDensity e x := by |
| 38 | have hmap := g.map_restrict_volumeMeasure_symm e he hei |
| 39 | have hc : ContinuousOn (fun x => f (e x)) e.source := |
| 40 | hf.comp e.continuousOn e.mapsTo |
| 41 | have hm : AEStronglyMeasurable (fun x => f (e x)) |
| 42 | ((g.volumeMeasure.restrict e.target).map e.symm) := by |
| 43 | rw [hmap] |
| 44 | exact hc.aestronglyMeasurable e.open_source.measurableSet |
| 45 | have hi := setIntegral_map hs hm |
| 46 | (e.symm.continuousOn.aemeasurable e.open_target.measurableSet) |
| 47 | have hset : e.symm ⁻¹' s ∩ e.target = e '' s := by |
| 48 | ext y |
| 49 | constructor |
| 50 | · intro hy |
| 51 | exact ⟨e.symm y, hy.1, e.right_inv hy.2⟩ |
| 52 | · rintro ⟨x, hx, rfl⟩ |
| 53 | exact ⟨by simpa only [mem_preimage, e.left_inv (hse hx)], e.map_source (hse hx)⟩ |
| 54 | have hid : (∫ y in e.symm ⁻¹' s, f (e (e.symm y)) |
| 55 | ∂g.volumeMeasure.restrict e.target) = |
| 56 | ∫ y in e '' s, f y ∂g.volumeMeasure := by |
| 57 | calc |
| 58 | _ = ∫ y in e.symm ⁻¹' s, f y ∂g.volumeMeasure.restrict e.target := by |
| 59 | apply integral_congr_ae |
| 60 | apply ae_restrict_of_ae |
| 61 | filter_upwards [ae_restrict_mem e.open_target.measurableSet] with y hy |
| 62 | exact congrArg f (e.right_inv hy) |
| 63 | _ = _ := by rw [Measure.restrict_restrict' e.open_target.measurableSet, hset] |
| 64 | rw [hid, hmap, Measure.restrict_restrict hs, inter_eq_left.mpr hse] at hi |
| 65 | rw [← hi] |
| 66 | have hD : e.MDifferentiable (𝓡 n) (𝓡 n) := |
| 67 | ⟨he.mdifferentiableOn (by simp), hei.mdifferentiableOn (by simp)⟩ |
| 68 | have hρ : ContinuousOn (g.pullbackVolumeDensity e) s := by |
| 69 | intro x hx |
| 70 | exact (g.contDiffAt_pullbackVolumeDensity |
| 71 | (he.contMDiffAt (e.open_source.mem_nhds (hse hx))) |
| 72 | (hD.mfderiv_injective (hse hx))).1.continuousAt.continuousWithinAt |
| 73 | rw [setIntegral_withDensity_eq_setIntegral_toReal_smul₀ |
| 74 | (μ := volume) (f := fun x => ENNReal.ofReal (g.pullbackVolumeDensity e x)) |
| 75 | (s := s) |
| 76 | ((ENNReal.continuous_ofReal.comp_continuousOn hρ).aemeasurable hs) |
| 77 | (Eventually.of_forall fun _ => ENNReal.ofReal_lt_top) (fun x => f (e x)) hs] |
| 78 | apply setIntegral_congr_fun hs |
| 79 | intro x hx |
| 80 | simp [RiemannianMetric.pullbackVolumeDensity, Real.sqrt_nonneg, |
| 81 | smul_eq_mul, mul_comm] |
| 82 | |
| 83 | /-- The real-valued intrinsic chart volume equals the integrated metric density. -/ |
| 84 | theorem RiemannianMetric.volumeMeasure_image_toReal_eq_integral_pullbackVolumeDensity |
| 85 | (g : RiemannianMetric n M) |
| 86 | (e : OpenPartialHomeomorph (EuclideanSpace ℝ (Fin n)) M) |
| 87 | (he : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e e.source) |
| 88 | (hei : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e.symm e.target) |
| 89 | {s : Set (EuclideanSpace ℝ (Fin n))} (hs : MeasurableSet s) |
| 90 | (hse : s ⊆ e.source) : |
| 91 | (g.volumeMeasure (e '' s)).toReal = ∫ x in s, g.pullbackVolumeDensity e x := by |
| 92 | simpa [integral_const, Measure.real, smul_eq_mul] using |
| 93 | g.integral_image_eq_integral_pullback_density e he hei hs hse |
| 94 | (f := fun _ => 1) continuousOn_const |
| 95 | |
| 96 | /-- A measurable coordinate set contained in a compact chart domain has the |
| 97 | intrinsic Ricci-flow volume derivative. -/ |
| 98 | theorem RicciFlow.hasDerivAt_volumeMeasure_image_of_subset |
| 99 | {J : Set ℝ} (F : RicciFlow n M J) {t : ℝ} (ht : t ∈ interior J) |
| 100 | (hD : (F.connection t).CurvatureTensorCalculus) |
| 101 | (e : OpenPartialHomeomorph (EuclideanSpace ℝ (Fin n)) M) |
| 102 | (he : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e e.source) |
| 103 | (hei : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e.symm e.target) |
| 104 | {K L : Set (EuclideanSpace ℝ (Fin n))} |
| 105 | (hK : MeasurableSet K) (hL : IsCompact L) (hKL : K ⊆ L) |
| 106 | (hLe : L ⊆ e.source) : |
| 107 | HasDerivAt (fun s => ((F.metric s).volumeMeasure (e '' K)).toReal) |
| 108 | (-(∫ y in e '' K, (F.connection t).scalarCurvature y |
| 109 | ∂(F.metric t).volumeMeasure)) t := by |
| 110 | have heD : e.MDifferentiable (𝓡 n) (𝓡 n) := |
| 111 | ⟨he.mdifferentiableOn (by simp), hei.mdifferentiableOn (by simp)⟩ |
| 112 | have hd := F.hasDerivAt_integral_pullbackVolumeDensity_of_subset ht hD e hK hL hKL |
| 113 | (fun x hx => he.contMDiffAt (e.open_source.mem_nhds (hLe hx))) |
| 114 | (fun x hx => heD.mfderiv_injective (hLe hx)) |
| 115 | have hfun : (fun s => ((F.metric s).volumeMeasure (e '' K)).toReal) = |
| 116 | (fun s => ∫ x in K, (F.metric s).pullbackVolumeDensity e x) := by |
| 117 | funext s |
| 118 | exact (F.metric s).volumeMeasure_image_toReal_eq_integral_pullbackVolumeDensity |
| 119 | e he hei hK (hKL.trans hLe) |
| 120 | rw [hfun] |
| 121 | convert hd using 1 |
| 122 | rw [(F.metric t).integral_image_eq_integral_pullback_density e he hei |
| 123 | hK (hKL.trans hLe) hD.contMDiff_scalarCurvature.continuous.continuousOn] |
| 124 | simp only [neg_mul, integral_neg] |
| 125 | |
| 126 | /-- A fixed compact chart image has the intrinsic Ricci-flow volume derivative. -/ |
| 127 | theorem RicciFlow.hasDerivAt_volumeMeasure_image |
| 128 | {J : Set ℝ} (F : RicciFlow n M J) {t : ℝ} (ht : t ∈ interior J) |
| 129 | (hD : (F.connection t).CurvatureTensorCalculus) |
| 130 | (e : OpenPartialHomeomorph (EuclideanSpace ℝ (Fin n)) M) |
| 131 | (he : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e e.source) |
| 132 | (hei : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e.symm e.target) |
| 133 | {K : Set (EuclideanSpace ℝ (Fin n))} (hK : IsCompact K) |
| 134 | (hKe : K ⊆ e.source) : |
| 135 | HasDerivAt (fun s => ((F.metric s).volumeMeasure (e '' K)).toReal) |
| 136 | (-(∫ y in e '' K, (F.connection t).scalarCurvature y |
| 137 | ∂(F.metric t).volumeMeasure)) t := |
| 138 | F.hasDerivAt_volumeMeasure_image_of_subset ht hD e he hei |
| 139 | hK.measurableSet hK Subset.rfl hKe |
| 140 | |
| 141 | end PoincareMT |