AFTD Auto-Formalizing Theoretical Domains

tr_pauli_of_ne_one

theoremverified

If a Pauli string on $n$ qubits contains at least one non-identity single-qubit Pauli operator, then its tensor-product matrix has trace zero.

Statement

lemma tr_pauli_of_ne_one (n : ℕ) (p : PauliString n)
    (hp : ∃ i : Fin n, p i ≠ PauliBasis.I) :
    (pauliMatrix p).trace = 0
Source
arXiv:2610.37807, Lemma 10 proof
Verified
08 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 4
  • pauliMatrixFor a Pauli string $p$ on $n$ qubits, the $2^n\times 2^n$ matrix obtained as the tensor product of the single-qubit Pauli matrices…
  • PauliStringA Pauli string of length $n$ is a function $p : \mathrm{Fin}\,n \to \mathrm{PauliBasis}$.
  • PauliBasisThe four Pauli basis elements $\{I,X,Y,Z\}$, represented as an inductive type.
  • PauliBasis.toMatrixMaps each Pauli basis element $\{I,X,Y,Z\}$ to its corresponding $2\times 2$ matrix $\{\sigma_I,\sigma_X,\sigma_Y,\sigma_Z\}$.
Used by 1

Read back from the Lean

For every natural number n and every Pauli string p on n qubits (that is, p : Fin n → PauliBasis), if there exists an index i : Fin n such that p i ≠ PauliBasis.I, then the trace of the Pauli matrix associated with p ((pauliMatrix p).trace) is equal to 0 in ℂ.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

The trace of an $n$-qubit Pauli tensor product matrix factors into the product of the traces of its individual single-qubit Pauli factors via generalized distributivity. By assumption, at least one factor at some qubit index $k$ is a non-identity Pauli operator ($X, Y,$ or $Z$). Since the single-qubit Pauli matrices $X, Y,$ and $Z$ all have trace zero, that factor vanishes, which makes the entire product zero.

  1. There exists a qubit index $k$ such that the Pauli operator $p(k)$ is not the identity.

    We instantiate the existential hypothesis ($hp$) to fix a specific qubit index $k$ and the fact that $p(k) \ne I$.

    line 5

      obtain ⟨k, hk⟩ := hp
  2. The trace of the Pauli string matrix equals the sum over all binary multi-indices of the product of the diagonal entries of each single-qubit factor.

    By definition, the Pauli string matrix is the tensor product of the individual Pauli matrices, with matrix entries given by the product of the corresponding single-qubit entries. Since the trace is the sum of diagonal entries, this identity holds directly by definition (`rfl`).

    lines 6–7

      have hkey : (pauliMatrix p).trace
          = ∑ i : Fin n → Fin 2, ∏ k, (p k).toMatrix (i k) (i k) := rfl
  3. The sum of products of diagonal entries factors into the product over all qubits of the traces of the individual Pauli matrices.

    Distributing multiplication over addition across the function space (using `Finset.sum_prod_piFinset`) converts the sum over multi-indices of products into a product over qubits of sums. Congruence (`congr 1`) equates the domain of summation with the universe of functions from $\text{Fin } n$ to $\text{Fin } 2$.

    lines 8–12

    uses Finset.sum_prod_piFinset

      have hfac : (∑ i : Fin n → Fin 2, ∏ k, (p k).toMatrix (i k) (i k))
          = ∏ k, ∑ a : Fin 2, (p k).toMatrix a a := by
        rw [← Finset.sum_prod_piFinset (s := Finset.univ)
              (g := fun k (a : Fin 2) => (p k).toMatrix a a)]
        congr 1
  4. It suffices to show that the trace of the single-qubit operator $p(k)$ is zero.

    Rewriting the trace of `pauliMatrix p` using the previous identities expresses it as the product $\prod_{j} \operatorname{Tr}(p(j))$. By `Finset.prod_eq_zero`, a finite product vanishes if at least one factor is zero, so it suffices to show that the $k$-th factor $\sum_{a=0}^1 (p(k))_{a,a}$ is zero.

    lines 13–14

    uses Finset.prod_eq_zero, Finset.mem_univ

      rw [hkey, hfac]
      apply Finset.prod_eq_zero (Finset.mem_univ k)
  5. The single-qubit Pauli matrix $p(k)$ has trace zero.

    We perform case analysis on the Pauli basis operator $p(k)$: - If $p(k) = I$, this contradicts the hypothesis $p(k) \ne I$ via `absurd`. - If $p(k) = X$, the matrix $\sigma_X$ has zeros on the diagonal, so its trace is $0 + 0 = 0$. - If $p(k) = Y$, the matrix $\sigma_Y$ has zeros on the diagonal, so its trace is $0 + 0 = 0$. - If $p(k) = Z$, the matrix $\sigma_Z$ has diagonal entries $1$ and $-1$, which sum to $0$. In each non-identity case, simplifying using the definitions of the matrices confirms the trace evaluates to zero.

    lines 15–19

    uses absurd, PauliBasis.toMatrix, sigmaX, sigmaY, sigmaZ

      cases hpk : p k with
      | I => exact absurd hpk hk
      | X => simp [PauliBasis.toMatrix, sigmaX]
      | Y => simp [PauliBasis.toMatrix, sigmaY]
      | Z => simp [PauliBasis.toMatrix, sigmaZ]
Finset.sum_prod_piFinset
A sum of products over functions with values in a finite set factors as the product over the domain of the sums over the codomain: $\sum_{f \in \prod s} \prod_i g(i, f(i)) = \prod_i \sum_{j \in s} g(i, j)$.
Finset.prod_eq_zero
A finite product is zero if at least one factor in the product is zero.
Finset.mem_univ
Every element of a finite type belongs to its universal finite set `Finset.univ`.
absurd
From a proposition $P$ and its negation $\neg P$, any conclusion follows (principle of explosion).
PauliBasis.toMatrix
Maps each Pauli basis element ($I, X, Y, Z$) to its corresponding 2×2 complex matrix.
sigmaX
The 2×2 Pauli X matrix, $\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$.
sigmaY
The 2×2 Pauli Y matrix, $\begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}$.
sigmaZ
The 2×2 Pauli Z matrix, $\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

/-- Any Pauli string having at least one non-identity single-qubit factor has trace zero. -/lemma tr_pauli_of_ne_one (n : ℕ) (p : PauliString n)    (hp : ∃ i : Fin n, p i ≠ PauliBasis.I) :    (pauliMatrix p).trace = 0 := by  obtain ⟨k, hk⟩ := hp  have hkey : (pauliMatrix p).trace      = ∑ i : Fin n → Fin 2, ∏ k, (p k).toMatrix (i k) (i k) := rfl  have hfac : (∑ i : Fin n → Fin 2, ∏ k, (p k).toMatrix (i k) (i k))      = ∏ k, ∑ a : Fin 2, (p k).toMatrix a a := by    rw [← Finset.sum_prod_piFinset (s := Finset.univ)          (g := fun k (a : Fin 2) => (p k).toMatrix a a)]    congr 1  rw [hkey, hfac]  apply Finset.prod_eq_zero (Finset.mem_univ k)  cases hpk : p k with  | I => exact absurd hpk hk  | X => simp [PauliBasis.toMatrix, sigmaX]  | Y => simp [PauliBasis.toMatrix, sigmaY]  | Z => simp [PauliBasis.toMatrix, sigmaZ]
See it in the graphDiscuss this resultChallenge it