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.BoundedDistance.GeometryImports |
| 2 | import Mathlib.Geometry.Manifold.Diffeomorph |
| 3 | import Mathlib.Topology.OpenPartialHomeomorph.Composition |
| 4 | import Mathlib.Topology.Order.IntermediateValue |
| 5 | |
| 6 | /-! |
| 7 | # The exact vertical domain of an aligned transition band |
| 8 | |
| 9 | Two smooth partial charts with the same base coordinate on a closed band |
| 10 | have one coherent height orientation there. Their actual restricted |
| 11 | transition has precisely the open region between the endpoint graphs as |
| 12 | target, with its jointly smooth inverse retained. This is the transition |
| 13 | domain step for Morgan--Tian A.13, p. 505, and A.19, p. 507; see |
| 14 | `tasks/M25/case-local/tube-transition-band-plan.md`. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | |
| 19 | open Set |
| 20 | open scoped Manifold ContDiff |
| 21 | |
| 22 | namespace OpenPartialHomeomorph |
| 23 | |
| 24 | /-- An aligned closed product band determines one signed height order |
| 25 | and the exact smooth transition to the open region between its endpoint |
| 26 | graphs. The inverse is the actual reverse chart composition. This is |
| 27 | the retained overlap step in MT A.13/A.19, pp. 505/507. -/ |
| 28 | theorem exists_fiberwise_transition_band |
| 29 | {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 30 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 31 | {H H' : Type*} [TopologicalSpace H] [TopologicalSpace H'] |
| 32 | {I : ModelWithCorners ℝ E H} {J : ModelWithCorners ℝ F H'} |
| 33 | {K : Type*} [TopologicalSpace K] [ChartedSpace H K] |
| 34 | [PreconnectedSpace K] |
| 35 | {M : Type*} [TopologicalSpace M] [ChartedSpace H' M] |
| 36 | (e f : OpenPartialHomeomorph (K × ℝ) M) (A : K ≃ₜ K) |
| 37 | {a b : ℝ} (hab : a < b) |
| 38 | (hsource : univ ×ˢ Icc a b ⊆ e.source) |
| 39 | (htarget : MapsTo e (univ ×ˢ Icc a b) f.target) |
| 40 | (hfirst : ∀ z : K × ℝ, z.2 ∈ Icc a b → |
| 41 | (f.symm (e z)).1 = A z.1) |
| 42 | (he : ContMDiffOn (I.prod 𝓘(ℝ, ℝ)) J ∞ e e.source) |
| 43 | (hei : ContMDiffOn J (I.prod 𝓘(ℝ, ℝ)) ∞ e.symm e.target) |
| 44 | (hf : ContMDiffOn (I.prod 𝓘(ℝ, ℝ)) J ∞ f f.source) |
| 45 | (hfi : ContMDiffOn J (I.prod 𝓘(ℝ, ℝ)) ∞ f.symm f.target) : |
| 46 | let h : K × ℝ → ℝ := fun z => (f.symm (e z)).2 |
| 47 | let T := (e.restr (univ ×ˢ Ioo a b)).trans f.symm |
| 48 | ∃ σ : ℝ, (σ = 1 ∨ σ = -1) ∧ |
| 49 | (∀ q : K, StrictMonoOn (fun s => σ * h (q, s)) (Icc a b)) ∧ |
| 50 | ContMDiff I 𝓘(ℝ, ℝ) ∞ (fun q : K => h (q, a)) ∧ |
| 51 | ContMDiff I 𝓘(ℝ, ℝ) ∞ (fun q : K => h (q, b)) ∧ |
| 52 | T.source = univ ×ˢ Ioo a b ∧ |
| 53 | T.target = {z : K × ℝ | |
| 54 | σ * h (A.symm z.1, a) < σ * z.2 ∧ |
| 55 | σ * z.2 < σ * h (A.symm z.1, b)} ∧ |
| 56 | T.target ⊆ f.source ∧ |
| 57 | ContMDiffOn (I.prod 𝓘(ℝ, ℝ)) (I.prod 𝓘(ℝ, ℝ)) ∞ T T.source ∧ |
| 58 | ContMDiffOn (I.prod 𝓘(ℝ, ℝ)) (I.prod 𝓘(ℝ, ℝ)) ∞ T.symm T.target ∧ |
| 59 | (∀ z ∈ T.source, |
| 60 | T z = (A z.1, h z) ∧ f (T z) = e z) ∧ |
| 61 | (∀ z ∈ T.target, |
| 62 | T.symm z = e.symm (f z) ∧ |
| 63 | (T.symm z).1 = A.symm z.1 ∧ e (T.symm z) = f z) := by |
| 64 | let h : K × ℝ → ℝ := fun z => (f.symm (e z)).2 |
| 65 | let T := (e.restr (univ ×ˢ Ioo a b)).trans f.symm |
| 66 | have hclosed {z : K × ℝ} (hz : z ∈ univ ×ˢ Ioo a b) : |
| 67 | z ∈ univ ×ˢ Icc a b := ⟨hz.1, hz.2.1.le, hz.2.2.le⟩ |
| 68 | have hTsource : T.source = univ ×ˢ Ioo a b := by |
| 69 | dsimp only [T] |
| 70 | rw [trans_source, e.restr_source' _ (isOpen_univ.prod isOpen_Ioo), symm_source] |
| 71 | ext z |
| 72 | change ((z ∈ e.source ∧ z ∈ univ ×ˢ Ioo a b) ∧ e z ∈ f.target) ↔ |
| 73 | z ∈ univ ×ˢ Ioo a b |
| 74 | constructor |
| 75 | · exact fun hz => hz.1.2 |
| 76 | · intro hz |
| 77 | exact ⟨⟨hsource (hclosed hz), hz⟩, htarget (hclosed hz)⟩ |
| 78 | have hTclosed {z : K × ℝ} (hz : z ∈ T.source) : z ∈ univ ×ˢ Icc a b := |
| 79 | hclosed (hTsource ▸ hz) |
| 80 | have hTtarget_mem (z : K × ℝ) (hz : z ∈ T.target) : |
| 81 | z ∈ f.source ∧ f z ∈ e.target := by |
| 82 | change z ∈ f.source ∧ f z ∈ (e.restr (univ ×ˢ Ioo a b)).target at hz |
| 83 | exact ⟨hz.1, hz.2.1⟩ |
| 84 | have hTpair (z : K × ℝ) (hz : z.2 ∈ Icc a b) : T z = (A z.1, h z) := |
| 85 | Prod.ext (hfirst z hz) rfl |
| 86 | have hslice (t : ℝ) (ht : t ∈ Icc a b) : |
| 87 | ContMDiff I 𝓘(ℝ, ℝ) ∞ (fun q : K => h (q, t)) := by |
| 88 | have hp : ContMDiff I (I.prod 𝓘(ℝ, ℝ)) ∞ (fun q : K => (q, t)) := |
| 89 | contMDiff_id.prodMk contMDiff_const |
| 90 | have heq : ContMDiff I J ∞ (fun q : K => e (q, t)) := |
| 91 | he.comp_contMDiff hp (fun q => hsource ⟨mem_univ q, ht⟩) |
| 92 | have hcoord : ContMDiff I (I.prod 𝓘(ℝ, ℝ)) ∞ |
| 93 | (fun q : K => f.symm (e (q, t))) := |
| 94 | hfi.comp_contMDiff heq (fun q => htarget ⟨mem_univ q, ht⟩) |
| 95 | exact contMDiff_snd.comp hcoord |
| 96 | have hcont (q : K) : ContinuousOn (fun t : ℝ => h (q, t)) (Icc a b) := by |
| 97 | have hp : Continuous (fun t : ℝ => (q, t)) := continuous_const.prodMk continuous_id |
| 98 | have heq : ContinuousOn (fun t : ℝ => e (q, t)) (Icc a b) := |
| 99 | e.continuousOn.comp hp.continuousOn (fun _ ht => hsource ⟨mem_univ q, ht⟩) |
| 100 | exact (f.symm.continuousOn.comp heq |
| 101 | (fun _ ht => htarget ⟨mem_univ q, ht⟩)).snd |
| 102 | have hinj (q : K) : InjOn (fun t : ℝ => h (q, t)) (Icc a b) := by |
| 103 | intro s hs t ht hst |
| 104 | have hp : f.symm (e (q, s)) = f.symm (e (q, t)) := |
| 105 | Prod.ext ((hfirst (q, s) hs).trans (hfirst (q, t) ht).symm) hst |
| 106 | have heq := congrArg f hp |
| 107 | rw [f.right_inv (htarget ⟨mem_univ q, hs⟩), |
| 108 | f.right_inv (htarget ⟨mem_univ q, ht⟩)] at heq |
| 109 | exact congrArg Prod.snd (e.injOn (hsource ⟨mem_univ q, hs⟩) |
| 110 | (hsource ⟨mem_univ q, ht⟩) heq) |
| 111 | have ha : a ∈ Icc a b := ⟨le_rfl, hab.le⟩ |
| 112 | have hb : b ∈ Icc a b := ⟨hab.le, le_rfl⟩ |
| 113 | let d : K → ℝ := fun q => h (q, b) - h (q, a) |
| 114 | have hd : Continuous d := (hslice b hb).continuous.sub (hslice a ha).continuous |
| 115 | have hdne (q : K) (_ : q ∈ (univ : Set K)) : d q ≠ 0 := by |
| 116 | intro hz |
| 117 | have heq : h (q, a) = h (q, b) := (sub_eq_zero.mp hz).symm |
| 118 | exact hab.ne (hinj q ha hb heq) |
| 119 | have hsign : ∃ σ : ℝ, (σ = 1 ∨ σ = -1) ∧ |
| 120 | ∀ q : K, σ * h (q, a) < σ * h (q, b) := by |
| 121 | rcases isPreconnected_univ.mapsTo_Ioi_or_Iio hd.continuousOn hdne with hpos | hneg |
| 122 | · refine ⟨1, Or.inl rfl, ?_⟩ |
| 123 | intro q |
| 124 | have hq : 0 < h (q, b) - h (q, a) := hpos (mem_univ q) |
| 125 | simpa only [one_mul] using sub_pos.mp hq |
| 126 | · refine ⟨-1, Or.inr rfl, ?_⟩ |
| 127 | intro q |
| 128 | have hq : h (q, b) - h (q, a) < 0 := hneg (mem_univ q) |
| 129 | simpa only [neg_one_mul] using neg_lt_neg (sub_neg.mp hq) |
| 130 | obtain ⟨σ, hσ, hend⟩ := hsign |
| 131 | have hσne : σ ≠ 0 := by |
| 132 | rcases hσ with rfl | rfl |
| 133 | · exact one_ne_zero |
| 134 | · exact neg_ne_zero.mpr one_ne_zero |
| 135 | have hsigcont (q : K) : |
| 136 | ContinuousOn (fun s => σ * h (q, s)) (Icc a b) := |
| 137 | continuousOn_const.mul (hcont q) |
| 138 | have hmono (q : K) : StrictMonoOn (fun s => σ * h (q, s)) (Icc a b) := |
| 139 | ContinuousOn.strictMonoOn_of_injOn_Icc hab.le (hend q).le (hsigcont q) |
| 140 | (fun _ hs _ ht hst => hinj q hs ht (mul_left_cancel₀ hσne hst)) |
| 141 | have hTtarget : T.target = {z : K × ℝ | |
| 142 | σ * h (A.symm z.1, a) < σ * z.2 ∧ |
| 143 | σ * z.2 < σ * h (A.symm z.1, b)} := by |
| 144 | rw [← T.image_source_eq_target] |
| 145 | ext z |
| 146 | constructor |
| 147 | · rintro ⟨w, hw, rfl⟩ |
| 148 | have hwopen : w.2 ∈ Ioo a b := (hTsource ▸ hw).2 |
| 149 | have hwclosed : w.2 ∈ Icc a b := ⟨hwopen.1.le, hwopen.2.le⟩ |
| 150 | change σ * h (A.symm (T w).1, a) < σ * (T w).2 ∧ |
| 151 | σ * (T w).2 < σ * h (A.symm (T w).1, b) |
| 152 | rw [hTpair w hwclosed] |
| 153 | simp only [A.symm_apply_apply] |
| 154 | exact ⟨hmono w.1 ha hwclosed hwopen.1, hmono w.1 hwclosed hb hwopen.2⟩ |
| 155 | · intro hz |
| 156 | change σ * h (A.symm z.1, a) < σ * z.2 ∧ |
| 157 | σ * z.2 < σ * h (A.symm z.1, b) at hz |
| 158 | let q := A.symm z.1 |
| 159 | have himage := (hsigcont q).image_Ioo_of_strictMonoOn hab.le (hmono q) |
| 160 | have hzimage : σ * z.2 ∈ (fun s => σ * h (q, s)) '' Ioo a b := by |
| 161 | rw [himage] |
| 162 | exact hz |
| 163 | obtain ⟨s, hs, heq⟩ := hzimage |
| 164 | refine ⟨(q, s), ?_, ?_⟩ |
| 165 | · rw [hTsource] |
| 166 | exact ⟨mem_univ q, hs⟩ |
| 167 | · rw [hTpair (q, s) ⟨hs.1.le, hs.2.le⟩] |
| 168 | apply Prod.ext |
| 169 | · exact A.apply_symm_apply z.1 |
| 170 | · exact mul_left_cancel₀ hσne heq |
| 171 | have hTs : ContMDiffOn (I.prod 𝓘(ℝ, ℝ)) (I.prod 𝓘(ℝ, ℝ)) ∞ T T.source := |
| 172 | hfi.comp (he.mono (fun _ hz => hsource (hTclosed hz))) |
| 173 | (fun _ hz => htarget (hTclosed hz)) |
| 174 | have hTis : ContMDiffOn (I.prod 𝓘(ℝ, ℝ)) (I.prod 𝓘(ℝ, ℝ)) ∞ T.symm T.target := |
| 175 | hei.comp (hf.mono (fun z hz => (hTtarget_mem z hz).1)) |
| 176 | (fun z hz => (hTtarget_mem z hz).2) |
| 177 | refine ⟨σ, hσ, hmono, hslice a ha, hslice b hb, hTsource, hTtarget, |
| 178 | (fun z hz => (hTtarget_mem z hz).1), hTs, hTis, ?_, ?_⟩ |
| 179 | · intro z hz |
| 180 | exact ⟨hTpair z (hTclosed hz).2, f.right_inv (htarget (hTclosed hz))⟩ |
| 181 | · intro z hz |
| 182 | refine ⟨rfl, ?_, ?_⟩ |
| 183 | · have hw : (T.symm z).2 ∈ Icc a b := (hTclosed (T.map_target hz)).2 |
| 184 | have hbase : A (T.symm z).1 = z.1 := by |
| 185 | have heq := T.right_inv hz |
| 186 | rw [hTpair (T.symm z) hw] at heq |
| 187 | exact congrArg Prod.fst heq |
| 188 | calc |
| 189 | (T.symm z).1 = A.symm (A (T.symm z).1) := (A.symm_apply_apply _).symm |
| 190 | _ = A.symm z.1 := congrArg A.symm hbase |
| 191 | · exact e.right_inv (hTtarget_mem z hz).2 |
| 192 | |
| 193 | end OpenPartialHomeomorph |