Lean, informalized

Nielsen & Chuang · Chapter 10, Quantum error-correction · p. 474

Exercise 10.60 - Syndrome circuits for the five qubit code and Shor's nine qubit code

One ancilla qubit records the eigenvalue of a generator.

Hover over a blue or green term in the text, or a node in the graph, to find it in the other. Select it to read its declaration both in Lean and in words.

The Exercise

The exercise concerns syndrome measurement for two codes, the five qubit code and Shor’s nine qubit code. Each code is given by a list of generators, tensor products of Pauli matrices on the code’s qubits, and the syndrome is read one generator at a time. An ancilla qubit is prepared in |0⟩|0\rangle beside the code’s qubits, and a circuit acts on both. If the state |ψ⟩|\psi\rangle of the code’s qubits is an eigenstate of the generator with eigenvalue (−1)b(-1)^b, for a bit bb, the circuit must leave the ancilla in |b⟩|b\rangle and the code’s qubits in |ψ⟩|\psi\rangle. A measurement of the ancilla in the computational basis then gives the syndrome bit bb.

The library states this for every generator of both codes, with one circuit built the same way from each generator.

A Quantum System

A quantum system SS is a physical system whose state space is a finite dimensional complex Hilbert space.✦ Every such space ℋ\mathcal{H} is the state space of a system, the system modelled on ℋ\mathcal{H}.✦ The qudit with dd levels is the system modelled on ℂd\mathbb{C}^d with its standard inner product✦; the qubit is the qudit with two levels✦, and the qudit with 2n2^n levels is a register of nn qubits. The composite system S⊗TS \otimes T of two systems SS and TT is the system whose state space is the tensor product of their state spaces.✦

A pure state |ψ⟩|\psi\rangle of SS is a unit vector in the state space of SS, ‖ψ‖=1\lVert \psi \rVert = 1.✦ For pure states |ψ⟩|\psi\rangle of SS and |φ⟩|\varphi\rangle of TT, the product state |ψ⟩⊗|φ⟩|\psi\rangle \otimes |\varphi\rangle is the pure state of S⊗TS \otimes T whose vector is the tensor product of the two vectors.✦ The basis states |0⟩|0\rangle and |1⟩|1\rangle of the qubit are the pure states whose vectors are the standard basis vectors e0e_0 and e1e_1 of ℂ2\mathbb{C}^2.✦

A unitary UU of SS is an operator on the state space of SS with U†U=UU†=1U^\dagger U = U U^\dagger = 1.✦ It carries a pure state |ψ⟩|\psi\rangle of SS to the pure state U|ψ⟩U|\psi\rangle.✦ The identity evolution of SS is the unitary 11.✦ For two unitaries UU and VV of SS, the composite UVUV is the unitary of SS that applies VV first and then UU.✦ For a unitary UU of SS and a unitary VV of TT, the product unitary U⊗VU \otimes V is the unitary of S⊗TS \otimes T whose operator is the tensor product of the two operators✦; with V=1V = 1 it is the gate U⊗1U \otimes 1, which acts with UU on the first factor alone.✦

An observable AA on SS is a self adjoint operator on the state space of SS, A†=AA^\dagger = A.✦ A pure state |ψ⟩|\psi\rangle of SS is an eigenstate of AA with eigenvalue μ\mu, a real number, when A|ψ⟩=μ|ψ⟩A|\psi\rangle = \mu|\psi\rangle.✦

Pauli Strings

The Pauli matrices are the four complex 2×22 \times 2 matrices σ0=I=(1001),σ1=X=(0110),σ2=Y=(0−ii0),σ3=Z=(100−1).\sigma_0 = I = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}, \quad \sigma_1 = X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, \quad \sigma_2 = Y = \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}, \quad \sigma_3 = Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}.(1)✦ For a choice p=(p1,…,pn)p = (p_1, \dots, p_n) of one label in {0,1,2,3}\{0, 1, 2, 3\} for each of nn qubits, the Pauli string P=σp1⊗⋯⊗σpnP = \sigma_{p_1} \otimes \cdots \otimes \sigma_{p_n} is the operator on the nn qubits whose matrix, with rows and columns labelled by strings ii and jj of nn bits, has the entries Pij=∏k=1n(σpk)ikjk.P_{ij} = \prod_{k=1}^{n} (\sigma_{p_k})_{i_k j_k}.(2)✦ With ii and jj read as binary numbers from 00 to 2n−12^n - 1, PP is a matrix on ℂ2n\mathbb{C}^{2^n}, the state space of the register of nn qubits.✦ A Pauli string is written as a word, XZZXIXZZXI for X⊗Z⊗Z⊗X⊗IX \otimes Z \otimes Z \otimes X \otimes I, or by the qubits on which it is not the identity, Z1Z2Z_1 Z_2 for Z⊗Z⊗I⊗⋯⊗IZ \otimes Z \otimes I \otimes \cdots \otimes I.

A Pauli string is Hermitian. For a Pauli string PP on nn qubits and a real coefficient cc, the observable cPcP on the register of nn qubits is the operator whose matrix is cc times that of PP; with c=1c = 1 it is the observable PP.✦

The Syndrome Circuits

The Hadamard gate HH is the unitary of the qubit whose matrix is H=12(111−1).H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}.(3)✦ For a unitary UU of a system SS, the controlled gate C(U)C(U) is the unitary of the composite system of a control qubit and the target SS whose operator is C(U)=|0⟩⟨0|⊗1+|1⟩⟨1|⊗U.C(U) = |0\rangle\langle 0| \otimes 1 + |1\rangle\langle 1| \otimes U.(4)✦

The measurement circuit (H⊗1)C(U)(H⊗1)(H \otimes 1)\, C(U)\, (H \otimes 1) of UU is the unitary of the control qubit and SS that applies a Hadamard gate to the control alone, then C(U)C(U), then a second Hadamard gate to the control alone.✦ For a Pauli string PP on nn qubits, the syndrome circuit of PP is the measurement circuit of the observable PP, taken as a unitary of the register: MP=(H⊗1)C(P)(H⊗1).M_P = (H \otimes 1)\, C(P)\, (H \otimes 1).(5)✦

The five qubit code has the four generators of Figure 10.12, each the one before it shifted cyclically one place to the right: g1=XZZXI,g2=IXZZX,g3=XIXZZ,g4=ZXIXZ.g_1 = XZZXI, \quad g_2 = IXZZX, \quad g_3 = XIXZZ, \quad g_4 = ZXIXZ.(6)✦ Its syndrome circuits are the four unitaries of a control qubit and a register of five qubits Mi(5)=Mgi,i=1,…,4.M^{(5)}_i = M_{g_i}, \qquad i = 1, \dots, 4.(7)✦

Shor’s code has eight generators on nine qubits: six of ZZ type, against bit flips within each block of three qubits, and two of XX type, against phase flips between the blocks, s1=Z1Z2,s2=Z2Z3,s3=Z4Z5,s4=Z5Z6,s5=Z7Z8,s6=Z8Z9,s7=X1X2X3X4X5X6,s8=X4X5X6X7X8X9.\begin{gathered} s_1 = Z_1 Z_2, \quad s_2 = Z_2 Z_3, \quad s_3 = Z_4 Z_5, \quad s_4 = Z_5 Z_6, \quad s_5 = Z_7 Z_8, \quad s_6 = Z_8 Z_9, \\ s_7 = X_1 X_2 X_3 X_4 X_5 X_6, \quad s_8 = X_4 X_5 X_6 X_7 X_8 X_9. \end{gathered}(8)✦ On a control qubit and a register of nine qubits, the syndrome circuits of Shor’s code are Mj(9)=Msj,j=1,…,8.M^{(9)}_j = M_{s_j}, \qquad j = 1, \dots, 8.(9)✦

The Claim

Theorem 1. Let bb be a bit. For each generator gig_i of the five qubit code, if a pure state |ψ⟩|\psi\rangle of five qubits is an eigenstate of the observable gig_i with eigenvalue (−1)b(-1)^b, then Mi(5)(|0⟩⊗|ψ⟩)=|b⟩⊗|ψ⟩.M^{(5)}_i \, (|0\rangle \otimes |\psi\rangle) = |b\rangle \otimes |\psi\rangle.(10)✦ For each generator sjs_j of Shor’s code, if a pure state |ψ⟩|\psi\rangle of nine qubits is an eigenstate of the observable sjs_j with eigenvalue (−1)b(-1)^b, then Mj(9)(|0⟩⊗|ψ⟩)=|b⟩⊗|ψ⟩.M^{(9)}_j \, (|0\rangle \otimes |\psi\rangle) = |b\rangle \otimes |\psi\rangle.(11)✦

What Is Checked

The two claims are stated over the syndrome circuits (7) and (9), each the circuit (5) of one generator, applied to the product state of the ancilla’s |0⟩|0\rangle with a pure state of the code’s register, and over the eigenstates of each generator as an observable.

The library proves that every Pauli string squares to the identity, P2=1P^2 = 1✦, which makes the observable PP a unitary of the register, and that the controlled gate C(U)C(U) of (4) is unitary for every unitary UU.✦