Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

trace_pow_eq_walk

Proved

by Harry_Xu · Jun 23, 2026 · Mathlib c5ea003 (Lean v4.30.0)

combinatoricslinear-algebramatrixtrace

For a square matrix MMM over a commutative ring and any n≥0n \geq 0n≥0, the trace of Mn+1M^{n+1}Mn+1 equals the sum over all closed walks of length n+1n+1n+1 of the product of edge weights along the walk:

tr⁡(Mn+1)=∑v:{0,…,n}→ι∏k=0nMv(k), v(k+1 mod (n+1)).\operatorname{tr}(M^{n+1}) = \sum_{v : \{0,\dots,n\} \to \iota} \prod_{k=0}^{n} M_{v(k),\,v(k+1 \bmod (n+1))}.tr(Mn+1)=v:{0,…,n}→ι∑​k=0∏n​Mv(k),v(k+1mod(n+1))​.

Here a closed walk of length n+1n+1n+1 is a function vvv from the cyclic index set Z/(n+1)\mathbb{Z}/(n+1)Z/(n+1) to the vertex set ι\iotaι, and the successor index is taken modulo n+1n+1n+1 (so the walk returns to its start). This is the standard combinatorial expansion of trace moments as a sum over closed walks, the entry point of the moment method (Buchholz, Operator Khintchine inequality in non-commutative probability, Math. Ann. 319 (2001) 1–16, §2).

Preamble
import Mathlib
open Matrix
open scoped BigOperators
Formal statement
theorem trace_pow_eq_walk {iota : Type*} [Fintype iota] [DecidableEq iota]
    {R : Type*} [CommRing R] (M : Matrix iota iota R) (n : Nat) :
    Matrix.trace (M ^ (n + 1)) =
      ∑ v : Fin (n + 1) → iota,
        ∏ k : Fin (n + 1),
          M (v k) (v ⟨(k.1 + 1) % (n + 1), Nat.mod_lt _ (Nat.succ_pos n)⟩) := by sorry
Source
Buchholz, Operator Khintchine inequality in non-commutative probability, Math. Ann. 319 (2001) 1-16, section 2; CR2009 (arXiv:0805.4471) section 6.1 Lemma 6.1

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me