xz_rho_trace_one
For 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.
Statement
theorem xz_rho_trace_one (L : ℕ) (hL : 1 ≤ L) : Matrix.trace (xz_rho L) = 1- Source
- arXiv:2610.20846, Appendix C
- Verified
- 02 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 12
- xz_rhoThe reduced density matrix
xz_rho (L : ℕ) : Matrix (Fin L → Fin 2) (Fin L → Fin 2) ℂdefined as the matrix square… - 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}$.
- xz_pauli_stringThe function
xz_pauli_string (L : ℕ) : (Fin L → Fin 2) → PauliString Lmapping a configuration a : Fin L → Fin 2 to the Pauli string… - 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\}$.
- sigmaIThe $2\times 2$ identity matrix over $\mathbb{C}$, i.e.\ the Pauli operator $I$.
- sigmaXThe bit-flip Pauli matrix $X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$ over $\mathbb{C}$.
- sigmaYThe bit-phase-flip Pauli matrix $Y = \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}$ over $\mathbb{C}$.
- sigmaZThe phase-flip Pauli matrix $Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$ over $\mathbb{C}$.
- g$g(S,M) = \dim_{\mathbb{F}_p}(S^{\perp}_M) - \dim_{\mathbb{F}_p}(S_M)$.
- xz_pauliThe function
xz_pauli : Fin 2 → Fin 2 → PauliBasistaking two curried arguments a, b : Fin 2, mapping a = 0, b = 0 to PauliBasis.X; a =…
- xz_rhoThe reduced density matrix
Read back from the Lean
For every natural number $L \ge 1$, the trace of the complex matrix xz_rho L is equal to $1$.
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 theorem shows that the reduced density matrix xz_rho L has trace 1 for any L ≥ 1. By definition, xz_rho L is the square of an average A = (1 / 2^L) ∑_a P(a) of 2^L Pauli string operators. Expanding the square of the sum and invoking trace linearity reduces Tr(xz_rho L) to (1 / 2^(2L)) ∑_{a, b} Tr(P(a) P(b)). The key moves are proving that the Pauli string assignment a ↦ P(a) is injective and that Pauli strings are trace-orthogonal with Tr(P(a) P(b)) = 2^L δ_{a, b}, collapsing the double sum to 2^L diagonal terms of value 2^L, which cancels the prefactor (1 / 2^L)^2.
For any single-qubit Pauli basis elements s and t, Tr(σ_s σ_t) equals 2 if s = t and 0 otherwise. automation
Exhausts all 16 pairs of Pauli basis elements s, t ∈ {I, X, Y, Z}. In each case, unfolds the explicit matrices, computes the diagonal entries and trace sum, and verifies the arithmetic.
uses
PauliBasis.toMatrix.eq_1,PauliBasis.toMatrix.eq_2,PauliBasis.toMatrix.eq_3,PauliBasis.toMatrix.eq_4,Matrix.diag_apply,Fin.sum_univ_two,Complex.ext_ifffin_cases s <;> fin_cases t <;> simp [PauliBasis.toMatrix.eq_1, PauliBasis.toMatrix.eq_2, PauliBasis.toMatrix.eq_3, PauliBasis.toMatrix.eq_4, sigmaI, sigmaX, sigmaY, sigmaZ, Matrix.trace, Matrix.diag_apply, Fin.sum_univ_two, Complex.ext_iff] <;> norm_numThere is a canonical equivalence between functions into Cartesian products (∀ i, α i × β i) and pairs of functions (∀ i, α i) × (∀ i, β i).
Constructs the two-sided inverse by pointwise projection and pairing, verifying left and right inverses by function extensionality.
left_inv f := by funext i; rfl right_inv p := by ext i <;> rfl
A double sum ∑_i ∑_j f(i, j) over functions i, j : ι → Fin 2 can be rewritten as a single sum over pointwise pairs c : ι → (Fin 2 × Fin 2).
Converts the double sum into a sum over the product type using Fintype.sum_prod_type and then reindexes across the function-pair equivalence using Equiv.sum_comp.
uses
Fintype.sum_prod_type,Equiv.sum_comp,xz_rho_trace_one_pi_prod_equivrefine (Fintype.sum_prod_type (fun p : (ι → Fin 2) × (ι → Fin 2) => f p.1 p.2)).symm.trans ?_ exact (Equiv.sum_comp (xz_rho_trace_one_pi_prod_equiv (fun _ => Fin 2) (fun _ => Fin 2)) (fun p => f p.1 p.2)).symm
The trace of a product of two Pauli string matrices factorizes into the product of single-site traces: Tr(P_p P_q) = ∏_k Tr(σ_{p_k} σ_{q_k}).
Unfolds trace and matrix multiplication into coordinate sums, collects the coordinate product across sites, transforms the double sum into a sum over pointwise index pairs, and applies the generalized distributive law exchanging finite sums and products.
uses
Matrix.diag_apply,Matrix.mul_apply,Finset.prod_mul_distrib,xz_rho_trace_one_sum_pi_prod,Fintype.piFinset_univ,Finset.sum_prod_piFinset,Fintype.sum_prod_typesimp only [Matrix.trace, Matrix.diag_apply, Matrix.mul_apply, pauliMatrix] simp only [← Finset.prod_mul_distrib] rw [xz_rho_trace_one_sum_pi_prod] rw [← Fintype.piFinset_univ] rw [Finset.sum_prod_piFinset (s := Finset.univ) (κ := Fin 2 × Fin 2) (g := fun k z => (p k).toMatrix z.1 z.2 * (q k).toMatrix z.2 z.1)] simp only [Fintype.sum_prod_type]
For any n-qubit Pauli string p, the trace of its square is 2^n.
Applies the trace product factorization to Tr(P_p P_p). Each site contributes Tr(σ_{p_k}^2) = 2, yielding a product of n factors of 2.
uses
xz_rho_trace_one_trace_pauliMatrix_mul,xz_rho_trace_one_pauli_basis_trace_mul,Finset.prod_constrw [xz_rho_trace_one_trace_pauliMatrix_mul] simp [xz_rho_trace_one_pauli_basis_trace_mul, Finset.prod_const]
If p and q are distinct n-qubit Pauli strings, the trace of their product is 0.
Since p ≠ q, there exists at least one site k where p_k ≠ q_k. The trace factorization contains Tr(σ_{p_k} σ_{q_k}) = 0 as a factor, making the entire product vanish.
uses
xz_rho_trace_one_trace_pauliMatrix_mul,xz_rho_trace_one_pauli_basis_trace_mul,Finset.prod_eq_zero,Finset.mem_univ,if_negclassical rw [xz_rho_trace_one_trace_pauliMatrix_mul] simp only [xz_rho_trace_one_pauli_basis_trace_mul] obtain ⟨k, hk⟩ : ∃ k, p k ≠ q k := by by_contra hk push Not at hk exact h (funext hk) exact Finset.prod_eq_zero (Finset.mem_univ k) (if_neg hk)
The first argument of xz_pauli is uniquely recoverable: xz_pauli a b = xz_pauli a' b' implies a = a'. automation
Exhausts all 16 combinations of a, b, a', b' ∈ Fin 2, checking in each case that equal Pauli outputs require equal first indices.
fin_cases a <;> fin_cases b <;> fin_cases a' <;> fin_cases b' <;> simp_all [xz_pauli]The assignment of Pauli strings xz_pauli_string L is injective.
If two strings agree everywhere, their values at any coordinate j give xz_pauli (a j) ... = xz_pauli (b j) ..., from which a j = b j follows by left-invertibility of xz_pauli. Function extensionality then gives a = b.
uses
congrFun,xz_rho_trace_one_xz_pauli_fstintro a b hab funext j have h := congrFun hab j simp only [xz_pauli_string] at h exact xz_rho_trace_one_xz_pauli_fst h
For any two configurations a, b : Fin L → Fin 2, Tr(P(a) P(b)) equals 2^L if a = b and 0 if a ≠ b.
Splits into cases a = b and a ≠ b. The diagonal case reduces to the self-pairing trace 2^L; the off-diagonal case uses injectivity to show P(a) ≠ P(b) and applies orthogonality of distinct Pauli strings.
uses
xz_rho_trace_one_injective,xz_rho_trace_one_pauli_trace_mul_self,if_neg,xz_rho_trace_one_pauli_trace_mul_of_neclassical have hinj := xz_rho_trace_one_injective L have hsum : ∀ a b : Fin L → Fin 2, Matrix.trace (pauliMatrix (xz_pauli_string L a) * pauliMatrix (xz_pauli_string L b)) = if a = b then (2:ℂ)^L else 0 := by intro a b by_cases h : a = b · subst h; simp [xz_rho_trace_one_pauli_trace_mul_self] · rw [if_neg h, xz_rho_trace_one_pauli_trace_mul_of_ne] intro hcontra exact h (hinj hcontra)
The product of the two sums of Pauli string matrices expands into a double sum over pairs (a, b) of individual matrix products.
Applies right and left distributivity of matrix multiplication over finite sums.
uses
Matrix.sum_mul,Matrix.mul_sumhave hSS : (∑ a : Fin L → Fin 2, pauliMatrix (xz_pauli_string L a)) * (∑ a : Fin L → Fin 2, pauliMatrix (xz_pauli_string L a)) = ∑ a : Fin L → Fin 2, ∑ b : Fin L → Fin 2, pauliMatrix (xz_pauli_string L a) * pauliMatrix (xz_pauli_string L b) := by rw [Matrix.sum_mul] simp only [Matrix.mul_sum]
The trace of xz_rho L simplifies to (1 / 2^L) * (1 / 2^L) * ∑_a 2^L.
Unfolds xz_rho L and xz_matrix_a L, distributes the trace linearly over the expanded double sum, substitutes the trace pairing value 2^L δ_{a, b}, and sums over b to collapse the Kronecker delta.
uses
Matrix.smul_mul,Matrix.mul_smul,Matrix.trace_smul,smul_eq_mul,Matrix.trace_sum,Finset.sum_congr,Finset.sum_ite_eq,Finset.mem_univ,if_truesimp only [xz_rho, xz_matrix_a, hSS, Matrix.smul_mul, Matrix.mul_smul, Matrix.trace_smul, smul_eq_mul, Matrix.trace_sum] rw [Finset.sum_congr rfl (fun a _ => Finset.sum_congr rfl (fun b _ => hsum a b))] simp only [Finset.sum_ite_eq, Finset.mem_univ, if_true]
The sum ∑_a 2^L over all configurations a : Fin L → Fin 2 evaluates to 2^L * 2^L.
Computes the cardinality of the function space Fin L → Fin 2 as 2^L, and evaluates the sum of the constant 2^L over this domain as the cardinality times the constant.
uses
Fintype.card_fun,Fintype.card_fin,Finset.sum_const,Finset.card_univ,nsmul_eq_mulhave hcard : Fintype.card (Fin L → Fin 2) = 2 ^ L := by rw [Fintype.card_fun, Fintype.card_fin, Fintype.card_fin] rw [Finset.sum_const, Finset.card_univ, hcard, nsmul_eq_mul]
The trace of xz_rho L equals 1. automation
Casts natural powers to complex numbers and applies field simplification to cancel (1 / 2^L) * (1 / 2^L) * (2^L * 2^L) = 1, using 2^L ≠ 0.
uses
pow_ne_zero,two_ne_zeropush_cast have h2 : ((2:ℂ))^L ≠ 0 := pow_ne_zero _ two_ne_zero field_simp
Complex.ext_iff- Two complex numbers are equal if and only if their real and imaginary parts are equal.
Equiv.sum_comp- Summing a function reindexed by an equivalence equals summing the original function over the codomain.
Fin.sum_univ_two- A sum over the two-element set Fin 2 equals f(0) + f(1).
Finset.card_univ- The universal finset of a finite type has cardinality equal to the Fintype cardinality of that type.
Finset.mem_univ- Every element of a finite type belongs to its universal finset Finset.univ.
Finset.prod_const- The product of a constant element b over a finset s equals b raised to the power of the cardinality of s.
Finset.prod_eq_zero- A product over a finite set is zero if at least one factor in the set is zero.
Finset.prod_mul_distrib- A product over a finite set of pointwise products equals the product of the first factors times the product of the second factors.
Finset.sum_congr- Two finite sums are equal if their index sets are equal and their summands agree on every element.
Finset.sum_const- Summing a constant value over a finite set equals the cardinality of the set scalar-multiplied by that value.
Finset.sum_ite_eq- Summing an indicator expression (if a = x then b x else 0) over a finite set evaluates to b(a) if a is in the set, and 0 otherwise.
Finset.sum_prod_piFinset- Generalized distributivity: the sum over functions of a product over coordinates equals the product over coordinates of the sum of the components.
Fintype.card_fin- The cardinality of Fin n is n.
Fintype.card_fun- The cardinality of the function space α → β between finite types is |β|^|α|.
Fintype.piFinset_univ- The Cartesian product of universal finsets indexed by a finite type is the universal finset of the function type.
Fintype.sum_prod_type- A sum over a Cartesian product type equals the nested double sum over each component type.
Matrix.diag_apply- The i-th diagonal entry of a square matrix A is A(i, i).
Matrix.mul_apply- The (i, k) entry of the product of two matrices M and N is the sum over j of M(i, j) * N(j, k).
Matrix.mul_smul- Scalar multiplication on the second factor commutes with matrix multiplication: M * (a • N) = a • (M * N).
Matrix.mul_sum- Left distributivity of matrix multiplication over a finite sum: M * ∑ a, f(a) = ∑ a, M * f(a).
Matrix.smul_mul- Scalar multiplication on the first factor commutes with matrix multiplication: (a • M) * N = a • (M * N).
Matrix.sum_mul- Right distributivity of matrix multiplication over a finite sum: (∑ a, f(a)) * M = ∑ a, f(a) * M.
Matrix.trace_smul- The trace of a scalar multiple of a square matrix is the scalar times the trace of the matrix.
Matrix.trace_sum- The trace of a finite sum of square matrices is the sum of their individual traces.
PauliBasis.toMatrix.eq_1- The identity Pauli basis element PauliBasis.I corresponds to the 2x2 identity matrix sigmaI.
PauliBasis.toMatrix.eq_2- The Pauli basis element PauliBasis.X corresponds to the Pauli matrix sigmaX.
PauliBasis.toMatrix.eq_3- The Pauli basis element PauliBasis.Y corresponds to the Pauli matrix sigmaY.
PauliBasis.toMatrix.eq_4- The Pauli basis element PauliBasis.Z corresponds to the Pauli matrix sigmaZ.
congrFun- Equal functions take equal values at any argument: f = g implies f(a) = g(a).
if_neg- When a condition c is false, the conditional expression if c then t else e simplifies to e.
if_true- When the condition is True, the conditional expression if True then t else e simplifies to t.
nsmul_eq_mul- Natural number scalar multiplication in a semiring coincides with multiplication by the natural number cast to the ring: n • a = (↑n) * a.
pow_ne_zero- Any power a^n of a non-zero element a in a reduced monoid with zero is non-zero.
smul_eq_mul- Scalar multiplication of an element on another in a multiplication structure equals their product: a • b = a * b.
two_ne_zero- The number 2 is not equal to 0.
xz_rho_trace_one_injective- The map assigning an index configuration a : Fin L → Fin 2 to its Pauli string xz_pauli_string L a is injective.
xz_rho_trace_one_pauli_basis_trace_mul- The trace of the product of two single-qubit Pauli matrices is 2 if the two basis elements are equal, and 0 otherwise.
xz_rho_trace_one_pauli_trace_mul_of_ne- The trace of the product of two distinct Pauli strings is 0.
xz_rho_trace_one_pauli_trace_mul_self- The trace of the square of an n-qubit Pauli string matrix is 2^n.
xz_rho_trace_one_pi_prod_equiv- The canonical bijection between a family of pairs (∀ i, α i × β i) and a pair of families (∀ i, α i) × (∀ i, β i).
xz_rho_trace_one_sum_pi_prod- A double sum over pairs of functions into Fin 2 equals a single sum over functions into Fin 2 × Fin 2.
xz_rho_trace_one_trace_pauliMatrix_mul- The trace of a product of two n-qubit Pauli string matrices equals the product over all n sites of the single-qubit trace pairings.
xz_rho_trace_one_xz_pauli_fst- If xz_pauli a b = xz_pauli a' b', then a = a'.
- The trace orthonormality of single-qubit Pauli matrices (xz_rho_trace_one_pauli_basis_trace_mul) and the left-invertibility of xz_pauli (xz_rho_trace_one_xz_pauli_fst) are established by exhaustive 16-case analysis via fin_cases.
- The final arithmetic cancellation ((1 / 2^L)^2 * 2^(2L) = 1) is closed automatically by field_simp after casting from natural numbers to complex numbers.
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
open scoped BigOperatorsopen Matrix/-- Trace pairing of two single-qubit Pauli matrices: orthonormal up to a factor 2. -/private lemma xz_rho_trace_one_pauli_basis_trace_mul (s t : PauliBasis) : Matrix.trace (PauliBasis.toMatrix s * PauliBasis.toMatrix t) = if s = t then (2:ℂ) else 0 := by fin_cases s <;> fin_cases t <;> simp [PauliBasis.toMatrix.eq_1, PauliBasis.toMatrix.eq_2, PauliBasis.toMatrix.eq_3, PauliBasis.toMatrix.eq_4, sigmaI, sigmaX, sigmaY, sigmaZ, Matrix.trace, Matrix.diag_apply, Fin.sum_univ_two, Complex.ext_iff] <;> norm_num/-- Splitting a family indexed by pairs of functions into a single family of pointwise pairs. -/private def xz_rho_trace_one_pi_prod_equiv {ι : Type*} (α β : ι → Type*) : (∀ i, α i × β i) ≃ (∀ i, α i) × (∀ i, β i) where toFun f := (fun i => (f i).1, fun i => (f i).2) invFun p := fun i => (p.1 i, p.2 i) left_inv f := by funext i; rfl right_inv p := by ext i <;> rfl/-- A double sum over pairs of 2-valued functions is a single sum over pointwise pairs. -/private lemma xz_rho_trace_one_sum_pi_prod {ι : Type*} [Fintype ι] [DecidableEq ι] {M : Type*} [AddCommMonoid M] (f : (ι → Fin 2) → (ι → Fin 2) → M) : (∑ i, ∑ j, f i j) = ∑ c : ι → (Fin 2 × Fin 2), f (fun k => (c k).1) (fun k => (c k).2) := by refine (Fintype.sum_prod_type (fun p : (ι → Fin 2) × (ι → Fin 2) => f p.1 p.2)).symm.trans ?_ exact (Equiv.sum_comp (xz_rho_trace_one_pi_prod_equiv (fun _ => Fin 2) (fun _ => Fin 2)) (fun p => f p.1 p.2)).symm/-- The trace of a product of two Pauli string matrices is the product of the single-site traces. -/private lemma xz_rho_trace_one_trace_pauliMatrix_mul {n : ℕ} (p q : PauliString n) : Matrix.trace (pauliMatrix p * pauliMatrix q) = ∏ k, Matrix.trace ((p k).toMatrix * (q k).toMatrix) := by simp only [Matrix.trace, Matrix.diag_apply, Matrix.mul_apply, pauliMatrix] simp only [← Finset.prod_mul_distrib] rw [xz_rho_trace_one_sum_pi_prod] rw [← Fintype.piFinset_univ] rw [Finset.sum_prod_piFinset (s := Finset.univ) (κ := Fin 2 × Fin 2) (g := fun k z => (p k).toMatrix z.1 z.2 * (q k).toMatrix z.2 z.1)] simp only [Fintype.sum_prod_type]/-- Self-pairing of a Pauli string matrix: trace of the square is `2 ^ n`. -/private lemma xz_rho_trace_one_pauli_trace_mul_self {n : ℕ} (p : PauliString n) : Matrix.trace (pauliMatrix p * pauliMatrix p) = (2:ℂ)^n := by rw [xz_rho_trace_one_trace_pauliMatrix_mul] simp [xz_rho_trace_one_pauli_basis_trace_mul, Finset.prod_const]/-- Distinct Pauli strings are orthogonal in the trace pairing. -/private lemma xz_rho_trace_one_pauli_trace_mul_of_ne {n : ℕ} {p q : PauliString n} (h : p ≠ q) : Matrix.trace (pauliMatrix p * pauliMatrix q) = 0 := by classical rw [xz_rho_trace_one_trace_pauliMatrix_mul] simp only [xz_rho_trace_one_pauli_basis_trace_mul] obtain ⟨k, hk⟩ : ∃ k, p k ≠ q k := by by_contra hk push Not at hk exact h (funext hk) exact Finset.prod_eq_zero (Finset.mem_univ k) (if_neg hk)/-- `xz_pauli` recovers its first argument. -/private lemma xz_rho_trace_one_xz_pauli_fst {a b a' b' : Fin 2} (h : xz_pauli a b = xz_pauli a' b') : a = a' := by fin_cases a <;> fin_cases b <;> fin_cases a' <;> fin_cases b' <;> simp_all [xz_pauli]/-- `xz_pauli_string L` is injective. -/private lemma xz_rho_trace_one_injective (L : ℕ) : Function.Injective (xz_pauli_string L) := by intro a b hab funext j have h := congrFun hab j simp only [xz_pauli_string] at h exact xz_rho_trace_one_xz_pauli_fst h/-- The reduced density matrix rho_L has unit trace for any L >= 1. -/theorem xz_rho_trace_one (L : ℕ) (hL : 1 ≤ L) : Matrix.trace (xz_rho L) = 1 := by classical have hinj := xz_rho_trace_one_injective L have hsum : ∀ a b : Fin L → Fin 2, Matrix.trace (pauliMatrix (xz_pauli_string L a) * pauliMatrix (xz_pauli_string L b)) = if a = b then (2:ℂ)^L else 0 := by intro a b by_cases h : a = b · subst h; simp [xz_rho_trace_one_pauli_trace_mul_self] · rw [if_neg h, xz_rho_trace_one_pauli_trace_mul_of_ne] intro hcontra exact h (hinj hcontra) have hSS : (∑ a : Fin L → Fin 2, pauliMatrix (xz_pauli_string L a)) * (∑ a : Fin L → Fin 2, pauliMatrix (xz_pauli_string L a)) = ∑ a : Fin L → Fin 2, ∑ b : Fin L → Fin 2, pauliMatrix (xz_pauli_string L a) * pauliMatrix (xz_pauli_string L b) := by rw [Matrix.sum_mul] simp only [Matrix.mul_sum] simp only [xz_rho, xz_matrix_a, hSS, Matrix.smul_mul, Matrix.mul_smul, Matrix.trace_smul, smul_eq_mul, Matrix.trace_sum] rw [Finset.sum_congr rfl (fun a _ => Finset.sum_congr rfl (fun b _ => hsum a b))] simp only [Finset.sum_ite_eq, Finset.mem_univ, if_true] have hcard : Fintype.card (Fin L → Fin 2) = 2 ^ L := by rw [Fintype.card_fun, Fintype.card_fin, Fintype.card_fin] rw [Finset.sum_const, Finset.card_univ, hcard, nsmul_eq_mul] push_cast have h2 : ((2:ℂ))^L ≠ 0 := pow_ne_zero _ two_ne_zero field_simp