AFTD Auto-Formalizing Theoretical Domains

PauliString

defimported Lean

A Pauli string of length $n$ is a function $p : \mathrm{Fin}\,n \to \mathrm{PauliBasis}$.

Statement

set_option linter.mathlibStandardSet false in
open scoped BigOperators in
open scoped Real in
open scoped Nat in
open scoped Classical in
open scoped Pointwise in
set_option maxRecDepth 4000 in
set_option synthInstance.maxHeartbeats 20000 in
set_option synthInstance.maxSize 128 in
set_option relaxedAutoImplicit false in
set_option autoImplicit false in
open Complex Matrix in
noncomputable def PauliString (n : ℕ)
Defined in
TCSlib, `PauliString`
Lean proof
By Allan Li, Hydroxyi (from the file's git history), from github.com/Shilun-Allan-Li/tcslib at c8a02591b1e5 (Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.25.0.
Verified
07 Oct 2026
Axioms
none listed
Built on 1
  • PauliBasisThe four Pauli basis elements $\{I,X,Y,Z\}$, represented as an inductive type.
Used by 27
  • tr_pauli_of_ne_oneIf a Pauli string on $n$ qubits contains at least one non-identity single-qubit Pauli operator, then its tensor-product matrix has trace…
  • pauliLiouvilleMomentTwoFor an n-qubit pure state ψ, the second Pauli-Liouville moment m_2(ψ) is (1/2^n) times the sum over all n-qubit Pauli strings P of…
  • mkWithSupportGiven a finset $S \subseteq \mathrm{Fin}\,n$ and an assignment $f : S \to \mathrm{PauliNZ}$, constructs the Pauli string that equals…
  • supportThe support $\mathrm{supp}(p) \subseteq \mathrm{Fin}\,n$ consists of coordinates where $p(i) \neq I$; the weight is…
  • quantum_hamming_bound_rawQuantum Hamming bound for non-degenerate codes. Let $C \le \mathcal{H}_n$ be a subspace of the $n$-qubit Hilbert space that is a…
  • stabilizer_subspace_finrank_eq_two_powLet $k \le n$ and let $g_1, \dots, g_{n-k}$ be $n$-qubit Pauli operators $g_l = \varepsilon_l P_l$ with signs…
  • PauliErrorsLeThe set of all Pauli strings of weight at most $t$:…
  • pauliStringsExactSupportThe finset of all Pauli strings on $n$ qubits whose support equals exactly the given finset $S$.
  • xz_pauli_stringThe function xz_pauli_string (L : ℕ) : (Fin L → Fin 2) → PauliString L mapping a configuration a : Fin L → Fin 2 to the Pauli string…
  • IsNondegenerateA code is non-degenerate if it satisfies the Knill--Laflamme condition and additionally $P_C E^\dagger F P_C = 0$ whenever…
  • instFintypePauliStringinstFintypePauliString
  • pauliOpAdjointThe adjoint (Hermitian conjugate) $\hat{p}^\dagger : \mathcal{H}_n \to \mathcal{H}_n$ of the Pauli operator associated with a Pauli string…
  • KnillLaflammeA subspace $C \le \mathcal{H}_n$ satisfies the Knill--Laflamme condition for $t$-error correction if for all Pauli strings $E,F$…
  • pauliXSupportThe X-support (bit-flip) vector of a Pauli string: (pauliXSupport p) i = 1 iff p i ∈ {X, Y}, else 0.
  • xz_rho_trace_oneFor every natural number L with 1 ≤ L, the trace of the reduced density matrix xz_rho L equals 1: Matrix.trace (xz_rho L) = 1.
  • weightThe support $\mathrm{supp}(p) \subseteq \mathrm{Fin}\,n$ consists of coordinates where $p(i) \neq I$; the weight is…
  • pauli_moment_two_eq_four_replica_sumFor every natural number n and n-qubit pure state ψ in Hn n, the second Pauli-Liouville moment (pauliLiouvilleMomentTwo n ψ as a complex…
  • 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…
  • pauliZSupportThe Z-support (phase) vector of a Pauli string: (pauliZSupport p) i = 1 iff p i ∈ {Y, Z}, else 0.
  • pauliOpFor $p \in \mathrm{PauliString}\,n$, the associated Pauli operator $\hat{p} : \mathcal{H}_n \to \mathcal{H}_n$.
  • gaussPauliExpectReal part of the Pauli expectation of the 3-qubit Pauli string p in the pure state ψ, i.e. Re⟨ψ|P_p|ψ⟩.
  • xz_matrix_a_is_hermitianFor every natural number L, the matrix xz_matrix_a L is Hermitian: (xz_matrix_a L).IsHermitian.
  • card_pauliStringsExactSupportNumber of Pauli strings with a prescribed support. Let $n$ be a natural number and let $S \subseteq \mathrm{Fin}\,n$ be a set of…
  • error_subspaces_orthogonalOrthogonality of distinct error subspaces. Let $C \le \mathcal{H}_n$ be a code that is non-degenerate for $t$-error correction, and let…
  • error_sphere_dimensionDimension of the error sphere of a non-degenerate code. Let $C \le \mathcal{H}_n$ be a code on $n$ qubits that is non-degenerate for $t$…
  • xz_rho_is_hermitianFor every natural number L, the reduced density matrix xz_rho L is Hermitian: (xz_rho L).IsHermitian.
  • ErrorSphereThe error sphere $\mathrm{ES}(C,t)$ is the subspace $\bigvee_{\mathrm{wt}(p)\le t} \hat{p}(C)$, i.e.\ the supremum of the Pauli…

Lean source view module on GitHub

set_option linter.mathlibStandardSet false in
open scoped BigOperators in
open scoped Real in
open scoped Nat in
open scoped Classical in
open scoped Pointwise in
set_option maxRecDepth 4000 in
set_option synthInstance.maxHeartbeats 20000 in
set_option synthInstance.maxSize 128 in
set_option relaxedAutoImplicit false in
set_option autoImplicit false in
open Complex Matrix in
/-- An n-qubit Pauli string: a function assigning a Pauli basis element to each of the n qubits. -/
noncomputable def PauliString (n : ℕ) := Fin n → PauliBasis
See it in the graphDiscuss this resultChallenge it