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.Generalized.BoundedDistance.GeometryImports |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.NeckGeometry.NeckFrontierDistance |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.NeckGeometry.NeckSpherePaths |
| 4 | import PoincareLib.Geometry.RicciFlow.CanonicalNeighborhood.Neck.Separation.Diameter |
| 5 | |
| 6 | /-! |
| 7 | # Actual balanced distances at source-neck frontiers |
| 8 | |
| 9 | The upper estimate joins a central-sphere path to an axial path and then |
| 10 | passes to closure. The lower estimate uses the compact inner collar's |
| 11 | actual first-exit cost. Neither estimate assumes completeness or a proposed |
| 12 | balanced pair. Morgan--Tian Appendix A.17, pp. 506-507, and Claim 10.4. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set |
| 18 | open scoped Manifold ContDiff Bundle Topology ENNReal |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.M28 |
| 23 | |
| 24 | variable {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 26 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 27 | [T2Space M] [T3Space M] {g : RiemannianMetric 3 M} |
| 28 | |
| 29 | private theorem neck_center_edist_upper (N : EpsilonNeck g) {x : M} |
| 30 | (hx : x ∈ N.carrier) : |
| 31 | g.edist N.center x ≤ ENNReal.ofReal |
| 32 | ((Real.sqrt (1 + N.epsilon) * N.epsilon⁻¹ + |
| 33 | 4 * standardSpherePathCeiling) * N.scale) := by |
| 34 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 35 | ⟨g.toRiemannianMetric⟩ |
| 36 | let z := N.coordinate_inverse x |
| 37 | have hz : z.2 ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹ := |
| 38 | (N.coordinate_inverse_mem x hx).2 |
| 39 | have hzero : (0 : ℝ) ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹ := |
| 40 | ⟨neg_neg_of_pos (inv_pos.mpr N.epsilon_pos), inv_pos.mpr N.epsilon_pos⟩ |
| 41 | have hcentral : N.coordinate_map (z.1, 0) ∈ N.central_sphere := by |
| 42 | rw [N.central_sphere_eq] |
| 43 | exact ⟨(z.1, 0), ⟨mem_univ _, rfl⟩, rfl⟩ |
| 44 | obtain ⟨γ, h0, h1, hγ, _, hlength, _, _⟩ := |
| 45 | exists_central_sphere_shortcut N N.center_on_central_sphere hcentral |
| 46 | have hsphere := (Manifold.riemannianEDist_le_pathELength hγ.contMDiffOn |
| 47 | h0 h1 zero_le_one).trans hlength.le |
| 48 | have haxis := N.edist_coordinate_map_axis_le z.1 hzero hz |
| 49 | have hcoord : N.coordinate_map (z.1, z.2) = x := |
| 50 | N.coordinate_map_coordinate_inverse hx |
| 51 | rw [hcoord, sub_zero] at haxis |
| 52 | have hheight : |z.2| ≤ N.epsilon⁻¹ := (abs_lt.mpr hz).le |
| 53 | have haxis' : g.edist (N.coordinate_map (z.1, 0)) x ≤ |
| 54 | ENNReal.ofReal (N.scale * Real.sqrt (1 + N.epsilon) * N.epsilon⁻¹) := |
| 55 | haxis.trans (ENNReal.ofReal_le_ofReal (mul_le_mul_of_nonneg_left hheight |
| 56 | (mul_nonneg N.scale_pos.le (Real.sqrt_nonneg _)))) |
| 57 | have hsum := (Manifold.riemannianEDist_triangle |
| 58 | (x := N.center) (y := N.coordinate_map (z.1, 0)) (z := x)).trans |
| 59 | (add_le_add hsphere haxis') |
| 60 | have heq : ENNReal.ofReal ((4 * standardSpherePathCeiling) * N.scale) + |
| 61 | ENNReal.ofReal (N.scale * Real.sqrt (1 + N.epsilon) * N.epsilon⁻¹) = |
| 62 | ENNReal.ofReal ((Real.sqrt (1 + N.epsilon) * N.epsilon⁻¹ + |
| 63 | 4 * standardSpherePathCeiling) * N.scale) := by |
| 64 | rw [← ENNReal.ofReal_add |
| 65 | (mul_nonneg (mul_nonneg (by norm_num) standardSpherePathCeiling_pos.le) |
| 66 | N.scale_pos.le) |
| 67 | (mul_nonneg (mul_nonneg N.scale_pos.le (Real.sqrt_nonneg _)) |
| 68 | (inv_nonneg.mpr N.epsilon_pos.le))] |
| 69 | congr 1 |
| 70 | ring |
| 71 | exact hsum.trans_eq heq |
| 72 | |
| 73 | private theorem neck_center_edist_upper_closure (N : EpsilonNeck g) {x : M} |
| 74 | (hx : x ∈ closure N.carrier) : |
| 75 | g.edist N.center x ≤ ENNReal.ofReal |
| 76 | ((Real.sqrt (1 + N.epsilon) * N.epsilon⁻¹ + |
| 77 | 4 * standardSpherePathCeiling) * N.scale) := by |
| 78 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 79 | ⟨g.toRiemannianMetric⟩ |
| 80 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin 3)) |
| 81 | (TangentSpace (𝓡 3) : M → Type _) := |
| 82 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ => rfl⟩⟩ |
| 83 | let : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 3) M |
| 84 | have hclosed : IsClosed {y : M | g.edist N.center y ≤ ENNReal.ofReal |
| 85 | ((Real.sqrt (1 + N.epsilon) * N.epsilon⁻¹ + |
| 86 | 4 * standardSpherePathCeiling) * N.scale)} := |
| 87 | isClosed_le (continuous_const.edist continuous_id) continuous_const |
| 88 | exact (closure_minimal (fun _ hy => neck_center_edist_upper N hy) hclosed) hx |
| 89 | |
| 90 | /-- Every actual frontier point has the balanced center-distance bounds. |
| 91 | The fixed accuracy is chosen before the neck, ambient metric and point. -/ |
| 92 | theorem exists_neck_frontier_distance_accuracy : |
| 93 | ∃ epsilon₀ : ℝ, 0 < epsilon₀ ∧ epsilon₀ ≤ (1 / 200 : ℝ) ∧ |
| 94 | ∀ (M : Type u) [TopologicalSpace M] |
| 95 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 96 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 97 | [T2Space M] [T3Space M] |
| 98 | (g : RiemannianMetric 3 M) (N : EpsilonNeck g), |
| 99 | N.epsilon ≤ epsilon₀ → ∀ x ∈ frontier N.carrier, |
| 100 | ENNReal.ofReal ((0.99 : ℝ) * N.scale * N.epsilon⁻¹) ≤ |
| 101 | g.edist N.center x ∧ |
| 102 | g.edist N.center x ≤ |
| 103 | ENNReal.ofReal ((1.01 : ℝ) * N.scale * N.epsilon⁻¹) := by |
| 104 | have hLs := standardSpherePathCeiling_pos |
| 105 | refine ⟨min (1 / 1000) (1 / (4000 * standardSpherePathCeiling + 1)), |
| 106 | lt_min (by norm_num) (by positivity), (min_le_left _ _).trans (by norm_num), ?_⟩ |
| 107 | intro M _ _ _ _ _ _ _ g N hsmall x hx |
| 108 | have hepsilon : N.epsilon ≤ 1 / 1000 := hsmall.trans (min_le_left _ _) |
| 109 | have hA : 0 < N.epsilon⁻¹ := inv_pos.mpr N.epsilon_pos |
| 110 | have hrootLower : (999 / 1000 : ℝ) ≤ Real.sqrt (1 - N.epsilon) := by |
| 111 | have hsq := Real.sq_sqrt (show 0 ≤ 1 - N.epsilon by linarith) |
| 112 | nlinarith [Real.sqrt_nonneg (1 - N.epsilon)] |
| 113 | have hrootUpper : Real.sqrt (1 + N.epsilon) ≤ (1001 / 1000 : ℝ) := by |
| 114 | have hsq := Real.sq_sqrt (show 0 ≤ 1 + N.epsilon by linarith [N.epsilon_pos]) |
| 115 | nlinarith [Real.sqrt_nonneg (1 + N.epsilon)] |
| 116 | have hout : x ∉ N.carrier := (N.carrier_open.frontier_eq ▸ hx).2 |
| 117 | have hlower := N.edist_central_lower_of_not_mem_region |
| 118 | (r := (999 / 1000 : ℝ) * N.epsilon⁻¹) (by positivity) (by linarith) |
| 119 | N.center_on_central_sphere (fun h => hout h.1) |
| 120 | have hcoef : (0.99 : ℝ) ≤ Real.sqrt (1 - N.epsilon) * (999 / 1000) := by |
| 121 | nlinarith only [hrootLower] |
| 122 | have hlowBudget : (0.99 : ℝ) * N.scale * N.epsilon⁻¹ ≤ |
| 123 | (N.scale * Real.sqrt (1 - N.epsilon)) * ((999 / 1000) * N.epsilon⁻¹) := by |
| 124 | have h := mul_le_mul_of_nonneg_right |
| 125 | (mul_le_mul_of_nonneg_left hcoef N.scale_pos.le) hA.le |
| 126 | nlinarith only [h] |
| 127 | have hrecip : 4000 * standardSpherePathCeiling + 1 ≤ N.epsilon⁻¹ := by |
| 128 | have h := one_div_le_one_div_of_le N.epsilon_pos |
| 129 | (hsmall.trans (min_le_right _ _)) |
| 130 | simpa only [one_div, inv_inv] using h |
| 131 | have hcoefUpper : Real.sqrt (1 + N.epsilon) * N.epsilon⁻¹ + |
| 132 | 4 * standardSpherePathCeiling ≤ (1.01 : ℝ) * N.epsilon⁻¹ := by |
| 133 | have h := mul_le_mul_of_nonneg_right hrootUpper hA.le |
| 134 | linarith |
| 135 | have hupperBudget := mul_le_mul_of_nonneg_right hcoefUpper N.scale_pos.le |
| 136 | refine ⟨(ENNReal.ofReal_le_ofReal hlowBudget).trans hlower, ?_⟩ |
| 137 | apply (neck_center_edist_upper_closure N (frontier_subset_closure hx)).trans |
| 138 | apply ENNReal.ofReal_le_ofReal |
| 139 | nlinarith only [hupperBudget] |
| 140 | |
| 141 | end PoincareMT.M28 |