My goal is to understand why the magic state distillation (for instance based upon the $15$ qubit code) improves the fidelity of the magic state. I followed this lecture to try to understand it. I assume that my goal is to perform a logical $T$ gate on my logical data qubits. For this I need to prepare a logical state $|A\rangle=T | + \rangle$ having a high fidelity: the magic state.
To summarize my question briefly: I don't understand why the procedure improves the probability of success from $O(p)$ to $O(p^2)$ if we take into account the encoding and decoding part of the $15$ qubit code.
My current understanding
The overall strategy to implement a logical $T$ gate is to use a code that is able to implement transversal $T$-gates. The interest in using transversal gates is that they are intrinsically fault-tolerant as they do not propagate physical errors of one physical qubit composing a logical qubit to multiple physical qubits composing this same logical qubit. The $15$ qubit code has such properties.
I assume that my qubits are encoded with a code $C1$ that can perform all Clifford gates transversally (hence fault-tolerantly) but that cannot do a $T$ gate like this. In order to implement the $T$ gate, I can use an ancilla prepared in the state $|A\rangle$ and use state injection to perform the gate on my logical qubits. Now, I need to prepare a state $|A\rangle$ with a high fidelity. A "recipe" to do it is:
- Regroup $15$ logical qubits of the code $C1$ and encode with them the logical $|+_L\rangle$ state of the $15$ qubit code (hence each qubit of the $15$ qubit code is a logical qubit of $C1$, itself composed of physical qubits).
- Apply a transversal $T$ to this logical qubit (it is equal to a logical $T$ thanks to the $15$ qubit code properties) ( * )
- Decode the $15$ qubit encoding: we now have a state $|A\rangle$ encoded with the code $C1$, we can perform state injection.
Then, if everything works nicely at the end you have created the $|A\rangle$ state encoded with $C1$.
I assume that the steps 1 and 3 are perfect (no faults can occur there). If my code is able to detect and correct for one error, calling $p$ the probability that a physical $T$ gate fails, the probability to have an error in the encoded state after the transversal $T$ gate has been applied (and after the error correction procedure) is $O(p^2)$ instead of $O(p)$. It is because thanks to the transversal implementation, one faulty gate will only induce one error, and we can detect and correct one error within the logical qubit using error correction. The probability that the procedure fails is then equal to the probability to have two faults which is of order $O(p^2)$.
What I don't understand
Here, I assumed that steps 1. and 3. are perfect. In practice, they will not be. What we need is to be sure that the probability that something goes wrong there has a probability $O(p^2)$. What ensures me this?
Typically, are there implicit assumptions of how we prepare the logical $|+\rangle$ state? Or of how we perform the decoding? Indeed, for instance, preparing the logical $|+_L\rangle$ in a fault-tolerant manner is not trivial with Steane code (at least with the "standard" technique I am aware of, see my edits there, or the second column of the intro of this paper). For this, you have to repeat the procedure many times and do some checking. The probability of failure is $O(p)$ and by repeating enough time we can find a good state in the end. But if you have to do it there is no point in using the $15$ qubit encoding at all then... However, I know that it is easy to initialize such a state with the surface code. This is why I am wondering if implicit assumptions are behind the way we perform the preparation (which probably restricts the kind of codes we can use with the $15$ to $1$ distillation procedure. My questions for the decoding are similar.
In conclusion: how can we be sure that the procedure will succeed with a probability $O(p^2)$ if we take into account the preparation (1.) and decoding steps (3.). Is there a paper discussing it?
( * ) Actually it is not entirely correct, the transversal $T$ will do a logical $T_L^{\dagger}$ but I skip this detail (I could implement a transversal $T^{\dagger}$ instead)