betaFeedback

WorksPhysics and Astronomy

The Robustness of QAC0

Abstract

In this work we study the robustness of QAC0\mathsf{QAC}^0 with respect to error tolerance and modifications to its gate-set. First, we investigate whether the non-zero error typically allowed for QAC0\mathsf{QAC}^0 circuits computing Boolean functions is truly necessary. We show that the error inherent in the parallel WW-test of \cite{grier_morris_wu} can be eliminated entirely via a novel application of exact amplitude amplification in the many-copies context. Consequently, we find that QAC0\mathsf{QAC}^0 can exactly simulate TC0\mathsf{TC}^0 with polynomially many copies of the classical input and that for every fixed prime pp exact QAC0\mathsf{QAC}^0, EQAC0\mathsf{EQAC}^0, can compute total Boolean functions outside of AC0[p]\mathsf{AC}^0[p]. Second, we ask to what extent the computational power of QAC0\mathsf{QAC}^0 follows from the fact that arbitrary single-qubit gates may be used at any point in the circuit. We find that QAC0\mathsf{QAC}^0 is in fact robust to restrictions on which single-qubit gates are permitted: every QAC0\mathsf{QAC}^0 circuit can be approximately implemented by a QAC0\mathsf{QAC}^0 circuit consisting of just generalized Toffoli, SS, and Hadamard gates. Moreover, this approximating circuit can be constructed efficiently from a classical description of the original circuit.

Introduction

Understanding which features of a computational model are essential to its power is a central goal of quantum complexity theory. Two very natural aspects of a computational model which may be essential for its power are 1) the set of allowed operations (or more specifically gates in circuit models) and 2) whether computations in the model can be made errorless. Further, these questions are particularly delicate for constant-depth quantum circuit models as standard methods for error reduction and and gate synthesis may require a super-constant factor blow-up in circuit depth. In this work, we explore these questions in the context of QAC0\mathrm{QAC}^{0} - the class of problems decidable by constant-depth, polynomial-size quantum circuits which use polynomially many ancilla qubits and consist of generalized Toffoli and arbitrary single-qubit gates.

This class was originally introduced by Moore as a quantum analogue of AC0\mathrm{AC}^{0} in [Moo99], though it has proven to be substantially more difficult to characterize than its classical counterpart. While a plethora of combinatorial and analytic techniques have given us a very precise understanding of the limitations of AC0\mathrm{AC}^{0} [4, 8 Hås86, 15], the same cannot be said for QAC0\mathrm{QAC}^{0} despite numerous lower bounds in restricted settings [19, 13, 2, 18]. As such, QAC0\mathrm{QAC}^{0} sits at the frontier of our understanding of shallow quantum computation.

Recent work has shown that QAC0\mathrm{QAC}^{0} can solve tasks beyond the reach of AC0\mathrm{AC}^{0} - a phenomena that is provably false for the weaker quantum circuit model QNC0\mathrm{QNC}^{0}. Explicitly, [9] showed that bounded-error QAC0\mathrm{QAC}^{0} circuits can compute total Boolean functions outside AC0[p]\mathrm{AC}^{0}[p] for every fixed prime (p)(p). They also showed that arbitrary TC0\mathrm{TC}^{0} circuits can be simulated by to inverse exponential error by a QAC0\mathrm{QAC}^{0} circuit supplied with polynomially many copies of the classical input.

One limitation of this result is that inverse-exponential error in either result cannot be eliminated in an obvious way. Another is that the gates used in these constructions are somewhat non-standard; for different input sizes nn, the quantum circuit witnessing the simulation requires different single-qubit gates. Moreover, these gates do not lie in the Clifford hierarchy in general.

These limitations of the construction raise the following broader questions about QAC0\mathrm{QAC}^{0}:

  1. Must QAC0\mathrm{QAC}^{0} circuits have some non-zero when computing Boolean functions or can any such computation be made exact? Does QAC0\mathrm{QAC}^{0}’s advantage against AC0[p]\mathrm{AC}^{0}[p] vanish if zero-error is required?

  1. Are all single-qubit gates necessary for QAC0\mathrm{QAC}^{0} to retain its power? Does QAC0\mathrm{QAC}^{0} admit a discrete gate-set, i.e., can QAC0\mathrm{QAC}^{0} circuits be implemented with just generalized Toffoli and finitely many single qubit gates?

A number of methods for gate synthesis and error reduction have been developed for generic quantum circuits - however, they cannot be immediately applied to the constant-depth regime. In particular, the Solovay-Kitaev theorem shows that any fixed, inverse-closed set of single-qubit gates generating a dense subgroup of SU(2)\mathrm{SU}(2) can approximate an arbitrary single-qubit unitary to accuracy ϵ\epsilon using only polylog⁡(1/ϵ)\operatorname{polylog}(1/\epsilon) gates [Sol95, Kit97]. However, this method in general result in a compiled circuit whose depth is a super-constant factor larger than the original.

Shi further showed that the Hadamard and Toffoli gate can be leveraged to simulate arbitrary quantum computations, so a gate-set need not generate a dense subset of SU(2)\mathrm{SU}(2) in order to be universal [Shi03]. Again though, this construction can in general result in an increase in circuit depth by a factor of nn, the number of qubits the circuit acts on.

Our first main result is that QAC0\mathrm{QAC}^{0} does indeed admit a simple, discrete gate-set:

Theorem 1 (See also Theorem 9). For every ϵ>0\epsilon> 0 and QAC circuit, QQ, of depth- dd and size- ss acting on nn qubits there exists a depth- O(d)O(d), size O(slog⁡2s/ϵ)O(s\log^2 s/\epsilon) circuit, Q~\widetilde{Q}, acting on O(n+slog⁡2s/ϵ)O(n+s\log^2 s/\epsilon) qubits such that Q~\widetilde{Q} only consists of generalized Toffoli, Hadamard, and SS gates and has operator-norm distance at most ϵ\epsilon from Im⊗QI_m \otimes Q (where ImI_m accounts for ancilla qubits used by Q~\widetilde{Q}). Moreover, Q~\widetilde{Q} can be found efficiently given the description of QQ.

Regarding error elimination, exact amplitude amplification provides a method for eliminating error when the initial success probability is known [11, 7]. However, a direct application need not preserve circuit depth: the standard construction uses a sequence of applications of the original circuit and its inverse and the precise number of iterations depends on the original success probability. For the WW-test, the rejection probability on an incorrect input can be as small as Θ(1/n2)\Theta(1/n^2), leading to a non-constant number of sequential amplification steps. Parallel repetition improves this probability to a constant, but its precise value still depends on the Hamming weight of the input, which is precisely the quantity we are interested in computing. Obtaining an exact constant-depth implementation therefore requires overcoming both the sequential nature of the amplification and its dependence on the initial success probability.

Our second main result does precisely this:

Theorem 2 (See also Theorem 12). Every language in TC0\mathrm{TC}^0 can be computed exactly by a family of constant-depth, polynomial-size QAC circuits using polynomially many copies of its input. Consequently,

TC0⊆EQAC0∘NC0.\mathrm{TC}^0 \subseteq\mathrm{EQAC}^0 \circ\mathrm{NC}^0.

Further, this exactification carries over to the decision problem separation of [9], i.e., EQAC0⊄AC0[p]\mathrm{EQAC}^0 \not\subset\mathrm{AC}^0[p] for any fixed prime pp (see Corollary 14), meaning that QAC0\mathrm{QAC}^0 can still exhibit quantum advantage against AC0\mathrm{AC}^0 even in the zero-error regime.

In addition to these two robustness results we develop several new QAC0\mathrm{QAC}^0 primitives which may be of interest for further QAC0\mathrm{QAC}^0 constructions.

The first primitive is a random selector: given an nn-bit string xx, it returns a random coordinate i∈[n]i \in[n] with xi=1x_i = 1. In addition, we show that both its binary and unary encodings can be obtained in QAC0\mathrm{QAC}^0.

Theorem 3 (Random selector; see also Theorem 15 and Theorem 16). There are constant-depth, polynomial-size QAC circuits that, on nonzero x∈{0,1}nx \in\{0,1\}^n, with probability at least 1−2−polylog⁡(n)1 - 2^{-\operatorname{polylog}(n)}, output a uniformly random location i∈[n]i \in[n] with xi=1x_i = 1, encoded either in binary or as an nn-bit indicator vector eie_i.

Our second primitive is an approximate counter that estimates the Hamming weight of an input binary string. While it is a combination of known geometric counting sketch [Ajt93, Vio14] and known QAC0\mathrm{QAC}^0 primitives [9], we find it very interesting and document it here.

Theorem 4 (Approximate counter; see also Theorem 17). There is a constant-depth, polynomial-size QAC circuit that, on input x∈{0,1}nx \in\{0,1\}^n, with probability at least $1 - 2^{-\operatorname{polylog}(n)},∗computestheHammingweightof∗, *computes the Hamming weight of*x up to 1/polylog⁡(n)1/\operatorname{polylog}(n) relative errors.

Technical overview

Next, we give an overview of our techniques and highlight the novel aspects of each construction.

A discrete gate-set for QAC0^{0}. Standard quantum compilation techniques may result in a super-constant factor depth blow-up. In particular, synthesis over a fixed set of single-qubit gates generally improves accuracy by using a longer sequence of gates acting on the target qubit. To circumvent this our construction encodes the parameters of a target gate in a coherent sampling circuit whose size increases with the desired precision while its depth remains constant.

Our starting point is a construction which for any p∈[0,1]p \in[0,1] and ϵ>0\epsilon> 0 produces a constant-depth circuit on m=O(log⁡21/ϵ)m = O(\log^{2} 1/\epsilon) qubits, QQ, such that

  • QQ consists only of Hadamard and Generalized Toffoli gates and

  • Measuring the final qubit of Q∣0m⟩Q \lvert0^{m}\rangle yields ∣1⟩\lvert1\rangle with probability p~∈[p−ϵ,p+ϵ]\widetilde{p} \in[p-\epsilon,p+\epsilon]

QQ is found via a binary search-like procedure wherein we iteratively construct a DNF whose acceptance probability for a uniformly random input approaches pp as more clauses are added. Finally, evaluating this DNF on ∣+⟩m\lvert+\rangle^{m} yields the desired single-qubit marginal which will be entangled with the ancilla used by the rest of the circuit.

Next, we make use of the fact that up to a ZZ correction any real single-qubit gate can be written as

Uθ:=(cos⁡θsin⁡θsin⁡θ−cos⁡θ)=cos⁡θZ+sin⁡θX.U_{\theta} := \begin{pmatrix} \cos\theta& \sin\theta\\ \sin\theta& -\cos\theta\end{pmatrix} = \cos\theta Z + \sin\theta X.

for some θ∈[0,2π]\theta\in[0,2\pi]. Moreover, we may write UθU_{\theta} as a linear combination of {−X,X,−Z,Z}\{-X,X,-Z,Z\} using only non-negative coefficients. Using the coherent samplers and an additional Hadamard gate, we prepare a superposition of labels for these four operators, with probabilities given by the normalized coefficients. Next, we control on the label register to apply {−X,X,−Z,Z}\{-X,X,-Z,Z\} coherently, resulting in the application of U~θ\widetilde{U}_{\theta} and not exactly UθU_{\theta} due to the error incurred by the coherent sampler. After uncomputation of the sampler registers, the non-negative coefficients are always normalized in such a way that in the all-zeros ancilla branch U~θ\widetilde{U}_{\theta} has been applied and this branch has amplitude exactly 12\frac{1}{2}. Finally, we apply amplitude amplification to approximately obtain ∣0m⟩U~θ∣ψ⟩\lvert0^{m}\rangle\widetilde{U}_{\theta}\lvert\psi\rangle.

Thus, we can approximately implement arbitrary real single-qubit unitaries using Hadamard and generalized Toffoli in constant depth - with the SS gate and real single-qubit gates we can construct an approximate implementation of any single-qubit gate in constant depth.

Exactificaiton of the many-copy WW-test. First, recall the techniques developed in [9] to simulate TC0\mathrm{TC}^{0} via a QAC0\mathrm{QAC}^{0} circuit which acts on multiple copies of the input string. The primary technical tool underlying this simulation is a primitive called the “WW-test”. The WW-test is a QAC0\mathrm{QAC}^{0} circuit which takes x∈{0,1}nx \in\{0,1\}^{n} as input and produces a state ∣ψx⟩\lvert\psi_{x}\rangle of the form

∣ψx⟩=n−2∣x∣n∣ψx0⟩∣0⟩+1−(n−2∣x∣n)2∣ψx1⟩∣1⟩\lvert\psi_{x}\rangle= \frac{n-2\lvert x\rvert}{n}\lvert\psi_{x}^{0}\rangle\lvert0\rangle+ \sqrt{1-\left(\frac{n-2\lvert x\rvert}{n}\right)^{2}}\lvert\psi_{x}^{1}\rangle\lvert1\rangle

where ∣ψx0⟩\lvert\psi_{x}^{0}\rangle and ∣ψx1⟩\lvert\psi_{x}^{1}\rangle are some normalized states. The measurement outcome of this final qubit is treated as the output of the WW-test. This means that

  • If ∣x∣=n/2\lvert x\rvert= n/2 then measuring the final qubit of ∣ψx⟩\lvert\psi_{x}\rangle yields ∣1⟩\lvert1\rangle with probability 1

  • If ∣x∣≠n/2\lvert x\rvert\ne n/2 then measuring the final qubit of ∣ψx⟩\lvert\psi_{x}\rangle yields ∣0⟩\lvert0\rangle with probability at least 1/n21/n^{2}

Hence, the WW-test computes EXn/2\mathrm{EX}_{n/2} with perfect completeness and 1−1/poly⁡(n)1-1/\operatorname{poly}(n) soundness. Running the WW-test in parallel mm times will yield outcomes b1,…,bm∈{0,1}b_1,\ldots,b_m \in\{0,1\} and if ∣x∣=n/2|x| = n/2 then all of these bits will be 11 with certainty. However, if ∣x∣≠n/2|x| \ne n/2 then at least one bib_i will be equal to 00 with probability (1−1n2)m\left(1-\frac{1}{n^2}\right)^m. So in this case, if m≫n2log⁡nm \gg n^2 \log n, then Pr⁡[b1∧⋯∧bm=1]≤1/n\Pr[b_1 \wedge\cdots\wedge b_m = 1] \le1/n.

When mm copies of xx are given as input the WW-test can be ran in parallel and then AND of their outputs yields EXn/2(x)\mathrm{EX}_{n/2}(x) with high probability. Indeed, the error can be made inverse exponential with n2+Ω(1)n^{2+\Omega(1)} copies of the input. However, standard techniques (i.e. parallel repetition) will fail to improve the error beyond this.

To go beyond inverse-exponential error and indeed remove it completely, we turn to exact amplitude amplification. Explicitly, our goal to take ∣ψx⟩⊗m|\psi_x\rangle^{\otimes m} and amplify the amplitude on the branch in which some WW-test yields ∣0⟩|0\rangle, if this occurs with non-zero probability. In the case of ∣x∣=n/2|x| = n/2 nothing need be done, as the qubit corresponding to the value of b1∧⋯∧bmb_1 \wedge\cdots\wedge b_m is already ∣1⟩|1\rangle. If ∣x∣≠n/2|x| \ne n/2 then the desired branch has weight Ω(1)\Omega(1) when m=Ω(n2)m = \Omega(n^2), but precisely how much ∣ψx⟩⊗m|\psi_x\rangle^{\otimes m} overlaps with the desired state depends on ∣x∣|x| - the quantity this construction is meant to reveal some information about.

To address this apparent circularity we observe that if ∣x∣|x| is promised to be either n/2n/2 or some k∈{0,1,…,n}∖{n/2}k \in\{0,1,\ldots,n\} \setminus\{n/2\} then ∣ψx⟩⊗m|\psi_x\rangle^{\otimes m}’s outcome qubits will either be ∣1⟩⊗m|1\rangle^{\otimes m} or have some fixed constant amplitude on the branch in which some output qubit is ∣0⟩|0\rangle. Hence, for this promise problem exact amplitude amplification can be applied in constant depth to perfectly distinguish strings of weight kk from strings of weight n/2n/2. With sufficiently many classical copies of xx we may solve each of these promise problems in parallel and in the case that ∣x∣=k≠n/2|x| = k \ne n/2, the corresponding promise problem WW-test will reveal this with certainty.

Future directions

One immediate question left open by our work is whether the SS gate is still necessary for QAC0\mathrm{QAC}^0. Of course, any QAC circuit implemented with just HH and generalized Toffoli will result in a unitary with real entries. One reason to suggest that this gate may not be necessary for QAC0\mathrm{QAC}^0 is that no QAC0\mathrm{QAC}^0 construction for computing a Boolean function uses this gate and it has been proven to be unnecessary once the circuit depth can grow like Ω(n)\Omega(n) [3].

Additionally, the fact that arbitrary QAC0\mathrm{QAC}^0 circuits can be compiled with this discrete gate-set may allow for new lower-bound approaches which take advantage of additional structure this new gate-set entails.

Similarly, the construction presented in Section 4 combined with prior work [9] shows that every Boolean function known to be in BQAC0\mathrm{BQAC}^0 is also computable in EQAC0\mathrm{EQAC}^0. So, we leave open the question of whether BQAC0=EQAC0\mathrm{BQAC}^0 = \mathrm{EQAC}^0. It is quite unclear how a generic exactification procedure might be implemented, given that it is still quite unclear which types of Boolean functions are even in BQAC0\mathrm{BQAC}^0.

Preliminaries

For integer n≥1n \ge1, we use [n][n] to denote the set {1,2,…,n}\{1,2,\ldots,n\}. We use In\mathbb{I}_n to denote the identity operator on nn qubits, and omit nn when the dimension is clear.

For every x∈{0,1}nx \in\{0,1\}^n, we use ∣x∣|x| to denote its Hamming weight. For binary strings x,yx,y of equal length, we use x⊕yx \oplus y to denote their bitwise XOR. For integers k≥0k \ge0, EXk(x)\mathrm{EX}_k(x) and THR≥k(x)\mathrm{THR}_{\ge k}(x) indicate whether ∣x∣=k|x| = k and ∣x∣≥k|x| \ge k, respectively.

Our circuit upper bounds (i.e., constructions) are uniform circuits that can be efficiently extracted from our proofs and descriptions. All our circuit lower bounds hold with respect to non-uniform circuits. The (non-)uniformity is not our focus and we do not discuss it in detail.

Classical circuit complexity. In a Boolean circuit, every gate evaluates some Boolean function on the input wires and passes the result onward via its output wires. For a Boolean circuit,

  • depth is defined as the maximal length from an input bit to output and size is defined as the total number of gates in the circuit;

  • fanin is the maximal number of input wires of each gate, fanout is the maximal number of output wires of each gate, and gate set is the set of different gates.

We use ¬\neg to denote the negation gate; and use AND (resp., OR) to denote the AND (resp., OR) gate/function. Sometimes we use ANDn,ORn\mathrm{AND}_n,\mathrm{OR}_n to highlight that the function takes nn bit input and it will be clear from the context when we omit it.

We will need the following standard classical circuit classes. Here we give informal description and refer readers to textbooks [1, 12] for formal definitions.

  • NC0\mathrm{NC}^0 is the set of languages that can be exactly decided by constant-depth polynomial-size Boolean circuits with bounded fanin and unrestricted fanout. We also use NC0\mathrm{NC}^0 for maps with polynomially many output bits computed by such circuits.

  • AC0\mathrm{AC}^0 is the set of languages that can be exactly decided by constant-depth polynomial-size Boolean circuits of gate set {¬,AND,OR}\{\neg,\mathrm{AND},\mathrm{OR}\}.

  • AC0[m]\mathrm{AC}^0[m] is the set of languages that can be exactly decided by constant-depth polynomial-size Boolean circuits of gate set {¬,AND,OR,MODm}\{\neg,\mathrm{AND},\mathrm{OR},\mathrm{MOD}_m\}. ACC0\mathrm{ACC}^0 is the union of AC0[m]\mathrm{AC}^0[m] for all m≥2m \ge2.

  • TC0\mathrm{TC}^0 is the set of languages that can be exactly decided by constant-depth polynomial-size Boolean circuits of gate set {¬,(THR≥k)k≥0}\{\neg,(\mathrm{THR}_{\ge k})_{k \ge0}\}.

For decision problems, the following strict inclusions are known to be true for every fixed prime pp: AC0⊊AC0[p]⊊TC0\mathrm{AC}^0 \subsetneq\mathrm{AC}^0[p] \subsetneq\mathrm{TC}^0 [4, 8 Hås86, 20 Smo87]. It is also easy to prove that ACC0⊆TC0\mathrm{ACC}^0 \subseteq\mathrm{TC}^0. While it is widely believed that this inclusion is strict, it is yet to be proven.

(Multi-qubit) quantum gates. The quantum fanout gate FnF_n is an (n+1)(n+1)-qubit unitary defined by

Fn:∣b⟩∣x1,…,xn⟩→∣b⟩∣x1⊕b,…,xn⊕b⟩for every x1,…,xn,b∈{0,1}.F_n : |b\rangle|x_1,\ldots,x_n\rangle\to|b\rangle|x_1 \oplus b,\ldots,x_n \oplus b\rangle\quad\text{for every } x_1,\ldots,x_n,b \in\{0,1\}.

Every Boolean function f:{0,1}n→{0,1}f:\{0,1\}^n \to\{0,1\} naturally induces an (n+1)(n+1)-qubit unitary UfU_f by

Uf:∣x1,…,xn⟩∣b⟩→∣x1,…,xn⟩∣b⊕f(x1,…,xn)⟩for every x1,…,xn,b∈{0,1}.U_f : |x_1,\ldots,x_n\rangle|b\rangle\to|x_1,\ldots,x_n\rangle|b \oplus f(x_1,\ldots,x_n)\rangle\quad\text{for every } x_1,\ldots,x_n,b \in\{0,1\}.

The generalized Toffoli gate corresponds to UANDnU_{\mathrm{AND}_n} for all n≥1n \ge1. When clear from context, we sometimes use AND, OR to denote UANDU_{\mathrm{AND}}, UORU_{\mathrm{OR}}.

Quantum circuits. A quantum circuit CC is a product of layers of non-overlapping quantum gates, i.e., a single layer consists of quantum gates acting on disjoint sets of qubits and a circuit consists of multiple layers of gates:

  • A circuit CC has depth dd if C=MdMd−1⋯M1C = M_d M_{d-1} \cdots M_1 where each MiM_i is a product of gates operating on disjoint sets of qubits. The size of CC is the total number of gates in CC and qubits that CC operates on.

  • Let SS be a set of unitaries. We say CC has gate set SS if every gate of CC belongs to SS, i.e. CC only consists of gates belonging to SS.

Let f:{0,1}n→{0,1}f : \{0,1\}^n \to\{0,1\}. We say CC decides ff with aa ancillas and error ϵ\epsilon if for every x∈{0,1}nx \in\{0,1\}^n, the last qubit of C∣x⟩∣0a⟩∣0⟩C \lvert x\rangle\lvert0^a\rangle\lvert0\rangle measures, in the computational basis, to ∣f(x)⟩\lvert f(x)\rangle with probability at least 1−ϵ1-\epsilon. In addition, we say

  • it has completeness cc if for every x∈f−1(1)x \in f^{-1}(1), the output qubit measures to ∣1⟩\lvert1\rangle with probability at least cc;

  • and has soundness ss if for every x∈f−1(0)x \in f^{-1}(0), the output qubit measures to ∣1⟩\lvert1\rangle with probability at most ss.

If CC decides ff with zero error, then we say CC exactly decides ff and we can assume without loss of generality C∣x⟩∣0a⟩∣0⟩=∣x⟩∣0a⟩∣f(x)⟩C \lvert x\rangle\lvert0^a\rangle\lvert0\rangle= \lvert x\rangle\lvert0^a\rangle\lvert f(x)\rangle by standard uncomputation, which incurs an insignificant constant blowup in the depth and size of the circuit.

QAC and QAC0^0. We primarily work with QAC circuits and the corresponding quantum circuit class QAC0^0. See [17, 6] for a more comprehensive introduction.

A quantum circuit is a QAC circuit if it only uses single-qubit gates and generalized Toffoli gates. We distinguish QAC0^0 as the following finer classes EQAC0^0 and BQAC0^0.

  • EQAC0^0 is the set of languages that can be exactly decided by constant-depth polynomial-size QAC circuits.

  • BQAC0^0 is the set of languages that can be decided with error4 at most 1/31/3 by constant-depth polynomial-size QAC circuits.

We emphasize that the standard definition of QAC0^0 allows for arbitrary single-qubit gates, i.e., the gateset includes the set of all single-qubit gate. We allow ancillary qubits in our quantum circuits, the number of which will be upper bounded by the circuit size. We also remark that the quantum OR gate UOR:∣x⟩∣b⟩↦∣x⟩∣b⊕OR⁡(x)⟩U_{\mathrm{OR}} : \lvert x\rangle\lvert b\rangle\mapsto\lvert x\rangle\lvert b \oplus\operatorname{OR}(x)\rangle is in QAC0^0.

Classical copies and composition. We write EQAC0∘^0 \circ NC0^0 for Boolean function families of the form f=g∘hf = g \circ h, where hh is an NC0^0 map with polynomial output length and gg is computable in EQAC0^0. In our applications, hh is the copying map x↦(x,…,x)x \mapsto(x,\ldots,x), which supplies polynomially many classical copies of xx. For a Boolean function f:{0,1}n→{0,1}f:\{0,1\}^{n}\to\{0,1\} and an integer m≥1m\ge1, define its mm-copy lift f↑m:({0,1}n)m→{0,1}f^{\uparrow m}:\left(\{0,1\}^{n}\right)^{m}\to\{0,1\} by

f↑m(x(1),…,x(m))={f(x(1))if x(1)=⋯=x(m),0otherwise.f^{\uparrow m}\left(x^{(1)},\ldots,x^{(m)}\right)= \begin{cases} f\left(x^{(1)}\right) & \text{if }x^{(1)}=\cdots=x^{(m)},\\ 0 & \text{otherwise.} \end{cases}

Thus f↑mf^{\uparrow m} is a total Boolean function on mnmn input bits, with inconsistent copies rejected.

Unitary approximation and block encodings. We use ∥⋅∥\lVert\cdot\rVert for the Euclidean norm of vectors and the operator norm of operators. In this work we use the following notion of approximation when discussing a quantum circuit which approximates a unitary:

Definition 5 (Approximation with ancillas). Let UU be a unitary on nn qubits and let CC be a circuit using n+an+a qubits. The circuit CC approximates UU to error ε\varepsilon if

∥C∣0a⟩∣ψ⟩−∣0a⟩U∣ψ⟩∥≤ε\lVert C\lvert0^{a}\rangle\lvert\psi\rangle-\lvert0^{a}\rangle U\lvert\psi\rangle\rVert\le\varepsilon

for every nn-qubit state ∣ψ⟩\lvert\psi\rangle.

Definition 5 controls both the error on the input register and the error in uncomputing the ancillas.

Definition 6 (Block encoding). The all-zero ancilla block of a unitary circuit LL using aa ancillas is the operator BB given by

B:=(⟨0a∣⊗I)L(∣0a⟩⊗I).B:=\left(\langle0^{a}\rvert\otimes I\right)L\left(\lvert0^{a}\rangle\otimes I\right).

Equivalently, BB is determined by

L∣0a⟩∣ψ⟩=∣0a⟩B∣ψ⟩+∣Φ⟩,L\lvert0^{a}\rangle\lvert\psi\rangle=\lvert0^{a}\rangle B\lvert\psi\rangle+\lvert\Phi\rangle,

where ∣Φ⟩\lvert\Phi\rangle may depend on ∣ψ⟩\lvert\psi\rangle and is orthogonal to the subspace in which all aa ancillas are zero. We call LL a block encoding of BB.

Measuring the ancillas after applying LL gives the all-zero outcome with probability ∥B∣ψ⟩∥2\lVert B\lvert\psi\rangle\rVert^{2}. In particular, if B=U/2B=U/2 for a unitary UU, this probability is 1/41/4, and the conditional state is U∣ψ⟩U\lvert\psi\rangle. Thus, block-encoding U/2U/2 does not by itself implement UU with ancillas returned to zero. Section 3 uses amplitude amplification to convert an approximate block encoding of this form into an approximation satisfying Definition 5.

Prior constructions. We will make use of the following QAC0\mathrm{QAC}^{0} constructions from [9].

  • Preparation, with clean ancillas, of the WW state, i.e., a unitary UU which can be implemented by a constant-depth, polynomial-size QAC circuit satisfying

U∣0n⟩∣0a(n)⟩=∣Wn⟩∣0a(n)⟩=1n∑i=1n∣ei⟩∣0a(n)⟩U\lvert0^{n}\rangle\lvert0^{a(n)}\rangle=\lvert W_{n}\rangle\lvert0^{a(n)}\rangle=\frac{1}{\sqrt{n}}\sum_{i=1}^{n}\lvert e_{i}\rangle\lvert0^{a(n)}\rangle

for some a(n)=poly⁡(n)a(n)=\operatorname{poly}(n) [9 Theorem 17].

  • Exact implementation of FmF_{m} when m=polylog⁡(n)m=\operatorname{polylog}(n) [9 Corollary 10].

  • Exact Computation of THRk\mathrm{THR}_{k} and EXk\mathrm{EX}_{k} on nn bits when k≤polylog⁡(n)k\le\operatorname{polylog}(n) [9 Corollary 16].

A discrete basis for QAC0^{0}

In this section we show that arbitrary one-qubit gates can be approximately implemented with generalized Toffoli, SS, and Hadamard gates. Consequently, this yields a discrete gate set for bounded-error QAC0^{0} circuits. We first prove that arbitrary real one-qubit gates can be approximately implemented in QAC0^{0} with just generalized Toffoli and Hadamard gates. It is then simple to show how to extend this construction to all complex single-qubit gates with SS gates.

First note that up to multiplication by a ZZ gate (and global phase), every one-qubit unitary with real entries has the form

Uθ:=(cos⁡θsin⁡θsin⁡θ−cos⁡θ)=cos⁡θ Z+sin⁡θ X.(1)U_\theta:= \begin{pmatrix} \cos\theta& \sin\theta\\ \sin\theta& -\cos\theta\end{pmatrix} = \cos\theta\, Z + \sin\theta\, X. \tag*{(1)}

In fact, let us suggestively expand the final expression so that it is a linear combination of unitaries (LCU) with non-negative coefficients:

Uθ=(1+cos⁡θ2)(+Z)+(1−cos⁡θ2)(−Z)+(1+sin⁡θ2)(+X)+(1−sin⁡θ2)(−X).U_\theta= \left(\frac{1+\cos\theta}{2}\right)(+Z) + \left(\frac{1-\cos\theta}{2}\right)(-Z) + \left(\frac{1+\sin\theta}{2}\right)(+X) + \left(\frac{1-\sin\theta}{2}\right)(-X).

We follow the standard LCU outline:

  1. Preparation oracle: For any bias p∈[0,1]p \in[0,1], we construct a circuit WpW_p for preparing approximations to pp-biased states:

Wp∣0⋯0⟩=1−p~∣ϕ0⟩∣0⟩+p~∣ϕ1⟩∣1⟩W_p |0\cdots0\rangle= \sqrt{1-\widetilde{p}}|\phi_0\rangle|0\rangle+ \sqrt{\widetilde{p}}|\phi_1\rangle|1\rangle

for p~≈p\widetilde{p} \approx p. The states ∣ϕ0⟩|\phi_0\rangle and ∣ϕ1⟩|\phi_1\rangle are unimportant. The relevant feature is that measuring the last qubit yields ∣1⟩|1\rangle with probability approximately pp. See Lemma 7.

These WpW_p unitaries will be the workhorses of the preparation oracle. Specifically, for qZ:=1−cos⁡θ2q_Z := \frac{1-\cos\theta}{2} and qX:=1−sin⁡θ2q_X := \frac{1-\sin\theta}{2}, we show (H⊗WqZ⊗WqX)∣0⋯0⟩(H \otimes W_{q_Z} \otimes W_{q_X})|0\cdots0\rangle correctly prepares (approximations to) the coefficients in (1/2)Uθ(1/2)U_\theta:

1−q~Z2∣Φ+Z⟩+q~Z2∣Φ−Z⟩+1−q~X2∣Φ+X⟩+q~X2∣Φ−X⟩\sqrt{\frac{1-\widetilde{q}_Z}{2}}|\Phi_{+Z}\rangle+ \sqrt{\frac{\widetilde{q}_Z}{2}}|\Phi_{-Z}\rangle+ \sqrt{\frac{1-\widetilde{q}_X}{2}}|\Phi_{+X}\rangle+ \sqrt{\frac{\widetilde{q}_X}{2}}|\Phi_{-X}\rangle

for orthonormal states ∣Φ+Z⟩|\Phi_{+Z}\rangle, ∣Φ−Z⟩|\Phi_{-Z}\rangle, ∣Φ+X⟩|\Phi_{+X}\rangle, and ∣Φ−X⟩|\Phi_{-X}\rangle.

  1. Selector oracle: As it turns out, there is a simple constant-depth QNC0^{0} circuit that applies Pauli P∈{±Z,±X}P \in\{\pm Z,\pm X\} based on the flag qubits of the states ∣ΦP⟩|\Phi_P\rangle prepared above. Thus, after applying this “selector” oracle, we get

1−q~Z2∣Φ+Z⟩⊗Z∣ψ⟩−q~Z2∣Φ−Z⟩⊗Z∣ψ⟩+1−q~X2∣Φ+X⟩⊗X∣ψ⟩−q~X2∣Φ−X⟩⊗X∣ψ⟩.\sqrt{\frac{1-\widetilde{q}_Z}{2}}|\Phi_{+Z}\rangle\otimes Z|\psi\rangle- \sqrt{\frac{\widetilde{q}_Z}{2}}|\Phi_{-Z}\rangle\otimes Z|\psi\rangle+ \sqrt{\frac{1-\widetilde{q}_X}{2}}|\Phi_{+X}\rangle\otimes X|\psi\rangle- \sqrt{\frac{\widetilde{q}_X}{2}}|\Phi_{-X}\rangle\otimes X|\psi\rangle.

After uncomputing the preparation oracle, one can show that we are left with the state

12∣0⋯0⟩U~θ∣ψ⟩+∣Φ⟩\frac{1}{2}|0\cdots0\rangle\widetilde{U}_\theta|\psi\rangle+ |\Phi\rangle

where U~θ\widetilde{U}_\theta is our approximation for UθU_\theta with error determined by the error in q~X\widetilde{q}_X and q~Z\widetilde{q}_Z, and ∣Φ⟩|\Phi\rangle is orthogonal to all-zeros on the first register.

Oblivious amplitude amplification

Finally, we amplify the amplitude on ∣0⋯0⟩U~θ∣ψ⟩|0\cdots0\rangle\widetilde{U}_{\theta}|\psi\rangle so that it approximates UθU_{\theta} rather than (1/2)Uθ(1/2)U_{\theta}. To do this, we use a standard approach of negating the branch in which the ancillas are all zero in order to reflect about ∣Φ⟩|\Phi\rangle. Since the angle between ∣Φ⟩|\Phi\rangle and (1/2)∣0⋯0⟩U~θ∣ψ⟩+∣Φ⟩(1/2)|0\cdots0\rangle\widetilde{U}_{\theta}|\psi\rangle+|\Phi\rangle is approximately π/6\pi/6, only a single round of amplitude amplification is required, leading to a constant-depth implementation.

It’s worth emphasizing that each step of the proof introduces little ancilla overhead (specifically, O(log⁡2(1/ϵ))O(\log^2(1/\epsilon)) additional ancillas for an ϵ\epsilon-approximation), and only uses Hadamard, SS, and generalized Toffoli gates. Steps 2 and 3 of this construction are a fairly straightforward application of LCU + amplitude amplification, but the coherent sampler construction does not seem to have appeared in prior literature, so let us start with that.

Lemma 7 (Coherent Bernoulli sampler). For every p∈[0,1]p \in[0,1] and 0<δ<1/20 < \delta< 1/2, there is a circuit WpW_p consisting only of Hadamard and generalized Toffoli gates such that

Wp∣0r⟩∣0⟩=1−p~ ∣ϕ0⟩∣0⟩+p~ ∣ϕ1⟩∣1⟩,∣p~−p∣≤δ,(2)W_p |0^r\rangle|0\rangle= \sqrt{1-\widetilde{p}}\,|\phi_0\rangle|0\rangle+ \sqrt{\widetilde{p}}\,|\phi_1\rangle|1\rangle,\qquad|\widetilde{p}-p| \le\delta, \tag*{(2)}

where r=O(log⁡2(1/δ))r=O(\log^2(1/\delta)). Furthermore, WpW_p has O(log⁡2(1/δ))O(\log^2(1/\delta)) gates and depth independent of pp and δ\delta.

Proof. The first goal of this proof will be to express 1−p1-p as an OR of ANDs. If we can do this, then the quantum circuit WpW_p satisfying (2) is

Quantum circuit for the coherent Bernoulli sampler

Figure 5.

where measuring the last qubit of this circuit yields ∣1⟩|1\rangle with probability

p~=∏j=1k(1−12rj)\widetilde{p}=\prod_{j=1}^{k}\left(1-\frac{1}{2^{r_j}}\right)

Therefore, to prove the lemma, it suffices to choose the rir_i values so that ∣p~−p∣≤δ|\widetilde{p}-p| \le\delta. Our choices will correspond to a sort of modified binary search algorithm, where we will pick the rjr_j values so that ∏j=1k(1−2−rj)\prod_{j=1}^{k}(1-2^{-r_j}) approximates pp from above. That is, for the iith iteration of our algorithm, let

p~i:=∏j=1i(1−12rj)\widetilde{p}_i := \prod_{j=1}^{i}\left(1-\frac{1}{2^{r_j}}\right)

be our current estimate for pp with the guarantee that p~i≥p\widetilde{p}_i \ge p. We will measure our progress at each step by the gap

gi:=p~i−p.g_i := \widetilde{p}_i-p.

To start, we set p~0=1\widetilde{p}_0=1 with gap g0=p~0−p=1−pg_0=\widetilde{p}_0-p=1-p. On iteration i>0i>0, pick the smallest integer ri>0r_i>0 such that

p≤(1−12ri)p~i−1.p \le\left(1-\frac{1}{2^{r_i}}\right)\widetilde{p}_{i-1}.

In other words, we shrink our estimate as much as possible without making it smaller than our target pp. We claim this shrinks the gap by at least a factor of 2. To see this, first note that the gap decreases by

gi−1−gi=p~i−1−p~i=p~i−1−(1−12ri)p~i−1=12rip~i−1.(3)g_{i-1}-g_i=\widetilde{p}_{i-1}-\widetilde{p}_i=\widetilde{p}_{i-1}-\left(1-\frac{1}{2^{r_i}}\right)\widetilde{p}_{i-1}=\frac{1}{2^{r_i}}\widetilde{p}_{i-1}. \tag*{(3)}

Meanwhile, we know that decreasing rir_i by one would make the estimate less than pp. Thus, the gap gig_i is at most the difference of those two possible estimates:

gi≤(1−12ri)p~i−1−(1−12ri−1)p~i−1=12rip~i−1.(4)g_i\le\left(1-\frac{1}{2^{r_i}}\right)\widetilde{p}_{i-1}-\left(1-\frac{1}{2^{r_i-1}}\right)\widetilde{p}_{i-1}=\frac{1}{2^{r_i}}\widetilde{p}_{i-1}. \tag*{(4)}

Combining (3) and (4), we get that gi≤(1/2)gi−1g_i\le(1/2)g_{i-1}. We stop as soon as gi≤δg_i\le\delta, so O(log⁡(1/δ))O(\log(1/\delta)) iterations suffice to δ\delta-approximate pp. Finally, notice that combining (3) and (4), we also get

gi−1≤22rip~i−1≤22rig_{i-1}\le\frac{2}{2^{r_i}}\widetilde{p}_{i-1}\le\frac{2}{2^{r_i}}

so ri<1+log⁡2(1/δ)r_i<1+\log_2(1/\delta); otherwise, gi−1≤δg_{i-1}\le\delta and we would have stopped the algorithm at the previous iteration. Thus, each ancilla register rir_i has size O(log⁡(1/δ))O(\log(1/\delta)), leading to the final ancilla count ∑i(ri+1)=O(log⁡2(1/δ))\sum_i(r_i+1)=O(\log^2(1/\delta)).

We now show how the previous construction can be used as the first step in the LCU synthesis of UθU_\theta:

Lemma 8 (Direct synthesis of UθU_\theta). For every θ∈R\theta\in\mathbb{R} and ϵ∈(0,1/2)\epsilon\in(0,1/2) there exists a constant-depth circuit CθC_\theta which acts on n+1n+1 qubits, where n=O(log⁡2(1/ϵ))n=O(\log^2(1/\epsilon)), and uses only Hadamard and generalized Toffoli gates such that

∥Cθ∣0n⟩∣ψ⟩−∣0n⟩Uθ∣ψ⟩∥≤ϵ\lVert C_\theta|0^n\rangle|\psi\rangle-|0^n\rangle U_\theta|\psi\rangle\rVert\le\epsilon

for all single-qubit states ∣ψ⟩|\psi\rangle.

Proof. Set

qZ=1−cos⁡θ2,qX=1−sin⁡θ2,δ=ϵ16.(5)q_Z = \frac{1-\cos\theta}{2}, \qquad q_X = \frac{1-\sin\theta}{2}, \qquad\delta= \frac{\epsilon}{16}. \tag*{(5)}

We first apply Lemma 7 twice in parallel to prepare the two states

∣ψZ⟩:=WqZ∣0⋯0,0⟩=1−q~Z∣α0,0⟩+q~Z∣α1,1⟩|\psi_Z\rangle:= W_{q_Z}|0\cdots0,0\rangle= \sqrt{1-\widetilde{q}_Z}|\alpha_0,0\rangle+ \sqrt{\widetilde{q}_Z}|\alpha_1,1\rangle
∣ψX⟩:=WqX∣0⋯0,0⟩=1−q~X∣β0,0⟩+q~X∣β1,1⟩,|\psi_X\rangle:= W_{q_X}|0\cdots0,0\rangle= \sqrt{1-\widetilde{q}_X}|\beta_0,0\rangle+ \sqrt{\widetilde{q}_X}|\beta_1,1\rangle,

where ∣q~Z−qZ∣≤δ|\widetilde{q}_Z-q_Z|\leq\delta and ∣q~X−qX∣≤δ|\widetilde{q}_X-q_X|\leq\delta. Note that we have written ∣0⋯0⟩|0\cdots0\rangle to avoid the messiness of specifying the exact number of ancilla qubits (a number r=O(log⁡2(1/δ))r=O(\log^2(1/\delta)) in this case). We will continue to use this convention throughout.

Together with Hadamard, these two unitaries, WqZW_{q_Z} and WqXW_{q_X}, constitute the preparation circuit in LCU. To see this, first recall our expansion of our target unitary UθU_\theta:

Uθ=(1+cos⁡θ2)(+Z)+(1−cos⁡θ2)(−Z)+(1+sin⁡θ2)(+X)+(1−sin⁡θ2)(−X).U_\theta= \left(\frac{1+\cos\theta}{2}\right)(+Z) + \left(\frac{1-\cos\theta}{2}\right)(-Z) + \left(\frac{1+\sin\theta}{2}\right)(+X) + \left(\frac{1-\sin\theta}{2}\right)(-X).

Now, expand ∣+⟩∣ψZ⟩∣ψX⟩|+\rangle|\psi_Z\rangle|\psi_X\rangle as

1−q~Z2∣0⟩∣α0,0⟩∣ψX⟩+q~Z2∣0⟩∣α1,1⟩∣ψX⟩+1−q~X2∣1⟩∣ψZ⟩∣β0,0⟩+q~X2∣1⟩∣ψZ⟩∣β1,1⟩.\sqrt{\frac{1-\widetilde{q}_Z}{2}}|0\rangle|\alpha_0,0\rangle|\psi_X\rangle+ \sqrt{\frac{\widetilde{q}_Z}{2}}|0\rangle|\alpha_1,1\rangle|\psi_X\rangle+ \sqrt{\frac{1-\widetilde{q}_X}{2}}|1\rangle|\psi_Z\rangle|\beta_0,0\rangle+ \sqrt{\frac{\widetilde{q}_X}{2}}|1\rangle|\psi_Z\rangle|\beta_1,1\rangle.

In other words, the squared-magnitudes of the states in this decomposition are approximately those of our decomposition of UθU_\theta (up to the attenuating 1/21/2 factor). At δ=0\delta=0, this correspondence is exact.

Next, we apply the appropriate unitary (either +Z+Z, −Z-Z, +X+X, or −X-X) to our target state depending on the basis state to mirror the decomposition of UθU_\theta. This is simple to do with some constant-sized controlled-unitary operations (see Figure 1 (PDF p. 13)). The effect of this selection unitary SEL on ∣+⟩∣ψZ⟩∣ψX⟩⊗I|+\rangle|\psi_Z\rangle|\psi_X\rangle\otimes I can then be written as

The LCU circuit

Figure 1 (PDF p. 13). The LCU circuit L=(PREP†⊗I)∘SEL∘(PREP⊗I)L = (\mathrm{PREP}^{\dagger} \otimes I) \circ\mathrm{SEL} \circ(\mathrm{PREP} \otimes I) for (1/2)Uθ(1/2)U_{\theta}.

1−q~Z2∣Φ+Z⟩⊗Z−q~Z2∣Φ−Z⟩⊗Z+1−q~X2∣Φ+X⟩⊗X−q~X2∣Φ−X⟩⊗X.\sqrt{\frac{1-\widetilde{q}_Z}{2}}|\Phi_{+Z}\rangle\otimes Z-\sqrt{\frac{\widetilde{q}_Z}{2}}|\Phi_{-Z}\rangle\otimes Z+\sqrt{\frac{1-\widetilde{q}_X}{2}}|\Phi_{+X}\rangle\otimes X-\sqrt{\frac{\widetilde{q}_X}{2}}|\Phi_{-X}\rangle\otimes X.

where we’ve renamed the basis states in our decomposition since their details are now unimportant.

From here, we follow the standard outline for LCU with amplitude amplification. Let’s now show the remainder of these steps. First, we uncompute the preparation circuit, i.e., apply PREP†\mathrm{PREP}^{\dagger}. Altogether, our LCU circuit LL is

L=(PREP†⊗I)∘SEL∘(PREP⊗I)L=(\mathrm{PREP}^{\dagger}\otimes I)\circ\mathrm{SEL}\circ(\mathrm{PREP}\otimes I)

where the full circuit is shown in Figure 1 (PDF p. 13). Note that LL is Hermitian since the individual terms of SEL are Hermitian.

Projecting all-but-the-last qubit onto the all-zeros state, we get

V~θ:=(⟨0⋯0∣⊗I)L(∣0⋯0⟩⊗I)=1−q~Z2(+Z)+q~Z2(−Z)+1−q~X2(+X)+q~X2(−X)\widetilde{V}_\theta:= (\langle0\cdots0|\otimes I)L(|0\cdots0\rangle\otimes I)=\frac{1-\widetilde{q}_Z}{2}(+Z)+\frac{\widetilde{q}_Z}{2}(-Z)+\frac{1-\widetilde{q}_X}{2}(+X)+\frac{\widetilde{q}_X}{2}(-X)

where V~θ\widetilde{V}_\theta is our approximation for (1/2)Uθ(1/2)U_\theta:

∥V~θ−(1/2)Uθ∥≤∣q~Z−qZ∣+∣q~X−qX∣≤2δ=ϵ8.(6)\left\|\widetilde{V}_\theta-(1/2)U_\theta\right\|\leq|\widetilde{q}_Z-q_Z|+|\widetilde{q}_X-q_X|\leq2\delta=\frac{\epsilon}{8}. \tag*{(6)}

For obvious reasons, we will define our approximation for UθU_{\theta} itself as U~θ:=2V~θ\widetilde{U}_{\theta} := 2\widetilde{V}_{\theta}. In other words, for every single-qubit state ∣ψ⟩|\psi\rangle we have

L∣0⋯0⟩∣ψ⟩=12∣0⋯0⟩U~θ∣ψ⟩+∣Φ⟩(7)L|0\cdots0\rangle|\psi\rangle= \frac{1}{2}|0\cdots0\rangle\widetilde{U}_{\theta}|\psi\rangle+ |\Phi\rangle \tag*{(7)}

where ∣Φ⟩|\Phi\rangle is an unnormalized state orthogonal to all-zeros on the preparation register, i.e., (⟨0⋯0∣⊗I)∣Φ⟩=0(\langle0\cdots0|\otimes I)|\Phi\rangle= 0.

In fact, in order to analyze the effect of amplitude amplification, it will be useful to expand L∣0⋯0⟩∣ψ⟩L|0\cdots0\rangle|\psi\rangle to include an error term capturing the distance from our target unitary UθU_{\theta}:

L∣0⋯0⟩∣ψ⟩=12∣0⋯0⟩Uθ∣ψ⟩+∣err⟩+∣Φ⟩(8)L|0\cdots0\rangle|\psi\rangle= \frac{1}{2}|0\cdots0\rangle U_{\theta}|\psi\rangle+ |\mathrm{err}\rangle+ |\Phi\rangle \tag*{(8)}

where ∣err⟩:=12∣0⋯0⟩(U~θ−Uθ)∣ψ⟩|\mathrm{err}\rangle:= \frac{1}{2}|0\cdots0\rangle(\widetilde{U}_{\theta}-U_{\theta})|\psi\rangle is an error term (which depends on ψ\psi) such that ∥∣err⟩∥≤ϵ/8\lVert|\mathrm{err}\rangle\rVert\le\epsilon/8 by (6).

The two reflections we will use for amplitude amplification are

  1. Reflection about ∣Φ⟩|\Phi\rangle: R:=(I−2∣0⋯0⟩⟨0⋯0∣)⊗IR := (I - 2|0\cdots0\rangle\langle0\cdots0|)\otimes I. Note that RR can be constructed from a single generalized Toffoli gate. This amplification is “oblivious” in the sense that we don’t know the state ∣Φ⟩|\Phi\rangle but can nevertheless reflect about it.

  1. Reflection about L∣0⋯0⟩∣ψ⟩L|0\cdots0\rangle|\psi\rangle: −LRL†-LRL^{\dagger}. Recall that LL is Hermitian, so −LRL-LRL suffices. The global phase can be prepared using (HX)4=−I(HX)^4=-I.

Given the large amplitude on ∣0⋯0⟩U~θ∣ψ⟩|0\cdots0\rangle\widetilde{U}_{\theta}|\psi\rangle for our state L∣0⋯0⟩∣ψ⟩L|0\cdots0\rangle|\psi\rangle, it will turn out that only a single round of amplification is required. In other words, our entire circuit CC is: state preparation (L)(L); then reflection about the orthogonal branch (R)(R); then reflection about our prepared state (−LRL)(-LRL).

Altogether, we have C=−LRLRLC=-LRLRL. Algebraically, we can analyze CC as follows. First, let’s write Π:=∣0⋯0⟩⟨0⋯0∣⊗I\Pi:= |0\cdots0\rangle\langle0\cdots0|\otimes I, so that R=I−2ΠR=I-2\Pi.

Expanding the RR reflections in our circuit CC, we get

C=−LRLRL=−L(I−2Π)L(I−2Π)L=2ΠL+2LΠ−L−4LΠLΠL.C=-LRLRL=-L(I-2\Pi)L(I-2\Pi)L=2\Pi L+2L\Pi-L-4L\Pi L\Pi L.

Define ∣init⟩:=∣0⋯0⟩∣ψ⟩|\mathrm{init}\rangle:= |0\cdots0\rangle|\psi\rangle and ∣targ⟩:=∣0⋯0⟩Uθ∣ψ⟩|\mathrm{targ}\rangle:= |0\cdots0\rangle U_\theta|\psi\rangle, and apply (8) to ∣init⟩|\mathrm{init}\rangle and ∣targ⟩|\mathrm{targ}\rangle, respectively, to get

ΠL∣init⟩=12∣0⋯0⟩Uθ∣ψ⟩+∣err1⟩=12∣targ⟩+∣err1⟩(9)\Pi_L|\mathrm{init}\rangle= \frac{1}{2}|0\cdots0\rangle U_\theta|\psi\rangle+ |\mathrm{err}_1\rangle= \frac{1}{2}|\mathrm{targ}\rangle+ |\mathrm{err}_1\rangle \tag*{(9)}
ΠL∣targ⟩=12∣0⋯0⟩∣ψ⟩+∣err2⟩=12∣init⟩+∣err2⟩(10)\Pi_L|\mathrm{targ}\rangle= \frac{1}{2}|0\cdots0\rangle|\psi\rangle+ |\mathrm{err}_2\rangle= \frac{1}{2}|\mathrm{init}\rangle+ |\mathrm{err}_2\rangle \tag*{(10)}

Crucially, (10) uses the fact that Uθ2=IU_\theta^2 = I (i.e., UθU_\theta is both unitary and Hermitian). We now have all the pieces we need. Applying CC to our initial state, we get

C∣init⟩=2ΠL∣init⟩+L∣init⟩−4LΠLΠL∣init⟩=2((1/2)∣targ⟩+∣err1⟩)+L∣init⟩−4LΠL((1/2)∣targ⟩+∣err1⟩)=∣targ⟩+L∣init⟩−2LΠL∣targ⟩−4LΠL∣err1⟩+2∣err1⟩=∣targ⟩+L∣init⟩−2L((1/2)∣init⟩+∣err2⟩)−4LΠL∣err1⟩+2∣err1⟩=∣targ⟩−2L∣err2⟩−4LΠL∣err1⟩+2∣err1⟩\begin{aligned} C|\mathrm{init}\rangle&= 2\Pi_L|\mathrm{init}\rangle+ L|\mathrm{init}\rangle- 4L\Pi_L\Pi_L|\mathrm{init}\rangle\\ &= 2((1/2)|\mathrm{targ}\rangle+ |\mathrm{err}_1\rangle) + L|\mathrm{init}\rangle- 4L\Pi_L((1/2)|\mathrm{targ}\rangle+ |\mathrm{err}_1\rangle) \\ &= |\mathrm{targ}\rangle+ L|\mathrm{init}\rangle- 2L\Pi_L|\mathrm{targ}\rangle- 4L\Pi_L|\mathrm{err}_1\rangle+ 2|\mathrm{err}_1\rangle\\ &= |\mathrm{targ}\rangle+ L|\mathrm{init}\rangle- 2L((1/2)|\mathrm{init}\rangle+ |\mathrm{err}_2\rangle) - 4L\Pi_L|\mathrm{err}_1\rangle+ 2|\mathrm{err}_1\rangle\\ &= |\mathrm{targ}\rangle- 2L|\mathrm{err}_2\rangle- 4L\Pi_L|\mathrm{err}_1\rangle+ 2|\mathrm{err}_1\rangle \end{aligned}

Therefore,

∥C∣init⟩−∣targ⟩∥≤∥2L∣err2⟩∥+∥4LΠL∣err1⟩∥+∥2∣err1⟩∥≤2⋅ϵ8+4⋅ϵ8+2⋅ϵ8=ϵ.\|C|\mathrm{init}\rangle- |\mathrm{targ}\rangle\| \leq\|2L|\mathrm{err}_2\rangle\| + \|4L\Pi_L|\mathrm{err}_1\rangle\| + \|2|\mathrm{err}_1\rangle\| \leq2\cdot\frac{\epsilon}{8} + 4\cdot\frac{\epsilon}{8} + 2\cdot\frac{\epsilon}{8} = \epsilon.

Theorem 9. Hadamard, SS, and generalized Toffoli are universal for QAC0\mathrm{QAC}^0.

Proof. The proof follows almost immediately from Lemma 8. First, write a single-qubit gate as G=eiαVG=e^{i\alpha}V, where α∈R\alpha\in\mathbb{R} and V∈SU(2)V\in\mathrm{SU}(2). The Euler decomposition gives the exact identity

V=RY(θ1)RX(θ2)RY(θ3)=RY(θ1)S†RY(θ2)SRY(θ3)(11)V=R_Y(\theta_1)R_X(\theta_2)R_Y(\theta_3)=R_Y(\theta_1)S^\dagger R_Y(\theta_2)S R_Y(\theta_3) \tag*{(11)}

for angles θ1,θ2,θ3∈R\theta_1,\theta_2,\theta_3\in\mathbb{R}, where RP(θ)R_P(\theta) is the standard rotation gate about Pauli PP: RP(θ):=cos⁡(θ/2)I−isin⁡(θ/2)PR_P(\theta):=\cos(\theta/2)I-i\sin(\theta/2)P. In particular, we have

RY(2θ)=(cos⁡θ−sin⁡θsin⁡θcos⁡θ)=(cos⁡θsin⁡θsin⁡θ−cos⁡θ)(100−1)=UθZ.R_Y(2\theta)= \begin{pmatrix} \cos\theta& -\sin\theta\\ \sin\theta& \cos\theta \end{pmatrix} = \begin{pmatrix} \cos\theta& \sin\theta\\ \sin\theta& -\cos\theta \end{pmatrix} \begin{pmatrix} 1 & 0\\ 0 & -1 \end{pmatrix} =U_\theta Z.

Therefore, we can write (11) as

V=Uθ1/2ZS†Uθ2/2ZSUθ3/2Z=Uθ1/2SUθ2/2S3Uθ3/2S2V=U_{\theta_1/2}ZS^\dagger U_{\theta_2/2}ZSU_{\theta_3/2}Z=U_{\theta_1/2}SU_{\theta_2/2}S^3U_{\theta_3/2}S^2

so every determinant-one single-qubit gate can be approximated using three UθU_\theta gates and six SS gates.

Consider a general QAC circuit QQ with k≥1k\geq1 single-qubit gates Gj=eiαjVjG_j=e^{i\alpha_j}V_j. Let Q0Q_0 be the circuit obtained by replacing each GjG_j with VjV_j, so that Q=eiαQ0Q=e^{i\alpha}Q_0 for α=∑j=1kαj\alpha=\sum_{j=1}^k\alpha_j. To restore this phase, introduce one qubit initialized to ∣0⟩|0\rangle and apply

Dα:=(eiα00e−iα)=HS3U−αS3H.D_\alpha:=\begin{pmatrix}e^{i\alpha} & 0\\0 & e^{-i\alpha}\end{pmatrix}=HS^3U_{-\alpha}S^3H.

::: Indeed, S3U−αS3=cos⁡αI+isin⁡αXS^{3}U_{-\alpha}S^{3}=\cos\alpha I+i\sin\alpha X, and conjugating by HH gives the displayed diagonal matrix. Thus

(Dα⊗Q0)∣0⟩∣ψ⟩=∣0⟩Q∣ψ⟩(D_{\alpha}\otimes Q_{0})|0\rangle|\psi\rangle=|0\rangle Q|\psi\rangle

so the extra qubit returns to zero while supplying the required global phase.

To approximate Dα⊗Q0D_{\alpha}\otimes Q_{0} to error ϵ\epsilon, we use the above decomposition to obtain at most 3k+13k+1 gates of the form UθU_{\theta}, together with gates from the prescribed basis. We invoke Lemma 8 for each UθU_{\theta} with error ϵ/(3k+1)\epsilon/(3k+1) and fresh work ancillas. By the triangle inequality, the resulting circuit is an ϵ\epsilon-approximation with O(klog⁡2(k/ϵ))O(k\log^{2}(k/\epsilon)) additional ancillary qubits.

Exact simulation of TC0\mathrm{TC}^{0} in QAC0\mathrm{QAC}^{0}

In this section we show that the soundness error inherent in the WW-test of [9] can be eliminated entirely at the cost of additional classical copies. Consequently, arbitrary threshold functions (and indeed arbitrary TC0\mathrm{TC}^{0} functions) can be computed exactly in QAC0\mathrm{QAC}^{0} given sufficiently many classical copies.

Standard error reduction via parallel repetition

Let us briefly recall the WW-test and how it gives rise to a one-sided Hamming weight tester:

Theorem 10 (Corollary 19 of [9]). There is a family of QAC0\mathrm{QAC}^{0} circuits {Cn,k}n≥1,0≤k≤n\{C_{n,k}\}_{n\geq1,0\leq k\leq n} such that for all x∈{0,1}nx\in\{0,1\}^{n},

  • If ∣x∣=k|x|=k, then Cn,kC_{n,k} accepts ∣x⟩|x\rangle with probability 1.

  • If ∣x∣≠k|x|\ne k, then Cn,kC_{n,k} accepts ∣x⟩|x\rangle with probability at most 1−1n21-\frac{1}{n^{2}}.

The circuit witnessing Theorem 10 in the case k=n/2k=n/2 is shown in Figure 2.

The W-test circuit

Figure 2. The WW-test circuit, corresponding to the case of k=n/2k=n/2

Here, UU is a constant-depth unitary that prepares ∣W⟩=1n∑i=1n∣ei⟩|W\rangle=\frac{1}{\sqrt{n}}\sum_{i=1}^{n}|e_i\rangle with a=a(n)a=a(n) clean ancilla qubits, and the two-qubit gates are CZ gates. The final OR acts on all n+an+a workspace qubits and the output qubit. On input ∣x⟩|x\rangle the state evolves as follows:

∣x⟩∣0n+a⟩∣0⟩→U∣x⟩∣W⟩∣0a⟩∣0⟩→CZ∣x⟩⊗1n∑i=1n(−1)xi∣ei⟩∣0a⟩∣0⟩→U†∣x⟩(αx∣0n+a⟩+p1(x)∣ψx⟩)∣0⟩→OR∣x⟩(αx∣0n+a⟩∣0⟩+p1(x)∣ψx⟩∣1⟩)\begin{aligned} |x\rangle|0^{n+a}\rangle|0\rangle&\xrightarrow{U} |x\rangle|W\rangle|0^a\rangle|0\rangle\\ &\xrightarrow{\mathrm{CZ}} |x\rangle\otimes\frac{1}{\sqrt{n}}\sum_{i=1}^{n}(-1)^{x_i}|e_i\rangle|0^a\rangle|0\rangle\\ &\xrightarrow{U^\dagger} |x\rangle\left(\alpha_x|0^{n+a}\rangle+\sqrt{p_1(x)}|\psi_x\rangle\right)|0\rangle\\ &\xrightarrow{\mathrm{OR}} |x\rangle\left(\alpha_x|0^{n+a}\rangle|0\rangle+\sqrt{p_1(x)}|\psi_x\rangle|1\rangle\right) \end{aligned}

where ∣ψx⟩|\psi_x\rangle is a normalized state orthogonal to ∣0n+a⟩|0^{n+a}\rangle, and

αx=n−2∣x∣n,p0(x)=αx2,p1(x)=1−p0(x).\alpha_x=\frac{n-2|x|}{n},\qquad p_0(x)=\alpha_x^2,\qquad p_1(x)=1-p_0(x).

p0(x)p_0(x) is exactly the probability that the output qubit yields ∣0⟩|0\rangle when measured in the computational basis. Thus, the test accepts with certainty when ∣x∣=n/2|x|=n/2, as p0(x)=0p_0(x)=0 and otherwise rejects with probability at least 1/n21/n^2.

Given mm classical copies of xx, we can run mm independent WW-tests in parallel and take the AND of their output bits b1,…,bmb_1,\ldots,b_m. The probability that some test fails is

pfail=1−(1−p0(x))m=1−(1−(n−2∣x∣)2n2)m.p_{\mathrm{fail}}=1-(1-p_0(x))^m=1-\left(1-\frac{(n-2|x|)^2}{n^2}\right)^m.

If ∣x∣=n/2|x|=n/2, every test accepts. Otherwise, the probability that all tests accept is at most (1−1/n2)m≤e−m/n2(1-1/n^2)^m\le e^{-m/n^2}, so parallel repetition reduces the soundness error exponentially in m/n2m/n^2.

Hamming weight oblivious exact amplitude amplification

However, parallel repetition does not in general, eliminate this error: whenever 0<p1(x)<10<p_1(x)<1, the WW test fails with non-zero probability. We overcome this obstacle via an amplitude amplification protocol which reflects the post-WW-test state entirely into the subspace in which the output qubit is in the correct state depending on xx. Since pfail=Ω(1)p_{\mathrm{fail}}=\Omega(1) (see Figure 3) when ∣x∣≠n/2|x|\ne n/2 this amplitude amplification can be done in a constant number of rounds and therefore constant depth - when ∣x∣=n/2|x|=n/2, pfail=0p_{\mathrm{fail}}=0, so amplitude amplification will leave the state unchanged.

Figure 3. Hamming weight vs. acceptance probability of Ω(n2)\Omega(n^2) parallel WW-tests.

It may seem that this approach could not be made to work in QAC0 because applying precise amplitude amplification requires knowing exactly the angle between our starting state and the target state, but this overlap is a function of the Hamming weight of xx - the exact quantity we wish to compute. Nevertheless, we are able to construct a protocol which is able to make use of precise amplitude amplification while being oblivious to ∣x∣|x|.

We first consider a promise problem wherein ∣x∣|x| is either kk or n/2n/2 for some fixed k≠n/2k\ne n/2. Then, we proceed in running some number, say mkm_k, parallel WW-tests on xx and obtain a state ∣ψx⟩|\psi_x\rangle. If ∣x∣=n/2|x|=n/2 then ∣ψx⟩|\psi_x\rangle will have zero overlap with the subspace corresponding to “some WW-tests fails”, however if ∣x∣=k|x|=k then we can choose mkm_k such that this overlap is constant, i.e., pfail=Ω(1)p_{\mathrm{fail}}=\Omega(1). With an additional ancilla and an appropriate rotation applied, this overlap can be tuned to exactly 1/21/2.5 Finally, we proceed in applying amplitude amplification so that in the case of ∣x∣=k|x|=k the resulting state is in the “some WW-tests fails” subspace and when ∣x∣=n/2|x| = n/2, the state is orthogonal to this subspace, allowing us to perfectly distinguish weight kk from weight n/2n/2.

If ∣x∣=j∉{k,n/2}|x| = j \notin\{k,n/2\} then this procedure will not produce a meaningful result. However, if we had instead tested jj vs. n/2n/2, then we would have been able to correctly conclude ∣x∣≠n/2|x| \ne n/2. So, with sufficiently many classical copies of xx we may run the kk vs. n/2n/2 test on xx for each k∈{0,1,…,n}∖{n/2}k \in\{0,1,\ldots,n\} \setminus\{n/2\} and if ∣x∣≠n/2|x| \ne n/2, then some test will fail with certainty. Taking the AND of the outputs of each of these sub-tests will give EXn/2(x)\mathrm{EX}_{n/2}(x) exactly. By choosing the number of copies separately for each kk, we can solve all nn promise problems in parallel using O(n2)O(n^2) classical copies in total.

Let us now construct the circuit which perfectly distinguishes the middle Hamming slice from any other fixed Hamming slice:

Lemma 11. For every even n≥2n \ge2 and every k∈{0,…,n}∖{n/2}k \in\{0,\ldots,n\} \setminus\{n/2\}, there is a QAC0^0 circuit QkQ_k using mk=O(n2)m_k = O(n^2) classical copies of x∈{0,1}nx \in\{0,1\}^n and polynomially many zero-initialized ancillas such that

  • QkQ_k accepts ∣x⟩⊗mk|x\rangle^{\otimes m_k} with certainty if ∣x∣=n/2|x| = n/2.

  • QkQ_k rejects ∣x⟩⊗mk|x\rangle^{\otimes m_k} with certainty if ∣x∣=k|x| = k.

Proof. Fix k≠n/2k \ne n/2 and set

Δ:=∣n/2−k∣,m:=mk=⌈n24Δ2⌉.\Delta:= |n/2-k|,\qquad m := m_k = \left\lceil\frac{n^2}{4\Delta^2} \right\rceil.

Run one WW-test on each of the mm input copies in parallel. Let (b1,…,bm)∈{0,1}m(b_1,\ldots,b_m) \in\{0,1\}^m denote the results of each of these tests. On weight kk, a single test rejects with probability 4Δ2/n24\Delta^2/n^2, so the probability of at least one rejection is

qk:=1−(1−4Δ2n2)m≥1−e−1.q_k := 1-\left(1-\frac{4\Delta^2}{n^2}\right)^m \ge1-e^{-1}.

This value depends only on nn and kk. In contrast, on weight n/2n/2 the rejection probability is zero. Below, pfailp_{\mathrm{fail}} denotes the rejection probability for this choice of mm.

Compute the AND of the output bits into a new ancilla initialized to ∣0⟩\lvert0\rangle and then apply X to that qubit, so that its value becomes r=1−(b1∧⋯∧bm)r = 1 - (b_1 \land\cdots\land b_m). We will refer to this register as the AND register. The resulting state is

∣γx⟩=pfail∣γ0x⟩∣1⟩+1−pfail∣γ1x⟩∣0⟩.\lvert\gamma_x\rangle= \sqrt{p_{\mathrm{fail}}}\lvert\gamma_0^x\rangle\lvert1\rangle+ \sqrt{1-p_{\mathrm{fail}}}\lvert\gamma_1^x\rangle\lvert0\rangle.

Where ∣γ0x⟩\lvert\gamma_0^x\rangle is a normalized state supported only on basis states satisfying b1∧⋯∧bm=0b_1 \land\cdots\land b_m = 0 and ∣γ1x⟩\lvert\gamma_1^x\rangle on basis states where b1∧⋯∧bm=1b_1 \land\cdots\land b_m = 1.

For θ∈[0,π/2]\theta\in[0,\pi/2], define the controlled one-qubit gate

CU(θ)=C(RY(2θ)Z):=∣1⟩⟨1∣⊗(cos⁡θsin⁡θsin⁡θ−cos⁡θ)+∣0⟩⟨0∣⊗I.CU(\theta) = C\left(R_Y(2\theta)Z\right) := \lvert1\rangle\langle1\rvert\otimes\begin{pmatrix} \cos\theta& \sin\theta\\ \sin\theta& -\cos\theta\end{pmatrix} + \lvert0\rangle\langle0\rvert\otimes I.

Append an ancilla qubit initialized to ∣0⟩\lvert0\rangle and apply CU(θk)CU(\theta_k) controlled on the AND register, where

cos⁡2θk:=tk=1−14qk∈(0,3/4].\cos^2\theta_k := t_k = 1 - \frac{1}{4q_k} \in(0,3/4].

The resulting state is

∣Γx⟩=tkpfail∣γ0x⟩∣10⟩+(1−tk)pfail∣γ0x⟩∣11⟩+1−pfail∣γ1x⟩∣00⟩.\lvert\Gamma_x\rangle= \sqrt{t_kp_{\mathrm{fail}}}\lvert\gamma_0^x\rangle\lvert10\rangle+ \sqrt{(1-t_k)p_{\mathrm{fail}}}\lvert\gamma_0^x\rangle\lvert11\rangle + \sqrt{1-p_{\mathrm{fail}}}\lvert\gamma_1^x\rangle\lvert00\rangle.

Note that if ∣x∣=n/2\lvert x\rvert= n/2 then ∣Γx⟩=∣γ1x⟩∣00⟩\lvert\Gamma_x\rangle= \lvert\gamma_1^x\rangle\lvert00\rangle, but if ∣x∣=k\lvert x\rvert= k then (⟨γ0x∣⟨11∣)∣Γx⟩=1/2(\langle\gamma_0^x\rvert\langle11\rvert)\lvert\Gamma_x\rangle= 1/2.

Now, we apply CZ to the last two qubits of this state:

∣Γx−⟩:=(I⊗CZ)∣Γx⟩=∣Γx⟩−2(1−tk)pfail∣γ0x⟩∣11⟩.\lvert\Gamma_x^-\rangle:= (I \otimes CZ)\lvert\Gamma_x\rangle= \lvert\Gamma_x\rangle- 2\sqrt{(1-t_k)p_{\mathrm{fail}}}\lvert\gamma_0^x\rangle\lvert11\rangle.

Next, apply Rx:=I−2∣Γx⟩⟨Γx∣R_x := I - 2\lvert\Gamma_x\rangle\langle\Gamma_x\rvert. This reflection can be implemented via

Rx=Vk,x(I−2∣0B⟩⟨0B∣)Vk,x†.R_x = V_{k,x}(I - 2\lvert0^B\rangle\langle0^B\rvert)V_{k,x}^{\dagger}.

where Vk,xV_{k,x} is the unitary that prepares ∣Γx⟩\lvert\Gamma_x\rangle from ∣x⟩⊗∣0B⟩\lvert x\rangle\otimes\lvert0^B\rangle. Note that Vk,xV_{k,x} only controls on the copies of xx, so implementing Vk,xV_{k,x} requires no knowledge of xx or its Hamming weight.

If ∣x∣=k\lvert x\rvert= k, then (1−tk)pfail=1/4(1-t_k)p_{\mathrm{fail}} = 1/4 and

⟨Γx∣Γx−⟩=1−2(1−tk)pfail=12.\langle\Gamma_x\vert\Gamma_x^-\rangle= 1 - 2(1-t_k)p_{\mathrm{fail}} = \frac{1}{2}.

Therefore,

Rx∣Γx−⟩=∣Γx−⟩−2⟨Γx∣Γx−⟩∣Γx⟩=∣Γx−⟩−∣Γx⟩=−2(1−tk)pfail∣γ0x⟩∣11⟩=−∣γ0x⟩∣11⟩.\begin{aligned} R_x\lvert\Gamma_x^-\rangle&= \lvert\Gamma_x^-\rangle- 2\langle\Gamma_x\vert\Gamma_x^-\rangle\lvert\Gamma_x\rangle\\ &= \lvert\Gamma_x^-\rangle- \lvert\Gamma_x\rangle\\ &= -2\sqrt{(1-t_k)p_{\mathrm{fail}}}\lvert\gamma_0^x\rangle\lvert11\rangle\\ &= -\lvert\gamma_0^x\rangle\lvert11\rangle. \end{aligned}

If ∣x∣=n/2|x|=n/2, then pfail=0p_{\mathrm{fail}}=0, so the CZ gate has no effect and reflection yields

Rx∣Γx−⟩=−∣Γx⟩=−∣γxχ⟩∣00⟩R_x|\Gamma_x^{-}\rangle=-|\Gamma_x\rangle=-|\gamma_x^{\chi}\rangle|00\rangle

So, when ∣x∣=n/2|x|=n/2 the state is unchanged up to a global phase. Finally, apply XX to the final ancilla qubit, so that it is 1 when ∣x∣=n/2|x|=n/2 and 0 when ∣x∣=k|x|=k. Thus, if final ancilla qubit is taken as the output then this circuit solves the kk vs. n/2n/2 Hamming weight problem with zero-error on all inputs satisfying the promise.

To achieve a more general test in which weight j≠n/2j\ne n/2 strings are accepted and weight kk strings are rejected, we can append the fixed string 1n−j0j1^{n-j}0^j to each input copy. The resulting 2n2n-bit string y=x1n−j0jy=x1^{n-j}0^j satisfies ∣y∣=n|y|=n when ∣x∣=j|x|=j, and has weight n+k−jn+k-j when ∣x∣=k|x|=k. Applying Lemma 11 for inputs of length 2n2n gives the desired behavior with O(n2)O(n^2) copies of xx. The padded bits can be hard-coded into the circuit with XX gates.

Theorem 12. For even nn, EXn/2\mathrm{EX}_{n/2} can be computed with zero error in QAC0\mathrm{QAC}^{0} given m=O(n2)m=O(n^2) classical copies of its input. In particular, EXn/2∈EQAC0∘NC0\mathrm{EX}_{n/2}\in\mathrm{EQAC}^{0}\circ\mathrm{NC}^{0}, and the corresponding lifted function EXn/2↑m\mathrm{EX}_{n/2}^{\uparrow m} is in EQAC0\mathrm{EQAC}^{0}.

Proof. Run the circuit QkQ_k from Lemma 11 for every k∈{0,…,n}∖{n/2}k\in\{0,\ldots,n\}\setminus\{n/2\} in parallel, using disjoint input copies. Taking the AND of each of the output bits of each QkQ_k computes EXn/2\mathrm{EX}_{n/2} exactly using O(n2)O(n^2) copies of the input. Indeed, the total number of copies is

∑k≠n/2mk=2∑Δ=1n/2⌈n24Δ2⌉≤n+n22∑Δ=1n/21Δ2=O(n2).\sum_{k\ne n/2}m_k=2\sum_{\Delta=1}^{n/2}\left\lceil\frac{n^2}{4\Delta^2}\right\rceil\le n+\frac{n^2}{2}\sum_{\Delta=1}^{n/2}\frac{1}{\Delta^2}=O(n^2).

To compute the lifted function on arbitrary blocks x(1),…,x(m)x^{(1)},\ldots,x^{(m)}, first check that all blocks agree. For each coordinate i∈[n]i\in[n], test whether the mm bits xi(1),…,xi(m)x_i^{(1)},\ldots,x_i^{(m)} are all zero or all one. These tests use generalized Toffoli and single-qubit gates, run in parallel across coordinates, and preserve the input blocks. Taking the AND of their results gives a consistency flag in constant depth and O(nm)O(nm) size. Run the above circuit on the blocks and take the AND of its output with this flag. Equal blocks give the correct value of EXn/2\mathrm{EX}_{n/2}, while unequal blocks are rejected with certainty. This proves EXn/2↑m∈EQAC0\mathrm{EX}_{n/2}^{\uparrow m}\in\mathrm{EQAC}^{0}.

The same padding argument gives exact tests for every EXj\mathrm{EX}_j. Taking an OR over the appropriate Hamming weights then computes any symmetric function, including every threshold function, using polynomially many classical copies. As in [9 Section 4.2]:

Corollary 13. TC0⊆EQAC0∘NC0\mathrm{TC}^{0}\subseteq\mathrm{EQAC}^{0}\circ\mathrm{NC}^{0}.

Corollary 14. For all primes pp, EQAC0⊈AC0[p]\mathrm{EQAC}^{0}\not\subseteq\mathrm{AC}^{0}[p]. Additionally, EQAC0⊈ACC0\mathrm{EQAC}^{0}\not\subseteq\mathrm{ACC}^{0} under the assumption that ACC0⊂TC0\mathrm{ACC}^{0}\subset\mathrm{TC}^{0}.

Proof. For a fixed prime pp, if there exist a constant k>0k>0 such that EXn/2↑nk∈AC0[p]\mathrm{EX}_{n/2}^{\uparrow n^k}\in\mathrm{AC}^{0}[p], then EXn/2∈AC0[p]\mathrm{EX}_{n/2}\in\mathrm{AC}^{0}[p]. To see this, suppose CC is the polynomial-size AC0[p]\mathrm{AC}^{0}[p] circuit which computes EXn/2↑nk\mathrm{EX}_{n/2}^{\uparrow n^k}. We can construct an AC0[p]\mathrm{AC}^{0}[p] circuit C~\widetilde{C} which computes EXn/2\mathrm{EX}_{n/2} by first fanning the input bits out nkn^k times and then evaluating CC on the resulting string, x∘⋯∘x⏟nk∈{0,1}nk+1\underbrace{x\circ\cdots\circ x}_{n^k}\in\{0,1\}^{n^{k+1}}: However, EXn/2∈AC0[p]⇒AC0[p]=TC0\mathrm{EX}_{n/2}\in\mathrm{AC}^{0}[p]\Rightarrow\mathrm{AC}^{0}[p]=\mathrm{TC}^{0} - which we know to be false via [20 Smo87]. Similarly, EXn/2∈AC0⇒ACC0=TC0\mathrm{EX}_{n/2}\in\mathrm{AC}^{0}\Rightarrow\mathrm{ACC}^{0}=\mathrm{TC}^{0}.

Construction of $\widetilde{C}$ from $C$

Figure 4. If CC computes EXn/2nk\mathrm{EX}_{n/2}^{n^k} then we can construct a circuit C~\widetilde{C} which computes EXn/2\mathrm{EX}_{n/2} by simply copying the input and feeding it into CC.

AI disclosure

Results in this paper were obtained through interactions with GPT 5.6 Sol: the authors provided intuitive justification and intended proof approach, then GPT confirmed the heuristics with rigorous proofs, which were further simplified and generalized in the same human-LLM interaction cycle. GPT 5.6 Sol and GPT 6 were used to draft the paper, which was fully rewritten by the authors. All mathematical claims and exposition remain the responsibility of the authors.

Random selectors in QAC0

Given a binary string x∈{0,1}nx \in\{0,1\}^{n}, the selector function checks if xx contains 1 and outputs one such location. In this section, we give two constructions in QAC0^{0}: in the binary version, it outputs a random i∈[n]i \in[n] with xi=1x_i = 1; and in the unary version, it outputs the indicator vector ei=0i−110n−ie_i = 0^{i-1}10^{n-i}. We remark that if QAC0^{0} could implement the map ∣i⟩→∣ei⟩|i\rangle\to|e_i\rangle, then the two constructions would be equivalent. Unfortunately this operator is equivalent to computing the indexing function, which is not known to be in QAC0^{0}. To this this, recall that the indexing function computes xix_i given input ii and xx; if the operator is available, one can obtain eie_i from ii and then an entrywise-AND followed by an OR suffices. Consequently we view our selector constructions quite surprising: it bypasses the natural need of computing the indexing function.

The unary selector. Write S(x)={i:xi=1}S(x) = \{i : x_i = 1\} for the support of xx. We first construct the unary selector, whose circuit aims to return eie_i for a uniformly random i∈S(x)i \in S(x). The main challenge is to produce all nn output bits of eie_i without large fanout. We do this by the phase kickback trick.

Theorem 15. Let δ∈(0,1/2)\delta\in(0,1/2) satisfy log⁡(1/δ)=polylog⁡(n)\log(1/\delta) = \operatorname{polylog}(n). There is a constant-depth, polynomial-size QAC circuit with an nn-qubit output register YY such that:

  1. if input x=0nx = 0^n, then measuring YY gives 0n0^n with probability one;

  2. if input x≠0nx \ne0^n, then measuring YY gives either 0n0^n or eie_i where ii is uniformly random in S(x)S(x).

In addition, with probability at least 1−δ1-\delta, the latter case happens.

Proof. Set

R=⌈log⁡2(n)⌉,q=⌈2eln⁡(1/δ)⌉,T=(R+1)q=polylog⁡(n).R = \lceil\log_{2}(n) \rceil,\qquad q = \lceil2e\ln(1/\delta) \rceil,\qquad T = (R+1)q = \operatorname{polylog}(n).

For each trial t=(r,j)t = (r,j) with 0≤r≤R0 \le r \le R and 1≤j≤q1 \le j \le q, choose a mask mt∈{0,1}nm_t \in\{0,1\}^{n} by including each bit independently with probability 2−r2^{-r}. Define the masked vector and its success flag by

zt=x∧mtandut=EX1⁡(zt).z_t = x \wedge m_t \qquad\text{and}\qquad u_t = \operatorname{EX1}(z_t).

Fix an arbitrary ordering of the trials and let

st=ut∧⋀t′<t(¬ut′).s_t = u_t \wedge\bigwedge_{t'<t}(\neg u_{t'}).

which marks the first trial that isolates exactly one coordinate of S(x)S(x). Thus ss is either all-zero or an indicator vector with exactly one 1. The desired output is

F(x)={ztif st=1 for some t,0nif every trial fails.F(x)=\begin{cases} z_t & \text{if }s_t=1\text{ for some }t,\\ 0^n & \text{if every trial fails.} \end{cases}

In particular, F(x)F(x) is always zero or a valid indicator vector, and it is zero whenever x=0nx=0^n.

Suppose k=∣S(x)∣>0k=|S(x)|>0. If k=1k=1, every trial at level r=0r=0 succeeds. Otherwise, at level r=⌈log⁡2k⌉r=\lceil\log_2 k\rceil, the sampling probability 2−r2^{-r} lies in [1/(2k),1/k][1/(2k),1/k], and the trial succeeds with probability

k⋅2−r(1−2−r)k−1≥12e.k\cdot2^{-r}\left(1-2^{-r}\right)^{k-1}\geq\frac{1}{2e}.

Consequently, the probability that all trials fail is at most (1−12e)q≤e−q/(2e)≤δ\left(1-\frac{1}{2e}\right)^q\leq e^{-q/(2e)}\leq\delta. Moreover, within any trial, all kk marked coordinates have the same probability of being the unique survivor. For every trial with positive success probability, the survivor conditional on success is therefore uniform on S(x)S(x). This proves both the success bound and the claimed conditional uniformity for the random function FF.

We now implement this procedure coherently in QAC0\mathrm{QAC}^0. Exact polylogarithmic fanout [9] supplies the TT copies of each xix_i needed to compute all ztz_t in parallel. The exact EX1\mathrm{EX}_1 construction [9] computes the flags utu_t in parallel. Each bit of uu is used at most TT times in among sts_t’s, so another application of exact polylogarithmic fanout allows all sts_t’s to be computed in parallel. This computes all ztz_t’s and sts_t’s.

Recall that F(x)F(x) depends only on ztz_t’s and sts_t’s. To compute F(x)F(x), we implement phase oracle

PF:∣zt′⟩∣st′⟩∣a⟩⟼(−1)⟨a,F(x)⟩∣zt′⟩∣st′⟩∣a⟩for a∈{0,1}n.P_F:\lvert z_t'\rangle\lvert s_t'\rangle\lvert a\rangle\longmapsto(-1)^{\langle a,F(x)\rangle}\lvert z_t'\rangle\lvert s_t'\rangle\lvert a\rangle\qquad\text{for }a\in\{0,1\}^n.

where we omit other registers for simplicity. To this end, for a∈{0,1}na\in\{0,1\}^n and each tt, we compute dt=OR⁡i=1n(ai∧zt,i)d_t=\operatorname{OR}_{i=1}^n(a_i\land z_{t,i}) and let h=OR⁡t(st∧dt)h=\operatorname{OR}_t(s_t\land d_t). If F(x)=ztF(x)=z_t, the vector ztz_t has exactly one nonzero coordinate, so dt=⟨a,zt⟩d_t=\langle a,z_t\rangle; otherwise F(x)=0nF(x)=0^n, the ss vector is all-zero, so h=0h=0. In either case, we have h=⟨a,F(x)⟩h=\langle a,F(x)\rangle, after which a bit-phase oracle ∣h⟩⟼(−1)h∣h⟩\lvert h\rangle\longmapsto(-1)^h\lvert h\rangle, together with appropriate uncomputation, constructs PFP_F.

Finally, to write F(x)F(x) on register YY, we use phase kickback based on PFP_F: initialize YY register to 0n0^n and apply H⊗nH^{\otimes n}, PFP_F with a=Ya=Y, and H⊗nH^{\otimes n} again, which are all in QAC0\mathrm{QAC}^0. This completes the whole proof.

The binary selector. For the binary selector, we fix

L=⌈log⁡2(n+1)⌉.L=\lceil\log_2(n+1)\rceil.

Since each index ii has only LL bits, we can compute those bits directly from its masked vector using polylogarithmic fanout. Below, we use bin⁡(i)\operatorname{bin}(i) to denote the length-LL binary encoding of i∈[n]i\in[n].

Theorem 16. Let δ∈(0,1/2)\delta\in(0,1/2) satisfy log⁡(1/δ)=polylog⁡(n)\log(1/\delta)=\operatorname{polylog}(n). There is a constant-depth, polynomial-size QAC\mathrm{QAC} circuit with an LL-qubit output register YY such that

  1. If input x=0nx=0^n, then measuring YY gives 0L0^L with probability one;

  1. if input x≠0nx \ne0^n, then measuring YY gives either 0L0^L or bin⁡(i)\operatorname{bin}(i) where ii is uniformly random in S(x)S(x). In addition, with probability at least 1−δ1-\delta, the latter case happens.

Proof. Given the unary selector, the binary selector is much easier: we simply observe that the map ∣ei⟩→∣ei⟩∣bin⁡(i)⟩|e_i\rangle\to|e_i\rangle|\operatorname{bin}(i)\rangle is in QAC0\mathrm{QAC}^{0}. This is because there are only LL bits in bin⁡(i)\operatorname{bin}(i) and, since eie_i has Hamming weight 1, each such bit can be computed by an OR of subsets of bits in eie_i. Consequently (poly)logarithmic fanout suffices.

We make a final remark there. While the map ∣ei⟩→∣ei⟩∣bin⁡(i)⟩|e_i\rangle\to|e_i\rangle|\operatorname{bin}(i)\rangle is in QAC0\mathrm{QAC}^{0}, as used in the above proof, we do not know if it entails ∣ei⟩→∣i⟩|e_i\rangle\to|i\rangle in QAC0\mathrm{QAC}^{0}, which would put the indexing function into QAC0\mathrm{QAC}^{0}.

Approximate counting in QAC0

In this section, we show how QAC0\mathrm{QAC}^{0} can count, up to small multiplicative error. Our construction is based on the AC0\mathrm{AC}^{0}-style counting sketch [Ajt93, Vio14], which requires only polylogarithmic fanout and small threshold functions.

Theorem 17. Let ε,δ∈(0,1/2)\varepsilon, \delta\in(0,1/2) satisfy 1/ε=polylog⁡(n)1/\varepsilon= \operatorname{polylog}(n) and log⁡(1/δ)=polylog⁡(n)\log(1/\delta) = \operatorname{polylog}(n). There is a constant-depth, polynomial-size QAC circuit that, on input x∈{0,1}nx \in\{0,1\}^{n}, outputs an integer w∈{0,…,n}w \in\{0,\ldots,n\} such that

  1. if Hamming weight ∣x∣=0|x|=0, then w=0w=0 with probability one;

  1. if Hamming weight ∣x∣>0|x|>0, then (1−ε)∣x∣≤w≤(1+ε)∣x∣(1-\varepsilon)|x| \le w \le(1+\varepsilon)|x| with probability at least 1−δ1-\delta.

Proof. The proof combines the classic geometric subsampling sketch [Ajt93, Vio14] with the known polylogarithmic fanout and threshold function constructions in QAC0\mathrm{QAC}^{0} [9].

We briefly outline the classical approximate counting algorithm. Set B=Θ(ε−2)B=\Theta(\varepsilon^{-2}) and use J=O(ε−1log⁡n)J=O(\varepsilon^{-1}\log n) candidate weights Tj=⌈B⋅(1+Θ(ε))j⌉T_j=\lceil B\cdot(1+\Theta(\varepsilon))^j\rceil extending up to nn. For each Hamming weight ww at most 2B2B, we use threshold functions to directly check if ∣x∣=w|x|=w. For each j∈[J]j\in[J], we perform the following subsampling algorithm: independently keep each coordinate of xx with probability B/TjB/T_j and check whether at least BB kept coordinates are ones; note that the expected number of ones is B∣x∣/TjB|x|/T_j. Let j′∈[J]j'\in[J] be the largest candidate that succeeds the test. If ∣x∣≤2B|x|\le2B, we have directly computed ∣x∣|x|; otherwise, we use Tj′T_{j'} as the approximation of ∣x∣|x|. Standard concentration bounds show that the multiplicative error is at most ε\varepsilon with constant success probability. Then the ultimate construction computes the median of O(log⁡(1/δ))O(\log(1/\delta)) independent runs to reduce the failure probability to δ\delta. The detailed analysis can be found in [Ajt93, Vio14].

To implement the above algorithm in QAC0\mathrm{QAC}^{0}, we recall from [9] that threshold functions of polylogarithmic weights and polylogarithmic fanout have exact implementation in QAC0\mathrm{QAC}^{0}. By our assumption on δ\delta and ε\varepsilon, one can implement the O(log⁡(1/δ))O(\log(1/\delta)) runs exactly in QAC0\mathrm{QAC}^{0}. As for the final median computation, we observe that it is the median of polylogarithmically many numbers in S:={0,1,…,2B}∪{T1,…,TJ}S:=\{0,1,\ldots,2B\}\cup\{T_1,\ldots,T_J\}. Since both BB and JJ are polylogarithmic, we can check individually if each s∈Ss\in S is the median. This individual check can then be implemented as a polylogarithmic-sized majority of greater-than functions on two binary strings of polylogarithmic length. Hence these also only use threshold functions of polylogarithmic weights and polylogarithmic fanout. This completes the whole proof.

References

  1. [1]Sanjeev Arora and Boaz Barak. Computational complexity: a modern approach. Cambridge University Press, 2009.
  2. [2]Anurag Anshu, Yangjing Dong, Fengning Ou, and Penghui Yao. On the computational power of QAC⁰ with barely superlinear ancillae. arXiv preprint arXiv:2410.06499, 2024.arxiv.org/abs/2410.06499
  3. [3]Dorit Aharonov. A simple proof that Toffoli and Hadamard are quantum universal. arXiv preprint quant-ph/0301040, 2003. URL: https://arxiv.org/abs/quant-ph/0301040.
  4. [4]Miklós Ajtai. Σ₁-formulae on finite structures. Annals of pure and applied logic, 24(1):1–48, 1983.
  5. [6]DEBAJYOTI Bera. Quantum circuits: power and limitations. PhD thesis, Boston University, 2010.
  6. [7]Gilles Brassard, Peter Høyer, Michele Mosca, and Alain Tapp. Quantum amplitude amplification and estimation. In Samuel J. Lomonaco, Jr. and Howard E. Brandt, editors, Quantum Computation and Information, volume 305 of Contemporary Mathematics, pages 53–74. American Mathematical Society, 2002. URL: https://arxiv.org/abs/quant-ph/0005055, arXiv:quant-ph/0005055, doi:10.1090/conm/305/05215.
  7. [8]Merrick Furst, James B Saxe, and Michael Sipser. Parity, circuits, and the polynomial-time hierarchy. Mathematical systems theory, 17(1):13–27, 1984.
  8. [9]Daniel Grier, Jackson Morris, and Kewen Wu. QAC⁰ contains TC⁰ (with many copies of the input). arXiv preprint arXiv:2601.03243, 2026. URL: https://arxiv.org/abs/2601.03243.
  9. [11]Peter Høyer. Arbitrary phases in quantum amplitude amplification. Physical Review A, 62(5):052304, 2000. URL: https://arxiv.org/abs/quant-ph/0006031, arXiv:quant-ph/0006031, doi:10.1103/PhysRevA.62.052304.
  10. [12]Stasys Jukna et al. Boolean function complexity: advances and frontiers, volume 27. Springer, 2012.DOI
  11. [13]Malvika Raj Joshi, Avishay Tal, Francisca Vasconcelos, and John Wright. Improved lower bounds for qac0, 2025. URL: https://arxiv.org/abs/2512.14643, arXiv:2512.14643.
  12. [15]Nathan Linial, Yishay Mansour, and Noam Nisan. Constant depth circuits, Fourier transform, and learnability. Journal of the ACM (JACM), 40(3):607–620, 1993.
  13. [17]Michael A Nielsen and Isaac L Chuang. Quantum computation and quantum information. Cambridge university press, 2010.
  14. [18]Shivam Nadimpalli, Natalie Parham, Francisca Vasconcelos, and Henry Yuen. On the pauli spectrum of QAC⁰. In Proceedings of the 56th Annual ACM Symposium on Theory of Computing, pages 1498–1506, 2024.DOI
  15. [19]Daniel Padé, Stephen Fenner, Daniel Grier, and Thomas Thierauf. Tight bounds on depth-2 QAC-circuits computing parity. arXiv preprint arXiv:2504.06433, 2025.arxiv.org/abs/2504.06433
  16. [20]Alexander A Razborov. Lower bounds on the size of bounded depth circuits over a complete basis with logical addition. Mat. Zametki, 41(4):598–607, 1987.DOI

Paper details

vlnc:W_sfqgybqy
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

GPT-5.6 Sol (bare), GPT 6

View statement
Looking for related papers…
Contents