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.Fields.InitialVariationFields |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Exponential.FamilySquareVelocity |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Calculus.VelocityRestriction |
| 4 | |
| 5 | /-! |
| 6 | # The actual boundary term for initial-vector variation |
| 7 | |
| 8 | The initial variation field vanishes. At the terminal endpoint, the |
| 9 | within velocity is the smooth square velocity and the parameter field |
| 10 | is the actual slice differential, at the same metric basepoint. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option maxSynthPendingDepth 3 |
| 15 | set_option maxHeartbeats 800000 |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.ReducedLength |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 25 | [IsManifold (𝓡 n) ∞ M] |
| 26 | {J : Set ℝ} {F : RicciFlow n M J} {T τmax : ℝ} {p : M} |
| 27 | |
| 28 | local notation "Q" => EuclideanSpace ℝ (Fin n) |
| 29 | |
| 30 | set_option backward.isDefEq.respectTransparency false in |
| 31 | theorem initialVectorVariation_boundaryTerm (A : LExponentialFamily F T τmax p) |
| 32 | (Z W : TangentSpace (𝓡 n) p) (b : ℝ) (hb : 0 < b) (hmax : b < τmax) : |
| 33 | firstVariationBoundaryTerm (initialVectorVariation A Z W b hb hmax).toLVariation = |
| 34 | 2 * Real.sqrt b * (F.metric (T - b)).inner (A.gamma Z b) |
| 35 | (curveVelocity (n := n) (A.gamma Z) b) (A.sliceDifferential Z b W) := by |
| 36 | let V := (initialVectorVariation A Z W b hb hmax).toLVariation |
| 37 | let K := sqrtParameterInterval 0 b |
| 38 | have hbase : V.baseSquareCurve = A.squareFamily Z := |
| 39 | initialVectorVariation_baseSquareCurve A Z W b hb hmax |
| 40 | have hroot : 0 < Real.sqrt b := Real.sqrt_pos.mpr hb |
| 41 | have hrootmax : Real.sqrt b < Real.sqrt τmax := Real.sqrt_lt_sqrt hb.le hmax |
| 42 | have hK : K = Set.Icc 0 (Real.sqrt b) := by simp [K, sqrtParameterInterval] |
| 43 | have hKdiff : UniqueDiffOn ℝ K := hK ▸ uniqueDiffOn_Icc hroot |
| 44 | have hend : Real.sqrt b ∈ K := by rw [hK]; exact ⟨hroot.le, le_rfl⟩ |
| 45 | have hdiff : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) V.baseSquareCurve (Real.sqrt b) := by |
| 46 | rw [hbase] |
| 47 | exact (lExponentialFamily_squareSlice_contMDiffAt A Z (Real.sqrt b) |
| 48 | ⟨hroot.le, hrootmax⟩).mdifferentiableAt (by simp) |
| 49 | have hwithin := curveVelocityWithin_eq_curveVelocity V.baseSquareCurve K (Real.sqrt b) |
| 50 | (hKdiff _ hend) hdiff |
| 51 | have hvbase := congrArg (fun α : ℝ → M ↦ (curveVelocity (n := n) α (Real.sqrt b) : Q)) hbase |
| 52 | have hvsquare := lExponentialFamily_square_velocity_eq A Z (Real.sqrt b) ⟨hroot, hrootmax⟩ |
| 53 | have hvsq := congrArg (fun t : ℝ ↦ (curveVelocity (n := n) (A.gamma Z) t : Q)) |
| 54 | (Real.sq_sqrt hb.le) |
| 55 | have hv : (curveVelocityWithin (n := n) V.baseSquareCurve K (Real.sqrt b) : Q) = |
| 56 | (2 * Real.sqrt b) • curveVelocity (n := n) (A.gamma Z) b := |
| 57 | hwithin.trans (hvbase.trans (hvsquare.trans |
| 58 | (congrArg (fun v : Q ↦ (2 * Real.sqrt b) • v) hvsq))) |
| 59 | have hx : V.baseSquareCurve (Real.sqrt b) = A.gamma Z b := by |
| 60 | apply (congrFun hbase (Real.sqrt b)).trans |
| 61 | simpa only [Real.sq_sqrt hb.le] using |
| 62 | A.square_agrees Z (Real.sqrt b) ⟨hroot.le, hrootmax⟩ |
| 63 | have hy : (squareVariationField V (Real.sqrt b) : Q) = A.sliceDifferential Z b W := |
| 64 | initialVectorVariation_squareField_terminal A Z W b hb hmax |
| 65 | have htriple : |
| 66 | (V.baseSquareCurve (Real.sqrt b), |
| 67 | ((curveVelocityWithin (n := n) V.baseSquareCurve K (Real.sqrt b) : Q), |
| 68 | (squareVariationField V (Real.sqrt b) : Q))) = |
| 69 | (A.gamma Z b, ((2 * Real.sqrt b) • curveVelocity (n := n) (A.gamma Z) b, |
| 70 | A.sliceDifferential Z b W)) := Prod.ext hx (Prod.ext hv hy) |
| 71 | have hvalue := congrArg (fun q : M × (Q × Q) ↦ |
| 72 | (F.metric (T - b)).inner q.1 q.2.1 q.2.2) htriple |
| 73 | have hlinear : (F.metric (T - b)).inner (A.gamma Z b) |
| 74 | ((2 * Real.sqrt b) • curveVelocity (n := n) (A.gamma Z) b) (A.sliceDifferential Z b W) = |
| 75 | 2 * Real.sqrt b * (F.metric (T - b)).inner (A.gamma Z b) |
| 76 | (curveVelocity (n := n) (A.gamma Z) b) (A.sliceDifferential Z b W) := by |
| 77 | simp only [map_smul, smul_apply, smul_eq_mul] |
| 78 | have hterminal : (F.metric (T - (Real.sqrt b) ^ 2)).inner (V.baseSquareCurve (Real.sqrt b)) |
| 79 | (curveVelocityWithin (n := n) V.baseSquareCurve K (Real.sqrt b)) |
| 80 | (squareVariationField V (Real.sqrt b)) = |
| 81 | 2 * Real.sqrt b * (F.metric (T - b)).inner (A.gamma Z b) |
| 82 | (curveVelocity (n := n) (A.gamma Z) b) (A.sliceDifferential Z b W) := by |
| 83 | rw [Real.sq_sqrt hb.le] |
| 84 | exact hvalue.trans hlinear |
| 85 | have hzero : (squareVariationField V 0 : Q) = 0 := |
| 86 | initialVectorVariation_squareField_zero A Z W b hb hmax |
| 87 | have hinitial : (F.metric (T - (0 : ℝ) ^ 2)).inner (V.baseSquareCurve 0) |
| 88 | (curveVelocityWithin (n := n) V.baseSquareCurve K 0) (squareVariationField V 0) = 0 := by |
| 89 | rw [hzero] |
| 90 | exact map_zero _ |
| 91 | change firstVariationBoundaryTerm V = _ |
| 92 | unfold firstVariationBoundaryTerm |
| 93 | dsimp only |
| 94 | rw [Real.sqrt_zero, hterminal, hinitial, sub_zero] |
| 95 | |
| 96 | end PoincareMT.ReducedLength |