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, 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.

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
  1. Step-by-Step Derivation
  • Ideal output state of the circuit
  • Start from |0000⟩.
  • Apply H on qubit 2, then CNOT21: this prepares a Bell pair on qubits (2,1),
\[ |\Phi^+\rangle_{21}=\frac{|00\rangle_{21}+|11\rangle_{21}}{\sqrt{2}}, \]
while qubits (0,3) remain in |00⟩.
  • Apply H on qubit 0, then CNOT03: this prepares a Bell pair on qubits (0,3),
\[ |\Phi^+\rangle_{03}=\frac{|00\rangle_{03}+|11\rangle_{03}}{\sqrt{2}}. \]
  • Therefore, the ideal final 4-qubit state is
\[ |\psi_{\mathrm{id}}\rangle = |\Phi^+\rangle_{21}\otimes |\Phi^+\rangle_{03}. \]
  • Stabilizers of the ideal state
  • The Bell state |Φ+⟩ on a pair (i,j) is stabilized by XiXj and ZiZj, and hence by the 4-element subgroup {I⊗I, XiXj, YiYj, ZiZj} (up to phase).
  • Hence
\[ \mathcal{S} = \langle X_2X_1,\,Z_2Z_1,\,X_0X_3,\,Z_0Z_3\rangle, \]
and factorizes as
\[ \mathcal{S}_{21}=\{II,\,X_2X_1,\,Y_2Y_1,\,Z_2Z_1\},\quad \]
  • Noise model after the CNOTs
  • After each CNOT, a two-qubit depolarizing channel acts on that pair:
\[ \mathcal{E}(\rho)=(1-p)\rho+\frac{p}{15}\sum_{P\in\mathcal{P}_2\setminus\{II\}}P\rho P, \]
where the sum runs over the 15 non-identity two-qubit Paulis on that pair.
  • In our circuit there are two such channels: one on qubits (2,1) after CNOT21 and one on (0,3) after CNOT03. These errors are independent and act on disjoint qubit sets. The single-qubit H gates are assumed perfect.

  • Fidelity with a pure stabilizer state

  • For a pure stabilizer state |ψid⟩, a Pauli error P maps |ψid⟩ to either the same state (up to a global phase) if P∈𝒮, or to a state orthogonal to |ψid⟩ if P∉𝒮. Therefore, the state fidelity is exactly the probability that the net Pauli error lies in the stabilizer group 𝒮.

  • Probability that a single two-qubit depolarizing error is “benign”

  • On a given pair (say 2,1), the “benign” Paulis (those in the pair’s stabilizer) are {II, XX, YY, ZZ}. Under the depolarizing channel:
    • Pr[II] = 1 − p,
    • Pr[XX] = Pr[YY] = Pr[ZZ] = p/15.
  • Hence, the probability that the error on that pair preserves the Bell state is
\[ P_{\mathrm{benign}} = (1-p)+3\frac{p}{15}=1-\frac{4p}{5}. \]
  • Total fidelity
  • Because the two error channels act on disjoint pairs and are independent, the final 4-qubit state fidelity is the product of the two benign probabilities:
\[ F(p)=\left(1-\frac{4p}{5}\right)^2. \]
  1. Mathematical Typesetting

All equations are given above in LaTeX.

  1. Conventions and Units
  • Qubits labeled 0,1,2,3; CNOTij has control i, target j.
  • Two-qubit depolarizing noise of strength p acts after each CNOT.
  • Fidelity is F = ⟨ψid|ρ|ψid⟩.
  1. Final Answer: F(p) = (1 - 4p/5)^2.
User #3

The correct answer is: $ F_{\rm{physical}}=(1-\frac{12}{15}p)^2 $

Now let’s solve the next Checkpoint.

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

# Define Pauli multiplication ignoring phase; represent as strings 'I','X','Y','Z'
# Provide function to compute commutation: returns True if commute, False if anticommute.

paulis = ['I','X','Y','Z']

# Single-qubit commutation table: anticommute pairs are X-Z, X-Y, Y-Z
anticommute_pairs = {('X','Z'),('Z','X'),('X','Y'),('Y','X'),('Y','Z'),('Z','Y')}

def single_anticommute(a,b):
    if a=='I' or b=='I' or a==b: return False
    return (a,b) in anticommute_pairs

# For tensor products represented as strings over length 4

def anticommutes(P,Q):
    # Count number of positions where local Paulis anticommute
    count = 0
    for a,b in zip(P,Q):
        if single_anticommute(a,b):
            count += 1
    # anticommute iff odd number of local anticommutes
    return (count % 2)==1

def commutes(P,Q):
    return not anticommutes(P,Q)

# Code stabilizers
S1 = 'XXXX'
S2 = 'ZZZZ'

# Logical operators
X_A = 'XIXI'
Z_A = 'ZZII'
X_B = 'XXII'
Z_B = 'ZIZI'

# Allowed pair Paulis on (2,1) and (0,3)
# Note our order is (0,1,2,3), so to place a 2-qubit Pauli on pair (2,1)
# we fill positions: 0:'I',1:P1,2:P2,3:'I' with P2 on qubit2, P1 on qubit1.

def embed_pair_21(p1,p2):
    # p1 acts on qubit1, p2 acts on qubit2
    return 'I' + p1 + p2 + 'I'

def embed_pair_03(p0,p3):
    # p0 acts on qubit0, p3 acts on qubit3
    return p0 + 'I' + 'I' + p3

# Function to multiply Pauli strings ignoring phase
# We just need for combining P21 and P03, which act on disjoint supports, so multiplication is just overlay

def combine(P,Q):
    # they act on disjoint supports in our construction; assert no conflicts
    out = []
    for a,b in zip(P,Q):
        out.append(a if b=='I' else (b if a=='I' else None))
    # None should not appear
    return ''.join(out)

# Construct all allowed two-qubit Paulis on a pair, with probabilities depending on p
p = 0.123 # placeholder, probabilities symbolic later

pair_nonidentity = [x for x in itertools.product(paulis, paulis) if not (x[0]=='I' and x[1]=='I')]

# We'll classify types per pair: parity (x,z)
XZ = {'I':(0,0),'X':(1,0),'Y':(1,1),'Z':(0,1)}

def pair_type(p,q):
    x = (XZ[p][0] + XZ[q][0]) % 2
    z = (XZ[p][1] + XZ[q][1]) % 2
    return (x,z)

# Verify classes
from collections import defaultdict
classes = defaultdict(list)
for a,b in itertools.product(paulis,paulis):
    classes[pair_type(a,b)].append((a,b))

classes_count = {k:len(v) for k,v in classes.items()}
print('Class sizes per pair type (x,z):', classes_count)

# Now enumerate all P_total = P21 * P03 with types equal for acceptance and compute logical effect

all_pairs = list(itertools.product(paulis, paulis))

# define commutation with logicals -> determine logical effect Ebar as a pair of single-qubit Paulis on (A,B)

def logical_action(P):
    # Determine x,z bits for A and B via commutation
    # x_bit = anticommutes with Z, z_bit = anticommutes with X
    xA = 1 if anticommutes(P, Z_A) else 0
    zA = 1 if anticommutes(P, X_A) else 0
    xB = 1 if anticommutes(P, Z_B) else 0
    zB = 1 if anticommutes(P, X_B) else 0
    # map bits to char
    inv = {(0,0):'I',(1,0):'X',(0,1):'Z',(1,1):'Y'}
    return inv[(xA,zA)] + inv[(xB,zB)]

# Now compute probabilities symbolically in terms of p: we'll tally weights as linear/quadratic polynomials in p and 1-p
from fractions import Fraction

# Probabilities per 2-qubit Pauli on a pair:
# II: 1-p; each other: p/15

def pair_prob(a,b):
    if a=='I' and b=='I':
        return ('lin', Fraction(1,1), Fraction(-1,1))  # Represent as (type, A, B) meaning A + B p, but we want (1-p)
    else:
        return ('constp', Fraction(1,15)) # means (p/15)

# We will accumulate probabilities for acceptance and for GHZ-stabilizing logical actions

from collections import Counter

# We'll symbolically compute: total weights as functions: W = c0 + c1 p + c2 p^2
# Because two independent errors -> polynomial up to p^2.

class Poly:
    def __init__(self,c0=Fraction(0),c1=Fraction(0),c2=Fraction(0)):
        self.c0=Fraction(c0); self.c1=Fraction(c1); self.c2=Fraction(c2)
    def __iadd__(self, other):
        self.c0 += other.c0; self.c1 += other.c1; self.c2 += other.c2
        return self
    def __add__(self, other):
        out=Poly(self.c0,self.c1,self.c2); out+=other; return out
    def __mul__(self, other):
        # multiply polynomials up to degree 2 only; but we will only multiply up to deg1 x deg1 -> deg2 (fine)
        out=Poly()
        out.c0 = self.c0*other.c0
        out.c1 = self.c0*other.c1 + self.c1*other.c0
        out.c2 = self.c0*other.c2 + self.c1*other.c1 + self.c2*other.c0
        return out
    def __repr__(self):
        return f"{self.c0} + {self.c1} p + {self.c2} p^2"

# Build polynomial probability for each (a,b) pair on each pair (21 or 03)

def prob_poly_pair(a,b):
    if a=='I' and b=='I':
        # 1-p = 1 + (-1) p
        return Poly(1, -1, 0)
    else:
        # p/15 = 0 + (1/15) p
        return Poly(0, Fraction(1,15), 0)

# Now enumerate and sum accepted cases.

# For acceptance, type equality across pairs:

def pair_type_key(pair):
    return pair_type(pair[0], pair[1])

# GHZ logical stabilizer set on (A,B): {II, XX, ZZ, YY}
GHZ_stab = {'II', 'XX', 'ZZ', 'YY'}

P_accept = Poly()
P_good = Poly()
# Also tally distribution over logical actions for accepted events
logdist = {}
for a in all_pairs:
    P21 = embed_pair_21(a[1], a[0])  # careful: a is (p0, p1) ??? For pair21 we used p1 on qubit1, p2 on qubit2: here let a=(p1,p2)
    # Actually our 'a' will be (p1,p2) for pair (1,2); we set P21 accordingly
    P21 = embed_pair_21(a[0], a[1])
    prob21 = prob_poly_pair(a[0], a[1])
    type21 = pair_type(a[0], a[1])
    for b in all_pairs:
        P03 = embed_pair_03(b[0], b[1])
        prob03 = prob_poly_pair(b[0], b[1])
        type03 = pair_type(b[0], b[1])
        if type03 != type21:
            continue
        Ptot = combine(P21, P03)
        # Confirm commute with stabilizers
        if not (commutes(Ptot,S1) and commutes(Ptot,S2)):
            # Shouldn't happen: type equality implies commute with both
            pass
        act = logical_action(Ptot)
        logdist.setdefault(act, Poly())
        weight = prob21 * prob03
        P_accept += weight
        logdist[act] += weight
        if act in GHZ_stab:
            P_good += weight

print('P_accept polynomial:', P_accept)
print('P_good polynomial:', P_good)
print('Distribution over logical actions (polynomials):')
for k,v in sorted(logdist.items()):
    print(k, v)

# Simplify to rational coefficients
acc = P_accept
good = P_good

# Compute logical fidelity F_log(p) = good / acc (as rational functions)
# For general p, F(p) = (c0g + c1g p + c2g p^2)/(c0a + c1a p + c2a p^2)

num = (good.c0, good.c1, good.c2)
den = (acc.c0, acc.c1, acc.c2)
print('num:', num)
print('den:', den)
Tool #5
Class sizes per pair type (x,z): {(0, 0): 4, (1, 0): 4, (1, 1): 4, (0, 1): 4}
P_accept polynomial: 1 + -8/5 p + 64/75 p^2
P_good polynomial: 1 + -8/5 p + 16/25 p^2
Distribution over logical actions (polynomials):
II 1 + -2 p + 76/75 p^2
IX 0 + 0 p + 4/225 p^2
IY 0 + 0 p + 4/225 p^2
IZ 0 + 0 p + 4/225 p^2
XI 0 + 0 p + 4/225 p^2
XX 0 + 2/15 p + -28/225 p^2
XY 0 + 0 p + 4/225 p^2
XZ 0 + 0 p + 4/225 p^2
YI 0 + 0 p + 4/225 p^2
YX 0 + 0 p + 4/225 p^2
YY 0 + 2/15 p + -28/225 p^2
YZ 0 + 0 p + 4/225 p^2
ZI 0 + 0 p + 4/225 p^2
ZX 0 + 0 p + 4/225 p^2
ZY 0 + 0 p + 4/225 p^2
ZZ 0 + 2/15 p + -28/225 p^2
num: (Fraction(1, 1), Fraction(-8, 5), Fraction(16, 25))
den: (Fraction(1, 1), Fraction(-8, 5), Fraction(64, 75))
Assistant #6
  1. Step-by-Step Derivation
  • Ideal encoded target and the prepared state
  • The circuit (H2 → CNOT21) prepares a Bell pair on qubits (2,1), and (H0 → CNOT03) prepares a Bell pair on (0,3):
\[ |\psi_{\text{id}}\rangle = |\Phi^+\rangle_{21}\otimes|\Phi^+\rangle_{03},\quad |\Phi^+\rangle=\frac{|00\rangle+|11\rangle}{\sqrt{2}}. \]
  • This state is stabilized by
\[ X_2X_1,\ Z_2Z_1,\ X_0X_3,\ Z_0Z_3. \]
The [[4,2,2]] code stabilizers are $XXXX$ and $ZZZZ$, and the logical Bell (GHZ) stabilizers are $X_A X_B=X_2X_1$ and $Z_A Z_B=Z_2Z_1$.
  • Noise model and independence
  • After CNOT21, a two-qubit depolarizing channel acts on qubits (2,1); after CNOT03, the same on (0,3). These two channels are independent and act on disjoint qubits.
  • For a two-qubit depolarizing channel with error rate \(p\):

    • \(II\) occurs with probability \(1-p\),
    • each of the 15 non-identity two-qubit Paulis occurs with probability \(p/15\).
  • Parity classification on a pair

  • For a two-qubit Pauli \(P\) on a fixed pair, define the parity type
\[ t(P)=(x,z)\in\{0,1\}^2, \]
where $x$ is the parity of the number of $X$ or $Y$ factors, and $z$ is the parity of the number of $Z$ or $Y$ factors on the two qubits.
  • The 16 pair Paulis split into four equally sized classes:
    • Type I: \((0,0)\) = {II, XX, YY, ZZ} (4 elements)
    • Type X: \((1,0)\) (4 elements)
    • Type Z: \((0,1)\) (4 elements)
    • Type Y: \((1,1)\) (4 elements)
  • The probabilities for a single pair are:
\[ \]
  • Post-selection (detectable-error rejection)
  • A 4-qubit Pauli \(P\) on the two pairs is accepted (undetected) iff it commutes with both code stabilizers \(XXXX\) and \(ZZZZ\).
  • Using the parity picture: \(P\) commutes with \(ZZZZ\) iff the total \(x\)-parity across all four qubits is even, and commutes with \(XXXX\) iff the total \(z\)-parity is even. Since the error is a product of a Pauli on (2,1) and one on (0,3), this is equivalent to requiring the two pair-types match:
\[ t(P_{21})=t(P_{03}). \]
  • Therefore, the acceptance probability is
\[ =w_I^2+3\,w_X^2 \]
  • Which accepted errors preserve the logical Bell state?
  • The logical GHZ (Bell) state on \((A,B)\) is stabilized by \(X_A X_B\) and \(Z_A Z_B\); physically these are \(X_2X_1\) and \(Z_2Z_1\).
  • Any accepted error from Type I on both pairs (i.e., \(t=I\) on (2,1) and \(t=I\) on (0,3)) is a product of the four pair stabilizers \(X_2X_1,\ Z_2Z_1,\ X_0X_3,\ Z_0Z_3\), hence lies in the full stabilizer of \(|\psi_{\text{id}}\rangle\) and preserves the logical Bell state.
  • If both pairs are Type X, then the total error anticommutes with \(Z_AZ_B\) and changes the Bell eigenvalue (similarly, Type Z anticommutes with \(X_AX_B\), and Type Y anticommutes with both). Thus types X×X, Z×Z, Y×Y never preserve the logical Bell state.
  • Therefore, the probability of an accepted, logically correct outcome is exactly
\[ P_{\text{good}}=w_I^2=\left(1-\frac{4}{5}p\right)^2. \]
  • Logical fidelity with post-selection
  • The logical state fidelity (conditioned on acceptance) is
\[ \]
  • Equivalently, expanded as a rational function:
\[ F_{\text{logical}}(p)=\frac{1-\frac{8}{5}p+\frac{16}{25}p^2}{1-\frac{8}{5}p+\frac{64}{75}p^2}. \]
  • Small-\(p\) expansion (showing distance-2 detection eliminates all first-order logical error):
\[ F_{\text{logical}}(p)=1-\frac{16}{75}p^2+O(p^3). \]
  1. Mathematical Typesetting

All expressions are written in LaTeX above.

  1. Conventions and Units
  • Qubits labeled 0,1,2,3; logical qubits A,B.
  • Stabilizers: \(XXXX\), \(ZZZZ\).
  • Logical operators: \(X_A=XIXI\), \(X_B=XXII\), \(Z_A=ZZII\), \(Z_B=ZIZI\).
  • Two-qubit depolarizing noise of strength \(p\) acts after each CNOT.
  • Fidelity is \(F=\langle\psi_{\text{ideal}}|\rho|\psi_{\text{ideal}}\rangle\); post-selection keeps only runs with no stabilizer flips.
  1. Final Answer: \(F_{\text{logical}}(p)=\dfrac{\left(1-\frac{4}{5}p\right)^2}{\left(1-\frac{4}{5}p\right)^2+3\left(\frac{4}{15}p\right)^2} =\dfrac{1-\frac{8}{5}p+\frac{16}{25}p^2}{1-\frac{8}{5}p+\frac{64}{75}p^2} =1-\dfrac{16}{75}p^2+O(p^3).\)
User #7

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 #8
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 = ((1 - sp.Rational(4,5)*p)**2) / ((1 - sp.Rational(4,5)*p)**2 + 3*(sp.Rational(4,15)*p)**2)
    # ---------------------------------------------------------------

    return F_logical