Designing the Quantum Channels Induced by Diagonal Gates

The challenge of quantum computing is to combine error resilience with universal computation. Diagonal gates such as the transversal $T$ gate play an important role in implementing a universal set of quantum operations. This paper introduces a framework that describes the process of preparing a code state, applying a diagonal physical gate, measuring a code syndrome, and applying a Pauli correction that may depend on the measured syndrome (the average logical channel induced by an arbitrary diagonal gate). It focuses on CSS codes, and describes the interaction of code states and physical gates in terms of generator coefficients determined by the induced logical operator. The interaction of code states and diagonal gates depends very strongly on the signs of $Z$-stabilizers in the CSS code, and the proposed generator coefficient framework explicitly includes this degree of freedom. The paper derives necessary and sufficient conditions for an arbitrary diagonal gate to preserve the code space of a stabilizer code, and provides an explicit expression of the induced logical operator. When the diagonal gate is a quadratic form diagonal gate (introduced by Rengaswamy et al.), the conditions can be expressed in terms of divisibility of weights in the two classical codes that determine the CSS code. These codes find application in magic state distillation and elsewhere. When all the signs are positive, the paper characterizes all possible CSS codes, invariant under transversal $Z$-rotation through $\pi/2^l$, that are constructed from classical Reed-Muller codes by deriving the necessary and sufficient constraints on $l$. The generator coefficient framework extends to arbitrary stabilizer codes but there is nothing to be gained by considering the more general class of non-degenerate stabilizer codes.


Introduction and Review 1
We approach quantum computing through fault tolerant implementation of a universal set of gates. There are many finite sets of gates that are universal, and a standard choice is to augment the set of Clifford gates by a non-Clifford unitary [7] such as the T gate (π/8 rotation). Gottesman and Chuang [20] introduced the Clifford hierarchy of unitary operators. The first level is the Pauli group. The second level is the Clifford group, which consists of unitary operators that normalize the Pauli group. The l-th level consists of unitary operators that map Pauli operators to the (l − 1)-th level under conjugation. The teleportation model of quantum computation introduced in [20] is closely related to the structure of the Clifford hierarchy (for details, see [1,4,5,15,33,36,42]). The diagonal gates in the Clifford hierarchy form a group [15,42], and the diagonal entries are 2 l -th roots of unity raised to some polynomial function of the qubit state. Cui et al. [15] determined the level of a diagonal gate in the Clifford hierarchy in terms of l and the degree of the polynomial function. Quadratic form diagonal (QFD) gates are a family of diagonal gates associated with quadratic forms. The class of QFD gates includes transversal Z-rotations through π/2 l , and encompasses all 2-local gates in the hierarchy [36].
Quantum error-correcting codes (QECCs) protect information as it is transformed by logical 1 Section 2 introduces notation and provides technical background for the results described in this section. (2) applying a diagonal physical gate U Z to obtain ρ 2 ; (3) using X-stabilizers to measure ρ 2 , obtaining the syndrome µ with probability p µ , and the post-measurement state ρ 3 ; (4) applying a Pauli correction to ρ 3 , obtaining ρ 4 . The generator coefficients A µ,γ are obtained by expanding the logical operator B µ in terms of Z-logical Pauli operators (0,γ) E(0, γ), where (0,γ) ∈ {±1}.
gates. In general, a logical non-Clifford gate is more difficult to implement than a logical Clifford gate [19]. Any non-Clifford operation on the k logical qubits of an [[n, k, d]] QECC must be induced by a non-Clifford operation on the n physical qubits [15]. We derive a global necessary and sufficient condition for any diagonal physical gate to preserve the code space of a stabilizer code [11,18]. A transversal gate [18] is a tensor product of unitaries on individual code blocks. In the case of transversal Z-rotation through π/2 l , we show that this global condition is equivalent to the local trigonometric conditions derived by Rengaswamy et al. [35]. Our approach has the advantage of providing insight into the induced logical operator.
It is essential that a set of gates be both universal and fault-tolerant. Fault-tolerance of transversal gates follows from the observation that uncorrelated errors remain uncorrelated in code blocks. The Eastin-Knill Theorem [17] reveals that we cannot implement a universal set of logical operations on a QECC using transver-sal operations alone. Magic state distillation (MSD) combines transversal gates with an ancillary magic state to circumvent this restriction [2,9,10,13,14,22,25,26,34,39]. If the initial fidelity of magic state exceeds a certain threshold, then it can be purified by successive application of the quantum teleportation protocol on stabilizer codes that are able to realize a logical non-Clifford gate. (Generalized) triorthogonal codes [9,22] are Calderbank-Shor-Steane (CSS) codes [12,37] designed to implement a non-Clifford logical gate (up to some diagonal Clifford logical gates). Hamming weights in the classical codes that determine the CSS codes are required to satisfy certain divisibility properties [13,21,26,31,39]. Many examples employ Reed-Muller (RM) codes. In Section 5 we characterize CSS codes constructed from classical RM codes that are fixed by transversal Z-rotation through π/2 l . MSD provides a path to universal fault tolerant computation, where success depends on engineering the interaction of code states and physi-cal gates. Here we consider the interaction of a diagonal physical gate U Z with the code states of a stabilizer code, as shown in Figure 1. We prepare an initial code state, apply a physical gate, then measure a code syndrome µ, and finally apply a correction based on µ. For each syndrome, we expand the induced logical operator in the Pauli basis to obtain the generator coefficients that capture state evolution. Intuitively, the diagonal physical gate preserves the code space if and only if the induced logical operator corresponding to the trivial syndrome is unitary.
The effectiveness of magic state distillation (MSD) depends on the probability of observing a given syndrome, and it is possible to combine syndrome measurement with a decoder (see Krishna and Tillich [25] for example). Generator coefficients provide a framework for investigating the effectiveness and the threshold of distillation. We describe the design space that is available through a running example.
Example 1 (The [ [7,1,3]] Steane code). Reichardt [34] demonstrated that it is possible to distill the magic state |A = (|0 + e ıπ/4 |1 )/ √ 2 by post-selecting on the trivial syndrome, even though the Steane code is not perfectly preserved by the transversal T gate. He also demonstrated the distillation threshold is optimal for |A . In Section 4, we use generator coefficients to describe the average-logical channel induced by the transversal T gate on the Steane code. When we observe the trivial syndrome, the induced logical operator is T † . Otherwise it is a logical Pauli Z followed by a logical T † . The induced logical operator becomes T † for all syndromes after applying a logical Pauli Z correction to all non-trivial syndromes. However, the distillation protocol no longer converges, despite the higher probability of success 2 . Generator coefficients encode the probabilities of observing different syndromes, which can be used to analyze variants of the Steane protocol (such as applying a decoder to subsets of syndromes), as well as MSD protocols that use different codes (such as the [ [15,1,3]] code).
The introduction of magic state distillation by Bravyi and Kitaev [10] led to the construction of CSS codes where the code space is preserved by a 2 See Appendix A transversal Z-rotation of the underlying physical space [9,10,13,14,22,26,34,39]. The approach taken in each paper is to examine the action of a transversal Z-rotation on the basis states of a CSS code. This approach results in sufficient conditions for a transversal Z-rotation to realize a logical operation on the code space. In contrast we derive necessary and sufficient conditions by analyzing the action of a transversal diagonal gate on the stabilizer group that determines the code. In effect, we study the code space by studying symmetries of the codespace.
The interaction of transversal physical operators and code states depends very strongly on the signs of stabilizers [16,23]. Consider for example, the design of CSS codes that are oblivious to coherent noise. We can model the effective error as a uniform Z-rotation on each qubit through some (small) angle θ. We require the noise to preserve the code space and to act trivially (as the logical identity operator). It is possible to demonstrate the existence of weight-2 Z-stabilizers, and to show that their signs must be balanced [23]. Our generator coefficient framework includes the freedom to choose signs and this degree of freedom is relatively unexplored. We describe the design space that is available through a running example.
Example 2 (The [ [4,2,2]] code). Generator coefficients encode correlation between the initial code state and syndrome measurement, which may result in loss of logical information. The [[4, 2, 2]] code shows that correlation can depend very strongly on the signs of Z-stabilizers. The stabilizer group is S = X ⊗4 , Z ⊗4 . In Section 4 we show that if Z ⊗4 has a positive sign, then there is an embedded decoherence free subspace spanned by the three encoded basis states |01 , |10 , and |11 . We also show that syndrome measurement collapses logical information. If Z ⊗4 has a negative sign, then we show that logical information does not collapse, but the embedded decoherence free subspace disappears. Generator coefficients encode the different ways that code states can evolve.
We now summarize our main technical contributions.
1) We derive an explicit expression for the logical channel induced by a diagonal physical gate (Section 4, (75) describes the induced logical operator for each syndrome µ and (91) describes the probability of observing µ). We quantify the correlation between initial code state and measured syndrome by separating the probability of observing a given syndrome into two components, one depending on the generator coefficients, the other on the choice of initial state (Section 4.2). We analyze the [ [4,2,2]] code (Example 2) to show that each component depends strongly on the choice of signs in the stabilizer code, and that we can choose signs to create a embedded decoherence free subspace.
2) We derive necessary and sufficient conditions for an arbitrary diagonal physical gate to preserve the codespace of a CSS code with arbitrary signs (Section 5, Theorem 7), and describe the logical operator that results (Section 5, Remark 8). These conditions generalize earlier conditions found by Rengaswamy et al [35] for transversal Z-rotation through π/2 l .
3) We further simplify the necessary and sufficient conditions for a QFD gate to preserve the code space of a CSS code (Section 5, Theorem 9). These conditions govern divisibility of Hamming weights in the classical codes that determine the CSS codes. In the case of transversal Z-rotation through π/2 l applied to CSS codes with positive signs, we show the necessity of divisibility conditions derived in [26,39]. The rest of the paper is organized as follows. Section 2 introduces notation and provides the necessary background. Our review of stabilizer codes takes account of the freedom to choose signs in the stabilizer group, and provides the general encoding map and logical Pauli operators for CSS codes with arbitrary signs. Section 3 introduces the generator coefficients that describe how a diagonal gate acts on a CSS code. Section 4 describes how generator coefficient govern the average logical channel. Section 5 establishes necessary and sufficient conditions for a CSS code to support a diagonal physical gate, and derives the induced logical operator. We then derive the divisibility conditions and introduce RM constructions. Section 6 concludes the paper and discusses future directions. In Appendix B, we extends the generator coefficient framework to general stabilizer codes and show that CSS codes perform at the least as well as non-degenerate stabilizer codes for diagonal gates.

Classical Reed-Muller Codes
Let F 2 = {0, 1} denote the binary field. Let m ≥ 1, and let x 1 , x 2 , . . . , x m be binary variables (monomials of degree 1). Monomials of degree r can be written as x i 1 x i 2 · · · x ir where i j ∈ {1, 2, . . . , m} are distinct. A boolean function with degree r is a binary linear combination of monomials with degrees at most r. There is a one-to-one correspondence between boolean functions h and evaluation vectors h The degree 0 boolean function corresponds to the constant evaluation vector 1 ∈ F 2 m 2 . For 0 ≤ r ≤ m, the Reed-Muller code RM(r, m) is the set of all evaluation vectors h associated with boolean functions h(x 1 , x 2 , · · · , x m ) of degree at most r, RM(r, m) The length of the RM(r, m) code is 2 m , the dimension is given by k = r j=0 m j , and the minimal distance is 2 m−r . The dual of RM(r, m) is RM(m−r −1, m), and we can construct the RM codes by a recur-sively observing RM(r, m+ 1) = {(u, u+v) | u ∈ RM(r, m), v ∈ RM(r − 1, m)} [28]. Note that all weights in RM(r, m) are multiples of 2 (m−1)/r [3,28,29], and the highest power of 2 that divides all weights of codewords in RM(r, m) is exactly 2 (m−1)/r [6].

The MacWilliams Identities
Let ı := √ −1 be the imaginary unit. We denote the Hamming weight of a binary vector v by w H (v). The weight enumerator of a binary linear code C ⊂ F m 2 is the polynomial The MacWilliams Identities [27] relate the weight enumerator of a code C to that of the dual code C ⊥ , and are given by Given an angle θ ∈ (0, 2π), we make the substitution x = cos θ 2 and y = −ı sin θ 2 , and define

The Pauli Group
Any 2 × 2 Hermitian matrix can be uniquely expressed as a real linear combination of the four single qubit Pauli matrices/operators and Y := ıXZ. The operators satisfy Let A ⊗ B denote the Kronecker product (tensor product) of two matrices A and B. Let n ≥ 1 and N = 2 n . Given binary vectors a = [a 1 , a 2 , . . . , a n ] and b = [b 1 , b 2 , . . . , b n ] with a i , b j = 0 or 1, we define the operators We often abuse notation and write a, b ∈ F n 2 , though entries of vectors are sometimes interpreted in Z 4 = {0, 1, 2, 3}. Note that D(a, b) can have order 1, 2 or 4, but E(a, b) 2 = ı 2ab T D(a, b) 2 = ı 2ab T (ı 2ab T I N ) = I N . The nqubit Pauli group is defined as The n-qubit Pauli matrices form an orthonormal basis for the vector space of N × N complex matrices (C N ×N ) under the normalized Hilbert-Schmidt inner product A, B := Tr(A † B)/N [18]. We use the Dirac notation, |· to represent the basis states of a single qubit in C 2 . For any v = [v 1 , v 2 , · · · , v n ] ∈ F n 2 , we define |v = |v 1 ⊗ |v 2 ⊗ · · · ⊗ |v n , the standard basis vector in C N with 1 in the position indexed by v and 0 elsewhere. We write the Hermitian transpose of |v as v| = |v † . We may write an arbitrary n-qubit quantum state

The Clifford Hierarchy
The Clifford hierarchy of unitary operators was introduced in [20]. The first level of the hierarchy is defined to be the Pauli group C (1) = HW N . For l ≥ 2, the levels l are defined recursively as where U N is the group of N ×N unitary matrices. The second level is the Clifford Group, C (2) , which can be generated (up to overall phases) using the "elementary" unitaries Hadamard, Phase, and either of Controlled-NOT (CX) or Controlled-Z (CZ) defined respectively as Note that Clifford unitaries in combination with any unitary from a higher level can be used to approximate any unitary operator arbitrarily well [7]. Hence, they form a universal set for quantum computation. A widely used choice for the non-Clifford unitary is the T gate in the third level defined by

Stabilizer Codes
We define a stabilizer group S to be a commutative subgroup of the Pauli group HW N , where every group element is Hermitian and no group element is −I N . We say S has dimension r if it can be generated by r independent elements as Given a stabilizer group S, the corresponding stabilizer code is the fixed subspace V(S) := {|ψ ∈ C N : g|ψ = |ψ for all g ∈ S}. We refer to the subspace V(S) as an [[n, k, d]] stabilizer code because it encodes k := n − r logical qubits into n physical qubits. The minimum distance d is defined to be the minimum weight of any operator in N HW N (S)\S. Here, the weight of a Pauli operator is the number of qubits on which it acts non-trivially (i.e., as X, Y or Z), and N HW N (S) denotes the normalizer of S in HW N defined by Note that the second equality defines the centralizer of S in HW N , and it follows from the first since Pauli matrices commute or anti-commute. For any Hermitian Pauli matrix E (c, d) and ν ∈ {±1}, the operator I N +νE(c,d) 2 projects onto the ν-eigenspace of E (c, d). Thus, the projector onto the codespace V(S) of the stabilizer code defined by S = ν i E (c i , d i ) : i = 1, 2, . . . , r is where j ∈ {±1} is a character of the group S, and is determined by the signs of the gen- Let |α L , α ∈ F k 2 be the protected logical state. We define the generating set {X L j , Z L j ∈ HW 2 k : j = 1, . . . k = k 1 − k 2 } for the logical Pauli operators by the actions where and Z L j |α L = (−1) α j |α L . LetX j ,Z j be the n-qubit operators which are physical representatives of X L j , Z L j for j = 1, . . . , k. ThenX j ,Z j commute with the stabilizer group S and satisfȳ Remark 1. A stabilizer code determines a resolution of the identity with the different subspaces fixed by different signings of the stabilizer generators. When we correct stochastic and independent Pauli errors, different signings of stabilizer generators lead to quantum codes with identical performance. However, when we consider correlated errors such as the coherent errors (rotations of Z axis for any angle θ), the signs of stabilizers play an important role [16,23].
Example 3 (3-qubit bit flip code with negative signs). Consider the stabilizer code defined by the group S = −Z 1 Z 2 , Z 2 Z 3 , which differs from the stabilizer group of the 3-qubit bit flip code, S = Z 1 Z 2 , Z 2 Z 3 , just by the sign of Z 1 Z 2 . The encoding circuit of V(S ) consist of CX 1→2 and CX 1→3 gates, which maps |0 L to |000 and |1 L to |111 . Since XZX † = −Z, the encoding circuit of V(S) has an extra X gate on the first qubit, which has |0 = |100 and |1 = |011 . Moreover, the physical representation of logical Pauli X and Z for S is X 1 X 2 X 3 and Z 1 respectively, i.e.,X = X 1 X 2 X 3 ,Z = −Z 1 .

CSS Codes
A CSS (Calderbank-Shor-Steane) code is a particular type of stabilizer code with generators that can be separated into strictly X-type and strictly Z-type operators. Consider two classical binary codes C 1 , C 2 such that C 2 ⊂ C 1 , and let C ⊥ 1 , C ⊥ 2 denote the dual codes. Note that Then, the corresponding CSS code has the stabilizer group The CSS code projector can be written as the product: where and Each projector defines a resolution of the identity, and we focus on Π S X since we consider diagonal gates. Note that any n-qubit Pauli Z operator can be expressed as Then, we have and If C 1 and C ⊥ 2 can correct up to t errors, then S defines an [[n, k 1 − k 2 , d]] CSS code with d ≥ 2t+ 1, which we will represent as CSS(X, C 2 ; Z, C ⊥ 1 ). If G 2 and G ⊥ 1 are the generator matrices for C 2 and C ⊥ 1 respectively, then the generates S.

General Encoding Map for CSS codes
Given an [[n, k, d]] CSS(X, C 2 ; Z, C ⊥ 1 ) code with all positive signs, let G C 1 /C 2 be the generator matrix for all coset representatives for C 2 in C 1 (note that the choice of coset representatives is not unique). The canonical encoding map e : Note that the signs of stabilizers change the fixed subspace by changing the eigenspaces that enter into the intersection. Thus, the encoding map needs to include information about nontrivial signs.
We capture sign information through character vectors y ∈ F n 2 /C 1 , r ∈ F n 2 /C ⊥ 2 (note that the choice of coset representatives is not unique) defined for Z-stabilizers and X-stabilizers respectively by and The generalized encoding map g e : |α L ∈ F k 2 → |α ∈ V(S) is defined by To verify that the image of the general encoding map g e is in V(S), we show that for

General Logical Pauli Operators for CSS codes
Given the choice of Assume we have and where the second to last step follows from (32). Thus we can choosē (36) where w i , γ i are the i-th rows of the above coset generator matrices respectively.

Remark 2.
Applying appropriate Pauli operators takes care of different signs in the stabilizer group and changes the sign of logical Pauli operators. Although the sign for a single logical Pauli operator is not observable, a general logical operator is a linear combination of logical Pauli operators, which may bring the global sign into some local phase.
. We may choose the generator matrices of C 1 /C 2 and C ⊥ 2 /C ⊥ 1 as The encoded basis states and logical Pauli operators for two choices of the signs are given below.

Quantum Channels
The quantum states defined in Section 2.3 are called pure states. When a system contains multiple pure states |ψ x with probabilities p x , the ensemble {p x , |ψ x }, is described by a density operator ρ given by Every density operator is Hermitian, positive semi-definite, with unit trace. Conversely, any operator with these three properties can be written in the form (38). Every ensemble determines a unique density operator but a density operator can describe different ensembles.
Suppose we measure the density operator ρ with a finite set of projectors {Π j } j forming a resolution of the identity. If the initial state in the ensemble is |ψ x , then we observe the outcome j with probability p(j|x) = ψ x |Π j |ψ x = Tr(Π j |ψ x ψ x |) and obtain the reduced state . From the perspective of density operators, we observe the outcome j with probability p j = x p x p(j|x) = Tr(Π j ρ) and the density operator evolves to be Π j ρΠ j p j . Thus, after measurement, we have a ensemble of ensembles described by a new density operator ρ given by [40] A quantum channel is linear, completelypositive, and trace-preserving, and can be characterized by a Kraus representation [32,40]. A map Φ : H → G is linear, completely-positive, and trace-preserving if and only if there exists a finite set of operators The operators {B k } k are called Kraus operators and satisfy and Note that the Kraus representation of a quantum channel is not unique.

Generator Coefficients
Starting from the general encoding map and logical Pauli operators of CSS codes introduced in Section 2.7, we study gates interacting with these codes. We consider quantum gates for which the Pauli expansion consists only of tensor products of Pauli Z's (or Pauli X's). We partition F n 2 into cosets of the Z-stabilizers (or X-stabilizers), and define generator coefficients that take advantage of the structure of stabilizer group. The framework of generator coefficients provides insight into the average logical channel, the necessary and sufficient conditions for a CSS code to be invariant under a particular gate, and the induced logical operator. We extend the framework of generator coefficients to general stabilizer codes in Appendix B. Consider a 2 n × 2 n unitary matrix (quantum We define the generator coefficients for U Z acting on a given CSS code as follows.

Definition 3 (Generator Coefficients for
1 } and the character vector y ∈ F n 2 /C 1 for Zstabilizers. Let µ ∈ F n 2 /C ⊥ 2 be any X-syndrome and γ ∈ C ⊥ 2 /C ⊥ 1 be any Z-logical. Then, for any pair µ, γ, we define the generator coefficient A µ,γ corresponding to the diagonal unitary gate Note that given a CSS code with not all positive signs, the character vector y is unique up to an element of C 1 . A different choice of the coset representatives of C 1 in F n 2 only changes the signs of A µ,γ , and leads to a global phase in the logical quantum channel induced by U Z , which is given in Section 4.
By partitioning F n 2 into cosets of C ⊥ 1 , we gain insight into the interaction of syndromes and logicals. The code projector is Π S = Π S X Π S Z , and we have In the above summations, µ ∈ F n 2 /C ⊥ 2 and γ ∈ C ⊥ 2 /C ⊥ 1 , and A µ,γ is given by (45). We now study the generator coefficients associated with two different types of quantum gate U Z .

Transversal Z-Rotations R Z (θ)
There are two reasons to study how ⊗n acts on the states within a quantum error-correcting code. The first is that when θ is not a multiple of π 2 , R Z (θ) may realize a non-Clifford logical gate, and the second is that coherent noise can be modeled as {R Z (θ)} θ∈(0,2π) . The Pauli expansion of (47) , we substitute it in (45), and obtain the generator coefficients of R Z (θ), where H is the parity-check matrix of the Hamming code: where 0, 1 are the vectors of all ones and all zeros respectively. If we compute the generator coefficients directly from (48), then we need the weight enumerators of all cosets of C ⊥ 1 . We may simplify these calculations using the MacWilliams Identities. Consider for example the case µ = 0 and γ = 1, where we may write where P θ [C] is defined in (4). We apply the MacWilliams Identities to P θ [C ⊥ 1 ] to obtain We simplify the term P [ C ⊥ 1 , 1 ] in the same way, It follows from (51), (52), and (53) that where (55) is obtained from (54) by substituting in the weight enumerator of C 1 We compute all the generator coefficients for the Steane code in Table 1. We return to this data in Section 4.1 to provide more insight into the logical channel determined by R Z (θ), and in Section 4.2 to calculate the probabilities of observing different syndromes.
Before introducing the Kraus decomposition of R Z (θ) acting on a CSS code, we provide an alternative definition of generator coefficients which simplifies calculations. We first write A µ,γ(θ) as a linear combination of weight enumerators, then apply the MacWilliams Identities.
Lemma 4 (Simplified Definition of Generator Coefficients). Consider a CSS(X, C 2 ; Z, C ⊥ 1 ) code, where y is the character vector for the Zstabilizers (0,z) = (−1) zy T . Then, the generator coefficients A µ,γ (θ) defined in (48) can be written as Remark 5. The original definition (48) requires a sum over the weights of every coset C ⊥ 1 . The alternative definition (56) requires a sum over a single coset C 1 + y, where the syndrome µ and logical γ determine the hyperplane that specifies the signs in the sum.

Quadratic Form Diagonal Gates
Rengaswamy et al. [36] considered diagonal unitaries of the form where l ≥ 1 is an integer, ξ l = e ı π 2 l−1 , and R is an n × n symmetric matrix with entries in Z 2 l , the ring of integer modulo 2 l . Note that the exponent vRv T ∈ Z 2 l . When l = 2 and R is binary, we obtain the diagonal Clifford unitaries. QFD gates defined by (57) include all 1-local and 2local diagonal unitaries in the Clifford hierarchy, and they contain R Z (θ) for θ = 2π 2 l , where l ≥ 1 is an integer.
Setting l = 2, we list the generator coefficients for CZ ⊗2 in Table 2. Note that CZ and CP shared the same symmetric matrix R but the level l is different. Table 3 lists the generator coefficients for CP ⊗2 .

Average Logical Channel
We investigate the effect of U Z acting on a CSS codespace V(S) by considering the following steps: 1. Choose any initial density operator ρ 1 in the CSS codespace V(S). Then, we have ρ 1 = Π S ρ 1 Π S .
2. Apply U Z physically. Then the system evolves to 3. Measure with X-stabilizers to obtain the syndrome µ ∈ F n 2 /C ⊥ 2 . It follows from (39) that the system evolves to 4. Based on the syndrome µ, we apply a Pauli correction to map the state back to V(S). This correction may introduce some logical operator (0,γµ) E(0, γ µ ). The final state ρ 4 is in the CSS codespace.
Generator coefficients help describe the average logical channel resulting from U Z acting on a CSS codespace (steps 1-4). We extend our approach to arbitrary stabilizer codes in Appendix B.

The Kraus Representation
Kraus operators describe the logical channels obtained by averaging the action of U Z over density operators in V(S). Generator coefficient appear as the coefficients in the Pauli expansion of Kraus operators. We use generator coefficients to simplify the term U Z Π S in (67). It follows from (46) and the derivation in Appendix C.2 that where Π S X (µ) = 1 |C 2 | a∈C 2 (−1) aµ T (a,0) E(a, 0) as described in (23), and Since the projectors {Π S X (µ) } µ∈F n 2 /C ⊥ 2 are pairwise orthogonal, it follows from that for any fixed µ 0 ∈ F n 2 /C ⊥ 2 , we have Since ρ 1 describes an ensemble of states in the codespace V(S), it follows from that for fixed where K := (0,µ 0 ⊕γ 0 ) E(0, µ 0 ⊕ γ 0 ). Thus, we may write ρ 3 as where K 1 := γ∈C ⊥ 2 /C ⊥ 1 A µ,γ (0,µ⊕γ) E(0, µ⊕γ). Although the sign does not matter here, we carry it along for consistency with the logical Pauli Z operators derived in (36). Based on the syndrome µ, the decoder applies a correction and maps the quantum state back to the codespace V(S). This correction might induce some undetectable Z-logical (0,γµ) E(0, γ µ ) with γ 0 = 0. Hence, the final state after step 4 becomes where is the effective physical operator corresponding to syndrome µ. It follows from (36) that for γ ∈ C ⊥ 2 /C ⊥ 1 , (0,γ⊕γµ) E(0, γ ⊕ γ µ ) is a logical Pauli Z, and (74), (75) can be considered just in the logical space.
Note that the evolution described in (74) works for any initial code state ρ 1 in step 1. The interaction between the diagonal gate U Z and the structure of CSS code in step 2 is captured in the generator coefficients A µ,γ . The syndrome of the measurement in step 3 is reflected by the sum in (74), and the decoder chosen in step 4 is expressed by some logical Pauli Z determined by γ µ for each syndrome.
To show {B µ } µ∈F 2 /C ⊥ 2 is the set of Kraus operators, we need to verify that We may simplify the summation as where the new variable η = γ ⊕ γ ∈ C ⊥ 2 /C ⊥ 1 . In Theorem 6, we verify (76) by showing that the coefficient of E(0, 0) = I is 1 and that the coefficients of E(0, η), η = 0 are all zero. Theorem 6 describes the general property of generator coefficients, which mainly because quantum gates are unitaries.

Theorem 6. Suppose that a Z-unitary gate
Proof. See Appendix C.4.
We conclude that the Kraus operators describing the action of U Z on a CSS code are given by (75).
When U Z = R Z (θ), the generator coefficients A µ,γ take the form (48). Consider now a one-logical-qubit system, where one of the pair (A µ=0,γ=0 (θ), A µ=0,γ =0 (θ)) is real and the other is pure imaginary. Then the logical qubit is rotated with angle θ L and we can express θ L in terms of the physical rotation angle θ [16] as See Appendix C.3 for details. We again take the Steane code as an example, substitute the values from Table 1 and obtain the logical rotation angle θ L (θ) = 2 tan −1 sin 7θ 2 − 7 sin θ 2 cos 7θ 2 + 7 cos θ 2 = − 28 15 Figure 2 plots θ L (θ) displaying third-order convergence about θ = 0. Note that θ L ( π 4 ) = − π 4 . In Appendix A, we explain how R Z ( π 4 ) supports magic state distillation with the aid of a logical Phase gate. When θ < π 4 , θ L < θ, and the Steane code might be applied to convert 7 noisy copies of the state (|0 + e ıθ |1 )/ √ 2 into 1 copy of the state (|0 + e ıθ L |1 )/ √ 2 with higher fidelity. We now compute all Kraus operators induced by R Z (θ) acting on the Steane code. Example 1 (continued). We take the data in Table 1 and substitute θ = π 4 to obtain We assume γ µ = 0 for all µ, and use these generator coefficients to compute the Kraus operators Note that the Steane code is not a triorthogonal code [9], but it can be used in state distillation [34]. The generator coefficients framework may help to characterize codes that are not preserved by transversal T but realize a logical T gate when the trivial syndrome is observed. Recently, Vasmer [14]. It provides the first protocol in state distillation that supports a fault-tolerant logical T gate from a diagonal physical gate that is not transversal T . The generator coefficient framework applies to arbitrary diagonal gates, and may facilitate finding more examples of distillation.
When U Z is a QFD gate, the Kraus operators can be derived in the same way. Table 2 in Example 2 implies that the [[4, 2, 2]] code is preserved by CZ ⊗2 and that the induced logical operator is

Probability of Observing Different X-Syndromes
The Kraus operators derived in Section 4.1 describe logical evolution conditioned on different outcomes from stabilizer measurement, and it is natural to calculate the probability of observing different syndromes µ. Generator coefficients provide a means of calculating these probabilities that illuminates dependence on the initial state, and we will provide examples where the initial state and the outcome of syndrome measurement are entangled. Consider a CSS(X, C 2 ; Z, C ⊥ 1 ) code with codespace V(S). For any fixed |φ ∈ V(S) , we first apply U Z , and then measure with projectors {Π S X(µ) } µ∈F n where 0). Then the probability of obtaining a syndrome µ ∈ F n 2 /C ⊥ 2 is It follows from equation (46) that and similarly For any fixed µ 0 (87) It follows from the simplification in Appendix C.5 of the later half in (87) that where s(a) := a∈C 2 (−1) a(µ⊕µ 0 ) T . Note that since a ∈ C 2 and µ ⊕ µ 0 ∈ F n 2 /C ⊥ 2 , the inner summation is nonzero only when µ = µ 0 so that Similarly, we have Thus, the probability of observing the syndrome µ can be written as Note that only the second term depends on the initial state. If some |φ i ∈ {|+ , |− } in the initial state |φ = |φ 1 ⊗ · · · ⊗ φ k , then the second term (the cross terms) in (91) vanishes since every (0,γ⊕γ ) E(0, γ ⊕ γ ) with γ = γ is some nontrivial Pauli Z logical. Note that it follows from Theorem 6 that µ γ |A µ,γ | 2 = 1. Since µ p µ (|φ ) = 1 for any initial state |φ ∈ V(S), it follows that the sum of the second term over all the X-syndromes is 0, that is, Note that Pauli Z logicals only change signs in the |0 &|1 basis. If the second term is the same for all |0 &|1 computational basis states in the codespace, then the probability of observing different syndromes is the same for different initial states |φ . If not, the probabilities depend on the initial state, and encode the mutual information between initial state and syndrome measurement. In these circumstances, we cannot find a recovery operator for U Z that is good for the entire codespace. An important special case is when a decoherence-free subspace is embedded in the codespace (useful for passive control of coherent errors U Z = R Z (θ)).
We now introduce two examples to illustrate how (91) provides insight into invariance of the codespace, the probability of success in magic state distillation, and existence of an embedded decoherence-free subspace. Continuing Example 1 below, we compute the probabilities of observing different syndromes for the [[7, 1, 3]] Steane code and discuss implications. Continuing Example 2 below, we demonstrate that by changing signs of Z-stabilizers in the [[4, 2, 2]] code, we can switch from the case where the second term is the same for every initial state to the case of an embedded decoherence-free subspace.
Example 1 (continued). The Steane [[7, 1, 3]] code has only one logical qubit, and we let |0 , |1 denote the the two computational basis states. Given a syndrome µ, we observe that one of the generator coefficients A µ,γ=0 (θ), A µ,γ =0 (θ), is real and the other is purely imaginary, so that the crossterms vanish in (91). Hence, the probabilities of observing different syndromes are constant for different initial states and are given by It is not hard to verify that µ p µ (|φ , θ) = 1 32 (7 cos 4θ + 25) + 7 32 (1 − cos 4θ) = 1 for all |φ ∈ V(S) and for all θ. Figure 3 plots the probability of observing the trivial syndrome as a function of the rotation angle.
We observe from Figure 3 that when θ is a multiple of π 2 , p µ=0 (|φ ) = 1 for all the states |φ in the Steane codespace V(S), which implies that R Z ( kπ 2 ) preserves V(S). The angle θ = π 4 + kπ If the initial state is among |01 , |10 , |11 , then it evolves within the codespace for all angles θ, which implies that F := span(|01 , |10 , |11 ) forms a embedded decoherence-free subspace (DFS) inside the codespace [23].  When θ = π 4 + kπ 2 for some integer k, syndrome measurement acts as projection from V(S) to the embedded DFS, and we are able to learn whether the initial state was |00 ; When θ = kπ 2 for some integer k, the measurement outcome is always the zero syndrome, which implies that R Z ( π 2 ) perserve the codespace and some logical operator is induced. The Kraus operators derived in (75) imply that the induced logical operator is Next, we compute the generator coefficients for the same [ [4,2,2]] code but with nontrivial signs (character vector y = [0, 0, 0, 1]).

X-syndromes
It follows from (91) and Table 5 that In this case, the probabilities are independent of the different initial states and there is no embedded decoherence-free subspace in the codespace. This example shows that for the same code, state evolution depends very strongly on signs of Zstabilizers.
In prior work [23], we have derived criteria that ensure a stabilizer code is a DFS, and (91) opens the door to developing criteria for embedded DFS, in which the second term acts as an amendment to the first term and implies the probability is either 0 or 1 for a subset of initial |0 &|1 -basis state in the codespace.

CSS codes Preserved by U Z
When a CSS code is preserved by a unitary U Z , the probability of observing the zero syndrome is 1, and the Kraus operators capture evolution of logical states. Theorem 7 provides necessary and sufficient conditions for a unitary U Z to preserve a CSS code.
We prove Theorem 7 by writing Π S as a product Π S = Π S X Π S Z , where U Z commutes with the Z-projector Π S Z , and we then translate commutativity to conditions on generator coefficients. We generalize these conditions to arbitrary stabilizer codes in Appendix B.

Remark 8 (Logical Operator induced by U Z ).
We assume that U Z Π S U † Z = Π S for a CSS code defined by S. By Theorem 7, (98) holds, so that by Theorem 6 we only have one Kraus operator left in (75) that is given by Note that F k 2 C ⊥ 2 /C ⊥ 1 and we have a bijective map g : is the generator matrix selected. Let U L Z be the logical operator induced by U Z , and let α j be the jth entry of the vector α. Then, using (36), we translate the Kraus operator into the logical space as Thus, if a CSS code is preserved by , then the generator coefficients corresponding to the zero syndrome are simply the coefficients in the Pauli expansion of the induced logical operator. We also observe that U L Z given in (100) is unitary if and only if (98) holds.
In the following subsections, we simplify (98) in special cases when U Z is a QFD gate, and when U Z = R Z ( π p ) for some integer p. We then provide necessary and sufficient conditions for quantum Reed-Muller codes to be preserved by R Z ( 2π 2 l ), and connect to the conditions in [35,Theorem 17].

QFD Gates
Theorem 9 below specializes Theorem 7 to the broad class of diagonal level-l QFD gates τ (l) R determined by symmetric matrices R ∈ Z n×n 2 l . Note that Theorem 9 applies to CSS codes with arbitrary signs and R Z 2π 2 l form a subset of QFD gates. Theorem 9 includes the divisibility conditions derived in [26,39,43] as a special case. Theorem 9. Consider a CSS(X, C 2 ; Z, C ⊥ 1 )code, where y is the character vector of the Zstabilizers.
Then, a QFD gate τ Proof. It follows from (65) that where (103) We simplify (98) using (102) to obtain which requires each term to contribute 1 to the summation. We complete the proof by setting v 2 = v ⊕ v 1 .

Remark 10.
When R = I, then vRv T = w H (v) and the divisibility condition simplifies to the condition previously obtained for R Z 2π 2 l . If a CSS code is preserved by R Z 2π 2 l for all l ≥ 1, then it follows (101) that for any fixed w ∈ C 1 C 2 , all elements in the coset C 2 +w +y have the same Hamming weight. It then follows from the generalized encoding map given in (30) that any CSS code invariant under R Z 2π 2 l for all l ≥ 1 is a constant-excitation code [41].
We now explore the influence of signs by analyzing and separating the effect of the character vector y. Lemma 11. Consider a CSS(X, C 2 ; Z, C ⊥ 1 ) code, where y is the character vector of the Zstabilizers. Then, (101) holds for all v 1 , v 2 ∈ C 1 + y such that v 1 ⊕ v 2 ∈ C 2 if and only if for all u 1 , u 2 ∈ C 2 and w ∈ C 1 /C 2 .
Note that only (105) depends on the character vector y, and its contribution is moving the divisible requirement for a set to that for a coset. Note that by varying the level l, the same symmetric matrix R can determine different gates (for example, the gates CZ and CP in Example 5). The divisibility conditions corresponding to successive levels differ by a factor of 2. This suggests using concatenation to lift a code preserved by a level l QFD gate determined by R to a code preserved by a level l + 1 QFD gate determine by I 2 ⊗ R. We defer investigation to future work.

R Z (π/p) and RM Constructions
If the physical rotation angle θ is a fraction of π, then the constraint on generator coefficients in (98) is equivalent to conditions on the Hamming weights that appear in the classical codes C 1 and C 2 that determine the quantum CSS code.
for all w ∈ C 2 and all z ∈ C 1 + y, where y is the character vector that determines signs of Zstabilizers and w * z is the coordinate-wise product of w and z.
Remark 13 (Transversal π/2 l Z-rotation). Assume positive signs (character vector y = 0) and set p = 2 l−1 for some integer l ≥ 1. Since 0 ∈ C 1 and 0 ∈ C 2 , it follows from Theorem 12 that R Z π 2 l−1 preserves a CSS codespace V(S) if and only if 2 l | w H (w) for all w ∈ C 2 , and (108) 2 l−1 | w H (w * z) for all w ∈ C 2 and for all z ∈ C 1 .
(109) This result coincides with the sufficient conditions in [39,Proposition 4], which is a special case of the quasitransversality introduced earlier by Campbell and Howard [14]. For example, if a CSS code with all positive stabilizers is invariant under R Z π 4 , then the weight of every X-stabilizers needs to be divisible by 8. We note that the [ [8,3,2]] color code is the smallest errordetecting CSS code with all positive signs that is preserved by R Z π 4 . We defer the study of non-trivial character vectors y to future work.

Theorem 14 (Reed-Muller Constructions).
Consider Reed-Muller codes Proof. Note that all Z-stabilizers have positive signs corresponding to the case y = 0 in Theorem 12. Then, R Z π 2 l−1 preserves a CSS codespace if and only if (108) and (109) hold.
Let w ∈ C 2 and z ∈ C 1 . If r 2 = 0, then C 2 = {0, 1} and w H (w) ∈ {0, 2 m }. It follows from McEliece [29] (see also Ax [3]) that and this bound is tight. The two conditions become l ≤ min{m, m−1 If r 2 = 0, then it follows from McEliece [6,30] that m−1 r 2 is the highest power of 2 that divides w H (w) for all w ∈ C 2 = RM(r 2 , m). We first show (110) is necessary. It follows from (108) that We need to understand divisibility of weights w H (w * z) where w ∈ C 2 and z ∈ C 1 . The codeword w is the evaluation vector of a sum of monomials, and we start by considering the case of a single monomial. Consider a codeword w 1 ∈ C 2 corresponding to the evaluation of a monomial of degree s. For all z ∈ C 1 , we observe that w 1 * z is a codeword in RM(min{r 1 , m − s}, m − s) supported on w 1 . Then, m−s−1 max{r 1 ,m−s} is the highest power of 2 that divides w H (w 1 * z) for all z ∈ C 1 . Note that since s takes values from 0 to r 2 , we have We now consider w ∈ C 2 such that w = w 1 ⊕w 2 , where w 1 , w 2 are evaluation vectors correspond to monomials in C 2 . Then, for z ∈ C 1 , we have Since w, w 1 , w 2 ∈ C 2 , it follows from (109) that 2 l divides 2w H (w * z), 2w H (w 1 * z), and so 2w H (w 2 * z). By (114), we have Since w 1 * w 2 is the evaluation vector of a monomial with degree s ≤ min{m, 2r 2 }, w 1 * w 2 * z is a codeword in RM(min{r 1 , m − s }, m − s ) supported on w 1 * w 2 . Then, m−2r 2 −1 max{r 1 ,m−2r 2 } is the highest power of 2 that divides w H (w 1 * w 2 * z) for all w 1 * w 2 ∈ C 2 . The extremum is achieved when the monimials corresponding to w 1 and w 2 have degree r 2 and do not share a variable. Hence, It remains to consider the case w = w 1 ⊕ w 2 ⊕ · · · ⊕ w t ∈ C 2 , where each w i is the evaluation vector of a monomial. We use inclusion-exclusion to rewrite (109) as We now use induction. Assume for Note that for 1 ≤ i ≤ t − 1, w j 1 * · · · * w j i corresponds to a monomial with degree s ≤ min{m, ir}, hence w j 1 * · · · * w j i * z is a codeword in RM(min{r 1 , m − s }, m − s ) supported on w j 1 * · · · * w j i . Then, we have in which the bound on the exponent is tight since we can choose w 1 , · · · , w i to be evulations vectors corresponding to i disjoint monomials of degree r 2 . Hence, 2 l−1 divides all terms in (117) for i = 1, 2, . . . , t − 1. Hence, for the last term, we must have which implies that and the induction is complete. Note that since and the necessary condition reduces to To prove the sufficiency of the case r 2 = 0, we simply reverse the steps. is still the highest power of 2 that divides all of its weights. Hence, the RM constructions described in Theorem 14 can be extended to punctured RM codes. If operation 1 is applied on C 1 = RM(r 1 , m), and operations 1 and 2 are applied on C 2 = RM(r 2 , m), then we can relax the relation between r 1 and r 2 as r 1 ≥ r 2 . It follows from the same arguments that the resulting [[2 m − 1, r 1 j−r 2 +1 m j + 1, 2 min{r 2 +1,m−r 1 } − 1]] CSS code is preserved by R Z ( π 2 l−1 ) with the same constraint on l as described in (110). This family contains the [[2 m − 1, 1, 3]] triorthogonal codes described in [9].
which satisfies the necessary and sufficient conditions in (110).
We now illustrate Theorem 7 and Theorem 12 through two CSS codes preserved by R Z π 4 , one with a single logical qubit, the other with multiple logical quibts.
We compute the induced logical operator by computing the generator coefficients for the zero syndrome. Note that C ⊥ 2 /C ⊥ 1 = {0, 1}. The weight enumerators of C 1 and C 1 + 1 are given by We have The constraint on generator coefficients in (98) is satisfied: It follows from (100) that the logical operator The [ [8,3,2]] code can be used in magic state distillation for the controlled-controlled-Z (CCZ) gate in the third-level of Clifford hierarchy. To verify that the code is preserved by R Z π 4 and the induced logical operator is CCZ (up to some logical Pauli Z L ), we first compute the generator coefficients corresponding to the trivial syndrome. The weight enumerators of C ⊥ 1 and C ⊥ 1 +γ for γ ∈ C ⊥ 2 /C ⊥ 1 \ {0} are given by for all the seven non-zero γ ∈ C ⊥ 2 /C ⊥ 1 . Then, so (98) holds, and the induced logical operator is

Generator Coefficients and Trigonometric Identities
When θ = π 2 l for some integer l, Rengaswamy et al. [35] derived necessary and sufficient conditions for a stabilizer code to be invariant under R Z (θ). This derivation depends on prior work characterizing conjugates of arbitrary Pauli matrices by R Z ( π 2 l ) [36]. The necessary and sufficient conditions provided in [35,Theorem 17] are expressed as two types of trigonometric identity. We now show that our constraint on generator coefficients is equivalent to the first trigonometric identity, and that the second trigonometric identity follows from the first. Our main tool is the MacWilliams Identities [27], and our analysis extends from CSS codes to general stabilizer codes.
We demonstrate equivalence through a sequence of three lemmas. The support of a binary vector x is the set of coordinates for which the corresponding entry is non-zero. Given two binary vectors x, y, we write x y to mean that the support of x is contained in the support of y. Let supp(x) be the support of x. We define y| supp(x) ∈ F w H (x) 2 to be the truncated binary vector that drops all the coordinates outside supp(x). Given a space C, we denote proj x (C) := {v ∈ C : v x}. The next lemma finds equivalent representations of the cosets D w + w * y for non-zero w ∈ C 2 . Lemma 18. Given a CSS(X, C 2 ; Z, C ⊥ 1 ) code, define D w and y as above. For any non-zero w ∈ C 2 , define Z w := {z supp(w) ∈ F w H (w) 2

Lemma 17. Given a CSS(X,
: z ∈ C ⊥ 1 and z w} and B w = {v ∈ Z w : v = 1}. DefineZ w ⊂ F n 2 (resp.B w ⊂ F n 2 ) by adding all the zero coordinates outside supp(w) back into Z w (resp. B w ). Note that dim(proj w (B ⊥ w )) = dim(proj w (Z ⊥ w )) + 1. Define y ∈ F n 2 such that proj w (B ⊥ w ) = proj w (Z ⊥ w ), y . Then for all nontirvial w ∈ C 2 , Proof. See Appendix C.10.

Lemma 19. Given a CSS(X,
For any θ and any nontrivial w ∈ C 2 ,  [35,Theorem 17] derived a pair of necessary and sufficient conditions for a CSS code to be invariant under R Z ( π 2 l ). Theorem 20 shows that the first of these conditions implies the second and also generalizes the first condition to arbitrary angle θ. Note that the trigonometric conditions are local whereas the square sum constraint on generator coefficients is global.

Conclusion
We have introduced a framework that describes the process of preparing a code state, applying a diagonal physical gate, measuring a code syndrome, and applying a Pauli correction. We have described the interaction of code states and physical gates in terms of generator coefficients determined by the induced logical operator, and have shown that this interaction depends strongly on the signs of Z-stabilizers in a CSS code. We have derived necessary and sufficient conditions for a diagonal gate to preserve the code space of a CSS code, and have provided an explicit expression of its induced logical operator. When the diagonal gate is a transversal Z-rotation through an angle θ, we derived a simple global condition that can be expressed in terms of divisibility of weights in the two classical codes that determine the CSS code. When all signs in the CSS code are positive, we have proved the necessary and sufficient conditions for Reed-Muller component codes to construct families of CSS codes invariant under transversal Z-rotation through π/2 l . It remains open to investigate the constraints for a CSS code determined by two classical decreasing monomial codes to be invariant under transversal π/2 l Zrotation.
The generator coefficient framework provides a tool to analyze the evolution under any given diagonal gate of stabilizer codes with arbitrary signs, and we are working to characterize more valid CSS codes can be used in magic state distillation.

Acknowledgement
We would like to thank Ken Brown, Dripto Debroy, and Felice Manganiello for helpful discussions. Ken Brown suggested we look at the method of simulating coherent noise for surface codes described in [8], and this led to our generator coefficient framework, and its use in analyzing the average logical channel. Dripto Debroy encouraged us to interpret the decoherence-free subspace appearing in Example 2 in terms of entanglement of initial states and syndrome measurements. Felice Manganiello shared his construction of CSS codes with RM components that are preserved by a transversal T gate, and this led to our construction of CSS codes with RM components that are preserved by transversal π/2 l Z-rotations.
The work of the authors was supported in part by NSF under grants CCF-1908730 and CCF-2106213.

A Magic State Distillation Using the Steane Code
We use the Steane code as an example to show the trade-off between fidelity and the probability of success in magic state distillation. Classical magic state distillation post-selects on the trivial syndrome without considering the error correction. If we follow this procedure, then the [[7, 1, 3]] Steane code can be used to distill the state with linear convergence as described in Case 1. In Case 2, we try to increase the probability of success by introducing error-correction instead of post-selecting on the trivial syndrome. In Case 3, we consider only correcting one of non-trivial syndromes.
Case 1: Reichardt [34] calculated error rate by tracking evolution of code states. The generator coefficient framework makes it possible to calculate the output error rate by tracking operators.
(i) Encode to get the |+ of the Steane codestate.
(ii) Given seven copies of |A := T |+ = (|0 + e ıπ/4 |1 )/ √ 2 and ancillary qubits, we can realize the phsyical transversal T ⊗7 = [exp(−ı π 8 Z)] ⊗7 with the help of Clifford gates and Pauli measurements. If the states |A are exact, the probability of observing the trivial syndrome is p e µ=0 = 9 16 and the probability of observing each non-trivial syndrome is p e µ =0 = 1 16 (Take θ = π 4 in (93)). When the trivial syndrome is observed, it follows from Example 1 that the induced logical operator is T † L = exp(ı π 8 Z L ). We then apply a physical representation of the logical P hase gate P to obtain |A = P L T † L |+ . In practice, each of the input magic states |A is noisy. We assume dephasing noise: ρ → (1 − p)ρ + pZρZ with the same probability p of a Pauli Z error for each of the seven physical qubits. The probability of observing the trivial syndrome involves two terms. The first term captures the event that upon observing the trivial syndrome µ = 0, the dephasing error is undetectable. The second term captures the event that upon observing the non-trivial syndrome µ = 0, the dephasing error cancels the observed syndrome. The probability of success is given by Note that the 7 cosets corresponding to non-trivial syndromes have identical weight enumerators.
(iii) If we observe the non-trivial syndrome µ = 0, we declare failure and restart. Upon observing the trivial syndrome, we decode and the output mixed state is where p 0 out = p e µ=0 P (Z-error in C ⊥ 1 ) + µ =0 p e µ P (Z-error in C ⊥ 1 + µ + γ for γ = 0) The first term captures the event that upon observing the the trivial syndrome µ = 0, the dephasing error acts as a Z-stabilizer (B µ=0 = 3 4T † ). The second captures the event that upon observing the the non-trivial syndrome µ = 0, the dephasing error lies in C ⊥ 1 + µ + γ (B µ =0 = 1 4T †Z ). In this case, the dephasing error appears as the error correction that maps back to the code space and results in a logical T † gate. We now write the output error rate q as a function of the initial error rate p, and calculate its Taylor expansion at 0 q(p) = 1 − p 0 out P µ=0 = 7 9 p + 14 81 This implies that the threshold for the initial error rate is 0.1464... (the same as [34]), while that of the [ [15,1,3]] code is 0.1415.. [10].
Case 2: Note that probability of success in Case 1 is upper bounded by 9/16 = 56.25%. It is natural to ask whether we may introduce error correction to increase the probability of success. It follows from (81) that we can choose proper corrections based on syndromes (γ µ =Z for µ = 0) to obtain the logical operator T † with probability 1 if the physical transversal T is exact. The output error-rate now becomes The output error rate does not fall below the line y = x in the positive orthant, and we say that the protocol does not converge. Case 3: We balance Case 1 and Case 2 by implementing error correction for only one of the seven non-trivial syndromes, say µ = e 1 . Although the probability of success increases slightly to the prefactor of the linear term of the output error rate is greater than 1. We conclude that the protocol does not converge.
The same analysis can be performed for a code that is perfectly preserved by the transversal T gate, such as the [ [15,1,3]] code. The analysis provides insight into the trade-off between the probability of success and the fidelity of the output magic states.

B Generator Coefficient Framework for Stabilizer codes
We described the generator coefficient framework for CSS code and we now extend it to arbitrary stabilizer codes. We consider a general stabilizer code generated by the matrix where D = (D x , D z ) such that D x is the X-component of D and D z is the Z-component of D. We assume that the row space of D contains no non-zero vector c = (c X , c Z ) with c X = 0 or c Z = 0. Assume the dimensions of K, J, and D are n x , n z , n xz respectively. Then, we have where Π S X = 1 2 nx a∈K= K Let T := K, D x . Then, J ⊂ T ⊥ ⊂ F n 2 as described below.
and the generator coefficients of U Z for the stabilizer code S are given by where µ ∈ F n 2 /T ⊥ and γ ∈ T ⊥ /J . These generalized generator coefficients inherit the properties described in Theorem 6, that is, for η ∈ T ⊥ /J . Grouping together the projectors Π S X and Π S XZ , we consider the new family of projectors and note that {L (µ) } µ∈F n 2 /T ⊥ is a resolution of identity. Replacing the resolution of identity {Π S X (µ) } µ∈F n 2 /C ⊥ 2 by {L (µ) } µ∈F n 2 /T ⊥ , we conclude that the generator coefficients {A S µ,γ } µ∈F n 2 /T ⊥ ,γ∈T ⊥ /J describe the same average logical channel as in (74) and (75) since the logical Pauli Z for stabilizer codes can be chosen as γ ∈ T ⊥ /J up to a sign. Based on the description of the average logical channel, we study the conditions for the invariance of a stabilizer code as below.