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.Soliton.ThreeDimensional.Noncompact.Rigidity.Levels.MetricExpansion.Variation |
| 2 | |
| 3 | /-! |
| 4 | # A parallel vector field's flow preserves the metric |
| 5 | |
| 6 | The actual squared length of a transported tangent vector has zero |
| 7 | derivative by metric compatibility and parallelism. Its value at time |
| 8 | zero and polarization give the full metric identity. This follows |
| 9 | Morgan--Tian Theorem 1.2, pp. 3-4, for the null-branch flowout in |
| 10 | Claim 11.7, pp. 270-271. No gradient primitive is assumed. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.M30 |
| 20 | |
| 21 | /-- Every time map of the supplied smooth parallel-field flow preserves |
| 22 | the actual metric (Theorem 1.2, pp. 3-4; Claim 11.7, pp. 270-271). -/ |
| 23 | theorem flow_preserves_metric_of_parallel |
| 24 | {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 26 | {g : RiemannianMetric n M} (D : LeviCivitaData g) |
| 27 | {V : (x : M) → TangentSpace (𝓡 n) x} {Φ : ℝ → M → M} |
| 28 | (hV : ContMDiff (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% V)) |
| 29 | (hparallel : ∀ x, ∀ a : TangentSpace (𝓡 n) x, D.connection V x a = 0) |
| 30 | (hs : ContMDiff (𝓘(ℝ, ℝ).prod (𝓡 n)) (𝓡 n) ∞ (Function.uncurry Φ)) |
| 31 | (hΦ : ∀ x, IsMIntegralCurve (I := 𝓡 n) (fun t => Φ t x) V) |
| 32 | (h0 : ∀ x, Φ 0 x = x) |
| 33 | (t : ℝ) (x : M) (a b : TangentSpace (𝓡 n) x) : |
| 34 | g.inner (Φ t x) (mfderiv (𝓡 n) (𝓡 n) (Φ t) x a) |
| 35 | (mfderiv (𝓡 n) (𝓡 n) (Φ t) x b) = g.inner x a b := by |
| 36 | have hfun : Φ 0 = id := funext h0 |
| 37 | have hid : mfderiv (𝓡 n) (𝓡 n) (Φ 0) x = ContinuousLinearMap.id ℝ _ := by |
| 38 | rw [hfun] |
| 39 | exact mfderiv_id |
| 40 | have hdiag (v : TangentSpace (𝓡 n) x) : |
| 41 | g.inner (Φ t x) (mfderiv (𝓡 n) (𝓡 n) (Φ t) x v) |
| 42 | (mfderiv (𝓡 n) (𝓡 n) (Φ t) x v) = g.inner x v v := by |
| 43 | have hd (s : ℝ) : HasDerivAt (fun r => g.inner (Φ r x) |
| 44 | (mfderiv (𝓡 n) (𝓡 n) (Φ r) x v) (mfderiv (𝓡 n) (𝓡 n) (Φ r) x v)) 0 s := by |
| 45 | simpa only [hparallel, map_zero, zero_apply, mul_zero] using |
| 46 | D.hasDerivAt_manifoldFlow_squared_length hV hs hΦ x v s |
| 47 | have heq := is_const_of_deriv_eq_zero (fun s => (hd s).differentiableAt) |
| 48 | (fun s => (hd s).deriv) t 0 |
| 49 | rw [hid, h0] at heq |
| 50 | exact heq |
| 51 | have hp := hdiag (a + b) |
| 52 | simp only [map_add, add_apply] at hp |
| 53 | rw [g.symm (Φ t x) (mfderiv (𝓡 n) (𝓡 n) (Φ t) x b) |
| 54 | (mfderiv (𝓡 n) (𝓡 n) (Φ t) x a), g.symm x b a] at hp |
| 55 | linarith [hdiag a, hdiag b] |
| 56 | |
| 57 | end PoincareMT.M30 |