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.Variation.Index.AdaptedIndexTrace |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Tensor.HarnackIntegral |
| 3 | |
| 4 | /-! |
| 5 | # Integration of the full adapted index trace |
| 6 | |
| 7 | The actual scalar and square-energy evolutions express the trace using a |
| 8 | smooth primitive. Its boundary values recover the frozen Harnack integral. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option maxSynthPendingDepth 3 |
| 13 | |
| 14 | open scoped Manifold ContDiff Bundle Topology intervalIntegral BigOperators |
| 15 | |
| 16 | universe u |
| 17 | |
| 18 | namespace PoincareMT.ReducedLength |
| 19 | |
| 20 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 21 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 22 | [IsManifold (𝓡 n) ∞ M] |
| 23 | |
| 24 | noncomputable def adaptedScalarIndexDensity {J : Set ℝ} (F : RicciFlow n M J) |
| 25 | (T : ℝ) (α : ℝ → M) (c s : ℝ) : ℝ := |
| 26 | let D := F.connection (T - s ^ 2) |
| 27 | (n : ℝ) / c ^ 2 - 4 * s ^ 2 / c ^ 2 * D.scalarCurvature (α s) + |
| 28 | s ^ 2 / c ^ 2 * (4 * s ^ 2 * D.ricciNormSq (α s) + |
| 29 | 2 * s ^ 2 * D.laplacian D.scalarCurvature (α s) - |
| 30 | D.ricci (α s) (curveVelocity α s) (curveVelocity α s)) |
| 31 | |
| 32 | set_option backward.isDefEq.respectTransparency false in |
| 33 | theorem pointwiseSecondVariationDensity_linear_weight_trace {J : Set ℝ} |
| 34 | (F : RicciFlow n M J) (hM04 : RicciFlowCurvatureTheory.{u}) |
| 35 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 36 | (α : ℝ → M) (c : ℝ) (hc : 0 < c) (s : ℝ) |
| 37 | (hs : s ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) : |
| 38 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 39 | ⟨(F.metric (T - s ^ 2)).toRiemannianMetric⟩ |
| 40 | ∀ e : OrthonormalBasis (Fin n) ℝ (TangentSpace (𝓡 n) (α s)), |
| 41 | (∑ i, pointwiseSecondVariationDensity F T (α s) s (curveVelocity α s) |
| 42 | ((s / c) • e i) ((1 / c : ℝ) • e i - (2 * s * (s / c)) • |
| 43 | ricciOperator hM04 (F.connection (T - s ^ 2)) (α s) (e i))) = |
| 44 | adaptedScalarIndexDensity F T α c s := by |
| 45 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 46 | ⟨(F.metric (T - s ^ 2)).toRiemannianMetric⟩ |
| 47 | intro e |
| 48 | rw [pointwiseSecondVariationDensity_adapted_trace F hM04 T b hb hwindow |
| 49 | (α s) s hs (curveVelocity α s) (s / c) (1 / c) e] |
| 50 | unfold adaptedScalarIndexDensity |
| 51 | field_simp [hc.ne'] <;> ring |
| 52 | |
| 53 | set_option maxHeartbeats 1000000 in |
| 54 | -- Scalar, energy and action identities are normalized together under the same family. |
| 55 | set_option backward.isDefEq.respectTransparency false in |
| 56 | theorem lExponentialFamily_adaptedScalarIndex_integral {J : Set ℝ} {F : RicciFlow n M J} |
| 57 | (hM04 : RicciFlowCurvatureTheory.{u}) {T τmax : ℝ} |
| 58 | (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) |
| 59 | {p : M} (A : LExponentialFamily F T τmax p) |
| 60 | (Z : TangentSpace (𝓡 n) p) (b : ℝ) (hb : 0 < b) (hmax : b < τmax) : |
| 61 | IntervalIntegrable (adaptedScalarIndexDensity F T (A.squareFamily Z) (Real.sqrt b)) |
| 62 | MeasureTheory.volume 0 (Real.sqrt b) ∧ |
| 63 | (∫ s in 0..Real.sqrt b, adaptedScalarIndexDensity F T (A.squareFamily Z) (Real.sqrt b) s) = |
| 64 | (n : ℝ) / Real.sqrt b - 2 * Real.sqrt b * |
| 65 | (F.connection (T - (Real.sqrt b) ^ 2)).scalarCurvature (A.squareFamily Z (Real.sqrt b)) - |
| 66 | reducedHarnackIntegral F T (A.gamma Z) |
| 67 | (backwardScalarEvolutionAlong F T (A.gamma Z)) b / (Real.sqrt b) ^ 2 := by |
| 68 | let c := Real.sqrt b |
| 69 | have hc : 0 < c := Real.sqrt_pos.mpr hb |
| 70 | let U := ((fun s : ℝ ↦ (Z, s)) ⁻¹' A.squareDomain) ∩ |
| 71 | Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax) |
| 72 | have hU : IsOpen U := (A.square_open.preimage |
| 73 | (continuous_const.prodMk continuous_id)).inter isOpen_Ioo |
| 74 | have hKU : Set.Icc 0 c ⊆ U := by |
| 75 | intro s hs |
| 76 | have hsmax := hs.2.trans_lt (Real.sqrt_lt_sqrt hb.le hmax) |
| 77 | exact ⟨A.square_contains ⟨Set.mem_univ _, hs.1, hsmax⟩, |
| 78 | (neg_lt_zero.mpr (Real.sqrt_pos.mpr hτmax)).trans_le hs.1, hsmax⟩ |
| 79 | have hα := (lExponentialFamily_squareSlice_contMDiffOn A Z).mono |
| 80 | (show U ⊆ (fun s : ℝ ↦ (Z, s)) ⁻¹' A.squareDomain from Set.inter_subset_left) |
| 81 | let S : ℝ → ℝ := fun s ↦ (F.connection (T - s ^ 2)).scalarCurvature (A.squareFamily Z s) |
| 82 | let E := regularizedCurveEnergy F T (A.squareFamily Z) |
| 83 | have hS : ContDiffOn ℝ ∞ S U := |
| 84 | ((squareTime_scalar_smooth F hM04 T τmax hτmax hwindow).comp |
| 85 | (contMDiffOn_id.prodMk hα) (fun _ hs ↦ ⟨hs.2, Set.mem_univ _⟩)).contDiffOn |
| 86 | have hE : ContDiffOn ℝ ∞ E U := regularizedCurveEnergy_contDiffOn F T τmax hτmax hwindow |
| 87 | (A.squareFamily Z) U hU hα Set.inter_subset_right |
| 88 | let Q : ℝ → ℝ := fun s ↦ -(s ^ 3 * S s) + s * E s / 4 |
| 89 | let D : ℝ → ℝ := fun s ↦ 2 * s ^ 2 * S s + (1 / 2 : ℝ) * E s |
| 90 | have hQ : ContDiffOn ℝ ∞ Q U := |
| 91 | ((contDiffOn_id.pow 3).mul hS).neg.add ((contDiffOn_id.mul hE).div_const 4) |
| 92 | have hD : ContDiffOn ℝ ∞ D U := |
| 93 | ((contDiffOn_const.mul (contDiffOn_id.pow 2)).mul hS).add (contDiffOn_const.mul hE) |
| 94 | have hQi : IntervalIntegrable (deriv Q) MeasureTheory.volume 0 c := |
| 95 | ((hQ.deriv_of_isOpen hU (m := ∞) (by simp)).continuousOn.mono hKU).intervalIntegrable_of_Icc |
| 96 | hc.le |
| 97 | have hDi : IntervalIntegrable D MeasureTheory.volume 0 c := |
| 98 | (hD.continuousOn.mono hKU).intervalIntegrable_of_Icc hc.le |
| 99 | have hQder (s : ℝ) (hs : s ∈ Set.Ioo 0 c) : |
| 100 | deriv Q s = -(3 * s ^ 2 * S s + s ^ 3 * deriv S s) + |
| 101 | (E s + s * deriv E s) / 4 := by |
| 102 | have hSd := ((hS.contDiffAt (hU.mem_nhds (hKU (Set.Ioo_subset_Icc_self hs)))).differentiableAt |
| 103 | (by simp)).hasDerivAt |
| 104 | have hEd := ((hE.contDiffAt (hU.mem_nhds (hKU (Set.Ioo_subset_Icc_self hs)))).differentiableAt |
| 105 | (by simp)).hasDerivAt |
| 106 | convert! ((((hasDerivAt_pow 3 s).mul hSd).neg).add |
| 107 | (((hasDerivAt_id s).mul hEd).div_const 4)).deriv using 1 <;> |
| 108 | simp only [Q, Nat.cast_ofNat, Nat.reduceSub, one_mul, id_eq] |
| 109 | let I := adaptedScalarIndexDensity F T (A.squareFamily Z) c |
| 110 | have hrewrite (s : ℝ) (hs : s ∈ Set.Ioo 0 c) : |
| 111 | I s = (n : ℝ) / c ^ 2 + (deriv Q s - D s / 2) / c ^ 2 := by |
| 112 | have hαd := (hα.contMDiffAt (hU.mem_nhds (hKU (Set.Ioo_subset_Icc_self hs)))).mdifferentiableAt |
| 113 | (by simp) |
| 114 | have hSd := (squareTime_scalar_along_hasDerivAt F hM04 T τmax b hb hmax hwindow |
| 115 | (A.squareFamily Z) s hs hαd).deriv |
| 116 | have hEd := (lExponentialFamily_squareEnergy_hasDerivAt hM04 hτmax hwindow |
| 117 | A Z b hb hmax s (Set.Ioo_subset_Icc_self hs)).deriv |
| 118 | rw [hQder s hs] |
| 119 | dsimp only [S, E, D, I, adaptedScalarIndexDensity] |
| 120 | rw [hSd, hEd] |
| 121 | ring |
| 122 | have hRi : IntervalIntegrable |
| 123 | (fun s ↦ (n : ℝ) / c ^ 2 + (deriv Q s - D s / 2) / c ^ 2) |
| 124 | MeasureTheory.volume 0 c := intervalIntegrable_const.add ((hQi.sub (hDi.div_const 2)).div_const _) |
| 125 | have hIi : IntervalIntegrable I MeasureTheory.volume 0 c := hRi.congr_uIoo (by |
| 126 | intro s hs |
| 127 | have hs' : s ∈ Set.Ioo 0 c := by simpa only [Set.uIoo_of_le hc.le] using hs |
| 128 | exact (hrewrite s hs').symm) |
| 129 | have hFTC : (∫ s in 0..c, deriv Q s) = Q c - Q 0 := by |
| 130 | apply intervalIntegral.integral_eq_sub_of_hasDerivAt _ hQi |
| 131 | intro s hs |
| 132 | have hs' : s ∈ Set.Icc 0 c := by simpa only [Set.uIcc_of_le hc.le] using hs |
| 133 | exact ((hQ.contDiffAt (hU.mem_nhds (hKU hs'))).differentiableAt (by simp)).hasDerivAt |
| 134 | have hQ0 : Q 0 = 0 := by simp [Q] |
| 135 | have haction : (∫ s in 0..c, D s) = A.action Z b := |
| 136 | (lExponentialFamily_action_square_eq A Z b hb hmax).symm |
| 137 | refine ⟨hIi, ?_⟩ |
| 138 | change (∫ s in 0..c, I s) = (n : ℝ) / c - 2 * c * S c - _ / c ^ 2 |
| 139 | calc |
| 140 | (∫ s in 0..c, I s) = |
| 141 | ∫ s in 0..c, ((n : ℝ) / c ^ 2 + (deriv Q s - D s / 2) / c ^ 2) := |
| 142 | intervalIntegral.integral_congr_Ioo_of_le hc.le hrewrite |
| 143 | _ = c * ((n : ℝ) / c ^ 2) + (Q c - A.action Z b / 2) / c ^ 2 := by |
| 144 | rw [intervalIntegral.integral_add intervalIntegrable_const |
| 145 | ((hQi.sub (hDi.div_const 2)).div_const _), intervalIntegral.integral_const, |
| 146 | intervalIntegral.integral_div, |
| 147 | intervalIntegral.integral_sub hQi (hDi.div_const 2), intervalIntegral.integral_div, |
| 148 | hFTC, haction, hQ0, sub_zero] |
| 149 | simp only [sub_zero, smul_eq_mul] |
| 150 | _ = (n : ℝ) / c - 2 * c * S c - |
| 151 | reducedHarnackIntegral F T (A.gamma Z) |
| 152 | (backwardScalarEvolutionAlong F T (A.gamma Z)) b / c ^ 2 := by |
| 153 | rw [lExponentialFamily_harnack_integral_square_eq hM04 hτmax hwindow A Z b hb hmax] |
| 154 | dsimp only [Q, S, E, c] |
| 155 | field_simp [hc.ne'] |
| 156 | ring |
| 157 | |
| 158 | end PoincareMT.ReducedLength |