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 Mathlib.Geometry.Manifold.LocalDiffeomorph |
| 2 | |
| 3 | /-! |
| 4 | # Smooth charts on their actual open source and target |
| 5 | |
| 6 | Partial smooth charts restrict to diffeomorphisms of open submanifolds, |
| 7 | and open inclusions are local diffeomorphisms. These operations keep the |
| 8 | physical buffer carrier in Morgan--Tian, Lemma 16.8, pp. 372-373. |
| 9 | See M44 derivation 37. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | |
| 15 | open Set TopologicalSpace |
| 16 | open scoped Manifold ContDiff |
| 17 | |
| 18 | namespace PoincareMT.M44 |
| 19 | |
| 20 | variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] |
| 21 | {E F : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] |
| 22 | [NormedAddCommGroup F] [NormedSpace 𝕜 F] |
| 23 | {H G : Type*} [TopologicalSpace H] [TopologicalSpace G] |
| 24 | {I : ModelWithCorners 𝕜 E H} {J : ModelWithCorners 𝕜 F G} |
| 25 | {M N : Type*} [TopologicalSpace M] [TopologicalSpace N] |
| 26 | [ChartedSpace H M] [ChartedSpace G N] |
| 27 | |
| 28 | /-- Restrict a partial chart to its literal open source and target. |
| 29 | Source: the physical collar restriction in Lemma 16.8, pp. 372-373; |
| 30 | M44 derivation 37. -/ |
| 31 | def sourceTargetDiffeomorph (e : PartialDiffeomorph I J M N ∞) : |
| 32 | Diffeomorph I J (⟨e.source, e.open_source⟩ : Opens M) |
| 33 | (⟨e.target, e.open_target⟩ : Opens N) ∞ where |
| 34 | toFun x := ⟨e x, e.map_source x.2⟩ |
| 35 | invFun y := ⟨e.invFun y, e.map_target y.2⟩ |
| 36 | left_inv x := Subtype.ext (e.left_inv x.2) |
| 37 | right_inv y := Subtype.ext (e.right_inv y.2) |
| 38 | contMDiff_toFun := by |
| 39 | apply (ContMDiff.subtypeVal_comp_iff (⟨e.target, e.open_target⟩ : Opens N) _).mp |
| 40 | intro x |
| 41 | exact contMDiffAt_subtype_iff.mpr |
| 42 | (e.contMDiffOn_toFun.contMDiffAt (e.open_source.mem_nhds x.2)) |
| 43 | contMDiff_invFun := by |
| 44 | apply (ContMDiff.subtypeVal_comp_iff (⟨e.source, e.open_source⟩ : Opens M) _).mp |
| 45 | intro y |
| 46 | exact contMDiffAt_subtype_iff.mpr |
| 47 | (e.contMDiffOn_invFun.contMDiffAt (e.open_target.mem_nhds y.2)) |
| 48 | |
| 49 | /-- Inclusion of an open submanifold is locally a diffeomorphism. |
| 50 | Source: the buffered-carrier argument in Lemma 16.8, pp. 372-373; |
| 51 | M44 derivation 37. -/ |
| 52 | theorem open_inclusion_isLocalDiffeomorph (U : Opens M) : |
| 53 | IsLocalDiffeomorph I I ∞ (Subtype.val : U → M) := by |
| 54 | intro x |
| 55 | let hne : Nonempty U := ⟨x⟩ |
| 56 | let e := U.openPartialHomeomorphSubtypeCoe hne |
| 57 | have hi : ContMDiffOn I I ∞ e.symm e.target := by |
| 58 | intro y hy |
| 59 | apply (ContMDiffWithinAt.subtypeVal_comp_iff U e.symm e.target y).mp |
| 60 | apply contMDiffWithinAt_id.congr |
| 61 | · intro z hz |
| 62 | exact e.right_inv hz |
| 63 | · exact e.right_inv hy |
| 64 | let d : PartialDiffeomorph I I U M ∞ := { |
| 65 | toPartialEquiv := e.toPartialEquiv |
| 66 | open_source := e.open_source |
| 67 | open_target := e.open_target |
| 68 | contMDiffOn_toFun := contMDiff_subtype_val.contMDiffOn |
| 69 | contMDiffOn_invFun := hi } |
| 70 | exact d.isLocalDiffeomorphAt I I ∞ (mem_univ x) |
| 71 | |
| 72 | /-- The original chart valued in its actual open target, extended by |
| 73 | a fixed target point outside its source. Source: Lemma 16.8, |
| 74 | pp. 372-373; M44 derivation 37. -/ |
| 75 | noncomputable def targetChart (e : PartialDiffeomorph I J M N ∞) |
| 76 | (p : (⟨e.target, e.open_target⟩ : Opens N)) : |
| 77 | M → (⟨e.target, e.open_target⟩ : Opens N) := by |
| 78 | classical |
| 79 | exact fun x => if hx : x ∈ e.source then ⟨e x, e.map_source hx⟩ else p |
| 80 | |
| 81 | /-- The target-valued chart agrees with the original map on its |
| 82 | literal source. Source: Lemma 16.8, pp. 372-373; M44 derivation 37. -/ |
| 83 | theorem targetChart_val (e : PartialDiffeomorph I J M N ∞) |
| 84 | (p : (⟨e.target, e.open_target⟩ : Opens N)) {x : M} (hx : x ∈ e.source) : |
| 85 | (targetChart e p x).1 = e x := by |
| 86 | simp only [targetChart, dif_pos hx] |
| 87 | |
| 88 | /-- The target-valued chart is smooth on the original source, with |
| 89 | the inherited open-submanifold structure. Source: Lemma 16.8, |
| 90 | pp. 372-373; M44 derivation 37. -/ |
| 91 | theorem contMDiffOn_targetChart (e : PartialDiffeomorph I J M N ∞) |
| 92 | (p : (⟨e.target, e.open_target⟩ : Opens N)) : |
| 93 | ContMDiffOn I J ∞ (targetChart e p) e.source := by |
| 94 | intro x hx |
| 95 | apply (ContMDiffWithinAt.subtypeVal_comp_iff |
| 96 | (⟨e.target, e.open_target⟩ : Opens N) _ _ _).mp |
| 97 | apply (e.contMDiffOn_toFun x hx).congr |
| 98 | · intro y hy |
| 99 | exact targetChart_val e p hy |
| 100 | · exact targetChart_val e p hx |
| 101 | |
| 102 | /-- The target-valued chart is a partial diffeomorphism onto the |
| 103 | whole physical buffer carrier. Source: Lemma 16.8, pp. 372-373; |
| 104 | M44 derivation 37. -/ |
| 105 | noncomputable def targetPartialDiffeomorph (e : PartialDiffeomorph I J M N ∞) |
| 106 | (p : (⟨e.target, e.open_target⟩ : Opens N)) : |
| 107 | PartialDiffeomorph I J M (⟨e.target, e.open_target⟩ : Opens N) ∞ where |
| 108 | toFun := targetChart e p |
| 109 | invFun y := e.invFun y.1 |
| 110 | source := e.source |
| 111 | target := univ |
| 112 | map_source' := fun _ _ => mem_univ _ |
| 113 | map_target' := fun y _ => e.map_target y.2 |
| 114 | left_inv' := fun x hx => by |
| 115 | rw [targetChart_val e p hx] |
| 116 | exact e.left_inv hx |
| 117 | right_inv' := fun y _ => by |
| 118 | apply Subtype.ext |
| 119 | exact (targetChart_val e p (e.map_target y.2)).trans (e.right_inv y.2) |
| 120 | open_source := e.open_source |
| 121 | open_target := isOpen_univ |
| 122 | contMDiffOn_toFun := contMDiffOn_targetChart e p |
| 123 | contMDiffOn_invFun := |
| 124 | (contMDiff_subtype_val.comp (sourceTargetDiffeomorph e).symm.contMDiff).contMDiffOn |
| 125 | |
| 126 | end PoincareMT.M44 |