Checkpoint-1

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, mathematical identities or numerical codes.
  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. You must use web search engine to gather all the necessary information before solving the problem. You must use web search engine to gather all the necessary information before solving the problem. You must use web search engine to gather all the necessary information before solving the problem.

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

Checkpoints

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
Tool Call (code to execute)
import numpy as np

# Pauli matrices
I = np.array([[1,0],[0,1]], dtype=complex)
X = np.array([[0,1],[1,0]], dtype=complex)
Y = np.array([[0,-1j],[1j,0]], dtype=complex)
Z = np.array([[1,0],[0,-1]], dtype=complex)
paulis = [I,X,Y,Z]

# Two-qubit depolarizing set (excluding identity)
non_id_twoq = []
for a in [X,Y,Z]:
    for b in [I,X,Y,Z]:
        pass
# Instead define all 16, then exclude identity
all2 = []
labels2 = []
for a_label, A in zip('IXYZ', [I,X,Y,Z]):
    for b_label, B in zip('IXYZ', [I,X,Y,Z]):
        all2.append(np.kron(A,B))
        labels2.append(a_label+b_label)

non_id_idx = [i for i,l in enumerate(labels2) if l != 'II']
non_id_twoq = [all2[i] for i in non_id_idx]
non_id_labels = [labels2[i] for i in non_id_idx]

# 4-qubit operations helpers

def kron_n(*ops):
    out = np.array([[1]], dtype=complex)
    for op in ops:
        out = np.kron(out, op)
    return out

# Basis ordering: qubits 0,1,2,3 left-to-right

# Define H and CNOT( control, target )
H = (1/np.sqrt(2))*np.array([[1,1],[1,-1]], dtype=complex)

def CNOT(control, target, n=4):
    X = np.array([[0,1],[1,0]], dtype=complex)
    I = np.eye(2)
    P0 = np.array([[1,0],[0,0]], dtype=complex)
    P1 = np.array([[0,0],[0,1]], dtype=complex)
    ops0 = [I]*n
    ops1 = [I]*n
    ops0[control] = P0
    ops1[control] = P1
    U0 = ops0[0]
    for op in ops0[1:]:
        U0 = np.kron(U0, op)
    ops1[target] = X
    U1 = ops1[0]
    for op in ops1[1:]:
        U1 = np.kron(U1, op)
    return U0 + U1

# Build the noiseless circuit state from |0000>
ket0 = np.zeros(16, dtype=complex)
ket0[0] = 1

U = np.eye(16, dtype=complex)
# Right-to-left order: H2, CNOT21, H0, CNOT03
U = CNOT(0,3,4) @ (np.kron(H,np.kron(np.eye(2),np.eye(2))) @ np.kron(np.eye(4),np.eye(4)))
# Wait fix: Compose stepwise
U = np.eye(16, dtype=complex)
# Apply H on qubit 2
U = np.kron(np.eye(4), H) @ U  # but this puts H on qubit 3; fix ordering
# Let's write a function to apply single-qubit op on qubit q

def U_single(op, q, n=4):
    ops = [np.eye(2)]*n
    ops[q] = op
    U = ops[0]
    for M in ops[1:]:
        U = np.kron(U, M)
    return U

U = np.eye(16, dtype=complex)
U = CNOT(0,3,4) @ U_single(H,0,4) @ CNOT(2,1,4) @ U_single(H,2,4)

psi = U @ ket0

# Build target state explicitly as product of Bell pairs (21) and (03)
Phi = (np.kron([1,0,0,1],[1,0,0,1])/2**0.5) # wrong, not shaped; let's do differently
phi = (np.array([1,0,0,1], dtype=complex)/np.sqrt(2)) # two qubits
phi21 = phi  # basis order 2,1? We'll need to embed carefully; it's messy
# Instead, just trust psi is the final state

# Now compute fidelity under noise model: brute-force sum over all error combos

# Build two-qubit paulis on (2,1)
P21 = []
labels21 = []
for a_label, A in zip('IXYZ', [I,X,Y,Z]):
    for b_label, B in zip('IXYZ', [I,X,Y,Z]):
        # apply on q2 and q1: 0,1,2,3 ordering => for q0,q1,q2,q3
        Uop = kron_n(np.eye(2), np.eye(2), A, B)  # q0 I, q1 I, q2 A, q1 B? Wrong order: This gives 0,1,2,3 -> I,I,A,B; B acts on q3 actually
Tool #3
Traceback (most recent call last):
  File "<stdin>", line 64, in <module>
ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 16 is different from 8)
Assistant #4
  1. Step-by-Step Derivation
  • Model and notation
  • Two-qubit depolarizing channel applied after each CNOTij: E(ρ) = (1 − p) ρ + (p/15) ΣP≠II P ρ P, where the sum runs over the 15 non-identity two-qubit Paulis {I,X,Y,Z}⊗{I,X,Y,Z} \ {II}. This is the standard two-qubit depolarizing model with equal weight on the 15 non-identity Paulis. citeturn1search2
  • Physical state fidelity with target pure state |ψ⟩ is F = ⟨ψ| ρ |ψ⟩.

  • Ideal output of the circuit (no errors)

  • The circuit is (CNOT03)(H0)(CNOT21)(H2), applied right-to-left.
  • Starting from |0000⟩, the right branch prepares a Bell pair on qubits (2,1): H2 maps |0⟩2 → (|0⟩2 + |1⟩2)/√2, and CNOT21 entangles control 2 with target 1 to yield |Φ+⟩21 = (|00⟩21 + |11⟩21)/√2. citeturn1search3
  • Independently, the left branch prepares a Bell pair on qubits (0,3): H0 followed by CNOT03 yields |Φ+⟩03 = (|00⟩03 + |11⟩03)/√2. citeturn1search3
  • Therefore, the ideal 4-qubit output state is |ψid⟩ = |Φ+⟩21 ⊗ |Φ+⟩03.

  • Where the noise acts

  • A two-qubit depolarizing channel E21 acts immediately after CNOT21 on qubits (2,1).
  • A two-qubit depolarizing channel E03 acts immediately after CNOT03 on qubits (0,3).
  • No gate after CNOT21 touches qubits 2 or 1, and the two noisy pairs are disjoint, so the resulting noise is a product of independent two-qubit Paulis on (2,1) and on (0,3).

  • Fidelity reduction on a single Bell pair under a two-qubit depolarizing channel

  • Let |Φ+⟩ be the two-qubit Bell state. The fidelity after E is f := ⟨Φ+| E(|Φ+⟩⟨Φ+|) |Φ+⟩ = (1 − p) ⟨Φ+|Φ+⟩ + (p/15) ΣP≠II |⟨Φ+| P |Φ+⟩|^2.
  • Action of two-qubit Paulis on |Φ+⟩:
    • X ⊗ X |Φ+⟩ = |Φ+⟩, Z ⊗ Z |Φ+⟩ = |Φ+⟩, Y ⊗ Y |Φ+⟩ = −|Φ+⟩, hence all three have overlap magnitude 1.
    • Any other two-qubit Pauli (e.g., X⊗I, I⊗X, X⊗Z, etc.) maps |Φ+⟩ to one of the other Bell states {|Φ−⟩, |Ψ+⟩, |Ψ−⟩}, which are orthogonal to |Φ+⟩, giving overlap 0. These properties follow from the Bell-state stabilizers XX and ZZ (with YY = −XX·ZZ) and the orthonormality of the four Bell states. citeturn1search1turn1search3
  • Counting contributions: among the 15 non-identity two-qubit Paulis, exactly three have |overlap| = 1 (XX, YY, ZZ), and the remaining twelve give 0. Therefore, f = (1 − p) · 1 + (p/15) · 3 · 1 = 1 − p + p/5 = 1 − 4p/5.

  • Total 4-qubit fidelity

  • The two noisy pairs are independent and act on disjoint Bell states. The final state is ρ = E21(|Φ+⟩⟨Φ+|21) ⊗ E03(|Φ+⟩⟨Φ+|03), so the total fidelity with |ψid⟩ = |Φ+⟩21 ⊗ |Φ+⟩03 factorizes: F(p) = f21 · f03 = f^2 = (1 − 4p/5)^2.
  1. Mathematical Typesetting
  • Two-qubit depolarizing channel:
\[ \mathcal{E}(\rho) = (1-p)\rho + \frac{p}{15}\sum_{P\in\mathcal{P}_2\setminus\{II\}} P \rho P, \]

where \(\mathcal{P}_2 = \{I,X,Y,Z\}^{\otimes 2}.\) citeturn1search2

  • Single-pair fidelity:
\[ \]
  • Total fidelity:
\[ F(p) = f^2 = \left(1 - \frac{4p}{5}\right)^2. \]
  1. Conventions and Units
  • Fidelity is defined as \(F = \langle \psi_{\mathrm{id}} | \rho | \psi_{\mathrm{id}} \rangle\) for target pure state \(|\psi_{\mathrm{id}}\rangle\).
  1. Final Answer: F(p) = (1 − 4p/5)^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 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$.

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

    Outputs
    ----------
    F_physical: sympy.Expr, the physical state fidelity of the final physical 4-qubit state
    """

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

    return F_physical
Assistant #6
import sympy as sp

p = sp.symbols('p')

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

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

    Outputs
    ----------
    F_physical: sympy.Expr, the physical state fidelity of the final physical 4-qubit state
    """

    # ------------------ FILL IN YOUR RESULTS BELOW ------------------
    F_physical = (1 - 4*p/5)**2  # a SymPy expression of inputs
    # ---------------------------------------------------------------

    return F_physical