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.CenteredConnection |
| 2 | |
| 3 | /-! |
| 4 | # Connection calculations at every point of a fixed chart |
| 5 | |
| 6 | Finite frame expansion keeps the chart fixed while the evaluation point |
| 7 | varies. The coefficient map in the connection formula is explicit. |
| 8 | -/ |
| 9 | |
| 10 | set_option autoImplicit false |
| 11 | set_option maxSynthPendingDepth 3 |
| 12 | |
| 13 | open scoped Manifold ContDiff Bundle BigOperators Topology |
| 14 | open Filter |
| 15 | |
| 16 | universe u |
| 17 | |
| 18 | namespace PoincareMT.ReducedLength |
| 19 | |
| 20 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 21 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 22 | [IsManifold (𝓡 n) ∞ M] |
| 23 | |
| 24 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 25 | |
| 26 | theorem mdifferentiableAt_chartVectorField_variable_on_source |
| 27 | (p q : M) (hq : q ∈ (chartAt E p).source) (c : M → E) |
| 28 | (hc : MDifferentiableAt (𝓡 n) (𝓡 n) c q) : |
| 29 | MDifferentiableAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) |
| 30 | (T% (fun x ↦ chartVectorField p (c x) x)) q := by |
| 31 | let b := (stdOrthonormalBasis ℝ E).toBasis |
| 32 | have hsum : MDifferentiableAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) |
| 33 | (T% (fun x ↦ ∑ i, b.repr (c x) i • chartVectorField p (b i) x)) q := by |
| 34 | apply MDifferentiableAt.sum_section |
| 35 | intro i _ |
| 36 | have ha : MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) (fun x ↦ b.repr (c x) i) q := |
| 37 | (b.coord i).toContinuousLinearMap.mdifferentiableAt.comp q hc |
| 38 | have hv := ((chartVectorField_smooth p (b i)).contMDiffAt |
| 39 | ((chartAt E p).open_source.mem_nhds hq)).mdifferentiableAt (by simp) |
| 40 | exact ha.smul_section hv |
| 41 | apply hsum.congr_of_eventuallyEq |
| 42 | exact Filter.Eventually.of_forall fun x ↦ congrArg (Bundle.TotalSpace.mk x) |
| 43 | (congrFun (chartVectorField_variable_expansion p c b) x) |
| 44 | |
| 45 | set_option backward.isDefEq.respectTransparency false in |
| 46 | theorem connection_chartVectorField_variable_on_source {g : RiemannianMetric n M} |
| 47 | (D : LeviCivitaData g) (p q : M) (hq : q ∈ (chartAt E p).source) |
| 48 | (c : M → E) (hc : MDifferentiableAt (𝓡 n) (𝓡 n) c q) |
| 49 | (X : TangentSpace (𝓡 n) q) (A : E →L[ℝ] E) |
| 50 | (hA : ∀ v : E, D.connection (chartVectorField p v) q X = chartVectorField p (A v) q) : |
| 51 | D.connection (fun x ↦ chartVectorField p (c x) x) q X = |
| 52 | chartVectorField p (A (c q) + mvfderiv (𝓡 n) c q X) q := by |
| 53 | let b := (stdOrthonormalBasis ℝ E).toBasis |
| 54 | let a := fun i x ↦ b.repr (c x) i |
| 55 | have ha (i : Fin (Module.finrank ℝ E)) : |
| 56 | MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) (a i) q := |
| 57 | (b.coord i).toContinuousLinearMap.mdifferentiableAt.comp q hc |
| 58 | have hframe (i : Fin (Module.finrank ℝ E)) : |
| 59 | MDifferentiableAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) (T% (chartVectorField p (b i))) q := |
| 60 | ((chartVectorField_smooth p (b i)).contMDiffAt |
| 61 | ((chartAt E p).open_source.mem_nhds hq)).mdifferentiableAt (by simp) |
| 62 | have h := connection_germ_expansion D (fun x ↦ chartVectorField p (c x) x) |
| 63 | (fun i ↦ chartVectorField p (b i)) a q X |
| 64 | (mdifferentiableAt_chartVectorField_variable_on_source p q hq c hc) hframe ha |
| 65 | (Filter.Eventually.of_forall (congrFun (chartVectorField_variable_expansion p c b))) |
| 66 | have hder (i : Fin (Module.finrank ℝ E)) : |
| 67 | mvfderiv (𝓡 n) (a i) q X = b.repr (mvfderiv (𝓡 n) c q X) i := |
| 68 | mvfderiv_const_clm (b.coord i).toContinuousLinearMap c q hc X |
| 69 | rw [h] |
| 70 | simp only [hA, hder, Finset.sum_add_distrib] |
| 71 | let L : E →L[ℝ] TangentSpace (𝓡 n) q := |
| 72 | (mfderiv (𝓡 n) (𝓡 n) (chartAt E p) q).inverse |
| 73 | change (∑ i, a i q • L (A (b i))) + |
| 74 | (∑ i, b.repr (mvfderiv (𝓡 n) c q X) i • L (b i)) = |
| 75 | L (A (c q) + mvfderiv (𝓡 n) c q X) |
| 76 | simp only [a, ← map_smul, ← map_sum, b.sum_repr, map_add] |
| 77 | |
| 78 | theorem connection_of_eventuallyEq_chartVectorField_on_source {g : RiemannianMetric n M} |
| 79 | (D : LeviCivitaData g) (p q : M) (hq : q ∈ (chartAt E p).source) |
| 80 | (c : M → E) (hc : MDifferentiableAt (𝓡 n) (𝓡 n) c q) |
| 81 | (σ : (x : M) → TangentSpace (𝓡 n) x) |
| 82 | (heq : σ =ᶠ[𝓝 q] (fun x ↦ chartVectorField p (c x) x)) |
| 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 | D.connection σ q X = chartVectorField p (A (c q) + mvfderiv (𝓡 n) c q X) q := by |
| 86 | have hv := mdifferentiableAt_chartVectorField_variable_on_source p q hq c hc |
| 87 | have hσ : MDifferentiableAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) (T% σ) q := by |
| 88 | apply hv.congr_of_eventuallyEq |
| 89 | filter_upwards [heq] with x hx |
| 90 | exact congrArg (Bundle.TotalSpace.mk x) hx |
| 91 | rw [D.connection.isCovariantDerivativeOnUniv.congr_of_eventuallyEq hσ hv (by simp) heq] |
| 92 | exact connection_chartVectorField_variable_on_source D p q hq c hc X A hA |
| 93 | |
| 94 | theorem mvfderiv_vector_chartVectorField (p : M) (f : M → E) (y v : E) |
| 95 | (hy : y ∈ (chartAt E p).target) |
| 96 | (hf : MDifferentiableAt (𝓡 n) (𝓡 n) f ((chartAt E p).symm y)) : |
| 97 | mvfderiv (𝓡 n) f ((chartAt E p).symm y) |
| 98 | (chartVectorField p v ((chartAt E p).symm y)) = |
| 99 | fderiv ℝ (fun z ↦ f ((chartAt E p).symm z)) y v := by |
| 100 | rw [chartVectorField_at_inverse p v y hy] |
| 101 | have h := mfderiv_comp y hf |
| 102 | ((mdifferentiable_chart (I := 𝓡 n) p).mdifferentiableAt_symm hy) |
| 103 | rw [mfderiv_eq_fderiv] at h |
| 104 | exact (congrArg (fun L ↦ L v) h).symm |
| 105 | |
| 106 | end PoincareMT.ReducedLength |