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.CenteredChartOperators |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Coordinates.ConnectionFrame |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Tensor.ManifoldTraceDerivative |
| 4 | |
| 5 | /-! |
| 6 | # The connection on a variable centered coordinate field |
| 7 | |
| 8 | A finite smooth frame expansion establishes differentiability and then |
| 9 | computes the actual connection using its Leibniz rule. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option maxSynthPendingDepth 3 |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle BigOperators Topology |
| 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 | set_option backward.isDefEq.respectTransparency false in |
| 29 | theorem chartVectorField_variable_expansion (p : M) (c : M → E) |
| 30 | {ι : Type*} [Fintype ι] (b : Module.Basis ι ℝ E) : |
| 31 | (fun q ↦ chartVectorField p (c q) q) = |
| 32 | (fun q ↦ ∑ i, b.repr (c q) i • chartVectorField p (b i) q) := by |
| 33 | funext q |
| 34 | let L : E →L[ℝ] TangentSpace (𝓡 n) q := |
| 35 | (mfderiv (𝓡 n) (𝓡 n) (chartAt E p) q).inverse |
| 36 | change L (c q) = ∑ i, b.repr (c q) i • L (b i) |
| 37 | calc |
| 38 | _ = L (∑ i, b.repr (c q) i • b i) := congrArg L (b.sum_repr (c q)).symm |
| 39 | _ = _ := by simp only [map_sum, map_smul] |
| 40 | |
| 41 | theorem mdifferentiableAt_chartVectorField_variable (p : M) (c : M → E) |
| 42 | (hc : MDifferentiableAt (𝓡 n) (𝓡 n) c p) : |
| 43 | MDifferentiableAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) |
| 44 | (T% (fun q ↦ chartVectorField p (c q) q)) p := by |
| 45 | let b := (stdOrthonormalBasis ℝ E).toBasis |
| 46 | have hsum : MDifferentiableAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) |
| 47 | (T% (fun q ↦ ∑ i, b.repr (c q) i • chartVectorField p (b i) q)) p := by |
| 48 | apply MDifferentiableAt.sum_section |
| 49 | intro i _ |
| 50 | have ha : MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) (fun q ↦ b.repr (c q) i) p := |
| 51 | (b.coord i).toContinuousLinearMap.mdifferentiableAt.comp p hc |
| 52 | have hv := ((chartVectorField_smooth p (b i)).contMDiffAt |
| 53 | ((chartAt E p).open_source.mem_nhds (mem_chart_source E p))).mdifferentiableAt (by simp) |
| 54 | exact ha.smul_section hv |
| 55 | apply hsum.congr_of_eventuallyEq |
| 56 | exact Filter.Eventually.of_forall fun q ↦ congrArg (Bundle.TotalSpace.mk q) |
| 57 | (congrFun (chartVectorField_variable_expansion p c b) q) |
| 58 | |
| 59 | set_option backward.isDefEq.respectTransparency false in |
| 60 | theorem connection_chartVectorField_variable {g : RiemannianMetric n M} |
| 61 | (D : LeviCivitaData g) (p : M) (c : M → E) |
| 62 | (hc : MDifferentiableAt (𝓡 n) (𝓡 n) c p) (X : TangentSpace (𝓡 n) p) : |
| 63 | let A : E := frozenConnectionEndomorphism D p X (c p) |
| 64 | (D.connection (fun q ↦ chartVectorField p (c q) q) p X : E) = |
| 65 | A + mvfderiv (𝓡 n) c p X := by |
| 66 | dsimp only |
| 67 | let b := (stdOrthonormalBasis ℝ E).toBasis |
| 68 | let a := fun i q ↦ b.repr (c q) i |
| 69 | let B := frozenConnectionEndomorphism D p X |
| 70 | have ha (i : Fin (Module.finrank ℝ E)) : |
| 71 | MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) (a i) p := |
| 72 | (b.coord i).toContinuousLinearMap.mdifferentiableAt.comp p hc |
| 73 | have hframe (i : Fin (Module.finrank ℝ E)) : |
| 74 | MDifferentiableAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) (T% (chartVectorField p (b i))) p := |
| 75 | ((chartVectorField_smooth p (b i)).contMDiffAt |
| 76 | ((chartAt E p).open_source.mem_nhds (mem_chart_source E p))).mdifferentiableAt (by simp) |
| 77 | have h := connection_germ_expansion D (fun q ↦ chartVectorField p (c q) q) |
| 78 | (fun i ↦ chartVectorField p (b i)) a p X |
| 79 | (mdifferentiableAt_chartVectorField_variable p c hc) hframe ha |
| 80 | (Filter.Eventually.of_forall (congrFun (chartVectorField_variable_expansion p c b))) |
| 81 | have hconn (i : Fin (Module.finrank ℝ E)) : |
| 82 | D.connection (chartVectorField p (b i)) p X = B (b i) := |
| 83 | (connection_frozenExtend_eq_chartVectorField D p X (b i)).symm |
| 84 | have hder (i : Fin (Module.finrank ℝ E)) : |
| 85 | mvfderiv (𝓡 n) (a i) p X = b.repr (mvfderiv (𝓡 n) c p X) i := |
| 86 | mvfderiv_const_clm (b.coord i).toContinuousLinearMap c p hc X |
| 87 | rw [h] |
| 88 | simp only [hconn, hder, chartVectorField_self, Finset.sum_add_distrib] |
| 89 | have hfirst : (∑ i, a i p • B (b i)) = B (c p) := by |
| 90 | simp only [← map_smul, ← map_sum] |
| 91 | change B (∑ i, b.repr (c p) i • b i) = B (c p) |
| 92 | rw [b.sum_repr] |
| 93 | rw [hfirst, b.sum_repr] |
| 94 | |
| 95 | theorem connection_of_eventuallyEq_chartVectorField {g : RiemannianMetric n M} |
| 96 | (D : LeviCivitaData g) (p : M) (c : M → E) |
| 97 | (hc : MDifferentiableAt (𝓡 n) (𝓡 n) c p) |
| 98 | (σ : (q : M) → TangentSpace (𝓡 n) q) |
| 99 | (heq : σ =ᶠ[𝓝 p] (fun q ↦ chartVectorField p (c q) q)) |
| 100 | (X : TangentSpace (𝓡 n) p) : |
| 101 | let A : E := frozenConnectionEndomorphism D p X (c p) |
| 102 | (D.connection σ p X : E) = A + mvfderiv (𝓡 n) c p X := by |
| 103 | dsimp only |
| 104 | have hv := mdifferentiableAt_chartVectorField_variable p c hc |
| 105 | have hσ : MDifferentiableAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) (T% σ) p := by |
| 106 | apply hv.congr_of_eventuallyEq |
| 107 | filter_upwards [heq] with q hq |
| 108 | exact congrArg (Bundle.TotalSpace.mk q) hq |
| 109 | rw [D.connection.isCovariantDerivativeOnUniv.congr_of_eventuallyEq hσ hv (by simp) heq] |
| 110 | exact connection_chartVectorField_variable D p c hc X |
| 111 | |
| 112 | end PoincareMT.ReducedLength |