Magic and Communication Complexity

3 Magic lower bounds from communication complexity

3.1 Computation and communication models

Definition 15 Unitary Clifford+Magic circuit and \(\mathcal{M}^{\mathrm{unitary}}\)

A unitary Clifford\(+\)Magic circuit is a circuit of Clifford gates and magic gates. We say it computes \(f:\{ 0,1\} ^n\to \{ 0,1\} \) with correctness \(\epsilon \) if there is an advice state \(\lvert \psi \rangle \) (independent of the input) such that running the circuit on \(\lvert x\rangle \lvert \psi \rangle \) and measuring the first qubit returns \(f(x)\) with probability \(\ge 1-\epsilon \) for all \(x\) in the support of \(f\). The cost \(\mathcal{M}^{\mathrm{unitary}}_{\epsilon ,c_M}(f)\) is the minimal number of magic gates, each of weight at most \(c_M\), in any such circuit. Access to an arbitrary (arbitrarily large) advice state is allowed.

Definition 16 Mixed Clifford+Magic circuit and \(\mathcal{M}^{\mathrm{mixed}}\)

A mixed Clifford\(+\)Magic circuit is a quantum operation

\[ \mathcal{N}(\cdot ) = \sum _i p_i\, U_i(\cdot )U_i^\dagger , \]

where \(\{ p_i\} \) is a probability distribution and each \(U_i\) is a unitary Clifford\(+\)Magic circuit. Its magic-gate count is the worst-case count among the \(U_i\). It computes \(f\) with correctness \(\epsilon \) if (with an arbitrary advice state) measuring the first qubit yields \(f(x)\) with probability \(\ge 1-\epsilon \). The cost \(\mathcal{M}^{\mathrm{mixed}}_{\epsilon ,c_M}(f)\) is the minimal number of magic gates (of weight \(\le c_M\)) in any such operation computing \(f\).

Definition 17 Adaptive Clifford+Magic circuit and \(\mathcal{M}^{\mathrm{adaptive}}\)

An adaptive Clifford\(+\)Magic circuit is composed of Clifford gates, arbitrary magic gates, and mid-circuit computational-basis measurements, where later gate choices may depend arbitrarily on earlier measurement outcomes. Its cost is the total number of magic gates plus measurements in the worst-case run. The cost \(\mathcal{M}^{\mathrm{adaptive}}_{\epsilon ,c_M}(f)\) is the minimal such cost over adaptive circuits using magic gates and measurements each acting on at most \(c_M\) qubits (a single computational-basis measurement of \(c_M\) qubits counts once) that compute \(f\) with probability \(\ge 1-\epsilon \), with an arbitrary advice state.

Lemma 18 Comparison of computational models

For every Boolean function \(f\), \(\mathcal{M}^{\mathrm{unitary}}_{\epsilon }(f) \ge \mathcal{M}^{\mathrm{mixed}}_{\epsilon }(f)\) and \(\mathcal{M}^{\mathrm{unitary}}_{\epsilon }(f) \ge \mathcal{M}^{\mathrm{adaptive}}_{\epsilon }(f)\). Moreover the adaptive model can simulate the mixed model (by preparing \(\lvert +\rangle \) states and measuring), though the costs may be incomparable because \(\mathcal{M}^{\mathrm{adaptive}}\) also counts measurements.

Proof

A unitary Clifford\(+\)Magic circuit is the special case of a mixed circuit with a single term (\(p_1 = 1\)), and a special case of an adaptive circuit using no measurements; in both cases the magic-gate count is unchanged. Hence any unitary circuit witnessing \(\mathcal{M}^{\mathrm{unitary}}_\epsilon (f)\) is admissible in the mixed and adaptive models, giving \(\mathcal{M}^{\mathrm{unitary}}_\epsilon (f)\ge \mathcal{M}^{\mathrm{mixed}}_\epsilon (f)\) and \(\mathcal{M}^{\mathrm{unitary}}_\epsilon (f)\ge \mathcal{M}^{\mathrm{adaptive}}_\epsilon (f)\). For the simulation claim, an adaptive circuit can prepare \(\lvert +\rangle \) states and measure in the computational basis to generate randomness and then condition subsequent gates on the outcomes, reproducing the random choice \(i\) with distribution \(\{ p_i\} \) of a mixed circuit; but \(\mathcal{M}^{\mathrm{adaptive}}\) additionally charges for these measurements, so the two costs need not be comparable.

3.2 Lower bounds on magic gate count from communication complexity

Lemma 19 A single parity has \(\mathsf{D}\| \) cost \(2\)

For any parity function \(p(x,y) = \sum _{i\in S_A} x_i + \sum _{i\in S_B} y_i \pmod2\), the referee can compute \(p(x,y)\) in the \(\mathsf{D}\| \) model with communication cost \(2\).

Proof

Alice sends the single bit \(\sum _{i\in S_A} x_i \bmod 2\) and Bob sends the single bit \(\sum _{i\in S_B} y_i \bmod 2\). The referee XORs the two received bits to obtain \(p(x,y)\). Two bits are communicated.

Lemma 20 Pauli corrections are parities of the input

Let \(C\) be a Clifford circuit on \(n\) qubits and let \(X^{\vec a}Z^{\vec b}\) be a Pauli string whose exponents \(\vec a,\vec b\) are \(\mathbb {F}_2\)-affine functions (parity functions) of an input \((x,y)\). Then \(C\, (X^{\vec a}Z^{\vec b})\, C^\dagger \) is a Pauli string (up to phase) each of whose \(X\)- and \(Z\)-exponents is again a parity function of \((x,y)\), with the parities determined by \(C\) and not by the input.

Proof

Conjugation by a Clifford \(C\) maps each Pauli generator \(X_i, Z_i\) to a Pauli string (Definition 4); on exponent vectors over \(\mathbb {F}_2^{2n}\) this action is \(\mathbb {F}_2\)-linear (the symplectic representation of the Clifford group), depending only on \(C\) and ignoring global phases. Hence \(C(X^{\vec a}Z^{\vec b})C^\dagger \) has exponent vector \(L_C(\vec a, \vec b)\) for a fixed linear map \(L_C\) determined by \(C\). If \((\vec a,\vec b)\) are affine functions of \((x,y)\), then so is \(L_C(\vec a,\vec b)\), i.e. every output exponent is a parity function of \((x,y)\) with coefficients fixed by \(C\).

Theorem 21 Theorem 7: \(\mathsf{D}\| \) vs unitary magic count

Let \(f\) be a Boolean function. For all \(\epsilon {\lt} \tfrac 12\) and all \(c_M\),

\[ \frac{1}{4 c_M}\big(\mathsf{D}\| (f) - 2\big) \le \mathcal{M}^{\mathrm{unitary}}_{\epsilon }(f), \]

where the magic gates have weight at most \(c_M\).

Proof

Take a unitary Clifford\(+\)Magic circuit computing \(f\) with probability \(p = 1-\epsilon {\gt} 1/2\), with \(k\) magic gates each of weight \(\le c_M\). Decompose it into layers \(C^0, M_1, C^1, M_2, \dots , M_k, C^k\) where each \(C^j\) is a Clifford circuit and each \(M_j\) is a magic gate. Run on input \(\lvert z\rangle \lvert \psi \rangle \) with \(z\) split into \((x,y)\); view the input as \(X_A^{\vec x}\lvert x\rangle _A X_B^{\vec y}\lvert y\rangle _B\lvert \psi \rangle _E\) obtained from the all-zeros state.

Give a \(\mathsf{D}\| \) protocol. The referee runs the circuit on \(\lvert 0\rangle \lvert 0\rangle \lvert \psi \rangle \). After the first Clifford layer \(C^0\), the conjugated input Paulis become a Pauli correction \(\sigma _{ABE}[x,y]\) on the state, and by Lemma 20 each of its \(X\)- and \(Z\)-exponents is a parity function of \((x,y)\). Before applying \(M_1\) we must undo the Pauli corrections on the (at most \(c_M\)) wires that \(M_1\) acts on; each such wire carries a correction \(X^a Z^b\) with \(a,b\) parity functions of \((x,y)\), i.e. at most \(2c_M\) parity functions. By Lemma 19 each parity costs \(2\) bits of \(\mathsf{D}\| \) communication. Apply \(M_1\), then the next Clifford layer; the remaining corrections conjugate through to new parity-valued corrections (Lemma 20), and we repeat before each \(M_j\). Finally one more parity determines whether there is an \(X\) correction on the output qubit before the measurement (a \(Z\) correction does not affect the computational-basis measurement and may be left uncorrected). Correcting and measuring yields a sample from the circuit’s output distribution.

Repeating with the same parity values, the referee estimates the output distribution; since the circuit is correct with probability \(1-\epsilon {\gt} 1/2\), outputting the majority bit is correct. The total cost is at most \(4c_M\) per magic gate (at most \(2c_M\) parities, \(2\) bits each) plus \(2\) for the final parity, so \(\mathsf{D}\| (f) \le 4c_M\cdot \mathcal{M}^{\mathrm{unitary}}_{\epsilon {\lt}1/2}(f) + 2\). Rearranging gives the claim.

Proposition 22 Remark 8: post-selection strengthening

\(\mathsf{D}\| (f)\) also lower bounds the number of magic gates plus the number of post-selected qubits in any Clifford\(+\)Magic\(+\)post-selection circuit computing \(f\): precisely, the simulation of Theorem 21 extends so that each qubit of post-selection adds \(2\) bits of \(\mathsf{D}\| \) communication.

Proof

Run the simulation of Theorem 21. Just before a post-selection onto a fixed state, send the (at most \(2\) per qubit) parity-valued Pauli corrections acting on the post-selected qubit, exactly as is done before a magic gate; by Lemma 19 this costs \(2\) bits per qubit of post-selection. The referee corrects and then post-selects. Thus \(\mathsf{D}\| (f)\) also lower bounds the magic-gate count plus the number of post-selected qubits.

Theorem 23 Theorem 9: \(\mathsf{R}\| ^{\mathsf{pub}}\) vs mixed magic count

Let \(f\) be a Boolean function. For all \(\epsilon \) and \(c_M\),

\[ \frac{1}{4 c_M}\big(\mathsf{R}\| ^{\mathsf{pub}}_\epsilon (f) - 2\big) \le \mathcal{M}^{\mathrm{mixed}}_{\epsilon }(f). \]
Proof

Take a mixed Clifford\(+\)Magic circuit \(\mathcal{N}(\cdot )=\sum _i p_i U_i(\cdot ) U_i^\dagger \) computing \(f\) with probability \(\ge 1-\epsilon \); let \(P_i(z)\) be the probability that \(U_i\) outputs \(f(z)\) on input \(z\), so the success probability is \(p_{\mathrm{suc}}(z) = \sum _i p_i P_i(z) \ge 1-\epsilon \). The referee, Alice and Bob use public randomness to sample \(i\) with probability \(p_i\). They then run the \(\mathsf{D}\| \) protocol of Theorem 21 for the unitary \(U_i\), but the referee samples the final measurement once and outputs the result rather than taking a majority. The protocol is then correct with probability \(P_i\), and overall with probability \(\sum _i p_i P_i \ge 1-\epsilon \). The communication for the selected \(U_i\) is at most \(4c_M\) times the number of magic gates in \(U_i\) plus \(2\) (Theorem 21, Lemma 19); the worst case over \(i\) is \(4c_M \mathcal{M}^{\mathrm{mixed}}_{\epsilon ,c_M}(f) + 2\). Hence \(\mathsf{R}\| ^{\mathsf{pub}}_\epsilon (f) \le 4c_M\mathcal{M}^{\mathrm{mixed}}_{\epsilon }(f)+2\), which rearranges to the claim.

Theorem 24 Theorem 10: two-way \(\mathsf{R}\) vs adaptive magic count

Let \(f\) be a Boolean function. For all \(\epsilon \) and \(c_M\),

\[ \frac{1}{2 c_M}\big(\mathsf{R}_\epsilon (f) - 1\big) \le \mathcal{M}^{\mathrm{adaptive}}_{\epsilon ,c_M}(f). \]
Proof

Build a two-way protocol from an adaptive circuit. Decompose the circuit into layers, each an arbitrary Clifford circuit followed by at most one magic gate or one (computational-basis) measurement, occurring first in the layer. Alice prepares the advice state \(\lvert \psi \rangle _E\) and runs on \(\lvert x\rangle _A X_B^{\vec y}\lvert y\rangle _B\lvert \psi \rangle _E\); she applies the first Clifford layer, producing a Pauli correction \(\sigma _{ABE}[y]\) whose exponents are parities of the input (Lemma 20).

If the first non-Clifford operation is a magic gate (weight \(\le c_M\)), Bob computes the identities of the Pauli corrections on the \(\le c_M\) wires it acts on and sends them to Alice: for each wire there may be an \(X\) and a \(Z\) correction, so \(2c_M\) bits. Alice corrects and applies the gate. If instead it is a measurement (of \(\le c_M\) qubits), Bob sends the \(X\) corrections on the measured wires, Alice corrects, measures, and sends the \(\le c_M\) outcome bits back to Bob; total \(2c_M\) bits. In either case both players learn the measurement outcomes and choose the next layer accordingly. Repeating for every layer costs \(2c_M\) per magic gate or measurement. A final Pauli-\(X\) correction before the output measurement contributes \(+1\). The outcome equals \(f(x,y)\) with probability \(1-\epsilon \), so \(\mathsf{R}_\epsilon (f) \le 2c_M \mathcal{M}^{\mathrm{adaptive}}_{\epsilon ,c_M}(f)+1\), giving the claim.

Bounds from parity decision trees

Definition 25 Definition 11: non-adaptive parity decision tree

A non-adaptive parity decision tree (\(\mathsf{PDT}^{\mathrm{na}}\)) of depth \(k\) computing \(f:\{ 0,1\} ^n\to \{ 0,1\} \) is a function \(g:\{ 0,1\} ^k\to \{ 0,1\} \) together with parity functions \(p_1,\dots ,p_k\) such that \(f(x) = g(p_1(x),\dots ,p_k(x))\) for all \(x\). The \(\mathsf{PDT}^{\mathrm{na}}(f)\) complexity is the minimal such \(k\).

Definition 26 Definition 12: randomized non-adaptive parity decision tree

A randomized non-adaptive parity decision tree (\(\mathsf{RPDT}^{\mathrm{na}}\)) of depth \(k\) computing \(f\) with error \(\epsilon \) is a probability distribution over \(\mathsf{PDT}^{\mathrm{na}}\)’s each of depth \(\le k\) such that, for every input \(x\), the sampled tree outputs \(f(x)\) with probability \(\ge 1-\epsilon \). \(\mathsf{RPDT}^{\mathrm{na}}_\epsilon (f)\) is the minimal such \(k\).

Proposition 27 Eq. (18): \(\mathsf{PDT}^{\mathrm{na}}\) lower bounds unitary magic count

For all \(c_M\), \(\ \dfrac {1}{2c_M}\big(\mathsf{PDT}^{\mathrm{na}}(f) - 1\big) \le \mathcal{M}^{\mathrm{unitary}}_{\epsilon {\lt}1/2}(f)\).

Proof

In the proof of Theorem 21 the communication from Alice and Bob consists entirely of values of parity functions of \((x,y)\) (Lemma 20), and these parity functions depend only on the circuit, not on the input. Hence the referee computes the output as a fixed function of at most \(2c_M\) parities per magic gate plus one final parity, i.e. a non-adaptive parity decision tree of depth \(2c_M \mathcal{M}^{\mathrm{unitary}}_{\epsilon {\lt}1/2}(f) + 1\). Therefore \(\mathsf{PDT}^{\mathrm{na}}(f) \le 2c_M\mathcal{M}^{\mathrm{unitary}}_{\epsilon {\lt}1/2}(f) + 1\), which rearranges to the claim.

Proposition 28 Eq. (19): \(\mathsf{PDT}^{\mathrm{na}}\) vs unitary \(T\)-count

\(\ \mathsf{PDT}^{\mathrm{na}}(f) - 1 \le \mathcal{T}^{\mathrm{unitary}}_{\epsilon {\lt}1/2}(f)\), where \(\mathcal{T}^{\mathrm{unitary}}\) counts \(T\) gates.

Proof

Specialize Proposition 27 to \(T\) gates, where \(c_M = 1\). Since \(T\) commutes with Pauli \(Z\) (Definition 5), the \(Z\) corrections need not be undone before a \(T\) gate, halving the number of required parities to one per \(T\) gate. Hence \(\mathsf{PDT}^{\mathrm{na}}(f) \le \mathcal{T}^{\mathrm{unitary}}_{\epsilon {\lt}1/2}(f) + 1\).

Proposition 29 Eq. (20): \(\mathsf{RPDT}^{\mathrm{na}}\) lower bounds mixed magic count

For all \(c_M\), \(\ \dfrac {1}{2c_M}\big(\mathsf{RPDT}^{\mathrm{na}}_\epsilon (f) - 1\big) \le \mathcal{M}^{\mathrm{mixed}}_\epsilon (f)\).

Proof

For each \(U_i\) in the mixed circuit, the \(\mathsf{D}\| \) protocol of Theorem 21 defines a (deterministic) non-adaptive parity decision tree as in Proposition 27, except that the leaf now samples the output from the final measurement distribution rather than taking a majority; this is a \(\mathsf{RPDT}^{\mathrm{na}}\) that outputs \(f(x)\) with the same probability as running \(U_i\). Adding the public random choice of \(i\) (with probability \(p_i\)) gives a single \(\mathsf{RPDT}^{\mathrm{na}}\) outputting \(f(x)\) with the same probability as \(\sum _i p_i U_i(\cdot )U_i^\dagger \). The number of parities needed for the worst-case \(U_i\) is \(2c_M\mathcal{M}^{\mathrm{mixed}}_\epsilon (f) + 1\), so \(\mathsf{RPDT}^{\mathrm{na}}_\epsilon (f) \le 2c_M\mathcal{M}^{\mathrm{mixed}}_\epsilon (f) + 1\).

Proposition 30 Eq. (21): \(\mathsf{RPDT}^{\mathrm{na}}\) vs mixed \(T\)-count

\(\ \mathsf{RPDT}^{\mathrm{na}}_\epsilon (f) - 1 \le \mathcal{T}^{\mathrm{mixed}}_\epsilon (f)\).

Proof

Specialize Proposition 29 to \(T\) gates (\(c_M=1\)) and use, as in Proposition 28, that \(T\) commutes with \(Z\) so only one parity per \(T\) gate is needed. This gives \(\mathsf{RPDT}^{\mathrm{na}}_\epsilon (f) \le \mathcal{T}^{\mathrm{mixed}}_\epsilon (f) + 1\).

3.3 Lower bounds for concrete unitary operators

Definition 31 Magic count of a unitary operator

Extend \(\mathcal{M}^{\mathrm{unitary}}_\epsilon \) and \(\mathcal{M}^{\mathrm{mixed}}_\epsilon \) to a target unitary \(U\) by requiring the circuit to implement \(U\) to within \(\epsilon \) in diamond norm, \(\lVert U-U' \rVert _{\diamond }\le \epsilon \), where \(U'\) is the implemented unitary. The cost is the minimal magic count of such an approximating circuit.

Lemma 32 A unitary computing \(f\) inherits its magic lower bound

If a circuit using a unitary \(U\) computes \(f\) with probability \(1\) and no extra magic gates, then \(\mathcal{M}^{\mathrm{unitary}}_\epsilon (U) \ge \mathcal{M}^{\mathrm{unitary}}_\epsilon (f)\) and \(\mathcal{M}^{\mathrm{mixed}}_\epsilon (U) \ge \mathcal{M}^{\mathrm{mixed}}_\epsilon (f)\).

Proof

Suppose \(U'\) approximates \(U\) with \(\lVert U-U' \rVert _{\diamond }\le \epsilon \). Replacing \(U\) by \(U'\) in the circuit that computes \(f\) exactly yields a circuit computing \(f\) with probability \(\ge 1-\epsilon \) (the diamond-norm bound limits the change in any measurement outcome by \(\epsilon \)). Since the surrounding gates add no magic, any circuit implementing \(U\) to error \(\epsilon \) gives a circuit computing \(f\) to error \(\epsilon \) with the same magic count, so the magic count of \(U\) is at least that of \(f\) in both the unitary and mixed models.

Definition 33 Generalized Toffoli gate
#

The \(n\)-qubit generalized Toffoli gate acts by

\[ \mathrm{Toffoli}_n : \lvert x_1,\dots ,x_n,b\rangle \mapsto \Big\lvert x_1,\dots ,x_n,\, b \oplus \textstyle \bigwedge _{i=1}^n x_i \Big\rangle , \]

i.e. it XORs the AND of the first \(n\) bits into the target qubit.

Definition 34 Equality function
#

The equality function \(\mathrm{Equal}_n : \{ 0,1\} ^n\times \{ 0,1\} ^n\to \{ 0,1\} \) is \(\mathrm{Equal}_n(x,y) = 1\) iff \(x = y\).

Construction 35 Computing equality from \(\mathrm{Toffoli}_n\)

On \(2n+1\) qubits \(A_1,\dots ,A_n, B_1,\dots ,B_n, C\) with input \(\lvert x,y,0\rangle \):

  1. for each \(i\), apply CNOT with control \(A_i\), target \(B_i\), giving \(\lvert x_i, x_i\oplus y_i\rangle \), then apply \(X\) to \(B_i\) giving \(\lvert x_i, x_i\oplus y_i\oplus 1\rangle \);

  2. apply \(\mathrm{Toffoli}_n\) controlled on \(B_1,\dots ,B_n\) with target \(C\).

The target \(C\) flips iff all \(B_i = 1\), i.e. iff \(x_i = y_i\) for all \(i\); so the circuit computes \(\mathrm{Equal}_n(x,y)\) using one \(\mathrm{Toffoli}_n\) and otherwise only Clifford gates.

Lemma 36 Equality \(\mathsf{D}\| \) lower bound

\(\mathsf{D}\| (\mathrm{Equal}_n) = \Omega (n)\).

Lemma 37 Equality \(\mathsf{R}\| ^{\mathsf{pub}}\) lower bound

\(\mathsf{R}\| ^{\mathsf{pub}}_\epsilon (\mathrm{Equal}_n) = \Omega (\min \{ \log (1/\epsilon ), n\} )\).

Lemma 38 Lemma 13: magic lower bounds for \(\mathrm{Toffoli}_n\)

We have \(\mathcal{M}^{\mathrm{mixed}}_\epsilon (\mathrm{Toffoli}_n) = \Omega (\min \{ \log (1/\epsilon ), n\} )\) and, for all \(\epsilon {\lt}\tfrac 12\), \(\mathcal{M}^{\mathrm{unitary}}_\epsilon (\mathrm{Toffoli}_n) = \Omega (n)\).

Proof

By Construction 35, \(\mathrm{Toffoli}_n\) computes \(\mathrm{Equal}_n\) with no magic overhead, so by Lemma 32 \(\mathcal{M}^{\mathrm{mixed}}_\epsilon (\mathrm{Toffoli}_n) \ge \mathcal{M}^{\mathrm{mixed}}_\epsilon (\mathrm{Equal}_n)\) and \(\mathcal{M}^{\mathrm{unitary}}_\epsilon (\mathrm{Toffoli}_n)\ge \mathcal{M}^{\mathrm{unitary}}_\epsilon (\mathrm{Equal}_n)\). By Theorem 23, \(\mathcal{M}^{\mathrm{mixed}}_\epsilon (\mathrm{Equal}_n) \ge \tfrac {1}{4c_M}(\mathsf{R}\| ^{\mathsf{pub}}_\epsilon (\mathrm{Equal}_n)-1)\), and \(\mathsf{R}\| ^{\mathsf{pub}}_\epsilon (\mathrm{Equal}_n) = \Omega (\min \{ \log (1/\epsilon ),n\} )\) (Lemma 37) with \(c_M = O(1)\), giving the mixed bound. By Theorem 21, \(\mathcal{M}^{\mathrm{unitary}}_\epsilon (\mathrm{Equal}_n) \ge \tfrac {1}{4c_M}(\mathsf{D}\| (\mathrm{Equal}_n)-2)\), and \(\mathsf{D}\| (\mathrm{Equal}_n) = \Omega (n)\) (Lemma 36), giving the unitary bound \(\Omega (n)\).

Definition 39 Quantum multiplexer
#

The \(n\)-qubit quantum multiplexer acts, for \(x\in \{ 0,1\} ^n\), an \(\lceil \log _2 n\rceil \)-bit index \(i\), and \(b\in \{ 0,1\} \), by

\[ \mathrm{Multiplex}_n : \lvert i, x, b\rangle \mapsto \lvert i,\, x_1,\dots ,x_{i-1}, b, x_{i+1},\dots ,x_n,\, x_i\rangle , \]

i.e. controlled on \(i\) it swaps the \(i\)-th bit of \(x\) with the target \(b\).

Definition 40 Index function
#

The index function is \(\mathrm{Index}_n(i,x) = x_i\), where \(x\in \{ 0,1\} ^n\) and \(i\in \{ 0,1\} ^{\lceil \log _2 n\rceil }\).

Construction 41 The multiplexer computes the index function

Setting the target \(b = 0\), \(\mathrm{Multiplex}_n\) swaps \(x_i\) into the target register, so reading the target gives \(\mathrm{Index}_n(i,x) = x_i\). Hence the multiplexer computes the index function with zero magic overhead.

Lemma 42 Index function one-way / \(\mathsf{R}\| ^{\mathsf{pub}}\) lower bound

\(\mathsf{R}\| ^{\mathsf{pub}}_\epsilon (\mathrm{Index}_n) \ge (1-h(\epsilon ))\, n\).

Construction 43 Controlled multiplexer recursion

Define the controlled multiplexer \(\mathrm{cMultiplex}_n = \lvert 0\rangle \langle 0\rvert \otimes I + \lvert 1\rangle \langle 1\rvert \otimes \mathrm{Multiplex}_n\), acting on \(2 + \lceil \log _2 n\rceil + n\) qubits; a controlled multiplexer implements an ordinary one by fixing the control to \(\lvert 1\rangle \). The \(2^{k+1}\)-qubit controlled multiplexer is built from two \(2^{k}\)-qubit controlled multiplexers, with control \(C\), index register \(I_1,\dots ,I_{k+1}\), array \(X_1,\dots ,X_{2^{k+1}}\), target \(T\), and ancillas \(A_1,A_2\):

  1. apply \(X\) to \(I_1\); apply a Toffoli controlled on \(C, I_1\) with target \(A_1\); apply \(X\) to \(I_1\);

  2. apply a Toffoli controlled on \(C, I_1\) with target \(A_2\);

  3. run the \(2^k\)-qubit controlled multiplexer with control \(A_1\), index \(I_2,\dots ,I_{k+1}\), first half \(X_1,\dots ,X_{2^k}\), target \(T\);

  4. run the \(2^k\)-qubit controlled multiplexer with control \(A_2\), index \(I_2,\dots ,I_{k+1}\), second half \(X_{2^k+1},\dots ,X_{2^{k+1}}\), target \(T\);

  5. uncompute \(A_1, A_2\).

The ancillas \(A_1, A_2\) record whether the active half is the left or right half (determined by the top index bit \(I_1\) and control \(C\)); at most one of the two half-multiplexers fires, cleanly implementing the \(2^{k+1}\)-qubit controlled multiplexer.

Lemma 44 Lemma 14: magic bounds for \(\mathrm{Multiplex}_n\)

We have

\[ \mathcal{M}^{\mathrm{mixed}}_\epsilon (\mathrm{Multiplex}_n) \ge \frac{1}{4c_M}\big((1-h(\epsilon ))\, n - 1 \big), \]

and the upper bound \(\mathcal{M}^{\mathrm{unitary}}_{\epsilon =0}(\mathrm{Multiplex}_n) = O(n)\).

Proof

Lower bound. By Construction 41, \(\mathrm{Multiplex}_n\) computes \(\mathrm{Index}_n\) with no magic overhead, so by Lemma 32, \(\mathcal{M}^{\mathrm{mixed}}_\epsilon (\mathrm{Multiplex}_n) \ge \mathcal{M}^{\mathrm{mixed}}_\epsilon (\mathrm{Index}_n)\). By Theorem 23, \(\mathcal{M}^{\mathrm{mixed}}_\epsilon (\mathrm{Index}_n) \ge \tfrac {1}{4c_M}(\mathsf{R}\| ^{\mathsf{pub}}_\epsilon (\mathrm{Index}_n) - 1)\), and by Lemma 42 \(\mathsf{R}\| ^{\mathsf{pub}}_\epsilon (\mathrm{Index}_n) \ge (1-h(\epsilon ))n\), giving the stated bound.

Upper bound. Use Construction 43. Let \(g(k)\) be the magic count (Toffoli gates of weight \(3\)) of the \(2^k\)-qubit controlled multiplexer. The recursion uses two copies of the \(2^k\)-qubit controlled multiplexer plus a constant number of Toffolis (steps 1, 2 and the uncomputation in step 5), so \(g(k+1) \le 2g(k) + 4\), with base case \(g(1) = O(1)\). Unrolling, \(g(k) \le 2^k g_0 + 4(2^k - 1) = O(2^k)\). Since the \(n\)-array multiplexer corresponds to \(k = \log _2 n\), the magic count is \(O(2^{\log _2 n}) = O(n)\), and an ordinary multiplexer is a controlled one with control fixed to \(\lvert 1\rangle \). Hence \(\mathcal{M}^{\mathrm{unitary}}_{\epsilon =0}(\mathrm{Multiplex}_n) = O(n)\).