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.ReducedGeometry.SourceNames.Realization |
| 2 | import PoincareLib.Geometry.Spacetime.Realization.Box.Spatial.Calculus |
| 3 | import Mathlib.Analysis.Calculus.Deriv.Add |
| 4 | import Mathlib.Analysis.Calculus.Deriv.Mul |
| 5 | |
| 6 | /-! |
| 7 | # Affine shifts inside an open spatial subset |
| 8 | |
| 9 | The local test variations in Morgan-Tian Lemma 6.4, pp. 107-108, |
| 10 | use ordinary affine shifts in a compatible spatial coordinate domain. |
| 11 | The total map below is smooth on its explicit admissible domain. |
| 12 | M11's open-subset inclusion derivative identifies its actual tangent. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | -- Open-subset tangent fibers use the ambient normed vector model. |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Filter |
| 20 | open scoped Manifold ContDiff Topology |
| 21 | |
| 22 | namespace TopologicalSpace.Opens |
| 23 | |
| 24 | variable {E : Type*} [NormedAddCommGroup E] (U : Opens E) |
| 25 | |
| 26 | /-- The affine shift when it lies in the open spatial domain, with an |
| 27 | arbitrary totalization elsewhere, as used in Lemma 6.4, pp. 107-108. -/ |
| 28 | noncomputable def affineShift (x : U) (v : E) : U := by |
| 29 | classical |
| 30 | exact if h : x.val + v ∈ U then ⟨x.val + v, h⟩ else x |
| 31 | |
| 32 | /-- On the admissible domain the shifted point has the prescribed |
| 33 | ambient value, the coordinate perturbation in Lemma 6.4, pp. 107-108. -/ |
| 34 | theorem affineShift_val {x : U} {v : E} (h : x.val + v ∈ U) : |
| 35 | (U.affineShift x v).val = x.val + v := by |
| 36 | simp only [affineShift, dif_pos h] |
| 37 | |
| 38 | /-- Zero shift fixes every spatial point, Lemma 6.4, pp. 107-108. -/ |
| 39 | theorem affineShift_zero (x : U) : U.affineShift x 0 = x := by |
| 40 | apply Subtype.ext |
| 41 | rw [U.affineShift_val (by rw [add_zero]; exact x.property), add_zero] |
| 42 | |
| 43 | /-- Admissibility of a spatial shift is an open condition, |
| 44 | the parameter-buffer step of Lemma 6.4, pp. 107-108. -/ |
| 45 | theorem affineShift_domain_isOpen : IsOpen {z : U × E | z.1.val + z.2 ∈ U} := |
| 46 | U.isOpen.preimage ((continuous_subtype_val.comp continuous_fst).add continuous_snd) |
| 47 | |
| 48 | variable [NormedSpace ℝ E] |
| 49 | |
| 50 | /-- The totalized shift is smooth on its admissible domain, |
| 51 | the local coordinate construction in Lemma 6.4, pp. 107-108. -/ |
| 52 | theorem affineShift_contMDiffOn : |
| 53 | ContMDiffOn ((𝓘(ℝ, E)).prod (𝓘(ℝ, E))) (𝓘(ℝ, E)) ∞ |
| 54 | (fun z : U × E => U.affineShift z.1 z.2) {z | z.1.val + z.2 ∈ U} := by |
| 55 | have hadd : ContMDiff ((𝓘(ℝ, E)).prod (𝓘(ℝ, E))) (𝓘(ℝ, E)) ∞ |
| 56 | (fun z : U × E => z.1.val + z.2) := |
| 57 | (contMDiff_subtype_val.comp contMDiff_fst).add contMDiff_snd |
| 58 | have hval : ContMDiffOn ((𝓘(ℝ, E)).prod (𝓘(ℝ, E))) (𝓘(ℝ, E)) ∞ |
| 59 | (Subtype.val ∘ fun z : U × E => U.affineShift z.1 z.2) |
| 60 | {z | z.1.val + z.2 ∈ U} := |
| 61 | hadd.contMDiffOn.congr (fun _ hz => U.affineShift_val hz) |
| 62 | intro z hz |
| 63 | exact (ContMDiffWithinAt.subtypeVal_comp_iff U _ _ z).mp (hval z hz) |
| 64 | |
| 65 | /-- An affine spatial perturbation is smooth near parameter zero, |
| 66 | where its actual spatial basepoint lies in the open domain, |
| 67 | Lemma 6.4, pp. 107-108. -/ |
| 68 | theorem affineShift_parameter_contMDiffAt (x : U) (v : E) : |
| 69 | ContMDiffAt (𝓘(ℝ, ℝ)) (𝓘(ℝ, E)) ∞ (fun r : ℝ => U.affineShift x (r • v)) 0 := by |
| 70 | have hmem : (x, (0 : ℝ) • v) ∈ {z : U × E | z.1.val + z.2 ∈ U} := by |
| 71 | change x.val + (0 : ℝ) • v ∈ U |
| 72 | simpa only [zero_smul, add_zero] using x.property |
| 73 | have hi : ContMDiff (𝓘(ℝ, ℝ)) ((𝓘(ℝ, E)).prod (𝓘(ℝ, E))) ∞ |
| 74 | (fun r : ℝ => (x, r • v)) := |
| 75 | contMDiff_const.prodMk (contDiff_id.smul contDiff_const).contMDiff |
| 76 | exact ((U.affineShift_contMDiffOn _ hmem).contMDiffAt |
| 77 | (U.affineShift_domain_isOpen.mem_nhds hmem)).comp 0 hi.contMDiffAt |
| 78 | |
| 79 | /-- The parameter tangent of an affine spatial shift is the chosen |
| 80 | vector, using M11's actual open-subset derivative, Lemma 6.4, pp. 107-108. -/ |
| 81 | theorem affineShift_parameter_mfderiv (x : U) (v : E) : |
| 82 | mfderiv (𝓘(ℝ, ℝ)) (𝓘(ℝ, E)) (fun r : ℝ => U.affineShift x (r • v)) 0 (1 : ℝ) = v := by |
| 83 | have hf := U.affineShift_parameter_contMDiffAt x v |
| 84 | have hc : ContMDiff (𝓘(ℝ, E)) (𝓘(ℝ, E)) ∞ (Subtype.val : U → E) := |
| 85 | contMDiff_subtype_val |
| 86 | have hd := ((hc.mdifferentiable (by simp) _).hasMFDerivAt.comp 0 |
| 87 | (hf.mdifferentiableAt (by simp)).hasMFDerivAt).hasFDerivAt.hasDerivAt |
| 88 | have hpoly : HasDerivAt (fun r : ℝ => x.val + r • v) v 0 := by |
| 89 | simpa only [id_eq, one_smul] using ((hasDerivAt_id (0 : ℝ)).smul_const v).const_add x.val |
| 90 | have hval : HasDerivAt (fun r : ℝ => (U.affineShift x (r • v)).val) v 0 := by |
| 91 | apply hpoly.congr_of_eventuallyEq |
| 92 | have hnear : {r : ℝ | x.val + r • v ∈ U} ∈ 𝓝 0 := |
| 93 | (U.isOpen.preimage (continuous_const.add (continuous_id.smul continuous_const))).mem_nhds |
| 94 | (by |
| 95 | change x.val + (0 : ℝ) • v ∈ U |
| 96 | simpa only [zero_smul, add_zero] using x.property) |
| 97 | filter_upwards [hnear] with r hr |
| 98 | exact U.affineShift_val hr |
| 99 | have h := hd.unique hval |
| 100 | rw [PoincareMT.Proofs.M11.mfderiv_openSubtype_val] at h |
| 101 | change mfderiv (𝓘(ℝ, ℝ)) (𝓘(ℝ, E)) (fun r : ℝ => U.affineShift x (r • v)) 0 |
| 102 | (1 : ℝ) = v at h |
| 103 | exact h |
| 104 | |
| 105 | end TopologicalSpace.Opens |