Checkpoint-2

System #0

You are a physics research assistant specializing in solving complex, research-level problems using precise, step-by-step reasoning.

Input Problems will be provided in Markdown format.

Output (Markdown format)

  1. Step-by-Step Derivation - Show every non-trivial step in the solution. Justify steps using relevant physical laws, theorems, or mathematical identities.
  2. Mathematical Typesetting - Use LaTeX for all mathematics: $...$ for inline expressions, $$...$$ for display equations.
  3. Conventions and Units - Follow the unit system and conventions specified in the problem.
  4. Final Answer - At the end of the solution, start a new line with “Final Answer:”, and present the final result.

    For final answers involving values, follow the precision requirements specified in the problem. If no precision is specified: - If an exact value is possible, provide it (e.g., \$\sqrt(2)\$, \$\pi/4\$). - If exact form is not feasible, retain at least 12 significant digits in the result.

  5. Formatting Compliance - If the user requests a specific output format (e.g., code, table), provide the final answer accordingly.

User #1

Problem setup:

In quantum error correction, you encode quantum states into logical states made of many qubits in order to improve their resilience to errors. In quantum error detection, you do the same but can only detect the presence of errors and not correct them. In this problem, we will consider a single [[4,2,2]] quantum error detection code, which encodes two logical qubits into four physical qubits, and investigate how robust logical quantum operations in this code are to quantum errors.

Our convention is that the four physical qubits in the [[4,2,2]] code are labelled 0,1,2,3. The two logical qubits are labelled A and B. The stabilizers are \(XXXX\) and \(ZZZZ\), where \(X\) and \(Z\) are Pauli matrices. The logical \(X\) and \(Z\) operators on the two qubits are \(X_A = XIXI\), \(X_B=XXII\), \(Z_A = ZZII\), \(Z_B = ZIZI\), up to multiplication by stabilizers.

We will consider different state preparation circuits consisting of controlled not \(CNOT_{ij}\) gates, where \(CNOT_{ij}\) has control qubit \(i\) and target qubit \(j\). As a simple model of quantum errors in hardware, we will suppose that each \(CNOT_{ij}\) gate in the circuit has a two qubit depolarizing error channel following it that produces one of the 15 non-identity two-qubit Paulis with equal probability \(p/15\). The probability \(p\) indicates the probability of an error in a single two-qubit gate. We will assess the logical infidelity of certain state preparation protocols as a function of the physical infidelity \(p\).

Checkpoint 1

Suppose that we wish to prepare a logical two-qubit GHZ state \((|00\rangle_{AB}+|11\rangle_{AB})/\sqrt{2}\) in the [[4,2,2]] code. To do so, we use the following state preparation circuit:

\[ (CNOT_{03}) (H_0) (CNOT_{21}) (H_2). \]

Note that this equation is written in matrix multiplication order, while the quantum operations in the circuit occur in the reverse order (from right-to-left in the above equation). \(H\) is a single-qubit Hadamard gate.

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\)?

Assistant #2
Reasoning (model)

Calculating the Fidelity of a 4-Qubit GHZ State

Okay, here’s my breakdown of how I’d approach this problem. It’s about figuring out the fidelity of a GHZ state created by a specific quantum circuit when we introduce errors.

1. Setting the Stage:

  • What we want: Calculate the fidelity (\(F\)) of the actual state produced by a circuit with errors against the ideal (error-free) GHZ state.
  • The Code: A [[4,2,2]] quantum error detection code. We have 4 qubits that can represent 2 logical qubits with a distance of 2.
    • Stabilizers: \(S_1 = X_0X_1X_2X_3\) and \(S_2 = Z_0Z_1Z_2Z_3\).
    • Logical operators: \(X_A, X_B, Z_A, Z_B\).
  • The Goal State: A GHZ state, which can be thought of as a superposition of all qubits being zero and all qubits being one: \((|00\rangle_{AB}+|11\rangle_{AB})/\sqrt{2}\).
  • The Circuit: We’re applying the circuit \((CNOT_{03}) (H_0) (CNOT_{21}) (H_2)\). This means:
    1. Apply a Hadamard gate (\(H\)) on qubit 2.
    2. Apply a CNOT gate with qubit 2 as the control and qubit 1 as the target.
    3. Apply a Hadamard gate on qubit 0.
    4. Apply a CNOT gate with qubit 0 as the control and qubit 3 as the target.
  • The Errors: Each CNOT gate introduces a two-qubit depolarizing error channel (\(\mathcal{E}\)). The error channel’s probability is ‘p’, and it causes equal probability of one of 15 non-identity Pauli operators on the two qubits. \(\mathcal{E}(\rho) = (1-p)\rho + \frac{p}{15} \sum_{P \in \{I,X,Y,Z\}^{\otimes 2} \setminus \{II\}} P \rho P^\dagger\).
  • Starting Point: Almost certainly, we start with the all-zero state: \(|0000\rangle\).

2. The Plan:

  1. Find the Ideal State: Figure out the perfect GHZ state created by the error-free circuit, call it \(|\psi_{ideal}\rangle\).
  2. Model the Errors: Determine the actual final state, considering the error channel after each CNOT operation. This is \(\rho_{actual}\).
  3. Calculate Fidelity: Use the fidelity formula: \(F = \langle \psi_{ideal} | \rho_{actual} | \psi_{ideal} \rangle\).

3. The Ideal State:

  • \(|\psi_0\rangle = |0000\rangle\).
  • Apply the gates in order:
    • \(H_2\) on \(|0000\rangle\): \(\frac{1}{\sqrt{2}}(|0000\rangle+|0010\rangle)\).
    • \(CNOT_{21}\): \(\frac{1}{\sqrt{2}}(|0000\rangle+|0110\rangle)\).
    • \(H_0\): \(\frac{1}{2}(|0000\rangle+|1000\rangle+|0110\rangle+|1110\rangle)\).
    • \(CNOT_{03}\): \(\frac{1}{2}(|0000\rangle+|1001\rangle+|0110\rangle+|1111\rangle)\).
    • This final state IS the GHZ state for this code. We’ve got it. It is \(\frac{1}{2}(|0000\rangle+|1001\rangle+|0110\rangle+|1111\rangle)\).

4. Modeling Errors & Calculating Fidelity:

I decided this would be easiest to manage in an event-based way: * We can have: * Case 0: No Errors: Probability \((1-p)^2\) * Case 1: Error at the First CNOT Only: Probability \(p(1-p)\) * Case 2: Error at the Second CNOT Only: Probability \((1-p)p\) * **Case 3: Error at Both

Step-by-Step Derivation

The goal is to compute the physical state fidelity \(F = \langle \psi_{ideal} | \rho_{actual} | \psi_{ideal} \rangle\) of the final state of a 4-qubit system prepared by a given circuit, subject to a specific error model.

1. Determine the Ideal Final State \(|\psi_{ideal}\rangle\)

The circuit operations are applied from right to left to the initial state \(|\psi_0\rangle = |0000\rangle\). The circuit is \(U = (CNOT_{03}) (H_0) (CNOT_{21}) (H_2)\).

  1. Initial state:
\[ |\psi_0\rangle = |0000\rangle \]
  1. Apply \(H_2\) (Hadamard on qubit 2):
\[ |\psi_1\rangle = H_2 |\psi_0\rangle = |00\rangle_01 \otimes \frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)_2 \otimes |0\rangle_3 = \frac{1}{\sqrt{2}}(|0000\rangle + |0010\rangle) \]
  1. Apply \(CNOT_{21}\) (control qubit 2, target qubit 1): The control qubit is qubit 2. The target qubit is qubit 1.
\[ CNOT_{21}|0000\rangle = |0000\rangle \quad (\text{control is } |0\rangle) \]
\[ CNOT_{21}|0010\rangle = |0110\rangle \quad (\text{control is } |1\rangle, \text{flips target}) \]
Applying this to $|\psi_1\rangle$:
\[ |\psi_2\rangle = CNOT_{21} |\psi_1\rangle = \frac{1}{\sqrt{2}}(|0000\rangle + |0110\rangle) \]
  1. Apply \(H_0\) (Hadamard on qubit 0):
\[ |\psi_3\rangle = H_0 |\psi_2\rangle = \frac{1}{\sqrt{2}} \left( \frac{|0\rangle+|1\rangle}{\sqrt{2}}|000\rangle + \frac{|0\rangle+|1\rangle}{\sqrt{2}}|110\rangle \right) = \frac{1}{2}(|0000\rangle + |1000\rangle + |0110\rangle + |1110\rangle) \]
  1. Apply \(CNOT_{03}\) (control qubit 0, target qubit 3):
\[ CNOT_{03}|0000\rangle = |0000\rangle \]
\[ CNOT_{03}|1000\rangle = |1001\rangle \]
\[ CNOT_{03}|0110\rangle = |0110\rangle \]
\[ CNOT_{03}|1110\rangle = |1111\rangle \]
Applying this to $|\psi_3\rangle$ gives the ideal final state:
\[ |\psi_{ideal}\rangle = CNOT_{03} |\psi_3\rangle = \frac{1}{2}(|0000\rangle + |1001\rangle + |0110\rangle + |1111\rangle) \]

2. Analyze the Error Model and Fidelity Calculation Strategy

The error model states that after each of the two \(CNOT\) gates, a two-qubit depolarizing error channel is applied. The channel for a state \(\rho\) is:

\[ \mathcal{E}(\rho) = (1-p)\rho + \frac{p}{15} \sum_{P \in \{I,X,Y,Z\}^{\otimes 2} \setminus \{II\}} P \rho P^\dagger \]

where \(p\) is the total probability of an error.

We can calculate the fidelity by considering the four mutually exclusive events for the two \(CNOT\) gates: * Event 0 (NN): No error on either gate. * Event 1 (EN): Error on the first \(CNOT\) (\(CNOT_{21}\)), no error on the second (\(CNOT_{03}\)). * Event 2 (NE): No error on the first \(CNOT\), error on the second. * Event 3 (EE): Error on both \(CNOT\) gates.

The total fidelity is the sum of the fidelities from each event, weighted by the probability of that event:

\[ F = P(NN)F_{NN} + P(EN)F_{EN} + P(NE)F_{NE} + P(EE)F_{EE} \]

The probability of no error on a gate is \((1-p)\), and the probability of an error is \(p\). * \(P(NN) = (1-p)^2\) * \(P(EN) = p(1-p)\) * \(P(NE) = (1-p)p\) * \(P(EE) = p^2\)

3. Calculate Fidelity for Each Event

  • Fidelity for Event 0 (NN): If no errors occur, the final state is \(|\psi_{ideal}\rangle\). The fidelity is \(F_{NN} = \langle\psi_{ideal}|\psi_{ideal}\rangle = 1\). Contribution to total fidelity: \((1-p)^2\).

  • Fidelity for Event 2 (NE): (This is simpler than Event 1, so we do it first) The circuit is error-free until after the final \(CNOT_{03}\). The state is \(|\psi_{ideal}\rangle\). An error \(P_{03} \in \{I,X,Y,Z\}^{\otimes 2} \setminus \{II\}\) then occurs on qubits 0 and 3 with probability \(p/15\). The final state is \(P_{03}|\psi_{ideal}\rangle\). The fidelity, conditioned on error \(P_{03}\) occurring, is \(|\langle\psi_{ideal}|P_{03}|\psi_{ideal}\rangle|^2\). We need to average this over the 15 possible errors:

\[ F_{NE} = \frac{1}{15} \sum_{P_{03} \neq II} |\langle\psi_{ideal}|P_{03}|\psi_{ideal}\rangle|^2 \]
The state $|\psi_{ideal}\rangle$ is an eigenstate of the code's stabilizers $S_1=XXXX$ and $S_2=ZZZZ$. An operator $P$ that anti-commutes with a stabilizer $S$ of a state $|\psi\rangle$ will have zero expectation value: $\langle\psi|P|\psi\rangle = \langle\psi|SPS|\psi\rangle = -\langle\psi|P|\psi\rangle = 0$. We only need to sum over Paulis $P_{03}$ that commute with both $S_1$ and $S_2$. These are $\{II, X_0X_3, Y_0Y_3, Z_0Z_3\}$.
Let's compute the expectation values:
\[ \langle\psi_{ideal}|X_0X_3|\psi_{ideal}\rangle = \frac{1}{4}(\langle0000|+\dots)(X_0X_3)(|0000\rangle+\dots) = \frac{1}{4}(\langle0000|+\dots)(|1001\rangle+|0000\rangle+|1111\rangle+|0110\rangle) = 1 \]
\[ \langle\psi_{ideal}|Y_0Y_3|\psi_{ideal}\rangle = \frac{1}{4}(\langle0000|+\dots)(Y_0Y_3)(|0000\rangle+\dots) = \frac{1}{4}(\langle0000|+\dots)(-1|1001\rangle-1|0000\rangle-1|0110\rangle-1|1111\rangle) = -1 \]
\[ \langle\psi_{ideal}|Z_0Z_3|\psi_{ideal}\rangle = \frac{1}{4}(\langle0000|+\dots)(|0000\rangle-|1001\rangle-|0110\rangle+|1111\rangle) = \frac{1}{4}(1-1-1+1) = 0 \]
The sum is $1^2 + (-1)^2 + 0^2 = 2$.
\[ F_{NE} = \frac{2}{15} \]
Contribution to total fidelity: $p(1-p)\frac{2}{15}$.
  • Fidelity for Event 1 (EN): An error \(Q_{21} \neq II\) occurs after \(CNOT_{21}\). The state becomes \(Q_{21}|\psi_2\rangle\). The rest of the circuit \(U_{rem} = CNOT_{03}H_0\) is applied, resulting in the state \(U_{rem}Q_{21}|\psi_2\rangle\). The ideal final state is \(|\psi_{ideal}\rangle = U_{rem}|\psi_2\rangle\). The fidelity, conditioned on error \(Q_{21}\), is \(|\langle\psi_{ideal}|U_{rem}Q_{21}|\psi_2\rangle|^2 = |\langle\psi_2|U_{rem}^\dagger U_{rem}Q_{21}|\psi_2\rangle|^2 = |\langle\psi_2|Q_{21}|\psi_2\rangle|^2\). We need to average this over the 15 possible errors \(Q_{21}\):
\[ F_{EN} = \frac{1}{15} \sum_{Q_{21} \neq II} |\langle\psi_2|Q_{21}|\psi_2\rangle|^2 \]
The state is $|\psi_2\rangle = \frac{1}{\sqrt{2}}(|0000\rangle+|0110\rangle) = |0\rangle_0 \otimes \frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)_{12} \otimes |0\rangle_3$. Let $|\Phi^+\rangle_{12} = \frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)_{12}$. The operator $Q_{21}$ acts on qubits 1 and 2, so $\langle\psi_2|Q_{21}|\psi_2\rangle = \langle\Phi^+_{12}|Q_{12}|\Phi^+_{12}\rangle$.
For a Bell state $|\Phi^+\rangle$, the non-zero expectation values for Pauli operators $P \neq II$ are:
\[ \langle\Phi^+|XX|\Phi^+\rangle = 1, \quad \langle\Phi^+|YY|\Phi^+\rangle = -1, \quad \langle\Phi^+|ZZ|\Phi^+\rangle = 1 \]
The sum is $1^2 + (-1)^2 + 1^2 = 3$.
\[ F_{EN} = \frac{3}{15} = \frac{1}{5} \]
Contribution to total fidelity: $p(1-p)\frac{3}{15}$.
  • Fidelity for Event 3 (EE): Error \(Q_{21}\) on the first gate, error \(P_{03}\) on the second. The final state is \(P_{03} U_{rem} Q_{21} |\psi_2\rangle\). Fidelity is \(|\langle\psi_{ideal}|P_{03} U_{rem} Q_{21}|\psi_2\rangle|^2 = |\langle\psi_2|U_{rem}^\dagger P_{03} U_{rem} Q_{21}|\psi_2\rangle|^2\). The state \(|\psi_2\rangle = |00\rangle_{03} \otimes |\Phi^+\rangle_{12}\). The operator \(U_{rem}^\dagger P_{03} U_{rem}\) acts on qubits 0,3 and \(Q_{21}\) acts on qubits 1,2. The expectation value factorizes:
\[ \langle\psi_2|U_{rem}^\dagger P_{03} U_{rem} Q_{21}|\psi_2\rangle = \langle 00|_{03} U_{rem}^\dagger P_{03} U_{rem} |00\rangle_{03} \cdot \langle\Phi^+_{12}|Q_{21}|\Phi^+_{12}\rangle \]
The first term is $\langle (U_{rem}|00\rangle_{03}) | P_{03} | (U_{rem}|00\rangle_{03}) \rangle$. Let's compute $U_{rem}|00\rangle_{03}$:
\[ U_{rem}|00\rangle_{03} = CNOT_{03}H_0|00\rangle_{03} = CNOT_{03}\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)_0|0\rangle_3 = \frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)_{03} = |\Phi^+\rangle_{03} \]
So, $\langle\psi_2|\dots|\psi_2\rangle = \langle\Phi^+_{03}|P_{03}|\Phi^+_{03}\rangle \cdot \langle\Phi^+_{12}|Q_{21}|\Phi^+_{12}\rangle$.
The average fidelity is:
\[ F_{EE} = \frac{1}{15^2} \sum_{P_{03}\neq II, Q_{21}\neq II} |\langle\Phi^+_{03}|P_{03}|\Phi^+_{03}\rangle \cdot \langle\Phi^+_{12}|Q_{21}|\Phi^+_{12}\rangle|^2 \]
\[ F_{EE} = \left(\frac{1}{15}\sum_{P\neq II}|\langle\Phi^+|P|\Phi^+\rangle|^2\right) \left(\frac{1}{15}\sum_{Q\neq II}|\langle\Phi^+|Q|\Phi^+\rangle|^2\right) = \left(\frac{3}{15}\right)\left(\frac{3}{15}\right) = \frac{9}{225} = \frac{1}{25} \]
Contribution to total fidelity: $p^2 \frac{9}{225}$.

4. Assemble the Total Fidelity

Summing the contributions from all four events:

\[ F = (1-p)^2 \cdot 1 + p(1-p) \cdot \frac{3}{15} + p(1-p) \cdot \frac{2}{15} + p^2 \cdot \frac{9}{225} \]
\[ F = (1-p)^2 + p(1-p)\left(\frac{3+2}{15}\right) + \frac{9p^2}{225} \]
\[ F = (1-p)^2 + p(1-p)\frac{5}{15} + \frac{p^2}{25} \]
\[ F = (1-2p+p^2) + \frac{p-p^2}{3} + \frac{p^2}{25} \]
\[ F = 1 + (-2+\frac{1}{3})p + (1-\frac{1}{3}+\frac{1}{25})p^2 \]
\[ F = 1 - \frac{5}{3}p + \left(\frac{75-25+3}{75}\right)p^2 \]
\[ F = 1 - \frac{5}{3}p + \frac{53}{75}p^2 \]

Final Answer: The physical state fidelity as a function of the two-qubit gate error rate \(p\) is:

\[ F(p) = 1 - \frac{5}{3}p + \frac{53}{75}p^2 \]
User #3

Checkpoint 2

Suppose that we wish to prepare a logical two-qubit GHZ state \((|00\rangle_{AB}+|11\rangle_{AB})/\sqrt{2}\) in the [[4,2,2]] code. To do so, we use the following state preparation circuit:

\[ (CNOT_{03}) (H_0) (CNOT_{21}) (H_2). \]

Note that this equation is written in matrix multiplication order, while the quantum operations in the circuit occur in the reverse order (from right-to-left in the above equation). \(H\) is a single-qubit Hadamard gate.

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?

Assistant #4
Reasoning (model)

Deconstructing and Solving for Logical Fidelity Under Post-Selection

My analysis begins by recognizing the core objective: calculating the logical state fidelity, which demands a different approach than the physical fidelity computed previously. The circuit and error model remain unchanged, but the crucial addition is the post-selection condition. This means we’re only interested in results where all detectable errors have been corrected.

Understanding post-selection is paramount. Quantum error correction hinges on stabilizer measurements. The code space is the subspace where all stabilizers yield positive eigenvalues. Errors are deemed “detectable” if they anti-commute with at least one stabilizer. Post-selecting is akin to projecting the final density matrix onto the code space, discarding any states that exhibit syndromes.

This leads to the crucial connection: logical fidelity is the fidelity of the post-selected state with the ideal logical state. The ideal physical state representation of the target logical GHZ state needs careful confirmation. With that established, I can formulate the logical fidelity as the ratio of the physical fidelity to the probability of success, the probability of post-selection.

The central task becomes determining \(P_{success}\), the probability of ending up in the code space. Leveraging the event-based approach from Subproblem 1, I calculate this probability for each event (no errors, error on first CNOT, error on second CNOT, and errors on both CNOTs), carefully evaluating the probability of landing in the code space for each.

The key to these calculations lies in identifying undetectable errors, those that commute with both stabilizers. These errors are the ones that “pass” the post-selection. I systematically analyze all possible Pauli errors, determining which are undetectable for each CNOT operation. This requires a careful examination of Pauli commutation relations. I find that there are three such undetectable errors in each CNOT operation, which is critical for finding the post-selection probabilities.

The result is a clear expression for \(P_{success}\) in terms of \(p\). Finally, the logical fidelity formula is constructed by dividing \(F_{phys}\) (obtained from Subproblem 1) by this calculated \(P_{success}\).

Step-by-Step Derivation

The logical state fidelity, assuming post-selection on detectable errors, is the fidelity of the final state after it has been projected onto the code’s valid subspace (the code space) and renormalized.

1. Formal Definition of Logical Fidelity with Post-Selection

Let \(\rho_{actual}\) be the final density matrix of the 4-qubit system produced by the circuit with errors. Let \(\Pi_C\) be the projector onto the code space, which is the subspace where the stabilizers \(S_1 = XXXX\) and \(S_2 = ZZZZ\) both have an eigenvalue of +1.

Post-selection means we keep the state only if it is measured to be in the code space. The probability of this successful outcome is:

\[ P_{success} = \text{Tr}(\Pi_C \rho_{actual}) \]

The post-selected state is:

\[ \rho_{ps} = \frac{\Pi_C \rho_{actual} \Pi_C}{P_{success}} \]

The ideal logical state corresponds to the ideal physical state \(|\psi_{ideal}\rangle\) calculated in Subproblem 1, which lies in the code space (\(\Pi_C |\psi_{ideal}\rangle = |\psi_{ideal}\rangle\)). The logical fidelity is the fidelity of the post-selected state with this ideal state:

\[ F_{log} = \langle \psi_{ideal} | \rho_{ps} | \psi_{ideal} \rangle = \frac{\langle \psi_{ideal} | \Pi_C \rho_{actual} \Pi_C | \psi_{ideal} \rangle}{P_{success}} \]

Since \(|\psi_{ideal}\rangle\) is in the code space, this simplifies to:

\[ F_{log} = \frac{\langle \psi_{ideal} | \rho_{actual} | \psi_{ideal} \rangle}{P_{success}} = \frac{F_{phys}}{P_{success}} \]

We have already calculated \(F_{phys} = 1 - \frac{5}{3}p + \frac{53}{75}p^2\) in Subproblem 1. Our task is to calculate \(P_{success}\).

2. Calculating the Success Probability \(P_{success}\)

We will calculate \(P_{success} = \text{Tr}(\Pi_C \rho_{actual})\) by considering the same four events as in Subproblem 1. An error operator \(E\) is undetectable if it preserves the code space. This occurs if and only if the error commutes with all stabilizers of the code. Otherwise, the error is detectable.

Let’s find the number of undetectable non-identity two-qubit Pauli errors. * An error \(P_{ab}\) on qubits \(a,b\) is undetectable if \([P_{ab}, XXXX]=0\) and \([P_{ab}, ZZZZ]=0\). * Since the stabilizers have weight 4, a two-qubit Pauli operator \(P_{ab}=P_a \otimes P_b\) commutes with them if and only if it commutes with their restriction to qubits \(a,b\). So we need \([P_{ab}, X_aX_b]=0\) and \([P_{ab}, Z_aZ_b]=0\). * The set of two-qubit Paulis that commute with both \(XX\) and \(ZZ\) on the same two qubits is \(\{II, XX, YY, ZZ\}\). * Therefore, for any pair of qubits, there are 3 non-identity undetectable error operators.

Now we calculate \(P_{success}\) for each of the four events:

  • Event 0 (NN - No Error): Probability \((1-p)^2\). The final state is \(|\psi_{ideal}\rangle\), which is in the code space. The success probability is 1. Contribution to \(P_{success}\): \((1-p)^2\).

  • Event 2 (NE - Error on 2nd CNOT): Probability \(p(1-p)\). An error \(P_{03}\) occurs on qubits (0,3). The state is projected onto the code space only if the error is undetectable. There are 3 such undetectable errors out of 15 non-identity Paulis. The probability of success, given this event, is \(P(\text{success}|NE) = \frac{3}{15} = \frac{1}{5}\). Contribution to \(P_{success}\): \(p(1-p) \frac{3}{15}\).

  • Event 1 (EN - Error on 1st CNOT): Probability \(p(1-p)\). An error \(Q_{21}\) occurs on qubits (2,1). The subsequent unitary evolution \(U_{rem} = CNOT_{03}H_0\) acts on disjoint qubits, so the effective error operator on the final state is still \(Q_{21}\). The error is undetectable if \(Q_{21}\) is one of the 3 undetectable Paulis for qubits (1,2). The probability of success, given this event, is \(P(\text{success}|EN) = \frac{3}{15} = \frac{1}{5}\). Contribution to \(P_{success}\): \(p(1-p) \frac{3}{15}\).

  • Event 3 (EE - Errors on both CNOTs): Probability \(p^2\). An error \(Q_{21}\) occurs, followed by an error \(P_{03}\). The total effective error operator is the product \(P_{03}Q_{21}\). Since they act on disjoint sets of qubits, their product is undetectable if and only if both \(P_{03}\) and \(Q_{21}\) are individually undetectable. There are 3 undetectable options for \(P_{03}\) and 3 for \(Q_{21}\). Thus there are \(3 \times 3 = 9\) pairs of undetectable errors out of a total of \(15 \times 15 = 225\) pairs of errors. The probability of success, given this event, is \(P(\text{success}|EE) = \frac{9}{225} = \frac{1}{25}\). Contribution to \(P_{success}\): \(p^2 \frac{9}{225}\).

3. Assemble the Total Success Probability \(P_{success}\)

Summing the contributions:

\[ P_{success}(p) = (1-p)^2 \cdot 1 + p(1-p)\frac{3}{15} + p(1-p)\frac{3}{15} + p^2\frac{9}{225} \]
\[ P_{success}(p) = (1-p)^2 + 2p(1-p)\frac{1}{5} + \frac{p^2}{25} \]
\[ P_{success}(p) = (1 - 2p + p^2) + \frac{2}{5}(p - p^2) + \frac{1}{25}p^2 \]
\[ P_{success}(p) = 1 + (-2 + \frac{2}{5})p + (1 - \frac{2}{5} + \frac{1}{25})p^2 \]
\[ P_{success}(p) = 1 - \frac{8}{5}p + (\frac{25 - 10 + 1}{25})p^2 \]
\[ P_{success}(p) = 1 - \frac{8}{5}p + \frac{16}{25}p^2 \]

This can also be recognized as the perfect square: \(P_{success}(p) = \left(1 - \frac{4}{5}p\right)^2\).

4. Calculate the Logical Fidelity \(F_{log}\)

Now we can compute the logical fidelity using the formula derived in Step 1.

\[ F_{log}(p) = \frac{F_{phys}(p)}{P_{success}(p)} = \frac{1 - \frac{5}{3}p + \frac{53}{75}p^2}{1 - \frac{8}{5}p + \frac{16}{25}p^2} \]

This expression gives the logical fidelity as a function of the physical error rate \(p\), after post-selecting for outcomes that lie in the valid code space.

Final Answer: The logical state fidelity of the final 2-qubit logical state is:

\[ F_{log}(p) = \frac{1 - \frac{5}{3}p + \frac{53}{75}p^2}{1 - \frac{8}{5}p + \frac{16}{25}p^2} \]
User #5

Populate your final answer into the code template provided below. This step is purely for formatting/display purposes. No additional reasoning or derivation should be performed. Do not import any modules or packages beyond what is provided in the template.

import sympy as sp

p = sp.symbols('p')

def answer(p):
    r"""
    Return the expression of 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$ in Sympy format.

    Inputs
    ----------
    p: sympy.Symbol, the two-qubit gate error rate, $p$

    Outputs
    ----------
    F_logical: sympy.Expr, the logical state fidelity as a function of $p$
    """

    # ------------------ FILL IN YOUR RESULTS BELOW ------------------
    F_logical = ...  # a SymPy expression of inputs
    # ---------------------------------------------------------------

    return F_logical
Assistant #6
import sympy as sp

p = sp.symbols('p')

def answer(p):
    r"""
    Return the expression of 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$ in Sympy format.

    Inputs
    ----------
    p: sympy.Symbol, the two-qubit gate error rate, $p$

    Outputs
    ----------
    F_logical: sympy.Expr, the logical state fidelity as a function of $p$
    """

    # ------------------ FILL IN YOUR RESULTS BELOW ------------------
    numerator = 1 - (sp.S(5)/3)*p + (sp.S(53)/75)*p**2
    denominator = 1 - (sp.S(8)/5)*p + (sp.S(16)/25)*p**2
    F_logical = numerator / denominator
    # ---------------------------------------------------------------

    return F_logical