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.ReducedGeometry.Variation.AdaptedFields.AdaptedScalarPrimitive |
| 2 | |
| 3 | /-! |
| 4 | # The actual Harnack term in the adapted index trace |
| 5 | |
| 6 | Square-time velocity transport converts the frozen Harnack density |
| 7 | to a nonsingular weighted polynomial expression. Its sum with the |
| 8 | scalar boundary derivative is exactly the nonconstant index trace. |
| 9 | Morgan-Tian equation (6.15) and Proposition 6.43, pp. 127-128. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set |
| 15 | open scoped Manifold ContDiff Bundle |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.M14 |
| 20 | |
| 21 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 22 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 23 | |
| 24 | private theorem scalar_transport_smul {q r : G.Point} (h : q = r) |
| 25 | (v : G.Horizontal r) (c : ℝ) : |
| 26 | M14HorizontalScalarDifferential G q (h.symm ▸ (c • v)).val = |
| 27 | c * M14HorizontalScalarDifferential G r v.val := by |
| 28 | cases h |
| 29 | change M14HorizontalScalarDifferential G q (c • v.val) = _ |
| 30 | rw [map_smul, smul_eq_mul] |
| 31 | |
| 32 | private theorem ricci_transport_smul (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 33 | {q r : G.Point} (h : q = r) (v : G.Horizontal r) (c : ℝ) : |
| 34 | horizontalRicci G.leafwise q (h.symm ▸ (c • v)) (h.symm ▸ (c • v)) = |
| 35 | c ^ 2 * horizontalRicci G.leafwise r v v := by |
| 36 | cases h |
| 37 | rw [horizontalRicci_smul_left hM12, horizontalRicci_smul_right hM12] |
| 38 | ring |
| 39 | |
| 40 | variable {T a b : ℝ} {x y : G.Point} {p : M14BackwardPath G T a b x y} |
| 41 | |
| 42 | /-- The actual shifted Harnack density in square time has the exact |
| 43 | scalar and Ricci polynomial expression, equation (6.15), p. 127. -/ |
| 44 | theorem squareRoot_shiftedHarnackDensity_eq |
| 45 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) (R : M14SquareRootPath G p) |
| 46 | {s : ℝ} (hs : s ∈ Ioo (Real.sqrt a) (Real.sqrt b)) : |
| 47 | 2 * s ^ 2 * (s - Real.sqrt a) ^ 2 * M14GeneralizedHarnackDensity G p |
| 48 | (fun t => M14BackwardTimeDerivative G (horizontalScalarCurvature G.leafwise) |
| 49 | (p.curve t)) (s ^ 2) = |
| 50 | -(2 * s ^ 2 * (s - Real.sqrt a) ^ 2) * |
| 51 | M14BackwardTimeDerivative G (horizontalScalarCurvature G.leafwise) (R.curve s) - |
| 52 | 2 * (s - Real.sqrt a) ^ 2 * horizontalScalarCurvature G.leafwise (R.curve s) - |
| 53 | 2 * s * (s - Real.sqrt a) ^ 2 * |
| 54 | M14HorizontalScalarDifferential G (R.curve s) (R.horizontal_velocity s).val + |
| 55 | (s - Real.sqrt a) ^ 2 * horizontalRicci G.leafwise (R.curve s) |
| 56 | (R.horizontal_velocity s) (R.horizontal_velocity s) := by |
| 57 | have hsC : s ∈ M14SqrtParameterInterval a b := Ioo_subset_Icc_self hs |
| 58 | have hbase := R.agrees s hsC |
| 59 | have hscalar : M14HorizontalScalarDifferential G (R.curve s) (R.horizontal_velocity s).val = |
| 60 | (2 * s) * M14HorizontalScalarDifferential G (p.curve (s ^ 2)) |
| 61 | (p.horizontal_velocity (s ^ 2)).val := by |
| 62 | rw [R.horizontal_agrees s hs] |
| 63 | exact scalar_transport_smul hbase _ _ |
| 64 | have hricci : horizontalRicci G.leafwise (R.curve s) |
| 65 | (R.horizontal_velocity s) (R.horizontal_velocity s) = |
| 66 | (2 * s) ^ 2 * horizontalRicci G.leafwise (p.curve (s ^ 2)) |
| 67 | (p.horizontal_velocity (s ^ 2)) (p.horizontal_velocity (s ^ 2)) := by |
| 68 | rw [R.horizontal_agrees s hs] |
| 69 | exact ricci_transport_smul hM12 hbase _ _ |
| 70 | rw [hscalar, hricci, hbase] |
| 71 | unfold M14GeneralizedHarnackDensity M14HorizontalScalarDifferential |
| 72 | have hs0 : s ≠ 0 := ((Real.sqrt_nonneg a).trans_lt hs.1).ne' |
| 73 | field_simp [hs0] |
| 74 | |
| 75 | /-- The exact weighted Harnack density plus the boundary primitive |
| 76 | derivative is the nonconstant adapted trace, Proposition 6.43, |
| 77 | pp. 127-128. -/ |
| 78 | theorem adaptedScalarPrimitive_add_shiftedHarnack |
| 79 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) (R : M14SquareRootPath G p) |
| 80 | {s : ℝ} (hs : s ∈ Ioo (Real.sqrt a) (Real.sqrt b)) : |
| 81 | derivWithin (adaptedScalarPrimitive R) (M14SqrtParameterInterval a b) s + |
| 82 | 2 * s ^ 2 * (s - Real.sqrt a) ^ 2 * M14GeneralizedHarnackDensity G p |
| 83 | (fun t => M14BackwardTimeDerivative G (horizontalScalarCurvature G.leafwise) |
| 84 | (p.curve t)) (s ^ 2) = |
| 85 | 4 * s * (s - Real.sqrt a) * horizontalScalarCurvature G.leafwise (R.curve s) + |
| 86 | 2 * s ^ 2 * (s - Real.sqrt a) ^ 2 * |
| 87 | M14BackwardTimeDerivative G (horizontalScalarCurvature G.leafwise) (R.curve s) + |
| 88 | (s - Real.sqrt a) ^ 2 * horizontalRicci G.leafwise (R.curve s) |
| 89 | (R.horizontal_velocity s) (R.horizontal_velocity s) := by |
| 90 | rw [adaptedScalarPrimitive_derivWithin hM12 R (Ioo_subset_Icc_self hs), |
| 91 | squareRoot_shiftedHarnackDensity_eq hM12 R hs] |
| 92 | ring |
| 93 | |
| 94 | end PoincareMT.M14 |