# Magic state distillation: why is it harder to prepare the encoded $|A_{\pi/4}\rangle$ than $|0 \rangle$

My question is the following

Let's assume I am using Steane concatenated code to do error correction. I consider that the stabilizers are extracted fault-tolerantly through the Steane method. The Steane code admits transversal Clifford operations but not the $$T$$-gate.

In order to implement this gate one method is to prepare an ancilla in a state:

$$|A_{\pi/4}\rangle = T |+ \rangle$$

and to then use quantum teleportation to implement the $$T$$ gate on the logical data qubit.

The preparation of such a state will usually fail with a high probability and to increase its probability of success we use the so-called magic state distillation procedure.

## My question

Taking a step back I am not sure to understand why preparing $$|A_{\pi/4}\rangle$$ is more complicated than preparing the logical $$|0\rangle$$ for Steane code (where the stabilizers are measured fault-tolerantly with the Steane method) for instance.

## Edit

As suggested in the answers, it might be easier to prepare the logical $$|0_L\rangle$$ and $$|+_L\rangle$$ because they can be prepared by measuring the stabilizers. For instance, you initialize all your physical data qubits in $$|0\rangle$$, you measure your stabilizers, and with that, you created the logical state $$|0_L\rangle$$.

However, with the Steane method I don't think it can work. Indeed, in order to measure stabilizers, we need additional ancillae qubits to do those measurements. And those ancillae must be prepared in the $$|0_L\rangle$$ or $$|+_L\rangle$$. Here you are just "moving" the problem because now you have to prepare fault-tolerantly those ancillae state. So I guess that if we use the Steane method to fault-tolerantly measure the stabilizers, we cannot initialize our data qubit in $$|0_L\rangle$$ by simply initializing all physical data qubits in $$|0\rangle$$ and then measuring the stabilizers.

Hence, my guess is that the reason for the hardness of initializing arbitrary logical states might be very dependent on the fault-tolerant construction that is considered.

It might not be much harder to prepare the $$|0\rangle$$ logical state or the $$|A_{\pi/4}\rangle$$ logical state for a fault-tolerant implementation based on the Steane method (because we cannot do the trick of measuring the stabilizers for reason given above). However, for surface code, we could do it because to measure stabilizers we only need to initialize physical ancilla in the physical $$|0\rangle$$ or $$|+\rangle$$ state. We don't have the issue of "infinite loop" as I just explained for the Steane method. But this trick would not work for an arbitrary state initialization (and then preparing the logical state $$|A_{\pi/4}\rangle$$ might become much harder than preparing $$|0_L\rangle$$).

Would you agree with me?

The point is the logical $$|0\rangle$$ and $$|+\rangle$$ are (relatively) easy to prepare. You start with any bunch of qubits, it doesn't matter what state. You simply measure the stabilizers of the code and one of the logical operators. Whatever answers you get, you can correct for the outcomes.

For a stabilizer code, you know what the logical operators are for $$Z_L$$ and $$X_L$$ - they're just strings of Pauli operators, and so the measurement is just as easy to implement as any of the stabilizer measurements. For $$|A_{\pi/4}\rangle$$, there isn't a corresponding logical operator to directly measure.

• Thank you for your answer. I edited my question accordingly to your answer (I am still disturbed). Nov 4, 2021 at 11:31
• Hello. I am back on this question. I think that your suggestion might not work for any fault-tolerant implementation. For instance, the Steane method used to measure in a fault-tolerant manner the stabilizers requires an ancilla in the $|0\rangle$ logical state. And to prepare this ancilla fault-tolerantly we then need again another ancilla in the $|0\rangle$ logical state if we used what you suggest. And so on (to prepare this other logical ancilla I also need another logical ancilla in the $|0\rangle$ logical state etc). [...] Mar 2 at 15:53
• However, I guess what you say applies to surface code. In that case, to measure the stabilizers I need to prepare physical ancillae in the $|0\rangle$ physical state. And I do not need anything to prepare those physical ancillae (I don't have an infinite loop as in my previous example). Do you see what I mean and would you agree with me? My feeling is that the reason for the hardness of initializing logical state might be very dependent on the fault-tolerant construction that is considered. Mar 2 at 15:54

To prepare $$|0_L\rangle$$ in a CSS code, all you have to do is separately initialize all the data qubits into $$|0\rangle$$ and then start measuring the stabilizers of the code. The reason this works is because the stabilizers that protect $$|0_L\rangle$$ have a known value when all the data qubits are $$|0\rangle$$ (because they are Z type stabilizers). It's important that you know the stabilizers right from the start, since otherwise there would be a small moment of time where undetectable errors could sneak in before the first round of stabilizer measurements.

The same logic works for the $$|+_L\rangle$$ state, initializing data qubits into $$|+\rangle$$, and thereby knowing the X type stabilizers so you can detect any errors right from the start.

But initializing all the data qubits into $$|i\rangle$$ is not a fault tolerant way to prepare $$|i_L\rangle$$, even though $$|i\rangle$$ is a stabilizer state, because that initialization tells you none of the stabilizers' initial values. So you have no way of telling if there were errors affecting the logical observable between the initialization and the first round of stabilizer measurements. And actually, because $$|i_L\rangle$$ is vulnerable to both X and Z type logical errors, it needs all stabilizers to be deterministic instead of just the X types or the Z types. So it's even starting with a vulnerability penalty (in the context of a CSS code).

The same is true of the $$|T\rangle = T|+\rangle$$ state. Initializing all the data qubits into $$|T\rangle$$ randomizes all the stabilizers, so there's no foothold. In order for an initialization to be fault tolerant, it has to make deterministic all the stabilizers relevant to protecting that state. Otherwise you have no way of checking if an error happened between initialization and the first round of measurements. And the "easy" strategy of transversally initializing just doesn't work for non-trivial states like $$|T\rangle = T|+\rangle$$.

It's not that this is literally impossible. There are codes with fault tolerant T state initialization. It's just that the most obvious thing, transversal initialization in a CSS code, only works for $$|0\rangle$$ and $$|+\rangle$$.

• Thank you for your answer. I will need a few days to go back with further details, but a thing that still disturbs me is the following. I am familiar with concatenated FT construction associated to Steane method. If I am not wrong, in this framework we do not prepare the logical states the way you prescribe (see edit in my main text). We typically do a non FT preparation and we use a verifier to check if the ancilla have been properly prepared. By repeating the procedure in case of failure, the overall process is FT. Dec 10, 2021 at 14:46
• For this reason, I guess that you have in mind another way to prepare fault-tolerantly the logical computational states. More precisely, which method do you use to measure fault-tolerantly the stabilizer? Because to do it in Steane method we would need an ancilla in the state $|0_L\rangle$. And if to prepare this state I also need an ancilla prepared in the $|0_L\rangle$: we would end up in some "infinite loop" making your suggestion not applicable in this context if I am not wrong. This is why I am wondering which framework you are thinking of? Dec 10, 2021 at 14:47
• @StarBucK It's okay for the individual stabilizer measurements can be faulty. You account for that by simply repeating them multiple times. You do need the error introduced onto the data qubits by doing the measurements to be below some threshold, so that you're learning (and correcting) errors faster than you're introducing errors. Dec 16, 2021 at 19:10
• Hello. I am interested to understand better your three first paragraphs (I qualitatively see what you mean but a detailed discussion of that would help me). Would you have some good paper/lecture to read that explains it in further detail? Also: I believe what you describe applies to surface code but not to any FT implementation. For instance, for codes implemented for instance with the Steane method, to measure the stabilizers, we need to initialize an ancilla in the logical state $|0\rangle$. Hence we are just moving the problem one step further. Would you agree with me? Mar 2 at 15:45
• What I mean by "we are just moving the problem one step further" for the Steane method is that asking to measure stabilizers requires ancillae in the $|0\rangle$ logical state. To prepare those ancillae, we need to measure their stabilizers which requires further ancillae, and so on. In surface code the ancillae qubits need to start in the physical $|0\rangle$ or $|+\rangle$ states, hence we do not have this issue. This is at least my understanding. Mar 2 at 15:47