# Given a set of stabilizers, what is an efficient way to compute the logical states and logical operators?

Suppose I have $$n$$ qubits and I specify $$n - k$$ independent stabilizer generators. I have defined a Hilbert space with $$k$$ logical qubits. Moreover, there exist $$2k$$ operators that obey the Pauli commutation rules and represent logical $$X$$ and logical $$Z$$ on those $$k$$ qubits.

Is there a computationally efficient way to find these logical operators and logical states from the stabilizers alone?

As a concrete example, let's consider the $$[[7,1,3]]$$ Steane code. The stabilizers are:

$$X_1X_2X_3X_4 \\ X_2X_3X_5X_6 \\ X_3X_4X_6X_7 \\ \ \\ Z_1Z_2Z_3Z_4 \\ Z_2Z_3Z_5Z_6 \\ Z_3Z_4Z_6Z_7$$

The answer should give me two logical operators $$X_L = X_5X_6X_7$$ and $$Z_L=Z_5Z_6Z_7$$ (or some other operator that is a multiple of these with the stabilizers) as well as the logical qubits $$\vert 0\rangle_L$$ and $$\vert 1\rangle_L$$ where

\begin{aligned} |0\rangle_L= & \frac{1}{\sqrt{8}}[|0000000\rangle+|1010101\rangle+|0110011\rangle+|1100110\rangle \\ & +|0001111\rangle+|1011010\rangle+|0111100\rangle+|1101001\rangle] \\ |1\rangle_L= & X_L|0\rangle_L \end{aligned}

What is the "efficient" way to work this out for a general set of stabilizers and some larger number of physical qubits? I'm imagining really big codes with many stabilizers so I'd rather not do it by hand.

Here's a construction that works for any CSS code (CSS code: all stabilizers either have all $$Z$$s or all $$X$$s). Let's start with $$|0\rangle_L$$ state. Let the stabilizers be given by $$\{X^{\vec{v}_i}\}$$ and $$\{Z^{\vec{v}_i}\}$$.

The state $$|0\cdots 0\rangle$$ of all physical qubits in the $$|0\rangle$$ state is already a $$(+1)$$ eigenstate of all $$Z^{\vec{v}_i}$$ and also $$Z_L$$. We want to project into the $$(+1)$$ eigenstates of the $$X^{\vec{v}_i}$$. This projector is given by $$(1+X^{\vec{v}_i})/2$$. Ignoring normalization, we can then write:

$$|0\rangle_L=(1+X^{\vec{v}_1})\cdots (1+X^{\vec{v}_n})|0\cdots 0\rangle$$

Note that this state is still a $$(+1)$$ eigenstate of $$Z^{\vec{v}_i}$$ and $$Z_L$$ because the projectors $$(1+X^{\vec{v}_i})$$ all commute with $$Z^{\vec{v}_i}$$ and $$Z_L$$.

This says to get $$|0\rangle_L$$, you take the uniform superposition over $$|0\cdots 0\rangle$$ and all possible combinations of bit-flips generated by the stabilizers $$X^{\vec{v}_i}$$. This predicts that for the Steane code, with $$3$$ $$X$$-stabilizers, you will have a superposition of $$2^3$$ basis states, one for each subset of the $$X$$ stabilizers. This is precisely what you found above.

Once you have $$|0\rangle_L$$ you can get $$|1\rangle_L$$ by acting with $$X_L$$.

Note that this projector trick also works for non-CSS codes, but it's a little harder to interpret the result in the $$Z$$ basis.

• Thanks for the answer! I see how to get the logical states but not yet how to get the logical operators. From the stabilizers alone, how does one work out $Z^i_L$ and $X^i_L$ (where $i$ represents the index of the logical qubit)? I know these are elements of the centralizer of the stabilizer group but I'm not sure how to actually compute them Commented Feb 25 at 14:13
• @user1936752 Ah yes! I think the standard reference for that is still 4.1 of Gottesman's PhD thesis: arxiv.org/abs/quant-ph/9705052 Commented Feb 26 at 1:42