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.Endpoint.Chart |
| 2 | |
| 3 | /-! |
| 4 | # Global endpoint length from the constructed local inverse charts |
| 5 | |
| 6 | A countable source-chart cover is selected and disjointified on the |
| 7 | measurable graph of retained first-contact heights. Global endpoint |
| 8 | injectivity makes the corresponding outer-boundary parameter sets |
| 9 | disjoint. Summing the actual local Jacobian inequalities proves the total |
| 10 | endpoint projection bound without regularity of the height function. |
| 11 | |
| 12 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481. The project derivations |
| 13 | implement its intrinsic normal-geodesic, focusing and retained-length comparison |
| 14 | arguments. |
| 15 | -/ |
| 16 | |
| 17 | noncomputable section |
| 18 | set_option autoImplicit false |
| 19 | set_option backward.isDefEq.respectTransparency false |
| 20 | |
| 21 | open Set Filter MeasureTheory |
| 22 | open scoped Topology Manifold ContDiff Bundle Matrix ENNReal |
| 23 | |
| 24 | namespace PoincareMT |
| 25 | |
| 26 | /-- Regular endpoints of an injective measurable graph on boundary two have total projected |
| 27 | length at most the length of that boundary. Every inverse chart and every measurable patch |
| 28 | is constructed in the proof. Source: MT Proposition 19.35, pp. 480-481; |
| 29 | `reports/2026-09-25-global-endpoint-projection.md`. -/ |
| 30 | theorem m64Intrinsic_endpoint_projection_length_le |
| 31 | (N : IntrinsicAnnulus) (e : AnnulusCoordinates → AnnulusCoordinates) |
| 32 | (he : ContDiff ℝ ∞ e) {height : ℝ → ℝ} (hh : Measurable height) |
| 33 | {S : Set ℝ} (hS : MeasurableSet S) (hSsub : S ⊆ Ico (0 : ℝ) rampPeriod) |
| 34 | (hinj : InjOn (fun a => e !₂[a, height a]) S) |
| 35 | (hregular : ∀ a ∈ S, Function.Injective (mfderiv (𝓡 2) (𝓡 2) e !₂[a, height a])) |
| 36 | (hend : ∀ a ∈ S, ‖e !₂[a, height a]‖ = 2) |
| 37 | {c : ℝ} (hc : 0 ≤ c) |
| 38 | (hbound : ∀ a ∈ S, ∀ v : AnnulusCoordinates, |
| 39 | c ^ 2 * (intrinsicBoundarySpeed N.metric 1 a ^ 2 * (v 0) ^ 2 + (v 1) ^ 2) ≤ |
| 40 | N.metric.inner (e !₂[a, height a]) |
| 41 | (fderiv ℝ e !₂[a, height a] v) (fderiv ℝ e !₂[a, height a] v)) : |
| 42 | c * (∫ a in S, intrinsicBoundarySpeed N.metric 1 a) ≤ |
| 43 | intrinsicBoundaryLength N.metric 2 0 rampPeriod := by |
| 44 | classical |
| 45 | rcases S.eq_empty_or_nonempty with hEmpty | hNonempty |
| 46 | · simp only [hEmpty, setIntegral_empty, mul_zero] |
| 47 | exact m64Intrinsic_boundaryLength_nonneg N 2 0 rampPeriod Real.two_pi_pos.le |
| 48 | have hInv (a : S) : |
| 49 | ∃ F : OpenPartialHomeomorph AnnulusCoordinates AnnulusCoordinates, |
| 50 | !₂[a.1, height a.1] ∈ F.source ∧ |
| 51 | (F : AnnulusCoordinates → AnnulusCoordinates) = e ∧ |
| 52 | ContDiffOn ℝ ∞ F.symm F.target := by |
| 53 | obtain ⟨F, hpoint, _, hF, _, hFi⟩ := |
| 54 | m64Intrinsic_exists_smooth_polar_inverse isOpen_univ |
| 55 | (contMDiff_iff_contDiff.mpr he).contMDiffOn (mem_univ !₂[a.1, height a.1]) |
| 56 | (hregular a a.2) |
| 57 | exact ⟨F, hpoint, hF, hFi⟩ |
| 58 | choose F hpoint hF hFi using hInv |
| 59 | obtain ⟨T, hTcount, hTcover⟩ := TopologicalSpace.isOpen_iUnion_countable |
| 60 | (fun a : S => (F a).source) (fun a => (F a).open_source) |
| 61 | have hTnonempty : T.Nonempty := by |
| 62 | obtain ⟨a, ha⟩ := hNonempty |
| 63 | have hmem : !₂[a, height a] ∈ ⋃ b : S, (F b).source := |
| 64 | mem_iUnion.mpr ⟨⟨a, ha⟩, hpoint ⟨a, ha⟩⟩ |
| 65 | rw [← hTcover] at hmem |
| 66 | obtain ⟨b, hb⟩ := mem_iUnion.mp hmem |
| 67 | obtain ⟨hbT, _⟩ := mem_iUnion.mp hb |
| 68 | exact ⟨b, hbT⟩ |
| 69 | obtain ⟨v, hv⟩ := hTcount.exists_eq_range hTnonempty |
| 70 | have hcover (a : ℝ) (ha : a ∈ S) : ∃ n : ℕ, !₂[a, height a] ∈ (F (v n)).source := by |
| 71 | have hmem : !₂[a, height a] ∈ ⋃ b : S, (F b).source := |
| 72 | mem_iUnion.mpr ⟨⟨a, ha⟩, hpoint ⟨a, ha⟩⟩ |
| 73 | rw [← hTcover] at hmem |
| 74 | obtain ⟨b, hb⟩ := mem_iUnion.mp hmem |
| 75 | obtain ⟨hbT, hbpoint⟩ := mem_iUnion.mp hb |
| 76 | rw [hv] at hbT |
| 77 | obtain ⟨n, rfl⟩ := hbT |
| 78 | exact ⟨n, hbpoint⟩ |
| 79 | let A : ℕ → Set ℝ := fun n => S ∩ (fun a => !₂[a, height a]) ⁻¹' (F (v n)).source |
| 80 | have hgraph : Measurable (fun a => (!₂[a, height a] : AnnulusCoordinates)) := by fun_prop |
| 81 | have hA (n : ℕ) : MeasurableSet (A n) := |
| 82 | hS.inter ((F (v n)).open_source.measurableSet.preimage hgraph) |
| 83 | have hAunion : (⋃ n, A n) = S := by |
| 84 | apply Subset.antisymm |
| 85 | · intro a ha |
| 86 | obtain ⟨n, hn⟩ := mem_iUnion.mp ha |
| 87 | exact hn.1 |
| 88 | · intro a ha |
| 89 | obtain ⟨n, hn⟩ := hcover a ha |
| 90 | exact mem_iUnion.mpr ⟨n, ha, hn⟩ |
| 91 | let P := disjointed A |
| 92 | have hP (n : ℕ) : MeasurableSet (P n) := MeasurableSet.disjointed hA n |
| 93 | have hPsub (n : ℕ) : P n ⊆ S := (disjointed_subset A n).trans inter_subset_left |
| 94 | have hPsource (n : ℕ) (a : ℝ) (ha : a ∈ P n) : |
| 95 | !₂[a, height a] ∈ (F (v n)).source := (disjointed_subset A n ha).2 |
| 96 | have hPunion : (⋃ n, P n) = S := by rw [iUnion_disjointed, hAunion] |
| 97 | let B : ℕ → Set ℝ := fun n => m64IntrinsicEndpointParameters e height (P n) |
| 98 | have hlocal (n : ℕ) : MeasurableSet (B n) ∧ |
| 99 | ENNReal.ofReal c * (∫⁻ a in P n, ENNReal.ofReal (intrinsicBoundarySpeed N.metric 1 a)) ≤ |
| 100 | ∫⁻ b in B n, ENNReal.ofReal (intrinsicBoundarySpeed N.metric 2 b) := |
| 101 | m64Intrinsic_endpoint_chart_measure_le N e (he.differentiable (by simp)) |
| 102 | (F (v n)) (hF (v n)) (hFi (v n)) (hP n) hh (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 b hbn hbm |
| 108 | obtain ⟨_, a, ha, hab⟩ := hbn |
| 109 | obtain ⟨_, a', ha', ha'b⟩ := hbm |
| 110 | have haa' := hinj (hPsub n ha) (hPsub m ha') (hab.trans ha'b.symm) |
| 111 | exact Set.disjoint_left.mp (disjoint_disjointed A hnm) ha (haa'.symm ▸ ha') |
| 112 | have hBsub : (⋃ n, B n) ⊆ Ico (0 : ℝ) rampPeriod := by |
| 113 | intro b hb |
| 114 | obtain ⟨n, hn⟩ := mem_iUnion.mp hb |
| 115 | exact hn.1 |
| 116 | have hlength : ENNReal.ofReal c * |
| 117 | (∫⁻ a in S, ENNReal.ofReal (intrinsicBoundarySpeed N.metric 1 a)) ≤ |
| 118 | ∫⁻ b in Ico (0 : ℝ) rampPeriod, ENNReal.ofReal (intrinsicBoundarySpeed N.metric 2 b) := by |
| 119 | calc |
| 120 | _ = ∑' n, ENNReal.ofReal c * |
| 121 | (∫⁻ a in P n, ENNReal.ofReal (intrinsicBoundarySpeed N.metric 1 a)) := by |
| 122 | rw [← hPunion, lintegral_iUnion hP (disjoint_disjointed A), ENNReal.tsum_mul_left] |
| 123 | _ ≤ ∑' n, ∫⁻ b in B n, ENNReal.ofReal (intrinsicBoundarySpeed N.metric 2 b) := |
| 124 | ENNReal.tsum_le_tsum (fun n => (hlocal n).2) |
| 125 | _ = ∫⁻ b in ⋃ n, B n, ENNReal.ofReal (intrinsicBoundarySpeed N.metric 2 b) := |
| 126 | (lintegral_iUnion (fun n => (hlocal n).1) hBdisj _).symm |
| 127 | _ ≤ _ := lintegral_mono_set hBsub |
| 128 | have hs1 := (m64Intrinsic_contDiff_boundarySpeed N (by norm_num : (1 : ℝ) ≠ 0)).continuous |
| 129 | have hs2 := (m64Intrinsic_contDiff_boundarySpeed N (by norm_num : (2 : ℝ) ≠ 0)).continuous |
| 130 | rw [← ofReal_integral_eq_lintegral_ofReal |
| 131 | (hs1.integrableOn_Icc.mono_set (hSsub.trans Ico_subset_Icc_self)) |
| 132 | (Eventually.of_forall (fun _ => Real.sqrt_nonneg _)), |
| 133 | ← ofReal_integral_eq_lintegral_ofReal |
| 134 | (hs2.integrableOn_Icc.mono_set Ico_subset_Icc_self) |
| 135 | (Eventually.of_forall (fun _ => Real.sqrt_nonneg _)), |
| 136 | ← ENNReal.ofReal_mul hc] at hlength |
| 137 | have hout : (∫ b in Ico (0 : ℝ) rampPeriod, intrinsicBoundarySpeed N.metric 2 b) = |
| 138 | intrinsicBoundaryLength N.metric 2 0 rampPeriod := by |
| 139 | rw [intrinsicBoundaryLength, intervalIntegral.integral_of_le |
| 140 | (show (0 : ℝ) ≤ rampPeriod from Real.two_pi_pos.le)] |
| 141 | exact setIntegral_congr_set Ico_ae_eq_Ioc |
| 142 | rw [hout] at hlength |
| 143 | exact (ENNReal.ofReal_le_ofReal_iff |
| 144 | (m64Intrinsic_boundaryLength_nonneg N 2 0 rampPeriod Real.two_pi_pos.le)).mp hlength |
| 145 | |
| 146 | end PoincareMT |