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 | /- Adapted from Mapher `PoincareMT/Proofs/M03/MetricDifferenceEvolution.lean` at |
| 2 | f927d9e1f0810042766d3b5f64d3f4da02ee93cc. See |
| 3 | `references/ricci-flow/mapher/local-theory/port.json`. -/ |
| 4 | |
| 5 | import PoincareLib.Geometry.RicciFlow.Basic |
| 6 | import PoincareLib.Geometry.RicciFlow.Local.Curvature.Calculus.CurvatureTrilinear |
| 7 | |
| 8 | /-! |
| 9 | # Metric-difference evolution for two actual Ricci flows |
| 10 | |
| 11 | Kotschwar, arXiv:1206.3225v1, printed p. 4, contracts the (1,3) curvature |
| 12 | difference to obtain the metric-difference equation. Finite basis |
| 13 | reconstruction gives this contraction with the frozen Morgan-Tian curvature |
| 14 | convention. The resulting squared-coefficient estimate uses a fixed basis |
| 15 | and within-domain derivatives, including common endpoints. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | set_option maxHeartbeats 800000 |
| 20 | |
| 21 | open scoped Manifold ContDiff Bundle BigOperators |
| 22 | |
| 23 | universe u v |
| 24 | |
| 25 | namespace PoincareMT.RicciFlow.Local |
| 26 | |
| 27 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 29 | |
| 30 | theorem ricci_eq_sum_basis_of_curvature_pairing {g : RiemannianMetric n M} |
| 31 | (D : LeviCivitaData g) (x : M) (u v : TangentSpace (𝓡 n) x) |
| 32 | {ι : Type v} [Fintype ι] (b : Module.Basis ι ℝ (TangentSpace (𝓡 n) x)) : |
| 33 | D.ricci x u v = ∑ k, b.repr (D.curvature x (b k) u v) k := by |
| 34 | classical |
| 35 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 36 | ⟨g.toRiemannianMetric⟩ |
| 37 | obtain ⟨R, hR⟩ := exists_curvature_trilinearMap D x |
| 38 | let A : TangentSpace (𝓡 n) x →ₗ[ℝ] TangentSpace (𝓡 n) x := { |
| 39 | toFun := fun w => R w u v |
| 40 | map_add' := fun w z => by simp only [map_add, LinearMap.add_apply] |
| 41 | map_smul' := fun c w => by |
| 42 | simp only [map_smul, LinearMap.smul_apply, RingHom.id_apply] } |
| 43 | have hA (w : TangentSpace (𝓡 n) x) : A w = D.curvature x w u v := hR w u v |
| 44 | let c := g.orthonormalBasis x |
| 45 | have hdiag : (∑ j, c.toBasis.repr (A (c j)) j) = |
| 46 | ∑ i, b.repr (A (b i)) i := by |
| 47 | calc |
| 48 | _ = ∑ j, ∑ i, b.repr (c j) i * c.toBasis.repr (A (b i)) j := by |
| 49 | apply Finset.sum_congr rfl |
| 50 | intro j _ |
| 51 | conv_lhs => rw [← b.sum_repr (c j)] |
| 52 | simp only [map_sum, map_smul, Finset.sum_apply', |
| 53 | Finsupp.smul_apply, smul_eq_mul] |
| 54 | _ = ∑ i, ∑ j, b.repr (c j) i * c.toBasis.repr (A (b i)) j := |
| 55 | Finset.sum_comm |
| 56 | _ = _ := by |
| 57 | apply Finset.sum_congr rfl |
| 58 | intro i _ |
| 59 | exact b.sum_repr_mul_repr c.toBasis (A (b i)) i |
| 60 | calc |
| 61 | D.ricci x u v = ∑ j, c.toBasis.repr (A (c j)) j := by |
| 62 | change (∑ j, g.inner x (D.curvature x u (c j) (c j)) v) = _ |
| 63 | apply Finset.sum_congr rfl |
| 64 | intro j _ |
| 65 | have hswap : D.curvature x u (c j) v = -D.curvature x (c j) u v := by |
| 66 | delta LeviCivitaData.curvature |
| 67 | exact curvatureOnFields_swap D _ _ _ x |
| 68 | rw [curvature_pair_skew, hswap, map_neg, neg_neg, |
| 69 | c.coe_toBasis_repr_apply, c.repr_apply_apply, hA] |
| 70 | rfl |
| 71 | _ = ∑ i, b.repr (A (b i)) i := hdiag |
| 72 | _ = _ := by simp only [hA] |
| 73 | |
| 74 | theorem hasDerivWithinAt_metric_difference_basis |
| 75 | {J J' : Set ℝ} (F : RicciFlow n M J) (F' : RicciFlow n M J') |
| 76 | {t : ℝ} (ht : t ∈ J ∩ J') (x : M) |
| 77 | {ι : Type v} [Fintype ι] (b : Module.Basis ι ℝ (TangentSpace (𝓡 n) x)) |
| 78 | (u v : TangentSpace (𝓡 n) x) : |
| 79 | HasDerivWithinAt |
| 80 | (fun s => (F.metric s).inner x u v - (F'.metric s).inner x u v) |
| 81 | (-2 * ∑ k, b.repr ((F.connection t).curvature x (b k) u v - |
| 82 | (F'.connection t).curvature x (b k) u v) k) (J ∩ J') t := by |
| 83 | have hd := ((F.equation t ht.1 x u v).mono Set.inter_subset_left).sub |
| 84 | ((F'.equation t ht.2 x u v).mono Set.inter_subset_right) |
| 85 | rw [ricci_eq_sum_basis_of_curvature_pairing (F.connection t) x u v b, |
| 86 | ricci_eq_sum_basis_of_curvature_pairing (F'.connection t) x u v b] at hd |
| 87 | apply hd.congr_deriv |
| 88 | simp only [map_sub, Finsupp.sub_apply, Finset.sum_sub_distrib] |
| 89 | ring |
| 90 | |
| 91 | theorem metric_difference_basis_energy_rate |
| 92 | {J J' : Set ℝ} (F : RicciFlow n M J) (F' : RicciFlow n M J') |
| 93 | {t : ℝ} (ht : t ∈ J ∩ J') (x : M) |
| 94 | {ι : Type v} [Fintype ι] (b : Module.Basis ι ℝ (TangentSpace (𝓡 n) x)) : |
| 95 | let h := fun s i j => |
| 96 | (F.metric s).inner x (b i) (b j) - (F'.metric s).inner x (b i) (b j) |
| 97 | let S := fun k i j => b.repr |
| 98 | ((F.connection t).curvature x (b k) (b i) (b j) - |
| 99 | (F'.connection t).curvature x (b k) (b i) (b j)) k |
| 100 | HasDerivWithinAt (fun s => ∑ i, ∑ j, h s i j ^ 2) |
| 101 | (-4 * ∑ i, ∑ j, h t i j * ∑ k, S k i j) (J ∩ J') t ∧ |
| 102 | -4 * (∑ i, ∑ j, h t i j * ∑ k, S k i j) ≤ |
| 103 | (∑ i, ∑ j, h t i j ^ 2) + |
| 104 | 4 * (Fintype.card ι : ℝ) * ∑ i, ∑ j, ∑ k, S k i j ^ 2 := by |
| 105 | classical |
| 106 | dsimp only |
| 107 | let h := fun s i j => |
| 108 | (F.metric s).inner x (b i) (b j) - (F'.metric s).inner x (b i) (b j) |
| 109 | let S := fun k i j => b.repr |
| 110 | ((F.connection t).curvature x (b k) (b i) (b j) - |
| 111 | (F'.connection t).curvature x (b k) (b i) (b j)) k |
| 112 | have hd (i j : ι) : HasDerivWithinAt (fun s => h s i j ^ 2) |
| 113 | (-4 * (h t i j * ∑ k, S k i j)) (J ∩ J') t := by |
| 114 | have he := (hasDerivWithinAt_metric_difference_basis F F' ht x b (b i) (b j)).fun_pow 2 |
| 115 | apply he.congr_deriv |
| 116 | change (2 : ℝ) * h t i j ^ 1 * (-2 * ∑ k, S k i j) = _ |
| 117 | ring |
| 118 | constructor |
| 119 | · have hsum := HasDerivWithinAt.fun_sum (u := Finset.univ) fun i _ => |
| 120 | HasDerivWithinAt.fun_sum (u := Finset.univ) fun j _ => hd i j |
| 121 | simpa only [Finset.mul_sum] using hsum |
| 122 | · have hpoint (i j : ι) : -4 * (h t i j * ∑ k, S k i j) ≤ |
| 123 | h t i j ^ 2 + 4 * (Fintype.card ι : ℝ) * ∑ k, S k i j ^ 2 := by |
| 124 | have hcs : (∑ k, S k i j) ^ 2 ≤ |
| 125 | (Fintype.card ι : ℝ) * ∑ k, S k i j ^ 2 := by |
| 126 | simpa using Finset.sum_mul_sq_le_sq_mul_sq Finset.univ |
| 127 | (fun _ : ι => (1 : ℝ)) (fun k => S k i j) |
| 128 | nlinarith [sq_nonneg (h t i j + 2 * ∑ k, S k i j)] |
| 129 | have hsum := Finset.sum_le_sum (s := Finset.univ) fun i _ => |
| 130 | Finset.sum_le_sum (s := Finset.univ) fun j _ => hpoint i j |
| 131 | simpa only [Finset.sum_add_distrib, Finset.mul_sum] using hsum |
| 132 | |
| 133 | end PoincareMT.RicciFlow.Local |