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.ReducedGeometry.ReducedLength.Minimum.Variational.Action |
| 2 | |
| 3 | /-! |
| 4 | # Backward paths from square-root curves |
| 5 | |
| 6 | The transformed action proves integrability before the admissible path is |
| 7 | constructed. The C1 hypothesis is only needed on the open interval. |
| 8 | |
| 9 | Adapted from Mapher `Proofs/M08/SqrtRecovery.lean` and `SquareEnergy.lean`, |
| 10 | commit `49331b7d7ecad38f53e4300c3b35d6a84b2cc648`. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set Filter Topology MeasureTheory |
| 17 | open scoped Manifold ContDiff Bundle intervalIntegral |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.ReducedLengthMinimum.Variational |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | |
| 26 | theorem sq_mem_backward_interior {a b s : ℝ} (_ha : 0 ≤ a) |
| 27 | (hs : s ∈ Ioo (Real.sqrt a) (Real.sqrt b)) : |
| 28 | 0 < s ∧ s ^ 2 ∈ Ioo a b := by |
| 29 | have hpos : 0 < s := (Real.sqrt_nonneg a).trans_lt hs.1 |
| 30 | exact ⟨hpos, Real.lt_sq_of_sqrt_lt hs.1, (Real.lt_sqrt hpos.le).mp hs.2⟩ |
| 31 | |
| 32 | theorem intervalIntegrable_of_square_transform {a b : ℝ} (ha : 0 ≤ a) (hab : a ≤ b) |
| 33 | {g r : ℝ → ℝ} |
| 34 | (hr : IntervalIntegrable r volume (Real.sqrt a) (Real.sqrt b)) |
| 35 | (heq : ∀ s ∈ Ioo (Real.sqrt a) (Real.sqrt b), r s = g (s ^ 2) * (2 * s)) : |
| 36 | IntervalIntegrable g volume a b := by |
| 37 | have hsqrt : Real.sqrt a ≤ Real.sqrt b := Real.sqrt_le_sqrt hab |
| 38 | have hnonneg : ∀ s ∈ uIoo (Real.sqrt a) (Real.sqrt b), 0 ≤ 2 * s := by |
| 39 | intro s hs |
| 40 | rw [uIoo_of_le hsqrt] at hs |
| 41 | exact mul_nonneg (by norm_num) ((Real.sqrt_nonneg a).trans hs.1.le) |
| 42 | have hiff := intervalIntegral.integrable_comp_mul_deriv_iff_of_deriv_nonneg |
| 43 | (f := fun s : ℝ => s ^ 2) (f' := fun s => 2 * s) (g := g) |
| 44 | (continuous_id.pow 2).continuousOn (fun s _ => by simpa using hasDerivAt_pow 2 s) |
| 45 | hnonneg |
| 46 | have htrans : IntervalIntegrable (fun s => g (s ^ 2) * (2 * s)) volume |
| 47 | (Real.sqrt a) (Real.sqrt b) := by |
| 48 | apply hr.congr_uIoo |
| 49 | intro s hs |
| 50 | rw [uIoo_of_le hsqrt] at hs |
| 51 | exact heq s hs |
| 52 | simpa only [Real.sq_sqrt ha, Real.sq_sqrt (ha.trans hab)] using hiff.mp htrans |
| 53 | |
| 54 | theorem backwardLLength_eq_transformed {J : Set ℝ} {F : RicciFlow n M J} |
| 55 | {T a b : ℝ} (p : BackwardTimePath F T a b) : |
| 56 | backwardLLength F T a b p.curve = |
| 57 | ∫ s in Real.sqrt a..Real.sqrt b, |
| 58 | backwardLIntegrand F T p.curve (s ^ 2) * (2 * s) := by |
| 59 | have hle := Real.sqrt_le_sqrt p.ordered.le |
| 60 | have hsub := intervalIntegral.integral_comp_mul_deriv_of_deriv_nonneg |
| 61 | (a := Real.sqrt a) (b := Real.sqrt b) |
| 62 | (f := fun s : ℝ => s ^ 2) (f' := fun s => 2 * s) |
| 63 | (g := backwardLIntegrand F T p.curve) (continuous_id.pow 2).continuousOn |
| 64 | (fun s _ => by simpa using hasDerivAt_pow 2 s) |
| 65 | (fun s hs => by |
| 66 | rw [min_eq_left hle, max_eq_right hle] at hs |
| 67 | exact mul_nonneg (by norm_num) ((Real.sqrt_nonneg a).trans hs.1.le)) |
| 68 | simpa only [Real.sq_sqrt p.nonnegative, |
| 69 | Real.sq_sqrt (p.nonnegative.trans p.ordered.le), Function.comp_def, |
| 70 | backwardLLength] using hsub.symm |
| 71 | |
| 72 | omit [IsManifold (𝓡 n) ∞ M] in |
| 73 | theorem sqrtPullback_regular {a b : ℝ} (ha : 0 ≤ a) (α : ℝ → M) |
| 74 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) 1 α (Ioo (Real.sqrt a) (Real.sqrt b))) : |
| 75 | ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) 1 (fun τ ↦ α (Real.sqrt τ)) (Ioo a b) := by |
| 76 | have hsqrt : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ)) 1 Real.sqrt (Ioo a b) := by |
| 77 | intro τ hτ |
| 78 | exact (Real.contDiffAt_sqrt (ne_of_gt (ha.trans_lt hτ.1))).contMDiffAt.contMDiffWithinAt |
| 79 | exact hα.comp hsqrt (fun τ hτ ↦ |
| 80 | ⟨Real.sqrt_lt_sqrt ha hτ.1, Real.sqrt_lt_sqrt (ha.trans hτ.1.le) hτ.2⟩) |
| 81 | |
| 82 | theorem regularizedLIntegrand_sqrtPullback {J : Set ℝ} (F : RicciFlow n M J) |
| 83 | (T : ℝ) {a b : ℝ} (ha : 0 ≤ a) (α : ℝ → M) |
| 84 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) 1 α (Ioo (Real.sqrt a) (Real.sqrt b))) |
| 85 | {s : ℝ} (hs : s ∈ Ioo (Real.sqrt a) (Real.sqrt b)) : |
| 86 | regularizedLIntegrand F T α s = |
| 87 | backwardLIntegrand F T (fun τ ↦ α (Real.sqrt τ)) (s ^ 2) * (2 * s) := by |
| 88 | let δ : ℝ → M := fun τ ↦ α (Real.sqrt τ) |
| 89 | have hpos := (sq_mem_backward_interior ha hs).1 |
| 90 | have hτ := (sq_mem_backward_interior ha hs).2 |
| 91 | have hδ := ((sqrtPullback_regular ha α hα) (s ^ 2) hτ).contMDiffAt |
| 92 | (isOpen_Ioo.mem_nhds hτ) |
| 93 | have hnear : α =ᶠ[𝓝 s] fun r ↦ δ (r ^ 2) := by |
| 94 | filter_upwards [Ioi_mem_nhds hpos] with r hr |
| 95 | simp only [δ, Real.sqrt_sq hr.le] |
| 96 | have hvel : curveVelocity (n := n) α s = (2 * s) • curveVelocity (n := n) δ (s ^ 2) := by |
| 97 | have heq : curveVelocity (n := n) α s = curveVelocity (n := n) (fun r ↦ δ (r ^ 2)) s := by |
| 98 | unfold curveVelocity |
| 99 | rw [hnear.mfderiv_eq] |
| 100 | rfl |
| 101 | exact heq.trans (curveVelocity_comp_sq (hδ.mdifferentiableAt one_ne_zero)) |
| 102 | change regularizedLIntegrand F T α s = backwardLIntegrand F T δ (s ^ 2) * (2 * s) |
| 103 | unfold regularizedLIntegrand backwardLIntegrand |
| 104 | rw [Real.sqrt_sq hpos.le, hnear.eq_of_nhds] |
| 105 | simp only [hvel, map_smul, smul_apply, smul_eq_mul] |
| 106 | ring |
| 107 | |
| 108 | noncomputable def backwardPathOfSqrt {J : Set ℝ} (F : RicciFlow n M J) |
| 109 | (T a b : ℝ) (ha : 0 ≤ a) (hab : a < b) (hT : T ∈ J) |
| 110 | (htime : ∀ τ ∈ Icc a b, T - τ ∈ J) |
| 111 | (α : ℝ → M) (hcont : ContinuousOn α (Icc (Real.sqrt a) (Real.sqrt b))) |
| 112 | (hreg : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) 1 α (Ioo (Real.sqrt a) (Real.sqrt b))) |
| 113 | (hint : IntervalIntegrable (regularizedLIntegrand F T α) volume (Real.sqrt a) (Real.sqrt b)) : |
| 114 | BackwardTimePath F T a b where |
| 115 | curve := fun τ ↦ α (Real.sqrt τ) |
| 116 | nonnegative := ha |
| 117 | ordered := hab |
| 118 | terminal_mem := hT |
| 119 | time_mem := htime |
| 120 | continuous := hcont.comp Real.continuous_sqrt.continuousOn |
| 121 | (fun _ hτ ↦ ⟨Real.sqrt_le_sqrt hτ.1, Real.sqrt_le_sqrt hτ.2⟩) |
| 122 | regular := sqrtPullback_regular ha α hreg |
| 123 | l_integrable := intervalIntegrable_of_square_transform ha hab.le hint |
| 124 | (fun _ hs ↦ regularizedLIntegrand_sqrtPullback F T ha α hreg hs) |
| 125 | |
| 126 | theorem backwardPathOfSqrt_action {J : Set ℝ} (F : RicciFlow n M J) |
| 127 | (T a b : ℝ) (ha : 0 ≤ a) (hab : a < b) (hT : T ∈ J) |
| 128 | (htime : ∀ τ ∈ Icc a b, T - τ ∈ J) |
| 129 | (α : ℝ → M) (hcont : ContinuousOn α (Icc (Real.sqrt a) (Real.sqrt b))) |
| 130 | (hreg : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) 1 α (Ioo (Real.sqrt a) (Real.sqrt b))) |
| 131 | (hint : IntervalIntegrable (regularizedLIntegrand F T α) volume (Real.sqrt a) (Real.sqrt b)) : |
| 132 | backwardLLength F T a b (backwardPathOfSqrt F T a b ha hab hT htime α hcont hreg hint).curve = |
| 133 | (∫ s in Real.sqrt a..Real.sqrt b, regularizedLIntegrand F T α s) := by |
| 134 | rw [backwardLLength_eq_transformed] |
| 135 | apply intervalIntegral.integral_congr_Ioo_of_le (Real.sqrt_le_sqrt hab.le) |
| 136 | intro s hs |
| 137 | exact (regularizedLIntegrand_sqrtPullback F T ha α hreg hs).symm |
| 138 | |
| 139 | end PoincareMT.ReducedLengthMinimum.Variational |