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.Comparison.Map |
| 2 | /-! |
| 3 | # The retained comparison map and its fibers |
| 4 | |
| 5 | Morgan-Tian Proposition 15.12, p. 365, and the degree argument on pp. 430-431. |
| 6 | Every retained image avoids the closed caps and has a unique preimage. |
| 7 | The derivation is recorded in `proof-work/tasks/SurgeryComparison.Transport/derivations/retained-fibers.md`. |
| 8 | -/ |
| 9 | |
| 10 | set_option autoImplicit false |
| 11 | |
| 12 | open Set |
| 13 | open scoped Manifold ContDiff Bundle ENNReal Topology |
| 14 | |
| 15 | universe u |
| 16 | |
| 17 | namespace PoincareMT.SurgeryComparison.Transport |
| 18 | |
| 19 | variable {g₀ : StandardInitialMetric} {D : RepairedSurgeryFlowData.{u} g₀} |
| 20 | {T : ℝ} {hT : T ∈ D.flow.surgery_times} |
| 21 | [Nonempty (D.flow.slice T).carrier] |
| 22 | {I : RepairedComparisonMapInput D T hT} |
| 23 | (Q : RepairedComparisonMapConclusion I) |
| 24 | |
| 25 | local notation "E" => D.flow.event T hT |
| 26 | |
| 27 | /-- Retained agreement makes the comparison injective on the inherited |
| 28 | region, as used in the local degree argument on Morgan-Tian pp. 430-431. -/ |
| 29 | theorem retained_injOn : Set.InjOn Q.map I.retained := by |
| 30 | intro x hx y hy hxy |
| 31 | apply I.parent.inclusion_openEmbedding.injective |
| 32 | apply (E).retention.left_inverse.injOn |
| 33 | (interior_subset (I.retained_subset x hx)) |
| 34 | (interior_subset (I.retained_subset y hy)) |
| 35 | rw [← Q.retained_agreement x hx, ← Q.retained_agreement y hy, hxy] |
| 36 | |
| 37 | /-- Interior retained points avoid every actual closed cap. This is the |
| 38 | unique-fiber step of the degree argument on Morgan-Tian pp. 430-431. -/ |
| 39 | theorem retained_image_not_mem_cap {x : I.parent.carrier.carrier} |
| 40 | (hx : x ∈ I.retained) (i : Fin (E).cap_count) : |
| 41 | I.child.inclusion (Q.map x) ∉ ((E).caps i).carrier := by |
| 42 | intro hcap |
| 43 | have hxpre := I.retained_subset x hx |
| 44 | have hpost : I.child.inclusion (Q.map x) ∈ (E).retained_post := by |
| 45 | rw [Q.retained_agreement x hx] |
| 46 | exact (E).retention.map_image.subset ⟨_, interior_subset hxpre, rfl⟩ |
| 47 | have hfront : I.child.inclusion (Q.map x) ∈ frontier ((E).caps i).carrier := by |
| 48 | rw [← (E).cap_boundary i] |
| 49 | exact ⟨hpost, hcap⟩ |
| 50 | rw [← (E).boundary_correspondence i] at hfront |
| 51 | obtain ⟨z, hz, hzeq⟩ := hfront |
| 52 | have hzfront : z ∈ frontier (E).retained_pre := by |
| 53 | rw [(E).pre_boundary] |
| 54 | exact mem_iUnion.mpr ⟨i, hz⟩ |
| 55 | have hzpre : z ∈ (E).retained_pre := |
| 56 | (E).retained_pre_compact.isClosed.closure_subset hzfront.1 |
| 57 | have hzx : z = I.parent.inclusion x := |
| 58 | (E).retention.left_inverse.injOn hzpre (interior_subset hxpre) |
| 59 | (hzeq.trans (Q.retained_agreement x hx)) |
| 60 | exact hzfront.2 (hzx.symm ▸ hxpre) |
| 61 | |
| 62 | /-- A fiber meeting the inherited region is a singleton, using precisely |
| 63 | SurgeryComparison's cap-image condition; Morgan-Tian pp. 430-431. -/ |
| 64 | theorem retained_fiber_eq {x : I.parent.carrier.carrier} (hx : x ∈ I.retained) |
| 65 | {y : I.parent.carrier.carrier} (hy : Q.map y = Q.map x) : y = x := by |
| 66 | have hyret : y ∈ I.retained := by |
| 67 | by_contra hnot |
| 68 | obtain ⟨i, hi⟩ := Q.outside_image_in_caps y hnot |
| 69 | rw [hy] at hi |
| 70 | exact retained_image_not_mem_cap Q hx i hi |
| 71 | exact retained_injOn Q hyret hx hy |
| 72 | |
| 73 | /-- The nonempty retained region supplies a unique fiber of the actual |
| 74 | selected map, as required for local degree; Morgan-Tian pp. 430-431. -/ |
| 75 | theorem exists_unique_retained_fiber : |
| 76 | ∃ x ∈ I.retained, ∀ y, Q.map y = Q.map x → y = x := by |
| 77 | obtain ⟨x, hx⟩ := I.inherited |
| 78 | exact ⟨x, hx, fun _ hy => retained_fiber_eq Q hx hy⟩ |
| 79 | |
| 80 | /-- On the retained image, the stored inverses recover the original parent |
| 81 | point. This supplies the local equivalence of Proposition 15.12, p. 365. -/ |
| 82 | theorem retained_inverse_apply {x : I.parent.carrier.carrier} |
| 83 | (hx : x ∈ I.retained) : |
| 84 | I.parent.inverse ((E).retention.inverse (I.child.inclusion (Q.map x))) = x := by |
| 85 | rw [Q.retained_agreement x hx, |
| 86 | (E).retention.left_inverse (interior_subset (I.retained_subset x hx)), |
| 87 | I.parent.left_inverse] |
| 88 | |
| 89 | /-- The literal comparison map restricts to an open partial homeomorphism |
| 90 | on the retained region. This gives its local degree chart on pp. 430-431. -/ |
| 91 | def retainedOpenPartialHomeomorph : |
| 92 | OpenPartialHomeomorph I.parent.carrier.carrier I.child.carrier.carrier where |
| 93 | toFun := Q.map |
| 94 | invFun := I.parent.inverse ∘ (E).retention.inverse ∘ I.child.inclusion |
| 95 | source := I.retained |
| 96 | target := Q.map '' I.retained |
| 97 | map_source' := fun x hx => mem_image_of_mem Q.map hx |
| 98 | map_target' := by |
| 99 | rintro _ ⟨x, hx, rfl⟩ |
| 100 | simpa only [Function.comp_apply, retained_inverse_apply Q hx] using hx |
| 101 | left_inv' := fun _ hx => retained_inverse_apply Q hx |
| 102 | right_inv' := by |
| 103 | rintro _ ⟨x, hx, rfl⟩ |
| 104 | change Q.map (I.parent.inverse ((E).retention.inverse |
| 105 | (I.child.inclusion (Q.map x)))) = Q.map x |
| 106 | rw [retained_inverse_apply Q hx] |
| 107 | open_source := I.retained_open |
| 108 | open_target := I.child.inclusion_openEmbedding.isOpen_iff_image_isOpen.mpr |
| 109 | Q.retained_target_open |
| 110 | continuousOn_toFun := Q.map.continuous.continuousOn |
| 111 | continuousOn_invFun := by |
| 112 | apply I.parent.inverse_smooth.continuousOn.comp |
| 113 | ((E).retention.inverse_smooth.continuousOn.comp |
| 114 | I.child.inclusion_smooth.continuous.continuousOn ?_) ?_ |
| 115 | · rintro _ ⟨x, hx, rfl⟩ |
| 116 | rw [Q.retained_agreement x hx] |
| 117 | exact (E).retention.map_image.subset |
| 118 | ⟨_, interior_subset (I.retained_subset x hx), rfl⟩ |
| 119 | · rintro _ ⟨x, hx, rfl⟩ |
| 120 | change (E).retention.inverse (I.child.inclusion (Q.map x)) ∈ _ |
| 121 | rw [Q.retained_agreement x hx, |
| 122 | (E).retention.left_inverse (interior_subset (I.retained_subset x hx))] |
| 123 | exact mem_range_self x |
| 124 | |
| 125 | end PoincareMT.SurgeryComparison.Transport |