# Transversal Hadamard gates and multiple logical qubits

This question is linked to this post.

I wanted to work through the details in the main answer to check I understood the conditions for the existence of logical Hadamard gates. But I am slightly confused as to whether we are implicitly assuming that the code has only 1 logical qubit.

So, let $$C \leq \mathbb{F}_2^n$$ be a classical code such that $$C\leq C^{\perp}$$. It's well known that we can construct a "self-dual" CSS code from $$C$$, where our stabilisers are $$\{X^v, Z^v:v \in C\}$$.

Let's pick bases for the classical spaces $$\langle c_1,\dots,c_k \rangle =C \leq C^{\perp} = \langle c_1,\dots,c_k, d_1,\dots, d_l \rangle$$

In particular our CSS code has $$l = \dim (C^{\perp} \backslash C)$$ logical qubits. Furthermore, there exists another basis of $$C^{\perp} \backslash C$$, say $$\{e_1,\dots,e_l\}$$ such that we may use the two bases to define our logical Pauli ops: $$\bar{X_i}=X^{d_i}, \bar{Z_i}=Z^{e_i}$$

Now, my understanding of transversality is that we want to apply an operator $$U$$ to every physical qubit and have this implement logical $$\bar{U}$$ on each encoded bit.

So for $$H^n$$ to implement $$\bar{H}$$ on each logical qubit, it must conjugate the encoded Paulis appropriately. This holds iff $$d_i = e_i$$ and furthermore we require $$e_i\cdot e_j=\delta_{ij}.$$

This is where I struggle, as we are essentially asking for an orthogonal basis of a binary space, which isn't true in general. NB: it IS true if $$l=1$$ i.e. we have exactly one logical qubit

An example: Consider the following classical codes $$C\leq C^{\perp}$$. $$C = \langle (111001), (000110) \rangle$$ $$C^{\perp} = \langle (111001), (000110), (010001), (001001) \rangle$$.

This encodes a CSS code with 2 logical qubits but note that the space $$\langle (010001), (001001) \rangle$$ contains only vectors of even weight.

Here the only choice (up to stabilisers) of logical ops are $$\bar{X_1}=X^{010001}, \bar{X_2}=X^{001001}$$ $$\bar{Z_1}=Z^{001001}, \bar{Z_2}=Z^{010001}$$

So in particular $$H^n$$ actually sends $$\bar{X_1}$$ to $$\bar{Z_2}$$ and therefore isn't logical hadamard. In fact $$H^n$$ corresponds to logical Hadamard $$H^2$$ combined with a permutation of the logical qubits.

It'd be great if someone could clarify this for me -- am I misunderstanding the notion of transversality on multi-logical qubit codes?

• In your example, the first element of C has length 5. It should be 6 like all the other elements. You are missing a 1. Feb 3 at 22:23
• I've fixed that now thanks Feb 3 at 22:27

The definition of transversality is as follows: Given an $$[n,k,d]$$ code, with physical qubits labelled $$0,\dots,n-1$$, a transversal operator is of the form $$U_0\otimes \cdots \otimes U_{n-1}$$, where $$\{U_i\}$$ is a set of single qubit operators.

The crucial part is that $$U_i$$ don't all have to be the same.

Now, given a single-qubit logical operator, it's possible that there is no transversal operation to achieve this.

In your example, \begin{align} \bar{X_0} &= X_1X_5 \equiv X_0X_2 \equiv X_1X_3X_4X_5 \equiv X_0X_2X_3X_4,\\ &\equiv X_1Z_3Z_4X_5, \dots \\\ \bar{Z_0} &= Z_2Z_5 \equiv Z_0Z_1 \equiv Z_2Z_3Z_4Z_5 \equiv Z_0Z_1Z_3Z_4, \dots \\ \bar{X_1} &= X_2X_5 \equiv X_0X_1 \equiv X_2X_3X_4X_5 \equiv X_0X_1X_3X_4, \\ \bar{Z_1} &= Z_1Z_5 \equiv Z_0Z_2 \equiv Z_1Z_3Z_4Z_5 \equiv Z_0Z_2Z_3Z_4, \end{align} where the equivalences are obtained by multiplying with the stabilizers (if $$\bar{X}$$ is the logical bit-flip, so is $$s\bar{X}$$ for all stabilizers $$s$$).

Its quite clear there is no transversal operator that conjugates any of the representations of, say $$\bar{X_0}$$, to any of the representations of $$\bar{Z_0}$$ (see this). For example, \begin{align} U_0\otimes \cdots U_5 X_1X_5 U_0^\dagger\otimes \cdots U_5^\dagger = (U_1X_1U_1^\dagger)(U_5X_5U_5^\dagger). \end{align} You can see that none of the representations of $$\bar{Z_0}$$ only involve qubits 1 and 5. Hence, there is no transversal $$\bar{H}_0$$. By similar arguments, there is no transversal $$\bar{H}_1$$.

I want to emphasize that, this just means that this $$k\ne 1$$ code has no transversal Hadamard gates. But other such codes can have them.

### A set of non-transversal $$H$$ gates

Here is an inefficient way of constructing such gates, because the constructed gates might not be the simplest.

1. First construct an encoding circuit for the code. Here, the two inputs are at qubits 1 and 2 and the others are ancilla. Call this circuit $$E$$. 2. To construct a unoptimized non-transversal $$H$$ gate for the first logical qubit, we do the following. First, we run $$E$$ in reverse to decode the state, then apply $$H$$ to qubit 1, then apply $$E$$ again. This yields the circuit, 3. Next note that most gates in this circuit can be cancelled, leaving behind This is our $$\bar{H}_0$$.

Following the same process for $$\bar{H}_1$$, where we do in order reverse(E), $$H_2$$ and $$E$$, we obtain after simplification In this case, this worked out pretty well.

• Thank for your answer. I'd be interested if you can then comment on why it seems to be stated frequently in the literature (and also in the post I linked) that self-dual CSS codes have a transversal logical Hadamard? Feb 8 at 0:52
• The linked post only has a proof sketch. I would imagine there are unstated assumptions there, which your example code does not fulfill. You can try commenting on the linked post, and ask Adam to look at this question. Feb 8 at 22:08