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.Singular.RegularLimit.Spacetime.RegularBox |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.Metric.Distance.IntrinsicIsometry |
| 3 | |
| 4 | /-! |
| 5 | # Intrinsic distance inside an open regular region |
| 6 | |
| 7 | Open-submanifold inclusion preserves the full set of lengths of confined C1 |
| 8 | paths. Consequently intrinsic distance and diameter agree, including when |
| 9 | there are no admissible paths or the carrier itself is empty. |
| 10 | -/ |
| 11 | |
| 12 | noncomputable section |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set TopologicalSpace |
| 18 | open scoped Manifold ContDiff Bundle ENNReal |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.SingularRegularLimit |
| 23 | |
| 24 | variable {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 26 | |
| 27 | /-- The ambient length of an included C1 path is its induced length. -/ |
| 28 | theorem pathELength_subtypeVal (U : Opens M) (g : RiemannianMetric 3 M) |
| 29 | (gU : RiemannianMetric 3 U) |
| 30 | (hmetric : ∀ (x : U) (v w : TangentSpace (𝓡 3) x), |
| 31 | g.inner (x : M) (mfderiv (𝓡 3) (𝓡 3) (Subtype.val : U → M) x v) |
| 32 | (mfderiv (𝓡 3) (𝓡 3) (Subtype.val : U → M) x w) = gU.inner x v w) |
| 33 | {γ : ℝ → U} (hγ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 γ (Icc (0 : ℝ) 1)) : |
| 34 | g.pathELength (Subtype.val ∘ γ) 0 1 = gU.pathELength γ 0 1 := |
| 35 | MetricSurgery.pathELength_comp_eq_of_pullback gU g |
| 36 | (U := univ) (fun _ _ => contMDiff_subtype_val.contMDiffAt) |
| 37 | (fun x _ v w => hmetric x v w) hγ (subset_univ _) |
| 38 | |
| 39 | private theorem pathELength_eq_of_eqOn (g : RiemannianMetric 3 M) |
| 40 | {γ δ : ℝ → M} (h : EqOn γ δ (Icc (0 : ℝ) 1)) : |
| 41 | g.pathELength γ 0 1 = g.pathELength δ 0 1 := by |
| 42 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 43 | ⟨g.toRiemannianMetric⟩ |
| 44 | exact Manifold.pathELength_congr h |
| 45 | |
| 46 | /-- Equality of the actual confined C1 length sets gives intrinsic distance |
| 47 | equality without a nonemptiness or path-existence hypothesis. -/ |
| 48 | theorem intrinsicEDist_restrictToOpen (U : Opens M) (g : RiemannianMetric 3 M) |
| 49 | (gU : RiemannianMetric 3 U) |
| 50 | (hmetric : ∀ (x : U) (v w : TangentSpace (𝓡 3) x), |
| 51 | g.inner (x : M) (mfderiv (𝓡 3) (𝓡 3) (Subtype.val : U → M) x v) |
| 52 | (mfderiv (𝓡 3) (𝓡 3) (Subtype.val : U → M) x w) = gU.inner x v w) |
| 53 | (K : Set M) (hKU : K ⊆ U) (x y : U) : |
| 54 | intrinsicEDist gU ((Subtype.val : U → M) ⁻¹' K) x y = |
| 55 | intrinsicEDist g K (x : M) (y : M) := by |
| 56 | unfold intrinsicEDist |
| 57 | congr 1 |
| 58 | ext L |
| 59 | constructor |
| 60 | · rintro ⟨γ, hγ, h0, h1, hK, rfl⟩ |
| 61 | refine ⟨Subtype.val ∘ γ, |
| 62 | contMDiff_subtype_val.comp_contMDiffOn hγ, |
| 63 | by simp [h0], by simp [h1], ?_, ?_⟩ |
| 64 | · rintro _ ⟨t, ht, rfl⟩ |
| 65 | exact hK ⟨t, ht, rfl⟩ |
| 66 | · exact (pathELength_subtypeVal U g gU hmetric hγ).symm |
| 67 | · rintro ⟨γ, hγ, h0, h1, hK, rfl⟩ |
| 68 | let δ : ℝ → U := openRetraction U x ∘ γ |
| 69 | have hδval : EqOn (Subtype.val ∘ δ) γ (Icc (0 : ℝ) 1) := by |
| 70 | intro t ht |
| 71 | exact openRetraction_val U x (hKU (hK ⟨t, ht, rfl⟩)) |
| 72 | have hδ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 δ (Icc (0 : ℝ) 1) := by |
| 73 | apply MetricSurgery.path_contMDiffOn_comp_at (U := U) _ hγ |
| 74 | (fun z hz => hKU (hK hz)) |
| 75 | intro z hz |
| 76 | have hk : ContMDiffWithinAt (𝓡 3) (𝓡 3) ∞ (openRetraction U x) U z := by |
| 77 | rw [← ContMDiffWithinAt.subtypeVal_comp_iff U] |
| 78 | exact contMDiffWithinAt_id.congr_of_mem |
| 79 | (fun w hw => openRetraction_val U x hw) hz |
| 80 | exact hk.contMDiffAt (U.isOpen.mem_nhds hz) |
| 81 | refine ⟨δ, hδ, ?_, ?_, ?_, ?_⟩ |
| 82 | · apply Subtype.ext |
| 83 | exact (hδval (by norm_num)).trans h0 |
| 84 | · apply Subtype.ext |
| 85 | exact (hδval (by norm_num)).trans h1 |
| 86 | · rintro _ ⟨t, ht, rfl⟩ |
| 87 | change (Subtype.val ∘ δ) t ∈ K |
| 88 | rw [hδval ht] |
| 89 | exact hK ⟨t, ht, rfl⟩ |
| 90 | · exact (pathELength_eq_of_eqOn g hδval).symm.trans |
| 91 | (pathELength_subtypeVal U g gU hmetric hδ) |
| 92 | |
| 93 | /-- Intrinsic diameter is unchanged by restricting a whole carrier to an |
| 94 | open submanifold with the actual induced metric. -/ |
| 95 | theorem intrinsicDiameter_restrictToOpen (U : Opens M) (g : RiemannianMetric 3 M) |
| 96 | (gU : RiemannianMetric 3 U) |
| 97 | (hmetric : ∀ (x : U) (v w : TangentSpace (𝓡 3) x), |
| 98 | g.inner (x : M) (mfderiv (𝓡 3) (𝓡 3) (Subtype.val : U → M) x v) |
| 99 | (mfderiv (𝓡 3) (𝓡 3) (Subtype.val : U → M) x w) = gU.inner x v w) |
| 100 | (K : Set M) (hKU : K ⊆ U) : |
| 101 | intrinsicDiameter gU ((Subtype.val : U → M) ⁻¹' K) = intrinsicDiameter g K := by |
| 102 | unfold intrinsicDiameter |
| 103 | congr 1 |
| 104 | ext L |
| 105 | constructor |
| 106 | · rintro ⟨⟨x, y⟩, rfl⟩ |
| 107 | exact ⟨(⟨x.val.val, x.property⟩, ⟨y.val.val, y.property⟩), |
| 108 | (intrinsicEDist_restrictToOpen U g gU hmetric K hKU x.val y.val).symm⟩ |
| 109 | · rintro ⟨⟨x, y⟩, rfl⟩ |
| 110 | refine ⟨(⟨⟨x.val, hKU x.property⟩, x.property⟩, |
| 111 | ⟨⟨y.val, hKU y.property⟩, y.property⟩), ?_⟩ |
| 112 | exact intrinsicEDist_restrictToOpen U g gU hmetric K hKU |
| 113 | ⟨x.val, hKU x.property⟩ ⟨y.val, hKU y.property⟩ |
| 114 | |
| 115 | end PoincareMT.SingularRegularLimit |