Lean, informalized

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

Problem 4.3 - The generator of a unitary, its Pauli expansion, a circuit for each string, and the error and gate count of the Trotter product

Any unitary as a limit of Trotter products of Pauli exponentials.

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 problem is to build any unitary UU on nn qubits, to within a distance ϵ\epsilon, from one and two qubit gates, by way of a Hamiltonian that generates it. One writes U=e−iHU = e^{-iH} with HH Hermitian and its eigenvalues between 00 and 2π2\pi, and expands H=∑ghggH = \sum_g h_g\, g with real coefficients hgh_g, where gg runs over the 4n4^n tensor products of nn Pauli matrices drawn from II, XX, YY and ZZ.

Fix a positive integer kk and set Δ=1/k\Delta = 1/k. Each factor e−ihggΔe^{-ih_g g\Delta} is a circuit of O(n)O(n) one and two qubit gates. The product of these factors over all gg, in a fixed order, is the Trotter product; it differs from e−iHΔe^{-iH\Delta} by O(Δ2)O(\Delta^2), and its kkth power differs from UU by O(4n/k)O(4^n/k). With kk large enough to bring this error below ϵ\epsilon, the whole circuit has O(n16n/ϵ)O(n\,16^n/\epsilon) gates.✦

The library states each of these steps as a theorem, and the circuit for a single factor as two: one for the unitary it computes, one for its gate count.

A Register of Qubits

A quantum system QQ is a physical system whose state space is a finite dimensional complex Hilbert space.✦ The qudit with dd levels is the quantum system whose state space is ℂd\mathbb{C}^d itself, with its standard inner product, and a register of nn qubits is the qudit with 2n2^n levels.✦ The computational basis of a register of nn qubits is the standard basis of ℂ2n\mathbb{C}^{2^n}, with vectors |x⟩|x\rangle labelled by bit strings x=(x1,…,xn)x = (x_1, \dots, x_n); the qubits of the register are its wires 1,…,n1, \dots, n.

A unitary UU of QQ is an operator on the state space of QQ with U†U=UU†=IU^\dagger U = U U^\dagger = I.✦ An observable HH of QQ is a self adjoint operator, H†=HH^\dagger = H, on the state space of QQ.✦ The propagator of an observable HH from time t1t_1 to time t2t_2 is the unitary e−iH(t2−t1)/ℏe^{-iH(t_2 - t_1)/\hbar}; with ℏ=1\hbar = 1, t1=0t_1 = 0 and t2=tt_2 = t it is e−iHte^{-iHt}.✦ The matrix of an observable HH of the qudit with dd levels is the matrix of HH in the standard basis of ℂd\mathbb{C}^d, with rows and columns labelled by bit strings when the qudit is a register.✦

The Pauli matrices are the four 2×22 \times 2 matrices σ0=I,σ1=X=(0110),σ2=Y=(0−ii0),σ3=Z=(100−1).\sigma_0 = I, \qquad \sigma_1 = X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, \qquad \sigma_2 = Y = \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}, \qquad \sigma_3 = Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}.(1) A Pauli string gg on nn qubits is a tensor product g=σg1⊗⋯⊗σgng = \sigma_{g_1} \otimes \cdots \otimes \sigma_{g_n} of one Pauli matrix for each wire, given by its indices gj∈{0,1,2,3}g_j \in \{0, 1, 2, 3\}; its matrix elements between computational basis states are ⟨x|g|y⟩=∏j(σgj)xjyj\langle x | g | y \rangle = \prod_j (\sigma_{g_j})_{x_j y_j}.✦ The support of gg is the set of wires jj with gj≠0g_j \neq 0.✦ For a real number cc, the Hamiltonian cgc\,g is the observable of the register whose matrix is cc times that of gg.✦

The Generator and Its Pauli Expansion

Theorem 1. Let UU be a unitary of a quantum system QQ. Then there is an observable HH of QQ with U=e−iH,spec⁡H⊆[0,2π],U = e^{-iH}, \qquad \operatorname{spec} H \subseteq [0, 2\pi],(2)✦ where spec⁡H\operatorname{spec} H is the spectrum of HH, its set of eigenvalues.

Theorem 2. Let HH be an observable of a register of nn qubits. Then there are real numbers hgh_g, one for each Pauli string gg on nn qubits, such that the matrix of HH is H=∑ghgg.H = \sum_g h_g\, g.(3)✦

A Circuit for One Pauli String

A single qubit gate GG on wire jj of a register is the unitary G(j)G^{(j)} of the register that acts as GG on qubit jj and as the identity on the others: ⟨x|G(j)|y⟩=Gxjyj\langle x | G^{(j)} | y \rangle = G_{x_j y_j} when the bit strings xx and yy agree on every wire but jj, and 00 otherwise.✦ The Pauli vector is σ→=(X,Y,Z)\vec\sigma = (X, Y, Z); for a vector n→\vec n in three dimensions with real components n1,n2,n3n_1, n_2, n_3, the matrix n→⋅σ→\vec n \cdot \vec\sigma is n1X+n2Y+n3Zn_1 X + n_2 Y + n_3 Z, and the rotation by an angle θ\theta about an axis nˆ\hat n is Rnˆ(θ)=exp⁡(−iθnˆ⋅σ→/2)R_{\hat n}(\theta) = \exp(-i\theta\, \hat n \cdot \vec\sigma / 2); about the zˆ\hat z axis, nˆ=(0,0,1)\hat n = (0, 0, 1), it is Rz(θ)=e−iθZ/2R_z(\theta) = e^{-i\theta Z/2}.

The basis change gates B0,…,B3B_0, \dots, B_3 are made from the Hadamard gate 𝖧\mathsf{H} and the phase gate SS: 𝖧=12(111−1),S=(100i),B0=B3=I,B1=𝖧,B2=S𝖧.\mathsf{H} = \frac{1}{\sqrt 2} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}, \qquad S = \begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix}, \qquad B_0 = B_3 = I, \quad B_1 = \mathsf{H}, \quad B_2 = S\mathsf{H}.(4) The basis change layer of a Pauli string gg on nn qubits is B=Bg1(1)Bg2(2)⋯Bgn(n)B = B_{g_1}^{(1)} B_{g_2}^{(2)} \cdots B_{g_n}^{(n)}, the gate BgjB_{g_j} of (4) on each wire jj.

For a set AA of control wires and a target wire bb outside AA, the multiply controlled NOT is the permutation of bit strings that flips bit bb when every control bit is 11, xb↦xb⊕∏i∈Axi,x_b \mapsto x_b \oplus \prod_{i \in A} x_i,(5) and leaves the other bits unchanged; here ⊕\oplus is addition modulo 22. The gate of the multiply controlled NOT with controls AA and target bb is the unitary of the register that permutes the computational basis states |x⟩|x\rangle in the same way.✦ The CNOT gate CNOTab\mathrm{CNOT}_{ab} with control aa and target bb is the case of one control, A={a}A = \{a\}.✦

For a wire w0w_0 and a list w1,…,wrw_1, \dots, w_r of other wires, the CNOT fan F=CNOTw1w0⋯CNOTwrw0F = \mathrm{CNOT}_{w_1 w_0} \cdots \mathrm{CNOT}_{w_r w_0} adds the bits on w1,…,wrw_1, \dots, w_r to the bit on w0w_0, modulo 22.✦ The circuit V(θ)V(\theta) for a Pauli string gg on the wires w0,w1,…,wrw_0, w_1, \dots, w_r, with w0w_0 the collector wire on which the rotation acts, at an angle θ\theta, is V(θ)=BF†Rz(w0)(θ)FB†.V(\theta) = B\, F^\dagger\, R_z^{(w_0)}(\theta)\, F\, B^\dagger.(6)✦

Theorem 3. Let gg be a Pauli string on nn qubits whose support consists of the distinct wires w0,w1,…,wrw_0, w_1, \dots, w_r, and let cc and tt be real numbers. Then the circuit (6) for gg with collector wire w0w_0 and wires w1,…,wrw_1, \dots, w_r satisfies V(2ct)=e−ictg.V(2ct) = e^{-ictg}.(7)✦

A unitary UU of a register has gate budget (N,M)(N, M), written U∈𝒢(N,M)U \in \mathcal{G}(N, M), when it is built, up to an isomorphism of registers (a unitary identification of their state spaces), as a product of pieces of two kinds, with at most NN gates counted in pieces of the first kind and at most MM in pieces of the second. A piece of the first kind is a classical block: a unitary that sends each computational basis state |x⟩|x\rangle to |x′⟩|x'\rangle, where x′x' is what a sequence of NOT, CNOT and Toffoli gates (multiply controlled NOT gates with at most two controls) makes of xx, counted as the number of gates in the sequence.✦ A piece of the second kind is a single qubit gate, possibly beside idle qubits and possibly controlled by one further qubit, counted as one.

Theorem 4. Let gg be a Pauli string on a register of n+1n + 1 qubits, w0w_0 a wire, w1,…,wrw_1, \dots, w_r wires other than w0w_0, and θ\theta a real number. Then the circuit for gg with collector wire w0w_0 and wires w1,…,wrw_1, \dots, w_r satisfies V(θ)∈𝒢(2r,2n+3).V(\theta) \in \mathcal{G}(2r,\ 2n + 3).(8)✦

The Trotter Product

Let real coefficients hgh_g be given, one for each Pauli string gg on nn qubits. The Trotter factor of gg at time tt is the circuit Wg(t)=V(2hgt)W_g(t) = V(2 h_g t) for gg, with the first wire of its support as collector wire and the rest of the support as the other wires; for the identity string, whose support is empty, it is the global phase gate Wg(t)=e−ihgtIW_g(t) = e^{-i h_g t}\, I.✦ The Trotter step is the product of the factors over all Pauli strings, W(t)=∏gWg(t).W(t) = \prod_g W_g(t).(9)✦

The norm ∥A∥\|A\| of an operator AA is its operator norm, the largest length of A|ψ⟩A|\psi\rangle over unit vectors |ψ⟩|\psi\rangle, and the gate error between unitaries UU and VV is E(U,V)=∥U−V∥E(U, V) = \|U - V\|.✦ A fixed numerical constant KK appears in the error bounds of Theorems 6 and 7.

Theorem 5. Let HH be an observable of a register of nn qubits. Then there are real numbers hgh_g, one for each Pauli string gg, and a constant C≥0C \ge 0 such that for every Δ\Delta with 0≤Δ≤10 \le \Delta \le 1 ∥∏ge−ihggΔ−e−iHΔ∥≤CΔ2.\Bigl\| \prod_g e^{-i h_g g \Delta} - e^{-iH\Delta} \Bigr\| \le C \Delta^2.(10)✦

Theorem 6. Let UU be a unitary of a register of nn qubits. Then there are real numbers hgh_g, one for each Pauli string gg, such that for every positive integer kk ∥(∏ge−ihgg/k)k−U∥≤K(2π⋅2n)2k.\Bigl\| \Bigl( \prod_g e^{-i h_g g / k} \Bigr)^k - U \Bigr\| \le \frac{K\, (2\pi \cdot 2^n)^2}{k}.(11)✦

Theorem 7. Let UU be a unitary of a register of n+1n + 1 qubits. Then there are real numbers hgh_g, one for each Pauli string gg, such that for every ϵ>0\epsilon > 0 there is a positive integer kk for which the kkth power of the Trotter step W(1/k)W(1/k) of these coefficients, with N=2nk4n+1N = 2n\, k\, 4^{n+1} and M=(2n+3)k4n+1M = (2n + 3)\, k\, 4^{n+1}, satisfies E(W(1/k)k,U)≤ϵ,W(1/k)k∈𝒢(N,M),N+M≤4π2K(4n+3)16n+1ϵ+(4n+3)4n+1.\begin{gathered} E\bigl(W(1/k)^k,\, U\bigr) \le \epsilon, \qquad W(1/k)^k \in \mathcal{G}(N, M), \\ N + M \le \frac{4\pi^2 K\, (4n + 3)\, 16^{n+1}}{\epsilon} + (4n + 3)\, 4^{n+1}. \end{gathered}(12)✦

What Is Checked

The seven theorems are stated over the unitaries and observables of a quantum system and of a register of qubits, the propagator e−iHte^{-iHt}, the Pauli strings and their Hamiltonians cgc\,g, the circuit VV of (6), the Trotter step WW of (9) built from it, the gate error and the gate budget.

About these constructions the library proves that the propagator of an observable is a unitary, that a Pauli string is Hermitian, so that cgc\,g is an observable, and that the adjoint U†U^\dagger of a unitary is a unitary. It proves that the multiply controlled NOT is its own inverse, so that its gate is a unitary, and that the basis change gates, the rotations Rz(θ)R_z(\theta), a single qubit unitary placed on one wire and the global phase gate are unitaries of the register.