We are asked: “What is the logical state fidelity of the final 2-qubit logical state at the end of the circuit as a function of the two-qubit gate error rate p, assuming the state is post-selected on all detectable errors in the code?”
Interpretation: We have the same circuit as before. But now we want the logical state fidelity. And we assume that we post-select on all detectable errors. That means that if an error occurs that is detectable by the code, we discard the state. So only those error patterns that are either no error or undetectable errors (which are exactly the stabilizers? Actually, in quantum error detection, we measure the stabilizers. If we get a non-trivial syndrome, we detect an error and then we discard the state. So post-selection means we only keep states that yield the trivial syndrome (i.e., +1 for both stabilizers XXXX and ZZZZ). So then the logical state fidelity is the fidelity of the logical state conditioned on passing the post-selection.
So we need to compute: Given that the state passes post-selection (i.e., the error is undetectable, meaning it is in the stabilizer group of the code? But careful: The code [[4,2,2]] has distance 2. It can detect any single-qubit error? Actually, it’s a detection code. The stabilizers are XXXX and ZZZZ. An error is detectable if it anticommutes with at least one stabilizer. So undetectable errors are those that commute with both stabilizers. That set is exactly the normalizer of the stabilizer group within the Pauli group. But note: The normalizer includes the stabilizers themselves and also the logical operators? Actually, for a stabilizer code, the undetectable errors are those that are in the normalizer of the stabilizer group. That set includes the stabilizers and the logical operators. But wait: The code [[4,2,2]] encodes 2 qubits. So its normalizer has size? The stabilizer group has 4 elements. The full Pauli group on 4 qubits has 4^4 = 256 elements up to phases. The normalizer of the stabilizer group is larger. But careful: “Post-selected on all detectable errors” means that if an error is detectable (i.e., it gives a non-trivial syndrome), we discard. So we only keep states that have no error or errors that are undetectable. But undetectable errors include logical errors. So if an undetectable error occurs that is a logical operator, then the logical state is flipped. So then the logical fidelity would be reduced.
So we need to compute: The probability that the final state is the ideal logical state (i.e., no logical error) given that it passes post-selection. And then the logical fidelity is that probability? Actually, fidelity: If the state is mixed, the logical fidelity might be the overlap with the ideal logical state. But since we post-select, we only keep states that are in the code space. And within the code space, any state can be described as a logical state. And if an undetectable error occurs that is a logical operator, then the logical state is changed. So we want the probability that the logical state is exactly the ideal one.
So we need to determine: For each error pattern (from the two CNOT errors), what is the effective error on the logical state? And then we post-select: we only keep if the error is undetectable (i.e., it commutes with both stabilizers). And then among those, we want the probability that the logical state is correct.
Let’s denote the ideal final state as |ψ⟩ (physical state) which is in the code space. An error E (a Pauli on 4 qubits) will map |ψ⟩ to E|ψ⟩. This state is in the code space if and only if E is in the normalizer of the stabilizer group. That is, E must commute with XXXX and ZZZZ. If E does not commute with them, then the state is detected and discarded. So we only consider errors E that are in N(S), the normalizer of the stabilizer group. Now, if E is in N(S), then it acts on the logical qubits as a logical Pauli operator. We want that logical operator to be the identity (up to phase) on the logical state. But careful: The ideal state is |ψ⟩ = (|00⟩_L + |11⟩_L)/√2. This state is not necessarily a stabilizer state of the logical operators? But it is a Bell state between the two logical qubits. Its stabilizers include Z_A Z_B and X_A X_B. So if a logical error occurs that is, say, X_A, then it will map |00⟩_L+|11⟩_L to |10⟩_L+|01⟩_L, which is orthogonal to the original? Actually, check: X_A on the first logical qubit: (|00⟩+|11⟩) becomes (|10⟩+|01⟩). Those are orthogonal. So indeed, if any non-identity logical Pauli acts, the logical state becomes orthogonal to the ideal. So for the logical state to be correct, we need that the effective logical error is identity (or a phase factor, but since Paulis are Hermitian, they are either identity or flip the state to an orthogonal one). So we want the error to be in the stabilizer group itself (because stabilizers act trivially on the code space). But wait: Could there be an error that is in the normalizer but not in the stabilizer? That would be a logical operator. And that would change the logical state. So for the logical fidelity to be 1, we need that the error is exactly an element of the stabilizer group (which includes I, XXXX, ZZZZ, YYYY). But careful: What about errors that are, say, a product of a stabilizer and a logical operator? That would still be a logical operator. So indeed, the condition for the logical state to be ideal is that the error is in the stabilizer group.
So then, with post-selection, we only keep states where the error E (overall from the circuit) is in N(S). And among those, the logical state is ideal if E is in S (the stabilizer group). So we need to compute the probability that the overall error is in S, given that it is in N(S). But wait, we also have the probability of no error? Actually, we are post-selecting: we discard any state that gives a detectable error. So the probability of success (passing post-selection) is the probability that the error is in N(S). And then, among those, the probability that the logical state is correct is the probability that the error is in S divided by the probability that it is in N(S).
But careful: The overall error comes from two independent error channels on the two CNOT gates. As before, the overall error is E_total = E’ ⊗ E, where E acts on qubits {1,2} and E’ acts on qubits {0,3}. And we want to know when E_total is in N(S) and when it is in S.
First, determine N(S) for the [[4,2,2]] code. The stabilizer S is generated by XXXX and ZZZZ. So S = {I, XXXX, ZZZZ, XXXX ZZZZ = YYYY} (up to phases). The normalizer N(S) consists of all Pauli operators that commute with both XXXX and ZZZZ. What are the conditions for a Pauli P = P0 P1 P2 P3 to commute with XXXX? XXXX commutes with P if and only if the number of qubits where P is X or Y? Actually, more systematically: XXXX anticommutes with a Pauli if the number of qubits where the Pauli is Z or Y (since Z and Y anticommute with X) is odd. So for P to commute with XXXX, the number of qubits where P is Z or Y must be even. Similarly, ZZZZ anticommutes with P if the number of qubits where P is X or Y is odd. So for P to be in N(S), we need:
- The number of qubits with Pauli in {Z, Y} is even.
- The number of qubits with Pauli in {X, Y} is even.
Now, our overall error is E_total = E’ ⊗ E, where E’ acts on qubits 0 and 3, and E acts on qubits 1 and 2. So we can analyze based on the Paulis on these pairs.
Let’s denote:
E’ on qubits 0 and 3: It is a two-qubit Pauli. Write it as: (a, b) where a,b ∈ {I, X, Y, Z} but not both I? Actually, including identity? But error means non-identity? But we also include the case of no error as identity. So overall, E_total can be identity if both are identity. But then that is in S.
We want to classify all Paulis on two qubits according to whether when combined with another two-qubit Pauli on the other pair, the total satisfies the conditions for being in N(S). But maybe we can compute the probability that E_total is in N(S) and the probability that E_total is in S.
Alternatively, we can compute: The probability of success (passing post-selection) is the probability that E_total is in N(S). And the probability that the logical state is correct is the probability that E_total is in S.
Then the logical fidelity (after post-selection) is: F_logical = P(E_total in S) / P(E_total in N(S)).
And these probabilities depend on p.
But careful: The errors occur independently on the two CNOT gates. So we have:
P(no error on step2) = 1-p, but that corresponds to E = I on {1,2}.
P(error on step2) = p, and given error, each of the 15 Paulis on {1,2} has probability 1/15.
Similarly for step4: P(no error) = 1-p, and if error, each of 15 Paulis on {0,3} with probability 1/15.
So overall, the probability distribution for (E, E’) is:
- With probability (1-p)^2: E = I, E’ = I.
- With probability p(1-p)/15: E is a specific non-identity Pauli on {1,2} and E’ = I.
- With probability (1-p)p/15: E = I and E’ is a specific non-identity Pauli on {0,3}.
- With probability p^2/225: E and E’ are specific non-identity Paulis.
Now, we need to determine for each pair (E, E’), whether E_total = E’ ⊗ E is in N(S) and whether it is in S.
Let’s denote the Paulis on two qubits. For a two-qubit Pauli on qubits i and j, we can characterize it by its type: It can be:
Type A: Paulis that are of the form: both Paulis are the same: XX, YY, ZZ. Also what about II? That is identity, but that’s trivial.
Type B: Paulis that are not both the same? Actually, there are 15 non-identity Paulis on two qubits. They can be categorized by:
- Those with both Paulis same: XX, YY, ZZ: 3.
- Those with one I and one non-I: There are: X I, I X, Y I, I Y, Z I, I Z: 6.
- Those with two different non-I that are not the same: X Y, X Z, Y X, Y Z, Z X, Z Y: 6. But careful: X Y and Y X are different? Actually, on two qubits, the Pauli operators are tensor products: So X⊗Y and Y⊗X are different. So yes, 6.
Now, what are the conditions for E_total = (on qubits 0,3: Pauli P0 and P3) and (on qubits 1,2: Pauli Q1 and Q2) to be in N(S)? The conditions:
- The number of qubits with Pauli in {Z, Y} is even.
- The number of qubits with Pauli in {X, Y} is even.
Let’s analyze based on the types of E’ and E.
Let E’ be on qubits 0 and 3. Write E’ as: (P0, P3). And E on qubits 1 and 2: (Q1, Q2).
Condition 1: Even number of qubits with Pauli in {Z, Y}.
That means: count( from P0, P3, Q1, Q2 that are Z or Y ) is even.
Condition 2: Even number of qubits with Pauli in {X, Y}.
That means: count( from P0, P3, Q1, Q2 that are X or Y ) is even.
Now, let’s classify two-qubit Paulis by their “parity” with respect to these conditions if considered alone? But careful: The conditions are on the total. However, if we have two independent sets, we can compute the parity contributions from each set mod 2.
For a two-qubit Pauli on a pair, say on qubits i and j, define:
a = number of qubits in that pair that are in {Z, Y} mod 2.
b = number of qubits in that pair that are in {X, Y} mod 2.
Then for the total to be in N(S), we need that the sum of a from both pairs is 0 mod 2, and the sum of b from both pairs is 0 mod 2.
So if we can compute for each two-qubit Pauli (non-identity) what are (a mod 2, b mod 2)? And also for identity, (0,0).
Let’s do that for two-qubit Paulis on any pair. The Pauli on one qubit can be I, X, Y, Z.
For a single qubit:
- I: (0,0)
- X: (0,1) because X is in {X,Y} so b=1, and not in {Z,Y} so a=0.
- Y: (1,1) because Y is in both.
- Z: (1,0) because Z is in {Z,Y} so a=1, and not in {X,Y} so b=0.
Now for a two-qubit Pauli, we add the contributions from each qubit mod 2.
So for a two-qubit Pauli, let (a_total, b_total) mod 2 = (a1+a2 mod2, b1+b2 mod2).
Now, list all 16 Paulis on two qubits (including identity). But we only care about non-identity ones? Actually, we will need probabilities, so we’ll list all 16, but then note that identity has probability (1-p) from that gate? Actually, careful: The error model: With probability 1-p, we get identity. With probability p, we get one of the 15 non-identity Paulis uniformly. So if we want to compute the probability that a given gate yields a Pauli with a certain (a,b) characteristic, we can compute:
P(identity) = 1-p, and then for each of the 15, probability = p/15.
But then we want to combine two independent gates.
So let’s list the two-qubit Paulis on a pair. I’ll list them by type:
Identity: I⊗I: (0,0).
Type: One I and one non-I:
- X⊗I: qubit1: X -> (0,1); qubit2: I -> (0,0); so total (0,1).
- I⊗X: (0,1) as well.
- Y⊗I: (1,1)
- I⊗Y: (1,1)
- Z⊗I: (1,0)
- I⊗Z: (1,0)
Type: Both same non-I:
7. X⊗X: (0+0, 1+1) = (0,0) mod2.
8. Y⊗Y: (1+1, 1+1) = (0,0) mod2.
9. Z⊗Z: (1+1, 0+0) = (0,0) mod2.
Type: Different non-I that are not both same:
10. X⊗Y: (0+1, 1+1) = (1,0) mod2.
11. Y⊗X: (1+0, 1+1) = (1,0) mod2.
12. X⊗Z: (0+1, 1+0) = (1,1) mod2.
13. Z⊗X: (1+0, 0+1) = (1,1) mod2.
14. Y⊗Z: (1+1, 1+0) = (0,1) mod2? Check: Y: (1,1); Z: (1,0); sum mod2: (1+1=0 mod2, 1+0=1 mod2) so (0,1).
15. Z⊗Y: (1+1, 0+1) = (0,1) mod2.
So summary for two-qubit Paulis (non-identity):
(0,0): Paulis: X⊗X, Y⊗Y, Z⊗Z. (3 of them)
(0,1): X⊗I, I⊗X, Y⊗Z, Z⊗Y. (4 of them? Actually, check: X⊗I: (0,1); I⊗X: (0,1); Y⊗Z: (0,1); Z⊗Y: (0,1) -> so 4)
(1,0): Z⊗I, I⊗Z, X⊗Y, Y⊗X. (4 of them)
(1,1): Y⊗I, I⊗Y, X⊗Z, Z⊗X. (4 of them)
And identity: (0,0).
So for a single CNOT gate error channel, the output Pauli (on the two qubits) has a distribution:
With probability (1-p): we get identity, which gives (0,0).
With probability p: we get a non-identity Pauli uniformly from 15. So the probability that the Pauli from that gate has a given (a,b) is:
For (0,0): from non-identity: 3/15 = 1/5, so total probability = (1-p) + p*(3/15) = 1-p + p/5 = 1 - (4/5)p.
But careful: That is the probability that the Pauli from that gate is in the set that gives (0,0) mod2. But note: This set includes identity and the three Paulis: XX, YY, ZZ. But wait, are these exactly the ones that are harmless? Yes, we earlier identified that for step2, the harmless errors were XX, YY, ZZ. And indeed, they give (0,0). And for step4, similarly.
But now we are interested in the condition for E_total to be in N(S). E_total = E’ ⊗ E. We have two independent gates. Let the first gate (on qubits {1,2}) yield a Pauli with mod2 characteristics (a1, b1). And the second gate (on qubits {0,3}) yield (a2, b2). Then the total mod2 characteristics are (a1+a2 mod2, b1+b2 mod2). For E_total to be in N(S), we need that total is (0,0) mod2. Because then the number of qubits with Z/Y is even and with X/Y is even.
So the condition for E_total to be in N(S) is that (a1+a2, b1+b2) = (0,0) mod2.
And for E_total to be in S (the stabilizer group), we need that E_total is actually one of: I, XXXX, ZZZZ, YYYY. But note: If both gates yield Paulis that are in the set that give (0,0) mod2, then E_total will have mod2 (0,0). But is that sufficient for E_total to be in S? Not necessarily. Because S consists of Paulis that are the same on all four qubits? Actually, check: What are the elements of S? They are: I, XXXX, YYYY, ZZZZ. But wait, could there be another Pauli that commutes with both stabilizers? For example, consider E_total = X0 I1 I2 X3? That would be: on qubits 0 and 3: X and X, so that part gives (0,0) because X⊗X gives (0,0). And on qubits 1 and 2: I and I, so (0,0). So total mod2 is (0,0). But is X0 I1 I2 X3 in N(S)? Let’s check: X0 I1 I2 X3. Commute with XXXX? XXXX anticommutes if number of Z/Y on qubits? Qubit0: X -> not Z/Y so 0; qubit1: I -> 0; qubit2: I -> 0; qubit3: X -> 0; so it commutes. With ZZZZ: Qubit0: X -> X/Y so count=1; qubit1: I -> 0; qubit2: I -> 0; qubit3: X -> 1; total 2 mod2=0, so it commutes. So indeed, X0 I1 I2 X3 is in N(S). But is it in S? S are Paulis that are products of the stabilizers. The stabilizers are XXXX and ZZZZ. X0 I1 I2 X3 is not a product of these because if you take XXXX, you get X on all qubits. To get only on qubits 0 and 3, you would need to multiply by something that cancels on qubits 1 and 2. But the only Pauli that acts on qubits 1 and 2 and is in S would be I1I2 or X1X2? But X1X2 is not in S because S requires the same Pauli on all qubits? Actually, wait: S is the group generated by XXXX and ZZZZ. That group consists of: I, XXXX, ZZZZ, XXXX ZZZZ = YYYY. So indeed, every element of S has the property that on each qubit, the Pauli is the same? Check: XXXX: all X. ZZZZ: all Z. YYYY: all Y. So indeed, any element of S is of the form: P⊗P⊗P⊗P where P is either I, X, Y, Z? But I⊗I⊗I⊗I is identity. But wait, could there be something like X⊗X⊗I⊗I? That is not in S because if you take XXXX, you get X on all. To get I on qubits 1 and 2, you would need to multiply by something that gives I on those qubits. But the only Pauli that gives I on qubits 1 and2 from S would be? Actually, S is a subgroup of the Pauli group. Its elements are: I, XXXX, ZZZZ, YYYY. So indeed, they are all uniform across qubits. So for E_total to be in S, it must be that E’ and E are such that E’ is of the form: P0 and P3 with the same Pauli? Actually, if E_total is in S, then it is either I, or XXXX, or ZZZZ, or YYYY. That means that on qubits 0 and 3, the Pauli must be: if overall is XXXX, then on qubits 0 and 3, we need X and X; on qubits 1 and 2, we need X and X. So that means that E’ must be X⊗X and E must be X⊗X. Similarly, for ZZZZ: E’ = Z⊗Z, E = Z⊗Z. For YYYY: E’ = Y⊗Y, E = Y⊗Y. And for I: E’ = I, E = I.
But wait: Could there be a case where E_total is in S but not exactly these? For example, what about E’ = I and E = something that is in S? But if E’ = I, then E_total = I ⊗ E. For that to be in S, E must be such that on qubits 1 and 2, it is the same Pauli on both? But then overall, if E = X⊗X, then E_total = I0 X1 X2 I3. That is not of the form all X because qubits 0 and 3 are I. So that is not in S. So indeed, for E_total to be in S, we need that both E’ and E are either identity or are one of the three: XX, YY, ZZ, and moreover, they must be the same type? Actually, check: If E’ = XX and E = I? That gives overall: X0 I1 I2 X3, which is not in S because it’s not uniform. So yes, for E_total to be in S, we need that either both are identity, or both are XX, or both are YY, or both are ZZ. But wait: What about E’ = XX and E = XX? That gives XXXX, so yes.
So, the condition for E_total to be in S is that:
E’ is in {I, XX, YY, ZZ} and E is in the same set as E’? Actually, careful: If E’ = I, then E must be I to be in S? Because if E’ = I and E = XX, then overall is I0 X1 X2 I3, which is not in S. So indeed, for E_total to be in S, we need that E’ and E are both identity, or both are XX, or both are YY, or both are ZZ.
But wait: What about E’ = XX and E =? Actually, if E’ = XX and E = something else like YY? Then overall becomes X0 Y1 Y2 X3. That is not uniform because qubits 0 and 3 are X, but qubits 1 and 2 are Y. So not in S.
So, indeed, E_total is in S if and only if:
(E’ is I and E is I) OR (E’ is XX and E is XX) OR (E’ is YY and E is YY) OR (E’ is ZZ and E is ZZ).
Now, what is the condition for E_total to be in N(S)? That is that the mod2 characteristics sum to (0,0). As computed, mod2 characteristics for a two-qubit Pauli are:
For identity: (0,0)
For XX, YY, ZZ: (0,0)
For the ones with one I and one non-I: They are either (0,1), (1,0), or (1,1) as listed. Actually, from our list:
(0,1): X⊗I, I⊗X, Y⊗Z, Z⊗Y -> 4
(1,0): Z⊗I, I⊗Z, X⊗Y, Y⊗X -> 4
(1,1): Y⊗I, I⊗Y, X⊗Z, Z⊗X -> 4
And then the ones with two different non-I that are not both same: Actually, we already included them? Wait, our list of 15 non-identity:
Type: one I: 6 items.
Type: both same: 3 items.
Type: different non-I: 6 items.
And we computed:
For one I:
X⊗I: (0,1)
I⊗X: (0,1)
Y⊗I: (1,1)
I⊗Y: (1,1)
Z⊗I: (1,0)
I⊗Z: (1,0)
For both same:
XX: (0,0)
YY: (0,0)
ZZ: (0,0)
For different non-I:
X⊗Y: (1,0)
Y⊗X: (1,0)
X⊗Z: (1,1)
Z⊗X: (1,1)
Y⊗Z: (0,1)
Z⊗Y: (0,1)
So indeed, the mod2 values are as stated.
So, for a gate, the probability that it yields a Pauli with a given mod2 value is:
P(0,0) = (1-p) + p(3/15) = 1 - p + p/5 = 1 - (4/5)p.
P(0,1) = p(4/15) = (4p/15)
P(1,0) = p(4/15) = (4p/15)
P(1,1) = p(4/15) = (4p/15)
And these are independent for the two gates? Actually, careful: The gates are independent. So if we let gate1 (on {1,2}) have mod2 value (a1,b1) and gate2 (on {0,3}) have (a2,b2), then the condition for E_total to be in N(S) is that (a1+a2, b1+b2) = (0,0) mod2.
So, the probability that E_total is in N(S) is:
P(N) = Sum over all combinations where (a1+a2, b1+b2) = (0,0).
Since the gates are independent, we can compute:
P(N) = P1(0,0)P2(0,0) + P1(0,1)P2(0,1) + P1(1,0)P2(1,0) + P1(1,1)P2(1,1).
Because (0,0)+(0,0)=(0,0); (0,1)+(0,1)=(0,0) mod2? Actually, 0+0=0, 1+1=2 mod2=0; so yes.
(1,0)+(1,0)=(0,0); (1,1)+(1,1)=(0,0).
So,
P(N) = [1 - (4/5)p]^2 + (4p/15)^2 + (4p/15)^2 + (4p/15)^2 = [1 - (4/5)p]^2 + 3*(16p^2/225) = [1 - (8/5)p + (16/25)p^2] + (48p^2/225).
Now, (16/25) = (144/225). So that sum = 1 - (8/5)p + (144/225 + 48/225)p^2 = 1 - (8/5)p + (192/225)p^2 = 1 - (8/5)p + (64/75)p^2.
So, P(E_total in N(S)) = 1 - (8/5)p + (64/75)p^2.
Next, we want P(E_total in S). As argued, E_total is in S if and only if both gates yield Paulis that are in the set that are either identity or the ones that are both same (XX, YY, ZZ) AND moreover, they must be the same type? Actually, careful: If gate1 yields identity, then gate2 must yield identity to be in S? Because if gate1 = I and gate2 = XX, then overall is I0 XX I3? Actually, that gives X on qubits 1 and 2 only, so not uniform. So indeed, for E_total to be in S, we need that either:
Both gates yield identity: probability = (1-p)^2.
Or both gates yield the same specific Pauli among {XX, YY, ZZ}. For a given type, say XX: probability from gate1: p/15, gate2: p/15, so that gives p^2/225. And there are 3 types, so total = 3p^2/225 = p^2/75.
But wait: Could there be a case where gate1 yields XX and gate2 yields something that is not exactly XX but still gives overall uniform? For example, if gate1 = XX and gate2 = something that is also in the (0,0) mod2 set but not exactly XX? For instance, gate2 = YY. Then overall becomes: on qubits 0,3: YY and on qubits 1,2: XX. That is not uniform because on qubits 0 and 3 we have Y, on qubits 1 and 2 we have X. So that is not in S. So indeed, the only possibilities for S are: both identity, or both exactly the same Pauli from {XX, YY, ZZ}. So then:
P(S) = (1-p)^2 + 3(p/15)(p/15) = (1-p)^2 + 3p^2/225 = 1 - 2p + p^2 + p^2/75 = 1 - 2p + (76/75?) Let’s do: p^2 + 3p^2/225 = p^2 + p^2/75 = (75p^2/75 + p^2/75) = 76p^2/75? That would be 1 - 2p + 76p^2/75, but that is not consistent with our previous computation from fidelity? Actually, wait, earlier we computed the probability that the final state is ideal (without post-selection) was: 1 - (8/5)p + (46/75)p^2. But that was for physical fidelity. And here we are computing P(S) which is the probability that the error is in the stabilizer group. But note: That previous computation included also cases where only one gate had an error that was harmless? But those cases: e.g., gate1 gives XX and gate2 gives identity. That overall error is XX on qubits 1,2 and identity on qubits 0,3. That is not in S because it is not uniform. So indeed, those are not in S. So P(S) should be smaller than the physical fidelity squared? Actually, physical fidelity squared was the probability that the state is ideal. And that included cases where the error is a stabilizer? But wait, if gate1 gives XX and gate2 gives identity, then overall error is I0 XX I3. Is that a stabilizer? Check: I0 XX I3. That is not of the form all X, all Y, or all Z. So it is not in S. But earlier, we computed that if only step2 error is XX, then the state is ideal. That seems to contradict because if the error is I0 XX I3, then acting on the ideal state, does it leave it invariant? Let’s check: Consider an error on step2 only: E = X1X2. Then we computed that X1X2|ψ2⟩ = |ψ2⟩. And then after the perfect gates, we get the ideal final state. So that means that the overall error from the circuit, if only step2 error is X1X2, is actually not simply X1X2? Because we have to push the error through the subsequent gates. But wait, we already did that: We found that V E V^\dagger = E because V commutes with operations on qubits 1,2. So actually, if only step2 error is X1X2, then the overall error is indeed X1X2 on qubits 1,2 and identity on qubits 0,3. So that error is I0 X1X2 I3. And we argued that such an error, when applied to the ideal state, gives the ideal state? But then that would mean that I0 X1X2 I3 is actually a stabilizer of the ideal state? But is it? Check: I0 X1X2 I3 applied to |ψ_final⟩. We computed earlier: X1X2|ψ_final⟩ = |ψ_final⟩. So indeed, I0 X1X2 I3 acts as identity on the ideal state. But wait, then it must be that I0 X1X2 I3 is in the stabilizer group of the ideal state. But the stabilizer group of the ideal state is the code stabilizer group? But the code stabilizer group is generated by XXXX and ZZZZ. Is I0 X1X2 I3 a product of these? For it to be in the stabilizer group, it must be either I, XXXX, ZZZZ, or YYYY. But I0 X1X2 I3 is not one of these because it is not uniform. So there is a contradiction. Let’s re-check: We computed that if only step2 error is X1X2, then the final state is ideal. That means that for the ideal state |ψ_final⟩, we have (X1X2)|ψ_final⟩ = |ψ_final⟩. So that would imply that X1X2 is a stabilizer of |ψ_final⟩. But is that true? Let’s check explicitly:
|ψ_final⟩ = 1/2(|0000⟩ + |1001⟩ + |0110⟩ + |1111⟩).
Apply X1X2:
X1X2|0000⟩ = |0⟩0, X1|0⟩1=|1⟩1, X2|0⟩2=|1⟩2, so becomes |0110⟩.
X1X2|1001⟩ = |1⟩0, X1|0⟩1=|1⟩1, X2|0⟩2=|1⟩2, so becomes |1111⟩.
X1X2|0110⟩ = |0⟩0, X1|1⟩1=|0⟩1, X2|1⟩2=|0⟩2, so becomes |0000⟩.
X1X2|1111⟩ = |1⟩0, X1|1⟩1=|0⟩1, X2|1⟩2=|0⟩2, so becomes |1001⟩.
So indeed, X1X2|ψ_final⟩ = |ψ_final⟩. So X1X2 stabilizes |ψ_final⟩. But then X1X2 is not in the code stabilizer group? The code stabilizer group is the set of operators that fix every state in the code space. But |ψ_final⟩ is a particular state in the code space. Its stabilizer group as a state is larger than the code stabilizer group. Because the code stabilizer group fixes all states in the code space. But here, X1X2 does not necessarily fix every state in the code space. For example, take another state in the code space, say |00⟩_L. That state might not be stabilized by X1X2. So indeed, the stabilizer group of the ideal state |ψ_final⟩ is not the same as the code stabilizer group. We need to determine the stabilizer group of |ψ_final⟩. |ψ_final⟩ is a Bell state between logical qubits A and B. Its stabilizer group (as a state) is generated by Z_A Z_B and X_A X_B. What are these logical operators in terms of physical Paulis? We are given: X_A = XIXI, X_B = XXII, Z_A = ZZII, Z_B = ZIZI.
Then Z_A Z_B = (ZZII)(ZIZI) =? Let’s compute carefully: Z_A acts on qubits 0 and 1: Z on 0 and Z on 1. Z_B acts on qubits 0 and 2: Z on 0 and Z on 2. So Z_A Z_B will act on qubit 0: Z^2 = I actually careful: They commute so product is: on qubit0: Z from both gives Z^2 = I? Actually, Pauli multiplication: Z_A = Z0 Z1, Z_B = Z0 Z2, so product = Z0^2 Z1 Z2 = I0 Z1 Z2. So Z_A Z_B = I0 Z1 Z2 I3? But wait, that acts on qubits 1 and 2 only. And we already found that X1X2 stabilizes |ψ_final⟩. But Z1Z2? Check: Z1Z2|ψ_final⟩:
|0000⟩ -> |0000⟩ (since Z|0⟩=1)
|1001⟩ -> qubit1:0->+1, qubit2:0->+1, so remains?
Actually, compute: Z1Z2|1001⟩: qubit1 is 0 so factor +1, qubit2 is 0 so factor +1, so remains.
|0110⟩: qubit1 is 1 -> -1, qubit2 is 1 -> -1, product = +1, so remains.
|1111⟩: qubit1 is 1 -> -1, qubit2 is 1 -> -1, product = +1, so remains.
So Z1Z2 also stabilizes |ψ_final⟩. So indeed, Z_A Z_B = Z1Z2? But wait, then what is X_A X_B? X_A = XIXI means X on qubit0 and X on qubit2? Actually, X_A = XIXI: that means Pauli on qubit0: X, qubit1: I, qubit2: X, qubit3: I. X_B = XXII: means Pauli on qubit0: X, qubit1: X, qubit2: I, qubit3: I. So product X_A X_B = (X0 I1 X2 I3)(X0 X1 I2 I3) = (X0^2, I1X1, X2I2, I3I3) = (I0, X1, X2, I3) = X1X2. So indeed, the stabilizer group of |ψ_final⟩ is generated by X1X2 and Z1Z2. So the stabilizer group of |ψ_final⟩ has 4 elements: I, X1X2, Z1Z2, X1X2 * Z1Z2 = -Y1Y2? Actually, careful: X1X2 * Z1Z2 = (X1Z1)(X2Z2) = (-iY1)(-iY2) = -Y1Y2. So the stabilizer group of |ψ_final⟩ is {I, X1X2, Z1Z2, -Y1Y2}. But note that global phase doesn’t matter. So effectively, the stabilizer group of |ψ_final⟩ is that any operator that acts only on qubits 1 and 2 and is either I, XX, ZZ, or YY will stabilize |ψ_final⟩? But wait, check Y1Y2: Y1Y2|ψ_final⟩ we computed gave -|ψ_final⟩. So actually, Y1Y2 gives a phase of -1. But that is still a stabilizer because it leaves the state invariant up to a phase. So indeed, the stabilizer group of |ψ_final⟩ includes operators that are on qubits 1 and 2 that are either XX, ZZ, or YY (with possibly a phase). But what about operators on qubits 0 and 3? Do they stabilize |ψ_final⟩? Consider X0X3. Does that stabilize |ψ_final⟩? We computed earlier: X0X3|ψ_final⟩ = |ψ_final⟩. So X0X3 also stabilizes |ψ_final⟩. And what about Z0Z3? Z0Z3|ψ_final⟩ =? Let’s check: Z0Z3|0000⟩ = |0000⟩; Z0Z3|1001⟩: qubit0:1 -> -1, qubit3:1 -> -1, product=+1 so remains; similarly others -> so yes, Z0Z3 stabilizes |ψ_final⟩. And Y0Y3? Y0Y3|ψ_final⟩ = -|ψ_final⟩ as computed. So actually, it seems that any operator that acts on qubits 0 and 3 with the same Pauli on both (XX, YY, ZZ) will stabilize |ψ_final⟩? Check: What about an operator that acts on both pairs? For example, if we have an operator that is X0X3 on qubits 0,3 and I on qubits 1,2, that is in the stabilizer? But wait, is X0X3 alone a stabilizer of |ψ_final⟩? We computed that yes, X0X3|ψ_final⟩ = |ψ_final⟩. So indeed, the stabilizer group of |ψ_final⟩ is actually larger than just the code stabilizer group. Because |ψ_final⟩ is a specific state within the code space. Its stabilizer group includes all Paulis that act on qubits 0 and 3 with the same Pauli (XX, YY, ZZ) and act on qubits 1 and 2 with identity, and also those that act on qubits 1 and 2 with the same Pauli and act on qubits 0 and 3 with identity. And also products thereof. So actually, the full stabilizer group of |ψ_final⟩ is:
{ P0P3 ⊗ Q1Q2 such that P0P3 is either I or XX, YY, ZZ and Q1Q2 is either I or XX, YY, ZZ }? But wait, check: If we take P0P3 = XX and Q1Q2 = ZZ, then overall is X0 X3 Z1 Z2. Does that stabilize |ψ_final⟩? Let’s check: X0X3Z1Z2|ψ_final⟩.
|0000⟩ -> X0X3 gives |1001⟩? Actually, careful: X0X3|0000⟩ = |1001⟩. Then Z1Z2 on |1001⟩: qubit1=0 ->+1, qubit2=0->+1, so becomes |1001⟩. So that term becomes |1001⟩.
|1001⟩ -> X0X3 gives |0000⟩, and Z1Z2 gives still |0000⟩? So it seems it might stabilize? But wait, then the state would be mapped to itself? But then the operator would be in the stabilizer group. So indeed, it seems that any operator that is a tensor product of an operator on {0,3} that is in {I, XX, YY, ZZ} and an operator on {1,2} that is in {I, XX, YY, ZZ} will stabilize |ψ_final⟩? Let’s check another: X0X3 and X1X2 gives XXXX, which we know stabilizes. So yes, actually, the stabilizer group of |ψ_final⟩ is:
S_ψ = { E’ ⊗ E where E’ is on {0,3} and is either I or XX, YY, ZZ, and E is on {1,2} and is either I or XX, YY, ZZ }.
But wait, is that group closed under multiplication? The product of two such operators will give something where on {0,3} the Pauli is the product of two Paulis that are either I, XX, YY, ZZ. But note: If you take XX and YY on {0,3}, their product is X0X3 * Y0Y3 = (X0Y0)(X3Y3) = (iZ0)(iZ3) = -Z0Z3. So that gives ZZ up to a phase. So indeed, the set of operators on two qubits that are of the form: either I, or where both Paulis are the same (XX, YY, ZZ) is actually a group? Actually, check: The set {I, XX, YY, ZZ} is closed under multiplication? XXXX=I, YYYY=I, ZZZZ=I, XXYY = -ZZ, etc. So yes, that is a group (isomorphic to the Klein four-group times phases). So indeed, the stabilizer group of |ψ_final⟩ is actually the product of two such groups: one on {0,3} and one on {1,2}. So then the size of S_ψ is 4 * 4 = 16. But wait, are all these 16 operators actually stabilizing |ψ_final⟩? Let’s check one: Take E’ = XX on {0,3} and E = I on {1,2}. That gives X0X3. We already checked that stabilizes. Take E’ = XX on {0,3} and E = ZZ on {1,2}. That gives X0X3 Z1Z2. Check on |0000⟩: becomes? X0X3|0000⟩ = |1001⟩, then Z1Z2|1001⟩ leaves it as |1001⟩ because qubits 1 and 2 are 0 so no phase. On |1001⟩: X0X3 gives |0000⟩, then Z1Z2 gives |0000⟩. On |0110⟩: X0X3 gives |1111⟩? Actually, careful: |0110⟩: qubit0=0->1, qubit3=0->1 so becomes |1111⟩; then Z1Z2 on |1111⟩: qubit1=1 -> -1, qubit2=1 -> -1, product=+1, so becomes |1111⟩. On |1111⟩: X0X3 gives |0110⟩; then Z1Z2 gives |0110⟩. So yes, it works. So indeed, the stabilizer group of |ψ_final⟩ is actually of order 16. But wait, does that mean that if an error is any Pauli that is in this group, then the state remains ideal? That would imply that the physical fidelity squared would be the probability that E_total is in this group. And that probability we computed earlier for physical fidelity was: (1-p)^2 + (3/15)p(1-p) + (3/15)p(1-p) + (3/225)p^2 = 1 - (8/5)p + (46/75)p^2. And note that 46/75 is not coming from a group of size 16? Let’s check: The group S_ψ has 16 elements. But wait, are all these 16 elements actually Pauli operators that can occur from our error model? Our error model gives Paulis on {0,3} and on {1,2} independently. So the set of possible E_total is all Paulis that are products of an operator on {0,3} and an operator on {1,2}. That set has size 1616 = 256. Among these, how many are in S_ψ? S_ψ requires that on {0,3}, the operator is in the set {I, XX, YY, ZZ} which has size 4, and on {1,2}, the operator is in the set {I, XX, YY, ZZ} which has size 4. So that gives 44=16. So indeed, the physical fidelity squared should be the probability that E_total is in S_ψ. And that probability we computed as:
P(S_ψ) = P(E’ is in {I,XX,YY,ZZ}) * P(E is in {I,XX,YY,ZZ}) but careful: They are independent? Actually, yes, because the errors on the two gates are independent. And what is the probability that a given gate yields an operator in {I, XX, YY, ZZ}? That probability is: (1-p) + p(3/15) = 1-p + p/5 = 1 - (4/5)p. So then P(S_ψ) = [1 - (4/5)p]^2. That equals 1 - (8/5)p + (16/25)p^2. But wait, that is different from our earlier computation of physical fidelity squared, which was 1 - (8/5)p + (46/75)p^2. Because (16/25) = (48/75), so that would be 1 - (8/5)p + (48/75)p^2. But we got (46/75)p^2 earlier. So there is a discrepancy. I need to re-derive the physical fidelity carefully.
Physical fidelity: F^2 = probability that the final state is ideal. That means that the error operator E_total must be such that E_total|ψ_final⟩ = |ψ_final⟩ (up to phase). And as argued, that is equivalent to E_total being in the stabilizer group of |ψ_final⟩. And that stabilizer group is S_ψ = { E’ ⊗ E where E’ is in G_{0,3} and E is in G_{1,2} } where G is the group on two qubits consisting of {I, XX, YY, ZZ}? But wait, is that true? Let’s check: Take E’ = XX on {0,3} and E = I on {1,2}. That works. Take E’ = I on {0,3} and E = XX on {1,2}. That works. Take E’ = XX on {0,3} and E = XX on {1,2} gives XXXX, works. Take E’ = XX on {0,3} and E = ZZ on {1,2} gives X0X3 Z1Z2. Does that stabilize? We already checked seems yes. So then indeed, if E’ is in {I, XX, YY, ZZ} and E is in {I, XX, YY, ZZ}, then E_total should stabilize |ψ_final⟩. So then the probability that E_total is in S_ψ is indeed: [P(gate gives operator in {I,XX,YY,ZZ})]^2. And that is [1 - p + p(3/15)]^2 = [1 - (4/5)p]^2 = 1 - (8/5)p + (16/25)p^2 = 1 - (8/5)p + (48/75)p^2.
But earlier, I computed physical fidelity as: (1-p)^2 + (3/15)p(1-p) + (3/15)p(1-p) + (3/225)p^2 = 1 - 2p + p^2 + (6p/15)(1-p) + (3p^2/225) = 1 - 2p + p^2 + (2p/5)(1-p) + (p^2/75) = 1 - 2p + p^2 + 2p/5 - 2p^2/5 + p^2/75 = 1 - (8/5)p + p^2(1 - 2/5 + 1/75) = 1 - (8/5)p + p^2(3/5 + 1/75) = 1 - (8/5)p + p^2(45/75+1/75)= 1 - (8/5)p + (46/75)p^2.
So there is a difference of (2/75)p^2. That suggests that my earlier classification of which errors are harmless might have been off. I said that harmless errors on step2 are those that are XX, YY, ZZ. That gives 3/15. But wait, what about errors on step2 that are, say, something like? Could there be an error on step2 that is not in {I,XX,YY,ZZ} but still results in the ideal state? Let’s check: Suppose on step2, we have an error E = X⊗I on qubits {1,2}. Then what is the overall effect? E_total would be I0 (X⊗I) I3 = X1 alone. Does that stabilize |ψ_final⟩? Check: X1|ψ_final⟩.
|0000⟩ -> X1 gives |0100⟩, which is not in the superposition. So that would not leave it invariant. So that is not harmless.
What about E = I⊗X? Similarly, no.
What about E = Y⊗Z? That gives mod2 (0,1) actually. Would that stabilize? Let’s check: Y1Z2|ψ_final⟩.
|0000⟩: Y1|0⟩ = i|1⟩, Z2|0⟩ = |0⟩, so becomes i|0100⟩, not in the state.
So indeed, it seems that for step2 alone to be harmless, we need E to be in {XX, YY, ZZ}. So that part seems correct.
Then what about errors on step4 alone? Similarly, they need to be in {XX, YY, ZZ} on {0,3}. So that gives probability: 3/15 each.
Then for both errors, I said that they need to be the same type to be harmless. But wait, consider both errors: If step2 gives XX and step4 gives ZZ? Then overall is ZZ on {0,3} and XX on {1,2}. Is that in S_ψ? According to my new idea, S_ψ requires that on {0,3}, the operator is in {I,XX,YY,ZZ} and on {1,2}, the operator is in {I,XX,YY,ZZ}. So ZZ is in that set and XX is in that set. So then that overall operator should be in S_ψ. But wait, check manually: E_total = Z0Z3 ⊗ X1X2. Apply this to |ψ_final⟩:
|0000⟩ -> Z0Z3 gives stays? Actually, Z0Z3|0000⟩ = |0000⟩ because both are 0. Then X1X2 gives |0110⟩. So |0000⟩ goes to |0110⟩.
|1001⟩ -> Z0Z3: qubit0=1 -> -1, qubit3=1 -> -1, product=+1, so remains |1001⟩; then X1X2 gives |1111⟩? Actually, careful: X1X2|1001⟩ = |1111⟩ because qubit1=0->1, qubit2=0->1.
|0110⟩ -> Z0Z3: qubit0=0->+1, qubit3=0->+1, so remains |0110⟩; then X1X2 gives |0000⟩.
|1111⟩ -> Z0Z3: qubit0=1->-1, qubit3=1->-1, product=+1, so remains |1111⟩; then X1X2 gives |1001⟩.
So overall, the state becomes: 1/2(|0110⟩+|1111⟩+|0000⟩+|1001⟩) which is the same as |ψ_final⟩. So indeed, Z0Z3 ⊗ X1X2 does stabilize |ψ_final⟩. So that means that if step2 gives XX and step4 gives ZZ, that should be harmless as well. I earlier thought that they must be the same type to be harmless, but that is not true. Because S_ψ is actually the product of two independent groups: on {0,3} any operator from {I,XX,YY,ZZ} works, and on {1,2} any operator from {I,XX,YY,ZZ} works. So then the condition for E_total to be in S_ψ is that:
E’ is in {I, XX, YY, ZZ} and E is in {I, XX, YY, ZZ}.
And these are independent conditions. So then the probability that E_total is in S_ψ is indeed:
P(S_ψ) = [P(gate2 gives in {I,XX,YY,ZZ})] * [P(gate4 gives in {I,XX,YY,ZZ})] = [1 - p + p(3/15)]^2 = [1 - (4/5)p]^2 = 1 - (8/5)p + (16/25)p^2 = 1 - (8/5)p + (48/75)p^2.
But my previous computation gave only up to (46/75)p^2. I missed the cases where the errors are different types? Let’s recompute physical fidelity carefully using this new understanding:
We want the probability that E_total is in S_ψ. That is:
P(S_ψ) = P(E’ is in G) * P(E is in G), where G = {I, XX, YY, ZZ} on the respective pairs.
Now, for a single gate, P(gate yields an operator in G) = probability no error gives I: (1-p) + probability error gives one of XX, YY, ZZ: that is p(3/15) = p/5. So total = 1-p + p/5 = 1 - (4/5)p.
So then P(S_ψ) = (1 - (4/5)p)^2 = 1 - (8/5)p + (16/25)p^2 = 1 - (8/5)p + (48/75)p^2.
So the physical fidelity squared should be 1 - (8/5)p + (48/75)p^2.
Now, does that make sense? If p is small, physical infidelity is about (8/5)p = 1.6p. That seems plausible.
I will check with a specific case: If only step2 error occurs and it is XX, that is harmless. So that probability is p/5. If only step4 error occurs and it is XX, that is harmless: another p/5. If both occur and they are any combination from G, that probability is (p/5)(p/5) = p^2/25? But careful: wait, careful: The probability that step2 yields an operator in G is actually 1 - (4/5)p, not p/5 alone. Because that includes the case of no error as well. So if we want to compute the probability that there is an error on step2 that is in G (non-identity), that probability is p(3/15)= p/5. And similarly for step4. And the probability that both have errors that are in G (and they can be any combination independently) is (p/5)(p/5) = p^2/25. Then plus the cases where one gate has no error and the other has an error in G: that gives (1-p)(p/5) + (p/5)(1-p) = 2p/5(1-p). And plus both no error: (1-p)^2. So total = (1-p)^2 + 2p/5(1-p) + p^2/25 = 1 - 2p + p^2 + 2p/5 - 2p^2/5 + p^2/25 = 1 - (8/5)p + p^2(1 - 2/5 + 1/25) = 1 - (8/5)p + p^2(3/5 + 1/25) = 1 - (8/5)p + p^2(15/25+1/25)= 1 - (8/5)p + (16/25)p^2. Yes, that matches. So the physical fidelity squared is indeed 1 - (8/5)p + (16/25)p^2 = 1 - 1.6p + 0.64p^2.
So I believe the correct physical fidelity is F_physical = 1 - (4/5)p? Actually, wait, that is the square root? No, fidelity is usually the overlap, so F = sqrt(⟨ψ|ρ|ψ⟩). But if ρ is a mixture where with probability P(S_ψ) we have the ideal state and with probability 1-P(S_ψ) we have states orthogonal to ideal, then ⟨ψ|ρ|ψ⟩ = P(S_ψ). So the fidelity is sqrt(P(S_ψ)). So that would be sqrt(1 - (8/5)p + (16/25)p^2) = 1 - (4/5)p approximately. But wait, often fidelity is defined as the square root of that. However, sometimes people use fidelity as the probability itself. The problem says “physical state fidelity”. I need to check: usually fidelity between two states is defined as |⟨ψ|φ⟩|. If φ is mixed, fidelity is sqrt(⟨ψ|ρ|ψ⟩). So yes, it is the square root. But then the previous answer I got for physical fidelity was that expression under the square root. So I’ll keep it as that.
Now, back to the logical fidelity with post-selection. We post-select on detectable errors. That means we only keep states where the error is undetectable. Undetectable errors are those that are in the normalizer of the code stabilizer. wait careful: detectable errors are those that anticommute with at least one stabilizer. So undetectable errors are those that commute with both stabilizers. That is N(S) where S is the code stabilizer group. The code stabilizer group is generated by XXXX and ZZZZ. So what is N(S)? N(S) consists of Pauli operators that commute with XXXX and ZZZZ. As derived earlier, that condition is that the number of qubits with Pauli in {Z,Y} is even, and the number with Pauli in {X,Y} is even. wait, that is for being in the normalizer of the Pauli group? Actually, any Pauli will either commute or anticommute with XXXX. So yes.
So we want to know when is E_total in N(S). And we computed that using the mod2 characteristics. For a single gate, the probability that it yields a Pauli with mod2 value (a,b) is:
P(0,0) = 1 - p + p(3/15) = 1 - (4/5)p.
P(0,1) = p(4/15)
P(1,0) = p(4/15)
P(1,1) = p(4/15)
And these are independent for the two gates. And E_total is in N(S) if and only if the combined mod2 is (0,0). That probability is:
P(N) = P(0,0)^2 + P(0,1)^2 + P(1,0)^2 + P(1,1)^2 = [1 - (4/5)p]^2 + 3(4p/15)^2 = 1 - (8/5)p + (16/25)p^2 + 3(16p^2/225) = 1 - (8/5)p + (16/25)p^2 + (48p^2/225) = 1 - (8/5)p + (144/225)p^2 + (48/225)p^2 = 1 - (8/5)p + (192/225)p^2 = 1 - (8/5)p + (64/75)p^2.
So P(N) = 1 - (8/5)p + (64/75)p^2.
Now, within N(S), we want the logical state to be correct. The logical state is correct if the error is actually in the stabilizer group of the code? But careful: The code stabilizer group S_code is {I, XXXX, ZZZZ, YYYY}. wait, is that correct? Actually, the code stabilizer group is generated by XXXX and ZZZZ, so it is {I, XXXX, ZZZZ, XXXXZZZZ = YYYY}. So yes, S_code has 4 elements.
But wait, is that the condition for the logical state to be correct? If an error is in S_code, then it acts as identity on the code space. So that would leave the logical state unchanged. If an error is in N(S) but not in S_code, then it acts as a non-trivial logical operator. And since our ideal state is a Bell state between logical qubits, any non-trivial logical operator will change it to an orthogonal state likely. So then the logical fidelity after post-selection is:
F_logical^2 = P(E_total in S_code) / P(E_total in N(S)).
Because after post-selection, we only keep states with errors in N(S). Among those, the fraction that are in S_code will give the ideal logical state. So we need P(S_code).
Now, what is S_code? S_code requires that E_total is either I, or XXXX, or ZZZZ, or YYYY. In terms of the two gates, when is E_total in S_code?
I: when both gates yield identity.
XXXX: when? XXXX means on qubits 0,3: must be XX and on qubits 1,2: must be XX.
ZZZZ: requires on {0,3}: ZZ and on {1,2}: ZZ.
YYYY: requires on {0,3}: YY and on {1,2}: YY.
So note that this is not simply that each gate is in G because if one gate is in G and the other is in G, that gives 44=16 possibilities, but only 4 of those are in S_code? Because S_code requires that the Pauli on {0,3} and on {1,2} are the same type. So indeed, P(S_code) = probability that both gates yield identity OR both yield XX, OR both yield ZZ, OR both yield YY.
That probability is: (1-p)^2 + 3(p/15)^2 = (1-p)^2 + 3p^2/225 = 1 - 2p + p^2 + p^2/75 = 1 - 2p + (76/75)p^2? careful: p^2 + 3p^2/225 = p^2 + p^2/75 = (75p^2/75 + p^2/75) = 76p^2/75. So P(S_code) = 1 - 2p + (76/75)p^2.
But wait, is that correct? Let’s check: The probability that both gates yield identity is (1-p)^2.
The probability that both yield XX is (p/15)*(p/15)= p^2/225.
Similarly for YY and ZZ: total 3p^2/225 = p^2/75.
So yes, P(S_code) = (1-p)^2 + p^2/75 = 1 - 2p + p^2 + p^2/75 = 1 - 2p + (76/75)p^2.
So then the logical fidelity (squared) after post-selection is:
F_logical^2 = [1 - 2p + (76/75)p^2] / [1 - (8/5)p + (64/75)p^2].
For small p, this is approximately (1 - 2p) / (1 - 1.6p) ≈ 1 + 0.4p? That would be greater than 1, which is not right because fidelity should be <= 1. Let’s do series: Numerator = 1 - 2p + (76/75)p^2 = 1 - 2p + 1.01333…p^2 actually 76/75 = 1.01333.
Denom = 1 - 1.6p + (64/75)p^2 = 1 - 1.6p + 0.85333p^2.
So ratio = 1 + (-2+1.6)p + … = 1 - 0.4p + … So actually, F_logical^2 ≈ 1 - 0.4p, so F_logical ≈ 1 - 0.2p. So that makes sense.
But wait, the problem might expect a simpler result. often post-selection improves the fidelity. I recall that for this code, the logical fidelity with post-selection might become something like (1-p)^2? But let’s see.
Maybe there is another interpretation: “post-selected on all detectable errors” means that we discard any run where an error is detected. So the only runs that are kept are those where no error is detected. But wait, detectable errors are those that give a non-trivial syndrome. But note: even if an error occurs that is in N(S) but not in S, that error is not detected because it commutes with the stabilizers. So actually, post-selection would keep runs where the error is in N(S). So that is what we did.
So then the logical fidelity is F_logical = sqrt(P(S_code)/P(N)) = sqrt([1 - 2p + (76/75)p^2] / [1 - (8/5)p + (64/75)p^2]). That is not a nice expression.
Maybe they expect an expression to first order in p? Or maybe they expect that after post-selection, the only errors that remain are those that are in S_code actually? But wait, could it be that post-selection also removes errors that are in N(S) but not in S? Because those are undetectable errors. So they are not detected. So they are kept. So then the logical state will be wrong for those runs. So indeed, the logical fidelity is that fraction.
But wait, the problem might be simpler if we assume that p is small and we only keep terms up to order p. Then
P(S_code) ≈ 1 - 2p
P(N) ≈ 1 - (8/5)p = 1 - 1.6p
So then F_logical^2 ≈ (1-2p)/(1-1.6p) ≈ 1 - 0.4p, so F_logical ≈ 1 - 0.2p.
That is not a nice number either.
Maybe the intended result is that the logical fidelity becomes 1 - O(p^2) after post-selection? Because often error detection can improve the fidelity to higher order. Let’s check second order:
P(S_code) = 1 - 2p + (76/75)p^2
P(N) = 1 - (8/5)p + (64/75)p^2 = 1 - 1.6p + (64/75)p^2 actually (64/75)=0.85333p^2.
So the ratio = 1 - 0.4p + [ (76/75) - (64/75) ]p^2? Actually, careful: (1 - 2p + A p^2) / (1 - 1.6p + B p^2) with A=76/75=1.01333, B=64/75=0.85333. Then series: = 1 + (-2+1.6)p + [A - B - (-2)(-1.6) + (-1.6)^2]? Let’s do properly:
(1 + α p + β p^2) with α = -2, β=A.
Denom: 1 + γ p + δ p^2 with γ = -1.6, δ=B.
Then ratio = 1 + (α-γ)p + [β - δ - γ(α-γ) + (α-γ)^2]p^2? Actually, better: ratio = 1 + (α-γ)p + [β - δ - αγ + γ^2]p^2? I’ll do: (1+αp+βp^2)/(1+γp+δp^2) = 1 + (α-γ)p + [β - δ - γ(α-γ)]p^2 + … because (α-γ)^2? Let’s derive:
1/(1+γp+δp^2) = 1 - γp + (γ^2-δ)p^2 + …
Then multiply: (1+αp+βp^2)(1-γp+(γ^2-δ)p^2) = 1 + (α-γ)p + [β + γ^2-δ - αγ]p^2 + … So yes.
So here, α-γ = -2 - (-1.6) = -0.4.
Then β - δ - γ(α-γ) = (76/75 - 64/75) - (-1.6)*(-0.4) = (12/75) - (0.64) = 0.16 - 0.64 = -0.48.
So F_logical^2 = 1 - 0.4p - 0.48p^2, so F_logical = 1 - 0.2p - … So it does not become second order immediately. So that is not likely intended.
Maybe the intended result is that the logical fidelity after post-selection is actually 1? That would be if post-selection could detect all errors that cause logical errors. But wait, undetectable errors are those that are in N(S) but not in S. Those are logical errors. So post-selection cannot detect logical errors. So then the logical fidelity is less than 1.
I recall that the [[4,2,2]] code is detection-only. It can detect any single-qubit error. So if only one error occurs, it will be detected because any single-qubit error will anticommute with at least one stabilizer? Check: A single-qubit error, say X on qubit0. Does it commute with XXXX? XXXX anticommutes with X because? Actually, X on qubit0 commutes with XXXX? XXXX is X on all qubits. X on qubit0 commutes with itself actually. But it might anticommute with ZZZZ. ZZZZ has Z on qubit0, so X and Z anticommute. So yes, single-qubit errors are detectable. So then if only one error occurs, it will be detected and discarded. So then the only errors that survive post-selection are those that are either no error or errors that involve at least two qubits that are undetectable. And that is what we computed with P(N). So that seems right.
Given that the first subproblem likely expected an answer that is something like that, maybe the second subproblem expects something like that the logical fidelity becomes 1 - O(p^2) because the first-order terms cancel? But our expansion gave first order term -0.4p, so that is not cancelling.
Wait, could it be that I made a mistake in determining S_code? The code stabilizer group is actually not just {I, XXXX, ZZZZ, YYYY} because wait, the code is [[4,2,2]]. Its stabilizer group is indeed generated by XXXX and ZZZZ. So that group has 4 elements. So that is correct.
Maybe the intended result is that the logical fidelity after post-selection is actually independent of p? That would be if P(S_code) and P(N) were such that their ratio is constant. But that is not constant.
Let’s check another approach: The errors happen on two gates. The probability that no error occurs is (1-p)^2.
The probability that an error occurs that is detectable will be discarded. So the success probability is P(N) = 1 - (8/5)p + (64/75)p^2.
Among successful runs, the ones that are correct are those where the error is in S_code. That probability is (1-p)^2 + 3*(p/15)^2 = (1-p)^2 + p^2/75.
So the logical fidelity is that ratio. So that is what I got.
Maybe the answer is that logical fidelity = [1 - 2p + p^2/75] / [1 - (8/5)p + (64/75)p^2] wait careful: (1-p)^2 = 1 - 2p + p^2, so plus p^2/75 gives 1 - 2p + (76/75)p^2. Yes.
I will check with a specific value: p=0.1. Then P(S_code) = 1 - 0.2 + (76/75)0.01 = 0.8 + (1.01333)0.01 = 0.8 + 0.0101333 = 0.8101333.
P(N) = 1 - (8/5)0.1 + (64/75)0.01 = 1 - 0.16 + (0.85333)0.01 = 0.84 + 0.0085333 = 0.8485333.
Ratio = 0.8101333/0.8485333 = 0.9547 approximately. So logical fidelity squared is 0.9547, so logical fidelity is 0.9771. without post-selection, physical fidelity would be sqrt(1 - 1.60.1 + 0.64*0.01) = sqrt(1 - 0.16 + 0.0064) = sqrt(0.8464)=0.92. So post-selection improves the fidelity indeed. That makes sense.
But wait, the problem might expect an answer in a simple form. could it be that the logical fidelity is actually (1-p)^2? If that were the case, then for p=0.1, that would be 0.81, so fidelity would be 0.9, which is lower than physical fidelity? That doesn’t make sense.
Given that the first subproblem’s answer turned out to be something like that provided by the user? The user said: “The correct answer is: \(F_{\rm{physical}}=(1-\frac{12}{15}p)^2\)”. That is interesting: (1 - 12/15 p)^2 = (1 - 4/5 p)^2 = 1 - 8/5 p + 16/25 p^2. That is actually the probability that both gates yield an operator in G. And that is what I now believe is the physical fidelity squared? Because I earlier got that physical fidelity squared should be [1 - (4/5)p]^2 = 1 - (8/5)p + (16/25)p^2. And that is exactly what the user stated as the correct answer for physical fidelity. So that suggests that the intended physical fidelity is actually F_physical = 1 - (4/5)p? But wait, that is the square root? They wrote \(F_{\rm{physical}}=(1-\frac{12}{15}p)^2\). That is actually squared fidelity? Because (1 - 12/15 p) = (1 - 4/5 p). So then they square that to get (1 - 4/5 p)^2. So that would mean that the fidelity itself is 1 - 4/5 p, not the square root. So they might be using fidelity as the probability itself rather than the square root. Often in quantum information, the fidelity between a mixed state and a pure state is defined as F = sqrt(Tr(ρ|ψ><ψ|)). So that would be the square root of that probability. But sometimes people call that probability the fidelity squared. However, the problem says “physical state fidelity”. I need to check the first subproblem statement: “What is the physical state fidelity of the final physical 4-qubit state at the end of the circuit as a function of the two-qubit gate error rate p?” That would be F = sqrt(<ψ|ρ|ψ>). And that is not necessarily that probability because if there are phases, they might add up. But since errors are Pauli errors, they either leave the state intact or make it orthogonal. So indeed, <ψ|ρ|ψ> = probability that the error is in the stabilizer of |ψ>. And that probability we determined is [1 - (4/5)p]^2. So then the fidelity would be 1 - (4/5)p. So then the user’s statement that the correct answer is \(F_{\rm{physical}}=(1-\frac{12}{15}p)^2\) would actually mean that they are reporting the fidelity squared? Because 1 - 12/15 p = 1 - 4/5 p. So then (1 - 4/5 p)^2 is actually the fidelity squared? I need to be careful: The user wrote: “The correct answer is: \(F_{\rm{physical}}=(1-\frac{12}{15}p)^2\)”. That suggests that they believe that the physical fidelity is that expression. But if fidelity is defined as F = sqrt(<ψ|ρ|ψ>), then <ψ|ρ|ψ> should be that. So then that would mean that the probability of no error is actually (1-p)^2 plus something else? wait, if that is true, then for small p, fidelity would be 1 - (4/5)p, so infidelity is 0.8p. That is what I got earlier from the idea that physical fidelity squared is [1 - (4/5)p]^2. So that is consistent if we take fidelity to be that quantity itself. But then usually fidelity is between 0 and 1, and for a state that is with probability close to 1 the ideal state, fidelity is close to 1. So I will assume that the intended meaning is that the fidelity is that probability itself. So then for the first subproblem, the answer is F_physical = (1 - 4/5 p)^2 = (1 - 12/15 p)^2. Then for the second subproblem, we want the logical state fidelity after post-selection. following that pattern, the logical state fidelity would be the probability that the logical state is correct given that it passed post-selection. That is P(S_code)/P(N). And that is [1 - 2p + p^2/75] / [1 - (8/5)p + (64/75)p^2] wait careful: P(S_code) = (1-p)^2 + 3*(p/15)^2 = 1 - 2p + p^2 + 3p^2/225 = 1 - 2p + p^2 + p^2/75 = 1 - 2p + (76/75)p^2? because p^2 = 75/75 p^2, so that is 1 - 2p + (76/75)p^2. And P(N) = 1 - (8/5)p + (64/75)p^2. So the ratio is not a perfect square likely. But wait, could it be that actually intended that the logical fidelity is also something like (1 - something p)^2? What if we also post-select on errors that are detectable? Then the only errors that remain are those that are in S_code actually? Is it possible that post-selection actually removes all errors that are not in S_code? But wait, errors that are in N(S) but not in S_code are undetectable. So they are not removed by post-selection. So that doesn’t happen.
Maybe the intended result is that the logical fidelity becomes 1 after post-selection? That would be if somehow every error in N(S) is actually in S_code. But that’s not true because there are logical errors.
I will check online memory: The [[4,2,2]] code can detect any single-qubit error. So if only one error occurs, it is detected. So then the only errors that survive post-selection are those that involve two or more errors that cancel each other into an undetectable error. wait, that is right.
Given that the user provided the first answer as that, I will trust that. So then for the second subproblem, the logical state fidelity after post-selection is likely something like that the state is always correct if it passes post-selection? Is that possible? What is the distance of this code? It is distance 2, so it can detect any single error. But it cannot correct errors. However, if an error occurs that is undetectable, that means it is actually a logical error. So wait, if a single error occurs, it will be detected because any single-qubit Pauli will anticommute with at least one stabilizer? Check: Consider a single-qubit error on qubit0: X0. Does it commute with XXXX? X0 commutes with XXXX because XXXX has X on qubit0 too actually they commute. But it will anticommute with ZZZZ because ZZZZ has Z on qubit0. So yes. So any single-qubit error is detectable. What about two-qubit errors? They can be undetectable. For example, X0X1 might be undetectable? Check X0X1: commute with XXXX? XXXX has X on all, so that commutes. commute with ZZZZ? ZZZZ has Z on qubit0 and Z on qubit1, so that gives anticommute because X and Z anticommute on each qubit, so overall product of signs: (-1)(-1)=1 actually careful: For two qubits, if you have X on both, and you have Z on both, then they commute because on each qubit, X and Z anticommute, so you get (-1)(-1)=1. So X0X1 is actually undetectable? But wait, is X0X1 in N(S)? Check conditions: number of {Z,Y} on X0X1 is 0, so even. Number of {X,Y} is 2, even. So yes, X0X1 is in N(S). So that means that if there is an error on qubits 0 and 1 that is X0X1, that will not be detected. But would that error affect the logical state? likely yes. So post-selection cannot remove that error. So then the logical fidelity after post-selection is not 1.
Maybe the intended result is that the logical fidelity becomes something like (1-p)^2? But that would be if only no-error cases survive post-selection. But that’s not true because undetectable errors also survive.
I will recompute P(N) carefully using the mod2 method seems correct because that is based on whether commute with XXXX and ZZZZ. That gave me P(N) = [1 - (4/5)p]^2 + 3(4p/15)^2 = [1 - (4/5)p]^2 + 3(16p^2/225) = 1 - (8/5)p + (16/25)p^2 + (48/225)p^2 = 1 - (8/5)p + (144/225)p^2 + (48/225)p^2 = 1 - (8/5)p + (192/225)p^2 = 1 - (8/5)p + (64/75)p^2. So that seems right.
And P(S_code) = probability that E_total is in {I, XXXX, ZZZZ, YYYY}. That requires that on {0,3}, the Pauli is either I or else must be such that it is the same as on {1,2} actually wait careful: For E_total to be XXXX, we need that on {0,3} is XX and on {1,2} is XX. For ZZZZ, need ZZ on both. For YYYY, need YY on both. So that means that both gates must yield the same specific Pauli from {XX, YY, ZZ} or both yield identity. So that probability is indeed (1-p)^2 + 3*(p/15)^2 = 1 - 2p + p^2 + 3p^2/225 = 1 - 2p + p^2 + p^2/75 = 1 - 2p + (76/75)p^2.
So then the logical fidelity ( squared) after post-selection is that ratio. So that is not a nice number.
wait, could it be that the logical fidelity itself is actually this ratio? But then for small p, that is 1 - 2p divided by 1 - 1.6p, which is 1 - 0.4p approximately. So then the infidelity would be 0.4p, which is worse than the physical infidelity of 0.8p? That would mean that post-selection actually reduces the fidelity? That doesn’t make sense because post-selection should improve fidelity by removing detected errors. Physical fidelity without post-selection is actually lower because it includes states that are not in the code space. wait, careful: Physical fidelity is fidelity of the physical state relative to the ideal physical state. That includes states that are outside the code space. Those states have fidelity 0. So that why physical fidelity is [1 - (4/5)p]^2. That is actually higher than the success probability of post-selection? For p=0.1, physical fidelity would be (1 - 0.08)^2 = (0.92)^2 = 0.8464. So that means that without post-selection, the overlap with the ideal state is 0.8464. With post-selection, we only keep states that are in the code space. But then within the code space, the state could be ideal or could be a logical error. The probability of being in the code space is P(N) which is 1 - (8/5)p + (64/75)p^2. For p=0.1, that is 1 - 0.16 + (64/75)*0.01 = 0.84 + 0.0085333 = 0.8485333. And within that, the probability of being ideal is P(S_code)=0.8101333. So then the fidelity after post-selection would be 0.8101333/0.8485333 = 0.9547. So actually, post-selection improves the fidelity from 0.8464 to 0.9547. So that makes sense.
So then the logical fidelity after post-selection is that ratio. So then maybe the answer is that logical fidelity = [1 - 2p + p^2/75] / [1 - (8/5)p + (64/75)p^2] wait careful: 1 - 2p + (76/75)p^2 is not that simple. So that is the expression.
I wonder if that simplifies somehow?
P(S_code) = (1-p)^2 + 3p^2/225 = (1-p)^2 + p^2/75.
P(N) = (1-p)^2 + something else. Actually, note that P(N) can also be computed as follows: P(N) = P(both gates yield operators with the same mod2 value). And that is [1 - (4/5)p]^2 + 3(4p/15)^2 = (1 - (4/5)p)^2 + 3(16p^2/225) = 1 - (8/5)p + (16/25)p^2 + (48/225)p^2 = 1 - (8/5)p + (144/225+48/225)p^2 = 1 - (8/5)p + (192/225)p^2 = 1 - (8/5)p + (64/75)p^2.
So that is it.
These don’t simplify to a nice square unless something else happens.
Given that the first subproblem’s answer was given as something nice: actually wait, the user said: “The correct answer is: \(F_{\rm{physical}}=(1-\frac{12}{15}p)^2\)”. That is actually (1 - 4/5 p)^2. So that is very nice. So I will expect that the second subproblem’s answer might also be something nice like that. What could it be? If post-selection removes all errors that are detectable, then the only errors that remain are those that are in N(S). But wait, maybe the logical state fidelity is actually the probability that no error occurred given that it passed post-selection? That would be (1-p)^2 / P(N). But that is not likely.
Maybe the intended result is that the logical state fidelity becomes 1 because any undetectable error actually leaves the logical state unchanged? Is that possible? Check: Consider an undetectable error that is not in S_code, say X0X1. Does that leave the logical state unchanged? likely not because it will act as a logical operator. So that would change the state. So that’s not it.
I will check online memory: The [[4,2,2]] code is often used for entanglement distillation. actually wait, this circuit is used to prepare a Bell state. And with post-selection, the fidelity of the Bell state can be improved. There is known that using this code, the logical fidelity after post-selection becomes something like (1-p)^2/(1-p)^2? I recall that for entanglement purification with this code, the output fidelity can be higher.
Maybe I should compute the logical fidelity squared not as that ratio but as follows: After post-selection, the state is that conditional on being in the code space. So then the density matrix conditioned on success is: ρ_success = (1/P(N)) * ( projects onto code space of actually states that come from errors in N(S) ). within the code space, the state could be ideal or could be something else. actually wait, because errors in N(S) act as logical operators on the code space. So if an error E is in N(S) but not in S_code, then it will map the ideal state to an orthogonal state within the code space. So then the overlap with the ideal state will be 0 for that branch. So indeed, the fidelity is only from branches where the error is in S_code. So that ratio is correct.
Maybe the intended answer is that to first order, the logical infidelity is actually of order p^2. Let’s check that carefully with another method: The only errors that survive post-selection are those that are undetectable. What are the undetectable errors? They are errors that involve an even number of qubits with Pauli that are in {Z,Y} and even number with {X,Y}. For single-gate errors? But errors happen on two gates independently. The probability that an error occurs on one gate is order p. But wait, if only one gate has an error, that error will be on two qubits. Could that be undetectable? For example, if on step2, the error is XX. That is undetectable because XX has mod2 (0,0). So actually, single-gate errors can be undetectable. So there are order-p terms in P(N). And within those, if the error is XX on step2, that is actually in S_code? Is XX on step2 in S_code? For it to be in S_code, we need that the error on step2 is such that when combined with identity on step4, the overall is in S_code. But wait, if step2 gives XX and step4 gives identity, then overall is I0 XX I3. Is that in S_code? S_code requires that the operator is either I, XXXX, ZZZZ, or YYYY. I0 XX I3 is not that because it is not uniform across all qubits. So that means that if only one gate has an error, that error cannot be in S_code because S_code requires that the Pauli on both pairs are the same type. So indeed, P(S_code) has no order-p term. That is why P(S_code) starts with 1 - 2p actually wait, (1-p)^2 gives 1 - 2p + p^2. So the order-p term is -2p. So that is interesting: P(S_code) actually does have an order-p term coming from the case where both gates have no error? That gives 1 - 2p actually from expansion of (1-p)^2. So that is order-p. So then the ratio near p=0 is (1 - 2p) / (1 - (8/5)p) = 1 - (2 - 1.6)p = 1 - 0.4p. So there is a first-order term. So the logical infidelity is actually 0.4p to first order. So that means that post-selection improves the fidelity because the physical fidelity without post-selection would be [1 - (4/5)p]^2 = 1 - (8/5)p = 1 - 1.6p to first order. So indeed, post-selection reduces the infidelity from 1.6p to 0.4p. So that is an improvement by a factor of 4. So that is plausible.
Then maybe the intended result is that the logical fidelity after post-selection is actually 1 - (4/5)p? But that would be 1 - 0.8p, which is worse than 1 - 0.4p. So that’s not it.
Given that the first subproblem’s answer was given as a simple square, I will check if maybe the logical fidelity after post-selection also becomes a perfect square. What would it need to be? If logical fidelity = (1 - (2/5)p)^2, then that would be 1 - (4/5)p + (4/25)p^2 = 1 - 0.8p + 0.16p^2. Our ratio is 1 - 0.4p + … so that’s not that.
If it were (1 - (1/5)p)^2, that would be 1 - (2/5)p + … no.
Maybe it is that the logical fidelity is actually independent of p? Unlikely.
I will compute the ratio exactly:
F_logical^2 = [1 - 2p + (76/75)p^2] / [1 - (8/5)p + (64/75)p^2].
Write (8/5)p = (120/75)p actually careful: better to use fractions with denominator 75:
P(S_code) = 1 - 2p + (76/75)p^2. But careful: 2p = (150/75)p actually wait, p is not over 75. Let’s put everything with denominator 75 for the p^2 terms alone. actually, let me write:
P(S_code) = 1 - 2p + (76/75)p^2.
P(N) = 1 - (8/5)p + (64/75)p^2 = 1 - (120/75)p + (64/75)p^2.
So then F_logical^2 = [1 - 2p + (76/75)p^2] / [1 - (8/5)p + (64/75)p^2]. This doesn’t simplify to a nice form unless2p and (8/5)p become related if p is replaced by something. If they were both expressed with denominator 5, then would be easier. So stay with denominator 5:
P(S_code) = 1 - 2p + (76/75)p^2. And P(N) = 1 - (8/5)p + (64/75)p^2.
So that is it.
Maybe the intended result is just that logical fidelity = 1 - (2/5)p + O(p^2) so that F_logical = 1 - (1/5)p approximately? Because then squared would be 1 - (2/5)p. But we got 1 - 0.4p which is 1 - (2/5)p actually because 0.4p = (2/5)p. Yes! because 2/5 = 0.4. So to first order, F_logical^2 = 1 - (2/5)p. So then F_logical itself would be 1 - (1/5)p to first order. So that is nice: physical infidelity without post-selection is (4/5)p, and with post-selection, logical infidelity becomes (1/5)p. So that is a factor of 4 improvement. That is very nice.
And maybe that is the intended result: that the logical state fidelity becomes something like that. But wait, could it be that the logical fidelity itself is actually that ratio? often fidelity is between 0 and 1. If that ratio is close to 1, then it is fidelity squared often. But here, if p is small, the success probability is close to 1, so the state inside is almost ideal. So fidelity should be close to 1. So I would expect that the logical fidelity after post-selection is actually that ratio itself because that is the probability that the state is ideal conditioned on success. So then that would be 1 - (2/5)p to first order. So then the infidelity is (2/5)p = 0.4p. That is what I had. So that means that without post-selection, the infidelity is 1.6p, with post-selection, infidelity is 0.4p. So that is an improvement by factor of 4. That seems plausible.
I will check with p=0.1 again: then logical fidelity would be 1 - 0.04 = 0.96 approximately. But wait, our computed ratio was 0.8101333/0.8485333 = 0.9547, not 0.96. because 1 - 0.04 would be 0.96. So there is a discrepancy of 0.0053. That comes from the second order terms. So maybe the intended result is only to first order. Often these problems yield an answer that is good to first order in p. So then the logical state fidelity might be simply 1 - (2/5)p. But wait, that is fidelity squared or fidelity? If fidelity is defined as the probability itself, then that would be 1 - (2/5)p. If fidelity is defined as the square root, then it would be 1 - (1/5)p. I need to decide based on the first subproblem. The user said that the correct answer for physical fidelity is (1 - 12/15 p)^2 = (1 - 4/5 p)^2. So that suggests that they are actually reporting the fidelity itself as that expression? Because if fidelity were the square root, then physical fidelity would be 1 - 4/5 p, not its square. So they likely define fidelity as the success probability itself. So then physical fidelity = (1 - 4/5 p)^2. Then logical fidelity after post-selection would be something like that too. could it be that logical fidelity = (1 - 2/5 p)^2? Then that would be 1 - 4/5 p + 4/25 p^2. For p=0.1, that is 1 - 0.08 + 0.016 = 0.936, which is not near 0.9547. What about logical fidelity = 1 - 2/5 p? That would be 1 - 0.04 = 0.96 for p=0.1, which is closer to 0.9547? Actually, 0.96 is further from 0.9547 than 0.9547 is from 0.96? The difference is 0.0053.
Maybe it is that logical fidelity = 1 - (2/5)p + (2/25)p^2? That would be 1 - 0.04 + 0.008 = 0.968, too high.
wait, let’s actually compute the series for F_logical^2 from our expressions:
F_logical^2 = (1 - 2p + (76/75)p^2) / (1 - 1.6p + (64/75)p^2).
1/(1 - 1.6p + (64/75)p^2) = 1 + 1.6p + (1.6^2 - 64/75)p^2 = 1 + 1.6p + (2.56 - 0.85333)p^2 = 1 + 1.6p + (1.70667)p^2.
Then multiply: (1 - 2p + (76/75)p^2)(1 + 1.6p + 1.70667p^2) = 1 + (1.6-2)p + [1.70667 + (-2)(1.6) + (76/75)]p^2 = 1 -0.4p + [1.70667 -3.2 + 1.01333]p^2 = 1 -0.4p + (-0.48)p^2 = 1 -0.4p -0.48p^2.
So F_logical^2 = 1 - 0.4p - 0.48p^2.
Then F_logical = sqrt(1 - 0.4p - 0.48p^2) ≈ 1 - 0.2p - (0.48/2 + (0.4)^2/8?) actually, sqrt(1-x) ≈ 1 - x/2 - x^2/8 with x=0.4p+0.48p^2. So that is 1 -0.2p -0.24p^2 - (0.16p^2)/8? actually, careful: x = 0.4p + 0.48p^2. Then x^2 = 0.16p^2 + … so term becomes -x^2/8 = -0.02p^2 approximately. So F_logical ≈ 1 - 0.2p - 0.26p^2. So for p=0.1, that gives 1 - 0.02 - 0.0026 = 0.9774, which is not what I computed earlier. I need to recompute carefully the numbers for p=0.1:
P(S_code) = 1 - 20.1 + (76/75)0.01 = 1 - 0.2 + (1.01333)0.01 = 0.8 + 0.0101333 = 0.8101333.
P(N) = 1 - 1.60.1 + (64/75)0.01 = 1 - 0.16 + (0.85333)*0.01 = 0.84 + 0.0085333 = 0.8485333.
Ratio = 0.8101333/0.8485333 = 0.9547.
So that ratio is actually F_logical^2 because that is the probability that the state is ideal conditioned on success. So F_logical = sqrt(0.9547) = 0.9771. So that means that F_logical^2 should be 0.9547, not 1 - 0.4p -0.48p^2 because that would give 1 - 0.04 - 0.0048 = 0.9552, actually that is very close actually. 0.9552 is close to 0.9547. So that series is correct. So then F_logical^2 = 1 - 0.4p - 0.48p^2. So then to first order, F_logical^2 = 1 - 0.4p, so F_logical = 1 - 0.2p. So that means that the logical infidelity is 0.2p to first order. That is even better improvement relative to physical infidelity which was 0.8p. So that makes sense: post-selection reduces the infidelity by a factor of 4.
Now, note that 0.2p = (1/5)p. And 0.4p = (2/5)p. So then likely the intended result is that the logical state fidelity is 1 - (1/5)p. But wait, is that fidelity or fidelity squared? If fidelity is defined as the square root of the overlap, then physical fidelity would be sqrt((1-4/5p)^2) = 1-4/5p. So physical infidelity is 0.8p. Then logical infidelity becomes 0.2p. So that is consistent: post-selection improves infidelity by factor of 4.
So I will go with that: physical fidelity = 1 - (4/5)p and logical fidelity after post-selection = 1 - (1/5)p.
But wait, that is only first order. The first subproblem gave an exact expression though: physical fidelity = (1 - 12/15 p)^2 = (1 - 4/5 p)^2. So that suggests that they are using fidelity as the success probability itself, not the square root. because then physical infidelity would be 1 - (1 - 4/5p)^2 = 8/5p - … actually that is not linear. If fidelity = (1 - 4/5p)^2, then for small p, that is 1 - 8/5p. So then physical infidelity would be 1.6p. Then logical infidelity would be? from our ratio, logical fidelity squared would be that ratio itself because that is the probability of being ideal conditioned on success. So that would be 1 - 0.4p approximately, so logical infidelity would be 0.4p. Then that is also a factor of 4 improvement. So that is consistent if we define fidelity as the square of the usual fidelity. I need to know the convention. The problem says “physical state fidelity”. Often that is F = sqrt(tr(ρ|ψ><ψ|)). So that would be the square root of the probability. I will check the first subproblem statement: “What is the physical state fidelity of the final physical 4-qubit state”. That is likely that they want the fidelity between the actual state and the ideal state. That is usually between 0 and 1. If there is no error, fidelity=1. If there is a small error, fidelity is close to 1. So if fidelity is defined as that, then for small p, fidelity should be 1 - something*p. My physical fidelity came out as [1 - (4/5)p]^2 from the idea that the state is ideal with probability that. But wait, if the state is ideal with probability that, then the fidelity is actually the square root of that probability because fidelity is not linear in probability when there are phases? Actually, if the state is a mixture where with probability q it is the ideal state and with probability 1-q it is orthogonal states, then the fidelity is sqrt(q). So that would give fidelity = 1 - (4/5)p. So that suggests that physical fidelity = 1 - (4/5)p. Then logical fidelity would be sqrt(0.9547) = 0.9771 for p=0.1, which is 1 - 0.0229, so logical infidelity is 0.229p actually since p=0.1 gives 0.0229, so that is about 0.229p, not exactly 0.2p but close enough. actually, 1 - 0.9771 = 0.0229, so that is 0.229p when p=0.1. So that would be 1 - 0.229p approximately. That doesn’t simplify to a nice fraction like 1/5.
Given that the first subproblem’s answer was given as something very specific: (1 - 12/15 p)^2. That is likely the intended answer for physical fidelity. So I will assume that fidelity is defined as the success probability itself (i.e., the probability that the state is ideal). Then physical fidelity = (1 - 12/15 p)^2 = (1 - 4/5 p)^2.
Then logical fidelity after post-selection is that conditional probability itself, which is [1 - 2p + p^2/75] / [1 - (8/5)p + (64/75)p^2]. That doesn’t simplify nicely. But wait, could it be that logical fidelity = (1 - 4/15 p)^2? because then that would be 1 - 8/15 p + … that is not that either.
Maybe the intended result is that the logical fidelity becomes 1 because post-selection removes all errors. That is possible if the only errors that are undetectable are those that are actually in the stabilizer group. Is that true? Check: Can an error be undetectable but not in the stabilizer group? For example, consider an error on qubits 1 and2 that is XX. That is undetectable because it commutes with both stabilizers? actually, check XX on qubits 1 and2: commute with XXXX? yes. commute with ZZZZ? yes. So that error is undetectable. But is it in the stabilizer group? The stabilizer group is {I, XXXX, ZZZZ, YYYY}. XX on qubits 1 and2 is not that because that would require that on qubits 0 and3 also be XX to become XXXX. So that error is undetectable but not in the stabilizer group. So post-selection would keep that error, and that error would actually change the logical state because it acts as a logical operator. So then logical fidelity is not 1.
Given the first subproblem’s answer is provided by the user, I will use that. So then for the second subproblem, I’ll compute the logical fidelity as that conditional probability. And that conditional probability is actually independent of p? What if p is very small? Then logical fidelity ≈ (1-2p)/(1-1.6p) = 1 - 0.4p. So that would be 1 - (2/5)p. So then physical fidelity is (1-4/5p)^2 = 1 - 8/5p + … So then the improvement is that the infidelity goes from 8/5p to 2/5p, factor of 4 improvement. So then logical fidelity = 1 - (2/5)p to first order. That is a nice number. So I will state that to first order in p, the logical fidelity is 1 - (2/5)p. But wait, that is fidelity squared because that is the probability itself. If fidelity is defined as that probability, then yes.
I will check with p=0.1: then physical fidelity = (1 - 0.08)^2 = (0.92)^2 = 0.8464. Logical fidelity = 1 - 0.04 = 0.96. And indeed, 0.96 is close to 0.9547? Actually, 0.96 is a bit higher than 0.9547. The next term would reduce it to 0.9547, so that is consistent with series expansion.
I think I’ll go with that. So the logical state fidelity after post-selection is approximately 1 - (2/5)p for small p. But wait, that is not an exact function of p though. The problem asks for “as a function of the two-qubit gate error rate p”. So they might want an exact expression. That exact expression is messy.
Maybe it simplifies somehow?
F_logical = [1 - 2p + p^2/75] / [1 - (8/5)p + (64/75)p^2] actually careful: that is for the probability itself. But that is not a perfect square generally.
Given that the first answer was very neat, I suspect the second answer might also be neat. What if the logical fidelity is actually (1 - 4/15 p)^2? Then that would be 1 - 8/15 p + … that is not that.
wait, could it be that I made a mistake with P(N)? Let’s recompute P(N) carefully by actually counting the number of Pauli errors that yield undetectable errors. maybe that will yield a nice number.
For each gate, the probability distribution is:
P(I) = 1-p.
P( any specific non-I) = p/15.
Now, E_total is in N(S) if it commutes with both stabilizers. Equivalently, its symptoms are trivial. The symptoms are determined by whether it anticommutes with XXXX and ZZZZ. notice that these conditions factorize over the two gates because they act on disjoint sets? Actually, careful: whether E_total commutes with XXXX depends on both parts. But maybe we can compute the probability that a given gate’s error is such that it has a certain syndrome with respect to the stabilizers when combined with identity on the other gate? Not sure.
Maybe I can compute P(N) by instead computing the probability that an error is detectable and then subtract from 1. The probability that an error is detectable is easier? Errors are detectable if they anticommute with至少 one stabilizer. But that probability is not independent across gates because it involves both gates.
I will compute P(N) by using the mod2 method seems correct because it only depends on the parities. And that gave me that for each gate, the chance to have (0,0) is 1-p + 3p/15 = 1 - p + p/5 = 1 - 4p/5.
And the chance to have (0,1) is 4p/15, etc. So that seems right.
Then P(N) = (1-4p/5)^2 + 3(4p/15)^2 = 1 - 8p/5 + 16p^2/25 + 316p^2/225 = 1 - 8p/5 + 16p^2/25 + 48p^2/225 = 1 - 8p/5 + (144/225)p^2 + (48/225)p^2 = 1 - 8p/5 + (192/225)p^2 = 1 - 8p/5 + (64/75)p^2. So that is correct.
P(S_code) = probability that E_total is in {I, XXXX, ZZZZ, YYYY}. That requires that on both gates, the Pauli is either I or else must be such that they are the same specific type? actually careful: For E_total to be XXXX, we need that on gate2 (0,3) is XX and on gate1 (1,2) is XX. So that probability is (p/15)^2.
Similarly for ZZZZ and YYYY: total 3*(p/15)^2.
Plus both identity: (1-p)^2.
So that is (1-p)^2 + 3p^2/225 = 1 - 2p + p^2 + p^2/75 = 1 - 2p + (76/75)p^2. So that is correct.
So then the ratio is not a perfect square unless something cancels. What if I also include that would happen if somehow that p^2 term became something like? If it were (1-p)^2 + something else would become (1-4p/5)^2 would require that something else gives -8p/5 already wait, (1-4p/5)^2 = 1 - 8p/5 + 16p^2/25 = 1 - 8p/5 + (144/225)p^2. So for that to happen, we would need that P(S_code) has that form too. But it doesn’t because its linear term is -2p, not -8p/5. So that doesn’t happen.
Given that the first subproblem’s answer was given by the user, I will trust that. So then for the second subproblem, I’ll state that the logical fidelity after post-selection is
F_logical = [1 - 2p + (76/75)p^2] / [1 - (8/5)p + (64/75)p^2].
But that is not very nice.
Maybe the intended result is that because post-selection removes all errors that are detected, the only errors that remain are those that are in the normalizer. wait, could it be that actually, upon post-selection, we also project onto the code space? That might then change the state? I recall that in error detection, if you measure the stabilizers and they are +1, then the state is projected onto the code space. So that projection might actually improve the fidelity further because it would suppress components that are not in the code space. But wait, that is what post-selection means: we only keep runs where the stabilizers are +1. So that means that the state after post-selection is actually the conditional state given that outcome. That conditional state would be that obtained by applying the projector onto the code space to the state. That might actually increase the fidelity because even if there is an error that is detectable, it would be projected out. So that is what we did.
I will check with a very simple case: suppose only one error occurs on step2 that is detectable. That state would be outside the code space. So it would be discarded. So that is correct.
I think I’ll go with the result that seems most consistent with the first part. The first part gave that physical fidelity = (1 - 12/15 p)^2 = (1 - 4/5 p)^2.
So then likely the logical fidelity after post-selection is also something like that. What would it be? If it were (1 - 4/15 p)^2, then that would be 1 - 8/15 p + … that doesn’t match.
If it were (1 - 2/5 p)^2, then that is 1 - 4/5 p + 4/25 p^2. That is close to our first-order term because our first-order term in the ratio is 1 - (2p - 8/5p) = 1 - (2/5)p actually careful: when doing series for the ratio, we have numerator ~ 1 - 2p, denominator ~ 1 - 1.6p, so ratio ~ 1 - 0.4p. So that would require that the fidelity itself is 1 - 0.4p, not its square. So if physical fidelity is squared something, then logical fidelity should be that something itself. So then physical fidelity = (1 - 4/5 p)^2 means that without post-selection, the state is ideal with probability (1-4/5p)^2. Then the fidelity would be 1-4/5p. Then with post-selection, the logical fidelity becomes the conditional probability that it is ideal given that it is in the code space. That conditional probability is [1 - 2p + (76/75)p^2] / [1 - (8/5)p + (64/75)p^2]. Its series is 1 - (2 - 1.6)p = 1 - 0.4p. So then the logical fidelity would be 1 - 0.4p. So then the infidelity improves from 0.8p to 0.4p. That is a factor of 2 improvement, not 4. And that seems more likely because often error detection improves things by a factor related to the distance. Since this code has distance 2, it might improve by a factor of 2. I will check with p=0.1: then physical fidelity would be 1 - 0.08 = 0.92. Logical fidelity would be 1 - 0.04 = 0.96. And indeed, 0.96 is what I got from the conditional probability? Actually, wait, conditional probability was 0.8101333/0.8485333 = 0.9547, not 0.96. So that suggests that actually, if physical fidelity is 1-4/5p, then for p=0.1, that is 0.92. Then logical fidelity would be 0.96 would require that the conditional probability is 0.96^2? No, careful: If fidelity is defined as the overlap itself, then for a state that is with probability q the ideal state and with probability 1-q orthogonal states, the fidelity is sqrt(q). So if physical fidelity is 0.92, then q would be 0.92^2 = 0.8464. And that matches our P(S_code) for p=0.1 because that was 0.8101333? Actually, wait, 0.92^2 = 0.8464. Our P(S_code) for p=0.1 was 0.8101333. So there’s a discrepancy. I need to determine this clearly.
Let’s determine physical fidelity from scratch. physical fidelity F_physical = sqrt(⟨ψ|ρ|ψ⟩). ρ is the state after the circuit with errors.由于 errors are Pauli errors, they either leave |ψ⟩ invariant or make it orthogonal. So ⟨ψ|ρ|ψ⟩ = probability that the overall error is in the stabilizer of |ψ⟩. So that probability is what I called P(S_ψ). And I earlier argued that S_ψ actually is much larger than S_code. Because wait, is it true that if an error is in S_ψ, then it leaves |ψ⟩ invariant? That requires that error|ψ⟩ = |ψ⟩ up to phase. So what is S_ψ? determine S_ψ for |ψ⟩ = 1/2(|0000⟩+|1001⟩+|0110⟩+|1111⟩). What Paulis leave this state invariant? clearly, XXXX does. also, ZZZZ does. also, any Pauli that acts only on qubits 1 and2 that is XX, YY, ZZ will leave it invariant as we checked. Also, any Pauli that acts only on qubits 0 and3 that is XX, YY, ZZ will leave it invariant. Also, products thereof will leave it invariant. So indeed, S_ψ consists of errors that are in the set where on {0,3} the Pauli is in {I, XX, YY, ZZ} and on {1,2} the Pauli is in {I, XX, YY, ZZ}. So that set has size 44=16. So then P(S_ψ) = [P(gate2 yields in {I,XX,YY,ZZ}] * [P(gate4 yields in {I,XX,YY,ZZ}] because these independent. And that is [1-p + p(3/15)]^2 = [1 - p + p/5]^2 = [1 - 4p/5]^2. So then physical fidelity F_physical = sqrt(P(S_ψ)) = 1 - 4p/5. So that means that for small p, physical infidelity is 0.8p. For p=0.1, that gives fidelity 0.92. That seems right.
Now, after post-selection, we only keep states that are in the code space. That means that we require that the error is in N(S_code), not S_ψ. because S_ψ is larger than N(S_code)? Is that true? What is N(S_code)? S_code is generated by XXXX and ZZZZ. So N(S_code) consists of Paulis that commute with these. That condition is that the number of qubits with Pauli in {Z,Y} is even and number with {X,Y} is even. Is that conditions enough to ensure that the state is in the code space? actually, if an error is in N(S_code), then it will map the code space to itself. So yes. So after post-selection, we only keep errors that are in N(S_code). So then the success probability is P(N). And that we computed as 1 - 8p/5 + (64/75)p^2.
Within that, the state will be ideal if the error is in S_ψ actually because that is what leaves |ψ⟩ invariant. But wait, careful: If an error is in N(S_code) but not in S_ψ, then it will map |ψ⟩ to some other state in the code space. So then the conditional probability that the state is ideal given that it is in the code space is P(S_ψ ∩ N(S_code)) / P(N(S_code)). But note that S_ψ is actually inside N(S_code)? Is that true? Check: take an error in S_ψ, say XX on {1,2} only. That is in S_ψ. Is it in N(S_code)? For that, we need that it commutes with XXXX and ZZZZ. XX on {1,2} commutes with XXXX because that is X on all, so okay. It commutes with ZZZZ because that gives signs? actually, careful: ZZZZ has Z on qubits 1 and2. XX anticommutes with Z on each qubit, so overall product of signs: (-1)(-1)=1, so yes it commutes. So S_ψ is inside N(S_code). So then conditional probability = P(S_ψ) / P(N(S_code)) because S_ψ ⊆ N(S_code). But wait, is that true? Could there be an error in N(S_code) that is not in S_ψ? Yes, plenty. So then the logical fidelity after post-selection is actually F_logical = sqrt(P(S_ψ) / P(N(S_code)) ) because conditional state would have weight only from those errors in S_ψ. So that is sqrt([1-4p/5]^2 / [1 - 8p/5 + (64/75)p^2]) = (1-4p/5) / sqrt(1 - 8p/5 + (64/75)p^2). For small p, that is (1-4p/5) / (1 - 4p/5 + (64/75)/(2(1)) actually careful: sqrt(1 - 8p/5 + (64/75)p^2) = 1 - 4p/5 + … Let’s do series: sqrt(1 + αp + βp^2) = 1 + α/2 p + (β/2 - α^2/8)p^2. Here α = -8/5, so α/2 = -4/5. β = 64/75. So then sqrt = 1 -4p/5 + (64/75/2 - (64/25)/8)p^2 = 1 -4p/5 + (32/75 - 64/200)p^2 = 1 -4p/5 + (32/75 - 0.32)p^2. 64/200=0.32 exactly, and 32/75=0.42667, so that gives 0.10667p^2. So then F_logical = (1-4p/5) / (1-4p/5 + 0.10667p^2) ≈ 1 - 0.10667p^2/(1-4p/5) which is 1 - 0.10667p^2. So that would mean that to first order, F_logical = 1 - 4p/5? That doesn’t cancel because both numerator and denominator have 1-4p/5. Actually, wait, they cancel exactly to first order: (1-4p/5)/(1-4p/5) = 1. So actually, F_logical = 1 + ( something)p^2. Let’s do carefully:
F_logical = (1 - 4p/5) / sqrt(1 - 8p/5 + (64/75)p^2). square both sides: F_logical^2 = (1 - 4p/5)^2 / (1 - 8p/5 + (64/75)p^2) = (1 - 8p/5 + 16p^2/25) / (1 - 8p/5 + (64/75)p^2). now 16/25 = 48/75. So that is = 1 - (8p/5 -8p/5) actually careful: actually, it is = 1 + (16/25 - 64/75)p^2 / (1 - 8p/5 + (64/75)p^2) = 1 + (48/75 - 64/75)p^2/(Denom) = 1 - (16/75)p^2/(Denom). So for small p, Denom close to 1, so F_logical^2 = 1 - (16/75)p^2. Then F_logical = 1 - (8/75)p^2 approximately. So that would mean that to first order, F_logical = 1. That is because post-selection actually removes all first-order errors? because any single-gate error that is in S_ψ would actually be undetectable? But wait, if only one gate has an error that is in S_ψ, that error is undetectable? Check: If step2 has XX error, that is in S_ψ. Is it in N(S_code)? Yes, it is. So then that would survive post-selection. So then there should be a first-order term in the logical infidelity. So this approach suggests that F_logical^2 = physical fidelity^2 / P(N). physical fidelity^2 = (1-4p/5)^2 = 1 - 8p/5 + 16p^2/25. P(N) = 1 - 8p/5 + (64/75)p^2. So then the ratio is 1 - (8p/5 cancels) actually they cancel exactly in the linear term. So that means that to first order, the conditional probability is 1. because physical fidelity^2 and P(N) have the same first-order term: -8p/5. So that means that the leading order correction comes from the second order term. And that second order term difference is (16/25 - 64/75) = (48/75 - 64/75) = -16/75. So indeed, F_logical^2 = 1 - (16/75)p^2 + … So then F_logical = 1 - (8/75)p^2. So that would mean that post-selection actually makes the logical fidelity very close to 1, with infidelity scaling as p^2 rather than p. That is actually what I would expect from error detection: that it detects errors and so the only errors that survive are those that involve two or more errors that cancel out. wait, check: If only one gate has an error, that error will be on two qubits. Could that error be undetectable? For it to be undetectable, it must commute with both stabilizers. Is it possible that a single-gate error is undetectable? Yes, if that error is itself that it does not change the syndrome. For example, consider an error on step2 that is XX. does that commute with XXXX? yes. commute with ZZZZ? yes. So that error is undetectable. So then that means that there are first-order terms in P(N). But wait, then why does P(N) have a term -8p/5? That comes from when one gate has an error that is in the (0,0) category. And that probability is for each gate: probability of (0,0) is 1-p + p(3/15) = 1 - p + p/5 = 1 - 4p/5. So that means that if only one gate has an error, the chance that error is undetectable is actually p/5 per gate. So then P(N) should have terms from one-gate errors: that would be 2(1-p)(p/5) = 2p/5 - 2p^2/5. And then from no errors: (1-p)^2 = 1 - 2p + p^2. So that alone gives 1 - 2p + p^2 + 2p/5 - 2p^2/5 = 1 - (8/5)p + (3/5)p^2? because p^2 -2p^2/5 = (3/5)p^2. Then plus terms from both gates having errors that are undetectable would add more. So actually, wait, my earlier computation of P(N) using the mod2 method gave that it is the probability that both gates have the same mod2 value. That includes when one gate is identity and the other is (0,0) actually identity is (0,0). So that gives that term correctly. So then P(N) = (1-p)^2 + 2(1-p)(p/5) + … actually careful: The chance that a gate yields (0,0) is 1 - 4p/5. So if they are independent, then P(both yield (0,0)) would be (1-4p/5)^2 = 1 - 8p/5 + 16p^2/25. But that is not equal to P(N) because P(N) also includes when both yield (0,1) etc. So actually, P(N) = (1-4p/5)^2 + 3(4p/15)^2 = 1 - 8p/5 + 16p^2/25 + 3(16p^2/225) = 1 - 8p/5 + 16p^2/25 + 48p^2/225 = 1 - 8p/5 + (144/225)p^2 + (48/225)p^2 = 1 - 8p/5 + (192/225)p^2 = 1 - 8p/5 + (64/75)p^2. So that is correct. So then the term linear in p comes from expanding (1-4p/5)^2 gives -8p/5. So that means that actually, if only one gate has an error that is in (0,0), that is included in (1-4p/5)^2 because that is (1-p)(1-4p/5) wait careful: (1-4p/5) is not simply related to one-gate errors because that includes the no-error case as well. Actually, (1-4p/5) = (1-p) + (p/5). So then (1-4p/5)^2 = (1-p)^2 + 2(1-p)(p/5) + (p/5)^2. So that gives the contribution from events where both gates yield (0,0) actually that is when they are both in that set. But wait, that set includes identity and the three Paulis that are (0,0). So that term actually is the probability that both gates yield something in {I, XX, YY, ZZ}. But that is actually P(S_ψ) because that is what makes the state ideal. So indeed, P(S_ψ) = (1-4p/5)^2 = 1 - 8p/5 + 16p^2/25.
And P(N) is that plus additional terms from when both gates yield errors that are not in {I,XX,YY,ZZ} but still have the same mod2 value. Those additional terms are when both yield (0,1) gives probability (4p/15)^2, and similarly for (1,0) and (1,1). So that adds up to 3(16p^2/225)=48p^2/225 = 16p^2/75.
So then P(N) = P(S_ψ) + 16p^2/75 = 1 - 8p/5 + 16p^2/25 + 16p^2/75 = 1 - 8p/5 + (48/75)p^2 + (16/75)p^2 = 1 - 8p/5 + (64/75)p^2. So that is consistent.
So then the conditional probability that the state is ideal given that it is in the code space is P(S_ψ)/P(N) = [1 - 8p/5 + 16p^2/25] / [1 - 8p/5 + 64p^2/75] = 1 - [16/25 - 64/75]p^2 / (1 - 8p/5 + …) = 1 - [48/75 - 64/75]p^2 = 1 - (-16/75)p^2? Actually, 16/25 = 48/75, so difference = (48/75 - 64/75) = -16/75. So that means that conditional probability = 1 + (16/75)p^2? That would be greater than 1 for small p, which is impossible. I must careful:
P(S_ψ) = 1 - 8p/5 + (16/25)p^2.
P(N) = 1 - 8p/5 + (64/75)p^2.
So for small p, near p=0, both are 1 - 8p/5. So their ratio is 1 + [ (16/25) - (64/75) ]p^2 / (1 - 8p/5) actually wait, when two functions have the same first order term, their ratio is 1 + ( second order difference )p^2. Here, second order of P(S_ψ) is 16/25 = 48/75. Second order of P(N) is 64/75. So then P(S_ψ)/P(N) = 1 + (48/75 - 64/75)p^2 = 1 - (16/75)p^2. So that is correct. So then the conditional probability that the state is ideal given success is 1 - (16/75)p^2. So then the logical fidelity would be the square root of that because fidelity is the overlap itself. So then F_logical = sqrt(1 - (16/75)p^2) ≈ 1 - (8/75)p^2.
So that means that to first order in p, the logical fidelity after post-selection is actually 1. That is because the first-order terms cancel out. That makes sense because any single-gate error that is undetectable would actually be in S_ψ? Is that true? If only one gate has an error, say step2 has an error that is in {XX, YY, ZZ}. That error is undetectable because it commutes with stabilizers. But wait, would that error leave the state ideal? If step2 has XX error and step4 has no error, then the overall error is I0 XX I3. Is that in S_ψ? For it to be in S_ψ, we need that on {0,3} the Pauli is in {I,XX,YY,ZZ} and on {1,2} also. Here, on {0,3} it is II which is okay, and on {1,2} it is XX which is okay. So yes, that is in S_ψ. So actually, single-gate errors that are undetectable are actually in S_ψ. So then why does P(S_ψ) have a term -8p/5? That comes from events where one gate has an error and the other is identity. That probability is 2(1-p)(p/5) = 2p/5 - 2p^2/5. And then plus no errors gives (1-p)^2 = 1 - 2p + p^2. So that adds to 1 - 2p + p^2 + 2p/5 - 2p^2/5 = 1 - (8/5)p + (3/5)p^2. But wait, that is not what we got for P(S_ψ) because we got P(S_ψ) = (1-4p/5)^2 = 1 - 8p/5 + 16p^2/25. And 16/25 = 0.64, while 3/5 = 0.6. So there is a difference of 0.04p^2 coming from events where both gates have errors that are in S_ψ. Those events have probability (p/5)^2 = p^2/25 = 0.04p^2. So that checks out. So indeed, single-gate errors that are in S_ψ contribute to the linear term in P(S_ψ). So then why would they cancel with P(N)? Because P(N) also includes single-gate errors that are undetectable. But wait, are all single-gate errors that are undetectable in S_ψ? What makes an error undetectable? For a single-gate error on step2, it is undetectable if its mod2 is (0,0). That means it must be in {XX, YY, ZZ}. So yes, all single-gate errors that are undetectable are in S_ψ. So then actually, P(N) should also have a linear term from single-gate errors. And that linear term would be also 2(1-p)*(p/5) = 2p/5 - 2p^2/5. So then both P(S_ψ) and P(N) have the same linear term. So that means that to first order, the conditional probability P(S_ψ)/P(N) is 1. So that means that actually, post-selection removes all first-order errors. because any error that occurs on only one gate that is undetectable actually leaves the state ideal. Is that true? Check: If only step2 has an error that is XX, then we already checked that leaves the state ideal. If