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.Imports |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Uniqueness.CapGeometry.CarrierTopology |
| 3 | |
| 4 | /-! |
| 5 | # Actual local defining functions for the transported cap boundary |
| 6 | |
| 7 | Morgan-Tian Definition 9.72 in Theorem 12.28, pp. 323-324. |
| 8 | The old defining function is composed with the actual spatial inverse. |
| 9 | Its nonzero differential survives by differentiating the inverse identity. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set Filter |
| 15 | open scoped Manifold ContDiff Bundle Topology |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.CapCertificate |
| 20 | |
| 21 | /-- Definition 9.72 in Theorem 12.28: the transported compact cap |
| 22 | core has an actual smooth local defining function with nonzero differential |
| 23 | at each transported boundary point. -/ |
| 24 | theorem transported_boundary_local_defining_function |
| 25 | {M N : Type u} [TopologicalSpace M] [TopologicalSpace N] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) N] |
| 28 | [IsManifold (𝓡 3) ∞ M] [IsManifold (𝓡 3) ∞ N] |
| 29 | [MeasurableSpace M] [BorelSpace M] [T3Space M] |
| 30 | {g : RiemannianMetric 3 M} (C : CapCertificate g) |
| 31 | (phi : PartialDiffeomorph (𝓡 3) (𝓡 3) M N ∞) |
| 32 | (hU : C.carrier ⊆ phi.source) : |
| 33 | ∀ p ∈ phi '' C.boundary_sphere, ∃ V : Set N, ∃ f : N → ℝ, |
| 34 | IsOpen V ∧ p ∈ V ∧ V ⊆ phi '' C.carrier ∧ |
| 35 | (∀ q ∈ V, q ∈ phi '' C.closed_core ↔ f q ≤ 0) ∧ f p = 0 ∧ |
| 36 | ContMDiffOn (𝓡 3) 𝓘(ℝ, ℝ) ∞ f V ∧ |
| 37 | ∃ d : TangentSpace (𝓡 3) p, d ≠ 0 ∧ mvfderiv (𝓡 3) f p d ≠ 0 := by |
| 38 | rintro _ ⟨x, hx, rfl⟩ |
| 39 | obtain ⟨V, f, hV, hxV, hVU, hcore, hfx, hf, d, hd, hdf⟩ := |
| 40 | C.boundary_local_defining_function x hx |
| 41 | have hVs : V ⊆ phi.source := hVU.trans hU |
| 42 | have hxsource := hVs hxV |
| 43 | have hleft : phi.invFun (phi x) = x := phi.left_inv hxsource |
| 44 | have himage : phi '' V ⊆ phi.target := by |
| 45 | rintro _ ⟨z, hz, rfl⟩ |
| 46 | exact phi.map_source (hVs hz) |
| 47 | have hinverse : MapsTo phi.invFun (phi '' V) V := by |
| 48 | rintro _ ⟨z, hz, rfl⟩ |
| 49 | have hzleft : phi.invFun (phi z) = z := phi.left_inv (hVs hz) |
| 50 | exact hzleft.symm ▸ hz |
| 51 | refine ⟨phi '' V, f ∘ phi.invFun, |
| 52 | phi.toOpenPartialHomeomorph.isOpen_image_of_subset_source hV hVs, |
| 53 | ⟨x, hxV, rfl⟩, image_mono hVU, ?_, ?_, |
| 54 | hf.comp (phi.contMDiffOn_invFun.mono himage) hinverse, ?_⟩ |
| 55 | · rintro _ ⟨z, hz, rfl⟩ |
| 56 | have hzleft : phi.invFun (phi z) = z := phi.left_inv (hVs hz) |
| 57 | change phi z ∈ phi '' C.closed_core ↔ f (phi.invFun (phi z)) ≤ 0 |
| 58 | rw [hzleft, ← hcore z hz] |
| 59 | constructor |
| 60 | · rintro ⟨w, hw, heq⟩ |
| 61 | have hwU : w ∈ C.carrier := by |
| 62 | rw [C.closed_core_eq_complement_end] at hw |
| 63 | exact hw.1 |
| 64 | exact phi.toPartialEquiv.injOn (hU hwU) (hVs hz) heq ▸ hw |
| 65 | · intro hzc |
| 66 | exact ⟨z, hzc, rfl⟩ |
| 67 | · change f (phi.invFun (phi x)) = 0 |
| 68 | rw [hleft, hfx] |
| 69 | · have hphi := phi.mdifferentiableAt (by simp) hxsource |
| 70 | have hinv : MDifferentiableAt (𝓡 3) (𝓡 3) phi.invFun (phi x) := |
| 71 | phi.symm.mdifferentiableAt (by simp) (phi.map_source hxsource) |
| 72 | have hidentity : (phi.invFun ∘ phi) =ᶠ[𝓝 x] id := |
| 73 | eventuallyEq_of_mem (phi.open_source.mem_nhds hxsource) |
| 74 | (fun z hz => phi.left_inv hz) |
| 75 | have hderiv : (mfderiv (𝓡 3) (𝓡 3) phi.invFun (phi x)) |
| 76 | ((mfderiv (𝓡 3) (𝓡 3) phi x) d) = d := by |
| 77 | have h : mfderiv (𝓡 3) (𝓡 3) (phi.invFun ∘ phi) x = |
| 78 | mfderiv (𝓡 3) (𝓡 3) (id : M → M) x := hidentity.mfderiv_eq |
| 79 | rw [mfderiv_comp x hinv hphi, mfderiv_id] at h |
| 80 | exact congrArg (fun A : EuclideanSpace ℝ (Fin 3) →L[ℝ] |
| 81 | EuclideanSpace ℝ (Fin 3) => A d) h |
| 82 | refine ⟨mfderiv (𝓡 3) (𝓡 3) phi x d, ?_, ?_⟩ |
| 83 | · intro hzero |
| 84 | rw [hzero, map_zero] at hderiv |
| 85 | exact hd hderiv.symm |
| 86 | · have hfAt : MDifferentiableAt (𝓡 3) 𝓘(ℝ, ℝ) f (phi.invFun (phi x)) := by |
| 87 | rw [hleft] |
| 88 | exact (hf.contMDiffAt (hV.mem_nhds hxV)).mdifferentiableAt (by simp) |
| 89 | rw [mvfderiv_comp_apply (phi x) hfAt hinv, hderiv, hleft] |
| 90 | exact hdf |
| 91 | |
| 92 | end PoincareMT.CapCertificate |