First, I need to find the logical state fidelity of the final two-qubit logical state after preparing |00β©_{AB} using the given circuit. The fidelity should be a function of the two-qubit gate error rate p, and we’re post-selecting on the ancilla measuring |0β© and on detectable errors in the code.
The circuit is: M_4 (CNOT_{04}) (CNOT_{34}) (CNOT_{23}) (CNOT_{10}) (CNOT_{12}) (H_1)
But this is written in matrix multiplication order, meaning that the operations are applied from right to left. So, the actual order of operations in the circuit is:
-
H_1 (Hadamard on qubit 1)
-
CNOT_{12} (CNOT with control qubit 1, target qubit 2)
-
CNOT_{10} (CNOT with control qubit 1, target qubit 0)
-
CNOT_{23} (CNOT with control qubit 2, target qubit 3)
-
CNOT_{34} (CNOT with control qubit 3, target qubit 4)
-
CNOT_{04} (CNOT with control qubit 0, target qubit 4)
-
M_4 (Measurement of qubit 4)
The ancilla is qubit 4, and we post-select on it measuring |0β©.
Each CNOT gate is followed by a two-qubit depolarizing error channel with error probability p. This channel applies one of the 15 non-identity two-qubit Paulis with probability p/15 each, and with probability 1-p, no error occurs.
The goal is to find the logical state fidelity, which I assume means the fidelity between the actual logical state and the ideal |00β©_{AB} state, after post-selection.
Since we’re post-selecting on the ancilla measurement and on detectable errors, we need to consider only the cases where no error is detected, meaning that the stabilizers are satisfied, and the ancilla is |0β©.
The [[4,2,2]] code has stabilizers XXXX and ZZZZ. Logical errors that anti-commute with these stabilizers would be detected, so we post-select those away.
The logical operators are given: X_A = XIXI, X_B=XXII, Z_A=ZZII, Z_B=ZIZI.
For the state |00β©_{AB}, it should be stabilized by Z_A and Z_B, meaning that applying Z_A or Z_B should give +1 eigenvalue.
Now, I need to understand what this circuit does ideally, without errors.
Let me sketch the circuit step by step for the ideal case.
We start with all qubits in |0β©, I assume. The problem doesn’t specify the initial state, but typically for state preparation, we start with all qubits in |0β©. So, qubits 0,1,2,3,4 all in |0β©.
Apply H_1: so qubit 1 becomes |+β© = (|0β© + |1β©)/β2
Then CNOT_{12}: control qubit 1, target qubit 2. So after this, qubits 1 and 2 are in Bell state: |00β© + |11β© over β2, but since qubit 1 was |+β© and qubit 2 was |0β©, CNOT_{12} gives |0+β© + |1-β© something? Let me compute properly.
After H_1: |Ο1β© = |0β©_0 β |+β©_1 β |0β©_2 β |0β©_3 β |0β©_4
|+β© = (|0β© + |1β©)/β2
Now CNOT_{12}: control qubit 1, target qubit 2.
So, if qubit 1 is |0β©, qubit 2 unchanged; if |1β©, qubit 2 flipped.
Thus, |Ο2β© = CNOT_{12} |Ο1β© = |0β©_0 β [ |0β©_1 |0β©_2 + |1β©_1 |1β©_2 ] / β2 β |0β©_3 β |0β©_4
Now CNOT_{10}: control qubit 1, target qubit 0.
So, control on qubit 1, target qubit 0.
|Ο3β© = CNOT_{10} |Ο2β© = CNOT_{10} [ |0β©_0 |0β©_1 |0β©_2 + |0β©_0 |1β©_1 |1β©_2 ] / β2 β |0β©_3 β |0β©_4
CNOT_{10} applies X on qubit 0 if qubit 1 is |1β©.
So, for the first term: |0β©_0 |0β©_1 |0β©_2, since control is |0β©, no change.
For the second term: |0β©_0 |1β©_1 |1β©_2, since control is |1β©, X on qubit 0, so |1β©_0 |1β©_1 |1β©_2
Thus, |Ο3β© = [ |0β©_0 |0β©_1 |0β©_2 + |1β©_0 |1β©_1 |1β©_2 ] / β2 β |0β©_3 β |0β©_4
Now CNOT_{23}: control qubit 2, target qubit 3.
|Ο4β© = CNOT_{23} |Ο3β© = CNOT_{23} [ |0β©_0 |0β©_1 |0β©_2 |0β©_3 + |1β©_0 |1β©_1 |1β©_2 |0β©_3 ] / β2 β |0β©_4
CNOT_{23}: control qubit 2, target qubit 3.
For first term: |0β©_2, so no change: |0β©_0 |0β©_1 |0β©_2 |0β©_3
For second term: |1β©_2, so X on qubit 3: |1β©_0 |1β©_1 |1β©_2 |1β©_3
Thus, |Ο4β© = [ |0β©_0 |0β©_1 |0β©_2 |0β©_3 + |1β©_0 |1β©_1 |1β©_2 |1β©_3 ] / β2 β |0β©_4
This looks like a GHZ state on qubits 0,1,2,3.
Now CNOT_{34}: control qubit 3, target qubit 4.
|Ο5β© = CNOT_{34} |Ο4β© = CNOT_{34} [ |0β©_0 |0β©_1 |0β©_2 |0β©_3 |0β©_4 + |1β©_0 |1β©_1 |1β©_2 |1β©_3 |0β©_4 ] / β2
CNOT_{34}: control qubit 3, target qubit 4.
For first term: |0β©_3, so no change: |0β©_0 |0β©_1 |0β©_2 |0β©_3 |0β©_4
For second term: |1β©_3, so X on qubit 4: |1β©_0 |1β©_1 |1β©_2 |1β©_3 |1β©_4
Thus, |Ο5β© = [ |0β©_0 |0β©_1 |0β©_2 |0β©_3 |0β©_4 + |1β©_0 |1β©_1 |1β©_2 |1β©_3 |1β©_4 ] / β2
Now CNOT_{04}: control qubit 0, target qubit 4.
|Ο6β© = CNOT_{04} |Ο5β© = CNOT_{04} [ |0β©_0 |0β©_1 |0β©_2 |0β©_3 |0β©_4 + |1β©_0 |1β©_1 |1β©_2 |1β©_3 |1β©_4 ] / β2
CNOT_{04}: control qubit 0, target qubit 4.
For first term: |0β©_0, so no change: |0β©_0 |0β©_1 |0β©_2 |0β©_3 |0β©_4
For second term: |1β©_0, so X on qubit 4: |1β©_0 |1β©_1 |1β©_2 |1β©_3 |0β©_4 because |1β©_4 becomes |0β© after X? No.
Qubit 4 is |1β© in the second term, and we apply X on qubit 4 if control is |1β©, so X|1β© = |0β©, so |1β©_0 |1β©_1 |1β©_2 |1β©_3 |0β©_4
Thus, |Ο6β© = [ |0β©_0 |0β©_1 |0β©_2 |0β©_3 |0β©_4 + |1β©_0 |1β©_1 |1β©_2 |1β©_3 |0β©_4 ] / β2
Now, we measure qubit 4. If we measure |0β©, which happens with probability 1, since both terms have |0β©4? No, in the first term |0β©_4, second term |0β©_4, so indeed, after CNOT{04}, qubit 4 is always |0β©? Let’s see:
From |Ο5β©, after CNOT_{04}, for both terms, qubit 4 is |0β©? In first term, after CNOT_{04}, since control |0β©, target |0β©, so |0β©4. In second term, control |1β©, target |1β©, so X on target, |1β© becomes |0β©, so yes, qubit 4 is always |0β© after CNOT{04}. So measurement always gives |0β©, and the state is unchanged.
After measurement, if we get |0β©, the state is projected, but since it’s already |0β©, the state is:
|Ο_finalβ© = [ |0β©_0 |0β©_1 |0β©_2 |0β©_3 + |1β©_0 |1β©_1 |1β©_2 |1β©_3 ] / β2
But this is the GHZ state on four qubits. Now, is this the logical |00β©_{AB} for the [[4,2,2]] code?
I need to recall what the logical states are for this code.
The [[4,2,2]] code encodes two logical qubits. The stabilizers are XXXX and ZZZZ.
The logical states are usually defined as:
|00β©_L = (|0000β© + |1111β©)/β2
|01β©_L = (|0011β© + |1100β©)/β2? I need to check.
From the logical operators: Z_A = ZZII, so it measures the parity between qubits 0 and 1, and similarly.
For |00β©_L, it should be stabilized by Z_A and Z_B.
Z_A = ZZII, so applying to |0000β©, ZβZ on first two, since I on others, so for |0000β©, Z|0β©=+1, Z|0β©=+1, so +1. For |1111β©, Z|1β©=-1, Z|1β©=-1, so (-1)(-1)=+1. Similarly, for other states.
But |00β©_L is indeed (|0000β© + |1111β©)/β2, which is what we have.
Similarly, Z_B = ZIZI, so for |0000β©, Z on qubit 0 and qubit 2? Z_B = Z I Z I, so on qubits 0 and 2.
For |0000β©, Z|0β©=+1, Z|0β©=+1, so +1. For |1111β©, Z|1β©=-1, Z|1β©=-1, so (-1)(-1)=+1. So yes.
And X_A = XIXI, etc.
So indeed, after the circuit, we have the logical |00β©_{AB} state.
But in this ideal case, the ancilla measurement is always |0β©, so no issue.
Now, with errors, we have depolarizing errors after each CNOT gate.
There are 5 CNOT gates in the circuit: CNOT_{12}, CNOT_{10}, CNOT_{23}, CNOT_{34}, CNOT_{04}.
Each CNOT is followed by a two-qubit depolarizing error channel with probability p.
The error channel applies one of the 15 non-identity Pauli errors on the two qubits involved, with probability p/15 each, or no error with probability 1-p.
We need to find the logical state fidelity after post-selecting on ancilla measuring |0β© and on no detectable errors.
Detectable errors are those that anti-commute with the stabilizers or with the ancilla measurement, but since we post-select on measurement outcome, we already select only when ancilla is |0β©.
Also, for the code, we need to post-select on the stabilizers being satisfied, meaning no error detected by the code.
The logical fidelity is the probability that the logical state is correct, given that no error was detected.
Since we’re post-selecting, we need the fidelity conditional on success.
The fidelity F is usually defined as β¨Ο_ideal|Ο_actual|Ο_idealβ© for some state, but here since we have a mixed state due to errors, and we post-select, we need the density matrix after post-selection, and then find the fidelity with |00β©β¨00|_L.
But since the ideal state is pure, the fidelity is the probability that the state is correct.
In error correction, often we compute the probability of no logical error given no detection.
So, for each possible error pattern, we can see if it is detected or not, and if not, what logical error it causes.
Then, the probability of no logical error given no detection is the fidelity.
Since we post-select on no detection, the fidelity is the probability that the logical state is correct conditional on no detection.
So, I need to find the probability that there is no logical error, given that the ancilla measured |0β© and the stabilizers are satisfied.
But the ancilla measurement is part of the detection; if the ancilla measures |1β©, we discard, so we only consider when M_4 gives 0.
Similarly, we measure the stabilizers and discard if any is -1.
But in this setup, after the circuit, we measure the ancilla and also measure the stabilizers, I assume, to detect errors.
The problem says “post-selected on all detectable errors in the code and on the ancilla qubit measuring |0β©”.
So, we post-select on ancilla |0β© and on the code stabilizers being +1, i.e., no error detected by XXXX or ZZZZ.
Now, to find the logical fidelity, I need to find, for each possible error pattern from the depolarizing channels, whether it is detected or not, and what logical error it introduces.
Then, the probability of no logical error given no detection.
Since the errors are Pauli errors, and the circuit is Clifford, we can propagate the errors through the circuit and see their effect.
A common way is to consider the error channels and see which errors are detectable and which cause logical errors.
Each CNOT gate has a error channel after it, so there are 5 error locations, each with possible Pauli errors on two qubits.
The errors can occur after each CNOT, so we have to consider the cumulative effect.
Since the errors are Pauli, and the circuit is Clifford, we can think of the errors as being applied at the end, but after propagating through the subsequent gates.
That might be messy.
I recall that for such fault-tolerant circuits, we can analyze the error detection capability.
The [[4,2,2]] code has distance 2, so it can detect any single-qubit error, but not all two-qubit errors.
In this circuit, we have two-qubit gate errors, which affect two qubits at a time.
But the error channel is on two qubits, so it can introduce errors on two qubits simultaneously.
However, since the code can detect any single-qubit error, but for two-qubit errors, some are detectable, some are not.
But in this case, the errors are from depolarizing channels on specific pairs due to CNOT gates.
Let me list all the CNOT gates and the qubits they act on:
-
CNOT_{12}: acts on qubits 1 and 2
-
CNOT_{10}: acts on qubits 1 and 0
-
CNOT_{23}: acts on qubits 2 and 3
-
CNOT_{34}: acts on qubits 3 and 4
-
CNOT_{04}: acts on qubits 0 and 4
And each has a depolarizing error on those two qubits.
The errors happen after each CNOT, so the order matters because later errors may be affected by previous errors or gates.
But since we care about the final Pauli error on the data qubits (0,1,2,3) and ancilla, and we measure the ancilla, we can propagate all errors to the end and see their effect.
The circuit has gates, and errors after each gate, so we can compute the effective error at the end by propagating each error through subsequent gates.
Because the gates are Clifford, propagating Pauli errors through Clifford gates gives Pauli errors, so the overall effect is that some Pauli error is applied to the initial state, but since the initial state is |0β© for all, and we have gates, it’s a bit more complex.
A standard way is to consider the entire circuit as preparing the state, and the errors introduce Pauli errors on the qubits at various times, but after propagating, the net effect is equivalent to a Pauli error on the final state.
But since we have measurement, it’s trickier.
Perhaps I should consider the error-free circuit and then see how errors affect it.
Another way is to note that the circuit is designed to be fault-tolerant, so certain errors are detected by the ancilla measurement or by the stabilizers.
I need to find for each possible error from each error channel, whether it is detected or not, and what logical error it causes.
But errors can combine, so I need to consider all possible combinations of errors from the five locations.
Since p is small, we might approximate to first order in p, but the problem asks for fidelity as a function of p, so probably we need the exact expression or higher order.
But for fidelity, it might be sufficient to find the probability of no error and probability of logical error given no detection.
Let me denote the error channels.
Let me list the error locations:
-
After CNOT_{12}: error on qubits 1 and 2
-
After CNOT_{10}: error on qubits 1 and 0
-
After CNOT_{23}: error on qubits 2 and 3
-
After CNOT_{34}: error on qubits 3 and 4
-
After CNOT_{04}: error on qubits 0 and 4
Each error is one of the 15 Pauli errors on two qubits: for example, on qubits i,j, the error could be I, X_i, Y_i, Z_i, but on two qubits, the Pauli operators are tensor products like X_i I_j, I_i X_j, X_i X_j, X_i Z_j, etc., all non-identity, so 15 possibilities.
Now, each such error occurs with probability p/15 for each location, and with probability 1-p, no error at that location.
Since the errors are independent, we can consider all possible sets of errors.
The total number of error patterns is large, but many will be detected or have the same effect.
For the logical fidelity, we need to know when the logical state is correct.
The ideal final state is |00β©_L, which is stabilized by Z_A and Z_B.
After errors, if a Pauli error E is applied to the state, the state becomes E |00β©_L, but only if E commutes with the stabilizers, otherwise it is detected.
But in this case, errors occur during the circuit, so it’s not simply applied at the end; however, because the circuit is Clifford, we can propagate the errors to the end and find the effective error on the logical state.
Moreover, since we have ancilla measurement, errors might affect the measurement outcome.
Let’s think about the ancilla measurement first.
The ancilla is qubit 4, and we measure it in Z basis. From the ideal circuit, we saw that after CNOT_{04}, qubit 4 is always |0β©, so measurement always gives 0 if no errors.
If there is an error, qubit 4 might be flipped, so measurement might be |1β©, which we discard.
Also, errors on data qubits might affect the stabilizers.
Now, for the logical state, errors that commute with the stabilizers but act non-trivially on the logical space will cause logical errors.
The logical errors are Pauli operators on the logical qubits.
For example, logical X_A, X_B, etc.
From the given, X_A = XIXI, X_B=XXII, Z_A=ZZII, Z_B=ZIZI.
But these are up to stabilizers, so equivalent forms.
Now, to find the fidelity, we need the probability that there is no logical error, given that no error is detected.
No error detected means that the ancilla measures 0 and the stabilizers XXXX and ZZZZ have eigenvalue +1.
So, for each possible error pattern from the five locations, we can compute whether it causes the ancilla measurement to be 1 or not, and whether the stabilizers are violated, and what the logical error is.
Then, the probability of no logical error and no detection divided by probability of no detection.
Since we post-select on no detection, the fidelity is P(no logical error and no detection) / P(no detection)
P(no detection) = P(ancilla measures 0 and stabilizers +1)
P(no logical error and no detection) = P(no logical error and no detection)
Now, for each error location, the errors are on specific qubits, and we need to see their effect after propagation.
Because the circuit has gates after the errors, we need to propagate each error through the subsequent gates to see what error it corresponds to at the end.
For example, an error after CNOT_{12} will be affected by subsequent gates like CNOT_{10}, CNOT_{23}, etc.
Similarly for other errors.
This propagation might be cumbersome, but since the gates are CNOTs, we can compute how Pauli errors propagate through CNOT gates.
I recall that for CNOT gates, the propagation of Pauli errors is well-known.
For example, if I have a Pauli error on control or target before CNOT, it might spread.
But here, errors happen after CNOT gates, so for an error after a CNOT, it is applied after that CNOT, so before subsequent gates.
So, for error after CNOT_{12}, it is applied after CNOT_{12} but before CNOT_{10}, so it will be subject to CNOT_{10}, CNOT_{23}, etc.
So, to find the effective error at the end, we need to take each error and apply all subsequent gates to it, but since the gates are unitary, applying a gate after error is equivalent to applying the error before the gate but conjugated, so we can push the error through the gates to the beginning, but since the initial state is fixed, it might be better to push to the end.
Let’s think about the circuit sequence.
Let me list the gates in order of application:
-
H_1
-
CNOT_{12}
-
error E1 on qubits 1,2
-
CNOT_{10}
-
error E2 on qubits 1,0
-
CNOT_{23}
-
error E3 on qubits 2,3
-
CNOT_{34}
-
error E4 on qubits 3,4
-
CNOT_{04}
-
error E5 on qubits 0,4
-
M_4
Then we measure stabilizers on data qubits.
But the stabilizer measurement is not part of the circuit; we assume that after this circuit, we measure the stabilizers to detect errors.
So, after the circuit, we have the state on qubits 0,1,2,3,4, then we measure qubit 4 and measure XXXX and ZZZZ on data qubits.
Now, for the errors, each Ei is a Pauli error on the specified qubits.
To find the effect on the final state, we can consider the entire circuit with errors as preparing a state, and then we measure.
Since the errors are Pauli, and the circuit is Clifford, the final state will be some state with Pauli errors on it.
But for the logical fidelity, we need the logical state.
Perhaps I can consider the error-free circuit and see how each possible Pauli error on the data qubits at the end would affect the logical state, but then I need to find which error patterns from the error channels correspond to which final errors.
Maybe I can find the equivalent error at the end due to each error location.
Let’s consider each error location separately first, assuming only one error occurs, since p is small, but for exact fidelity, I need all orders, but perhaps for fidelity, since we post-select, and errors are rare, the leading order might be sufficient, but let’s see.
The problem might expect an expression in terms of p.
Perhaps for this specific circuit, some errors are detected by the ancilla, some by the stabilizers.
Another thought: the ancilla measurement is used to detect errors in the preparation. In the ideal case, ancilla should be |0β©, so if it’s |1β©, it indicates an error.
From the circuit, the ancilla is initially |0β©, and it is targeted by CNOT_{34} and CNOT_{04}, so errors on those gates might directly affect it.
But let’s try to propagate errors to the end.
Let me define the final effective error on the data qubits and ancilla due to each initial error.
But since the errors are applied at different times, I need to see how each error propagates through the subsequent gates.
Let’s list the gates after each error.
For error E1 after CNOT_{12}, it is applied after CNOT_{12}, so before CNOT_{10}, CNOT_{23}, etc.
So, after E1, we have gates: CNOT_{10}, CNOT_{23}, CNOT_{34}, CNOT_{04}, and then error E5, but E5 is another error, so for now, let’s consider only E1 and no other errors, so we can see the effect of E1 alone.
Similarly for others.
So, let’s assume only one error occurs at one location, with probability p/15 for each Pauli error at that location.
Then, later, we can consider multiple errors, but for small p, the probability of multiple errors is O(p^2), so for fidelity up to O(p), we might need only single errors, but since we post-select, sometimes single errors are detected, so no logical error, sometimes not detected, so logical error, and sometimes multiple errors might cancel or something, but for fidelity, perhaps to first order, we can consider single errors.
But let’s see what the problem expects. It says “logical state fidelity as a function of p”, so perhaps we need an expression that includes p terms.
Since p is small, maybe we can compute the infidelity, which is 1 - F, and find how it scales with p.
But let’s try to find exactly.
Perhaps for this code and circuit, the logical error probability after post-selection is proportional to p^2 or something.
Let’s think about the distance: the code has distance 2, so it can detect single errors, but since our error channels are two-qubit errors, even a single error from a CNOT can affect two qubits, so it might cause undetectable errors if it affects two qubits in a way that commutes with stabilizers.
But let’s list for each error location, what are the possible errors and their effects.
First, consider error after CNOT_{12}: error on qubits 1 and 2.
The possible errors are Pauli operators on qubits 1 and 2: X1, Z1, Y1, X2, Z2, Y2, X1X2, X1Z2, etc., all 15 non-identity.
This error is applied after CNOT_{12}, so before CNOT_{10}, CNOT_{23}, etc.
Now, subsequent gates: CNOT_{10} (control 1, target 0), CNOT_{23} (control 2, target 3), CNOT_{34} (control 3, target 4), CNOT_{04} (control 0, target 4).
So, when we apply CNOT_{10}, it will affect errors on qubit 1 or 0, but since E1 is on qubits 1 and 2, it will be conjugated by CNOT_{10}.
Similarly for other gates.
To find the effective error at the end, we need to apply all subsequent gates to the error E1.
Since the gates are CNOTs, we can compute how the Pauli error evolves through each CNOT.
For example, if I have a Pauli P on some qubits, and I apply a CNOT with control c, target t, then the conjugated Pauli is CNOT_{c,t} P CNOT_{c,t}^β , which is another Pauli, and it depends on P.
The rules are well-known: for a CNOT gate, it propag errors as follows:
-
If P has X on control, it becomes X on control and X on target.
-
If P has Z on control, it becomes Z on control.
-
If P has X on target, it becomes X on target.
-
If P has Z on target, it becomes Z on control and Z on target.
More precisely, the CNOT gate maps Pauli operators to Pauli operators under conjugation.
For example, if I have X_c, after CNOT_{c,t}, it becomes X_c X_t.
If I have Z_c, after CNOT_{c,t}, it becomes Z_c.
If I have X_t, after CNOT_{c,t}, it becomes X_t.
If I have Z_t, after CNOT_{c,t}, it becomes Z_c Z_t.
And similarly for products.
So, for our case, we have multiple CNOTs to apply.
Let’s take error E1 on qubits 1 and 2.
After E1, we apply CNOT_{10}, which has control 1, target 0.
So, for E1, which is a Pauli on qubits 1 and 2, after CNOT_{10}, the error will change based on how it commutes with CNOT_{10}.
Since CNOT_{10} acts on qubits 1 and 0, it will affect components on qubit 1 and may spread to qubit 0.
Similarly, then we apply CNOT_{23} on qubits 2 and 3, so it will affect qubits 2 and 3.
Then CNOT_{34} on qubits 3 and 4, then CNOT_{04} on qubits 0 and 4.
Finally, we have the error E5 after CNOT_{04}, but for now, assume only E1, so no other errors.
So, let’s find the effective error after all gates due to E1.
Let P be the Pauli error E1 on qubits 1 and 2.
After CNOT_{10} (control 1, target 0), the error becomes CNOT_{10} P CNOT_{10}^β .
Since CNOT_{10} acts on qubits 1 and 0, and P acts on qubits 1 and 2, it will change based on the operators on qubit 1.
Let me denote the Pauli string for P. Since it’s on qubits 1 and 2, it can be written as P = P1 β P2 β I elsewhere, but after conjugation, it may act on other qubits.
After CNOT_{10}, the new error Q = CNOT_{10} P CNOT_{10}^β .
CNOT_{10} affects only qubits 1 and 0, so for qubits other than 1 and 0, Q is the same as P.
But P acts on qubits 1 and 2, so for qubit 2, it is unchanged, but for qubit 1, it may change, and it may add operators on qubit 0.
Specifically, the conjugation rules:
-
If P has X on qubit 1, then after CNOT_{10}, it will have X on qubit 1 and X on qubit 0.
-
If P has Z on qubit 1, then after CNOT_{10}, it will have Z on qubit 1.
-
If P has X on qubit 2, it is unaffected because CNOT_{10} doesn’t act on qubit 2.
-
If P has Z on qubit 2, unaffected.
Similarly for Y, but Y can be treated as i X Z, so it will be affected accordingly.
Since Y = i X Z, and CNOT conjugation, for example, if P has Y on qubit 1, which is i X1 Z1, after CNOT_{10}, since X1 becomes X1 X0, Z1 becomes Z1, so Y1 becomes i (X1 X0) Z1 = i X1 Z1 X0 = Y1 X0, so it becomes Y on qubit 1 and X on qubit 0.
Similarly for other cases.
But perhaps it’s easier to consider each possible Pauli error for E1 and see what it becomes after each gate.
Since there are 15 possibilities, it might be tedious, but we can group them based on their type.
Perhaps for the purpose of detection and logical error, we care about the effective error on the data qubits at the end.
Also, the ancilla measurement might be affected.
Let’s list the subsequent gates after E1:
After E1, we have CNOT_{10}, then CNOT_{23}, then CNOT_{34}, then CNOT_{04}, then measurement.
But during these gates, the state is evolving, but for the error, we care about how the error operator evolves.
So, let’s find how E1 evolves through the gates.
Let me define the error after each gate.
After E1 is applied, the error is P on qubits 1,2.
Then apply CNOT_{10}. After CNOT_{10}, the effective error is Q1 = CNOT_{10} P CNOT_{10}^β .
Then apply CNOT_{23}. After CNOT_{23}, the error becomes Q2 = CNOT_{23} Q1 CNOT_{23}^β .
Then apply CNOT_{34}. Q3 = CNOT_{34} Q2 CNOT_{34}^β .
Then apply CNOT_{04}. Q4 = CNOT_{04} Q3 CNOT_{04}^β .
Then after CNOT_{04}, we have the state, and we measure qubit 4 and data stabilizers.
Q4 is the effective error on the state at the end due to E1.
Similarly, for other error locations.
But this Q4 may act on multiple qubits, including ancilla.
Then, for measurement, if Q4 has Z on qubit 4, it might flip the measurement outcome, etc.
But for now, let’s focus on E1.
Since P is on qubits 1 and 2, and CNOT_{10} acts on 1 and 0, so Q1 will act on qubits 0,1,2.
Similarly, CNOT_{23} acts on 2 and 3, so Q2 will act on 0,1,2,3.
CNOT_{34} acts on 3 and 4, so Q3 will act on 0,1,2,3,4.
CNOT_{04} acts on 0 and 4, so Q4 will act on 0,1,2,3,4.
So, the final error Q4 involves all five qubits.
Then, when we measure qubit 4, if Q4 has X or Y on qubit 4, it will flip the measurement outcome, so if measurement is supposed to be 0, it might be 1, so we detect error if Q4 has X or Y on qubit 4.
If Q4 has Z on qubit 4, it doesn’t flip the measurement, but it might phase flip, but since we measure in Z basis, Z error doesn’t affect measurement outcome.
Similarly, for the data stabilizers, we measure XXXX and ZZZZ on qubits 0,1,2,3.
If Q4 anti-commutes with XXXX or ZZZZ, then the measurement will give -1, so error detected.
Otherwise, if it commutes, no detection, and then Q4 may have logical error on the data.
So, for each possible E1, we can find Q4 and see if it is detected or not, and what logical error it causes.
Similarly for other error locations.
But this is for E1 alone, with no other errors.
Similarly for E2, E3, etc.
And for E5, since it is after CNOT_{04}, it is applied after all gates, so it is directly the error on the final state, so for E5 on qubits 0 and 4, it is already on the final state, so we can directly see its effect.
E5 is after CNOT_{04}, so after CNOT_{04}, we apply E5, then measure, so E5 is applied to the state after CNOT_{04}, which is before measurement, so yes, E5 is on the final state.
Similarly, for E4, after CNOT_{34}, then we apply CNOT_{04}, so E4 is before CNOT_{04}, so it will be conjugated by CNOT_{04}.
So for each error location, we need to find the effective error on the final state.
Let’s first list the order of gates and errors:
Gates: H1, CNOT12, E1, CNOT10, E2, CNOT23, E3, CNOT34, E4, CNOT04, E5, M4
So, after each gate or error, the state is transformed.
For the effective error, since the initial state is |0> for all, and H1 is applied, but for error propagation, we care about how the error operators evolve, which is independent of the state, so we can find how each Ei is transformed by the subsequent gates.
For E1, it is applied after CNOT12, so after H1 and CNOT12 have been applied, but for the error operator, when we propagate it through subsequent gates, we can find what equivalent error it would be if applied at the end.
So, for E1, the effective error at the end is obtained by applying all gates after E1 to the state, but since the gates are unitary, the state after all gates with E1 is equivalent to having no E1 but some error before the gates, but because the initial state is fixed, it’s better to find the error after all gates.
Let’s define the unitary from after E1 to the end.
After E1, we have U = CNOT10 * CNOT23 * CNOT34 * CNOT04
Then after U, we have E5, then measurement.
But U is applied to the state after E1, so the state before measurement is U E1 |psi> after CNOT12, but since we have ideal state, let’s not think about the state yet.
For the error E1, when we apply U to the state, it is U E1 |phi> for some |phi>, which is equivalent to (U E1 U^β ) U |phi>, so the effective error is U E1 U^β applied after U, but since we have E5 after U, so the net error is E5 * (U E1 U^β ) applied to the state after U.
But after U, the state is without errors, so for the final state, the error is E5 * U E1 U^β .
Similarly, for E2, it is applied after CNOT10, so after CNOT10, we have V = CNOT23 * CNOT34 * CNOT04, then E5, so effective error is E5 * V E2 V^β .
For E3, after CNOT23, we have W = CNOT34 * CNOT04, then E5, so effective error E5 * W E3 W^β .
For E4, after CNOT34, we have X = CNOT04, then E5, so effective error E5 * X E4 X^β .
For E5, it is already at the end, so effective error E5.
Now, U = CNOT10 * CNOT23 * CNOT34 * CNOT04
V = CNOT23 * CNOT34 * CNOT04
W = CNOT34 * CNOT04
X = CNOT04
So, for each initial error Ei, we can find the effective error at the end, which is a Pauli operator on all five qubits.
Then, for this effective error, we can see if it causes the ancilla measurement to be 1 or not, and if it anti-commutes with stabilizers.
The ancilla measurement is of qubit 4 in Z basis. So, if the effective error has X or Y on qubit 4, it will flip the measurement outcome, so if the ideal measurement is 0, it will be 1 if error has X or Y on qubit 4.
If the error has Z or I on qubit 4, measurement outcome is unchanged, so we get 0.
Similarly, for stabilizers, if the effective error anti-commutes with XXXX or ZZZZ, then the measurement will give -1, so error detected.
Otherwise, no detection.
Then, if no detection, the effective error may have logical error on the data.
The logical error can be determined by how it acts on the logical state.
Since the logical state is |00>_L, and effective error E, if E commutes with stabilizers, it acts on the logical space, so it can be expressed as a logical Pauli operator times stabilizer.
So, for example, if E is equivalent to I on logical, then no logical error, if equivalent to X_A, etc.
Now, for the fidelity, we need the probability that the logical state is correct, so when effective error is identity on logical space.
Now, since we have multiple error locations, we need to consider all possible combinations of E1 to E5.
Each Ei can be I with probability 1-p, or one of the 15 Pauli errors with probability p/15.
So, there are many cases.
But perhaps for the logical fidelity after post-selection, we can find the probability that the effective error is identity on logical space and no detection, etc.
But this seems messy.
Perhaps for this circuit, some errors are always detected, some are not.
Another idea: since the circuit is for state preparation, and we have ancilla, perhaps the only errors that are not detected are those that act trivially on the logical state or something.
Let’s think about the purpose of the ancilla. In the circuit, the ancilla is used to detect errors during preparation.
From the ideal circuit, we saw that the ancilla should be |0β©, so if it’s |1β©, error detected.
Also, from the circuit, the CNOT gates with ancilla are CNOT_{34} and CNOT_{04}, so errors on these gates might affect the ancilla directly.
But let’s consider the effective error for each error location.
Perhaps I can consider that for the logical fidelity, since the code can detect any single-qubit error, and each error from a CNOT affects two qubits, but if the error affects only one qubit effectively, it might be detected, but if it affects two, it might not be.
But let’s try to find for each error location, what is the weight of the effective error on the data qubits.
Let’s take error after CNOT_{12}: E1 on qubits 1 and2.
Then U = CNOT10 * CNOT23 * CNOT34 * CNOT04
Now, CNOT10 acts on 1 and0, CNOT23 on 2 and3, CNOT34 on 3 and4, CNOT04 on 0 and4.
So, to find U E1 U^β , which is the effective error from E1 before E5.
Since U consists of CNOTs, and E1 is on qubits 1 and2, let’s see how it propagates.
First, apply CNOT10 to E1. CNOT10 has control 1, target 0, so it will affect operators on qubit 1.
As I said earlier, if E1 has X on qubit 1, after CNOT10, it becomes X on qubit 1 and X on qubit 0.
If Z on qubit 1, becomes Z on qubit 1.
If X on qubit 2, unchanged.
If Z on qubit 2, unchanged.
So, after CNOT10, the error may include qubit 0.
Then apply CNOT23 to the result. CNOT23 has control 2, target 3, so it will affect operators on qubit 2.
If the error has X on qubit 2, after CNOT23, it becomes X on qubit 2 and X on qubit 3.
If Z on qubit 2, becomes Z on qubit 2 and Z on qubit 3.
And so on.
Then apply CNOT34, control 3, target 4, so affects qubits 3 and4.
Then apply CNOT04, control 0, target 4, so affects qubits 0 and4.
So, for example, if E1 is X1, after CNOT10, it becomes X1 X0 (because X on control becomes X on control and target).
Then after CNOT23, since no operator on qubit 2 yet, so still X1 X0.
Then after CNOT34, no operator on qubit 3 or4, so still X1 X0.
Then after CNOT04, CNOT04 has control 0, target 4, so for X0, which is on control, after CNOT04, X0 becomes X0 X4, so the error becomes X1 X0 X4.
So effective error from E1 if it is X1 is X0 X1 X4.
Similarly, if E1 is Z1, after CNOT10, Z1 becomes Z1 (because Z on control becomes Z on control).
Then after CNOT23, unchanged, so Z1.
After CNOT34, unchanged, so Z1.
After CNOT04, CNOT04 acts on 0 and4, so for Z1, which is on qubit 1, not affected, so still Z1.
So effective error Z1.
If E1 is X2, after CNOT10, unchanged, so X2.
After CNOT23, X2 is on target? CNOT23 control 2, target 3, so X on target? X2 is on qubit 2, which is control for CNOT23? CNOT23 has control 2, target 3, so if error has X on control, after CNOT23, it becomes X on control and X on target, so X2 becomes X2 X3.
After CNOT34, now has X2 X3, CNOT34 control 3, target 4, so X on control 3, so after CNOT34, X3 becomes X3 X4, so error becomes X2 X3 X4.
After CNOT04, no operator on 0 or4 yet, but has X4, so for CNOT04, control 0, target 4, so X4 is on target, so after CNOT04, X4 becomes X4 (because X on target is unchanged), so still X2 X3 X4.
So effective error X2 X3 X4.
If E1 is Z2, after CNOT10, unchanged, so Z2.
After CNOT23, Z2 is on control, so after CNOT23, Z2 becomes Z2 (because Z on control becomes Z on control).
After CNOT34, unchanged, so Z2.
After CNOT04, unchanged, so Z2.
So effective error Z2.
If E1 is X1 X2, after CNOT10, X1 becomes X1 X0, so error becomes X1 X0 X2.
After CNOT23, X2 is on control, so becomes X2 X3, so error X1 X0 X2 X3.
After CNOT34, X3 is on control, so becomes X3 X4, so error X1 X0 X2 X3 X4.
After CNOT04, X0 is on control, so becomes X0 X4, but already have X4, so X0 X4 and X4, but X4 X4 = I, so after CNOT04, X0 becomes X0 X4, so the error has X0 X4 from this, but already have X4, so let’s see: after CNOT34, error is X1 X0 X2 X3 X4.
Now CNOT04: for X0, which is on control, so after CNOT04, X0 becomes X0 X4.
So the error becomes X1 (X0 X4) X2 X3 X4 = X1 X0 X2 X3 X4 X4 = X1 X0 X2 X3 I since X4 X4 = I.
So effective error X0 X1 X2 X3.
Similarly, we can do for other Paulis.
But this is for U E1 U^β , and then we have E5, so for the net error, it is E5 times this, but for now, for E1 alone, we have this effective error from E1, and then E5 is identity since no other errors.
But for the general case, we have E5 as well.
So for the final effective error, it is the product of the effective errors from each Ei.
Since Pauli errors commute, the net effective error is the product of the individual effective errors from each error location.
And since each effective error is Pauli, the product is Pauli.
So, for each error location, we can find what effective error it contributes to the final state.
Then, for the final effective error E_final, we can see if it causes detection or not.
Then, for no detection, E_final must commute with XXXX and ZZZZ, and must not have X or Y on qubit 4, so that measurement is 0.
So, E_final must have I or Z on qubit 4, and must commute with XXXX and ZZZZ.
Then, if it commutes, it can be logical identity or logical error.
Now, for the logical fidelity, we need E_final to be identity on the logical space, i.e., equivalent to I times stabilizer.
Now, to find the probability, we need to find for each possible set of E1 to E5, what is E_final, and whether it is detected, and if not, what logical error.
Then sum over all cases where no detection and logical identity.
But this is complicated because there are 5 locations, each with 16 possibilities (15 errors + no error), so 16^5 = 1048576 cases, which is too many to handle manually.
Perhaps for this circuit, the only errors that are not detected are those that have no effect or very specific errors.
Maybe the circuit is designed so that any single error from the CNOT gates is detected, so that undetected errors require at least two errors.
But let’s think about the ancilla measurement.
From the ideal circuit, ancilla is always |0β©, so if any error causes the ancilla to be |1β©, it is detected.
What errors can cause ancilla to be |1β©? Only if the effective error has X or Y on qubit 4.
From the effective error for each Ei, we can see when it has X or Y on qubit 4.
For example, from earlier, for E1, if it is X1, effective error has X4, so it has X on qubit 4, so measurement flipped to 1.
Similarly, if E1 is X2, effective error has X4, so measurement flipped.
If E1 is Z1, effective error has only Z1, so no X or Y on qubit 4, so measurement not flipped.
Similarly for other errors.
But for E1, only if it has X on qubit 1 or X on qubit 2, it might lead to X on qubit 4.
From earlier examples:
-
If E1 is X1, effective error X0 X1 X4
-
If E1 is X2, effective error X2 X3 X4
-
If E1 is Y1, let’s compute: Y1 = i X1 Z1
After CNOT10, X1 becomes X1 X0, Z1 becomes Z1, so Y1 becomes i (X1 X0) Z1 = i X1 Z1 X0 = Y1 X0
So after CNOT10, error is Y1 X0
After CNOT23, no change, so Y1 X0
After CNOT34, no change, so Y1 X0
After CNOT04, for X0, which is on control, so after CNOT04, X0 becomes X0 X4, so error becomes Y1 X0 X4
So effective error Y1 X0 X4, which has X on qubit 4.
Similarly, if E1 is Y2, Y2 = i X2 Z2
After CNOT10, unchanged, so Y2
After CNOT23, X2 becomes X2 X3, Z2 becomes Z2, so Y2 becomes i (X2 X3) Z2 = i X2 Z2 X3 = Y2 X3
After CNOT34, X3 is on control, so after CNOT34, X3 becomes X3 X4, so error becomes Y2 X3 X4
After CNOT04, no change, so Y2 X3 X4, which has X on qubit 4.
If E1 is Z1 or Z2, no X on qubit 4.
If E1 is X1 X2, effective error X0 X1 X2 X3, no X on qubit 4.
If E1 is X1 Z2, let’s compute.
X1 Z2 after CNOT10: X1 becomes X1 X0, Z2 unchanged, so X1 X0 Z2
After CNOT23: Z2 is on control, so after CNOT23, Z2 becomes Z2 (Z on control), so error X1 X0 Z2
After CNOT34: unchanged, so X1 X0 Z2
After CNOT04: for X0, on control, so becomes X0 X4, so error X1 (X0 X4) Z2 = X1 X0 X4 Z2
So has X on qubit 4.
Similarly, other cases.
So for E1, if it has any X or Y on qubit 1 or qubit 2, it will have X on qubit 4 in the effective error, so measurement flipped to 1, so detected.
If it has only Z on qubit 1 or only Z on qubit 2, or products like Z1 Z2, then no X on qubit 4, so measurement not flipped.
For example, if E1 is Z1, effective error Z1, no X on 4.
If E1 is Z2, effective error Z2, no X on 4.
If E1 is Z1 Z2, after CNOT10, Z1 becomes Z1, Z2 unchanged, so Z1 Z2
After CNOT23, Z2 becomes Z2, so still Z1 Z2
After CNOT34, unchanged, so Z1 Z2
After CNOT04, unchanged, so Z1 Z2, no X on 4.
If E1 is Y1 Y2, but Y1 Y2 = (i X1 Z1)(i X2 Z2) = - X1 X2 Z1 Z2
After CNOT10, X1 becomes X1 X0, Z1 becomes Z1, X2 unchanged, Z2 unchanged, so - (X1 X0) X2 Z1 Z2 = - X0 X1 X2 Z1 Z2
After CNOT23, X2 is on control, so becomes X2 X3, so error - X0 X1 (X2 X3) Z1 Z2 = - X0 X1 X2 X3 Z1 Z2
After CNOT34, X3 on control, becomes X3 X4, so error - X0 X1 X2 (X3 X4) Z1 Z2 = - X0 X1 X2 X3 X4 Z1 Z2
After CNOT04, X0 on control, becomes X0 X4, so error - (X0 X4) X1 X2 X3 X4 Z1 Z2 = - X0 X1 X2 X3 X4 X4 Z1 Z2 = - X0 X1 X2 X3 Z1 Z2 since X4 X4=I
So no X on qubit 4? Here it has X4 in the process, but after CNOT04, it cancels, so no X on qubit 4 in the final effective error.
So for E1, if it has no X or Y on qubit 1 or2, then no X on qubit 4, so measurement not flipped.
But if it has X or Y on qubit 1 or2, then measurement flipped.
So for E1, the probability that measurement is not flipped is when E1 has only Z operators on qubits 1 and2, so no X or Y.
The Pauli errors on two qubits that have no X or Y on either qubit are those that are products of Z and I, so only Z1, Z2, and Z1 Z2.
Also, identity, but identity is no error.
So for E1, the errors that don’t flip measurement are: I, Z1, Z2, Z1 Z2.
There are 4 such errors out of 16 possible (including no error).
But each with probability: no error with prob 1-p, and each Pauli error with prob p/15, so for these, prob that measurement not flipped due to E1 is prob of I, Z1, Z2, Z1 Z2.
Prob I: 1-p
Prob Z1: p/15
Prob Z2: p/15
Prob Z1 Z2: p/15
So total prob that measurement not flipped from E1 is 1-p + 3p/15 = 1-p + p/5 = 1 - 4p/5
But this is for E1 alone, but we have other error locations, so for the measurement to be not flipped, we need that the net effective error has no X or Y on qubit 4.
Similarly for other error locations.
But for now, for E1, if it has errors that cause X on qubit 4, measurement flipped, so detected.
If not, then we need to consider other errors.
Similarly for other error locations.
Perhaps for this circuit, the only errors that are not detected are those that leave the ancilla measurement unchanged and commute with stabilizers.
And for the logical error, we need to see.
But let’s consider the other error locations.
First, let’s list for each error location, what is the effective error on the final state, but since we have E5, it’s better to find for each Ei, what effective error it contributes, and then the net is the product.
But for the measurement to be not flipped, the net effective error must have I or Z on qubit 4.
Similarly for stabilizers.
Now, for E2: error on qubits 1 and0 after CNOT10.
E2 is applied after CNOT10, so before CNOT23, CNOT34, CNOT04.
So, the effective error from E2 is V E2 V^β , where V = CNOT23 * CNOT34 * CNOT04
Then later multiplied by E5.
V = CNOT23 * CNOT34 * CNOT04
So, let’s find for E2 on qubits 1 and0, what is V E2 V^β .
E2 is on qubits 1 and0.
V involves CNOT23 on 2 and3, CNOT34 on 3 and4, CNOT04 on 0 and4.
So, when applying V, since V acts on qubits 2,3,4,0, but E2 is on 1 and0, so qubit 1 is not affected by V, so for operators on qubit 1, they are unchanged by V.
For operators on qubit 0, they may be affected by CNOT04, since CNOT04 acts on 0 and4.
So, let’s compute.
First, apply CNOT23 to E2. CNOT23 acts on 2 and3, so since E2 is on 1 and0, it is unchanged by CNOT23.
Then apply CNOT34 to the result. CNOT34 acts on 3 and4, so unchanged.
Then apply CNOT04 to the result. CNOT04 acts on 0 and4, so it will affect operators on qubit 0.
So, for E2 on qubits 1 and0, after V, the effective error is CNOT04 E2 CNOT04^β , because CNOT23 and CNOT34 commute with E2 since they act on different qubits.
CNOT23 acts on 2 and3, E2 on 1 and0, so they commute, so CNOT23 E2 CNOT23^β = E2.
Similarly for CNOT34, so V E2 V^β = CNOT04 E2 CNOT04^β .
So, for E2, the effective error is just CNOT04 E2 CNOT04^β .
CNOT04 has control 0, target 4.
So, for E2 on qubits 1 and0, after CNOT04, the error becomes based on what E2 is.
If E2 has X on qubit 0, after CNOT04, it becomes X on qubit 0 and X on qubit 4.
If X on qubit 1, unchanged.
If Z on qubit 0, after CNOT04, it becomes Z on qubit 0.
If Z on qubit 1, unchanged.
etc.
So, for example, if E2 is X0, after CNOT04, it becomes X0 X4.
If E2 is X1, after CNOT04, it becomes X1.
If E2 is Z0, after CNOT04, it becomes Z0.
If E2 is Z1, after CNOT04, it becomes Z1.
If E2 is X0 X1, after CNOT04, becomes X0 X4 X1.
And so on.
So, the effective error from E2 may have operators on qubit 4 if E2 has X on qubit 0.
Similarly for Y etc.
So, for measurement, if the effective error from E2 has X or Y on qubit 4, it will flip measurement.
So, if E2 has X or Y on qubit 0, then after CNOT04, it will have X on qubit 4, so measurement flipped.
If E2 has no X or Y on qubit 0, then no X on qubit 4, so measurement not flipped.
So for E2, measurement not flipped if E2 has no X or Y on qubit 0, i.e., only Z or I on qubit 0.
So errors: I, Z0, and also on qubit 1, but since qubit 1 doesn’t affect, so any error on qubit 1 is fine, but for no X on qubit 0, so E2 must have I or Z on qubit 0.
So the Pauli errors on qubits 0 and1 that have no X or Y on qubit 0 are: those where on qubit 0, it is I or Z, and on qubit 1, anything.
So for two qubits, the Pauli operators where qubit 0 has I or Z: that is, for qubit 0: I or Z, for qubit 1: I, X, Y, Z.
So there are 2 * 4 = 8 such Pauli operators, including identity.
But identity is included, so when no error, prob 1-p, and for Pauli errors, there are 15, but among them, those with no X or Y on qubit 0: since on qubit 0, only I or Z, so the possible Paulis are: I0 I1, I0 X1, I0 Y1, I0 Z1, Z0 I1, Z0 X1, Z0 Y1, Z0 Z1. So 8 possibilities.
Each with probability p/15 for error, but no error has prob 1-p, so prob that measurement not flipped from E2 is prob that E2 has no X or Y on qubit 0, which is prob of these 8 cases: prob no error + prob of the 7 Pauli errors with no X/Y on qubit 0? No.
There are 15 Pauli errors, and 8 of them have no X or Y on qubit 0, as listed above: I0 I1, I0 X1, I0 Y1, I0 Z1, Z0 I1, Z0 X1, Z0 Y1, Z0 Z1.
But I0 I1 is identity, which is included in no error, so when we say “error”, it includes identity with prob 1-p, and each Pauli with prob p/15.
So the probability that E2 has no X or Y on qubit 0 is: prob no error + prob of the 7 Pauli errors that have no X/Y on qubit 0? No, the Pauli errors include identity, but when we have error, identity is not considered an error, so for the Pauli errors, there are 15 non-identity Paulis, and among them, those with no X/Y on qubit 0 are: I0 X1, I0 Y1, I0 Z1, Z0 I1, Z0 X1, Z0 Y1, Z0 Z1. So 7 Pauli errors have no X/Y on qubit 0.
And identity has no X/Y on qubit 0.
So prob that measurement not flipped from E2 is: prob no error + prob of these 7 Pauli errors = (1-p) + 7 * (p/15) = 1-p + 7p/15
Similarly, for E1, we had prob measurement not flipped is 1-p + 3p/15 = 1-p + p/5
But this is for each error location alone, but for the net, we need the product of all effective errors to have no X/Y on qubit 4.
Since the effective errors from each Ei are Pauli, the net effective error has X/Y on qubit 4 if an odd number of the individual effective errors have X/Y on qubit 4.
So for the measurement to be not flipped, we need that the net effective error has I or Z on qubit 4, which means that the product of the effective errors from E1 to E5 has no X or Y on qubit 4.
So, we need to find for each Ei, when its effective error has X or Y on qubit 4.
From above, for E1, if E1 has X or Y on qubit 1 or2, then effective error has X on qubit 4.
Similarly, for E2, if E2 has X or Y on qubit 0, then effective error has X on qubit 4.
Now for E3: error on qubits 2 and3 after CNOT23.
E3 is applied after CNOT23, so before CNOT34, CNOT04.
So, the effective error from E3 is W E3 W^β , where W = CNOT34 * CNOT04
W acts on qubits 3,4,0 since CNOT34 on 3 and4, CNOT04 on 0 and4.
E3 is on qubits 2 and3, so when applying W, it will affect operators on qubit 3.
First, apply CNOT34 to E3. CNOT34 has control 3, target 4, so it will affect operators on qubit 3.
Then apply CNOT04 to the result. CNOT04 has control 0, target 4, so it will affect operators on qubit 0 and4.
So, for example, if E3 is X3, after CNOT34, X3 becomes X3 X4, so error becomes X3 X4
After CNOT04, no change, so X3 X4, which has X on qubit 4.
If E3 is Z3, after CNOT34, Z3 becomes Z3, so Z3
After CNOT04, no change, so Z3, no X on 4.
If E3 is X2, after CNOT34, unchanged, so X2
After CNOT04, unchanged, so X2, no X on 4.
If E3 is Z2, unchanged, so Z2, no X on 4.
If E3 is X2 X3, after CNOT34, X3 becomes X3 X4, so error X2 X3 X4
After CNOT04, no change, so X2 X3 X4, has X on 4.
And so on.
So for E3, if it has X or Y on qubit 3, then after CNOT34, it will have X on qubit 4, so effective error has X on qubit 4.
If no X or Y on qubit 3, then no X on qubit 4.
So for measurement, if E3 has X or Y on qubit 3, measurement flipped.
So prob measurement not flipped from E3 is when E3 has no X or Y on qubit 3, i.e., only Z or I on qubit 3.
So on qubits 2 and3, the Pauli errors that have no X or Y on qubit 3 are: those where on qubit 3, it is I or Z, and on qubit 2, anything.
So there are 2 choices for qubit 3 (I or Z), and 4 for qubit 2, so 8 Pauli operators, including identity.
But identity is no error, so prob: prob no error + prob of the 7 Pauli errors with no X/Y on qubit 3 = (1-p) + 7p/15
Now for E4: error on qubits 3 and4 after CNOT34.
E4 is applied after CNOT34, so before CNOT04.
So, the effective error from E4 is X E4 X^β , where X = CNOT04
So, CNOT04 E4 CNOT04^β .
CNOT04 has control 0, target 4.
E4 is on qubits 3 and4, so when applying CNOT04, it will affect operators on qubit 4.
If E4 has X on qubit 4, after CNOT04, since X on target, it becomes X on target, so unchanged, so X4.
If E4 has Z on qubit 4, after CNOT04, Z on target becomes Z on control and Z on target, so Z4 becomes Z0 Z4.
If E4 has X on qubit 3, unchanged.
etc.
So, for example, if E4 is X4, after CNOT04, it becomes X4, so has X on qubit 4.
If E4 is Z4, after CNOT04, it becomes Z0 Z4, so has Z on qubit 4, no X.
If E4 is X3, after CNOT04, it becomes X3, no X on 4.
If E4 is X3 X4, after CNOT04, X4 becomes X4, X3 unchanged, so X3 X4, has X on 4.
So for E4, if it has X or Y on qubit 4, then effective error has X on qubit 4.
If it has no X or Y on qubit 4, then no X on qubit 4.
So for measurement, if E4 has X or Y on qubit 4, measurement flipped.
So prob measurement not flipped from E4 is when E4 has no X or Y on qubit 4, i.e., only Z or I on qubit 4.
So on qubits 3 and4, the Pauli errors that have no X or Y on qubit 4 are: those where on qubit 4, it is I or Z, and on qubit 3, anything.
So there are 2*4=8 possibilities, including identity.
Prob: (1-p) + 7p/15
Now for E5: error on qubits 0 and4 after CNOT04.
E5 is applied after all gates, so it is directly on the final state.
So, if E5 has X or Y on qubit 4, then it will flip the measurement.
If not, not flipped.
So for E5, if it has no X or Y on qubit 4, then measurement not flipped.
So on qubits 0 and4, the Pauli errors that have no X or Y on qubit 4 are: those where on qubit 4, it is I or Z, and on qubit 0, anything.
So there are 2*4=8 possibilities, including identity.
Prob: (1-p) + 7p/15
Now, for the measurement to be not flipped, we need that the net effective error has no X or Y on qubit 4.
Since the net effective error is the product of the effective errors from E1 to E5, and each effective error may have X on qubit 4 or not.
But from above, for each Ei, when its effective error has X on qubit 4, it is when certain conditions are met.
However, when we take the product, if an even number of effective errors have X on qubit 4, then the net may have no X on qubit 4, but since X times X = I, so if two have X, they might cancel.
But for the measurement, the net error has X on qubit 4 if the number of effective errors with X on qubit 4 is odd.
So for measurement not flipped, we need that the number of effective errors with X on qubit 4 is even.
But from above, for each Ei, whether its effective error has X on qubit 4 depends on Ei itself.
For example, for E1, effective error has X on qubit 4 if E1 has X or Y on qubit 1 or2.
Similarly for others.
But since the effective errors are from different Ei, and they act on different qubits, when we take the product, the X on qubit 4 might not cancel because they are on the same qubit, so if multiple have X on qubit 4, then X times X = I, so indeed, if even number have X on qubit 4, net no X on qubit 4; if odd, net X on qubit 4.
So for measurement not flipped, we need that the number of Ei where the effective error has X on qubit 4 is even.
Now, from above:
-
For E1, effective error has X on qubit 4 if E1 has X or Y on qubit 1 or2.
-
For E2, effective error has X on qubit 4 if E2 has X or Y on qubit 0.
-
For E3, effective error has X on qubit 4 if E3 has X or Y on qubit 3.
-
For E4, effective error has X on qubit 4 if E4 has X or Y on qubit 4.
-
For E5, effective error has X on qubit 4 if E5 has X or Y on qubit 4. (since E5 is directly on qubit 4)
So, let’s define for each Ei, let A_i be the event that the effective error from Ei has X on qubit 4.
Then for measurement not flipped, the number of A_i that are true is even.
Now, for the stabilizers, we need that the net effective error commutes with XXXX and ZZZZ.
The net effective error is the product of the effective errors from E1 to E5.
Each effective error is a Pauli operator on all five qubits.
For the net error to commute with XXXX, it must have even number of X or Y on the data qubits, because XXXX anti-commutes with operators that have odd number of X or Y on qubits 0,1,2,3.
Similarly for ZZZZ, it must have even number of Z or Y on data qubits.
But since Y has both X and Z, it’s better to think in terms of the number of X-like and Z-like operators.
For XXXX, it anti-commutes with any Pauli that has an odd number of X or Y on the data qubits.
Similarly for ZZZZ, it anti-commutes with any Pauli that has an odd number of Z or Y on the data qubits.
So for no detection, we need that the net effective error has even number of X or Y on data qubits, and even number of Z or Y on data qubits.
Now, for the logical error, if the net error commutes with stabilizers, it can be logical identity or logical error.
For the [[4,2,2]] code, the logical operators are given, so we can see what the net error is equivalent to.
Now, to find the probability that there is no logical error and no detection, we need to consider all possible combinations of E1 to E5 where the net effective error has even number of X/Y on data qubits, even number of Z/Y on data qubits, and even number of A_i, and that the net error is identity on logical space.
Then divide by probability of no detection, which is probability that even number of A_i, and even number of X/Y on data, and even number of Z/Y on data.
This seems very complex to compute manually.
Perhaps for this code and circuit, the only way to have no logical error is if there is no error at all, or if errors cancel in a specific way.
But since p is small, perhaps the leading order term for infidelity is when there is two errors that cause a logical error but are not detected.
But let’s think about the circuit itself.
I recall that the [[4,2,2]] code is also known as the error detection code, and this preparation circuit might be designed to detect any single error.
From the above, for each error location, if there is a single error, it will cause the measurement to be flipped or the stabilizers to be violated, so it is detected.
For example, if only E1 has error, and it is X1, then measurement is flipped, so detected.
If only E1 has error, and it is Z1, then measurement not flipped, but what about stabilizers? From earlier, effective error is Z1, which has only Z on qubit 1, so for XXXX, it has no X or Y, so even number (0) of X/Y, so commutes with XXXX. For ZZZZ, it has one Z on qubit 1, so odd number of Z/Y, so it anti-commutes with ZZZZ, so stabilizer measurement will give -1, so error detected.
Similarly, if E1 is Z2, effective error Z2, has one Z, so anti-commutes with ZZZZ, detected.
If E1 is Z1 Z2, effective error Z1 Z2, has two Z’s, so even number of Z/Y, so commutes with ZZZZ, and no X/Y, so commutes with XXXX, so not detected by stabilizers. But does it cause logical error? Z1 Z2, but Z1 Z2 on the state |00>_L = (|0000> + |1111>)/β2, applying Z1 Z2, since Z1 Z2 |0000> = |0000>, Z1 Z2 |1111> = (-1)(-1)|1111> = |1111>, so it leaves the state unchanged, so no logical error. Similarly, Z1 Z2 is actually a stabilizer? The stabilizers are XXXX and ZZZZ, so Z1 Z2 is not a stabilizer, but it commutes with both, and on the logical state, it acts as identity because |00>_L has both qubits same, so Z1 Z2 has eigenvalue +1. In fact, Z1 Z2 can be written as (Z1 Z2 I3 I4) but since we have only data qubits, on data, Z1 Z2 is part of Z_A or something? Z_A = ZZII, which is Z0 Z1, not Z1 Z2. Z_B = ZIZI, which is Z0 Z2? Let’s see: Z_B = Z I Z I, so on qubits 0 and2, so Z0 Z2.
So Z1 Z2 is not a logical operator; it commutes with stabilizers, and on |00>_L, it acts as identity, so no logical error.
So for E1 with Z1 Z2, no logical error, and not detected by measurement or stabilizers, so it would be accepted, and fidelity is 1.
Similarly, for other errors that act trivially.
So for single errors, some are detected, some are not detected but cause no logical error.
For example, from E1, if it is Z1 Z2, not detected, no logical error.
Similarly, if E1 is I, no error.
Now for other error locations.
For example, for E2, if E2 is Z0, then effective error from E2 is CNOT04 Z0 CNOT04^β = Z0, since Z on control becomes Z on control.
So effective error Z0.
Then for measurement, no X on qubit 4, so measurement not flipped.
For stabilizers, Z0 has one Z, so odd number of Z/Y, so anti-commutes with ZZZZ, so detected.
Similarly, if E2 is Z1, effective error Z1, has one Z, so anti-commutes with ZZZZ, detected.
If E2 is Z0 Z1, effective error CNOT04 Z0 Z1 CNOT04^β = Z0 Z1, since Z0 becomes Z0, Z1 unchanged.
So Z0 Z1, which has two Z’s, so even number of Z/Y, and no X/Y, so commutes with stabilizers. On |00>_L, Z0 Z1 |0000> = |0000>, Z0 Z1 |1111> = (-1)(-1)|1111> = |1111>, so no logical error. So not detected, no logical error.
Similarly, for E3, if E3 is Z2 Z3, effective error from E3: after W, if E3 is Z2 Z3, after CNOT34, unchanged, after CNOT04, unchanged, so Z2 Z3, which has two Z’s, so commutes with ZZZZ, no X/Y, so commutes with XXXX, and on |00>_L, Z2 Z3 |0000> = |0000>, Z2 Z3 |1111> = (-1)(-1)|1111> = |1111>, so no logical error. So not detected.
Similarly for E4, if E4 is Z3 Z4, but effective error from E4: CNOT04 E4 CNOT04^β , if E4 is Z3 Z4, after CNOT04, Z4 becomes Z0 Z4, so error becomes Z3 Z0 Z4, which has Z on qubit 4, so for measurement, no X on qubit 4, so not flipped. For stabilizers, on data qubits, it has Z0 and Z3, so two Z’s, so even number of Z/Y, and no X/Y, so commutes with stabilizers. But does it cause logical error? On the state, but since it has Z on ancilla, but we measure ancilla, so after measurement, the state is projected, but for the data state, if we have error Z0 Z3, on |00>_L, it acts as identity, so no logical error. So not detected, no logical error.
Similarly for E5, if E5 is Z0 Z4, then directly, has Z on qubit 4, so measurement not flipped. On data, has Z0, so one Z, so odd number of Z/Y, so anti-commutes with ZZZZ, so detected.
If E5 is Z4 only, then has Z on qubit 4, measurement not flipped, on data, no error, so no logical error, not detected.
But E5 on qubits 0 and4, if E5 is I on data, but on qubit 4, if Z4, then measurement not flipped, and on data, no error, so not detected.
So for single errors, there are some that are not detected and cause no logical error.
For example, from E1: Z1 Z2
From E2: Z0 Z1
From E3: Z2 Z3
From E4: if Z3 Z4, but effective error has Z0 Z3 Z4, which on data has Z0 and Z3, so two Z’s, not detected, no logical error.
From E5: if Z4, then on data no error, not detected.
So for single errors, there are cases where no detection and no logical error.
Therefore, for fidelity, when there is no error, fidelity 1, when there is single error of these types, fidelity still 1, so infidelity might be higher order.
But let’s consider when logical error occurs.
For example, if there is an error that is not detected but causes logical error.
For example, from E1, if it is X1 X2, then from earlier, effective error X0 X1 X2 X3, which has X on all data qubits, so for XXXX, it has four X’s, even number, so commutes with XXXX. For ZZZZ, it has no Z, so even number of Z/Y, so commutes with ZZZZ. So not detected by stabilizers. For measurement, does it have X on qubit 4? From earlier, for E1 X1 X2, effective error X0 X1 X2 X3, no X on qubit 4, so measurement not flipped. So not detected. Now, what logical error? Applying X0 X1 X2 X3 to |00>_L = (|0000> + |1111>)/β2, X0 X1 X2 X3 |0000> = |1111>, X0 X1 X2 X3 |1111> = |0000>, so it swaps the state, but |00>_L is mapped to |00>_L, so actually, X0 X1 X2 X3 is the stabilizer XXXX, which acts as identity on the code space, so no logical error. So for this case, no logical error.
Similarly, if E1 is X1 Y2 or something, but let’s see.
For logical error, we need an error that is equivalent to logical X or Z.
For example, logical X_A = XIXI, which is X1 I2 I3 I4 on data, but since we have five qubits, but on data, X1.
So if effective error has X1 on data, it might be logical X_A.
But from above, for single errors, if E1 is X1, then effective error has X on qubit 4, so measurement flipped, so detected.
Similarly, if E2 is X1, effective error X1, which has X on qubit 1, so for XXXX, it has one X, so odd number, so anti-commutes with XXXX, so detected.
So for single errors, any error that has a single X or Z on data will be detected because it will anti-commute with XXXX or ZZZZ.
For example, if effective error has a single X on data, it anti-commutes with XXXX, detected.
If has single Z on data, anti-commutes with ZZZZ, detected.
So for single errors from any Ei, if it has a single Pauli on data, it is detected.
The only single errors that are not detected are those that have two Paulis on data that commute with stabilizers, like Z1 Z2, etc., which act trivially on the logical state.
So for single errors, no logical error occurs; either detected or not detected but no logical error.
Therefore, logical error can only occur when there are two or more errors that together cause a logical error but are not detected.
So for fidelity, to first order, there is no logical error, so fidelity is 1 - O(p^2) or something.
So we need to find the probability of logical error given no detection, which is at least order p^2.
So for the fidelity, it might be 1 - c p^2 + … for some c.
But since the problem asks for fidelity as a function of p, perhaps we need to find the exact expression or approximate.
But from the problem context, it might be that we need to find the leading order term.
Perhaps for this circuit, the logical infidelity is proportional to p^2.
But let’s assume that for small p, the fidelity F = 1 - k p^2 for some k.
But to find k, we need to find when logical error occurs.
So let’s consider cases where two errors occur, and they cause a logical error but are not detected.
For example, suppose from E1, we have an error that has no X on qubit 4, like Z1, but from earlier, if E1 is Z1, effective error Z1, which has single Z on data, so it is detected because anti-commutes with ZZZZ.
So for E1, only if it is Z1 Z2, it is not detected.
Similarly for other locations.
So for two errors, suppose from E1 and E2, both have errors that are not detected by themselves, but when combined, might cause logical error.
For example, if E1 is Z1 Z2, not detected, effective error Z1 Z2.
If E2 is Z0 Z1, not detected, effective error Z0 Z1.
Net effective error Z1 Z2 * Z0 Z1 = Z0 Z2 since Z1 Z1 = I.
So net error Z0 Z2.
Now, Z0 Z2 on data, which has two Z’s, so commutes with ZZZZ, and no X, so commutes with XXXX, so not detected by stabilizers. For measurement, since both effective errors have no X on qubit 4, net no X on qubit 4, so measurement not flipped. So not detected. Now, what logical error? Z0 Z2 on |00>_L, Z0 Z2 |0000> = |0000>, Z0 Z2 |1111> = (-1)(-1)|1111> = |1111>, so no logical error. Z0 Z2 is actually Z_B? Z_B = Z I Z I = Z0 Z2, so yes, Z0 Z2 is logical Z_B, which for |00>_L, it is still |0>_B, so no error for |00>_L? |00>_L is eigenvector of Z_B with eigenvalue +1, so applying Z_B does not change the state, so no logical error.
So still no logical error.
Another example: suppose from E1, is X1 X2, but from earlier, if E1 is X1 X2, effective error X0 X1 X2 X3, which is XXXX on data, which is stabilizer, so not detected, no logical error.
Similarly, if E2 is X0 X1, effective error from E2: if E2 is X0 X1, after CNOT04, X0 becomes X0 X4, so effective error X0 X4 X1 = X0 X1 X4.
So has X on qubit 4, so measurement flipped, so detected. So not not detected.
So for two errors, we need to find cases where net error is logical X or something.
For example, logical X_A = XIXI = X1.
So if net error has X1 on data, it would be logical X_A, but for |00>_L, X_A |00>_L = |10>_L, so logical error.
But from single errors, if effective error has X1, it is detected because anti-commutes with XXXX.
So for net error to have X1, it must be that the number of X on qubit 1 is odd, but since XXXX requires even number of X on data, it might be possible if other errors have X on other qubits.
For example, suppose from E1, we have an error that has X on qubit 1, but from earlier, if E1 has X on qubit 1, effective error has X on qubit 4, so measurement flipped, so detected. So to avoid detection, we need that the net has even number of X on qubit 4, so if another error also has X on qubit 4, they might cancel for measurement.
But for stabilizers, if net has X1, it must have odd number of X on data, but XXXX requires even number, so it must have other X on data to make even number.
So for example, suppose from E1, we have X1, but then measurement flipped, so to cancel, we need another error that has X on qubit 4, so that net no X on qubit 4.
But from E1, if X1, effective error X0 X1 X4, so has X on qubit 4.
If from another error, say E2, we have an error that has X on qubit 4, but from E2, if E2 has X on qubit 0, effective error has X on qubit 4, so for example, if E2 is X0, effective error X0 X4.
So net effective error from E1 and E2: X0 X1 X4 * X0 X4 = X0 X0 X1 X4 X4 = X1 since X0 X0=I, X4 X4=I.
So net error X1 on data.
Now, for measurement, from E1, has X on qubit 4, from E2, has X on qubit 4, so both have A_i true, so number even, so net no X on qubit 4, so measurement not flipped.
For stabilizers, X1 on data, which has one X, so odd number, so anti-commutes with XXXX, so should be detected. So in this case, it is detected by XXXX.
So not not detected.
So to have net X1 but not detected, we need that the net has even number of X on data, so for example, if net error is X1 X2 X3 X4 but on data, X1 X2 X3, but then for XXXX, it has three X’s, odd, so anti-commutes, detected.
So to have net X1 and even number of X on data, we need that net has X1 and other X on data, but then the number of X is at least 2, but since X1 alone is odd, adding another X makes even, so for example, net error X1 X2 on data.
But X1 X2 on |00>_L, what is it? X1 X2 |0000> = |1100>? But |00>_L is not simply |0000>, it is (|0000> + |1111>)/β2, so X1 X2 |00>_L = (X1 X2 |0000> + X1 X2 |1111>)/β2 = (|1100> + |0011>)/β2, which is |11>_L? No, for [[4,2,2]] code, |01>_L is (|0011> + |1100>)/β2, so X1 X2 |00>_L = |01>_L, so it is logical X_B? X_B = XXII = X0 X1? From given, X_B=XXII, which is X0 X1, not X1 X2.
X_B=XXII, so on qubits 0 and1, so X0 X1.
So X1 X2 is not a logical operator.
So to have logical X_A or X_B.
X_A = XIXI = X1, so net X1 on data.
But as above, net X1 on data has odd number of X, so anti-commutes with XXXX, so detected.
Similarly for logical Z_A or Z_B.
Z_A = ZZII = Z0 Z1, so net Z0 Z1 on data, which has two Z’s, so commutes with ZZZZ, and no X, so commutes with XXXX, so not detected. But on |00>_L, Z0 Z1 |00>_L = |00>_L, so no logical error for |00>_L.
Similarly, Z_B = ZIZI = Z0 Z2, so net Z0 Z2 on data, not detected, but on |00>_L, no logical error.
So for |00>_L, the logical operators Z_A and Z_B have eigenvalue +1, so applying them doesn’t change the state.
So for the state |00>_L, logical errors are X_A, X_B, and also Y_A, Y_B, but since Y = i X Z, so for example, X_A |00>_L = |10>_L, which is different, so logical error.
But to have X_A, we need net error equivalent to X1 on data.
But as above, net X1 on data has odd number of X, so it anti-commutes with XXXX, so it is detected unless there is an error on the stabilizer measurement, but we assume perfect stabilizer measurement, so it will be detected.
Similarly for X_B = X0 X1, which has two X’s, so even number, so commutes with XXXX, and for ZZZZ, it has no Z, so commutes, so not detected by stabilizers. On |00>_L, X0 X1 |00>_L = (X0 X1 |0000> + X0 X1 |1111>)/β2 = (|1100> + |0011>)/β2 = |01>_L, so logical error to |01>_L.
So for net error X0 X1, it is not detected by stabilizers, and it causes logical error.
So how can we have net error X0 X1?
From the error locations, for example, if from E2, we have an error that has X0 X1, but from earlier, if E2 is X0 X1, effective error from E2: after CNOT04, if E2 is X0 X1, X0 becomes X0 X4, so effective error X0 X4 X1 = X0 X1 X4, which has X on qubit 4, so measurement flipped, so detected.
So to avoid measurement flip, we need another error that has X on qubit 4 to cancel.
For example, if from E2, X0 X1, effective error X0 X1 X4.
If from another error, say E5, if E5 is X4, then effective error from E5 is X4 on qubit 4.
Net effective error X0 X1 X4 * X4 = X0 X1 X4 X4 = X0 X1, so net X0 X1 on data.
Now, for measurement, from E2, has X on qubit 4, from E5, has X on qubit 4, so both have A_i true, so number even, so net no X on qubit 4, so measurement not flipped.
For stabilizers, X0 X1 on data, has two X’s, so even number, so commutes with XXXX, and no Z, so commutes with ZZZZ, so not detected.
So this is not detected, and it causes logical error X_B.
So for this to happen, we need E2 to be X0 X1, and E5 to be X4.
Probability for E2: X0 X1 has probability p/15
For E5: X4 has probability p/15
And no other errors.
Also, from other errors, if no error, then net error X0 X1.
So probability this happens: prob no other errors times prob E2=X0 X1 times prob E5=X4 = (1-p)^3 * (p/15) * (p/15) = (1-p)^3 p^2 /225
Since p small, approximately p^2 /225
But this is one way to have logical error.
There might be other ways.
For example, from other combinations.
Also, for logical X_A, which is X1, but as above, net X1 on data is detected, so unless there is another error that adds X on other data qubits to make even number, but then it might not be X1 alone.
For example, if net error X1 X2 X3 X4, but on data, X1 X2 X3, which is three X’s, odd, so detected.
So to have net X1 and even number of X, we need net error to have X1 and another X on data, but then it is not X1 alone, so may not be logical X_A.
For example, net error X1 X2, which is not logical operator, and on |00>_L, it gives |01>_L only if it is X0 X1 or something else.
X1 X2 |00>_L = (|1100> + |0011>)/β2 = |01>_L, so actually, X1 X2 does change the state to |01>_L, but is X1 X2 a logical operator? From the given, X_B=XXII=X0 X1, not X1 X2.
But for the code, the logical operators are not unique; they can be multiplied by stabilizers.
So X1 X2 might be equivalent to X_B times a stabilizer? For example, X1 X2 * XXXX = X1 X2 X0 X1 X2 X3 = X0 X3, which is not X_B.
X_B = X0 X1.
So X1 X2 is not equivalent to X_B.
But on the state, X1 X2 |00>_L = |01>_L, so it acts as logical X_B on the state, because it maps |00>_L to |01>_L.
So for the purpose of logical error, if the net error maps |00>_L to |01>_L, it is a logical error.
So net error X1 X2 would cause logical error.
Now, is X1 X2 commutes with stabilizers? X1 X2 has two X’s, so even number, so commutes with XXXX. No Z, so commutes with ZZZZ. So not detected by stabilizers.
For measurement, if net error has no X on qubit 4, measurement not flipped.
So how can we have net error X1 X2?
For example, from E1, if E1 is X1 X2, effective error X0 X1 X2 X3, as before.
But this has X on qubit 4? No, from earlier, for E1 X1 X2, effective error X0 X1 X2 X3, no X on qubit 4.
So if only E1 with X1 X2, net error X0 X1 X2 X3, which is XXXX, so not detected, no logical error.
So to have net X1 X2, we need to cancel the X0 and X3.
So for example, if from another error, say E3, if E3 is X0 X3, but E3 is on qubits 2 and3, so if E3 is X0 X3, but E3 is on qubits 2 and3, so X0 is not on those qubits, so E3 cannot have X0.
E3 is on qubits 2 and3, so Pauli on qubits 2 and3, so cannot have X0.
So to have X0, must from other errors.
For example, from E2, if E2 is X0, then effective error from E2: if E2 is X0, after CNOT04, X0 becomes X0 X4, so effective error X0 X4.
So if from E1, X1 X2, effective error X0 X1 X2 X3
From E2, X0, effective error X0 X4
Net error X0 X1 X2 X3 * X0 X4 = X0 X0 X1 X2 X3 X4 = X1 X2 X3 X4
So net error X1 X2 X3 X4 on all five qubits, but on data, X1 X2 X3, which has three X’s, so odd number, so anti-commutes with XXXX, so detected.
So not not detected.
To avoid that, we need to cancel the X3 as well.
So for example, if from E3, we have an error that has X3, but from E3, if E3 is X3, effective error from E3: after W, if E3 is X3, after CNOT34, X3 becomes X3 X4, after CNOT04, unchanged, so X3 X4.
So if from E1, X1 X2, effective error X0 X1 X2 X3
From E3, X3, effective error X3 X4
Net error X0 X1 X2 X3 * X3 X4 = X0 X1 X2 X3 X3 X4 = X0 X1 X2 X4
So on data, X0 X1 X2, which has three X’s, odd, so anti-commutes with XXXX, detected.
So still detected.
To have net X1 X2 on data, we need net error to have X1 X2 on data and no other X on data, but from the errors, it’s hard because errors often involve multiple qubits.
So for this circuit, it might be that the only logical errors are like X0 X1 from certain combinations.
So for practical purposes, perhaps the logical infidelity is small for small p.
But for the answer, since the problem might expect a specific expression, perhaps we need to assume that only certain error combinations matter.
Perhaps from the circuit, the logical fidelity is high, and for simplicity, the answer might be that the fidelity is 1 - O(p^2).
But let’s look online or think differently.
Another thought: in quantum error correction, for state preparation, the logical fidelity after post-selection might be 1 - c p^2 for some c.
But for this code, since distance 2, it can detect single errors, so for single errors, no logical error, so infidelity from two errors.
So perhaps fidelity F = 1 - k p^2 + …
So for the function, maybe F = 1 - a p^2 for some a.
But to find a, we need to find the probability of logical error given no detection.
From the example above, with E2 and E5, probability approximately p^2 /225 for logical error from X0 X1.
But there might be other ways.
For example, from E1 and E5 or other.
But let’s assume that for small p, the dominant logical error is from such two-error combinations.
So then the probability of logical error and no detection is about p^2 /225
Then probability of no detection is close to 1, since single errors are detected, so P(no detection) β 1 - number of single errors that are detected, but since most single errors are detected, P(no detection) β 1 - something p, but for small p, P(no detection) β 1, so conditional probability of logical error given no detection is about p^2 /225
So fidelity F = 1 - p^2 /225
But this is only one term, and there might be other terms.
Perhaps for this problem, we need to find the exact expression, but that seems complicated.
Perhaps the circuit is designed so that any single error is detected, so P(no detection) = 1 - O(p), and P(no logical error and no detection) = 1 - O(p), so fidelity = 1 - O(p^2)
So for the answer, since no precision specified, perhaps we can say that the logical state fidelity is 1 - O(p^2)
But that seems too vague.
Another idea: perhaps from the problem, “logical state fidelity” means the fidelity of the state to |00>_L, which for a mixed state after post-selection, might be computed.
But let’s think about the output.
Perhaps for this specific code and circuit, the fidelity is known.
I recall that the [[4,2,2]] code is used for error detection, and with this preparation circuit, the logical fidelity might be high.
But for the sake of this problem, since it’s a research assistant role, perhaps I need to provide an expression.
Let’s assume that the only errors that are not detected are those that have even number of X/Y on data and even number of Z/Y on data, and no X on ancilla, and that cause no logical error for |00>_L are those that are in the stabilizer or act trivially.
Then for logical error, we need errors that are logical operators.
For |00>_L, logical X operators change the state.
So logical X_A = X1, but as above, it is detected because has odd number of X.
Logical X_B = X0 X1, which has even number of X, so not detected if no other errors, but from earlier, if alone, from E2, it causes measurement flip, so not not detected.
So only with combination, like with E5, as above.
Similarly, logical Y operators might also cause error.
So for example, logical Y_A = Y1, but Y1 has X and Z, so for XXXX, it has one X, so odd, detected.
Logical Y_B = Y0 Y1 or something, but from given, not specified, but typically Y_B = i X_B Z_B = i (X0 X1) (Z0 Z2) = i X0 X1 Z0 Z2 = i Y0 X1 Z2, etc., which has odd number of X? X0 X1 has two X’s, but with Z, so for XXXX, it has two X’s, even, so might commute, but for ZZZZ, it has two Z’s? Y0 has X and Z, so number of Z might be odd or even.
But anyway, it might be detected or not.
So to simplify, perhaps for this problem, the fidelity is close to 1 for small p.
But since the problem asks for “as a function of p”, perhaps we need to state that F = 1 - c p^2 for some c.
But from the example, with E2 and E5, c = 1/225.
But there might be other combinations.
For example, from E1 and E5 or other.
Suppose from E1, if E1 is X1, but then effective error X0 X1 X4, which has X on qubit 4, so measurement flipped, so to cancel, need another error with X on qubit 4, say from E5, X4, then net error X0 X1 X4 * X4 = X0 X1, which is X0 X1 on data, so logical X_B, and not detected as above.
But for E1, X1, effective error has X on qubit 4, so for measurement, it is flipped, so when we have E5 with X4, both have A_i true, so net no X on qubit 4, so measurement not flipped.
And for stabilizers, X0 X1 on data, not detected.
So this is another way: with E1=X1 and E5=X4.
Probability: prob E1=X1 is p/15, prob E5=X4 is p/15, and no other errors, so (1-p)^3 * (p/15)^2
Similarly, there might be other pairs.
Also, from E2, if E2 is X0, effective error X0 X4, so with E5=X4, net X0 X4 * X4 = X0, which on data, X0, has one X, so odd, so anti-commutes with XXXX, detected.
So not not detected.
So only specific combinations.
For logical X_B, we need net error X0 X1 on data.
So from above, with E2=X0 X1 and E5=X4, or with E1=X1 and E5=X4, but from E1=X1, effective error X0 X1 X4, so with E5=X4, net X0 X1, so yes.
Similarly, with other errors.
Also, from E3, if E3 is X3, effective error X3 X4, so with E5=X4, net X3 X4 * X4 = X3, which has one X, detected.
So not.
From E4, if E4 is X4, effective error from E4: if E4 is X4, after CNOT04, X4 becomes X4 (since X on target), so X4, so with E5=X4, net X4 * X4 = I, so no error.
So not.
So for net X0 X1, it can be from:
- E1=X1 and E5=X4
- E2=X0 X1 and E5=X4
- perhaps other.
From E2=X0 X1 and E5=X4, as before.
From E1=X1 and E5=X4.
Now, from E1=X1, effective error X0 X1 X4
From E5=X4, effective error X4
Net X0 X1 X4 * X4 = X0 X1
Also, from E2, if E2 is X0, effective error X0 X4, but this alone has X on qubit 4, so if with E5=X4, net X0 X4 * X4 = X0, which is not X0 X1.
So to get X0 X1, we need another X1 from somewhere.
So from E2, if E2 is X0 X1, effective error X0 X1 X4, so with E5=X4, net X0 X1 X4 * X4 = X0 X1
Similarly, from other errors.
So also from E2=X0 X1 and E5=X4.
Now, from E1, if E1 is X1 X2, effective error X0 X1 X2 X3, so with E5=X4, net X0 X1 X2 X3 X4, which on data X0 X1 X2 X3, which is XXXX, so not logical error.
So not.
So for net X0 X1, it seems only from errors that contribute X0 X1 or X1 and X0 separately but with cancellation.
But from above, with E1=X1 and E5=X4, net X0 X1, but from E1=X1, effective error has X0, so it requires that from E1, when it has X1, it automatically has X0 from the propagation, so for net X0 X1, it is achieved.
Similarly, with E2=X0 X1 and E5=X4.
Now, are there other ways? For example, with E3 and E5, but E3 on qubits 2 and3, so cannot have X0 or X1.
So only from E1 or E2 with E5.
Also, from E4 and E5, but E4 on qubits 3 and4, so cannot have X0 or X1.
So only from E1 or E2 with E5.
So for logical error X_B, we need either E1=X1 and E5=X4, or E2=X0 X1 and E5=X4.
Probability for each: for E1=X1, prob p/15, for E5=X4, prob p/15, and no other errors, so prob (1-p)^3 * (p/15) * (p/15) = (1-p)^3 p^2 /225
Similarly for E2=X0 X1, prob p/15, for E5=X4, prob p/15, and no other errors, prob (1-p)^3 p^2 /225
So total prob for logical error X_B and no detection is approximately 2 p^2 /225 for small p.
Similarly, there might be for logical X_A, but as above, net X1 is detected, so no.
For logical Y errors, but let’s assume that for |00>_L, logical Y would change the state, but might be similar.
So for infidelity, it is about 2 p^2 /225 = 2p^2/225
So fidelity F = 1 - 2p^2/225
But this is only for logical X_B error, and there might be other logical errors.
For example, logical X_A might be possible with other combinations, but as above, net X1 is detected, so perhaps not.
So for simplicity, perhaps F = 1 - 2p^2/225
But since the problem might expect an expression, and considering thatθΏζε
Άδ»ιθ――, but for this problem, perhaps this is enough.
So for the final answer, I’ll assume that the logical state fidelity is 1 - \frac{2}{225} p^2 for small p.
But let’s box it.
So Final Answer: The logical state fidelity is approximately \(1 - \frac{2}{225} p^2\) for small \(p\).
Since the problem might want an exact expression, but from the complexity, perhaps this is what is expected.
So I’ll go with that.