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.CurveShortening.Connection.Regularity |
| 2 | import PoincareLib.Geometry.RicciFlow.CurveShortening.Evolution.SpeedEvolution |
| 3 | |
| 4 | /-! |
| 5 | # Actual normalized fields in the open cylinder |
| 6 | |
| 7 | The smooth unit tangent, normalized spatial differentiation and its time |
| 8 | derivative supply the field calculus in MT2015Correction Lemmas 0.1-0.2, |
| 9 | pp. 3-6. See `references/ricci-flow/mapher/curve-evolution/derivations/2026-09-20-normalized-fields.md`. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | |
| 15 | open Bundle Manifold Set Topology Filter |
| 16 | open scoped Manifold ContDiff Bundle |
| 17 | |
| 18 | noncomputable section |
| 19 | |
| 20 | namespace PoincareMT.M62 |
| 21 | |
| 22 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 24 | {a b : ℝ} (F : RicciFlow n M (Set.Icc a b)) (c : ℝ → ℝ → M) |
| 25 | |
| 26 | /-- Actual normalization preserves joint interior smoothness; |
| 27 | MT2007 Lemma 19.6, pp. 441-442, and correction Lemma 0.1, p. 3. -/ |
| 28 | theorem unitTangent_joint_contMDiff (hc : M62ShrinkingCurve F c) : |
| 29 | ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n).tangent ∞ |
| 30 | (fun z : ℝ × ℝ => (⟨c z.1 z.2, spatialUnitTangent F c z.2 z.1⟩ : |
| 31 | TangentBundle (𝓡 n) M)) (Set.univ ×ˢ Set.Ioo a b) := by |
| 32 | have hX := spatial_velocity_joint_contMDiff F c hc |
| 33 | have hv := ((speed_joint_contDiffOn F c hc).inv |
| 34 | (fun z hz => (speed_pos F c hc (Ioo_subset_Icc_self hz.2) z.1).ne')).contMDiffOn |
| 35 | have hopen : IsOpen (univ ×ˢ Ioo a b : Set (ℝ × ℝ)) := isOpen_univ.prod isOpen_Ioo |
| 36 | intro z hz |
| 37 | apply ContMDiffAt.contMDiffWithinAt |
| 38 | rw [Bundle.contMDiffAt_totalSpace] |
| 39 | refine ⟨hc.joint_smooth.contMDiffAt (hopen.mem_nhds hz), ?_⟩ |
| 40 | have hcoord := (hv.contMDiffAt (hopen.mem_nhds hz)).smul |
| 41 | (Bundle.contMDiffAt_totalSpace.mp (hX.contMDiffAt (hopen.mem_nhds hz))).2 |
| 42 | apply hcoord.congr_of_eventuallyEq |
| 43 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) (c z.1 z.2) |
| 44 | have hnear : ∀ᶠ w in 𝓝 z, c w.1 w.2 ∈ e.baseSet := |
| 45 | (hc.joint_smooth.contMDiffAt (hopen.mem_nhds hz)).continuousAt |
| 46 | (e.open_baseSet.mem_nhds (FiberBundle.mem_baseSet_trivializationAt' (c z.1 z.2))) |
| 47 | filter_upwards [hnear] with w hw |
| 48 | change (e ⟨c w.1 w.2, (curveSpeed F c w.2 w.1)⁻¹ • |
| 49 | curveVelocity (fun s => c s w.2) w.1⟩).2 = |
| 50 | (curveSpeed F c w.2 w.1)⁻¹ • (e ⟨c w.1 w.2, curveVelocity (fun s => c s w.2) w.1⟩).2 |
| 51 | simpa only [e.continuousLinearMapAt_apply_of_mem ℝ hw] using |
| 52 | (e.continuousLinearMapAt ℝ (c w.1 w.2)).map_smul |
| 53 | (curveSpeed F c w.2 w.1)⁻¹ (curveVelocity (fun s => c s w.2) w.1) |
| 54 | |
| 55 | /-- Normalized actual spatial differentiation preserves smooth along-map |
| 56 | fields; correction Lemma 0.2, pp. 4-6. -/ |
| 57 | theorem spatialDerivative_joint_contMDiff [T2Space M] |
| 58 | (hc : M62ShrinkingCurve F c) |
| 59 | (Y : (z : ℝ × ℝ) → TangentSpace (𝓡 n) (c z.1 z.2)) |
| 60 | (hY : ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n).tangent ∞ |
| 61 | (fun z => (⟨c z.1 z.2, Y z⟩ : TangentBundle (𝓡 n) M)) |
| 62 | (Set.univ ×ˢ Set.Ioo a b)) : |
| 63 | ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n).tangent ∞ |
| 64 | (fun z : ℝ × ℝ => (⟨c z.1 z.2, |
| 65 | m62SpatialDerivative F c z.2 (fun s => Y (s, z.2)) z.1⟩ : |
| 66 | TangentBundle (𝓡 n) M)) (Set.univ ×ˢ Set.Ioo a b) := by |
| 67 | have hopen : IsOpen (univ ×ˢ Ioo a b : Set (ℝ × ℝ)) := isOpen_univ.prod isOpen_Ioo |
| 68 | have hD := flow_pullback_space_smooth F c Y hopen |
| 69 | (fun z hz => by simpa only [interior_Icc] using hz.2) hc.joint_smooth hY |
| 70 | have hv := ((speed_joint_contDiffOn F c hc).inv |
| 71 | (fun z hz => (speed_pos F c hc (Ioo_subset_Icc_self hz.2) z.1).ne')).contMDiffOn |
| 72 | intro z hz |
| 73 | apply ContMDiffAt.contMDiffWithinAt |
| 74 | rw [Bundle.contMDiffAt_totalSpace] |
| 75 | refine ⟨hc.joint_smooth.contMDiffAt (hopen.mem_nhds hz), ?_⟩ |
| 76 | have hcoord := (hv.contMDiffAt (hopen.mem_nhds hz)).smul |
| 77 | (Bundle.contMDiffAt_totalSpace.mp (hD.contMDiffAt (hopen.mem_nhds hz))).2 |
| 78 | apply hcoord.congr_of_eventuallyEq |
| 79 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) (c z.1 z.2) |
| 80 | have hnear : ∀ᶠ w in 𝓝 z, c w.1 w.2 ∈ e.baseSet := |
| 81 | (hc.joint_smooth.contMDiffAt (hopen.mem_nhds hz)).continuousAt |
| 82 | (e.open_baseSet.mem_nhds (FiberBundle.mem_baseSet_trivializationAt' (c z.1 z.2))) |
| 83 | filter_upwards [hnear] with w hw |
| 84 | change (e ⟨c w.1 w.2, (curveSpeed F c w.2 w.1)⁻¹ • |
| 85 | rampHorizontalCovariantDerivative (F.connection w.2) (fun s => c s w.2) |
| 86 | (fun s => Y (s, w.2)) w.1⟩).2 = |
| 87 | (curveSpeed F c w.2 w.1)⁻¹ • (e ⟨c w.1 w.2, |
| 88 | rampHorizontalCovariantDerivative (F.connection w.2) (fun s => c s w.2) |
| 89 | (fun s => Y (s, w.2)) w.1⟩).2 |
| 90 | simpa only [e.continuousLinearMapAt_apply_of_mem ℝ hw] using |
| 91 | (e.continuousLinearMapAt ℝ (c w.1 w.2)).map_smul (curveSpeed F c w.2 w.1)⁻¹ |
| 92 | (rampHorizontalCovariantDerivative (F.connection w.2) (fun s => c s w.2) |
| 93 | (fun s => Y (s, w.2)) w.1) |
| 94 | |
| 95 | /-- The normalization coefficient is smooth by the actual positive speed |
| 96 | equation; correction Lemmas 0.1-0.2, pp. 3-6. -/ |
| 97 | theorem normalization_coefficient_contDiffOn (hc : M62ShrinkingCurve F c) : |
| 98 | ContDiffOn ℝ ∞ (fun z : ℝ × ℝ => |
| 99 | m62TangentRicci F c z.2 z.1 + m62CurvatureSquared F c z.2 z.1) |
| 100 | (Set.univ ×ˢ Set.Ioo a b) := by |
| 101 | let v : ℝ × ℝ → ℝ := fun z => curveSpeed F c z.2 z.1 |
| 102 | have hv : ContDiffOn ℝ ∞ v (univ ×ˢ Ioo a b) := speed_joint_contDiffOn F c hc |
| 103 | have hopen : IsOpen (univ ×ˢ Ioo a b : Set (ℝ × ℝ)) := isOpen_univ.prod isOpen_Ioo |
| 104 | have hvinv := hv.inv (fun z hz => (speed_pos F c hc (Ioo_subset_Icc_self hz.2) z.1).ne') |
| 105 | apply ((ReducedLengthMinimum.Variation.Geometry.coordinatePartialU_contDiffOn hopen v hv).neg.mul hvinv).congr |
| 106 | intro z hz |
| 107 | have hd := (ReducedLengthMinimum.Variation.Geometry.coordinateSlice_snd_hasDerivAt v |
| 108 | ((hv.contDiffAt (hopen.mem_nhds hz)).differentiableAt (by simp))).unique |
| 109 | (hasDerivAt_speed F c hc hz.2 z.1) |
| 110 | change m62TangentRicci F c z.2 z.1 + m62CurvatureSquared F c z.2 z.1 = |
| 111 | -(fderiv ℝ v z (0, 1)) * (v z)⁻¹ |
| 112 | rw [hd] |
| 113 | dsimp only [v] |
| 114 | have hnonzero := (speed_pos F c hc (Ioo_subset_Icc_self hz.2) z.1).ne' |
| 115 | field_simp |
| 116 | |
| 117 | /-- The actual time derivative of the unit tangent includes the positive |
| 118 | normalization term; correction Lemmas 0.1-0.2, pp. 3-6. -/ |
| 119 | theorem unitTangent_time_derivative (hc : M62ShrinkingCurve F c) |
| 120 | {t : ℝ} (ht : t ∈ Set.Ioo a b) (x : ℝ) : |
| 121 | rampHorizontalCovariantDerivative (F.connection t) (fun r => c x r) |
| 122 | (fun r => spatialUnitTangent F c r x) t = |
| 123 | m62SpatialDerivative F c t (m62CurvatureVector F c t) x + |
| 124 | (m62TangentRicci F c t x + m62CurvatureSquared F c t x) • |
| 125 | spatialUnitTangent F c t x := by |
| 126 | have hopen : IsOpen (univ ×ˢ Ioo a b : Set (ℝ × ℝ)) := isOpen_univ.prod isOpen_Ioo |
| 127 | have hmem : (x, t) ∈ (univ ×ˢ Ioo a b : Set (ℝ × ℝ)) := ⟨mem_univ _, ht⟩ |
| 128 | have htime : MDifferentiableAt 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ × ℝ) |
| 129 | (fun r : ℝ => (x, r)) t := |
| 130 | ((differentiableAt_const x).prodMk differentiableAt_id).mdifferentiableAt |
| 131 | have hX := ((spatial_velocity_joint_contMDiff F c hc).contMDiffAt |
| 132 | (hopen.mem_nhds hmem)).mdifferentiableAt (by simp) |
| 133 | have hv := (speed_pos F c hc (Ioo_subset_Icc_self ht) x).ne' |
| 134 | have hvinv : HasDerivAt (fun r => (curveSpeed F c r x)⁻¹) |
| 135 | ((m62TangentRicci F c t x + m62CurvatureSquared F c t x) * |
| 136 | (curveSpeed F c t x)⁻¹) t := by |
| 137 | apply ((hasDerivAt_speed F c hc ht x).inv hv).congr_deriv |
| 138 | field_simp |
| 139 | have hcomm := pullback_velocity_commute (F.connection t) c hopen hc.joint_smooth hmem |
| 140 | have heq : (fun s => curveVelocity (fun r => c s r) t) = m62CurvatureVector F c t := |
| 141 | funext (hc.equation t ht) |
| 142 | rw [heq] at hcomm |
| 143 | change rampHorizontalCovariantDerivative (F.connection t) (fun r => c x r) |
| 144 | (fun r => (curveSpeed F c r x)⁻¹ • curveVelocity (fun s => c s r) x) t = _ |
| 145 | rw [pullback_smul (F.connection t) hvinv |
| 146 | (by simpa only [Function.comp_def] using hX.comp t htime), hcomm] |
| 147 | simp only [m62SpatialDerivative, spatialUnitTangent, mul_smul] |
| 148 | exact add_comm _ _ |
| 149 | |
| 150 | end PoincareMT.M62 |