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.Persistence.SourceNames.Metric |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.Induction.Schedules.StandardGeometry.CapNeckTopology |
| 3 | |
| 4 | /-! |
| 5 | # A smooth defining function for the compact cap core |
| 6 | |
| 7 | Morgan--Tian Definition 9.72(3) and Remark 9.73, pp. 230-231. The signed |
| 8 | axial inverse coordinate of the actual boundary neck defines the closed |
| 9 | core. Its differential is nonzero by the exact coordinate inverse rule. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | |
| 15 | open Set |
| 16 | open scoped Manifold ContDiff Topology |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | open PoincareMT.MetricSurgery |
| 21 | |
| 22 | namespace PoincareMT.M45 |
| 23 | |
| 24 | local notation "IC" => ModelWithCorners.prod (𝓡 2) 𝓘(ℝ, ℝ) |
| 25 | |
| 26 | variable {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 28 | {g : RiemannianMetric 3 M} |
| 29 | |
| 30 | /-- The axial inverse coordinate has a unit directional derivative on |
| 31 | the actual neck. Definition 2.18, p. 31, used in Definition 9.72(3). -/ |
| 32 | theorem neck_axial_derivative (N : EpsilonNeck g) {x : M} (hx : x ∈ N.carrier) : |
| 33 | ∃ d : TangentSpace (𝓡 3) x, |
| 34 | mvfderiv (𝓡 3) (fun y => (N.coordinate_inverse y).2) x d = 1 := by |
| 35 | let z := N.coordinate_inverse x |
| 36 | have hz := N.coordinate_inverse_mem x hx |
| 37 | have hk := (M36.neck_coordinate_contMDiffAt N hz).mdifferentiableAt (by simp) |
| 38 | have hf := (M36.neck_inverse_contMDiffAt N hx).snd.mdifferentiableAt (by simp) |
| 39 | have hright := M36.neck_coordinate_inverse N hx |
| 40 | have heq : (fun y => (N.coordinate_inverse y).2) ∘ N.coordinate_map =ᶠ[𝓝 z] |
| 41 | Prod.snd := by |
| 42 | filter_upwards [(isOpen_univ.prod isOpen_Ioo).mem_nhds hz] with w hw |
| 43 | exact congrArg Prod.snd (M36.neck_inverse_coordinate N w hw) |
| 44 | have hd : mvfderiv IC |
| 45 | ((fun y => (N.coordinate_inverse y).2) ∘ N.coordinate_map) z (0, 1) = 1 := by |
| 46 | change mfderiv IC 𝓘(ℝ, ℝ) _ z (0, 1) = 1 |
| 47 | rw [heq.mfderiv_eq, mfderiv_snd] |
| 48 | rfl |
| 49 | rw [mvfderiv_comp_apply_of_eq z hf hk hright] at hd |
| 50 | exact ⟨_, hd⟩ |
| 51 | |
| 52 | /-- A closed core occupying the negative half-neck is exactly the |
| 53 | nonpositive coordinate locus inside that neck. Definition 9.72(3), p. 230. -/ |
| 54 | theorem neck_core_iff_nonpos (N : EpsilonNeck g) {K : Set M} (hK : IsClosed K) |
| 55 | (hB : frontier K = N.central_sphere) |
| 56 | (hleft : N.region (-N.epsilon⁻¹) 0 ⊆ interior K) |
| 57 | (hright : N.region 0 N.epsilon⁻¹ ⊆ Kᶜ) {x : M} (hx : x ∈ N.carrier) : |
| 58 | x ∈ K ↔ (N.coordinate_inverse x).2 ≤ 0 := by |
| 59 | have hz := (N.coordinate_inverse_mem x hx).2 |
| 60 | constructor |
| 61 | · intro hxin |
| 62 | by_contra h |
| 63 | exact hright ⟨hx, lt_of_not_ge h, hz.2⟩ hxin |
| 64 | · intro h |
| 65 | rcases lt_or_eq_of_le h with h | h |
| 66 | · exact interior_subset (hleft ⟨hx, hz.1, h⟩) |
| 67 | · have hxB := (M36.neck_central_iff N).mpr ⟨hx, h⟩ |
| 68 | rw [← hB] at hxB |
| 69 | exact hK.closure_eq ▸ frontier_subset_closure hxB |
| 70 | |
| 71 | /-- The boundary-neck coordinate gives the literal smooth local defining |
| 72 | function, with a nonzero tangent derivative. Definition 9.72(3), p. 230, |
| 73 | and Remark 9.73, p. 231. -/ |
| 74 | theorem neck_boundary_defining_function [PreconnectedSpace M] |
| 75 | (N : EpsilonNeck g) {K C : Set M} (hK : IsClosed K) |
| 76 | (hinterior : (interior K).Nonempty) (hproper : K ≠ univ) |
| 77 | (hB : frontier K = N.central_sphere) (hNC : N.carrier ⊆ C) |
| 78 | {x : M} (hx : x ∈ frontier K) : |
| 79 | ∃ U : Set M, ∃ f : M → ℝ, IsOpen U ∧ x ∈ U ∧ U ⊆ C ∧ |
| 80 | (∀ y ∈ U, y ∈ K ↔ f y ≤ 0) ∧ f x = 0 ∧ |
| 81 | ContMDiffOn (𝓡 3) 𝓘(ℝ, ℝ) ∞ f U ∧ |
| 82 | ∃ d : TangentSpace (𝓡 3) x, d ≠ 0 ∧ mvfderiv (𝓡 3) f x d ≠ 0 := by |
| 83 | have hxN := N.central_sphere_subset (hB ▸ hx) |
| 84 | have hx0 := ((M36.neck_central_iff N).mp (hB ▸ hx)).2 |
| 85 | obtain ⟨d, hd⟩ := neck_axial_derivative N hxN |
| 86 | have hdne : d ≠ 0 := by intro h; simp only [h, map_zero, zero_ne_one] at hd |
| 87 | rcases neck_opposite_sides N hK hinterior hproper hB with hside | hside |
| 88 | · refine ⟨N.carrier, fun y => (N.coordinate_inverse y).2, N.carrier_open, |
| 89 | hxN, hNC, fun y hy => neck_core_iff_nonpos N hK hB hside.1 hside.2 hy, |
| 90 | hx0, (fun y hy => (N.coordinate_inverse_smooth y hy).snd), d, hdne, ?_⟩ |
| 91 | rw [hd] |
| 92 | norm_num |
| 93 | · refine ⟨N.carrier, fun y => -(N.coordinate_inverse y).2, N.carrier_open, |
| 94 | hxN, hNC, ?_, by simp only [hx0, neg_zero], |
| 95 | (fun y hy => (N.coordinate_inverse_smooth y hy).snd.neg), d, hdne, ?_⟩ |
| 96 | · intro y hy |
| 97 | have hz := (N.coordinate_inverse_mem y hy).2 |
| 98 | constructor |
| 99 | · intro hyK |
| 100 | by_contra h |
| 101 | have hneg : (N.coordinate_inverse y).2 < 0 := by linarith |
| 102 | exact hside.1 ⟨hy, hz.1, hneg⟩ hyK |
| 103 | · intro h |
| 104 | have hnonneg : 0 ≤ (N.coordinate_inverse y).2 := by linarith |
| 105 | rcases lt_or_eq_of_le hnonneg with hpos | hzero |
| 106 | · exact interior_subset (hside.2 ⟨hy, hpos, hz.2⟩) |
| 107 | · have hyB := (M36.neck_central_iff N).mpr ⟨hy, hzero.symm⟩ |
| 108 | rw [← hB] at hyB |
| 109 | exact hK.closure_eq ▸ frontier_subset_closure hyB |
| 110 | · change (mvfderiv (𝓡 3) (-(fun y => (N.coordinate_inverse y).2)) x) d ≠ 0 |
| 111 | rw [mvfderiv_neg] |
| 112 | simpa only [neg_apply, hd] using (by norm_num : -(1 : ℝ) ≠ 0) |
| 113 | |
| 114 | end PoincareMT.M45 |