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.Surgery.StandardCap.Uniqueness.TerminalBlowup.ScalarReciprocalGradient |
| 2 | import PoincareLib.Geometry.Riemannian.Measure.HausdorffDensity.LocalDistance |
| 3 | import Mathlib.Topology.Order.IntermediateValue |
| 4 | |
| 5 | /-! |
| 6 | # A scalar lower patch at a component maximum |
| 7 | |
| 8 | Up to the first scalar drop from H to 3H/4, the actual canonical gradient |
| 9 | bound and whole-component upper bound control variation along short paths. |
| 10 | The radius is chosen so that the variation is strictly less than H/8. |
| 11 | Source: Lemma 11.2, pp. 268-269, used in the induction on pp. 402-405. |
| 12 | See `proof-work/tasks/M47/derivations/component-estimate.md`, Stage D2. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set Manifold |
| 19 | open scoped Manifold ContDiff Bundle ENNReal NNReal Topology |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.M47 |
| 24 | |
| 25 | attribute [local instance] normedAddCommGroupTangentSpaceVectorSpace |
| 26 | normedSpaceTangentSpaceVectorSpace |
| 27 | |
| 28 | variable {M : Type u} [TopologicalSpace M] |
| 29 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 30 | |
| 31 | private theorem scalar_variation_le_path_length |
| 32 | (g : RiemannianMetric 3 M) (D : LeviCivitaData g) |
| 33 | (hreg : ContMDiff (𝓡 3) (𝓘(ℝ, ℝ)) ∞ D.scalarCurvature) |
| 34 | {a b K : ℝ} (hab : a ≤ b) (hK : 0 ≤ K) |
| 35 | {gamma : ℝ → M} (hgamma : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 3) 1 gamma (Icc a b)) |
| 36 | (hgrad : ∀ s ∈ Icc a b, ∀ v : TangentSpace (𝓡 3) (gamma s), |
| 37 | g.inner (gamma s) v v = 1 → |
| 38 | |mvfderiv (𝓡 3) D.scalarCurvature (gamma s) v| ≤ K) : |
| 39 | edist (D.scalarCurvature (gamma a)) (D.scalarCurvature (gamma b)) ≤ |
| 40 | ENNReal.ofReal K * g.pathELength gamma a b := by |
| 41 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 42 | ⟨g.toRiemannianMetric⟩ |
| 43 | let r : ℝ →ᴬ[ℝ] ℝ := ContinuousAffineMap.lineMap a b |
| 44 | have hrange : MapsTo r (Icc 0 1) (Icc a b) := by |
| 45 | rw [mapsTo_iff_image_subset, show (r : ℝ → ℝ) = AffineMap.lineMap a b from rfl, |
| 46 | ← segment_eq_image_lineMap, segment_eq_Icc hab] |
| 47 | have hcomp : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 3) 1 (gamma ∘ r) (Icc 0 1) := |
| 48 | hgamma.comp r.contDiff.contMDiff.contMDiffOn hrange |
| 49 | have hlength : g.pathELength (gamma ∘ r) 0 1 = g.pathELength gamma a b := by |
| 50 | change Manifold.pathELength (𝓡 3) (gamma ∘ r) 0 1 = |
| 51 | Manifold.pathELength (𝓡 3) gamma a b |
| 52 | have h := Manifold.pathELength_comp_of_monotoneOn (I := 𝓡 3) |
| 53 | (γ := gamma) (f := r) zero_le_one |
| 54 | ((AffineMap.lineMap_mono hab).monotoneOn (Icc 0 1)) r.differentiableOn |
| 55 | (by simpa [r, ContinuousAffineMap.coe_lineMap_eq] using |
| 56 | hgamma.mdifferentiableOn one_ne_zero) |
| 57 | simpa [r, ContinuousAffineMap.coe_lineMap_eq] using h |
| 58 | have hnorm (z : M) (hz : z ∈ gamma '' Icc a b) : |
| 59 | ‖mfderiv (𝓡 3) (𝓘(ℝ, ℝ)) D.scalarCurvature z‖ ≤ K := by |
| 60 | obtain ⟨s, hs, rfl⟩ := hz |
| 61 | apply ContinuousLinearMap.opNorm_le_bound _ hK |
| 62 | intro v |
| 63 | have h := D.scalar_directional_bound_of_unit_bound (gamma s) (hgrad s hs) v |
| 64 | have hv : g.tangentNorm (gamma s) v = ‖v‖ := by |
| 65 | rw [norm_eq_sqrt_real_inner] |
| 66 | rfl |
| 67 | have hn : ‖mfderiv (𝓡 3) (𝓘(ℝ, ℝ)) D.scalarCurvature (gamma s) v‖ = |
| 68 | |mvfderiv (𝓡 3) D.scalarCurvature (gamma s) v| := by |
| 69 | change ‖mvfderiv (𝓡 3) D.scalarCurvature (gamma s) v‖ = _ |
| 70 | exact Real.norm_eq_abs _ |
| 71 | rw [hn] |
| 72 | simpa only [hv] using h |
| 73 | let K' : ℝ≥0 := ⟨K, hK⟩ |
| 74 | have hKcoe : (K' : ℝ≥0∞) = ENNReal.ofReal K := ENNReal.coe_nnreal_eq K' |
| 75 | have hbound (z : M) (hz : z ∈ gamma '' Icc a b) : |
| 76 | ‖mfderiv (𝓡 3) (𝓘(ℝ, ℝ)) D.scalarCurvature z‖ₑ ≤ (K' : ℝ≥0∞) := by |
| 77 | rw [hKcoe, ← ofReal_norm] |
| 78 | exact ENNReal.ofReal_le_ofReal (hnorm z hz) |
| 79 | have h := Poincare.edist_le_mul_pathELength_of_mfderiv_le |
| 80 | (fun z (_hz : z ∈ gamma '' Icc a b) => (hreg z).of_le (by simp)) hbound hcomp |
| 81 | (fun s hs => ⟨r s, hrange hs, rfl⟩) |
| 82 | change edist (D.scalarCurvature (gamma (r 0))) (D.scalarCurvature (gamma (r 1))) ≤ |
| 83 | (K' : ℝ≥0∞) * g.pathELength (gamma ∘ r) 0 1 at h |
| 84 | rw [hlength, hKcoe] at h |
| 85 | simpa only [r, ContinuousAffineMap.coe_lineMap_eq, AffineMap.lineMap_apply_zero, |
| 86 | AffineMap.lineMap_apply_one] using h |
| 87 | |
| 88 | /-- At a positive whole-component scalar maximum, the gradient bound is |
| 89 | needed only in the band R>=3H/4. The actual metric ball has the scalar |
| 90 | floor required by local persistence; Lemma 11.2 and pp. 402-405. -/ |
| 91 | theorem component_maximum_scalar_patch |
| 92 | (g : RiemannianMetric 3 M) (D : LeviCivitaData g) |
| 93 | (hreg : ContMDiff (𝓡 3) (𝓘(ℝ, ℝ)) ∞ D.scalarCurvature) |
| 94 | {B H : ℝ} (hB : 0 < B) (hH : 0 < H) (x : M) |
| 95 | (hcenter : D.scalarCurvature x = H) |
| 96 | (hupper : ∀ z ∈ connectedComponent x, D.scalarCurvature z ≤ H) |
| 97 | (hgrad : ∀ z ∈ connectedComponent x, 3 * H / 4 ≤ D.scalarCurvature z → |
| 98 | ∀ v : TangentSpace (𝓡 3) z, g.inner z v v = 1 → |
| 99 | |mvfderiv (𝓡 3) D.scalarCurvature z v| ≤ |
| 100 | B * D.scalarCurvature z ^ (3 / 2 : ℝ)) : |
| 101 | ∀ y ∈ g.ball x ((Real.sqrt H)⁻¹ / (8 * B)), |
| 102 | 3 * H / 4 ≤ D.scalarCurvature y := by |
| 103 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 104 | ⟨g.toRiemannianMetric⟩ |
| 105 | intro y hy |
| 106 | by_contra hbad |
| 107 | have hlow : D.scalarCurvature y < 3 * H / 4 := lt_of_not_ge hbad |
| 108 | obtain ⟨gamma, hzero, hone, hgamma, hlength⟩ := |
| 109 | Manifold.exists_lt_of_riemannianEDist_lt hy |
| 110 | let f (s : ℝ) := D.scalarCurvature (gamma s) |
| 111 | have hfzero : f 0 = H := by simp only [f, hzero, hcenter] |
| 112 | have hcont : ContinuousOn f (Icc 0 1) := |
| 113 | hreg.continuous.comp_continuousOn hgamma.continuousOn |
| 114 | have hcomponent (s : ℝ) (hs : s ∈ Icc 0 1) : gamma s ∈ connectedComponent x := |
| 115 | (isPreconnected_Icc.image gamma hgamma.continuousOn).subset_connectedComponent |
| 116 | ⟨0, ⟨le_rfl, zero_le_one⟩, hzero⟩ ⟨s, hs, rfl⟩ |
| 117 | have hlowerClosed : IsClosed (Icc (0 : ℝ) 1 ∩ f ⁻¹' Iic (3 * H / 4)) := |
| 118 | hcont.preimage_isClosed_of_isClosed isClosed_Icc isClosed_Iic |
| 119 | obtain ⟨b, hb, hfirst⟩ := |
| 120 | (isCompact_Icc.of_isClosed_subset hlowerClosed inter_subset_left).exists_isLeast |
| 121 | ⟨1, ⟨⟨zero_le_one, le_rfl⟩, by |
| 122 | change f 1 ≤ 3 * H / 4 |
| 123 | simpa only [f, hone] using hlow.le⟩⟩ |
| 124 | have hbpos : 0 < b := by |
| 125 | apply lt_of_le_of_ne hb.1.1 |
| 126 | intro heq |
| 127 | have h : f b ≤ 3 * H / 4 := hb.2 |
| 128 | rw [← heq, hfzero] at h |
| 129 | linarith |
| 130 | have hbvalue : f b = 3 * H / 4 := by |
| 131 | obtain ⟨s, hs, hfs⟩ := intermediate_value_Icc' hbpos.le |
| 132 | (hcont.mono (Icc_subset_Icc le_rfl hb.1.2)) |
| 133 | ⟨hb.2, by rw [hfzero]; linarith⟩ |
| 134 | have hbs : b ≤ s := hfirst ⟨⟨hs.1, hs.2.trans hb.1.2⟩, hfs.le⟩ |
| 135 | simpa only [le_antisymm hbs hs.2] using hfs |
| 136 | have hband (s : ℝ) (hs : s ∈ Icc 0 b) : |
| 137 | 3 * H / 4 ≤ f s ∧ f s ≤ H := by |
| 138 | constructor |
| 139 | · by_cases hsb : s = b |
| 140 | · simp only [hsb, hbvalue, le_refl] |
| 141 | have hsb' : s < b := lt_of_le_of_ne hs.2 hsb |
| 142 | by_contra hlo |
| 143 | exact not_le_of_gt hsb' |
| 144 | (hfirst ⟨⟨hs.1, hs.2.trans hb.1.2⟩, (lt_of_not_ge hlo).le⟩) |
| 145 | · exact hupper (gamma s) (hcomponent s ⟨hs.1, hs.2.trans hb.1.2⟩) |
| 146 | have hdiff (s : ℝ) (hs : s ∈ Icc 0 b) |
| 147 | (v : TangentSpace (𝓡 3) (gamma s)) (hv : g.inner (gamma s) v v = 1) : |
| 148 | |mvfderiv (𝓡 3) D.scalarCurvature (gamma s) v| ≤ B * H ^ (3 / 2 : ℝ) := by |
| 149 | obtain ⟨hlo, hhi⟩ := hband s hs |
| 150 | have hfpos : 0 < f s := (by positivity : 0 < 3 * H / 4).trans_le hlo |
| 151 | exact (hgrad (gamma s) (hcomponent s ⟨hs.1, hs.2.trans hb.1.2⟩) hlo v hv).trans |
| 152 | (mul_le_mul_of_nonneg_left (Real.rpow_le_rpow hfpos.le hhi (by norm_num)) hB.le) |
| 153 | have hK : 0 < B * H ^ (3 / 2 : ℝ) := mul_pos hB (Real.rpow_pos_of_pos hH _) |
| 154 | have hdist := scalar_variation_le_path_length g D hreg hbpos.le hK.le |
| 155 | (hgamma.mono (Icc_subset_Icc le_rfl hb.1.2)) hdiff |
| 156 | change edist (f 0) (f b) ≤ _ at hdist |
| 157 | rw [hfzero, hbvalue] at hdist |
| 158 | have hmono : g.pathELength gamma 0 b ≤ g.pathELength gamma 0 1 := |
| 159 | Manifold.pathELength_mono le_rfl hb.1.2 |
| 160 | have hstrict := ENNReal.mul_lt_mul_right |
| 161 | (ne_of_gt (ENNReal.ofReal_pos.mpr hK)) ENNReal.ofReal_ne_top hlength |
| 162 | have heq : ENNReal.ofReal (B * H ^ (3 / 2 : ℝ)) * |
| 163 | ENNReal.ofReal ((Real.sqrt H)⁻¹ / (8 * B)) = ENNReal.ofReal (H / 8) := by |
| 164 | rw [← ENNReal.ofReal_mul hK.le] |
| 165 | congr 1 |
| 166 | rw [show (3 / 2 : ℝ) = 1 + (1 / 2 : ℝ) by norm_num, |
| 167 | Real.rpow_add hH, Real.rpow_one, ← Real.sqrt_eq_rpow] |
| 168 | field_simp [hB.ne', (Real.sqrt_pos.mpr hH).ne'] |
| 169 | have hsmall := (hdist.trans (mul_le_mul_right hmono _)).trans_lt (hstrict.trans_eq heq) |
| 170 | rw [edist_dist, Real.dist_eq, show H - 3 * H / 4 = H / 4 by ring, |
| 171 | abs_of_pos (by positivity : 0 < H / 4)] at hsmall |
| 172 | have hsmallReal := (ENNReal.ofReal_lt_ofReal_iff (by positivity : 0 < H / 8)).mp hsmall |
| 173 | linarith |
| 174 | |
| 175 | end PoincareMT.M47 |