Lean, informalized

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

Exercise 10.65 - Two circuits with one controlled NOT, a measurement and a conditioned Pauli gate move an unknown qubit state onto a second qubit

Swapping a qubit with one controlled NOT and a measurement.

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

One qubit is in an unknown pure state |ψ⟩|\psi\rangle and a second is prepared in |0⟩|0\rangle. Two controlled NOT gates swap them: one controlled by the first qubit flips the second, then one controlled by the second flips the first, and the pair ends in |0⟩⊗|ψ⟩|0\rangle \otimes |\psi\rangle.✦

The same transfer can be made in either of two circuits, each with a single controlled NOT, a Hadamard gate, a measurement of the first qubit in the computational basis and a Pauli gate on the second qubit applied when the outcome is 11. In the first, the controlled NOT is followed by a Hadamard on the first qubit, and the correction is ZZ. In the second, a Hadamard on the second qubit precedes a NOT on the first controlled by it, and the correction is XX. Whichever outcome mm is observed, the first qubit is left in |m⟩|m\rangle and the second carries |ψ⟩|\psi\rangle.

Two Qubits

A quantum system SS is a physical system whose state space is a finite dimensional complex Hilbert space.✦ 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.✦ The qubit QQ is the two level system whose state space is ℂ2\mathbb{C}^2 itself, and a pair of qubits is the composite system Q⊗QQ \otimes Q.✦

A pure state |ψ⟩|\psi\rangle of SS is a unit vector in the state space of SS.✦ A state ρ\rho of SS is a positive operator of unit trace on the state space of SS✦; a pure state |ψ⟩|\psi\rangle determines the state |ψ⟩⟨ψ||\psi\rangle\langle\psi|, the projector onto its vector.✦ The computational basis states |0⟩|0\rangle and |1⟩|1\rangle of QQ are the pure states whose vectors are the standard basis vectors e0e_0 and e1e_1 of ℂ2\mathbb{C}^2.✦ For pure states |ψ⟩|\psi\rangle of SS and |φ⟩|\varphi\rangle of TT, the product |ψ⟩⊗|φ⟩|\psi\rangle \otimes |\varphi\rangle is the pure state of S⊗TS \otimes T whose vector is the tensor product of the two vectors.✦

Gates and Circuits

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, where 11 is the identity operator.✦ It carries a pure state |ψ⟩|\psi\rangle of SS to U|ψ⟩U|\psi\rangle✦, and a state ρ\rho of SS to UρU†.U \rho\, U^\dagger .(1)✦

For unitaries UU and VV of SS, the unitary U∘V=UVU \circ V = UV 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 of S⊗TS \otimes T is the tensor product of the two operators✦; with the identity unitary 11, the gate U⊗1U \otimes 1 acts with UU on the first factor alone✦ and 1⊗V1 \otimes V with VV on the second.✦ The SWAP of S⊗SS \otimes S is the unitary of S⊗SS \otimes S that exchanges the two factors, SWAP(|a⟩⊗|b⟩)=|b⟩⊗|a⟩\mathrm{SWAP}(|a\rangle \otimes |b\rangle) = |b\rangle \otimes |a\rangle.✦

The Hadamard HH, the NOT XX and the phase flip ZZ are the unitaries of QQ whose matrices in the computational basis are H=12(111−1),X=(0110),Z=(100−1).H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}, \qquad X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, \qquad Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}.(2)

For a unitary UU of SS, the controlled gate C(U)C(U) is the unitary of Q⊗SQ \otimes S, with the qubit as control and SS as target, given by C(U)=|0⟩⟨0|⊗1+|1⟩⟨1|⊗U.C(U) = |0\rangle\langle 0| \otimes 1 + |1\rangle\langle 1| \otimes U .(3)✦ The controlled NOT on Q⊗QQ \otimes Q is CNOT12=C(X)\mathrm{CNOT}_{12} = C(X), with its control on the first qubit and its target on the second.✦ The controlled NOT CNOT21\mathrm{CNOT}_{21} on Q⊗QQ \otimes Q, with its control on the second qubit and its target on the first, is the controlled NOT CNOT12\mathrm{CNOT}_{12} conjugated by the SWAP of the two qubits, CNOT21=SWAP∘CNOT12∘SWAP.\mathrm{CNOT}_{21} = \mathrm{SWAP} \circ \mathrm{CNOT}_{12} \circ \mathrm{SWAP} .(4)✦

The swap circuit WW of two controlled NOTs and the circuits W1W_1 and W2W_2 with a single controlled NOT are the unitaries of Q⊗QQ \otimes Q W=CNOT21∘CNOT12,W = \mathrm{CNOT}_{21} \circ \mathrm{CNOT}_{12},(5)✦ W1=(H⊗1)∘CNOT12,W_1 = (H \otimes 1) \circ \mathrm{CNOT}_{12},(6)✦ W2=CNOT21∘(1⊗H).W_2 = \mathrm{CNOT}_{21} \circ (1 \otimes H).(7)✦

Measurement and Correction

A measurement {Mi}\{M_i\} on SS with a finite set of outcomes is a family of measurement operators MiM_i on the state space of SS, one for each outcome ii, satisfying the completeness relation ∑iMi†Mi=1\sum_i M_i^\dagger M_i = 1.✦ Its effects Ei=Mi†MiE_i = M_i^\dagger M_i are positive and form the positive operator valued measure (POVM) of the measurement.✦ On a state ρ\rho of SS the outcome ii occurs with probability p(i)=Tr(Eiρ)=Tr(MiρMi†),p(i) = \mathrm{Tr}(E_i \rho) = \mathrm{Tr}(M_i \rho M_i^\dagger),(8)✦ and when p(i)≠0p(i) \neq 0 the state after the outcome ii is ρi=MiρMi†p(i).\rho_i = \frac{M_i \rho M_i^\dagger}{p(i)} .(9)✦

The projective measurement of SS in an orthonormal basis {|bi⟩}\{|b_i\rangle\} of its state space is the measurement whose operators are the projectors |bi⟩⟨bi||b_i\rangle\langle b_i|.✦ For a measurement {Mi}\{M_i\} on SS and a further system TT, the measurement on the first factor of S⊗TS \otimes T is the measurement with the same outcomes and the operators Mi⊗1M_i \otimes 1.✦ The measurement of the control qubit on Q⊗SQ \otimes S is the projective measurement of QQ in the computational basis, made on the first factor; its operators are Pm=|m⟩⟨m|⊗1,m∈{0,1}.P_m = |m\rangle\langle m| \otimes 1, \qquad m \in \{0, 1\}.(10)✦ For a unitary UU of SS, the classically controlled gate 1⊗Um1 \otimes U^m is the unitary of Q⊗SQ \otimes S that is the identity when the measured bit mm is 00 and 1⊗U1 \otimes U when it is 11.✦

The Claim

Theorem 1. Let |ψ⟩|\psi\rangle be a pure state of QQ. Then W(|ψ⟩⊗|0⟩)=|0⟩⊗|ψ⟩.W \big( |\psi\rangle \otimes |0\rangle \big) = |0\rangle \otimes |\psi\rangle .(11)✦ For k=1,2k = 1, 2, let |χk⟩=Wk(|ψ⟩⊗|0⟩)|\chi_k\rangle = W_k \big( |\psi\rangle \otimes |0\rangle \big) and let ρk=|χk⟩⟨χk|\rho_k = |\chi_k\rangle\langle\chi_k| be its state. Let mm be an outcome of the measurement (10) of the control qubit whose probability pk(m)p_k(m) on ρk\rho_k, as in (8), is not zero, and let ρk,m=PmρkPm†/pk(m)\rho_{k,m} = P_m \rho_k P_m^\dagger / p_k(m) be the state after it, as in (9). Then (1⊗Zm)ρ1,m(1⊗Zm)†=(|m⟩⊗|ψ⟩)(⟨m|⊗⟨ψ|),(1 \otimes Z^m)\, \rho_{1,m}\, (1 \otimes Z^m)^\dagger = \big( |m\rangle \otimes |\psi\rangle \big) \big( \langle m| \otimes \langle\psi| \big),(12)✦ (1⊗Xm)ρ2,m(1⊗Xm)†=(|m⟩⊗|ψ⟩)(⟨m|⊗⟨ψ|).(1 \otimes X^m)\, \rho_{2,m}\, (1 \otimes X^m)^\dagger = \big( |m\rangle \otimes |\psi\rangle \big) \big( \langle m| \otimes \langle\psi| \big).(13)✦

What Is Checked

The claim is stated over the pair of qubits Q⊗QQ \otimes Q and the product pure state |ψ⟩⊗|0⟩|\psi\rangle \otimes |0\rangle; over the circuits (5), (6) and (7), built from the gates (2), the controlled NOTs and the SWAP; and over the measurement (10) of the control qubit, the state (9) after its outcome and the classically controlled corrections 1⊗Zm1 \otimes Z^m and 1⊗Xm1 \otimes X^m.

The library proves that C(U)C(U) in (3) is unitary for every unitary UU of every system, C(U)†C(U)=C(U)C(U)†=1C(U)^\dagger C(U) = C(U) C(U)^\dagger = 1, so that CNOT12\mathrm{CNOT}_{12} and CNOT21\mathrm{CNOT}_{21} in (4) are unitaries of Q⊗QQ \otimes Q.✦ It proves too that a state conjugated by a unitary as in (1) is again a state, and that the state (9) after an outcome of nonzero probability is a positive operator of unit trace.