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.VolumeMeasure |
| 2 | import Mathlib.Geometry.Manifold.Instances.Real |
| 3 | import Mathlib.Topology.Compactness.LocallyCompact |
| 4 | |
| 5 | /-! |
| 6 | # Volume evolution on relatively compact measurable sets |
| 7 | |
| 8 | Finite compact localization assembles the coordinate calculation without a |
| 9 | global chart or an orientability assumption. This is the fixed-set volume |
| 10 | identity in Cabezas-Rivas--Wilking, Proposition 4.3, equation (4.2), p. 3161. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set MeasureTheory Filter |
| 17 | open scoped Manifold ContDiff Bundle ENNReal Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.RicciFlow |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [MeasurableSpace M] [BorelSpace M] [T3Space M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 26 | {J : Set ℝ} |
| 27 | |
| 28 | /-- The time derivative of intrinsic volume for any fixed relatively compact |
| 29 | measurable set is minus its scalar-curvature integral. -/ |
| 30 | theorem hasDerivAt_volumeMeasure_of_subset |
| 31 | (F : RicciFlow n M J) {t : ℝ} (ht : t ∈ interior J) |
| 32 | (hD : (F.connection t).CurvatureTensorCalculus) |
| 33 | {S K : Set M} (hS : MeasurableSet S) (hK : IsCompact K) (hSK : S ⊆ K) : |
| 34 | HasDerivAt (fun s => ((F.metric s).volumeMeasure S).toReal) |
| 35 | (-(∫ y in S, (F.connection t).scalarCurvature y |
| 36 | ∂(F.metric t).volumeMeasure)) t := by |
| 37 | classical |
| 38 | let : LocallyCompactSpace M := |
| 39 | ChartedSpace.locallyCompactSpace (EuclideanSpace ℝ (Fin n)) M |
| 40 | have hfinite (s : ℝ) {A : Set M} (hAK : A ⊆ K) : |
| 41 | (F.metric s).volumeMeasure A ≠ ⊤ := |
| 42 | (lt_of_le_of_lt (measure_mono hAK) |
| 43 | ((F.metric s).volumeMeasure_lt_top_of_isCompact hK)).ne |
| 44 | have hint : IntegrableOn (F.connection t).scalarCurvature K |
| 45 | (F.metric t).volumeMeasure := |
| 46 | hD.contMDiff_scalarCurvature.continuous.continuousOn.integrableOn_compact hK |
| 47 | let P : Set M → Prop := fun U => ∃ V : Set M, MeasurableSet V ∧ U ⊆ V ∧ |
| 48 | ∀ A : Set M, MeasurableSet A → A ⊆ V ∩ K → |
| 49 | HasDerivAt (fun s => ((F.metric s).volumeMeasure A).toReal) |
| 50 | (-(∫ y in A, (F.connection t).scalarCurvature y |
| 51 | ∂(F.metric t).volumeMeasure)) t |
| 52 | have hp : P K := by |
| 53 | apply hK.induction_on (p := P) |
| 54 | · refine ⟨∅, MeasurableSet.empty, Subset.rfl, ?_⟩ |
| 55 | intro A hA hAK |
| 56 | have hAe : A = ∅ := subset_empty_iff.mp (hAK.trans inter_subset_left) |
| 57 | simp only [hAe, measure_empty, ENNReal.toReal_zero, setIntegral_empty, neg_zero] |
| 58 | exact hasDerivAt_const t 0 |
| 59 | · rintro U V hUV ⟨W, hW, hVW, hd⟩ |
| 60 | exact ⟨W, hW, hUV.trans hVW, hd⟩ |
| 61 | · rintro U W ⟨V, hV, hUV, hdV⟩ ⟨Z, hZ, hWZ, hdZ⟩ |
| 62 | refine ⟨V ∪ Z, hV.union hZ, union_subset_union hUV hWZ, ?_⟩ |
| 63 | intro A hA hAK |
| 64 | have hAK' : A ⊆ K := hAK.trans inter_subset_right |
| 65 | have hd₁ := hdV (A ∩ V) (hA.inter hV) |
| 66 | (fun _ hx => ⟨hx.2, hAK' hx.1⟩) |
| 67 | have hd₂ := hdZ (A \ V) (hA.diff hV) |
| 68 | (fun _ hx => ⟨(hAK hx.1).1.resolve_left hx.2, hAK' hx.1⟩) |
| 69 | have hfun : (fun s => ((F.metric s).volumeMeasure A).toReal) = |
| 70 | (fun s => ((F.metric s).volumeMeasure (A ∩ V)).toReal + |
| 71 | ((F.metric s).volumeMeasure (A \ V)).toReal) := by |
| 72 | funext s |
| 73 | rw [← measure_inter_add_sdiff A hV, |
| 74 | ENNReal.toReal_add (hfinite s (inter_subset_left.trans hAK')) |
| 75 | (hfinite s (sdiff_subset.trans hAK'))] |
| 76 | rw [hfun] |
| 77 | apply (hd₁.add hd₂).congr_deriv |
| 78 | have heq := integral_inter_add_sdiff hV (hint.mono_set hAK') |
| 79 | linarith |
| 80 | · intro x hx |
| 81 | let e := (chartAt (EuclideanSpace ℝ (Fin n)) x).symm |
| 82 | obtain ⟨L, hL, hxL, hLe⟩ := |
| 83 | exists_compact_subset e.open_target (mem_chart_source _ x) |
| 84 | refine ⟨interior L, mem_nhdsWithin_of_mem_nhds |
| 85 | (isOpen_interior.mem_nhds hxL), interior L, isOpen_interior.measurableSet, |
| 86 | Subset.rfl, ?_⟩ |
| 87 | intro A hA hAL |
| 88 | have hAL' : A ⊆ L := (hAL.trans inter_subset_left).trans interior_subset |
| 89 | have hAe : A ⊆ e.target := hAL'.trans hLe |
| 90 | have hpre : MeasurableSet (e.symm '' A) := by |
| 91 | rw [e.symm_image_eq_source_inter_preimage hAe] |
| 92 | have hm := e.continuousOn.measurable_piecewise |
| 93 | (g := fun _ => x) continuousOn_const e.open_source.measurableSet |
| 94 | have h := e.open_source.measurableSet.inter (hA.preimage hm) |
| 95 | convert h using 1 |
| 96 | ext z |
| 97 | by_cases hz : z ∈ e.source <;> simp [hz] |
| 98 | have hLc : IsCompact (e.symm '' L) := |
| 99 | hL.image_of_continuousOn (e.symm.continuousOn.mono hLe) |
| 100 | have hLcE : e.symm '' L ⊆ e.source := image_subset_iff.mpr |
| 101 | (fun y hy => e.map_target (hLe hy)) |
| 102 | have hd := F.hasDerivAt_volumeMeasure_image_of_subset ht hD e |
| 103 | contMDiffOn_chart_symm contMDiffOn_chart hpre hLc (image_mono hAL') hLcE |
| 104 | have heA : e '' (e.symm '' A) = A := e.image_symm_image_of_subset_target hAe |
| 105 | rwa [heA] at hd |
| 106 | obtain ⟨V, hV, hKV, hd⟩ := hp |
| 107 | exact hd S hS (fun _ hx => ⟨hKV (hSK hx), hSK hx⟩) |
| 108 | |
| 109 | /-- Fixed compact sets satisfy the intrinsic volume evolution equation. -/ |
| 110 | theorem hasDerivAt_volumeMeasure |
| 111 | (F : RicciFlow n M J) {t : ℝ} (ht : t ∈ interior J) |
| 112 | (hD : (F.connection t).CurvatureTensorCalculus) |
| 113 | {K : Set M} (hK : IsCompact K) : |
| 114 | HasDerivAt (fun s => ((F.metric s).volumeMeasure K).toReal) |
| 115 | (-(∫ y in K, (F.connection t).scalarCurvature y |
| 116 | ∂(F.metric t).volumeMeasure)) t := |
| 117 | F.hasDerivAt_volumeMeasure_of_subset ht hD hK.measurableSet hK Subset.rfl |
| 118 | |
| 119 | end PoincareMT.RicciFlow |