Lean, informalized

Nielsen & Chuang · Chapter 4, Quantum circuits · p. 198

Exercise 4.43 - Every unitary of n+1n+1 qubits, up to a phase, as a limit of circuits in four gates and a measured gadget

Hadamard, phase, CNOT and Toffoli with measurement are universal.

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 is to show that four gates, together with measurement, are universal for quantum computation. The gates are the Hadamard gate HH and the phase gate SS on one qubit, the controlled NOT (CNOT) on two qubits and the Toffoli gate on three. Measurement enters through the circuit of Figure 4.17 of the book. A target qubit and two ancillas prepared in |0⟩|0\rangle pass through Hadamard gates on the ancillas, a Toffoli gate, SS on the target, a second Toffoli gate and Hadamard gates on the ancillas again; then both ancillas are measured in the computational basis. When both outcomes are 00, the target has undergone a fixed single qubit gate. Universality asks that every unitary of n+1n+1 qubits be approximated, up to a global phase and as closely as one likes, by circuits of these gates and of that measured gate, each placed on any of the qubits.

A Register of Qubits

A quantum system AA is given by its state space, a finite dimensional complex Hilbert space.✦ A pure state |ψ⟩|\psi\rangle of AA is a unit vector in the state space of AA, determined physically up to a global phase.✦ The qubit is the two level system whose state space is ℂ2\mathbb{C}^2, the standard two dimensional complex Euclidean space; its basis states |0⟩|0\rangle and |1⟩|1\rangle are the pure states given by the standard basis vectors of ℂ2\mathbb{C}^2.

The composite system A⊗BA \otimes B of systems AA and BB has as its state space the tensor product of their state spaces, and the product |ψ⟩⊗|φ⟩|\psi\rangle \otimes |\varphi\rangle of a pure state of AA and a pure state of BB is the pure state of A⊗BA \otimes B whose vector is the tensor product of the two vectors. For a family of systems indexed by a finite set, the composite ⨂iAi\bigotimes_i A_i has the tensor product of all their state spaces as its state space.✦ The tensor power A⊗mA^{\otimes m} is the composite of mm copies of AA, one on each of the wires 0,…,m−10, \dots, m-1.✦

Gates with controls act on a register built one qubit at a time. The register of nn control qubits around a system AA is the system Qn(A)Q_n(A) with Q0(A)=A,Qn+1(A)=qubit⊗Qn(A),Q_0(A) = A, \qquad Q_{n+1}(A) = \mathrm{qubit} \otimes Q_n(A),(1)✦ and Qn=Qn(qubit)Q_n = Q_n(\mathrm{qubit}) is a register of n+1n+1 qubits.

An identification ee of a system AA with a system BB is a linear isometric bijection from the state space of AA onto that of BB, and its inverse e−1e^{-1} identifies BB with AA.

The reindexing of a composite along a bijection ee of index sets is the identification that moves the factor at position ii to position e(i)e(i); on tensor powers it relabels the wires.✦ The split of A⊗(a+b)A^{\otimes(a+b)} is the identification of A⊗(a+b)A^{\otimes(a+b)} with A⊗a⊗A⊗bA^{\otimes a} \otimes A^{\otimes b} that divides the wire labels into a first block of aa and a last block of bb and sends a product of a+ba+b factors to the product of the first aa with the product of the last bb. The register QnQ_n is identified with the tensor power qubit⊗(n+1)\mathrm{qubit}^{\otimes(n+1)} by the identification ιn\iota_n, defined by recursion: ι0\iota_0 takes the qubit to its tensor power of one factor, and ιn\iota_n is the identity on the first qubit and ιn−1\iota_{n-1} on the rest, followed by the inverse of the split of qubit⊗(n+1)\mathrm{qubit}^{\otimes(n+1)} into qubit⊗qubit⊗n\mathrm{qubit} \otimes \mathrm{qubit}^{\otimes n}.✦

Gates

A unitary UU of a system AA is an operator on the state space of AA with U†U=UU†=1U^\dagger U = U U^\dagger = 1; it carries a pure state |ψ⟩|\psi\rangle of AA to the pure state U|ψ⟩U|\psi\rangle. For unitaries UU and VV of AA, UU after VV is the unitary UVUV, first VV and then UU, and the identity evolution is the unitary 11. For unitaries UU of AA and VV of BB, the product unitary U⊗VU \otimes V of A⊗BA \otimes B is the tensor product of the two operators; U⊗1U \otimes 1 is the gate UU on the first wires and 1⊗V1 \otimes V the gate VV on the last wires. Along an identification ee of AA with BB, a unitary UU of AA is carried to the unitary eUe−1e U e^{-1} of BB.✦ A linear isometric bijection of the state space of AA onto itself is a unitary of AA.✦

On the qubit, the Hadamard gate, the phase gate and the Pauli XX are the unitaries with the matrices H=12(111−1),S=(100i),X=(0110)H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}, \qquad S = \begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix}, \qquad X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}(2) in the computational basis |0⟩,|1⟩|0\rangle, |1\rangle.

For a unitary UU of a system AA, the controlled gate C(U)C(U) is the unitary of qubit⊗A\mathrm{qubit} \otimes A 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)✦ with the qubit as control and AA as target. The CNOT gate is C(X)C(X).✦ The doubly controlled gate C2(U)=C(C(U))C^2(U) = C(C(U)) acts on three qubits, and the Toffoli gate is C2(X)C^2(X). With nn controls, Cn(U)C^n(U) is the unitary of Qn(A)Q_n(A) given by C0(U)=UC^0(U) = U and Cn+1(U)=C(Cn(U))C^{n+1}(U) = C(C^n(U)).✦ The NOT gate with kk controls, XkX_k, is HS2HH S^2 H for k=0k = 0, which is XX since S2=diag⁡(1,−1)S^2 = \operatorname{diag}(1, -1), and Ck(X)C^k(X) for k≥1k \ge 1.✦

A single qubit gate gg acts on wire ii of QnQ_n, for 0≤i≤n0 \le i \le n, as the unitary g(i)g_{(i)} that applies gg to the qubit at position ii and the identity to the others.✦ On Q0Q_0 it is gg, and on Qn=qubit⊗Qn−1Q_n = \mathrm{qubit} \otimes Q_{n-1} it is g⊗1g \otimes 1 for i=0i = 0 and 1⊗g(i−1)1 \otimes g_{(i-1)} for i≥1i \ge 1.✦

Gates on several wires are placed on tensor powers. For a permutation σ\sigma of the wires of A⊗mA^{\otimes m}, the wire permutation gate PσP_\sigma is the unitary given by the isometry that moves the tensor factor on wire ii to wire σ(i)\sigma(i).✦ For a gate GG of A⊗aA^{\otimes a} and bb further wires, the gate GG on the front block of A⊗(a+b)A^{\otimes(a+b)} is G⊗1G \otimes 1 on A⊗a⊗A⊗bA^{\otimes a} \otimes A^{\otimes b}, carried to A⊗(a+b)A^{\otimes(a+b)} by the inverse of the split, and for a permutation σ\sigma of the wires the gate GσG_\sigma of A⊗(a+b)A^{\otimes(a+b)}, which applies GG on the wires σ(0),…,σ(a−1)\sigma(0), \dots, \sigma(a-1), is Gσ=Pσ(G⊗1)Pσ−1.G_\sigma = P_\sigma \, (G \otimes 1) \, P_{\sigma^{-1}} .(4)

The reversible generators of QnQ_n are the NOT, the CNOT and the Toffoli gate on any ordered choice of one, two or three of its n+1n+1 qubits, the gates ιn−1(ιkXkιk−1)σιn,k≤2,\iota_n^{-1} \bigl( \iota_k X_k \iota_k^{-1} \bigr)_\sigma \, \iota_n , \qquad k \le 2 ,(5)✦ where σ\sigma is a permutation of the k+1+b=n+1k+1+b = n+1 wires of (4), relabelled as the wires of QnQ_n. We write 𝒳n\mathcal{X}_n for their set.

The Measured Gadget

A measurement on a system AA with a finite set of outcomes is a family of operators MiM_i on the state space of AA, one for each outcome ii, satisfying the completeness relation ∑iMi†Mi=1\sum_i M_i^\dagger M_i = 1.✦ The projective measurement in an orthonormal basis {|bi⟩}\{|b_i\rangle\} has the operators |bi⟩⟨bi||b_i\rangle\langle b_i|.✦ A measurement on AA gives the measurement on the first wires of A⊗BA \otimes B, with operators Mi⊗1M_i \otimes 1, and the measurement on the last wires of B⊗AB \otimes A, with operators 1⊗Mi1 \otimes M_i. The cascade of two measurements LL and MM on one system, first LL and then MM, is the measurement with outcomes (l,m)(l, m) and operators MmLlM_m L_l.✦

The measurement of the control qubit of qubit⊗A\mathrm{qubit} \otimes A is the projective measurement of the qubit in the computational basis on the first wires, with operators |i⟩⟨i|⊗1|i\rangle\langle i| \otimes 1.✦ On three qubits, the measurement of the two ancillas measures the first qubit and then the second, and its operator for the outcome (i,j)(i, j) is Nij=(1⊗|j⟩⟨j|⊗1)(|i⟩⟨i|⊗1⊗1)=|i⟩⟨i|⊗|j⟩⟨j|⊗1.N_{ij} = \bigl(1 \otimes |j\rangle\langle j| \otimes 1\bigr) \bigl(|i\rangle\langle i| \otimes 1 \otimes 1\bigr) = |i\rangle\langle i| \otimes |j\rangle\langle j| \otimes 1 .(6)✦

The circuit of Figure 4.17 is the unitary K=WDW,W=H⊗H⊗1,D=Toffoli(1⊗1⊗S)ToffoliK = W D W, \qquad W = H \otimes H \otimes 1, \qquad D = \mathrm{Toffoli}\,(1 \otimes 1 \otimes S)\,\mathrm{Toffoli}(7)✦ of qubit⊗(qubit⊗qubit)\mathrm{qubit} \otimes (\mathrm{qubit} \otimes \mathrm{qubit}), the two ancillas followed by the target.

The interference amplitude of the ancilla outcome a′b′a'b' for the target bit tt is λa′b′(t)=(12)4∑a,b∈{0,1}it⊕ab(−1)aa′(−1)bb′,\lambda_{a'b'}(t) = \Bigl(\frac{1}{\sqrt{2}}\Bigr)^{4} \sum_{a, b \in \{0, 1\}} i^{\,t \oplus ab} \, (-1)^{a a'} \, (-1)^{b b'} ,(8)✦ with t⊕abt \oplus ab the sum modulo 22.

The circuit of Figure 4.17 followed by the measurement of its two ancillas is the gadget. A single qubit gate GG is realised by the gadget when there is a complex number cc with |c|2=5/8|c|^2 = 5/8 such that, for t=0t = 0 and t=1t = 1, N00K(|0⟩⊗|0⟩⊗|t⟩)=λ00(t)|0⟩⊗|0⟩⊗|t⟩,λ00(t)|t⟩=cG|t⟩.N_{00}\, K \bigl( |0\rangle \otimes |0\rangle \otimes |t\rangle \bigr) = \lambda_{00}(t)\, |0\rangle \otimes |0\rangle \otimes |t\rangle , \qquad \lambda_{00}(t)\, |t\rangle = c\, G |t\rangle .(9)✦ For any target state |ψ⟩|\psi\rangle, the outcome 0000 then has probability 5/85/8 and leaves the target in G|ψ⟩G|\psi\rangle.

We write ℱ\mathcal{F} for the set of gates realised by the gadget.

The Claim

The set ℛn\mathcal{R}_n of gates of QnQ_n reachable with the four gates and measurement consists of the products of generators, namely ℛn={E1E2⋯Em:m≥0,Ej∈{g(i):g∈{H,S}∪ℱ,0≤i≤n}∪𝒳n},\mathcal{R}_n = \bigl\{ E_1 E_2 \cdots E_m :\ m \ge 0,\ E_j \in \{ g_{(i)} : g \in \{H, S\} \cup \mathcal{F},\ 0 \le i \le n \} \cup \mathcal{X}_n \bigr\} ,(10) the empty product being the identity.

Theorem 1. Let nn be a natural number and UU a unitary of the register QnQ_n of n+1n+1 qubits. Then there is a real number α\alpha such that eiαUe^{i\alpha} U is a limit, in the operator norm, of gates of ℛn\mathcal{R}_n: eiαU∈ℛn¯.e^{i\alpha}\, U \in \overline{\mathcal{R}_n} .(11)✦

What Is Checked

The claim is stated over the unitaries of the register QnQ_n and the reachable gates (10), measurement entering through the condition (9) on the circuit (7) and the measurement (6) of its ancillas.

The library proves that the controlled gate C(U)C(U) of (3) is unitary for every unitary UU of any system, and with it every gate Ck(X)C^k(X).✦ It proves as well that a product and a tensor product of unitaries are unitary, and that the cascade of two measurements satisfies the completeness relation.