# How to understand the disjointness of a stabilizer code?

I'm reading The disjointness of stabilizer codes and limitations on fault-tolerant logical gates and trying to understand the disjointness of a stabilizer code.

Does anyone have any intuition about or experience with the concept of disjointness of a stabilizer code?

For example, what is the disjointness of the Shor $$[[9,1,3]]$$ code?

I quickly threw together some code to play with this.

Define the Shor code and logical operator representatives

shorgen = np.array([
[0, 0, 0, 0, 0, 0, 0, 0, 0,   1, 1, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0,   0, 1, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 1, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 1, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 1, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 1, 1],
[1, 1, 1, 1, 1, 1, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 1, 1, 1, 1, 1, 1,   0, 0, 0, 0, 0, 0, 0, 0, 0],
], dtype=int)

n = 9
m = 8

# logical operators
logX = np.array([0, 0, 0, 0, 0, 0, 0, 0, 0,  1, 1, 1, 1, 1, 1, 1, 1, 1])
logZ = np.array([1, 1, 1, 1, 1, 1, 1, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0])


We are interested in the support of operators. The support here is a list of length $$n$$ which has 1s where ever the operator has a non-trivial Pauli. Otherwise 0.

# compute support of an operator
# an operator is a binary array of length 2n
def support(op, n):
sup = np.zeros(n, dtype=int)
for i in range(n):
if op[i] == 0 and op[n+i] == 0:
continue
else:
sup[i] = 1
return tuple(sup)


Next, just determine all possible supports. For this we need to determine the support for every possible representative of $$\bar{X}$$. To do this, for every number from 1-2^m-1, we convert to binary string of length $$n=9$$. Then use the binary string to pick a subset of generators. Next multiply this subset of generators to get an element of $$S$$. Next multiply with logX ( or logZ) to get a logical operator representative.

We use a set to only save the unique supports.

supX = set()
for i in range(1, 2**m):
d = np.binary_repr(i,m)
sel = np.array(list(d), dtype=int).astype(bool)
op = (np.sum(cd.generator_matrix[sel,:],axis=0) + logX) % 2

## supX has elements of the form
## (0, 0, 0, 0, 0, 0, 1, 1, 1)


We can check that the minimum support sum is 3 for both logX and logZ, using the following line

min([np.sum(g) for g in supX])


Hence, using the definition

we can say that $$d_\downarrow = 3$$.

Finally, I quickly run a dumb optimization.

c = 1
DeltacG = 0
for L in range(1, 6):
for subset in combinations(supX, L):
# count the support at each location. Then determine max
# if max is greater than c, then discard. Else keep
if max(np.sum(subset, axis=0)) <= c:
A = subset
DeltacG = len(A)/c

print(DeltacG)
print(A)


Running it for both logX and logZ, we determine that $$\Delta_1(\bar{X}) = \Delta_1(\bar{Z}) = 3$$.

Our goal is to determine

The following lemma from the paper

shows that 3 is the max value of $$\Delta$$. And it seems like we have saturated it already for $$c=1$$. No need to calculate higher values of $$\Delta_c$$, though they seem to also all be equal to 3.

#### Important

I choose the simplest choice of the partition in the definition of $$\Delta$$, i.e. each qubit is in its own partition.

• Great answer! So the disjointness is $\Delta=3$. The paper says "if we choose a single-qudit partition, then those two quantities coincide, $d_\downarrow =d$." So indeed $d_\downarrow = 3=d$ as you say ($XXX III III$ implementing logical $Z$ witnesses this). Finally I think $d_\uparrow =3$ since logical $X$ is implemented by $ZII ZII ZII$. So we have $d_\uparrow =3 < 3 (3)= d_\downarrow (\Delta)$. Commented Apr 8, 2023 at 12:04
• After doing the calculations, I think Shor code is not a good example to work with. Because both logical operators have a rep that is all $X$ or all $Z$. Which means the support is mostly determined by the elements of $S$ and the support of the operators plays less of a role in determining the disjointedness. You should repeat the calculations for codes which don't have this structure. Commented Apr 8, 2023 at 21:13