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.CurveShortening.Comparison.IntrinsicComparison.Curve.EndpointChart |
| 2 | |
| 3 | /-! |
| 4 | # Global endpoint sweep on a smooth target arc |
| 5 | |
| 6 | Countably many actual inverse charts cover the stopping graph. Their |
| 7 | disjoint source patches give disjoint target parameter sets by endpoint |
| 8 | injectivity. The resulting length estimate applies in particular to the |
| 9 | returning unit-speed geodesic in Morgan--Tian, Lemma 19.46, p. 477. |
| 10 | -/ |
| 11 | |
| 12 | noncomputable section |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set Filter MeasureTheory |
| 17 | open scoped Topology Manifold ContDiff Bundle Matrix ENNReal |
| 18 | |
| 19 | namespace PoincareMT |
| 20 | |
| 21 | attribute [local instance] normedAddCommGroupTangentSpaceVectorSpace |
| 22 | normedSpaceTangentSpaceVectorSpace |
| 23 | |
| 24 | /-- Actual regular endpoints on an embedded target arc obey the global |
| 25 | length estimate for a merely measurable stopping graph; Lemma 19.46, |
| 26 | pp. 475-478. No finiteness premise on the target integral is needed. -/ |
| 27 | theorem m64Intrinsic_curve_endpoint_projection_measure_le |
| 28 | (N : IntrinsicAnnulus) (e : AnnulusCoordinates → AnnulusCoordinates) |
| 29 | (he : ContDiff ℝ ∞ e) {height : ℝ → ℝ} (hh : Measurable height) |
| 30 | {S T : Set ℝ} (hS : MeasurableSet S) (hT : MeasurableSet T) |
| 31 | (hinj : InjOn (fun a => e !₂[a, height a]) S) |
| 32 | (hregular : ∀ a ∈ S, Function.Injective (mfderiv (𝓡 2) (𝓡 2) e !₂[a, height a])) |
| 33 | {target : ℝ → AnnulusCoordinates} (htarget : ContDiff ℝ ∞ target) |
| 34 | (htargetInj : InjOn target T) |
| 35 | (hend : ∀ a ∈ S, e !₂[a, height a] ∈ target '' T) |
| 36 | {c : ℝ} (hc : 0 ≤ c) |
| 37 | (hbound : ∀ a ∈ S, ∀ v : AnnulusCoordinates, |
| 38 | c ^ 2 * (intrinsicBoundarySpeed N.metric 1 a ^ 2 * (v 0) ^ 2 + (v 1) ^ 2) ≤ |
| 39 | N.metric.inner (e !₂[a, height a]) |
| 40 | (fderiv ℝ e !₂[a, height a] v) (fderiv ℝ e !₂[a, height a] v)) : |
| 41 | ENNReal.ofReal c * (∫⁻ a in S, ENNReal.ofReal (intrinsicBoundarySpeed N.metric 1 a)) ≤ |
| 42 | ∫⁻ t in T, ENNReal.ofReal |
| 43 | (Real.sqrt (N.metric.inner (target t) (deriv target t) (deriv target t))) := by |
| 44 | classical |
| 45 | rcases S.eq_empty_or_nonempty with hEmpty | hNonempty |
| 46 | · simp [hEmpty] |
| 47 | have hInv (a : S) : |
| 48 | ∃ F : OpenPartialHomeomorph AnnulusCoordinates AnnulusCoordinates, |
| 49 | !₂[a.1, height a.1] ∈ F.source ∧ |
| 50 | (F : AnnulusCoordinates → AnnulusCoordinates) = e ∧ |
| 51 | ContDiffOn ℝ ∞ F.symm F.target := by |
| 52 | obtain ⟨F, hpoint, _, hF, _, hFi⟩ := |
| 53 | m64Intrinsic_exists_smooth_polar_inverse isOpen_univ |
| 54 | (contMDiff_iff_contDiff.mpr he).contMDiffOn (mem_univ !₂[a.1, height a.1]) |
| 55 | (hregular a a.2) |
| 56 | exact ⟨F, hpoint, hF, hFi⟩ |
| 57 | choose F hpoint hF hFi using hInv |
| 58 | obtain ⟨C, hCcount, hCcover⟩ := TopologicalSpace.isOpen_iUnion_countable |
| 59 | (fun a : S => (F a).source) (fun a => (F a).open_source) |
| 60 | have hCnonempty : C.Nonempty := by |
| 61 | obtain ⟨a, ha⟩ := hNonempty |
| 62 | have hmem : !₂[a, height a] ∈ ⋃ b : S, (F b).source := |
| 63 | mem_iUnion.mpr ⟨⟨a, ha⟩, hpoint ⟨a, ha⟩⟩ |
| 64 | rw [← hCcover] at hmem |
| 65 | obtain ⟨b, hb⟩ := mem_iUnion.mp hmem |
| 66 | obtain ⟨hbC, _⟩ := mem_iUnion.mp hb |
| 67 | exact ⟨b, hbC⟩ |
| 68 | obtain ⟨v, hv⟩ := hCcount.exists_eq_range hCnonempty |
| 69 | have hcover (a : ℝ) (ha : a ∈ S) : ∃ n : ℕ, !₂[a, height a] ∈ (F (v n)).source := by |
| 70 | have hmem : !₂[a, height a] ∈ ⋃ b : S, (F b).source := |
| 71 | mem_iUnion.mpr ⟨⟨a, ha⟩, hpoint ⟨a, ha⟩⟩ |
| 72 | rw [← hCcover] at hmem |
| 73 | obtain ⟨b, hb⟩ := mem_iUnion.mp hmem |
| 74 | obtain ⟨hbC, hbpoint⟩ := mem_iUnion.mp hb |
| 75 | rw [hv] at hbC |
| 76 | obtain ⟨n, rfl⟩ := hbC |
| 77 | exact ⟨n, hbpoint⟩ |
| 78 | let A : ℕ → Set ℝ := fun n => S ∩ (fun a => !₂[a, height a]) ⁻¹' (F (v n)).source |
| 79 | have hgraph : Measurable (fun a => (!₂[a, height a] : AnnulusCoordinates)) := by fun_prop |
| 80 | have hA (n : ℕ) : MeasurableSet (A n) := |
| 81 | hS.inter ((F (v n)).open_source.measurableSet.preimage hgraph) |
| 82 | have hAunion : (⋃ n, A n) = S := by |
| 83 | apply Subset.antisymm |
| 84 | · intro a ha |
| 85 | obtain ⟨n, hn⟩ := mem_iUnion.mp ha |
| 86 | exact hn.1 |
| 87 | · intro a ha |
| 88 | obtain ⟨n, hn⟩ := hcover a ha |
| 89 | exact mem_iUnion.mpr ⟨n, ha, hn⟩ |
| 90 | let P := disjointed A |
| 91 | have hP (n : ℕ) : MeasurableSet (P n) := MeasurableSet.disjointed hA n |
| 92 | have hPsub (n : ℕ) : P n ⊆ S := (disjointed_subset A n).trans inter_subset_left |
| 93 | have hPsource (n : ℕ) (a : ℝ) (ha : a ∈ P n) : |
| 94 | !₂[a, height a] ∈ (F (v n)).source := (disjointed_subset A n ha).2 |
| 95 | have hPunion : (⋃ n, P n) = S := by rw [iUnion_disjointed, hAunion] |
| 96 | let B : ℕ → Set ℝ := fun n => m64IntrinsicCurveEndpointParameters e height (P n) target T |
| 97 | have hlocal (n : ℕ) : MeasurableSet (B n) ∧ |
| 98 | ENNReal.ofReal c * (∫⁻ a in P n, ENNReal.ofReal (intrinsicBoundarySpeed N.metric 1 a)) ≤ |
| 99 | ∫⁻ t in B n, ENNReal.ofReal |
| 100 | (Real.sqrt (N.metric.inner (target t) (deriv target t) (deriv target t))) := |
| 101 | m64Intrinsic_curve_endpoint_chart_measure_le N e (he.differentiable (by simp)) |
| 102 | (F (v n)) (hF (v n)) (hFi (v n)) (hP n) hT hh htarget htargetInj (hPsource n) |
| 103 | (fun a ha => hend a (hPsub n ha)) hc (fun a ha => hbound a (hPsub n ha)) |
| 104 | have hBdisj : Pairwise (fun n m => Disjoint (B n) (B m)) := by |
| 105 | intro n m hnm |
| 106 | apply Set.disjoint_left.mpr |
| 107 | intro t htn htm |
| 108 | obtain ⟨_, a, ha, hat⟩ := htn |
| 109 | obtain ⟨_, a', ha', ha't⟩ := htm |
| 110 | have haa' := hinj (hPsub n ha) (hPsub m ha') (hat.trans ha't.symm) |
| 111 | exact Set.disjoint_left.mp (disjoint_disjointed A hnm) ha (haa'.symm ▸ ha') |
| 112 | have hBsub : (⋃ n, B n) ⊆ T := by |
| 113 | intro t ht |
| 114 | obtain ⟨n, hn⟩ := mem_iUnion.mp ht |
| 115 | exact hn.1 |
| 116 | calc |
| 117 | _ = ∑' n, ENNReal.ofReal c * |
| 118 | (∫⁻ a in P n, ENNReal.ofReal (intrinsicBoundarySpeed N.metric 1 a)) := by |
| 119 | rw [← hPunion, lintegral_iUnion hP (disjoint_disjointed A), ENNReal.tsum_mul_left] |
| 120 | _ ≤ ∑' n, ∫⁻ t in B n, ENNReal.ofReal |
| 121 | (Real.sqrt (N.metric.inner (target t) (deriv target t) (deriv target t))) := |
| 122 | ENNReal.tsum_le_tsum (fun n => (hlocal n).2) |
| 123 | _ = ∫⁻ t in ⋃ n, B n, ENNReal.ofReal |
| 124 | (Real.sqrt (N.metric.inner (target t) (deriv target t) (deriv target t))) := |
| 125 | (lintegral_iUnion (fun n => (hlocal n).1) hBdisj _).symm |
| 126 | _ ≤ _ := lintegral_mono_set hBsub |
| 127 | |
| 128 | /-- The endpoints falling on a unit-speed embedded target segment cost |
| 129 | at most its actual length; Lemma 19.46, p. 477. The target need not be |
| 130 | geodesic, and the stopping height need only be measurable. -/ |
| 131 | theorem m64Intrinsic_unit_curve_endpoint_projection_length_le |
| 132 | (N : IntrinsicAnnulus) (e : AnnulusCoordinates → AnnulusCoordinates) |
| 133 | (he : ContDiff ℝ ∞ e) {height : ℝ → ℝ} (hh : Measurable height) |
| 134 | {S : Set ℝ} (hS : MeasurableSet S) {l u : ℝ} (hSsub : S ⊆ Icc l u) |
| 135 | (hinj : InjOn (fun a => e !₂[a, height a]) S) |
| 136 | (hregular : ∀ a ∈ S, Function.Injective (mfderiv (𝓡 2) (𝓡 2) e !₂[a, height a])) |
| 137 | {target : ℝ → AnnulusCoordinates} (htarget : ContDiff ℝ ∞ target) |
| 138 | {a b : ℝ} (hab : a ≤ b) (htargetInj : InjOn target (Icc a b)) |
| 139 | (hunit : ∀ t ∈ Icc a b, |
| 140 | N.metric.inner (target t) (deriv target t) (deriv target t) = 1) |
| 141 | (hend : ∀ s ∈ S, e !₂[s, height s] ∈ target '' Icc a b) |
| 142 | {c : ℝ} (hc : 0 ≤ c) |
| 143 | (hbound : ∀ s ∈ S, ∀ v : AnnulusCoordinates, |
| 144 | c ^ 2 * (intrinsicBoundarySpeed N.metric 1 s ^ 2 * (v 0) ^ 2 + (v 1) ^ 2) ≤ |
| 145 | N.metric.inner (e !₂[s, height s]) |
| 146 | (fderiv ℝ e !₂[s, height s] v) (fderiv ℝ e !₂[s, height s] v)) : |
| 147 | c * (∫ s in S, intrinsicBoundarySpeed N.metric 1 s) ≤ b - a := by |
| 148 | have hlength := m64Intrinsic_curve_endpoint_projection_measure_le N e he hh hS |
| 149 | measurableSet_Icc hinj hregular htarget htargetInj hend hc hbound |
| 150 | have htargetLength : |
| 151 | (∫⁻ t in Icc a b, ENNReal.ofReal |
| 152 | (Real.sqrt (N.metric.inner (target t) (deriv target t) (deriv target t)))) = |
| 153 | ENNReal.ofReal (b - a) := by |
| 154 | calc |
| 155 | _ = ∫⁻ _ in Icc a b, (1 : ℝ≥0∞) := by |
| 156 | apply setLIntegral_congr_fun measurableSet_Icc |
| 157 | intro t ht |
| 158 | change ENNReal.ofReal (Real.sqrt |
| 159 | (N.metric.inner (target t) (deriv target t) (deriv target t))) = 1 |
| 160 | rw [hunit t ht, Real.sqrt_one, ENNReal.ofReal_one] |
| 161 | _ = _ := by simp |
| 162 | have hs := (m64Intrinsic_contDiff_boundarySpeed N (by norm_num : (1 : ℝ) ≠ 0)).continuous |
| 163 | rw [htargetLength, ← ofReal_integral_eq_lintegral_ofReal |
| 164 | (hs.integrableOn_Icc.mono_set hSsub) |
| 165 | (Eventually.of_forall (fun _ => Real.sqrt_nonneg _)), |
| 166 | ← ENNReal.ofReal_mul hc] at hlength |
| 167 | exact (ENNReal.ofReal_le_ofReal_iff (sub_nonneg.mpr hab)).mp hlength |
| 168 | |
| 169 | end PoincareMT |