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 PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.SourceNames |
| 3 | import PoincareLib.Geometry.RicciFlow.Curvature.Estimates.Shi.Paths.PiecewiseEnergy |
| 4 | import Mathlib.MeasureTheory.Integral.DominatedConvergence |
| 5 | import Mathlib.Topology.Order.IntermediateValue |
| 6 | |
| 7 | /-! |
| 8 | # Exact partial-length anchors for C1 paths |
| 9 | |
| 10 | Morgan--Tian Claim 10.4, pp. 249-251, uses extensions on the whole regional |
| 11 | minimum. M04's within-interval speed computes every subsegment length and |
| 12 | gives continuous partial lengths, including the original endpoints. |
| 13 | See M28 derivation 49 and the supervisor-signed overlap route, section 3. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set MeasureTheory |
| 19 | open scoped Manifold ContDiff Bundle Topology ENNReal |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.M28 |
| 24 | |
| 25 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 27 | |
| 28 | /-- The speed within one fixed interval computes all its subsegment lengths; |
| 29 | the endpoint derivative values do not affect the integral (Claim 10.4). -/ |
| 30 | theorem pathELength_eq_integral_fixed_segment_speed (g : RiemannianMetric n M) |
| 31 | {γ : ℝ → M} {a b c d : ℝ} |
| 32 | (hγ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 γ (Icc a b)) |
| 33 | (hac : a ≤ c) (hcd : c ≤ d) (hdb : d ≤ b) : |
| 34 | g.pathELength γ c d = |
| 35 | ENNReal.ofReal (∫ t in c..d, M04.segmentPathSpeed g γ a b t) := by |
| 36 | rcases hcd.eq_or_lt with rfl | hcd |
| 37 | · simp [RiemannianMetric.pathELength] |
| 38 | rw [M04.pathELength_eq_ofReal_integral_segmentPathSpeed g |
| 39 | (hγ.mono (Icc_subset_Icc hac hdb)) hcd] |
| 40 | congr 1 |
| 41 | apply intervalIntegral.integral_congr_Ioo_of_le hcd.le |
| 42 | intro t ht |
| 43 | simp only [M04.segmentPathSpeed, |
| 44 | mfderivWithin_of_mem_nhds (Icc_mem_nhds ht.1 ht.2), |
| 45 | mfderivWithin_of_mem_nhds (Icc_mem_nhds (hac.trans_lt ht.1) (ht.2.trans_le hdb))] |
| 46 | |
| 47 | /-- Partial lengths ending at the right endpoint are continuous on the |
| 48 | whole C1 interval, with no condition on the extension outside it. -/ |
| 49 | theorem continuousOn_pathELength_left (g : RiemannianMetric n M) |
| 50 | {γ : ℝ → M} {a b : ℝ} (hab : a < b) |
| 51 | (hγ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 γ (Icc a b)) : |
| 52 | ContinuousOn (fun t => g.pathELength γ t b) (Icc a b) := by |
| 53 | have hint : IntegrableOn (M04.segmentPathSpeed g γ a b) (uIcc a b) := by |
| 54 | rw [uIcc_of_le hab.le] |
| 55 | exact (M04.continuousOn_segmentPathSpeed g hγ hab).integrableOn_Icc |
| 56 | have hcont := ENNReal.continuous_ofReal.comp_continuousOn |
| 57 | (intervalIntegral.continuousOn_primitive_interval_left hint) |
| 58 | rw [uIcc_of_le hab.le] at hcont |
| 59 | apply hcont.congr |
| 60 | intro t ht |
| 61 | exact pathELength_eq_integral_fixed_segment_speed g hγ ht.1 ht.2 le_rfl |
| 62 | |
| 63 | /-- Partial lengths beginning at the left endpoint are continuous on the |
| 64 | whole C1 interval (Claim 10.4's forward anchors). -/ |
| 65 | theorem continuousOn_pathELength_right (g : RiemannianMetric n M) |
| 66 | {γ : ℝ → M} {a b : ℝ} (hab : a < b) |
| 67 | (hγ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 γ (Icc a b)) : |
| 68 | ContinuousOn (fun t => g.pathELength γ a t) (Icc a b) := by |
| 69 | have hint : IntegrableOn (M04.segmentPathSpeed g γ a b) (uIcc a b) := by |
| 70 | rw [uIcc_of_le hab.le] |
| 71 | exact (M04.continuousOn_segmentPathSpeed g hγ hab).integrableOn_Icc |
| 72 | have hcont := ENNReal.continuous_ofReal.comp_continuousOn |
| 73 | (intervalIntegral.continuousOn_primitive_interval hint) |
| 74 | rw [uIcc_of_le hab.le] at hcont |
| 75 | apply hcont.congr |
| 76 | intro t ht |
| 77 | exact pathELength_eq_integral_fixed_segment_speed g hγ le_rfl ht.1 ht.2 |
| 78 | |
| 79 | /-- A prescribed positive length below the whole length determines an |
| 80 | interior backward anchor on the original path (Claim 10.4). -/ |
| 81 | theorem exists_pathELength_left_anchor (g : RiemannianMetric n M) |
| 82 | {γ : ℝ → M} {a b L : ℝ} (hab : a < b) |
| 83 | (hγ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 γ (Icc a b)) |
| 84 | (hL : 0 < L) (hroom : ENNReal.ofReal L < g.pathELength γ a b) : |
| 85 | ∃ t ∈ Ioo a b, g.pathELength γ t b = ENNReal.ofReal L := by |
| 86 | have hzero : g.pathELength γ b b = 0 := by |
| 87 | simp [RiemannianMetric.pathELength] |
| 88 | obtain ⟨t, ht, heq⟩ := intermediate_value_Icc' hab.le |
| 89 | (continuousOn_pathELength_left g hab hγ) |
| 90 | (show ENNReal.ofReal L ∈ Icc (g.pathELength γ b b) (g.pathELength γ a b) by |
| 91 | rw [hzero] |
| 92 | exact ⟨bot_le, hroom.le⟩) |
| 93 | change g.pathELength γ t b = ENNReal.ofReal L at heq |
| 94 | refine ⟨t, ⟨lt_of_le_of_ne ht.1 ?_, lt_of_le_of_ne ht.2 ?_⟩, heq⟩ |
| 95 | · intro h |
| 96 | subst t |
| 97 | exact (ne_of_lt hroom) heq.symm |
| 98 | · intro h |
| 99 | subst t |
| 100 | rw [hzero] at heq |
| 101 | exact (ENNReal.ofReal_pos.mpr hL).ne' heq.symm |
| 102 | |
| 103 | /-- A prescribed positive length below the whole length determines an |
| 104 | interior forward anchor on the original path (Claim 10.4). -/ |
| 105 | theorem exists_pathELength_right_anchor (g : RiemannianMetric n M) |
| 106 | {γ : ℝ → M} {a b L : ℝ} (hab : a < b) |
| 107 | (hγ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) 1 γ (Icc a b)) |
| 108 | (hL : 0 < L) (hroom : ENNReal.ofReal L < g.pathELength γ a b) : |
| 109 | ∃ t ∈ Ioo a b, g.pathELength γ a t = ENNReal.ofReal L := by |
| 110 | have hzero : g.pathELength γ a a = 0 := by |
| 111 | simp [RiemannianMetric.pathELength] |
| 112 | obtain ⟨t, ht, heq⟩ := intermediate_value_Icc hab.le |
| 113 | (continuousOn_pathELength_right g hab hγ) |
| 114 | (show ENNReal.ofReal L ∈ Icc (g.pathELength γ a a) (g.pathELength γ a b) by |
| 115 | rw [hzero] |
| 116 | exact ⟨bot_le, hroom.le⟩) |
| 117 | change g.pathELength γ a t = ENNReal.ofReal L at heq |
| 118 | refine ⟨t, ⟨lt_of_le_of_ne ht.1 ?_, lt_of_le_of_ne ht.2 ?_⟩, heq⟩ |
| 119 | · intro h |
| 120 | subst t |
| 121 | rw [hzero] at heq |
| 122 | exact (ENNReal.ofReal_pos.mpr hL).ne' heq.symm |
| 123 | · intro h |
| 124 | subst t |
| 125 | exact (ne_of_lt hroom) heq.symm |
| 126 | |
| 127 | end PoincareMT.M28 |