AFTD Auto-Formalizing Theoretical Domains

pauli_comm_factor

def

For an implicit natural number n and two Pauli strings a b : PauliString n, pauli_comm_factor a b is the real sign factor (-1 : ℝ) ^ k in ℝ, where k is the number of coordinates i : Fin n such that a i ≠ PauliBasis.I, b i ≠ PauliBasis.I, and a i ≠ b i.

Statement

open Classical in
noncomputable def pauli_comm_factor {n : ℕ} (a b : PauliString n) : ℝ
Defined in
arXiv:2611.34872, eq. (2)
Verified
28 Nov 2026
Axioms
none listed
Built on 2
  • PauliBasisThe four Pauli basis elements $\{I,X,Y,Z\}$, represented as an inductive type.
  • PauliStringA Pauli string of length $n$ is a function $p : \mathrm{Fin}\,n \to \mathrm{PauliBasis}$.
Used by 2
  • ppt_pauli_error_ratesFor an implicit natural number n, a function p : PauliString n → ℝ, and a Pauli string b : PauliString n, ppt_pauli_error_rates p b is the…
  • pauli_eigenvaluesFor an implicit natural number n, a probability distribution p : PauliString n → ℝ, and a Pauli string a : PauliString n,…

Read back from the Lean

Given a natural number $n$ (implicit) and two Pauli strings $a, b : \mathrm{PauliString}\ n$ (functions from $\mathrm{Fin}\ n$ to the four-element type $\mathrm{PauliBasis} = \{I, X, Y, Z\}$), pauli_comm_factor a b is defined to be the real number $(-1)^k$, where $k$ is the number of indices $i \in \mathrm{Fin}\ n$ such that $a(i) \neq I$, $b(i) \neq I$, and $a(i) \neq b(i)$.

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

Lean source view module on GitHub

open Classical in
/-- The commutation sign factor (-1)^[a,b] in ℝ between Pauli strings a and b. -/
noncomputable def pauli_comm_factor {n : ℕ} (a b : PauliString n) : ℝ := (-1 : ℝ) ^ (Finset.card (Finset.filter (fun i => a i ≠ PauliBasis.I ∧ b i ≠ PauliBasis.I ∧ a i ≠ b i) Finset.univ))
See it in the graphDiscuss this resultChallenge it