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 | /- Adapted from Mapher `PoincareMT/Proofs/M03/MetricDifferenceEnergy.lean` at |
| 2 | f927d9e1f0810042766d3b5f64d3f4da02ee93cc. See |
| 3 | `references/ricci-flow/mapher/local-theory/port.json`. -/ |
| 4 | |
| 5 | import PoincareLib.Geometry.RicciFlow.Basic |
| 6 | import PoincareLib.Geometry.RicciFlow.Local.Energy.Coordinates.FiniteBundleFamilyEnergy |
| 7 | import PoincareLib.Geometry.RicciFlow.Local.Energy.Localization.FiniteCoordinateCutoffs |
| 8 | import PoincareLib.Geometry.RicciFlow.Local.Energy.Coordinates.ModelFiberEnergyCoordinates |
| 9 | |
| 10 | /-! |
| 11 | # Energy of the actual metric difference |
| 12 | |
| 13 | A fixed finite coordinate cover gives an energy detecting equality of two |
| 14 | flow metrics. The construction includes common endpoints; its time derivative |
| 15 | is asserted on the interior of the compact comparison set. |
| 16 | Derivation: proof-work/tasks/M03/reviews/metric-difference-energy-derivation.md. |
| 17 | -/ |
| 18 | |
| 19 | set_option autoImplicit false |
| 20 | set_option maxHeartbeats 1800000 |
| 21 | set_option synthInstance.maxHeartbeats 200000 |
| 22 | |
| 23 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 24 | open Bundle MeasureTheory Set |
| 25 | |
| 26 | universe u |
| 27 | |
| 28 | namespace PoincareMT.RicciFlow.Local |
| 29 | |
| 30 | theorem exists_metric_difference_energy |
| 31 | {n : ℕ} {M : Type u} [TopologicalSpace M] [T2Space M] |
| 32 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 33 | [CompactSpace M] : |
| 34 | let FM := EuclideanSpace ℝ (Fin n) →L[ℝ] |
| 35 | EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ |
| 36 | let EM := fun x : M => TangentSpace (𝓡 n) x →L[ℝ] |
| 37 | TangentSpace (𝓡 n) x →L[ℝ] ℝ |
| 38 | let d := Module.finrank ℝ FM |
| 39 | letI : MeasurableSpace (EuclideanSpace ℝ (Fin n)) := borel _ |
| 40 | letI : BorelSpace (EuclideanSpace ℝ (Fin n)) := ⟨rfl⟩ |
| 41 | ∃ (q : FM ≃L[ℝ] EuclideanSpace ℝ (Fin d)) |
| 42 | (s : Finset M) (φ : M → EuclideanSpace ℝ (Fin n) → ℝ) (C : ℝ), |
| 43 | 0 ≤ C ∧ |
| 44 | (∀ a ∈ s, ContDiff ℝ ∞ (φ a) ∧ HasCompactSupport (φ a) ∧ |
| 45 | tsupport (φ a) ⊆ (chartAt (EuclideanSpace ℝ (Fin n)) a).target) ∧ |
| 46 | (∀ x : M, ∃ a ∈ s, |
| 47 | x ∈ (chartAt (EuclideanSpace ℝ (Fin n)) a).source ∧ |
| 48 | φ a (chartAt (EuclideanSpace ℝ (Fin n)) a x) = 1) ∧ |
| 49 | ∀ (J J' : Set ℝ) (F : RicciFlow n M J) (F' : RicciFlow n M J') |
| 50 | (K : Set ℝ), IsCompact K → K ⊆ J ∩ J' → |
| 51 | let c := chartAt (EuclideanSpace ℝ (Fin n)) |
| 52 | let e := trivializationAt FM EM |
| 53 | let h : (t : ℝ) → (x : M) → EM x := |
| 54 | fun t x => (F.metric t).inner x - (F'.metric t).inner x |
| 55 | let f : M → Fin d → ℝ × EuclideanSpace ℝ (Fin n) → ℝ := |
| 56 | fun a i p => q ((e a) (TotalSpace.mk' FM |
| 57 | ((c a).symm p.2) (h p.1 ((c a).symm p.2)))).2 i |
| 58 | let energy : ℝ → ℝ := |
| 59 | fun t => ∑ a ∈ s, ∑ i, ∫ z, (φ a z * f a i (t, z)) ^ 2 |
| 60 | ContinuousOn energy K ∧ |
| 61 | (∀ t ∈ K, 0 ≤ energy t) ∧ |
| 62 | (∀ t ∈ K, energy t = 0 ↔ F.metric t = F'.metric t) ∧ |
| 63 | (∀ t ∈ interior K, HasDerivAt energy |
| 64 | (∑ a ∈ s, ∑ i, ∫ z, 2 * φ a z ^ 2 * f a i (t, z) * |
| 65 | fderiv ℝ (f a i) (t, z) (1, 0)) t) ∧ |
| 66 | (∀ t ∈ K, ∀ a ∈ s, |
| 67 | (∫ z in tsupport (φ a), ∑ i, (f a i (t, z)) ^ 2) ≤ C * energy t) := by |
| 68 | let FM := EuclideanSpace ℝ (Fin n) →L[ℝ] |
| 69 | EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ |
| 70 | let EM := fun x : M => TangentSpace (𝓡 n) x →L[ℝ] |
| 71 | TangentSpace (𝓡 n) x →L[ℝ] ℝ |
| 72 | let : NormedAddCommGroup FM := inferInstance |
| 73 | let : NormedSpace ℝ FM := inferInstance |
| 74 | let : ∀ x, AddCommGroup (EM x) := inferInstance |
| 75 | let : ∀ x, Module ℝ (EM x) := inferInstance |
| 76 | let : MeasurableSpace (EuclideanSpace ℝ (Fin n)) := borel _ |
| 77 | let : BorelSpace (EuclideanSpace ℝ (Fin n)) := ⟨rfl⟩ |
| 78 | classical |
| 79 | obtain ⟨q, _, _, _⟩ := exists_model_fiber_energy_coordinates (F := FM) |
| 80 | obtain ⟨s, r, R, φ, hcut, hcover⟩ := exists_finite_coordinate_cutoffs (n := n) (M := M) |
| 81 | have hφ : ∀ a ∈ s, ContDiff ℝ ∞ (φ a) ∧ HasCompactSupport (φ a) ∧ |
| 82 | tsupport (φ a) ⊆ (chartAt (EuclideanSpace ℝ (Fin n)) a).target := by |
| 83 | intro a ha |
| 84 | obtain ⟨_, _, htarget, hsmooth, hcompact, _, _, hsupp, _, _⟩ := hcut a ha |
| 85 | exact ⟨hsmooth, hcompact, hsupp.trans htarget⟩ |
| 86 | have hcover' : ∀ x : M, ∃ a ∈ s, |
| 87 | x ∈ (chartAt (EuclideanSpace ℝ (Fin n)) a).source ∧ |
| 88 | φ a (chartAt (EuclideanSpace ℝ (Fin n)) a x) = 1 := by |
| 89 | intro x |
| 90 | obtain ⟨a, ha, hx, hz⟩ := hcover x |
| 91 | obtain ⟨_, _, _, _, _, _, hone, _, _, _⟩ := hcut a ha |
| 92 | exact ⟨a, ha, hx, hone (Metric.ball_subset_closedBall hz)⟩ |
| 93 | have hbase : ∀ a ∈ s, (chartAt (EuclideanSpace ℝ (Fin n)) a).source ⊆ |
| 94 | (trivializationAt FM EM a).baseSet := by |
| 95 | intro a _ |
| 96 | simp only [FM, EM, hom_trivializationAt_baseSet, |
| 97 | TangentBundle.trivializationAt_baseSet] |
| 98 | intro x hx |
| 99 | exact ⟨hx, hx, mem_univ x⟩ |
| 100 | obtain ⟨C, hC0, hC⟩ := exists_finite_bundle_family_energy_bound (E := EM) q s φ |
| 101 | (fun a ha => (hφ a ha).1.continuous) (fun a ha => (hφ a ha).2.1) |
| 102 | (fun a ha => (hφ a ha).2.2) hbase hcover' |
| 103 | refine ⟨q, s, φ, C, hC0, hφ, hcover', ?_⟩ |
| 104 | intro J J' F F' K hK hKsub |
| 105 | let h : (t : ℝ) → (x : M) → EM x := |
| 106 | fun t x => (F.metric t).inner x - (F'.metric t).inner x |
| 107 | have hF : RiemannianMetric.IsSmoothFamilyOn F.metric K := |
| 108 | F.smooth.mono (Set.prod_mono (fun _ ht => (hKsub ht).1) subset_rfl) |
| 109 | have hF' : RiemannianMetric.IsSmoothFamilyOn F'.metric K := |
| 110 | F'.smooth.mono (Set.prod_mono (fun _ ht => (hKsub ht).2) subset_rfl) |
| 111 | have hh : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) ((𝓡 n).prod 𝓘(ℝ, FM)) ∞ |
| 112 | (fun p : ℝ × M => TotalSpace.mk' FM p.2 (h p.1 p.2)) (K ×ˢ Set.univ) := by |
| 113 | intro p hp |
| 114 | apply Bundle.contMDiffWithinAt_totalSpace.mpr |
| 115 | refine ⟨contMDiffWithinAt_snd, ?_⟩ |
| 116 | have hc := (Bundle.contMDiffWithinAt_totalSpace.mp (hF p hp)).2 |
| 117 | have hc' := (Bundle.contMDiffWithinAt_totalSpace.mp (hF' p hp)).2 |
| 118 | let e := trivializationAt FM EM p.2 |
| 119 | have he : p.2 ∈ e.baseSet := FiberBundle.mem_baseSet_trivializationAt' p.2 |
| 120 | have hnear : ∀ᶠ z in 𝓝[K ×ˢ (Set.univ : Set M)] p, z.2 ∈ e.baseSet := |
| 121 | Filter.Eventually.filter_mono nhdsWithin_le_nhds |
| 122 | (continuous_snd.continuousAt.preimage_mem_nhds (e.open_baseSet.mem_nhds he)) |
| 123 | apply (hc.sub hc').congr_of_eventuallyEq_of_mem _ hp |
| 124 | filter_upwards [hnear] with z hz |
| 125 | exact (e.linearEquivAt ℝ z.2 hz).map_sub |
| 126 | ((F.metric z.1).inner z.2) ((F'.metric z.1).inner z.2) |
| 127 | obtain ⟨hcont, hnonneg, hzero, hderiv, hbound⟩ := hC K hK h hh |
| 128 | refine ⟨hcont, hnonneg, ?_, hderiv, hbound⟩ |
| 129 | intro t ht |
| 130 | refine (hzero t ht).trans ?_ |
| 131 | constructor |
| 132 | · intro hzero' |
| 133 | have hinner : (F.metric t).inner = (F'.metric t).inner := by |
| 134 | funext x |
| 135 | exact sub_eq_zero.mp (hzero' x) |
| 136 | have hext (g g' : RiemannianMetric n M) (heq : g.inner = g'.inner) : g = g' := by |
| 137 | cases g |
| 138 | cases g' |
| 139 | cases heq |
| 140 | rfl |
| 141 | exact hext _ _ hinner |
| 142 | · intro heq x |
| 143 | exact sub_eq_zero.mpr (congrArg (fun g : RiemannianMetric n M => g.inner x) heq) |
| 144 | |
| 145 | end PoincareMT.RicciFlow.Local |