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.Coordinates.FrozenChartCoordinates |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Tensor.BilinearFamily |
| 3 | import PoincareLib.Geometry.Riemannian.Tensor.Regularity |
| 4 | |
| 5 | /-! |
| 6 | # Tensor derivatives throughout a fixed chart |
| 7 | |
| 8 | Actual frozen extensions have variable chart coefficients. The product |
| 9 | rule cancels their derivatives against the connection corrections. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option maxSynthPendingDepth 3 |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 16 | open Filter |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.ReducedLength |
| 21 | |
| 22 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 24 | [IsManifold (𝓡 n) ∞ M] |
| 25 | |
| 26 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 27 | |
| 28 | theorem mvfderiv_clm_application |
| 29 | {V W : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] |
| 30 | [NormedAddCommGroup W] [NormedSpace ℝ W] |
| 31 | (B : M → V →L[ℝ] W) (c : M → V) (q : M) |
| 32 | (hB : MDifferentiableAt (𝓡 n) (𝓘(ℝ, V →L[ℝ] W)) B q) |
| 33 | (hc : MDifferentiableAt (𝓡 n) (𝓘(ℝ, V)) c q) (X : TangentSpace (𝓡 n) q) : |
| 34 | mvfderiv (𝓡 n) (fun x ↦ B x (c x)) q X = |
| 35 | B q (mvfderiv (𝓡 n) c q X) + mvfderiv (𝓡 n) B q X (c q) := by |
| 36 | let z := (B q, c q) |
| 37 | have he := (hasFDerivAt_fst (𝕜 := ℝ) (p := z)).clm_apply |
| 38 | (hasFDerivAt_snd (𝕜 := ℝ) (p := z)) |
| 39 | have hp : HasMFDerivAt (𝓡 n) (𝓘(ℝ, (V →L[ℝ] W) × V)) |
| 40 | (fun x ↦ (B x, c x)) q ((mvfderiv (𝓡 n) B q).prod (mvfderiv (𝓡 n) c q)) := by |
| 41 | convert! hB.hasMFDerivAt.prodMk hc.hasMFDerivAt using 1 <;> |
| 42 | simp only [modelWithCornersSelf_prod, chartedSpaceSelf_prod] |
| 43 | have h := he.hasMFDerivAt.comp q hp |
| 44 | convert! congrArg (fun L : TangentSpace (𝓡 n) q →L[ℝ] W ↦ L X) h.mfderiv using 1 |
| 45 | |
| 46 | noncomputable def chartTensorBilinear (T : CovariantTensorEvaluation n M 2) |
| 47 | (hT : IsSmoothCovariantTensor T) (p q : M) : E →L[ℝ] E →L[ℝ] ℝ := |
| 48 | bilinearOfMultilinear ((hT.1 q).choose.compLinearMap |
| 49 | (fun _ ↦ (mfderiv (𝓡 n) (𝓡 n) (chartAt E p) q).inverse.toLinearMap)) |
| 50 | |
| 51 | set_option backward.isDefEq.respectTransparency false in |
| 52 | theorem chartTensorBilinear_apply (T : CovariantTensorEvaluation n M 2) |
| 53 | (hT : IsSmoothCovariantTensor T) (p q : M) (v w : E) : |
| 54 | chartTensorBilinear T hT p q v w = |
| 55 | T q ![chartVectorField p v q, chartVectorField p w q] := by |
| 56 | rw [chartTensorBilinear, bilinearOfMultilinear_apply, MultilinearMap.compLinearMap_apply, |
| 57 | ← (hT.1 q).choose_spec] |
| 58 | congr 1 |
| 59 | funext i |
| 60 | fin_cases i <;> rfl |
| 61 | |
| 62 | theorem chartTensorBilinear_smooth (T : CovariantTensorEvaluation n M 2) |
| 63 | (hT : IsSmoothCovariantTensor T) (p : M) : |
| 64 | ContMDiffOn (𝓡 n) (𝓘(ℝ, E →L[ℝ] E →L[ℝ] ℝ)) ∞ (chartTensorBilinear T hT p) |
| 65 | (chartAt E p).source := by |
| 66 | apply contMDiffOn_bilinear_iff.mpr |
| 67 | intro v w |
| 68 | have h := hT.2 (chartAt E p).source (chartAt E p).open_source |
| 69 | (fun i ↦ chartVectorField p (![v, w] i)) (fun i ↦ chartVectorField_smooth p _) |
| 70 | apply h.congr |
| 71 | intro x _ |
| 72 | rw [chartTensorBilinear_apply] |
| 73 | congr 1 |
| 74 | funext i |
| 75 | fin_cases i <;> rfl |
| 76 | |
| 77 | set_option maxHeartbeats 1000000 in |
| 78 | -- Two actual frozen-field germs are expanded and differentiated before cancellation. |
| 79 | set_option backward.isDefEq.respectTransparency false in |
| 80 | theorem covariantTensorDerivative_fixedChart {g : RiemannianMetric n M} |
| 81 | (D : LeviCivitaData g) (T : CovariantTensorEvaluation n M 2) |
| 82 | (hT : IsSmoothCovariantTensor T) (p q : M) (hq : q ∈ (chartAt E p).source) |
| 83 | (X : TangentSpace (𝓡 n) q) (A : E →L[ℝ] E) |
| 84 | (hA : ∀ v : E, D.connection (chartVectorField p v) q X = chartVectorField p (A v) q) |
| 85 | (v w : E) : |
| 86 | D.covariantTensorDerivative T q ![X, chartVectorField p v q, chartVectorField p w q] = |
| 87 | mvfderiv (𝓡 n) (chartTensorBilinear T hT p) q X v w - |
| 88 | chartTensorBilinear T hT p q (A v) w - chartTensorBilinear T hT p q v (A w) := by |
| 89 | classical |
| 90 | let V := chartVectorField p v q |
| 91 | let W := chartVectorField p w q |
| 92 | let c := frozenChartCoordinates p q V |
| 93 | let d := frozenChartCoordinates p q W |
| 94 | let B := chartTensorBilinear T hT p |
| 95 | have hc := (frozenChartCoordinates_contMDiffAt p q hq V).mdifferentiableAt (by simp) |
| 96 | have hd := (frozenChartCoordinates_contMDiffAt p q hq W).mdifferentiableAt (by simp) |
| 97 | have hB := ((chartTensorBilinear_smooth T hT p).contMDiffAt |
| 98 | ((chartAt E p).open_source.mem_nhds hq)).mdifferentiableAt (by simp) |
| 99 | have hcv : c q = v := frozenChartCoordinates_at_base p q hq v |
| 100 | have hdw : d q = w := frozenChartCoordinates_at_base p q hq w |
| 101 | have heq : (fun x ↦ T x ![FiberBundle.extend E V x, FiberBundle.extend E W x]) =ᶠ[𝓝 q] |
| 102 | (fun x ↦ B x (c x) (d x)) := by |
| 103 | filter_upwards [(chartAt E p).open_source.mem_nhds hq] with x hx |
| 104 | rw [chartTensorBilinear_apply, frozenChartCoordinates_reconstruct p q x V hx, |
| 105 | frozenChartCoordinates_reconstruct p q x W hx] |
| 106 | have hder : mvfderiv (𝓡 n) |
| 107 | (fun x ↦ T x ![FiberBundle.extend E V x, FiberBundle.extend E W x]) q X = |
| 108 | B q v (mvfderiv (𝓡 n) d q X) + B q (mvfderiv (𝓡 n) c q X) w + |
| 109 | mvfderiv (𝓡 n) B q X v w := by |
| 110 | rw [mvfderiv, heq.mfderiv_eq] |
| 111 | change mvfderiv (𝓡 n) (fun x ↦ B x (c x) (d x)) q X = _ |
| 112 | rw [mvfderiv_clm_application (fun x ↦ B x (c x)) d q (hB.clm_apply hc) hd X, |
| 113 | mvfderiv_clm_application B c q hB hc X, hcv, hdw, ContinuousLinearMap.add_apply] |
| 114 | ring |
| 115 | have hup0 (a : TangentSpace (𝓡 n) q) : Function.update ![V, W] (0 : Fin 2) a = ![a, W] := by |
| 116 | funext i |
| 117 | fin_cases i <;> simp |
| 118 | have hup1 (a : TangentSpace (𝓡 n) q) : Function.update ![V, W] (1 : Fin 2) a = ![V, a] := by |
| 119 | funext i |
| 120 | fin_cases i <;> simp |
| 121 | have htail : (fun i : Fin 2 ↦ ![X, V, W] i.succ) = ![V, W] := rfl |
| 122 | have hfields : (fun x ↦ T x (fun i : Fin 2 ↦ FiberBundle.extend E (![V, W] i) x)) = |
| 123 | (fun x ↦ T x ![FiberBundle.extend E V x, FiberBundle.extend E W x]) := by |
| 124 | funext x |
| 125 | congr 1 |
| 126 | funext i |
| 127 | fin_cases i <;> rfl |
| 128 | unfold LeviCivitaData.covariantTensorDerivative |
| 129 | change mvfderiv (𝓡 n) |
| 130 | (fun x ↦ T x (fun i : Fin 2 ↦ FiberBundle.extend E (![X, V, W] i.succ) x)) q X - |
| 131 | (∑ i : Fin 2, T q (Function.update (fun j : Fin 2 ↦ ![X, V, W] j.succ) i |
| 132 | (D.connection (FiberBundle.extend E (![X, V, W] i.succ)) q X))) = _ |
| 133 | simp only [Matrix.cons_val_succ] |
| 134 | rw [hfields, Fin.sum_univ_two, hup0, hup1] |
| 135 | simp only [Matrix.cons_val_zero, Matrix.cons_val_one] |
| 136 | rw [connection_frozenChartCoordinates D p q hq X A hA v, |
| 137 | connection_frozenChartCoordinates D p q hq X A hA w] |
| 138 | rw [← chartTensorBilinear_apply T hT p q _ w, ← chartTensorBilinear_apply T hT p q v _, hder] |
| 139 | simp only [map_add, ContinuousLinearMap.add_apply] |
| 140 | ring |
| 141 | |
| 142 | end PoincareMT.ReducedLength |