28
Span-program-based quantum algorithm for evaluating unbalanced formulas Ben W. Reichardt * Abstract The formula-evaluation problem is defined recursively. A formula’s evaluation is the eval- uation of a gate, the inputs of which are themselves independent formulas. Despite this pure recursive structure, the problem is combinatorially difficult for classical computers. A quantum algorithm is given to evaluate formulas over any finite boolean gate set. Provided that the complexities of the input subformulas to any gate differ by at most a constant factor, the algorithm has optimal query complexity. After efficient preprocessing, it is nearly time optimal. The algorithm is derived using the span program framework. It corresponds to the composition of the individual span programs for each gate in the formula. Thus the algorithm’s structure reflects the formula’s recursive structure. 1 Introduction A k-bit gate is a function f : {0, 1} k →{0, 1}.A formula ϕ over a set of gates S is a rooted tree in which each node with k children is associated to a k-bit gate from S , for k =1, 2,.... Any such tree with n leaves naturally defines a function ϕ : {0, 1} n →{0, 1}, by placing the input bits on the leaves in a fixed order and evaluating the gates recursively toward the root. Such functions are often called read-once formulas, as each input bit is associated to one leaf only. The formula-evaluation problem is to evaluate a formula ϕ over S on an input x ∈{0, 1} n . The formula is given, but the input string x must be queried one bit at a time. How many queries to x are needed to compute ϕ(x)? We would like to understand this complexity as a function of S and asymptotic properties of ϕ. Roughly, larger gate sets allow ϕ to have less structure, which increases the complexity of evaluating ϕ. Another important factor is often the balancedness of the tree ϕ. Unbalanced formulas often seem to be more difficult to evaluate. For applications, the most important gate set consists of all AND and OR gates. Formulas over this set are known as AND-OR formulas. Evaluating such a formula solves the decision version of a MIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating formulas, even over this limited gate set, is unknown, although important special cases have been solved. The problem over much larger gate sets appears to be combinatorially intractable. For some formulas, it is known that “non-directional” algorithms that do not work recursively on the structure of the formula perform better than any recursive procedure. In this article, we show that the formula-evaluation problem becomes dramatically simpler when we allow the algorithm to be a bounded-error quantum algorithm, and allow it coherent * School of Computer Science and Institute for Quantum Computing, University of Waterloo. 1 arXiv:0907.1622v1 [quant-ph] 9 Jul 2009

for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

Span-program-based quantum algorithm

for evaluating unbalanced formulas

Ben W Reichardtlowast

Abstract

The formula-evaluation problem is defined recursively A formularsquos evaluation is the eval-uation of a gate the inputs of which are themselves independent formulas Despite this purerecursive structure the problem is combinatorially difficult for classical computers

A quantum algorithm is given to evaluate formulas over any finite boolean gate set Providedthat the complexities of the input subformulas to any gate differ by at most a constant factorthe algorithm has optimal query complexity After efficient preprocessing it is nearly timeoptimal The algorithm is derived using the span program framework It corresponds to thecomposition of the individual span programs for each gate in the formula Thus the algorithmrsquosstructure reflects the formularsquos recursive structure

1 Introduction

A k-bit gate is a function f 0 1k rarr 0 1 A formula ϕ over a set of gates S is a rooted treein which each node with k children is associated to a k-bit gate from S for k = 1 2 Any suchtree with n leaves naturally defines a function ϕ 0 1n rarr 0 1 by placing the input bits onthe leaves in a fixed order and evaluating the gates recursively toward the root Such functions areoften called read-once formulas as each input bit is associated to one leaf only

The formula-evaluation problem is to evaluate a formula ϕ over S on an input x isin 0 1n Theformula is given but the input string x must be queried one bit at a time How many queries to xare needed to compute ϕ(x) We would like to understand this complexity as a function of S andasymptotic properties of ϕ Roughly larger gate sets allow ϕ to have less structure which increasesthe complexity of evaluating ϕ Another important factor is often the balancedness of the tree ϕUnbalanced formulas often seem to be more difficult to evaluate

For applications the most important gate set consists of all AND and OR gates Formulas overthis set are known as AND-OR formulas Evaluating such a formula solves the decision version of aMIN-MAX tree also known as a two-player game tree Unfortunately the complexity of evaluatingformulas even over this limited gate set is unknown although important special cases have beensolved The problem over much larger gate sets appears to be combinatorially intractable Forsome formulas it is known that ldquonon-directionalrdquo algorithms that do not work recursively on thestructure of the formula perform better than any recursive procedure

In this article we show that the formula-evaluation problem becomes dramatically simplerwhen we allow the algorithm to be a bounded-error quantum algorithm and allow it coherentlowastSchool of Computer Science and Institute for Quantum Computing University of Waterloo

1

arX

iv0

907

1622

v1 [

quan

t-ph

] 9

Jul

200

9

Randomized zero-error Quantum bounded-errorFormula ϕ query complexity R(ϕ) query complexity Q(ϕ)

ORn n Θ(radicn) [Gro96 BBBV97]

Balanced AND2-OR2 Θ(nα) [SW86] Θ(radicn) [FGG07 ACR+07]

Well-balanced AND-OR tight recursion [SW86]Approx-balanced AND-OR Θ(

radicn) [ACR+07] (Thm 111)

Arbitrary AND-OR Ω(n051) [HW91] Ω(radicn)

O(radicn log n)

[BS04][Rei09b]

Balanced MAJ3 (n = 3d) Ω((73)d

) O(2654d) [JKS03] Θ(2d) [RS08]

Balanced over S Θ(Advplusmn(ϕ)) [Rei09a]Almost-balanced over S Θ(Advplusmn(ϕ)) (Thm 19)

Table 1 Comparison of some classical and quantum query complexity results for formula evaluationHere S is any fixed finite gate set and the exponent α is given by α = log2(1+

radic33

4 ) asymp 0753 Undercertain assumptions the algorithmsrsquo running times are only poly-logarithmically slower

query access to the input string x Fix S to be any finite set of gates We give an optimal quantumalgorithm for evaluating ldquoalmost-balancedrdquo formulas over S The balance condition states thatthe complexities of the input subformulas to any gate differ by at most a constant factor wherecomplexity is measured by the general adversary bound Advplusmn In general Advplusmn is the value of anexponentially large semi-definite program (SDP) For a formula ϕ with constant-size gates thoughAdvplusmn(ϕ) can be computed efficiently by solving constant-size SDPs for each gate

To place this work in context some classical and quantum results for evaluating formulas aresummarized in Table 1 The stated upper bounds are on query complexity and not time complexityHowever for the ORn and balanced AND2-OR2 formulas the quantum algorithmsrsquo running timesare only slower by a poly-logarithmic factor For the other formulas the quantum algorithmsrsquorunning times are slower by a poly-logarithmic factor provided that

1 A polynomial-time classical preprocessing step outputting a string s(ϕ) is not charged for

2 The algorithms are allowed unit-cost coherent access to s(ϕ)

Our algorithm is based on the framework relating span programs and quantum algorithmsfrom [Rei09a] Previous work has used span programs to develop quantum algorithms for evaluatingformulas [RS08] Using this and the observation that the optimal span program witness size fora boolean function f equals the general adversary bound Advplusmn(f) Ref [Rei09a] gives an optimalquantum algorithm for evaluating ldquoadversary-balancedrdquo formulas over an arbitrary finite gate setThe balance condition is that each gatersquos input subformulas have equal general adversary bounds

In order to relax this strict balance requirement we must maintain better control in the recursiveanalysis To help do so we define a new span program complexity measure the ldquofull witnesssizerdquo This complexity measure has implications for developing time- and query-efficient quantumalgorithms based on span programs Essentially using a second result from [Rei09a] that propertiesof eigenvalue-zero eigenvectors of certain bipartite graphs imply ldquoeffectiverdquo spectral gaps aroundzero it allows quantum algorithms to be based on span programs with free inputs This can simplifythe implementation of a quantum walk on the corresponding graph

2

Besides allowing a relaxed balance requirement our approach has the additional advantage ofmaking the constants hidden in the big-O notation more explicit The formula-evaluation quantumalgorithms in [RS08 Rei09a] evaluate certain formulas ϕ using O

(Advplusmn(ϕ)

)queries where the

hidden constant depends on the gates in S in a complicated manner It is not known how to upper-bound the hidden constant in terms of say the maximum fan-in k of a gate in S In contrast theapproach we follow here allows bounding this constant by an exponential in k

It is known that the general adversary bound is a nearly tight lower bound on quantum querycomplexity for any boolean function [Rei09a] including in particular boolean formulas Howeverthis comes with no guarantees on time complexity The main contribution of this paper is togive a nearly time-optimal algorithm for formula evaluation The algorithm is also tight for querycomplexity removing the extra logarithmic factor from the bound in [Rei09a]

Additionally we apply the same technique to study AND-OR formulas For this special casespecial properties of span programs for AND and for OR gates allow the almost-balance conditionto be significantly weakened Ambainis et al [ACR+07] have studied this case previously Byapplying the span program framework we identify a slight weakness in their analysis Tighteningthe analysis extends the algorithmrsquos applicability to a broader class of AND-OR formulas

A companion paper [Rei09b] applies the span program framework to the problem of evaluatingarbitrary AND-OR formulas By studying the full witness size for span programs constructedusing a novel composition method it gives an O(

radicn log n)-query quantum algorithm to evaluate a

formula of size n for which the time complexity is poly-logarithmically worse after preprocessingThis nearly matches the Ω(

radicn) lower bound and improves a

radicn2O(

radiclogn)-query quantum algorithm

from [ACR+07] Ref [Rei09b] shares the broader motivation of this paper to study span programproperties and design techniques that lead to time-efficient quantum algorithms

Sections 11 and 12 below give further background on the formula-evaluation problem for clas-sical and quantum algorithms Section 13 precisely states our main theorem the proof of which isgiven in Section 3 after some background on span programs The theorem for approximately bal-anced AND-OR formulas is stated in Section 14 and proved in Section 4 An appendix revisits theproof from [ACR+07] to prove our extension directly without using the span program framework

11 History of the formula-evaluation problem for classical algorithms

For a function f 0 1n rarr 0 1 let D(f) be the least number of input bit queries sufficientto evaluate f on any input with zero error D(f) is known as the deterministic decision-treecomplexity of f or the deterministic query complexity of f Let the randomized decision-treecomplexity of f R(f) le D(f) be the least expected number of queries required to evaluate fwith zero error (ie by a Las Vegas randomized algorithm) Let the Monte Carlo decision-treecomplexity R2(f) = O

(R(f)

) be the least number of queries required to evaluate f with error

probability at most 13 (ie by a Monte Carlo randomized algorithm)Classically formulas over the gate set S = NANDk k isin N have been studied most exten-

sively where NANDk(x1 xk) = 1 minusprodkj=1 xj By De Morganrsquos rules any formula over NAND

gates can also be written as a formula in which the gates at an even distance from the formularsquosroot are AND gates and those an odd distance away are OR gates with some inputs or the outputpossibly complemented Thus formulas over S are also known as AND-OR formulas

For any AND-OR formula ϕ of size n ie on n inputs D(ϕ) = n However randomizationgives a strict advantage R(ϕ) and R2(ϕ) can be strictly smaller Indeed let ϕd be the completebinary AND-OR formula of depth d corresponding to the tree in which each internal vertex has

3

two children and every leaf is at distance d from the root with alternating levels of AND and ORgates Its size is n = 2d Snir [Sni85] has given a randomized algorithm for evaluating ϕd usingin expectation O(nα) queries where α = log2(1+

radic33

4 ) asymp 0753 [SW86] This algorithm known asrandomized alpha-beta pruning evaluates a random subformula recursively and only evaluates thesecond subformula if necessary Saks and Wigderson [SW86] have given a matching lower bound onR(ϕd) which Santha has extended to hold for Monte Carlo algorithms R2(ϕd) = Ω(nα) [San95]

Thus the query complexities have been characterized for the complete binary AND-OR formu-las In fact the tight characterization works for a larger class of formulas called ldquowell balancedrdquoformulas by [San95] This class includes for example alternating AND2-OR2 formulas where forsome d every leaf is at depth d or dminus1 Fibonacci trees and binomial trees [SW86] It also includesskew trees for which the depth is the maximal nminus 1

For arbitrary AND-OR formulas on the other hand little is known It has been conjectured thatcomplete binary AND-OR formulas are the easiest to evaluate and that in particular R(ϕ) = Ω(nα)for any size-n AND-OR formula ϕ [SW86] However the best general lower bound is R(ϕ) =Ω(n051) due to Heiman and Wigderson [HW91] Ref [HW91] also extends the result of [SW86] toallow for AND and OR gates with fan-in more than two

It is perhaps not surprising that formulas over most other gate sets S are even less well under-stood For example Boppana has asked the complexity of evaluating the complete ternary majority(MAJ3) formula of depth d [SW86] and the best published bounds on its query complexity areΩ((73)d

)and O

((26537 )d

)[JKS03] In particular the naıve ldquodirectionalrdquo generalization of

the randomized alpha-beta pruning algorithm is to evaluate recursively two random immediate sub-formulas and if they disagree then also the third This algorithm uses O

((83)d

)expected queries

and is suboptimal This suggests that the complete MAJ3 formulas are significantly different fromthe complete AND-OR formulas

Heiman Newman and Wigderson have considered read-once threshold formulas in an attemptto separate the complexity classes TC0 from NC1 [HNW93] That is they allow the gate set tobe the set of Hamming-weight threshold gates T km m k isin N defined by T km 0 1k rarr 0 1T km(x) = 1 if and only if the Hamming weight of x is at least m AND OR and majority gatesare all special cases of threshold gates Heiman et al prove that R(ϕ) ge n2d for ϕ a thresholdformula of depth d and in fact their proof extends to gate sets in which every gate ldquocontains afliprdquo [HNW93] This implies that a large depth is necessary for the randomized complexity to bemuch lower than the deterministic complexity

Of course there are some trivial gate sets for which the query complexity is fully understood forexample the set of parity gates Overall though there are many more open problems than resultsDespite its structure formula evaluation appears to be combinatorially complicated Howeverthere is another approach to try to leverage the power of quantum computers Surprisingly theformula-evaluation problem simplifies considerably in this different model of computation

12 History of the formula-evaluation problem for quantum algorithms

In the quantum query model the input bits can be queried coherently That is the quantumalgorithm is allowed unit-cost access to the unitary operator Ox called the input oracle defined by

Ox |ϕ〉 otimes |j〉 otimes |b〉 7rarr |ϕ〉 otimes |j〉 otimes |boplus xj〉 (11)

Here |ϕ〉 is an arbitrary pure state |j〉 j = 1 2 n is an orthonormal basis for Cn|b〉 b = 0 1 is an orthonormal basis for C2 and oplus denotes addition mod two Ox can be

4

implemented efficiently on a quantum computer given a classical circuit that computes the func-tion j 7rarr xj [NC00] For a function f 0 1n rarr 0 1 let Q(f) be the number of input queriesrequired to evaluate f with error probability at most 13 It is immediate that Q(f) le R2(f)

Research on the formula-evaluation problem in the quantum model began with the n-bit ORfunction ORn Grover gave a quantum algorithm for evaluating ORn with bounded one-sided errorusing O(

radicn) oracle queries and O(

radicn log log n) time [Gro96 Gro02] In the classical case on the

other hand it is obvious that R2(ORn) R(ORn) and D(ORn) are all Θ(n)Groverrsquos algorithm can be applied recursively to speed up the evaluation of more general AND-

OR formulas Call a formula layered if the gates at the same depth are the same Buhrman Cleveand Wigderson show that a layered depth-d size-n AND-OR formula can be evaluated usingO(radicn logdminus1 n) queries [BCW98] The logarithmic factors come from using repetition at each level

to reduce the error probability from a constant to be polynomially smallHoslashyer Mosca and de Wolf [HMW03] consider the case of a unitary input oracle Ox that maps

Ox |ϕ〉 otimes |j〉 otimes |b〉 otimes |0〉 7rarr |ϕ〉 otimes |j〉 otimes(|boplus xj〉 otimes |ψxjxj 〉+ |boplus xj〉 otimes |ψxjxj 〉

) (12)

where |ψxjxj 〉 |ψxjxj 〉 are pure states with |ψxjxj 〉2 ge 23 Such an oracle can be implemented

when the function j 7rarr xj is computed by a bounded-error randomized subroutine Hoslashyer et alallow access to Ox and Ominus1

x both at unit cost and show that ORn can still be evaluated usingO(radicn) queries This robustness result implies that the log n steps of repetition used by [BCW98]

are not necessary and a depth-d layered AND-OR formula can be computed in O(radicn cdminus1) queries

for some constant c gt 1000 If the depth is constant this gives an O(radicn)-query quantum algorithm

but the result is not useful for the complete binary AND-OR formula for which d = log2 nIn 2007 Farhi Goldstone and Gutmann presented a quantum algorithm for evaluating com-

plete binary AND-OR formulas [FGG07] Their breakthrough algorithm is not based on iteratingGroverrsquos algorithm in any way but instead runs a quantum walkmdashanalogous to a classical ran-dom walkmdashon a graph based on the formula The algorithm runs in time O(

radicn) in a certain

continuous-time query modelAmbainis et al discretized the [FGG07] algorithm by reinterpreting a correspondence between

(discrete-time) random and quantum walks due to Szegedy [Sze04] as a correspondence betweencontinuous-time and discrete-time quantum walks [ACR+07] Applying this correspondence toquantum walks on certain weighted graphs they gave an O(

radicn)-query quantum algorithm for

evaluating ldquoapproximately balancedrdquo AND-OR formulas For example MAJ3(x1 x2 x3) = (x1 andx2) or

((x1 or x2) and x3

) so there is a size-5d AND-OR formula that computes MAJ3

d the completeternary majority formula of depth d Since the formula is approximately balanced Q(MAJ3

d) =O(radic

5d) better than the Ω

((73)d

)classical lower bound

The [ACR+07] algorithm also applies to arbitrary AND-OR formulas If ϕ has size n anddepth d then the algorithm applied directly evaluates ϕ using O(

radicnd) queries1 This can be as

bad as O(n32) if the depth is d = n However Bshouty Cleve and Eberly have given a formularebalancing procedure that takes AND-OR formula ϕ as input and outputs an equivalent AND-ORformula ϕprime with depth dprime = 2O(

radiclogn) and size nprime = n 2O(

radiclogn) [BCE91 BB94] The formula ϕprime

can then be evaluated using O(radicnprime dprime) =

radicn 2O(

radiclogn) queries

Our understanding of lower bounds for the formula-evaluation problem progressed in parallel1Actually [ACR+07 Sec 7] only shows a bound of O(

radicnd32) queries but this can be improved to O(

radicnd)

using the bounds on σplusmn(ϕ) below [ACR+07 Def 1]

5

to this progress on quantum algorithms There are essentially two techniques the polynomial andadversary methods for lower-bounding quantum query complexity

bull The polynomial method introduced in the quantum setting by Beals et al [BBC+01] is basedon the observation that after making q oracle Ox queries the probability of any measurementresult is a polynomial of degree at most 2q in the variables xj

bull Ambainis generalized the classical hybrid argument to consider the systemrsquos entanglementwhen run on a superposition of inputs [Amb02] A number of variants of Ambainisrsquos boundwere soon discovered including weighted versions [HNS02 BS04 Amb06 Zha05] a spectralversion [BSS03] and a version based on Kolmogorov complexity [LM04] These variants canbe asymptotically stronger than Ambainisrsquos original unweighted bound but are equivalent toeach other [SS06] We therefore term it simply ldquothe adversary boundrdquo denoted by Adv

The adversary bound is well-suited for lower-bounding the quantum query complexity for eval-uating formulas For example Barnum and Saks proved that for any size-n AND-OR formula ϕAdv(ϕ) =

radicn implying the lower bound Q(ϕ) = Ω(

radicn) [BS04] Thus the [ACR+07] algorithm is

optimal for approximately balanced AND-OR formulas and is nearly optimal for arbitrary AND-OR formulas This is a considerably more complete solution than is known classically

It is then natural to consider formulas over larger gate sets The adversary bound continues towork well because it transforms nicely under function composition

Theorem 11 (Adversary bound composition [Amb06 LLS06 HLS05]) Let f 0 1k rarr 0 1and let fj 0 1mj rarr 0 1 for j = 1 2 k Define g 0 1m1 times middot middot middot times 0 1mk rarr 0 1 byg(x) = f

(f1(x1) fk(xk)

) Let s = (Adv(f1) Adv(fk)) Then

Adv(g) = Advs(f) (13)

See Definition 21 for the definition of the adversary bound with ldquocostsrdquo Advs The Adv boundequals Advs with uniform unit costs s = ~1 For a function f Adv(f) can be computed using asemi-definite program in time polynomial in the size of f rsquos truth table Therefore Theorem 11gives a polynomial-time procedure for computing the adversary bound for a formula ϕ over anarbitrary finite gate set compute the bounds for subformulas moving from the leaves toward theroot At an internal node f having computed the adversary bounds for the input subformulasf1 fk Eq (13) says that the adversary bound for g the subformula rooted at f equals theadversary bound for the gate f with certain costs Computing this requires 2O(k) time which is aconstant if k = O(1) For example if f is an ORk or ANDk gate then Adv(s1sk)(f) =

radicsumj s

2j

from which follows immediately the [BS04] result Adv(ϕ) =radicn for a size-n AND-OR formula ϕ

A special case of Theorem 11 is when the functions fj all have equal adversary bounds soAdv(g) = Adv(f)Adv(f1) In particular for a function f 0 1k rarr 0 1 and a natural numberd isin N let fd 0 1kd rarr 0 1 denote the complete depth-d formula over f That is f1 = f andfd(x) = f

(fdminus1(x1 xkdminus1) fdminus1(xkdminuskdminus1+1 xkd)

)for d gt 1 Then we obtain

Corollary 12 For any function f 0 1k rarr 0 1

Adv(fd) = Adv(f)d (14)

6

In particular Ambainis defined a boolean function f 0 14 rarr 0 1 that can be representedexactly by a polynomial of degee two but for which Adv(f) = 52 [Amb06] Thus fd can berepresented exactly by a polynomial of degree 2d but by Corollary 12 Adv(fd) = (52)d For thisfunction the adversary bound is strictly stronger than any bound obtainable using the polynomialmethod Many similar examples are given in [HLS06] However for other functions the adversarybound is asymptotically worse than the polynomial method [SS06 AS04 Amb05]

In 2007 though Hoslashyer et al discovered a strict generalization of Adv that also lower-boundsquantum query complexity [HLS07] We call this new bound the general adversary bound or AdvplusmnFor example for Ambainisrsquos four-bit function f Advplusmn(f) ge 251 [HLS06] Like the adversarybound Advplusmns (f) can be computed in time polynomial in the size of f rsquos truth table and alsocomposes nicely

Theorem 13 ([HLS07 Rei09a]) Under the conditions of Theorem 11

Advplusmn(g) = Advplusmns (f) (15)

In particular if Advplusmn(f1) = middot middot middot = Advplusmn(fk) then Advplusmn(g) = Advplusmn(f) Advplusmn(f1)

Define a formula ϕ to be adversary balanced if at each internal node the general adversarybounds of the input subformulas are equal In particular by Theorem 13 this implies that Advplusmn(ϕ)is equal to the product of the general adversary bounds of the gates along any path from the rootto a leaf Complete layered formulas are an example of adversary-balanced formulas

Returning to upper bounds Reichardt and Spalek [RS08] generalized the algorithmic approachstarted by [FGG07] They gave an optimal quantum algorithm for evaluating adversary-balancedformulas over a considerably extended gate set including in particular all functions 0 1k rarr 0 1for k le 3 69 inequivalent four-bit functions and the gates ANDk ORk PARITYk and EQUALkfor k = O(1) For example Q(MAJ3

d) = Θ(2d)The [RS08] result follows from a framework for developing formula-evaluation quantum algo-

rithms based on span programs A span program introduced by Karchmer and Wigderson [KW93]is a certain linear-algebraic way of defining a function which corresponds closely to eigenvalue-zeroeigenvectors of certain bipartite graphs [RS08] derived a quantum algorithm for evaluating certainconcatenated span programs with a query complexity upper-bounded by the span program witnesssize denoted wsize In particular a special case of [RS08 Theorem 47] is

Theorem 14 ([RS08]) Fix a function f 0 1k rarr 0 1 If span program P computes f then

Q(fd) = O(wsize(P )d

) (16)

From Theorem 13 this result is optimal if wsize(P ) = Advplusmn(f) The question thereforebecomes how to find optimal span programs Using an ad hoc search [RS08] found optimal spanprograms for a variety of functions with Advplusmn = Adv Further work automated the search bygiving a semi-definite program (SDP) for the optimal span program witness size for any givenfunction [Rei09a] Remarkably the SDPrsquos value always equals the general adversary bound

Theorem 15 ([Rei09a]) For any function f 0 1n rarr 0 1

infP

wsize(P ) = Advplusmn(f) (17)

where the infimum is over span programs P computing f Moreover this infimum is achieved

7

This result greatly extends the gate set over which the formula-evaluation algorithm of [RS08]works optimally For example combined with Theorem 14 it implies that limdrarrinfinQ(fd)1d =Advplusmn(f) for every boolean function f More generally Theorem 15 allows the [RS08] algorithmto be run on formulas over any finite gate set S A factor is lost that depends on the gates in Sbut it will be a constant for S finite Combining Theorem 15 with [RS08 Theorem 47] gives

Theorem 16 ([Rei09a]) Let S be a finite set of gates Then there exists a quantum algorithm thatevaluates an adversary-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After efficient

classical preprocessing independent of the input x and assuming unit-time coherent access to thepreprocessed classical string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

In the discussion so far we have for simplicity focused on query complexity The query com-plexity is an information-theoretic quantity that does not charge for operations independent of theinput string even though these operations may require many elementary gates to implement Forpractical algorithms it is important to be able to bound the algorithmrsquos running time which countsthe cost of implementing the input-independent operations Theorem 16 puts an optimal boundon the query complexity and also puts a nearly optimal bound on the algorithmrsquos time complexityIn fact all of the query-optimal algorithms so far discussed are also nearly time optimal

In general though an upper bound on the query complexity does not imply an upper boundon the time complexity Ref [Rei09a] also generalized the span program framework of [RS08] toapply to quantum algorithms not based on formulas The main result of [Rei09a] is

Theorem 17 ([Rei09a]) For any function f D rarr 1 2 m with D sube 0 1n Q(f) satisfies

Q(f) = Ω(Advplusmn(f)) and Q(f) = O

(Advplusmn(f)

log Advplusmn(f)log log Advplusmn(f)

log(m) log logm) (18)

Theorem 17 in particular allows us to compute the query complexity of formulas up to thelogarithmic factor It does not give any guarantees on running time However the analysis requiredto prove Theorem 17 also leads to significantly simpler proofs of Theorem 16 and the AND-ORformula results of [ACR+07 FGG07] Moreover we will see that it allows the formula-evaluationalgorithms to be extended to formulas that are not adversary balanced

13 Quantum algorithm for evaluating almost-balanced formulas

We give a formula-evaluation algorithm that is both query-optimal without a logarithmic overheadand after an efficient preprocessing step nearly time optimal Define almost balance as follows

Definition 18 Consider a formula ϕ over a gate set S For a vertex v in the correspondingtree let ϕv denote the subformula of ϕ rooted at v and if v is an internal vertex let gv be thecorresponding gate The formula ϕ is β-balanced if for every vertex v with children c1 c2 ck

maxj Advplusmn(ϕcj )minj Advplusmn(ϕcj )

le β (19)

(If cj is a leaf Advplusmn(ϕcj ) = 1) Formula ϕ is almost balanced if it is β-balanced for some β = O(1)

In particular an adversary-balanced formula is 1-balanced We will show

8

Theorem 19 Let S be a fixed finite set of gates Then there exists a quantum algorithm thatevaluates an almost-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After polynomial-

time classical preprocessing independent of the input and assuming unit-time coherent access tothe preprocessed string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

Theorem 19 is significantly stronger than Theorem 16 which requires exact balance Thereare important classes of exactly balanced formulas such as complete layered formulas In fact it issufficient that the multiset of gates along the simple path from the root to a leaf not depend on theleaf Moreover sometimes different gates have the same Advplusmn bound see [HLS06] for examplesEven still exact adversary balance is a very strict condition

The proof of Theorem 19 is based on the span program framework developed in Ref [Rei09a]In particular [Rei09a Theorem 91] gives two quantum algorithms for evaluating span programsThe first algorithm is based on a discrete-time simulation of a continuous-time quantum walkIt applies to arbitrary span programs and is used in combination with Theorem 15 to proveTheorem 17 However the simulation incurs a logarithmic query overhead and potentially worsetime complexity overhead so this algorithm is not suitable for proving Theorem 19

The second algorithm in [Rei09a] is based directly on a discrete-time quantum walk similarto previous optimal formula-evaluation algorithms [ACR+07 RS08] However this algorithm doesnot apply to an arbitrary span program A bound is needed on the operator norm of the entry-wiseabsolute value of the weighted adjacency matrix for a corresponding graph Further graph sparsityconditions are needed for the algorithm to be time efficient (see Theorem 24)

Unfortunately the span program from Theorem 15 will not generally satisfy these conditionsTheorem 15 gives a canonical span program ([Rei09a Def 51]) Even for a simple formula theoptimal canonical span program will typically correspond to a dense graph with large norm

An example should clarify the problem Consider the AND-OR formula ψ(x) =([(x1 and x2) or

x3] and x4

)or(x5 and [x6 or x7]

) and consider the two graphs in Figure 1 For an input x isin 0 17

modify the graphs by attaching dangling edges to every vertex j for which xj = 0 Observe thenthat each graph has an eigenvalue-zero eigenvector supported on vertex 0mdashcalled a witnessmdashif andonly if ψ(x) = 1 The graphs correspond to different span programs computing ψ and the quantumalgorithm works essentially by running a quantum walk starting at vertex 0 in order to detect thewitness The graph on the left is a significantly simplified version of a canonical span program forψ and its density still makes it difficult to implement the quantum walk

We will be guided by the second simpler graph Instead of applying Theorem 15 to ϕ as awhole we apply it separately to every gate in the formula We then compose these span programsone per gate according to the formula using direct-sum composition (Definition 25) In terms ofgraphs direct-sum composition attaches the output vertex of one span programrsquos graph to an inputvertex of the next [RS08] This leads to a graph whose structure somewhat follows the structure ofthe formula ϕ as the graph in Figure 1(b) follows the structure of ψ (However the general casewill be more complicated than shown as we are plugging together constant-size graph gadgets andthere may be duplication of some subgraphs)

Direct-sum composition keeps the maximum degree and norm of the graph under controlmdasheachis at most twice its value for the worst single gate Therefore the second [Rei09a] algorithm appliesHowever direct-sum composition also leads to additional overhead In particular a witness in thefirst graph will be supported only on numbered vertices (note that the graph is bipartite) whereasa witness in the second graph will be supported on some of the internal vertices as well This meansroughly that the second witness will be harder to detect because after normalization its overlap on

9

0

1

2

3

4

5

6

7

(a)

3

6

7

0

1

2

4

5

(b)

Figure 1 Graphs corresponding to two span programs both computing the same function

vertex 0 will be smaller Scale both witnesses so that the amplitude on vertex 0 is one The witnesssize (wsize) measures the squared length of the witness only on numbered vertices whereas the fullwitness size (fwsize) measures the squared length on all vertices For [Rei09a] it was sufficient toconsider only span program witness size because for canonical span programs like in Figure 1(a)the two measures are equal (For technical reasons we will actually define fwsize to be 1 + wsizeeven in this case) For our analysis we will need to bound the full witness size in terms of thewitness size We maintain this bound in a recursion from the formularsquos leaves toward its root

A span program is called strict if every vertex on one half of the bipartite graph is either aninput vertex (vertices 1ndash7 in the graphs of Figure 1) or the output vertex (vertex 0) Thus the firstgraph in the example above corresponds to a strict span program and the second does not Theoriginal definition of span programs in [KW93] allowed for only strict span programs This wassensible because any other vertices on the inputoutput part of the graphrsquos bipartition can alwaysbe projected away yielding a strict span program that computes the same function For developingtime-efficient quantum algorithms though it seems important to consider span programs that arenot strict Unfortunately going backwards eg from 1(a) to 1(b) is probably difficult in general

Theorem 19 does not follow from the formula-evaluation techniques of [RS08] together withTheorem 14 from [Rei09a] This tempting approach falls into intractable technical difficulties Inparticular the same span program can be used at two vertices v and w in ϕ only if gv = gw andthe general adversary bounds of vrsquos input subformulas are the same as those for wrsquos inputs upto simultaneous scaling In general then an almost-balanced formula will require an unboundednumber of different span programs However the analysis in [RS08] loses a factor that dependsbadly on the individual span programs Since the dependence is not continuous even showingthat the span programs in use all lie within a compact set would not be sufficient to obtain anO(1) upper bound In contrast the approach we follow here allows bounding the lost factor by anexponential in k uniformly over different gate imbalances

10

14 Quantum algorithm to evaluate approximately balanced AND-OR formulas

Ambainis et al [ACR+07] use a weaker balance criterion for AND-OR formulas than Definition 18They define an AND-OR formula to be approximately balanced if σminus(ϕ) = O(1) and σ+(ϕ) = O(n)Here n is the size of the formula ie the number of leaves and σminus(ϕ) and σ+(ϕ) are defined by

Definition 110 For each vertex v in a formula ϕ let

σminus(v) = maxξ

sumwisinξ

1Advplusmn(ϕw)

σ+(v) = maxξ

sumwisinξ

Advplusmn(ϕw)2 (110)

with each maximum taken over all simple paths ξ from v to a leaf Let σplusmn(ϕ) = σplusmn(r) where r isthe root of ϕ

Recall that Advplusmn(ϕ) = Adv(ϕ) =radicn for an AND-OR formula Definition 18 is a stricter

balance criterion because β-balance of a formula ϕ implies (by Lemma 32) that σminus(ϕ) and σ+(ϕ) areboth dominated by geometric series However the same steps followed by the proof of Theorem 19still suffice for proving the [ACR+07] result and in fact for strengthening it We show

Theorem 111 Let ϕ be an AND-OR formula of size n Then after polynomial-time classicalpreprocessing that does not depend on the input x ϕ(x) can be evaluated by a quantum algo-rithm with error at most 13 using O

(radicnσminus(ϕ)

)input queries The algorithmrsquos running time isradic

nσminus(ϕ)(log n)O(1) assuming unit-cost coherent access to the preprocessed string

For the special case of AND-OR formulas with σminus(ϕ) = O(1) Theorem 111 strengthens The-orem 19 The requirement that σminus(ϕ) = O(1) allows for some gates in the formula to be veryunbalanced Theorem 111 also strengthens [ACR+07 Theorem 1] because it does not require thatσ+(ϕ) = O(n) For example a formula that is biased near the root but balanced at greater depthscan have σminus(ϕ) = O(1) and σ+(ϕ) = ω(n) By substituting the bound σminus(ϕ) = O(

radicd) for a depth-

d formula [ACR+07 Def 3] a corollary of Theorem 111 is that a depth-d size-n AND-OR formulacan be evaluated using O(

radicnd) queries This improves the depth-dependence from [ACR+07] and

matches the dependence from an earlier version of that article [Amb07]The essential reason that the Definition 18 balance condition can be weakened is that for the

specific gates AND and OR by writing out the optimal span programs explicitly we can prove thatthey satisfy stronger properties than are necessarily true for other functions

2 Span programs

21 Definitions

We briefly recall some definitions from [Rei09a Sec 2] Additionally we define a span programcomplexity measure the full witness size that charges even for the ldquofreerdquo inputs This quantity isimportant for developing quantum algorithms that are time efficient as well as query efficient

For a natural number n let [n] = 1 2 n For a finite set X let CX be the inner productspace C|X| with orthonormal basis |x〉 x isin X For vector spaces V and W over C let L(VW )be the set of linear transformations from V into W and let L(V ) = L(V V ) For A isin L(VW )A is the operator norm of A For a string x isin 0 1n let x denote its bitwise complement

11

Definition 21 ([HLS05 HLS07]) For finite sets C E and D sube Cn let f D rarr E An adversarymatrix for f is a real symmetric matrix Γ isin L(CD) that satisfies 〈x|Γ|y〉 = 0 whenever f(x) = f(y)

The general adversary bound for f with costs s isin [0infin)n is

Advplusmns (f) = maxadversary matrices Γforalljisin[n] Γ∆jlesj

Γ (21)

Here Γ ∆j denotes the entry-wise matrix product between Γ and ∆j =sum

xyxj 6=yj|x〉〈y| The

(nonnegative-weight) adversary bound for f with costs s is defined by the same maximizationexcept with Γ restricted to have nonnegative entries In particular Advplusmns (f) ge Advs(f)

Letting ~1 = (1 1 1) the adversary bound for f is Adv(f) = Adv~1(f) and the generaladversary bound for f is Advplusmn(f) = Advplusmn~1 (f) By [HLS07] Q(f) = Ω(Advplusmn(f))

Definition 22 (Span program [KW93]) A span program P consists of a natural number n afinite-dimensional inner product space V over C a ldquotargetrdquo vector |t〉 isin V disjoint sets Ifree andIjb for j isin [n] b isin 0 1 and ldquoinput vectorsrdquo |vi〉 isin V for i isin Ifree cup

⋃jisin[n]bisin01 Ijb

To P corresponds a function fP 0 1n rarr 0 1 defined on x isin 0 1n by

fP (x) =

1 if |t〉 isin Span(|vi〉 i isin Ifree cup

⋃jisin[n] Ijxj)

0 otherwise(22)

Some additional notation is convenient Fix a span program P Let I = Ifreecup⋃jisin[n]bisin01 Ijb

Let A isin L(CI V ) be given by A =sum

iisinI |vi〉〈i| For x isin 0 1n let I(x) = Ifree cup⋃jisin[n] Ijxj and

Π(x) =sum

iisinI(x) |i〉〈i| isin L(CI) Then fP (x) = 1 if |t〉 isin Range(AΠ(x)) A vector |w〉 isin CI is saidto be a witness for fP (x) = 1 if Π(x)|w〉 = |w〉 and A|w〉 = |t〉 A vector |wprime〉 isin V is said to be awitness for fP (x) = 0 if 〈t|wprime〉 = 1 and Π(x)Adagger|wprime〉 = 0

Definition 23 (Witness size) Consider a span program P and a vector s isin [0infin)n of nonnegativeldquocostsrdquo Let S =

sumjisin[n]bisin01iisinIjb

radicsj |i〉〈i| isin L(CI) For each input x isin 0 1n define the witness

size of P on x with costs s wsizes(P x) as follows

wsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉 S|w〉2 if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

SAdagger|wprime〉2 if fP (x) = 0 (23)

The witness size of P with costs s is

wsizes(P ) = maxxisin01n

wsizes(P x) (24)

Define the full witness size fwsizes(P ) by letting Sf = S +sum

iisinIfree|i〉〈i| and

fwsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉(1 + Sf |w〉2) if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

(|wprime〉2 + SAdagger|wprime〉2) if fP (x) = 0 (25)

fwsizes(P ) = maxxisin01n

fwsizes(P x) (26)

When the subscript s is omitted the costs are taken to be uniform s = ~1 = (1 1 1) egfwsize(P ) = fwsize~1(P ) The witness size is defined in [RS08] The full witness size is definedin [Rei09a Sec 8] but is not named there A strict span program has Ifree = empty so Sf = S and amonotone span program has Ij0 = empty for all j [Rei09a Def 49]

12

22 Quantum algorithm to evaluate a span program based on its full witness size

[Rei09a Theorem 93] gives a quantum query algorithm for evaluating span programs based on thefull witness size The algorithm is based on a quantum walk on a certain graph Provided that thedegree of the graph is not too large it can actually be implemented efficiently

Theorem 24 ([Rei09a Theorem 93]) Let P be a span program Then fP can be evaluated using

T = O(fwsize(P ) abs(AGP

))

(27)

quantum queries with error probability at most 13 Moreover if the maximum degree of a vertexin GP is d then the time complexity of the algorithm for evaluating fP is at most a factor of(log d)

(log(T log d)

)O(1) worse after classical preprocessing and assuming constant-time coherentaccess to the preprocessed string

Proof sketch The query complexity claim is actually slightly weaker than [Rei09a Theorem 93]which allows the target vector to be scaled downward by a factor of

radicfwsize(P )

The time-complexity claim will follow from the proof of [Rei09a Theorem 93] in [Rei09aProp 94 Theorem 95] The algorithm for evaluating fP (x) uses a discrete-time quantum walkon the graph GP (x) If the maximum degree of a vertex in GP is d then each coin reflec-tion can be implemented using O(log d) single-qubit unitaries and queries to the preprocessedstring [GR02 CNW09] Finally the

(log(T log d)

)O(1) factor comes from applying the Solovay-Kitaev Theorem [KSV02] to compile the single-qubit unitaries into products of elementary gatesto precision 1O(T log d)

We remark that together with [Rei09a Theorem 31] Theorem 24 gives a way of transforming aone-sided-error quantum algorithm into a span program and back into a quantum algorithm suchthat the time complexity is nearly preserved after preprocessing This is only a weak equivalencebecause aside from requiring preprocessing the algorithm from Theorem 24 also has two-sided errorTo some degree though it complements the equivalence results for best span program witness sizeand bounded-error quantum query complexity [Rei09a Theorem 71 Theorem 92]

23 Direct-sum span program composition

Let us study the full witness size of the direct-sum composition of span programs We begin byrecalling the definition of direct-sum composition

Let f 0 1n rarr 0 1 and S sube [n] For j isin [n] let mj be a natural number with mj = 1 forj isin S For j isin S let fj 0 1mj rarr 0 1 Define y 0 1m1 times middot middot middot times 0 1mn rarr 0 1n by

y(x)j =

fj(xj) if j isin Sxj if j isin S

(28)

Define g 0 1m1 times middot middot middottimes 0 1mn rarr 0 1 by g(x) = f(y(x)) For example if S = [n] r 1 then

g(x) = f(x1 f2(x2) fn(xn)

) (29)

Given span programs for the individual functions f and fj for j isin S we will construct a spanprogram for g We remark that although we are here requiring that the inner functions fj act on

13

disjoint sets of bits this assumption is not necessary for the definition It simplifies the notationthough for the cases S 6= [n] and will suffice for our applications

Let P be a span program computing fP = f Let P have inner product space V target vector|t〉 and input vectors |vi〉 indexed by Ifree and Ijc for j isin [n] and c isin 0 1

For j isin [n] let sj isin [0infin)mj be a vector of costs and let s isin [0infin)Pmj be the concatenation of

the vectors sj For j isin S let P j0 and P j1 be span programs computing fP j1 = fj 0 1mj rarr 0 1and fP j0 = notfj with rj = wsizesj (P j0) = wsizesj (P j1) For c isin 0 1 let P jc have inner productspace V jc with target vector |tjc〉 and input vectors indexed by Ijcfree and Ijckb for k isin [mj ] b isin 0 1For j isin S let rj = sj

Let IS =⋃jisinScisin01 Ijc Define ς IS rarr [n]times 0 1 by ς(i) = (j c) if i isin Ijc The idea is that

ς maps i to the input span program that must evaluate to 1 in order for |vi〉 to be available in P There are several ways of composing the span programs P and P jc to obtain a span program Q

computing the composed function fQ = g with wsizes(Q) le wsizer(P ) [Rei09a Defs 44 45 46]We focus on direct-sum composition

Definition 25 ([Rei09a Def 45]) The direct-sum-composed span program Qoplus is defined by

bull The inner product space is V oplus = V oplusoplus

jisinScisin01(CIjc otimes V jc) Any vector in V oplus can be

uniquely expressed as |u〉V +sum

iisinIS |i〉 otimes |ui〉 where |u〉 isin V and |ui〉 isin V ς(i)

bull The target vector is |toplus〉 = |t〉V

bull The free input vectors are indexed by Ioplusfree = Ifree cup IS cup⋃jisinScisin01(Ijc times Ijcfree) with for

i isin Ioplusfree

|voplusi 〉 =

|vi〉V if i isin Ifree

|vi〉V minus |i〉 otimes |tjc〉 if i isin Ijc and j isin S|iprime〉 otimes |viprimeprime〉 if i = (iprime iprimeprime) isin Ijc times Ijcfree

(210)

bull The other input vectors are indexed by Ioplus(jk)b for j isin [n] k isin [mj ] b isin 0 1 For j isin S

Ioplus(j1)b = Ijb with |voplusi 〉 = |vi〉V for i isin Ioplus(j1)b For j isin S let Ioplus(jk)b =⋃cisin01(Ijc times I

jckb) For

i isin Ijc and iprime isin Ijckb let|voplusiiprime〉 = |i〉 otimes |viprime〉 (211)

By [Rei09a Theorem 43] fQoplus = g and wsizes(Qoplus) le wsizer(P ) (While that theorem is statedonly for the case S = [n] it is trivially extended to other S sub [n]) We give a bound on how quicklythe full witness size can grow relative to the witness size

Lemma 26 Under the above conditions for each input x isin 0 1m1timesmiddot middot middottimes0 1mn with y = y(x)

bull If g(x) = 1 let |w〉 be a witness to fP (y) = 1 such thatsum

jisin[n]iisinIjyjrj |wi|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |w〉

)+

1 +sum

iisinIfree|wi|2

wsizer(P y)

where σ(y |w〉) = maxjisinS

existi isin Ijyj with 〈i|w〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(212)

14

bull If g(x) = 0 let |wprime〉 be a witness to fP (y) = 0 such thatsum

jisin[n]iisinIjyjrj |〈wprime|vi〉|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |wprime〉) +|wprime〉2

wsizer(P y)

where σ(y |wprime〉) = maxjisinS

existi isin Ijyj with 〈vi|wprime〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(213)

If S = empty then σ(y |w〉) and σ(y |wprime〉) should each be taken to be 1 in the above equations

Proof We follow the proof of [Rei09a Theorem 43] except keeping track of the full witness sizeNote that if S = empty then Eqs (212) and (213) are immediate by definition of fwsizes(Qoplus x)

Let I(y)prime = I(y) r Ifree =⋃jisin[n] Ijyj

In the first case g(x) = 1 for j isin S let |wjyj 〉 isin CIjyj be a witness to fP jyj (xj) = 1 such that

fwsizes(P jyj xj) = 1 +sum

iisinIjyjfree

|wjyj

i |2

+sum

kisin[mj ]iisinIjyjk(xj)k

(sj)k|wjyj

i |2 As in [Rei09a Theorem 43]

let |woplus〉 isin CIoplus(x) be given by

woplusi =

wi if i isin I(y)

wiprimewς(iprime)iprimeprime if i = (iprime iprimeprime) with iprime isin I(y)prime cap IS iprimeprime isin Iς(iprime)(x)

0 otherwise

(214)

Then |woplus〉 is a witness for fQoplus(x) = 1 and we compute

fwsizes(Qoplus x) le 1 +sumiisinIoplusfree

|woplusi |2 +

sumjisin[n]kisin[mj ]

iisinIoplus(jk)(xj)k

(sj)k|woplusi |2

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 (215)

+sum

jisinSiisinIjyj

|wi|2(

1 +sum

iprimeisinIjyjfree

|wjyj

iprime |2 +

sumkisin[mj ]iprimeisinI

jyjk(xj)k

(sj)k|wjyj

iprime |2

)

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 +sum

jisinSiisinIjyj

|wi|2 fwsizesj (P jyj xj)

Eq (212) follows using the bound fwsizesj (P jyj xj) le σ(y |w〉)rj for j isin S and sj = rj for j isin SNext consider the case g(x) = 0 For j isin S let |ujyj 〉 isin V jyj be a witness for f

P jyj (xj) = 0 withfwsizes(P jyj xj) = |ujyj 〉2 +

sumkisin[mj ]iisinI

jyj

k(xj)k

(sj)k|〈vi|ujyj 〉|2 As in [Rei09a Theorem 43] let

|uoplus〉 = |wprime〉V +sum

iisinISrI(y)

〈vi|wprime〉|i〉 otimes |uς(i)〉 (216)

15

Then |uoplus〉 is a witness for fQoplus(x) = 0 and moreover

fwsizes(Qoplus x) le |uoplus〉2 +sum

jisin[n]kisin[mj ]iisinIoplus(jk)(xj)k

(sj)k|〈voplusi |uoplus〉|2

= |uoplus〉2 +sum

jisin[n]rSiisinIjxj

sj |〈voplusi |uoplus〉|2 +

sumjisinSkisin[mj ]

iisinIjyjiprimeisinI

jyj

k(xj)k

(sj)k|〈voplusiiprime |uoplus〉|2

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

sj |〈vi|wprime〉|2 (217)

+sum

jisinSiisinIjyj

|〈vi|wprime〉|2(|ujyj 〉2 +

sumkisin[mj ]iprimeisinI

jyj

k(xj)k

(sj)k|〈viprime |ujyj 〉|2)

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

rj |〈vi|wprime〉|2 +sum

jisinSiisinIjyj

|〈vi|wprime〉|2 fwsizesj (P jyj xj)

Eq (213) follows using the bound fwsizesj (P jyj xj) le σ(y |wprime〉)rj for j isin S

Lemma 26 is a key step in the formula-evaluation results in this article and [Rei09b] Itis used to track the full witness size for span programs recursively composed in a direct-summanner along a formula The proof of Theorem 19 will require the lemma with the weakerbounds σ(y |w〉) σ(y |wprime〉) le maxjisinScisin01 fwsizesj (P jc)wsizesj (P jc) Theorem 111 will useonly the slightly stronger bounds σ(y |w〉) le maxjisinS fwsizesj (P jyj )wsizesj (P jyj ) σ(y |wprime〉) lemaxjisinS fwsizesj (P jyj )wsizesj (P jyj ) However the proof of [Rei09b Theorem 11] will require thebounds of Eqs (212) and (213)

3 Evaluation of almost-balanced formulas

In this section we will apply the span program framework from [Rei09a] to prove Theorem 19Our algorithm will be given by applying Theorem 24 to a certain span program Before beginningthe proof though we will give two necessary lemmas

Consider a span program P with corresponding weighted graph GP from [Rei09a Def 82]We will need a bound on the operator norm of abs(AGPv

) the entry-wise absolute value of theweighted adjacency matrix AGPv

If P is canonical [Rei09a Def 51] then we can indeed obtainsuch a bound in terms of the witness size of P

Lemma 31 Let s isin (0infin)k and let P be a canonical span program computing a function f 0 1k rarr 0 1 with input vectors indexed by the set I Assume that for each x isin 0 1k withf(x) = 0 an optimal witness to fP (x) = 0 is |x〉 itself Then

abs(AGP) le 2k

(1 +

wsizes(P )minjisin[k] sj

)+ |I| (31)

16

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 2: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

Randomized zero-error Quantum bounded-errorFormula ϕ query complexity R(ϕ) query complexity Q(ϕ)

ORn n Θ(radicn) [Gro96 BBBV97]

Balanced AND2-OR2 Θ(nα) [SW86] Θ(radicn) [FGG07 ACR+07]

Well-balanced AND-OR tight recursion [SW86]Approx-balanced AND-OR Θ(

radicn) [ACR+07] (Thm 111)

Arbitrary AND-OR Ω(n051) [HW91] Ω(radicn)

O(radicn log n)

[BS04][Rei09b]

Balanced MAJ3 (n = 3d) Ω((73)d

) O(2654d) [JKS03] Θ(2d) [RS08]

Balanced over S Θ(Advplusmn(ϕ)) [Rei09a]Almost-balanced over S Θ(Advplusmn(ϕ)) (Thm 19)

Table 1 Comparison of some classical and quantum query complexity results for formula evaluationHere S is any fixed finite gate set and the exponent α is given by α = log2(1+

radic33

4 ) asymp 0753 Undercertain assumptions the algorithmsrsquo running times are only poly-logarithmically slower

query access to the input string x Fix S to be any finite set of gates We give an optimal quantumalgorithm for evaluating ldquoalmost-balancedrdquo formulas over S The balance condition states thatthe complexities of the input subformulas to any gate differ by at most a constant factor wherecomplexity is measured by the general adversary bound Advplusmn In general Advplusmn is the value of anexponentially large semi-definite program (SDP) For a formula ϕ with constant-size gates thoughAdvplusmn(ϕ) can be computed efficiently by solving constant-size SDPs for each gate

To place this work in context some classical and quantum results for evaluating formulas aresummarized in Table 1 The stated upper bounds are on query complexity and not time complexityHowever for the ORn and balanced AND2-OR2 formulas the quantum algorithmsrsquo running timesare only slower by a poly-logarithmic factor For the other formulas the quantum algorithmsrsquorunning times are slower by a poly-logarithmic factor provided that

1 A polynomial-time classical preprocessing step outputting a string s(ϕ) is not charged for

2 The algorithms are allowed unit-cost coherent access to s(ϕ)

Our algorithm is based on the framework relating span programs and quantum algorithmsfrom [Rei09a] Previous work has used span programs to develop quantum algorithms for evaluatingformulas [RS08] Using this and the observation that the optimal span program witness size fora boolean function f equals the general adversary bound Advplusmn(f) Ref [Rei09a] gives an optimalquantum algorithm for evaluating ldquoadversary-balancedrdquo formulas over an arbitrary finite gate setThe balance condition is that each gatersquos input subformulas have equal general adversary bounds

In order to relax this strict balance requirement we must maintain better control in the recursiveanalysis To help do so we define a new span program complexity measure the ldquofull witnesssizerdquo This complexity measure has implications for developing time- and query-efficient quantumalgorithms based on span programs Essentially using a second result from [Rei09a] that propertiesof eigenvalue-zero eigenvectors of certain bipartite graphs imply ldquoeffectiverdquo spectral gaps aroundzero it allows quantum algorithms to be based on span programs with free inputs This can simplifythe implementation of a quantum walk on the corresponding graph

2

Besides allowing a relaxed balance requirement our approach has the additional advantage ofmaking the constants hidden in the big-O notation more explicit The formula-evaluation quantumalgorithms in [RS08 Rei09a] evaluate certain formulas ϕ using O

(Advplusmn(ϕ)

)queries where the

hidden constant depends on the gates in S in a complicated manner It is not known how to upper-bound the hidden constant in terms of say the maximum fan-in k of a gate in S In contrast theapproach we follow here allows bounding this constant by an exponential in k

It is known that the general adversary bound is a nearly tight lower bound on quantum querycomplexity for any boolean function [Rei09a] including in particular boolean formulas Howeverthis comes with no guarantees on time complexity The main contribution of this paper is togive a nearly time-optimal algorithm for formula evaluation The algorithm is also tight for querycomplexity removing the extra logarithmic factor from the bound in [Rei09a]

Additionally we apply the same technique to study AND-OR formulas For this special casespecial properties of span programs for AND and for OR gates allow the almost-balance conditionto be significantly weakened Ambainis et al [ACR+07] have studied this case previously Byapplying the span program framework we identify a slight weakness in their analysis Tighteningthe analysis extends the algorithmrsquos applicability to a broader class of AND-OR formulas

A companion paper [Rei09b] applies the span program framework to the problem of evaluatingarbitrary AND-OR formulas By studying the full witness size for span programs constructedusing a novel composition method it gives an O(

radicn log n)-query quantum algorithm to evaluate a

formula of size n for which the time complexity is poly-logarithmically worse after preprocessingThis nearly matches the Ω(

radicn) lower bound and improves a

radicn2O(

radiclogn)-query quantum algorithm

from [ACR+07] Ref [Rei09b] shares the broader motivation of this paper to study span programproperties and design techniques that lead to time-efficient quantum algorithms

Sections 11 and 12 below give further background on the formula-evaluation problem for clas-sical and quantum algorithms Section 13 precisely states our main theorem the proof of which isgiven in Section 3 after some background on span programs The theorem for approximately bal-anced AND-OR formulas is stated in Section 14 and proved in Section 4 An appendix revisits theproof from [ACR+07] to prove our extension directly without using the span program framework

11 History of the formula-evaluation problem for classical algorithms

For a function f 0 1n rarr 0 1 let D(f) be the least number of input bit queries sufficientto evaluate f on any input with zero error D(f) is known as the deterministic decision-treecomplexity of f or the deterministic query complexity of f Let the randomized decision-treecomplexity of f R(f) le D(f) be the least expected number of queries required to evaluate fwith zero error (ie by a Las Vegas randomized algorithm) Let the Monte Carlo decision-treecomplexity R2(f) = O

(R(f)

) be the least number of queries required to evaluate f with error

probability at most 13 (ie by a Monte Carlo randomized algorithm)Classically formulas over the gate set S = NANDk k isin N have been studied most exten-

sively where NANDk(x1 xk) = 1 minusprodkj=1 xj By De Morganrsquos rules any formula over NAND

gates can also be written as a formula in which the gates at an even distance from the formularsquosroot are AND gates and those an odd distance away are OR gates with some inputs or the outputpossibly complemented Thus formulas over S are also known as AND-OR formulas

For any AND-OR formula ϕ of size n ie on n inputs D(ϕ) = n However randomizationgives a strict advantage R(ϕ) and R2(ϕ) can be strictly smaller Indeed let ϕd be the completebinary AND-OR formula of depth d corresponding to the tree in which each internal vertex has

3

two children and every leaf is at distance d from the root with alternating levels of AND and ORgates Its size is n = 2d Snir [Sni85] has given a randomized algorithm for evaluating ϕd usingin expectation O(nα) queries where α = log2(1+

radic33

4 ) asymp 0753 [SW86] This algorithm known asrandomized alpha-beta pruning evaluates a random subformula recursively and only evaluates thesecond subformula if necessary Saks and Wigderson [SW86] have given a matching lower bound onR(ϕd) which Santha has extended to hold for Monte Carlo algorithms R2(ϕd) = Ω(nα) [San95]

Thus the query complexities have been characterized for the complete binary AND-OR formu-las In fact the tight characterization works for a larger class of formulas called ldquowell balancedrdquoformulas by [San95] This class includes for example alternating AND2-OR2 formulas where forsome d every leaf is at depth d or dminus1 Fibonacci trees and binomial trees [SW86] It also includesskew trees for which the depth is the maximal nminus 1

For arbitrary AND-OR formulas on the other hand little is known It has been conjectured thatcomplete binary AND-OR formulas are the easiest to evaluate and that in particular R(ϕ) = Ω(nα)for any size-n AND-OR formula ϕ [SW86] However the best general lower bound is R(ϕ) =Ω(n051) due to Heiman and Wigderson [HW91] Ref [HW91] also extends the result of [SW86] toallow for AND and OR gates with fan-in more than two

It is perhaps not surprising that formulas over most other gate sets S are even less well under-stood For example Boppana has asked the complexity of evaluating the complete ternary majority(MAJ3) formula of depth d [SW86] and the best published bounds on its query complexity areΩ((73)d

)and O

((26537 )d

)[JKS03] In particular the naıve ldquodirectionalrdquo generalization of

the randomized alpha-beta pruning algorithm is to evaluate recursively two random immediate sub-formulas and if they disagree then also the third This algorithm uses O

((83)d

)expected queries

and is suboptimal This suggests that the complete MAJ3 formulas are significantly different fromthe complete AND-OR formulas

Heiman Newman and Wigderson have considered read-once threshold formulas in an attemptto separate the complexity classes TC0 from NC1 [HNW93] That is they allow the gate set tobe the set of Hamming-weight threshold gates T km m k isin N defined by T km 0 1k rarr 0 1T km(x) = 1 if and only if the Hamming weight of x is at least m AND OR and majority gatesare all special cases of threshold gates Heiman et al prove that R(ϕ) ge n2d for ϕ a thresholdformula of depth d and in fact their proof extends to gate sets in which every gate ldquocontains afliprdquo [HNW93] This implies that a large depth is necessary for the randomized complexity to bemuch lower than the deterministic complexity

Of course there are some trivial gate sets for which the query complexity is fully understood forexample the set of parity gates Overall though there are many more open problems than resultsDespite its structure formula evaluation appears to be combinatorially complicated Howeverthere is another approach to try to leverage the power of quantum computers Surprisingly theformula-evaluation problem simplifies considerably in this different model of computation

12 History of the formula-evaluation problem for quantum algorithms

In the quantum query model the input bits can be queried coherently That is the quantumalgorithm is allowed unit-cost access to the unitary operator Ox called the input oracle defined by

Ox |ϕ〉 otimes |j〉 otimes |b〉 7rarr |ϕ〉 otimes |j〉 otimes |boplus xj〉 (11)

Here |ϕ〉 is an arbitrary pure state |j〉 j = 1 2 n is an orthonormal basis for Cn|b〉 b = 0 1 is an orthonormal basis for C2 and oplus denotes addition mod two Ox can be

4

implemented efficiently on a quantum computer given a classical circuit that computes the func-tion j 7rarr xj [NC00] For a function f 0 1n rarr 0 1 let Q(f) be the number of input queriesrequired to evaluate f with error probability at most 13 It is immediate that Q(f) le R2(f)

Research on the formula-evaluation problem in the quantum model began with the n-bit ORfunction ORn Grover gave a quantum algorithm for evaluating ORn with bounded one-sided errorusing O(

radicn) oracle queries and O(

radicn log log n) time [Gro96 Gro02] In the classical case on the

other hand it is obvious that R2(ORn) R(ORn) and D(ORn) are all Θ(n)Groverrsquos algorithm can be applied recursively to speed up the evaluation of more general AND-

OR formulas Call a formula layered if the gates at the same depth are the same Buhrman Cleveand Wigderson show that a layered depth-d size-n AND-OR formula can be evaluated usingO(radicn logdminus1 n) queries [BCW98] The logarithmic factors come from using repetition at each level

to reduce the error probability from a constant to be polynomially smallHoslashyer Mosca and de Wolf [HMW03] consider the case of a unitary input oracle Ox that maps

Ox |ϕ〉 otimes |j〉 otimes |b〉 otimes |0〉 7rarr |ϕ〉 otimes |j〉 otimes(|boplus xj〉 otimes |ψxjxj 〉+ |boplus xj〉 otimes |ψxjxj 〉

) (12)

where |ψxjxj 〉 |ψxjxj 〉 are pure states with |ψxjxj 〉2 ge 23 Such an oracle can be implemented

when the function j 7rarr xj is computed by a bounded-error randomized subroutine Hoslashyer et alallow access to Ox and Ominus1

x both at unit cost and show that ORn can still be evaluated usingO(radicn) queries This robustness result implies that the log n steps of repetition used by [BCW98]

are not necessary and a depth-d layered AND-OR formula can be computed in O(radicn cdminus1) queries

for some constant c gt 1000 If the depth is constant this gives an O(radicn)-query quantum algorithm

but the result is not useful for the complete binary AND-OR formula for which d = log2 nIn 2007 Farhi Goldstone and Gutmann presented a quantum algorithm for evaluating com-

plete binary AND-OR formulas [FGG07] Their breakthrough algorithm is not based on iteratingGroverrsquos algorithm in any way but instead runs a quantum walkmdashanalogous to a classical ran-dom walkmdashon a graph based on the formula The algorithm runs in time O(

radicn) in a certain

continuous-time query modelAmbainis et al discretized the [FGG07] algorithm by reinterpreting a correspondence between

(discrete-time) random and quantum walks due to Szegedy [Sze04] as a correspondence betweencontinuous-time and discrete-time quantum walks [ACR+07] Applying this correspondence toquantum walks on certain weighted graphs they gave an O(

radicn)-query quantum algorithm for

evaluating ldquoapproximately balancedrdquo AND-OR formulas For example MAJ3(x1 x2 x3) = (x1 andx2) or

((x1 or x2) and x3

) so there is a size-5d AND-OR formula that computes MAJ3

d the completeternary majority formula of depth d Since the formula is approximately balanced Q(MAJ3

d) =O(radic

5d) better than the Ω

((73)d

)classical lower bound

The [ACR+07] algorithm also applies to arbitrary AND-OR formulas If ϕ has size n anddepth d then the algorithm applied directly evaluates ϕ using O(

radicnd) queries1 This can be as

bad as O(n32) if the depth is d = n However Bshouty Cleve and Eberly have given a formularebalancing procedure that takes AND-OR formula ϕ as input and outputs an equivalent AND-ORformula ϕprime with depth dprime = 2O(

radiclogn) and size nprime = n 2O(

radiclogn) [BCE91 BB94] The formula ϕprime

can then be evaluated using O(radicnprime dprime) =

radicn 2O(

radiclogn) queries

Our understanding of lower bounds for the formula-evaluation problem progressed in parallel1Actually [ACR+07 Sec 7] only shows a bound of O(

radicnd32) queries but this can be improved to O(

radicnd)

using the bounds on σplusmn(ϕ) below [ACR+07 Def 1]

5

to this progress on quantum algorithms There are essentially two techniques the polynomial andadversary methods for lower-bounding quantum query complexity

bull The polynomial method introduced in the quantum setting by Beals et al [BBC+01] is basedon the observation that after making q oracle Ox queries the probability of any measurementresult is a polynomial of degree at most 2q in the variables xj

bull Ambainis generalized the classical hybrid argument to consider the systemrsquos entanglementwhen run on a superposition of inputs [Amb02] A number of variants of Ambainisrsquos boundwere soon discovered including weighted versions [HNS02 BS04 Amb06 Zha05] a spectralversion [BSS03] and a version based on Kolmogorov complexity [LM04] These variants canbe asymptotically stronger than Ambainisrsquos original unweighted bound but are equivalent toeach other [SS06] We therefore term it simply ldquothe adversary boundrdquo denoted by Adv

The adversary bound is well-suited for lower-bounding the quantum query complexity for eval-uating formulas For example Barnum and Saks proved that for any size-n AND-OR formula ϕAdv(ϕ) =

radicn implying the lower bound Q(ϕ) = Ω(

radicn) [BS04] Thus the [ACR+07] algorithm is

optimal for approximately balanced AND-OR formulas and is nearly optimal for arbitrary AND-OR formulas This is a considerably more complete solution than is known classically

It is then natural to consider formulas over larger gate sets The adversary bound continues towork well because it transforms nicely under function composition

Theorem 11 (Adversary bound composition [Amb06 LLS06 HLS05]) Let f 0 1k rarr 0 1and let fj 0 1mj rarr 0 1 for j = 1 2 k Define g 0 1m1 times middot middot middot times 0 1mk rarr 0 1 byg(x) = f

(f1(x1) fk(xk)

) Let s = (Adv(f1) Adv(fk)) Then

Adv(g) = Advs(f) (13)

See Definition 21 for the definition of the adversary bound with ldquocostsrdquo Advs The Adv boundequals Advs with uniform unit costs s = ~1 For a function f Adv(f) can be computed using asemi-definite program in time polynomial in the size of f rsquos truth table Therefore Theorem 11gives a polynomial-time procedure for computing the adversary bound for a formula ϕ over anarbitrary finite gate set compute the bounds for subformulas moving from the leaves toward theroot At an internal node f having computed the adversary bounds for the input subformulasf1 fk Eq (13) says that the adversary bound for g the subformula rooted at f equals theadversary bound for the gate f with certain costs Computing this requires 2O(k) time which is aconstant if k = O(1) For example if f is an ORk or ANDk gate then Adv(s1sk)(f) =

radicsumj s

2j

from which follows immediately the [BS04] result Adv(ϕ) =radicn for a size-n AND-OR formula ϕ

A special case of Theorem 11 is when the functions fj all have equal adversary bounds soAdv(g) = Adv(f)Adv(f1) In particular for a function f 0 1k rarr 0 1 and a natural numberd isin N let fd 0 1kd rarr 0 1 denote the complete depth-d formula over f That is f1 = f andfd(x) = f

(fdminus1(x1 xkdminus1) fdminus1(xkdminuskdminus1+1 xkd)

)for d gt 1 Then we obtain

Corollary 12 For any function f 0 1k rarr 0 1

Adv(fd) = Adv(f)d (14)

6

In particular Ambainis defined a boolean function f 0 14 rarr 0 1 that can be representedexactly by a polynomial of degee two but for which Adv(f) = 52 [Amb06] Thus fd can berepresented exactly by a polynomial of degree 2d but by Corollary 12 Adv(fd) = (52)d For thisfunction the adversary bound is strictly stronger than any bound obtainable using the polynomialmethod Many similar examples are given in [HLS06] However for other functions the adversarybound is asymptotically worse than the polynomial method [SS06 AS04 Amb05]

In 2007 though Hoslashyer et al discovered a strict generalization of Adv that also lower-boundsquantum query complexity [HLS07] We call this new bound the general adversary bound or AdvplusmnFor example for Ambainisrsquos four-bit function f Advplusmn(f) ge 251 [HLS06] Like the adversarybound Advplusmns (f) can be computed in time polynomial in the size of f rsquos truth table and alsocomposes nicely

Theorem 13 ([HLS07 Rei09a]) Under the conditions of Theorem 11

Advplusmn(g) = Advplusmns (f) (15)

In particular if Advplusmn(f1) = middot middot middot = Advplusmn(fk) then Advplusmn(g) = Advplusmn(f) Advplusmn(f1)

Define a formula ϕ to be adversary balanced if at each internal node the general adversarybounds of the input subformulas are equal In particular by Theorem 13 this implies that Advplusmn(ϕ)is equal to the product of the general adversary bounds of the gates along any path from the rootto a leaf Complete layered formulas are an example of adversary-balanced formulas

Returning to upper bounds Reichardt and Spalek [RS08] generalized the algorithmic approachstarted by [FGG07] They gave an optimal quantum algorithm for evaluating adversary-balancedformulas over a considerably extended gate set including in particular all functions 0 1k rarr 0 1for k le 3 69 inequivalent four-bit functions and the gates ANDk ORk PARITYk and EQUALkfor k = O(1) For example Q(MAJ3

d) = Θ(2d)The [RS08] result follows from a framework for developing formula-evaluation quantum algo-

rithms based on span programs A span program introduced by Karchmer and Wigderson [KW93]is a certain linear-algebraic way of defining a function which corresponds closely to eigenvalue-zeroeigenvectors of certain bipartite graphs [RS08] derived a quantum algorithm for evaluating certainconcatenated span programs with a query complexity upper-bounded by the span program witnesssize denoted wsize In particular a special case of [RS08 Theorem 47] is

Theorem 14 ([RS08]) Fix a function f 0 1k rarr 0 1 If span program P computes f then

Q(fd) = O(wsize(P )d

) (16)

From Theorem 13 this result is optimal if wsize(P ) = Advplusmn(f) The question thereforebecomes how to find optimal span programs Using an ad hoc search [RS08] found optimal spanprograms for a variety of functions with Advplusmn = Adv Further work automated the search bygiving a semi-definite program (SDP) for the optimal span program witness size for any givenfunction [Rei09a] Remarkably the SDPrsquos value always equals the general adversary bound

Theorem 15 ([Rei09a]) For any function f 0 1n rarr 0 1

infP

wsize(P ) = Advplusmn(f) (17)

where the infimum is over span programs P computing f Moreover this infimum is achieved

7

This result greatly extends the gate set over which the formula-evaluation algorithm of [RS08]works optimally For example combined with Theorem 14 it implies that limdrarrinfinQ(fd)1d =Advplusmn(f) for every boolean function f More generally Theorem 15 allows the [RS08] algorithmto be run on formulas over any finite gate set S A factor is lost that depends on the gates in Sbut it will be a constant for S finite Combining Theorem 15 with [RS08 Theorem 47] gives

Theorem 16 ([Rei09a]) Let S be a finite set of gates Then there exists a quantum algorithm thatevaluates an adversary-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After efficient

classical preprocessing independent of the input x and assuming unit-time coherent access to thepreprocessed classical string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

In the discussion so far we have for simplicity focused on query complexity The query com-plexity is an information-theoretic quantity that does not charge for operations independent of theinput string even though these operations may require many elementary gates to implement Forpractical algorithms it is important to be able to bound the algorithmrsquos running time which countsthe cost of implementing the input-independent operations Theorem 16 puts an optimal boundon the query complexity and also puts a nearly optimal bound on the algorithmrsquos time complexityIn fact all of the query-optimal algorithms so far discussed are also nearly time optimal

In general though an upper bound on the query complexity does not imply an upper boundon the time complexity Ref [Rei09a] also generalized the span program framework of [RS08] toapply to quantum algorithms not based on formulas The main result of [Rei09a] is

Theorem 17 ([Rei09a]) For any function f D rarr 1 2 m with D sube 0 1n Q(f) satisfies

Q(f) = Ω(Advplusmn(f)) and Q(f) = O

(Advplusmn(f)

log Advplusmn(f)log log Advplusmn(f)

log(m) log logm) (18)

Theorem 17 in particular allows us to compute the query complexity of formulas up to thelogarithmic factor It does not give any guarantees on running time However the analysis requiredto prove Theorem 17 also leads to significantly simpler proofs of Theorem 16 and the AND-ORformula results of [ACR+07 FGG07] Moreover we will see that it allows the formula-evaluationalgorithms to be extended to formulas that are not adversary balanced

13 Quantum algorithm for evaluating almost-balanced formulas

We give a formula-evaluation algorithm that is both query-optimal without a logarithmic overheadand after an efficient preprocessing step nearly time optimal Define almost balance as follows

Definition 18 Consider a formula ϕ over a gate set S For a vertex v in the correspondingtree let ϕv denote the subformula of ϕ rooted at v and if v is an internal vertex let gv be thecorresponding gate The formula ϕ is β-balanced if for every vertex v with children c1 c2 ck

maxj Advplusmn(ϕcj )minj Advplusmn(ϕcj )

le β (19)

(If cj is a leaf Advplusmn(ϕcj ) = 1) Formula ϕ is almost balanced if it is β-balanced for some β = O(1)

In particular an adversary-balanced formula is 1-balanced We will show

8

Theorem 19 Let S be a fixed finite set of gates Then there exists a quantum algorithm thatevaluates an almost-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After polynomial-

time classical preprocessing independent of the input and assuming unit-time coherent access tothe preprocessed string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

Theorem 19 is significantly stronger than Theorem 16 which requires exact balance Thereare important classes of exactly balanced formulas such as complete layered formulas In fact it issufficient that the multiset of gates along the simple path from the root to a leaf not depend on theleaf Moreover sometimes different gates have the same Advplusmn bound see [HLS06] for examplesEven still exact adversary balance is a very strict condition

The proof of Theorem 19 is based on the span program framework developed in Ref [Rei09a]In particular [Rei09a Theorem 91] gives two quantum algorithms for evaluating span programsThe first algorithm is based on a discrete-time simulation of a continuous-time quantum walkIt applies to arbitrary span programs and is used in combination with Theorem 15 to proveTheorem 17 However the simulation incurs a logarithmic query overhead and potentially worsetime complexity overhead so this algorithm is not suitable for proving Theorem 19

The second algorithm in [Rei09a] is based directly on a discrete-time quantum walk similarto previous optimal formula-evaluation algorithms [ACR+07 RS08] However this algorithm doesnot apply to an arbitrary span program A bound is needed on the operator norm of the entry-wiseabsolute value of the weighted adjacency matrix for a corresponding graph Further graph sparsityconditions are needed for the algorithm to be time efficient (see Theorem 24)

Unfortunately the span program from Theorem 15 will not generally satisfy these conditionsTheorem 15 gives a canonical span program ([Rei09a Def 51]) Even for a simple formula theoptimal canonical span program will typically correspond to a dense graph with large norm

An example should clarify the problem Consider the AND-OR formula ψ(x) =([(x1 and x2) or

x3] and x4

)or(x5 and [x6 or x7]

) and consider the two graphs in Figure 1 For an input x isin 0 17

modify the graphs by attaching dangling edges to every vertex j for which xj = 0 Observe thenthat each graph has an eigenvalue-zero eigenvector supported on vertex 0mdashcalled a witnessmdashif andonly if ψ(x) = 1 The graphs correspond to different span programs computing ψ and the quantumalgorithm works essentially by running a quantum walk starting at vertex 0 in order to detect thewitness The graph on the left is a significantly simplified version of a canonical span program forψ and its density still makes it difficult to implement the quantum walk

We will be guided by the second simpler graph Instead of applying Theorem 15 to ϕ as awhole we apply it separately to every gate in the formula We then compose these span programsone per gate according to the formula using direct-sum composition (Definition 25) In terms ofgraphs direct-sum composition attaches the output vertex of one span programrsquos graph to an inputvertex of the next [RS08] This leads to a graph whose structure somewhat follows the structure ofthe formula ϕ as the graph in Figure 1(b) follows the structure of ψ (However the general casewill be more complicated than shown as we are plugging together constant-size graph gadgets andthere may be duplication of some subgraphs)

Direct-sum composition keeps the maximum degree and norm of the graph under controlmdasheachis at most twice its value for the worst single gate Therefore the second [Rei09a] algorithm appliesHowever direct-sum composition also leads to additional overhead In particular a witness in thefirst graph will be supported only on numbered vertices (note that the graph is bipartite) whereasa witness in the second graph will be supported on some of the internal vertices as well This meansroughly that the second witness will be harder to detect because after normalization its overlap on

9

0

1

2

3

4

5

6

7

(a)

3

6

7

0

1

2

4

5

(b)

Figure 1 Graphs corresponding to two span programs both computing the same function

vertex 0 will be smaller Scale both witnesses so that the amplitude on vertex 0 is one The witnesssize (wsize) measures the squared length of the witness only on numbered vertices whereas the fullwitness size (fwsize) measures the squared length on all vertices For [Rei09a] it was sufficient toconsider only span program witness size because for canonical span programs like in Figure 1(a)the two measures are equal (For technical reasons we will actually define fwsize to be 1 + wsizeeven in this case) For our analysis we will need to bound the full witness size in terms of thewitness size We maintain this bound in a recursion from the formularsquos leaves toward its root

A span program is called strict if every vertex on one half of the bipartite graph is either aninput vertex (vertices 1ndash7 in the graphs of Figure 1) or the output vertex (vertex 0) Thus the firstgraph in the example above corresponds to a strict span program and the second does not Theoriginal definition of span programs in [KW93] allowed for only strict span programs This wassensible because any other vertices on the inputoutput part of the graphrsquos bipartition can alwaysbe projected away yielding a strict span program that computes the same function For developingtime-efficient quantum algorithms though it seems important to consider span programs that arenot strict Unfortunately going backwards eg from 1(a) to 1(b) is probably difficult in general

Theorem 19 does not follow from the formula-evaluation techniques of [RS08] together withTheorem 14 from [Rei09a] This tempting approach falls into intractable technical difficulties Inparticular the same span program can be used at two vertices v and w in ϕ only if gv = gw andthe general adversary bounds of vrsquos input subformulas are the same as those for wrsquos inputs upto simultaneous scaling In general then an almost-balanced formula will require an unboundednumber of different span programs However the analysis in [RS08] loses a factor that dependsbadly on the individual span programs Since the dependence is not continuous even showingthat the span programs in use all lie within a compact set would not be sufficient to obtain anO(1) upper bound In contrast the approach we follow here allows bounding the lost factor by anexponential in k uniformly over different gate imbalances

10

14 Quantum algorithm to evaluate approximately balanced AND-OR formulas

Ambainis et al [ACR+07] use a weaker balance criterion for AND-OR formulas than Definition 18They define an AND-OR formula to be approximately balanced if σminus(ϕ) = O(1) and σ+(ϕ) = O(n)Here n is the size of the formula ie the number of leaves and σminus(ϕ) and σ+(ϕ) are defined by

Definition 110 For each vertex v in a formula ϕ let

σminus(v) = maxξ

sumwisinξ

1Advplusmn(ϕw)

σ+(v) = maxξ

sumwisinξ

Advplusmn(ϕw)2 (110)

with each maximum taken over all simple paths ξ from v to a leaf Let σplusmn(ϕ) = σplusmn(r) where r isthe root of ϕ

Recall that Advplusmn(ϕ) = Adv(ϕ) =radicn for an AND-OR formula Definition 18 is a stricter

balance criterion because β-balance of a formula ϕ implies (by Lemma 32) that σminus(ϕ) and σ+(ϕ) areboth dominated by geometric series However the same steps followed by the proof of Theorem 19still suffice for proving the [ACR+07] result and in fact for strengthening it We show

Theorem 111 Let ϕ be an AND-OR formula of size n Then after polynomial-time classicalpreprocessing that does not depend on the input x ϕ(x) can be evaluated by a quantum algo-rithm with error at most 13 using O

(radicnσminus(ϕ)

)input queries The algorithmrsquos running time isradic

nσminus(ϕ)(log n)O(1) assuming unit-cost coherent access to the preprocessed string

For the special case of AND-OR formulas with σminus(ϕ) = O(1) Theorem 111 strengthens The-orem 19 The requirement that σminus(ϕ) = O(1) allows for some gates in the formula to be veryunbalanced Theorem 111 also strengthens [ACR+07 Theorem 1] because it does not require thatσ+(ϕ) = O(n) For example a formula that is biased near the root but balanced at greater depthscan have σminus(ϕ) = O(1) and σ+(ϕ) = ω(n) By substituting the bound σminus(ϕ) = O(

radicd) for a depth-

d formula [ACR+07 Def 3] a corollary of Theorem 111 is that a depth-d size-n AND-OR formulacan be evaluated using O(

radicnd) queries This improves the depth-dependence from [ACR+07] and

matches the dependence from an earlier version of that article [Amb07]The essential reason that the Definition 18 balance condition can be weakened is that for the

specific gates AND and OR by writing out the optimal span programs explicitly we can prove thatthey satisfy stronger properties than are necessarily true for other functions

2 Span programs

21 Definitions

We briefly recall some definitions from [Rei09a Sec 2] Additionally we define a span programcomplexity measure the full witness size that charges even for the ldquofreerdquo inputs This quantity isimportant for developing quantum algorithms that are time efficient as well as query efficient

For a natural number n let [n] = 1 2 n For a finite set X let CX be the inner productspace C|X| with orthonormal basis |x〉 x isin X For vector spaces V and W over C let L(VW )be the set of linear transformations from V into W and let L(V ) = L(V V ) For A isin L(VW )A is the operator norm of A For a string x isin 0 1n let x denote its bitwise complement

11

Definition 21 ([HLS05 HLS07]) For finite sets C E and D sube Cn let f D rarr E An adversarymatrix for f is a real symmetric matrix Γ isin L(CD) that satisfies 〈x|Γ|y〉 = 0 whenever f(x) = f(y)

The general adversary bound for f with costs s isin [0infin)n is

Advplusmns (f) = maxadversary matrices Γforalljisin[n] Γ∆jlesj

Γ (21)

Here Γ ∆j denotes the entry-wise matrix product between Γ and ∆j =sum

xyxj 6=yj|x〉〈y| The

(nonnegative-weight) adversary bound for f with costs s is defined by the same maximizationexcept with Γ restricted to have nonnegative entries In particular Advplusmns (f) ge Advs(f)

Letting ~1 = (1 1 1) the adversary bound for f is Adv(f) = Adv~1(f) and the generaladversary bound for f is Advplusmn(f) = Advplusmn~1 (f) By [HLS07] Q(f) = Ω(Advplusmn(f))

Definition 22 (Span program [KW93]) A span program P consists of a natural number n afinite-dimensional inner product space V over C a ldquotargetrdquo vector |t〉 isin V disjoint sets Ifree andIjb for j isin [n] b isin 0 1 and ldquoinput vectorsrdquo |vi〉 isin V for i isin Ifree cup

⋃jisin[n]bisin01 Ijb

To P corresponds a function fP 0 1n rarr 0 1 defined on x isin 0 1n by

fP (x) =

1 if |t〉 isin Span(|vi〉 i isin Ifree cup

⋃jisin[n] Ijxj)

0 otherwise(22)

Some additional notation is convenient Fix a span program P Let I = Ifreecup⋃jisin[n]bisin01 Ijb

Let A isin L(CI V ) be given by A =sum

iisinI |vi〉〈i| For x isin 0 1n let I(x) = Ifree cup⋃jisin[n] Ijxj and

Π(x) =sum

iisinI(x) |i〉〈i| isin L(CI) Then fP (x) = 1 if |t〉 isin Range(AΠ(x)) A vector |w〉 isin CI is saidto be a witness for fP (x) = 1 if Π(x)|w〉 = |w〉 and A|w〉 = |t〉 A vector |wprime〉 isin V is said to be awitness for fP (x) = 0 if 〈t|wprime〉 = 1 and Π(x)Adagger|wprime〉 = 0

Definition 23 (Witness size) Consider a span program P and a vector s isin [0infin)n of nonnegativeldquocostsrdquo Let S =

sumjisin[n]bisin01iisinIjb

radicsj |i〉〈i| isin L(CI) For each input x isin 0 1n define the witness

size of P on x with costs s wsizes(P x) as follows

wsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉 S|w〉2 if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

SAdagger|wprime〉2 if fP (x) = 0 (23)

The witness size of P with costs s is

wsizes(P ) = maxxisin01n

wsizes(P x) (24)

Define the full witness size fwsizes(P ) by letting Sf = S +sum

iisinIfree|i〉〈i| and

fwsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉(1 + Sf |w〉2) if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

(|wprime〉2 + SAdagger|wprime〉2) if fP (x) = 0 (25)

fwsizes(P ) = maxxisin01n

fwsizes(P x) (26)

When the subscript s is omitted the costs are taken to be uniform s = ~1 = (1 1 1) egfwsize(P ) = fwsize~1(P ) The witness size is defined in [RS08] The full witness size is definedin [Rei09a Sec 8] but is not named there A strict span program has Ifree = empty so Sf = S and amonotone span program has Ij0 = empty for all j [Rei09a Def 49]

12

22 Quantum algorithm to evaluate a span program based on its full witness size

[Rei09a Theorem 93] gives a quantum query algorithm for evaluating span programs based on thefull witness size The algorithm is based on a quantum walk on a certain graph Provided that thedegree of the graph is not too large it can actually be implemented efficiently

Theorem 24 ([Rei09a Theorem 93]) Let P be a span program Then fP can be evaluated using

T = O(fwsize(P ) abs(AGP

))

(27)

quantum queries with error probability at most 13 Moreover if the maximum degree of a vertexin GP is d then the time complexity of the algorithm for evaluating fP is at most a factor of(log d)

(log(T log d)

)O(1) worse after classical preprocessing and assuming constant-time coherentaccess to the preprocessed string

Proof sketch The query complexity claim is actually slightly weaker than [Rei09a Theorem 93]which allows the target vector to be scaled downward by a factor of

radicfwsize(P )

The time-complexity claim will follow from the proof of [Rei09a Theorem 93] in [Rei09aProp 94 Theorem 95] The algorithm for evaluating fP (x) uses a discrete-time quantum walkon the graph GP (x) If the maximum degree of a vertex in GP is d then each coin reflec-tion can be implemented using O(log d) single-qubit unitaries and queries to the preprocessedstring [GR02 CNW09] Finally the

(log(T log d)

)O(1) factor comes from applying the Solovay-Kitaev Theorem [KSV02] to compile the single-qubit unitaries into products of elementary gatesto precision 1O(T log d)

We remark that together with [Rei09a Theorem 31] Theorem 24 gives a way of transforming aone-sided-error quantum algorithm into a span program and back into a quantum algorithm suchthat the time complexity is nearly preserved after preprocessing This is only a weak equivalencebecause aside from requiring preprocessing the algorithm from Theorem 24 also has two-sided errorTo some degree though it complements the equivalence results for best span program witness sizeand bounded-error quantum query complexity [Rei09a Theorem 71 Theorem 92]

23 Direct-sum span program composition

Let us study the full witness size of the direct-sum composition of span programs We begin byrecalling the definition of direct-sum composition

Let f 0 1n rarr 0 1 and S sube [n] For j isin [n] let mj be a natural number with mj = 1 forj isin S For j isin S let fj 0 1mj rarr 0 1 Define y 0 1m1 times middot middot middot times 0 1mn rarr 0 1n by

y(x)j =

fj(xj) if j isin Sxj if j isin S

(28)

Define g 0 1m1 times middot middot middottimes 0 1mn rarr 0 1 by g(x) = f(y(x)) For example if S = [n] r 1 then

g(x) = f(x1 f2(x2) fn(xn)

) (29)

Given span programs for the individual functions f and fj for j isin S we will construct a spanprogram for g We remark that although we are here requiring that the inner functions fj act on

13

disjoint sets of bits this assumption is not necessary for the definition It simplifies the notationthough for the cases S 6= [n] and will suffice for our applications

Let P be a span program computing fP = f Let P have inner product space V target vector|t〉 and input vectors |vi〉 indexed by Ifree and Ijc for j isin [n] and c isin 0 1

For j isin [n] let sj isin [0infin)mj be a vector of costs and let s isin [0infin)Pmj be the concatenation of

the vectors sj For j isin S let P j0 and P j1 be span programs computing fP j1 = fj 0 1mj rarr 0 1and fP j0 = notfj with rj = wsizesj (P j0) = wsizesj (P j1) For c isin 0 1 let P jc have inner productspace V jc with target vector |tjc〉 and input vectors indexed by Ijcfree and Ijckb for k isin [mj ] b isin 0 1For j isin S let rj = sj

Let IS =⋃jisinScisin01 Ijc Define ς IS rarr [n]times 0 1 by ς(i) = (j c) if i isin Ijc The idea is that

ς maps i to the input span program that must evaluate to 1 in order for |vi〉 to be available in P There are several ways of composing the span programs P and P jc to obtain a span program Q

computing the composed function fQ = g with wsizes(Q) le wsizer(P ) [Rei09a Defs 44 45 46]We focus on direct-sum composition

Definition 25 ([Rei09a Def 45]) The direct-sum-composed span program Qoplus is defined by

bull The inner product space is V oplus = V oplusoplus

jisinScisin01(CIjc otimes V jc) Any vector in V oplus can be

uniquely expressed as |u〉V +sum

iisinIS |i〉 otimes |ui〉 where |u〉 isin V and |ui〉 isin V ς(i)

bull The target vector is |toplus〉 = |t〉V

bull The free input vectors are indexed by Ioplusfree = Ifree cup IS cup⋃jisinScisin01(Ijc times Ijcfree) with for

i isin Ioplusfree

|voplusi 〉 =

|vi〉V if i isin Ifree

|vi〉V minus |i〉 otimes |tjc〉 if i isin Ijc and j isin S|iprime〉 otimes |viprimeprime〉 if i = (iprime iprimeprime) isin Ijc times Ijcfree

(210)

bull The other input vectors are indexed by Ioplus(jk)b for j isin [n] k isin [mj ] b isin 0 1 For j isin S

Ioplus(j1)b = Ijb with |voplusi 〉 = |vi〉V for i isin Ioplus(j1)b For j isin S let Ioplus(jk)b =⋃cisin01(Ijc times I

jckb) For

i isin Ijc and iprime isin Ijckb let|voplusiiprime〉 = |i〉 otimes |viprime〉 (211)

By [Rei09a Theorem 43] fQoplus = g and wsizes(Qoplus) le wsizer(P ) (While that theorem is statedonly for the case S = [n] it is trivially extended to other S sub [n]) We give a bound on how quicklythe full witness size can grow relative to the witness size

Lemma 26 Under the above conditions for each input x isin 0 1m1timesmiddot middot middottimes0 1mn with y = y(x)

bull If g(x) = 1 let |w〉 be a witness to fP (y) = 1 such thatsum

jisin[n]iisinIjyjrj |wi|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |w〉

)+

1 +sum

iisinIfree|wi|2

wsizer(P y)

where σ(y |w〉) = maxjisinS

existi isin Ijyj with 〈i|w〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(212)

14

bull If g(x) = 0 let |wprime〉 be a witness to fP (y) = 0 such thatsum

jisin[n]iisinIjyjrj |〈wprime|vi〉|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |wprime〉) +|wprime〉2

wsizer(P y)

where σ(y |wprime〉) = maxjisinS

existi isin Ijyj with 〈vi|wprime〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(213)

If S = empty then σ(y |w〉) and σ(y |wprime〉) should each be taken to be 1 in the above equations

Proof We follow the proof of [Rei09a Theorem 43] except keeping track of the full witness sizeNote that if S = empty then Eqs (212) and (213) are immediate by definition of fwsizes(Qoplus x)

Let I(y)prime = I(y) r Ifree =⋃jisin[n] Ijyj

In the first case g(x) = 1 for j isin S let |wjyj 〉 isin CIjyj be a witness to fP jyj (xj) = 1 such that

fwsizes(P jyj xj) = 1 +sum

iisinIjyjfree

|wjyj

i |2

+sum

kisin[mj ]iisinIjyjk(xj)k

(sj)k|wjyj

i |2 As in [Rei09a Theorem 43]

let |woplus〉 isin CIoplus(x) be given by

woplusi =

wi if i isin I(y)

wiprimewς(iprime)iprimeprime if i = (iprime iprimeprime) with iprime isin I(y)prime cap IS iprimeprime isin Iς(iprime)(x)

0 otherwise

(214)

Then |woplus〉 is a witness for fQoplus(x) = 1 and we compute

fwsizes(Qoplus x) le 1 +sumiisinIoplusfree

|woplusi |2 +

sumjisin[n]kisin[mj ]

iisinIoplus(jk)(xj)k

(sj)k|woplusi |2

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 (215)

+sum

jisinSiisinIjyj

|wi|2(

1 +sum

iprimeisinIjyjfree

|wjyj

iprime |2 +

sumkisin[mj ]iprimeisinI

jyjk(xj)k

(sj)k|wjyj

iprime |2

)

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 +sum

jisinSiisinIjyj

|wi|2 fwsizesj (P jyj xj)

Eq (212) follows using the bound fwsizesj (P jyj xj) le σ(y |w〉)rj for j isin S and sj = rj for j isin SNext consider the case g(x) = 0 For j isin S let |ujyj 〉 isin V jyj be a witness for f

P jyj (xj) = 0 withfwsizes(P jyj xj) = |ujyj 〉2 +

sumkisin[mj ]iisinI

jyj

k(xj)k

(sj)k|〈vi|ujyj 〉|2 As in [Rei09a Theorem 43] let

|uoplus〉 = |wprime〉V +sum

iisinISrI(y)

〈vi|wprime〉|i〉 otimes |uς(i)〉 (216)

15

Then |uoplus〉 is a witness for fQoplus(x) = 0 and moreover

fwsizes(Qoplus x) le |uoplus〉2 +sum

jisin[n]kisin[mj ]iisinIoplus(jk)(xj)k

(sj)k|〈voplusi |uoplus〉|2

= |uoplus〉2 +sum

jisin[n]rSiisinIjxj

sj |〈voplusi |uoplus〉|2 +

sumjisinSkisin[mj ]

iisinIjyjiprimeisinI

jyj

k(xj)k

(sj)k|〈voplusiiprime |uoplus〉|2

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

sj |〈vi|wprime〉|2 (217)

+sum

jisinSiisinIjyj

|〈vi|wprime〉|2(|ujyj 〉2 +

sumkisin[mj ]iprimeisinI

jyj

k(xj)k

(sj)k|〈viprime |ujyj 〉|2)

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

rj |〈vi|wprime〉|2 +sum

jisinSiisinIjyj

|〈vi|wprime〉|2 fwsizesj (P jyj xj)

Eq (213) follows using the bound fwsizesj (P jyj xj) le σ(y |wprime〉)rj for j isin S

Lemma 26 is a key step in the formula-evaluation results in this article and [Rei09b] Itis used to track the full witness size for span programs recursively composed in a direct-summanner along a formula The proof of Theorem 19 will require the lemma with the weakerbounds σ(y |w〉) σ(y |wprime〉) le maxjisinScisin01 fwsizesj (P jc)wsizesj (P jc) Theorem 111 will useonly the slightly stronger bounds σ(y |w〉) le maxjisinS fwsizesj (P jyj )wsizesj (P jyj ) σ(y |wprime〉) lemaxjisinS fwsizesj (P jyj )wsizesj (P jyj ) However the proof of [Rei09b Theorem 11] will require thebounds of Eqs (212) and (213)

3 Evaluation of almost-balanced formulas

In this section we will apply the span program framework from [Rei09a] to prove Theorem 19Our algorithm will be given by applying Theorem 24 to a certain span program Before beginningthe proof though we will give two necessary lemmas

Consider a span program P with corresponding weighted graph GP from [Rei09a Def 82]We will need a bound on the operator norm of abs(AGPv

) the entry-wise absolute value of theweighted adjacency matrix AGPv

If P is canonical [Rei09a Def 51] then we can indeed obtainsuch a bound in terms of the witness size of P

Lemma 31 Let s isin (0infin)k and let P be a canonical span program computing a function f 0 1k rarr 0 1 with input vectors indexed by the set I Assume that for each x isin 0 1k withf(x) = 0 an optimal witness to fP (x) = 0 is |x〉 itself Then

abs(AGP) le 2k

(1 +

wsizes(P )minjisin[k] sj

)+ |I| (31)

16

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 3: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

Besides allowing a relaxed balance requirement our approach has the additional advantage ofmaking the constants hidden in the big-O notation more explicit The formula-evaluation quantumalgorithms in [RS08 Rei09a] evaluate certain formulas ϕ using O

(Advplusmn(ϕ)

)queries where the

hidden constant depends on the gates in S in a complicated manner It is not known how to upper-bound the hidden constant in terms of say the maximum fan-in k of a gate in S In contrast theapproach we follow here allows bounding this constant by an exponential in k

It is known that the general adversary bound is a nearly tight lower bound on quantum querycomplexity for any boolean function [Rei09a] including in particular boolean formulas Howeverthis comes with no guarantees on time complexity The main contribution of this paper is togive a nearly time-optimal algorithm for formula evaluation The algorithm is also tight for querycomplexity removing the extra logarithmic factor from the bound in [Rei09a]

Additionally we apply the same technique to study AND-OR formulas For this special casespecial properties of span programs for AND and for OR gates allow the almost-balance conditionto be significantly weakened Ambainis et al [ACR+07] have studied this case previously Byapplying the span program framework we identify a slight weakness in their analysis Tighteningthe analysis extends the algorithmrsquos applicability to a broader class of AND-OR formulas

A companion paper [Rei09b] applies the span program framework to the problem of evaluatingarbitrary AND-OR formulas By studying the full witness size for span programs constructedusing a novel composition method it gives an O(

radicn log n)-query quantum algorithm to evaluate a

formula of size n for which the time complexity is poly-logarithmically worse after preprocessingThis nearly matches the Ω(

radicn) lower bound and improves a

radicn2O(

radiclogn)-query quantum algorithm

from [ACR+07] Ref [Rei09b] shares the broader motivation of this paper to study span programproperties and design techniques that lead to time-efficient quantum algorithms

Sections 11 and 12 below give further background on the formula-evaluation problem for clas-sical and quantum algorithms Section 13 precisely states our main theorem the proof of which isgiven in Section 3 after some background on span programs The theorem for approximately bal-anced AND-OR formulas is stated in Section 14 and proved in Section 4 An appendix revisits theproof from [ACR+07] to prove our extension directly without using the span program framework

11 History of the formula-evaluation problem for classical algorithms

For a function f 0 1n rarr 0 1 let D(f) be the least number of input bit queries sufficientto evaluate f on any input with zero error D(f) is known as the deterministic decision-treecomplexity of f or the deterministic query complexity of f Let the randomized decision-treecomplexity of f R(f) le D(f) be the least expected number of queries required to evaluate fwith zero error (ie by a Las Vegas randomized algorithm) Let the Monte Carlo decision-treecomplexity R2(f) = O

(R(f)

) be the least number of queries required to evaluate f with error

probability at most 13 (ie by a Monte Carlo randomized algorithm)Classically formulas over the gate set S = NANDk k isin N have been studied most exten-

sively where NANDk(x1 xk) = 1 minusprodkj=1 xj By De Morganrsquos rules any formula over NAND

gates can also be written as a formula in which the gates at an even distance from the formularsquosroot are AND gates and those an odd distance away are OR gates with some inputs or the outputpossibly complemented Thus formulas over S are also known as AND-OR formulas

For any AND-OR formula ϕ of size n ie on n inputs D(ϕ) = n However randomizationgives a strict advantage R(ϕ) and R2(ϕ) can be strictly smaller Indeed let ϕd be the completebinary AND-OR formula of depth d corresponding to the tree in which each internal vertex has

3

two children and every leaf is at distance d from the root with alternating levels of AND and ORgates Its size is n = 2d Snir [Sni85] has given a randomized algorithm for evaluating ϕd usingin expectation O(nα) queries where α = log2(1+

radic33

4 ) asymp 0753 [SW86] This algorithm known asrandomized alpha-beta pruning evaluates a random subformula recursively and only evaluates thesecond subformula if necessary Saks and Wigderson [SW86] have given a matching lower bound onR(ϕd) which Santha has extended to hold for Monte Carlo algorithms R2(ϕd) = Ω(nα) [San95]

Thus the query complexities have been characterized for the complete binary AND-OR formu-las In fact the tight characterization works for a larger class of formulas called ldquowell balancedrdquoformulas by [San95] This class includes for example alternating AND2-OR2 formulas where forsome d every leaf is at depth d or dminus1 Fibonacci trees and binomial trees [SW86] It also includesskew trees for which the depth is the maximal nminus 1

For arbitrary AND-OR formulas on the other hand little is known It has been conjectured thatcomplete binary AND-OR formulas are the easiest to evaluate and that in particular R(ϕ) = Ω(nα)for any size-n AND-OR formula ϕ [SW86] However the best general lower bound is R(ϕ) =Ω(n051) due to Heiman and Wigderson [HW91] Ref [HW91] also extends the result of [SW86] toallow for AND and OR gates with fan-in more than two

It is perhaps not surprising that formulas over most other gate sets S are even less well under-stood For example Boppana has asked the complexity of evaluating the complete ternary majority(MAJ3) formula of depth d [SW86] and the best published bounds on its query complexity areΩ((73)d

)and O

((26537 )d

)[JKS03] In particular the naıve ldquodirectionalrdquo generalization of

the randomized alpha-beta pruning algorithm is to evaluate recursively two random immediate sub-formulas and if they disagree then also the third This algorithm uses O

((83)d

)expected queries

and is suboptimal This suggests that the complete MAJ3 formulas are significantly different fromthe complete AND-OR formulas

Heiman Newman and Wigderson have considered read-once threshold formulas in an attemptto separate the complexity classes TC0 from NC1 [HNW93] That is they allow the gate set tobe the set of Hamming-weight threshold gates T km m k isin N defined by T km 0 1k rarr 0 1T km(x) = 1 if and only if the Hamming weight of x is at least m AND OR and majority gatesare all special cases of threshold gates Heiman et al prove that R(ϕ) ge n2d for ϕ a thresholdformula of depth d and in fact their proof extends to gate sets in which every gate ldquocontains afliprdquo [HNW93] This implies that a large depth is necessary for the randomized complexity to bemuch lower than the deterministic complexity

Of course there are some trivial gate sets for which the query complexity is fully understood forexample the set of parity gates Overall though there are many more open problems than resultsDespite its structure formula evaluation appears to be combinatorially complicated Howeverthere is another approach to try to leverage the power of quantum computers Surprisingly theformula-evaluation problem simplifies considerably in this different model of computation

12 History of the formula-evaluation problem for quantum algorithms

In the quantum query model the input bits can be queried coherently That is the quantumalgorithm is allowed unit-cost access to the unitary operator Ox called the input oracle defined by

Ox |ϕ〉 otimes |j〉 otimes |b〉 7rarr |ϕ〉 otimes |j〉 otimes |boplus xj〉 (11)

Here |ϕ〉 is an arbitrary pure state |j〉 j = 1 2 n is an orthonormal basis for Cn|b〉 b = 0 1 is an orthonormal basis for C2 and oplus denotes addition mod two Ox can be

4

implemented efficiently on a quantum computer given a classical circuit that computes the func-tion j 7rarr xj [NC00] For a function f 0 1n rarr 0 1 let Q(f) be the number of input queriesrequired to evaluate f with error probability at most 13 It is immediate that Q(f) le R2(f)

Research on the formula-evaluation problem in the quantum model began with the n-bit ORfunction ORn Grover gave a quantum algorithm for evaluating ORn with bounded one-sided errorusing O(

radicn) oracle queries and O(

radicn log log n) time [Gro96 Gro02] In the classical case on the

other hand it is obvious that R2(ORn) R(ORn) and D(ORn) are all Θ(n)Groverrsquos algorithm can be applied recursively to speed up the evaluation of more general AND-

OR formulas Call a formula layered if the gates at the same depth are the same Buhrman Cleveand Wigderson show that a layered depth-d size-n AND-OR formula can be evaluated usingO(radicn logdminus1 n) queries [BCW98] The logarithmic factors come from using repetition at each level

to reduce the error probability from a constant to be polynomially smallHoslashyer Mosca and de Wolf [HMW03] consider the case of a unitary input oracle Ox that maps

Ox |ϕ〉 otimes |j〉 otimes |b〉 otimes |0〉 7rarr |ϕ〉 otimes |j〉 otimes(|boplus xj〉 otimes |ψxjxj 〉+ |boplus xj〉 otimes |ψxjxj 〉

) (12)

where |ψxjxj 〉 |ψxjxj 〉 are pure states with |ψxjxj 〉2 ge 23 Such an oracle can be implemented

when the function j 7rarr xj is computed by a bounded-error randomized subroutine Hoslashyer et alallow access to Ox and Ominus1

x both at unit cost and show that ORn can still be evaluated usingO(radicn) queries This robustness result implies that the log n steps of repetition used by [BCW98]

are not necessary and a depth-d layered AND-OR formula can be computed in O(radicn cdminus1) queries

for some constant c gt 1000 If the depth is constant this gives an O(radicn)-query quantum algorithm

but the result is not useful for the complete binary AND-OR formula for which d = log2 nIn 2007 Farhi Goldstone and Gutmann presented a quantum algorithm for evaluating com-

plete binary AND-OR formulas [FGG07] Their breakthrough algorithm is not based on iteratingGroverrsquos algorithm in any way but instead runs a quantum walkmdashanalogous to a classical ran-dom walkmdashon a graph based on the formula The algorithm runs in time O(

radicn) in a certain

continuous-time query modelAmbainis et al discretized the [FGG07] algorithm by reinterpreting a correspondence between

(discrete-time) random and quantum walks due to Szegedy [Sze04] as a correspondence betweencontinuous-time and discrete-time quantum walks [ACR+07] Applying this correspondence toquantum walks on certain weighted graphs they gave an O(

radicn)-query quantum algorithm for

evaluating ldquoapproximately balancedrdquo AND-OR formulas For example MAJ3(x1 x2 x3) = (x1 andx2) or

((x1 or x2) and x3

) so there is a size-5d AND-OR formula that computes MAJ3

d the completeternary majority formula of depth d Since the formula is approximately balanced Q(MAJ3

d) =O(radic

5d) better than the Ω

((73)d

)classical lower bound

The [ACR+07] algorithm also applies to arbitrary AND-OR formulas If ϕ has size n anddepth d then the algorithm applied directly evaluates ϕ using O(

radicnd) queries1 This can be as

bad as O(n32) if the depth is d = n However Bshouty Cleve and Eberly have given a formularebalancing procedure that takes AND-OR formula ϕ as input and outputs an equivalent AND-ORformula ϕprime with depth dprime = 2O(

radiclogn) and size nprime = n 2O(

radiclogn) [BCE91 BB94] The formula ϕprime

can then be evaluated using O(radicnprime dprime) =

radicn 2O(

radiclogn) queries

Our understanding of lower bounds for the formula-evaluation problem progressed in parallel1Actually [ACR+07 Sec 7] only shows a bound of O(

radicnd32) queries but this can be improved to O(

radicnd)

using the bounds on σplusmn(ϕ) below [ACR+07 Def 1]

5

to this progress on quantum algorithms There are essentially two techniques the polynomial andadversary methods for lower-bounding quantum query complexity

bull The polynomial method introduced in the quantum setting by Beals et al [BBC+01] is basedon the observation that after making q oracle Ox queries the probability of any measurementresult is a polynomial of degree at most 2q in the variables xj

bull Ambainis generalized the classical hybrid argument to consider the systemrsquos entanglementwhen run on a superposition of inputs [Amb02] A number of variants of Ambainisrsquos boundwere soon discovered including weighted versions [HNS02 BS04 Amb06 Zha05] a spectralversion [BSS03] and a version based on Kolmogorov complexity [LM04] These variants canbe asymptotically stronger than Ambainisrsquos original unweighted bound but are equivalent toeach other [SS06] We therefore term it simply ldquothe adversary boundrdquo denoted by Adv

The adversary bound is well-suited for lower-bounding the quantum query complexity for eval-uating formulas For example Barnum and Saks proved that for any size-n AND-OR formula ϕAdv(ϕ) =

radicn implying the lower bound Q(ϕ) = Ω(

radicn) [BS04] Thus the [ACR+07] algorithm is

optimal for approximately balanced AND-OR formulas and is nearly optimal for arbitrary AND-OR formulas This is a considerably more complete solution than is known classically

It is then natural to consider formulas over larger gate sets The adversary bound continues towork well because it transforms nicely under function composition

Theorem 11 (Adversary bound composition [Amb06 LLS06 HLS05]) Let f 0 1k rarr 0 1and let fj 0 1mj rarr 0 1 for j = 1 2 k Define g 0 1m1 times middot middot middot times 0 1mk rarr 0 1 byg(x) = f

(f1(x1) fk(xk)

) Let s = (Adv(f1) Adv(fk)) Then

Adv(g) = Advs(f) (13)

See Definition 21 for the definition of the adversary bound with ldquocostsrdquo Advs The Adv boundequals Advs with uniform unit costs s = ~1 For a function f Adv(f) can be computed using asemi-definite program in time polynomial in the size of f rsquos truth table Therefore Theorem 11gives a polynomial-time procedure for computing the adversary bound for a formula ϕ over anarbitrary finite gate set compute the bounds for subformulas moving from the leaves toward theroot At an internal node f having computed the adversary bounds for the input subformulasf1 fk Eq (13) says that the adversary bound for g the subformula rooted at f equals theadversary bound for the gate f with certain costs Computing this requires 2O(k) time which is aconstant if k = O(1) For example if f is an ORk or ANDk gate then Adv(s1sk)(f) =

radicsumj s

2j

from which follows immediately the [BS04] result Adv(ϕ) =radicn for a size-n AND-OR formula ϕ

A special case of Theorem 11 is when the functions fj all have equal adversary bounds soAdv(g) = Adv(f)Adv(f1) In particular for a function f 0 1k rarr 0 1 and a natural numberd isin N let fd 0 1kd rarr 0 1 denote the complete depth-d formula over f That is f1 = f andfd(x) = f

(fdminus1(x1 xkdminus1) fdminus1(xkdminuskdminus1+1 xkd)

)for d gt 1 Then we obtain

Corollary 12 For any function f 0 1k rarr 0 1

Adv(fd) = Adv(f)d (14)

6

In particular Ambainis defined a boolean function f 0 14 rarr 0 1 that can be representedexactly by a polynomial of degee two but for which Adv(f) = 52 [Amb06] Thus fd can berepresented exactly by a polynomial of degree 2d but by Corollary 12 Adv(fd) = (52)d For thisfunction the adversary bound is strictly stronger than any bound obtainable using the polynomialmethod Many similar examples are given in [HLS06] However for other functions the adversarybound is asymptotically worse than the polynomial method [SS06 AS04 Amb05]

In 2007 though Hoslashyer et al discovered a strict generalization of Adv that also lower-boundsquantum query complexity [HLS07] We call this new bound the general adversary bound or AdvplusmnFor example for Ambainisrsquos four-bit function f Advplusmn(f) ge 251 [HLS06] Like the adversarybound Advplusmns (f) can be computed in time polynomial in the size of f rsquos truth table and alsocomposes nicely

Theorem 13 ([HLS07 Rei09a]) Under the conditions of Theorem 11

Advplusmn(g) = Advplusmns (f) (15)

In particular if Advplusmn(f1) = middot middot middot = Advplusmn(fk) then Advplusmn(g) = Advplusmn(f) Advplusmn(f1)

Define a formula ϕ to be adversary balanced if at each internal node the general adversarybounds of the input subformulas are equal In particular by Theorem 13 this implies that Advplusmn(ϕ)is equal to the product of the general adversary bounds of the gates along any path from the rootto a leaf Complete layered formulas are an example of adversary-balanced formulas

Returning to upper bounds Reichardt and Spalek [RS08] generalized the algorithmic approachstarted by [FGG07] They gave an optimal quantum algorithm for evaluating adversary-balancedformulas over a considerably extended gate set including in particular all functions 0 1k rarr 0 1for k le 3 69 inequivalent four-bit functions and the gates ANDk ORk PARITYk and EQUALkfor k = O(1) For example Q(MAJ3

d) = Θ(2d)The [RS08] result follows from a framework for developing formula-evaluation quantum algo-

rithms based on span programs A span program introduced by Karchmer and Wigderson [KW93]is a certain linear-algebraic way of defining a function which corresponds closely to eigenvalue-zeroeigenvectors of certain bipartite graphs [RS08] derived a quantum algorithm for evaluating certainconcatenated span programs with a query complexity upper-bounded by the span program witnesssize denoted wsize In particular a special case of [RS08 Theorem 47] is

Theorem 14 ([RS08]) Fix a function f 0 1k rarr 0 1 If span program P computes f then

Q(fd) = O(wsize(P )d

) (16)

From Theorem 13 this result is optimal if wsize(P ) = Advplusmn(f) The question thereforebecomes how to find optimal span programs Using an ad hoc search [RS08] found optimal spanprograms for a variety of functions with Advplusmn = Adv Further work automated the search bygiving a semi-definite program (SDP) for the optimal span program witness size for any givenfunction [Rei09a] Remarkably the SDPrsquos value always equals the general adversary bound

Theorem 15 ([Rei09a]) For any function f 0 1n rarr 0 1

infP

wsize(P ) = Advplusmn(f) (17)

where the infimum is over span programs P computing f Moreover this infimum is achieved

7

This result greatly extends the gate set over which the formula-evaluation algorithm of [RS08]works optimally For example combined with Theorem 14 it implies that limdrarrinfinQ(fd)1d =Advplusmn(f) for every boolean function f More generally Theorem 15 allows the [RS08] algorithmto be run on formulas over any finite gate set S A factor is lost that depends on the gates in Sbut it will be a constant for S finite Combining Theorem 15 with [RS08 Theorem 47] gives

Theorem 16 ([Rei09a]) Let S be a finite set of gates Then there exists a quantum algorithm thatevaluates an adversary-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After efficient

classical preprocessing independent of the input x and assuming unit-time coherent access to thepreprocessed classical string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

In the discussion so far we have for simplicity focused on query complexity The query com-plexity is an information-theoretic quantity that does not charge for operations independent of theinput string even though these operations may require many elementary gates to implement Forpractical algorithms it is important to be able to bound the algorithmrsquos running time which countsthe cost of implementing the input-independent operations Theorem 16 puts an optimal boundon the query complexity and also puts a nearly optimal bound on the algorithmrsquos time complexityIn fact all of the query-optimal algorithms so far discussed are also nearly time optimal

In general though an upper bound on the query complexity does not imply an upper boundon the time complexity Ref [Rei09a] also generalized the span program framework of [RS08] toapply to quantum algorithms not based on formulas The main result of [Rei09a] is

Theorem 17 ([Rei09a]) For any function f D rarr 1 2 m with D sube 0 1n Q(f) satisfies

Q(f) = Ω(Advplusmn(f)) and Q(f) = O

(Advplusmn(f)

log Advplusmn(f)log log Advplusmn(f)

log(m) log logm) (18)

Theorem 17 in particular allows us to compute the query complexity of formulas up to thelogarithmic factor It does not give any guarantees on running time However the analysis requiredto prove Theorem 17 also leads to significantly simpler proofs of Theorem 16 and the AND-ORformula results of [ACR+07 FGG07] Moreover we will see that it allows the formula-evaluationalgorithms to be extended to formulas that are not adversary balanced

13 Quantum algorithm for evaluating almost-balanced formulas

We give a formula-evaluation algorithm that is both query-optimal without a logarithmic overheadand after an efficient preprocessing step nearly time optimal Define almost balance as follows

Definition 18 Consider a formula ϕ over a gate set S For a vertex v in the correspondingtree let ϕv denote the subformula of ϕ rooted at v and if v is an internal vertex let gv be thecorresponding gate The formula ϕ is β-balanced if for every vertex v with children c1 c2 ck

maxj Advplusmn(ϕcj )minj Advplusmn(ϕcj )

le β (19)

(If cj is a leaf Advplusmn(ϕcj ) = 1) Formula ϕ is almost balanced if it is β-balanced for some β = O(1)

In particular an adversary-balanced formula is 1-balanced We will show

8

Theorem 19 Let S be a fixed finite set of gates Then there exists a quantum algorithm thatevaluates an almost-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After polynomial-

time classical preprocessing independent of the input and assuming unit-time coherent access tothe preprocessed string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

Theorem 19 is significantly stronger than Theorem 16 which requires exact balance Thereare important classes of exactly balanced formulas such as complete layered formulas In fact it issufficient that the multiset of gates along the simple path from the root to a leaf not depend on theleaf Moreover sometimes different gates have the same Advplusmn bound see [HLS06] for examplesEven still exact adversary balance is a very strict condition

The proof of Theorem 19 is based on the span program framework developed in Ref [Rei09a]In particular [Rei09a Theorem 91] gives two quantum algorithms for evaluating span programsThe first algorithm is based on a discrete-time simulation of a continuous-time quantum walkIt applies to arbitrary span programs and is used in combination with Theorem 15 to proveTheorem 17 However the simulation incurs a logarithmic query overhead and potentially worsetime complexity overhead so this algorithm is not suitable for proving Theorem 19

The second algorithm in [Rei09a] is based directly on a discrete-time quantum walk similarto previous optimal formula-evaluation algorithms [ACR+07 RS08] However this algorithm doesnot apply to an arbitrary span program A bound is needed on the operator norm of the entry-wiseabsolute value of the weighted adjacency matrix for a corresponding graph Further graph sparsityconditions are needed for the algorithm to be time efficient (see Theorem 24)

Unfortunately the span program from Theorem 15 will not generally satisfy these conditionsTheorem 15 gives a canonical span program ([Rei09a Def 51]) Even for a simple formula theoptimal canonical span program will typically correspond to a dense graph with large norm

An example should clarify the problem Consider the AND-OR formula ψ(x) =([(x1 and x2) or

x3] and x4

)or(x5 and [x6 or x7]

) and consider the two graphs in Figure 1 For an input x isin 0 17

modify the graphs by attaching dangling edges to every vertex j for which xj = 0 Observe thenthat each graph has an eigenvalue-zero eigenvector supported on vertex 0mdashcalled a witnessmdashif andonly if ψ(x) = 1 The graphs correspond to different span programs computing ψ and the quantumalgorithm works essentially by running a quantum walk starting at vertex 0 in order to detect thewitness The graph on the left is a significantly simplified version of a canonical span program forψ and its density still makes it difficult to implement the quantum walk

We will be guided by the second simpler graph Instead of applying Theorem 15 to ϕ as awhole we apply it separately to every gate in the formula We then compose these span programsone per gate according to the formula using direct-sum composition (Definition 25) In terms ofgraphs direct-sum composition attaches the output vertex of one span programrsquos graph to an inputvertex of the next [RS08] This leads to a graph whose structure somewhat follows the structure ofthe formula ϕ as the graph in Figure 1(b) follows the structure of ψ (However the general casewill be more complicated than shown as we are plugging together constant-size graph gadgets andthere may be duplication of some subgraphs)

Direct-sum composition keeps the maximum degree and norm of the graph under controlmdasheachis at most twice its value for the worst single gate Therefore the second [Rei09a] algorithm appliesHowever direct-sum composition also leads to additional overhead In particular a witness in thefirst graph will be supported only on numbered vertices (note that the graph is bipartite) whereasa witness in the second graph will be supported on some of the internal vertices as well This meansroughly that the second witness will be harder to detect because after normalization its overlap on

9

0

1

2

3

4

5

6

7

(a)

3

6

7

0

1

2

4

5

(b)

Figure 1 Graphs corresponding to two span programs both computing the same function

vertex 0 will be smaller Scale both witnesses so that the amplitude on vertex 0 is one The witnesssize (wsize) measures the squared length of the witness only on numbered vertices whereas the fullwitness size (fwsize) measures the squared length on all vertices For [Rei09a] it was sufficient toconsider only span program witness size because for canonical span programs like in Figure 1(a)the two measures are equal (For technical reasons we will actually define fwsize to be 1 + wsizeeven in this case) For our analysis we will need to bound the full witness size in terms of thewitness size We maintain this bound in a recursion from the formularsquos leaves toward its root

A span program is called strict if every vertex on one half of the bipartite graph is either aninput vertex (vertices 1ndash7 in the graphs of Figure 1) or the output vertex (vertex 0) Thus the firstgraph in the example above corresponds to a strict span program and the second does not Theoriginal definition of span programs in [KW93] allowed for only strict span programs This wassensible because any other vertices on the inputoutput part of the graphrsquos bipartition can alwaysbe projected away yielding a strict span program that computes the same function For developingtime-efficient quantum algorithms though it seems important to consider span programs that arenot strict Unfortunately going backwards eg from 1(a) to 1(b) is probably difficult in general

Theorem 19 does not follow from the formula-evaluation techniques of [RS08] together withTheorem 14 from [Rei09a] This tempting approach falls into intractable technical difficulties Inparticular the same span program can be used at two vertices v and w in ϕ only if gv = gw andthe general adversary bounds of vrsquos input subformulas are the same as those for wrsquos inputs upto simultaneous scaling In general then an almost-balanced formula will require an unboundednumber of different span programs However the analysis in [RS08] loses a factor that dependsbadly on the individual span programs Since the dependence is not continuous even showingthat the span programs in use all lie within a compact set would not be sufficient to obtain anO(1) upper bound In contrast the approach we follow here allows bounding the lost factor by anexponential in k uniformly over different gate imbalances

10

14 Quantum algorithm to evaluate approximately balanced AND-OR formulas

Ambainis et al [ACR+07] use a weaker balance criterion for AND-OR formulas than Definition 18They define an AND-OR formula to be approximately balanced if σminus(ϕ) = O(1) and σ+(ϕ) = O(n)Here n is the size of the formula ie the number of leaves and σminus(ϕ) and σ+(ϕ) are defined by

Definition 110 For each vertex v in a formula ϕ let

σminus(v) = maxξ

sumwisinξ

1Advplusmn(ϕw)

σ+(v) = maxξ

sumwisinξ

Advplusmn(ϕw)2 (110)

with each maximum taken over all simple paths ξ from v to a leaf Let σplusmn(ϕ) = σplusmn(r) where r isthe root of ϕ

Recall that Advplusmn(ϕ) = Adv(ϕ) =radicn for an AND-OR formula Definition 18 is a stricter

balance criterion because β-balance of a formula ϕ implies (by Lemma 32) that σminus(ϕ) and σ+(ϕ) areboth dominated by geometric series However the same steps followed by the proof of Theorem 19still suffice for proving the [ACR+07] result and in fact for strengthening it We show

Theorem 111 Let ϕ be an AND-OR formula of size n Then after polynomial-time classicalpreprocessing that does not depend on the input x ϕ(x) can be evaluated by a quantum algo-rithm with error at most 13 using O

(radicnσminus(ϕ)

)input queries The algorithmrsquos running time isradic

nσminus(ϕ)(log n)O(1) assuming unit-cost coherent access to the preprocessed string

For the special case of AND-OR formulas with σminus(ϕ) = O(1) Theorem 111 strengthens The-orem 19 The requirement that σminus(ϕ) = O(1) allows for some gates in the formula to be veryunbalanced Theorem 111 also strengthens [ACR+07 Theorem 1] because it does not require thatσ+(ϕ) = O(n) For example a formula that is biased near the root but balanced at greater depthscan have σminus(ϕ) = O(1) and σ+(ϕ) = ω(n) By substituting the bound σminus(ϕ) = O(

radicd) for a depth-

d formula [ACR+07 Def 3] a corollary of Theorem 111 is that a depth-d size-n AND-OR formulacan be evaluated using O(

radicnd) queries This improves the depth-dependence from [ACR+07] and

matches the dependence from an earlier version of that article [Amb07]The essential reason that the Definition 18 balance condition can be weakened is that for the

specific gates AND and OR by writing out the optimal span programs explicitly we can prove thatthey satisfy stronger properties than are necessarily true for other functions

2 Span programs

21 Definitions

We briefly recall some definitions from [Rei09a Sec 2] Additionally we define a span programcomplexity measure the full witness size that charges even for the ldquofreerdquo inputs This quantity isimportant for developing quantum algorithms that are time efficient as well as query efficient

For a natural number n let [n] = 1 2 n For a finite set X let CX be the inner productspace C|X| with orthonormal basis |x〉 x isin X For vector spaces V and W over C let L(VW )be the set of linear transformations from V into W and let L(V ) = L(V V ) For A isin L(VW )A is the operator norm of A For a string x isin 0 1n let x denote its bitwise complement

11

Definition 21 ([HLS05 HLS07]) For finite sets C E and D sube Cn let f D rarr E An adversarymatrix for f is a real symmetric matrix Γ isin L(CD) that satisfies 〈x|Γ|y〉 = 0 whenever f(x) = f(y)

The general adversary bound for f with costs s isin [0infin)n is

Advplusmns (f) = maxadversary matrices Γforalljisin[n] Γ∆jlesj

Γ (21)

Here Γ ∆j denotes the entry-wise matrix product between Γ and ∆j =sum

xyxj 6=yj|x〉〈y| The

(nonnegative-weight) adversary bound for f with costs s is defined by the same maximizationexcept with Γ restricted to have nonnegative entries In particular Advplusmns (f) ge Advs(f)

Letting ~1 = (1 1 1) the adversary bound for f is Adv(f) = Adv~1(f) and the generaladversary bound for f is Advplusmn(f) = Advplusmn~1 (f) By [HLS07] Q(f) = Ω(Advplusmn(f))

Definition 22 (Span program [KW93]) A span program P consists of a natural number n afinite-dimensional inner product space V over C a ldquotargetrdquo vector |t〉 isin V disjoint sets Ifree andIjb for j isin [n] b isin 0 1 and ldquoinput vectorsrdquo |vi〉 isin V for i isin Ifree cup

⋃jisin[n]bisin01 Ijb

To P corresponds a function fP 0 1n rarr 0 1 defined on x isin 0 1n by

fP (x) =

1 if |t〉 isin Span(|vi〉 i isin Ifree cup

⋃jisin[n] Ijxj)

0 otherwise(22)

Some additional notation is convenient Fix a span program P Let I = Ifreecup⋃jisin[n]bisin01 Ijb

Let A isin L(CI V ) be given by A =sum

iisinI |vi〉〈i| For x isin 0 1n let I(x) = Ifree cup⋃jisin[n] Ijxj and

Π(x) =sum

iisinI(x) |i〉〈i| isin L(CI) Then fP (x) = 1 if |t〉 isin Range(AΠ(x)) A vector |w〉 isin CI is saidto be a witness for fP (x) = 1 if Π(x)|w〉 = |w〉 and A|w〉 = |t〉 A vector |wprime〉 isin V is said to be awitness for fP (x) = 0 if 〈t|wprime〉 = 1 and Π(x)Adagger|wprime〉 = 0

Definition 23 (Witness size) Consider a span program P and a vector s isin [0infin)n of nonnegativeldquocostsrdquo Let S =

sumjisin[n]bisin01iisinIjb

radicsj |i〉〈i| isin L(CI) For each input x isin 0 1n define the witness

size of P on x with costs s wsizes(P x) as follows

wsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉 S|w〉2 if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

SAdagger|wprime〉2 if fP (x) = 0 (23)

The witness size of P with costs s is

wsizes(P ) = maxxisin01n

wsizes(P x) (24)

Define the full witness size fwsizes(P ) by letting Sf = S +sum

iisinIfree|i〉〈i| and

fwsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉(1 + Sf |w〉2) if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

(|wprime〉2 + SAdagger|wprime〉2) if fP (x) = 0 (25)

fwsizes(P ) = maxxisin01n

fwsizes(P x) (26)

When the subscript s is omitted the costs are taken to be uniform s = ~1 = (1 1 1) egfwsize(P ) = fwsize~1(P ) The witness size is defined in [RS08] The full witness size is definedin [Rei09a Sec 8] but is not named there A strict span program has Ifree = empty so Sf = S and amonotone span program has Ij0 = empty for all j [Rei09a Def 49]

12

22 Quantum algorithm to evaluate a span program based on its full witness size

[Rei09a Theorem 93] gives a quantum query algorithm for evaluating span programs based on thefull witness size The algorithm is based on a quantum walk on a certain graph Provided that thedegree of the graph is not too large it can actually be implemented efficiently

Theorem 24 ([Rei09a Theorem 93]) Let P be a span program Then fP can be evaluated using

T = O(fwsize(P ) abs(AGP

))

(27)

quantum queries with error probability at most 13 Moreover if the maximum degree of a vertexin GP is d then the time complexity of the algorithm for evaluating fP is at most a factor of(log d)

(log(T log d)

)O(1) worse after classical preprocessing and assuming constant-time coherentaccess to the preprocessed string

Proof sketch The query complexity claim is actually slightly weaker than [Rei09a Theorem 93]which allows the target vector to be scaled downward by a factor of

radicfwsize(P )

The time-complexity claim will follow from the proof of [Rei09a Theorem 93] in [Rei09aProp 94 Theorem 95] The algorithm for evaluating fP (x) uses a discrete-time quantum walkon the graph GP (x) If the maximum degree of a vertex in GP is d then each coin reflec-tion can be implemented using O(log d) single-qubit unitaries and queries to the preprocessedstring [GR02 CNW09] Finally the

(log(T log d)

)O(1) factor comes from applying the Solovay-Kitaev Theorem [KSV02] to compile the single-qubit unitaries into products of elementary gatesto precision 1O(T log d)

We remark that together with [Rei09a Theorem 31] Theorem 24 gives a way of transforming aone-sided-error quantum algorithm into a span program and back into a quantum algorithm suchthat the time complexity is nearly preserved after preprocessing This is only a weak equivalencebecause aside from requiring preprocessing the algorithm from Theorem 24 also has two-sided errorTo some degree though it complements the equivalence results for best span program witness sizeand bounded-error quantum query complexity [Rei09a Theorem 71 Theorem 92]

23 Direct-sum span program composition

Let us study the full witness size of the direct-sum composition of span programs We begin byrecalling the definition of direct-sum composition

Let f 0 1n rarr 0 1 and S sube [n] For j isin [n] let mj be a natural number with mj = 1 forj isin S For j isin S let fj 0 1mj rarr 0 1 Define y 0 1m1 times middot middot middot times 0 1mn rarr 0 1n by

y(x)j =

fj(xj) if j isin Sxj if j isin S

(28)

Define g 0 1m1 times middot middot middottimes 0 1mn rarr 0 1 by g(x) = f(y(x)) For example if S = [n] r 1 then

g(x) = f(x1 f2(x2) fn(xn)

) (29)

Given span programs for the individual functions f and fj for j isin S we will construct a spanprogram for g We remark that although we are here requiring that the inner functions fj act on

13

disjoint sets of bits this assumption is not necessary for the definition It simplifies the notationthough for the cases S 6= [n] and will suffice for our applications

Let P be a span program computing fP = f Let P have inner product space V target vector|t〉 and input vectors |vi〉 indexed by Ifree and Ijc for j isin [n] and c isin 0 1

For j isin [n] let sj isin [0infin)mj be a vector of costs and let s isin [0infin)Pmj be the concatenation of

the vectors sj For j isin S let P j0 and P j1 be span programs computing fP j1 = fj 0 1mj rarr 0 1and fP j0 = notfj with rj = wsizesj (P j0) = wsizesj (P j1) For c isin 0 1 let P jc have inner productspace V jc with target vector |tjc〉 and input vectors indexed by Ijcfree and Ijckb for k isin [mj ] b isin 0 1For j isin S let rj = sj

Let IS =⋃jisinScisin01 Ijc Define ς IS rarr [n]times 0 1 by ς(i) = (j c) if i isin Ijc The idea is that

ς maps i to the input span program that must evaluate to 1 in order for |vi〉 to be available in P There are several ways of composing the span programs P and P jc to obtain a span program Q

computing the composed function fQ = g with wsizes(Q) le wsizer(P ) [Rei09a Defs 44 45 46]We focus on direct-sum composition

Definition 25 ([Rei09a Def 45]) The direct-sum-composed span program Qoplus is defined by

bull The inner product space is V oplus = V oplusoplus

jisinScisin01(CIjc otimes V jc) Any vector in V oplus can be

uniquely expressed as |u〉V +sum

iisinIS |i〉 otimes |ui〉 where |u〉 isin V and |ui〉 isin V ς(i)

bull The target vector is |toplus〉 = |t〉V

bull The free input vectors are indexed by Ioplusfree = Ifree cup IS cup⋃jisinScisin01(Ijc times Ijcfree) with for

i isin Ioplusfree

|voplusi 〉 =

|vi〉V if i isin Ifree

|vi〉V minus |i〉 otimes |tjc〉 if i isin Ijc and j isin S|iprime〉 otimes |viprimeprime〉 if i = (iprime iprimeprime) isin Ijc times Ijcfree

(210)

bull The other input vectors are indexed by Ioplus(jk)b for j isin [n] k isin [mj ] b isin 0 1 For j isin S

Ioplus(j1)b = Ijb with |voplusi 〉 = |vi〉V for i isin Ioplus(j1)b For j isin S let Ioplus(jk)b =⋃cisin01(Ijc times I

jckb) For

i isin Ijc and iprime isin Ijckb let|voplusiiprime〉 = |i〉 otimes |viprime〉 (211)

By [Rei09a Theorem 43] fQoplus = g and wsizes(Qoplus) le wsizer(P ) (While that theorem is statedonly for the case S = [n] it is trivially extended to other S sub [n]) We give a bound on how quicklythe full witness size can grow relative to the witness size

Lemma 26 Under the above conditions for each input x isin 0 1m1timesmiddot middot middottimes0 1mn with y = y(x)

bull If g(x) = 1 let |w〉 be a witness to fP (y) = 1 such thatsum

jisin[n]iisinIjyjrj |wi|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |w〉

)+

1 +sum

iisinIfree|wi|2

wsizer(P y)

where σ(y |w〉) = maxjisinS

existi isin Ijyj with 〈i|w〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(212)

14

bull If g(x) = 0 let |wprime〉 be a witness to fP (y) = 0 such thatsum

jisin[n]iisinIjyjrj |〈wprime|vi〉|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |wprime〉) +|wprime〉2

wsizer(P y)

where σ(y |wprime〉) = maxjisinS

existi isin Ijyj with 〈vi|wprime〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(213)

If S = empty then σ(y |w〉) and σ(y |wprime〉) should each be taken to be 1 in the above equations

Proof We follow the proof of [Rei09a Theorem 43] except keeping track of the full witness sizeNote that if S = empty then Eqs (212) and (213) are immediate by definition of fwsizes(Qoplus x)

Let I(y)prime = I(y) r Ifree =⋃jisin[n] Ijyj

In the first case g(x) = 1 for j isin S let |wjyj 〉 isin CIjyj be a witness to fP jyj (xj) = 1 such that

fwsizes(P jyj xj) = 1 +sum

iisinIjyjfree

|wjyj

i |2

+sum

kisin[mj ]iisinIjyjk(xj)k

(sj)k|wjyj

i |2 As in [Rei09a Theorem 43]

let |woplus〉 isin CIoplus(x) be given by

woplusi =

wi if i isin I(y)

wiprimewς(iprime)iprimeprime if i = (iprime iprimeprime) with iprime isin I(y)prime cap IS iprimeprime isin Iς(iprime)(x)

0 otherwise

(214)

Then |woplus〉 is a witness for fQoplus(x) = 1 and we compute

fwsizes(Qoplus x) le 1 +sumiisinIoplusfree

|woplusi |2 +

sumjisin[n]kisin[mj ]

iisinIoplus(jk)(xj)k

(sj)k|woplusi |2

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 (215)

+sum

jisinSiisinIjyj

|wi|2(

1 +sum

iprimeisinIjyjfree

|wjyj

iprime |2 +

sumkisin[mj ]iprimeisinI

jyjk(xj)k

(sj)k|wjyj

iprime |2

)

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 +sum

jisinSiisinIjyj

|wi|2 fwsizesj (P jyj xj)

Eq (212) follows using the bound fwsizesj (P jyj xj) le σ(y |w〉)rj for j isin S and sj = rj for j isin SNext consider the case g(x) = 0 For j isin S let |ujyj 〉 isin V jyj be a witness for f

P jyj (xj) = 0 withfwsizes(P jyj xj) = |ujyj 〉2 +

sumkisin[mj ]iisinI

jyj

k(xj)k

(sj)k|〈vi|ujyj 〉|2 As in [Rei09a Theorem 43] let

|uoplus〉 = |wprime〉V +sum

iisinISrI(y)

〈vi|wprime〉|i〉 otimes |uς(i)〉 (216)

15

Then |uoplus〉 is a witness for fQoplus(x) = 0 and moreover

fwsizes(Qoplus x) le |uoplus〉2 +sum

jisin[n]kisin[mj ]iisinIoplus(jk)(xj)k

(sj)k|〈voplusi |uoplus〉|2

= |uoplus〉2 +sum

jisin[n]rSiisinIjxj

sj |〈voplusi |uoplus〉|2 +

sumjisinSkisin[mj ]

iisinIjyjiprimeisinI

jyj

k(xj)k

(sj)k|〈voplusiiprime |uoplus〉|2

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

sj |〈vi|wprime〉|2 (217)

+sum

jisinSiisinIjyj

|〈vi|wprime〉|2(|ujyj 〉2 +

sumkisin[mj ]iprimeisinI

jyj

k(xj)k

(sj)k|〈viprime |ujyj 〉|2)

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

rj |〈vi|wprime〉|2 +sum

jisinSiisinIjyj

|〈vi|wprime〉|2 fwsizesj (P jyj xj)

Eq (213) follows using the bound fwsizesj (P jyj xj) le σ(y |wprime〉)rj for j isin S

Lemma 26 is a key step in the formula-evaluation results in this article and [Rei09b] Itis used to track the full witness size for span programs recursively composed in a direct-summanner along a formula The proof of Theorem 19 will require the lemma with the weakerbounds σ(y |w〉) σ(y |wprime〉) le maxjisinScisin01 fwsizesj (P jc)wsizesj (P jc) Theorem 111 will useonly the slightly stronger bounds σ(y |w〉) le maxjisinS fwsizesj (P jyj )wsizesj (P jyj ) σ(y |wprime〉) lemaxjisinS fwsizesj (P jyj )wsizesj (P jyj ) However the proof of [Rei09b Theorem 11] will require thebounds of Eqs (212) and (213)

3 Evaluation of almost-balanced formulas

In this section we will apply the span program framework from [Rei09a] to prove Theorem 19Our algorithm will be given by applying Theorem 24 to a certain span program Before beginningthe proof though we will give two necessary lemmas

Consider a span program P with corresponding weighted graph GP from [Rei09a Def 82]We will need a bound on the operator norm of abs(AGPv

) the entry-wise absolute value of theweighted adjacency matrix AGPv

If P is canonical [Rei09a Def 51] then we can indeed obtainsuch a bound in terms of the witness size of P

Lemma 31 Let s isin (0infin)k and let P be a canonical span program computing a function f 0 1k rarr 0 1 with input vectors indexed by the set I Assume that for each x isin 0 1k withf(x) = 0 an optimal witness to fP (x) = 0 is |x〉 itself Then

abs(AGP) le 2k

(1 +

wsizes(P )minjisin[k] sj

)+ |I| (31)

16

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 4: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

two children and every leaf is at distance d from the root with alternating levels of AND and ORgates Its size is n = 2d Snir [Sni85] has given a randomized algorithm for evaluating ϕd usingin expectation O(nα) queries where α = log2(1+

radic33

4 ) asymp 0753 [SW86] This algorithm known asrandomized alpha-beta pruning evaluates a random subformula recursively and only evaluates thesecond subformula if necessary Saks and Wigderson [SW86] have given a matching lower bound onR(ϕd) which Santha has extended to hold for Monte Carlo algorithms R2(ϕd) = Ω(nα) [San95]

Thus the query complexities have been characterized for the complete binary AND-OR formu-las In fact the tight characterization works for a larger class of formulas called ldquowell balancedrdquoformulas by [San95] This class includes for example alternating AND2-OR2 formulas where forsome d every leaf is at depth d or dminus1 Fibonacci trees and binomial trees [SW86] It also includesskew trees for which the depth is the maximal nminus 1

For arbitrary AND-OR formulas on the other hand little is known It has been conjectured thatcomplete binary AND-OR formulas are the easiest to evaluate and that in particular R(ϕ) = Ω(nα)for any size-n AND-OR formula ϕ [SW86] However the best general lower bound is R(ϕ) =Ω(n051) due to Heiman and Wigderson [HW91] Ref [HW91] also extends the result of [SW86] toallow for AND and OR gates with fan-in more than two

It is perhaps not surprising that formulas over most other gate sets S are even less well under-stood For example Boppana has asked the complexity of evaluating the complete ternary majority(MAJ3) formula of depth d [SW86] and the best published bounds on its query complexity areΩ((73)d

)and O

((26537 )d

)[JKS03] In particular the naıve ldquodirectionalrdquo generalization of

the randomized alpha-beta pruning algorithm is to evaluate recursively two random immediate sub-formulas and if they disagree then also the third This algorithm uses O

((83)d

)expected queries

and is suboptimal This suggests that the complete MAJ3 formulas are significantly different fromthe complete AND-OR formulas

Heiman Newman and Wigderson have considered read-once threshold formulas in an attemptto separate the complexity classes TC0 from NC1 [HNW93] That is they allow the gate set tobe the set of Hamming-weight threshold gates T km m k isin N defined by T km 0 1k rarr 0 1T km(x) = 1 if and only if the Hamming weight of x is at least m AND OR and majority gatesare all special cases of threshold gates Heiman et al prove that R(ϕ) ge n2d for ϕ a thresholdformula of depth d and in fact their proof extends to gate sets in which every gate ldquocontains afliprdquo [HNW93] This implies that a large depth is necessary for the randomized complexity to bemuch lower than the deterministic complexity

Of course there are some trivial gate sets for which the query complexity is fully understood forexample the set of parity gates Overall though there are many more open problems than resultsDespite its structure formula evaluation appears to be combinatorially complicated Howeverthere is another approach to try to leverage the power of quantum computers Surprisingly theformula-evaluation problem simplifies considerably in this different model of computation

12 History of the formula-evaluation problem for quantum algorithms

In the quantum query model the input bits can be queried coherently That is the quantumalgorithm is allowed unit-cost access to the unitary operator Ox called the input oracle defined by

Ox |ϕ〉 otimes |j〉 otimes |b〉 7rarr |ϕ〉 otimes |j〉 otimes |boplus xj〉 (11)

Here |ϕ〉 is an arbitrary pure state |j〉 j = 1 2 n is an orthonormal basis for Cn|b〉 b = 0 1 is an orthonormal basis for C2 and oplus denotes addition mod two Ox can be

4

implemented efficiently on a quantum computer given a classical circuit that computes the func-tion j 7rarr xj [NC00] For a function f 0 1n rarr 0 1 let Q(f) be the number of input queriesrequired to evaluate f with error probability at most 13 It is immediate that Q(f) le R2(f)

Research on the formula-evaluation problem in the quantum model began with the n-bit ORfunction ORn Grover gave a quantum algorithm for evaluating ORn with bounded one-sided errorusing O(

radicn) oracle queries and O(

radicn log log n) time [Gro96 Gro02] In the classical case on the

other hand it is obvious that R2(ORn) R(ORn) and D(ORn) are all Θ(n)Groverrsquos algorithm can be applied recursively to speed up the evaluation of more general AND-

OR formulas Call a formula layered if the gates at the same depth are the same Buhrman Cleveand Wigderson show that a layered depth-d size-n AND-OR formula can be evaluated usingO(radicn logdminus1 n) queries [BCW98] The logarithmic factors come from using repetition at each level

to reduce the error probability from a constant to be polynomially smallHoslashyer Mosca and de Wolf [HMW03] consider the case of a unitary input oracle Ox that maps

Ox |ϕ〉 otimes |j〉 otimes |b〉 otimes |0〉 7rarr |ϕ〉 otimes |j〉 otimes(|boplus xj〉 otimes |ψxjxj 〉+ |boplus xj〉 otimes |ψxjxj 〉

) (12)

where |ψxjxj 〉 |ψxjxj 〉 are pure states with |ψxjxj 〉2 ge 23 Such an oracle can be implemented

when the function j 7rarr xj is computed by a bounded-error randomized subroutine Hoslashyer et alallow access to Ox and Ominus1

x both at unit cost and show that ORn can still be evaluated usingO(radicn) queries This robustness result implies that the log n steps of repetition used by [BCW98]

are not necessary and a depth-d layered AND-OR formula can be computed in O(radicn cdminus1) queries

for some constant c gt 1000 If the depth is constant this gives an O(radicn)-query quantum algorithm

but the result is not useful for the complete binary AND-OR formula for which d = log2 nIn 2007 Farhi Goldstone and Gutmann presented a quantum algorithm for evaluating com-

plete binary AND-OR formulas [FGG07] Their breakthrough algorithm is not based on iteratingGroverrsquos algorithm in any way but instead runs a quantum walkmdashanalogous to a classical ran-dom walkmdashon a graph based on the formula The algorithm runs in time O(

radicn) in a certain

continuous-time query modelAmbainis et al discretized the [FGG07] algorithm by reinterpreting a correspondence between

(discrete-time) random and quantum walks due to Szegedy [Sze04] as a correspondence betweencontinuous-time and discrete-time quantum walks [ACR+07] Applying this correspondence toquantum walks on certain weighted graphs they gave an O(

radicn)-query quantum algorithm for

evaluating ldquoapproximately balancedrdquo AND-OR formulas For example MAJ3(x1 x2 x3) = (x1 andx2) or

((x1 or x2) and x3

) so there is a size-5d AND-OR formula that computes MAJ3

d the completeternary majority formula of depth d Since the formula is approximately balanced Q(MAJ3

d) =O(radic

5d) better than the Ω

((73)d

)classical lower bound

The [ACR+07] algorithm also applies to arbitrary AND-OR formulas If ϕ has size n anddepth d then the algorithm applied directly evaluates ϕ using O(

radicnd) queries1 This can be as

bad as O(n32) if the depth is d = n However Bshouty Cleve and Eberly have given a formularebalancing procedure that takes AND-OR formula ϕ as input and outputs an equivalent AND-ORformula ϕprime with depth dprime = 2O(

radiclogn) and size nprime = n 2O(

radiclogn) [BCE91 BB94] The formula ϕprime

can then be evaluated using O(radicnprime dprime) =

radicn 2O(

radiclogn) queries

Our understanding of lower bounds for the formula-evaluation problem progressed in parallel1Actually [ACR+07 Sec 7] only shows a bound of O(

radicnd32) queries but this can be improved to O(

radicnd)

using the bounds on σplusmn(ϕ) below [ACR+07 Def 1]

5

to this progress on quantum algorithms There are essentially two techniques the polynomial andadversary methods for lower-bounding quantum query complexity

bull The polynomial method introduced in the quantum setting by Beals et al [BBC+01] is basedon the observation that after making q oracle Ox queries the probability of any measurementresult is a polynomial of degree at most 2q in the variables xj

bull Ambainis generalized the classical hybrid argument to consider the systemrsquos entanglementwhen run on a superposition of inputs [Amb02] A number of variants of Ambainisrsquos boundwere soon discovered including weighted versions [HNS02 BS04 Amb06 Zha05] a spectralversion [BSS03] and a version based on Kolmogorov complexity [LM04] These variants canbe asymptotically stronger than Ambainisrsquos original unweighted bound but are equivalent toeach other [SS06] We therefore term it simply ldquothe adversary boundrdquo denoted by Adv

The adversary bound is well-suited for lower-bounding the quantum query complexity for eval-uating formulas For example Barnum and Saks proved that for any size-n AND-OR formula ϕAdv(ϕ) =

radicn implying the lower bound Q(ϕ) = Ω(

radicn) [BS04] Thus the [ACR+07] algorithm is

optimal for approximately balanced AND-OR formulas and is nearly optimal for arbitrary AND-OR formulas This is a considerably more complete solution than is known classically

It is then natural to consider formulas over larger gate sets The adversary bound continues towork well because it transforms nicely under function composition

Theorem 11 (Adversary bound composition [Amb06 LLS06 HLS05]) Let f 0 1k rarr 0 1and let fj 0 1mj rarr 0 1 for j = 1 2 k Define g 0 1m1 times middot middot middot times 0 1mk rarr 0 1 byg(x) = f

(f1(x1) fk(xk)

) Let s = (Adv(f1) Adv(fk)) Then

Adv(g) = Advs(f) (13)

See Definition 21 for the definition of the adversary bound with ldquocostsrdquo Advs The Adv boundequals Advs with uniform unit costs s = ~1 For a function f Adv(f) can be computed using asemi-definite program in time polynomial in the size of f rsquos truth table Therefore Theorem 11gives a polynomial-time procedure for computing the adversary bound for a formula ϕ over anarbitrary finite gate set compute the bounds for subformulas moving from the leaves toward theroot At an internal node f having computed the adversary bounds for the input subformulasf1 fk Eq (13) says that the adversary bound for g the subformula rooted at f equals theadversary bound for the gate f with certain costs Computing this requires 2O(k) time which is aconstant if k = O(1) For example if f is an ORk or ANDk gate then Adv(s1sk)(f) =

radicsumj s

2j

from which follows immediately the [BS04] result Adv(ϕ) =radicn for a size-n AND-OR formula ϕ

A special case of Theorem 11 is when the functions fj all have equal adversary bounds soAdv(g) = Adv(f)Adv(f1) In particular for a function f 0 1k rarr 0 1 and a natural numberd isin N let fd 0 1kd rarr 0 1 denote the complete depth-d formula over f That is f1 = f andfd(x) = f

(fdminus1(x1 xkdminus1) fdminus1(xkdminuskdminus1+1 xkd)

)for d gt 1 Then we obtain

Corollary 12 For any function f 0 1k rarr 0 1

Adv(fd) = Adv(f)d (14)

6

In particular Ambainis defined a boolean function f 0 14 rarr 0 1 that can be representedexactly by a polynomial of degee two but for which Adv(f) = 52 [Amb06] Thus fd can berepresented exactly by a polynomial of degree 2d but by Corollary 12 Adv(fd) = (52)d For thisfunction the adversary bound is strictly stronger than any bound obtainable using the polynomialmethod Many similar examples are given in [HLS06] However for other functions the adversarybound is asymptotically worse than the polynomial method [SS06 AS04 Amb05]

In 2007 though Hoslashyer et al discovered a strict generalization of Adv that also lower-boundsquantum query complexity [HLS07] We call this new bound the general adversary bound or AdvplusmnFor example for Ambainisrsquos four-bit function f Advplusmn(f) ge 251 [HLS06] Like the adversarybound Advplusmns (f) can be computed in time polynomial in the size of f rsquos truth table and alsocomposes nicely

Theorem 13 ([HLS07 Rei09a]) Under the conditions of Theorem 11

Advplusmn(g) = Advplusmns (f) (15)

In particular if Advplusmn(f1) = middot middot middot = Advplusmn(fk) then Advplusmn(g) = Advplusmn(f) Advplusmn(f1)

Define a formula ϕ to be adversary balanced if at each internal node the general adversarybounds of the input subformulas are equal In particular by Theorem 13 this implies that Advplusmn(ϕ)is equal to the product of the general adversary bounds of the gates along any path from the rootto a leaf Complete layered formulas are an example of adversary-balanced formulas

Returning to upper bounds Reichardt and Spalek [RS08] generalized the algorithmic approachstarted by [FGG07] They gave an optimal quantum algorithm for evaluating adversary-balancedformulas over a considerably extended gate set including in particular all functions 0 1k rarr 0 1for k le 3 69 inequivalent four-bit functions and the gates ANDk ORk PARITYk and EQUALkfor k = O(1) For example Q(MAJ3

d) = Θ(2d)The [RS08] result follows from a framework for developing formula-evaluation quantum algo-

rithms based on span programs A span program introduced by Karchmer and Wigderson [KW93]is a certain linear-algebraic way of defining a function which corresponds closely to eigenvalue-zeroeigenvectors of certain bipartite graphs [RS08] derived a quantum algorithm for evaluating certainconcatenated span programs with a query complexity upper-bounded by the span program witnesssize denoted wsize In particular a special case of [RS08 Theorem 47] is

Theorem 14 ([RS08]) Fix a function f 0 1k rarr 0 1 If span program P computes f then

Q(fd) = O(wsize(P )d

) (16)

From Theorem 13 this result is optimal if wsize(P ) = Advplusmn(f) The question thereforebecomes how to find optimal span programs Using an ad hoc search [RS08] found optimal spanprograms for a variety of functions with Advplusmn = Adv Further work automated the search bygiving a semi-definite program (SDP) for the optimal span program witness size for any givenfunction [Rei09a] Remarkably the SDPrsquos value always equals the general adversary bound

Theorem 15 ([Rei09a]) For any function f 0 1n rarr 0 1

infP

wsize(P ) = Advplusmn(f) (17)

where the infimum is over span programs P computing f Moreover this infimum is achieved

7

This result greatly extends the gate set over which the formula-evaluation algorithm of [RS08]works optimally For example combined with Theorem 14 it implies that limdrarrinfinQ(fd)1d =Advplusmn(f) for every boolean function f More generally Theorem 15 allows the [RS08] algorithmto be run on formulas over any finite gate set S A factor is lost that depends on the gates in Sbut it will be a constant for S finite Combining Theorem 15 with [RS08 Theorem 47] gives

Theorem 16 ([Rei09a]) Let S be a finite set of gates Then there exists a quantum algorithm thatevaluates an adversary-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After efficient

classical preprocessing independent of the input x and assuming unit-time coherent access to thepreprocessed classical string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

In the discussion so far we have for simplicity focused on query complexity The query com-plexity is an information-theoretic quantity that does not charge for operations independent of theinput string even though these operations may require many elementary gates to implement Forpractical algorithms it is important to be able to bound the algorithmrsquos running time which countsthe cost of implementing the input-independent operations Theorem 16 puts an optimal boundon the query complexity and also puts a nearly optimal bound on the algorithmrsquos time complexityIn fact all of the query-optimal algorithms so far discussed are also nearly time optimal

In general though an upper bound on the query complexity does not imply an upper boundon the time complexity Ref [Rei09a] also generalized the span program framework of [RS08] toapply to quantum algorithms not based on formulas The main result of [Rei09a] is

Theorem 17 ([Rei09a]) For any function f D rarr 1 2 m with D sube 0 1n Q(f) satisfies

Q(f) = Ω(Advplusmn(f)) and Q(f) = O

(Advplusmn(f)

log Advplusmn(f)log log Advplusmn(f)

log(m) log logm) (18)

Theorem 17 in particular allows us to compute the query complexity of formulas up to thelogarithmic factor It does not give any guarantees on running time However the analysis requiredto prove Theorem 17 also leads to significantly simpler proofs of Theorem 16 and the AND-ORformula results of [ACR+07 FGG07] Moreover we will see that it allows the formula-evaluationalgorithms to be extended to formulas that are not adversary balanced

13 Quantum algorithm for evaluating almost-balanced formulas

We give a formula-evaluation algorithm that is both query-optimal without a logarithmic overheadand after an efficient preprocessing step nearly time optimal Define almost balance as follows

Definition 18 Consider a formula ϕ over a gate set S For a vertex v in the correspondingtree let ϕv denote the subformula of ϕ rooted at v and if v is an internal vertex let gv be thecorresponding gate The formula ϕ is β-balanced if for every vertex v with children c1 c2 ck

maxj Advplusmn(ϕcj )minj Advplusmn(ϕcj )

le β (19)

(If cj is a leaf Advplusmn(ϕcj ) = 1) Formula ϕ is almost balanced if it is β-balanced for some β = O(1)

In particular an adversary-balanced formula is 1-balanced We will show

8

Theorem 19 Let S be a fixed finite set of gates Then there exists a quantum algorithm thatevaluates an almost-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After polynomial-

time classical preprocessing independent of the input and assuming unit-time coherent access tothe preprocessed string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

Theorem 19 is significantly stronger than Theorem 16 which requires exact balance Thereare important classes of exactly balanced formulas such as complete layered formulas In fact it issufficient that the multiset of gates along the simple path from the root to a leaf not depend on theleaf Moreover sometimes different gates have the same Advplusmn bound see [HLS06] for examplesEven still exact adversary balance is a very strict condition

The proof of Theorem 19 is based on the span program framework developed in Ref [Rei09a]In particular [Rei09a Theorem 91] gives two quantum algorithms for evaluating span programsThe first algorithm is based on a discrete-time simulation of a continuous-time quantum walkIt applies to arbitrary span programs and is used in combination with Theorem 15 to proveTheorem 17 However the simulation incurs a logarithmic query overhead and potentially worsetime complexity overhead so this algorithm is not suitable for proving Theorem 19

The second algorithm in [Rei09a] is based directly on a discrete-time quantum walk similarto previous optimal formula-evaluation algorithms [ACR+07 RS08] However this algorithm doesnot apply to an arbitrary span program A bound is needed on the operator norm of the entry-wiseabsolute value of the weighted adjacency matrix for a corresponding graph Further graph sparsityconditions are needed for the algorithm to be time efficient (see Theorem 24)

Unfortunately the span program from Theorem 15 will not generally satisfy these conditionsTheorem 15 gives a canonical span program ([Rei09a Def 51]) Even for a simple formula theoptimal canonical span program will typically correspond to a dense graph with large norm

An example should clarify the problem Consider the AND-OR formula ψ(x) =([(x1 and x2) or

x3] and x4

)or(x5 and [x6 or x7]

) and consider the two graphs in Figure 1 For an input x isin 0 17

modify the graphs by attaching dangling edges to every vertex j for which xj = 0 Observe thenthat each graph has an eigenvalue-zero eigenvector supported on vertex 0mdashcalled a witnessmdashif andonly if ψ(x) = 1 The graphs correspond to different span programs computing ψ and the quantumalgorithm works essentially by running a quantum walk starting at vertex 0 in order to detect thewitness The graph on the left is a significantly simplified version of a canonical span program forψ and its density still makes it difficult to implement the quantum walk

We will be guided by the second simpler graph Instead of applying Theorem 15 to ϕ as awhole we apply it separately to every gate in the formula We then compose these span programsone per gate according to the formula using direct-sum composition (Definition 25) In terms ofgraphs direct-sum composition attaches the output vertex of one span programrsquos graph to an inputvertex of the next [RS08] This leads to a graph whose structure somewhat follows the structure ofthe formula ϕ as the graph in Figure 1(b) follows the structure of ψ (However the general casewill be more complicated than shown as we are plugging together constant-size graph gadgets andthere may be duplication of some subgraphs)

Direct-sum composition keeps the maximum degree and norm of the graph under controlmdasheachis at most twice its value for the worst single gate Therefore the second [Rei09a] algorithm appliesHowever direct-sum composition also leads to additional overhead In particular a witness in thefirst graph will be supported only on numbered vertices (note that the graph is bipartite) whereasa witness in the second graph will be supported on some of the internal vertices as well This meansroughly that the second witness will be harder to detect because after normalization its overlap on

9

0

1

2

3

4

5

6

7

(a)

3

6

7

0

1

2

4

5

(b)

Figure 1 Graphs corresponding to two span programs both computing the same function

vertex 0 will be smaller Scale both witnesses so that the amplitude on vertex 0 is one The witnesssize (wsize) measures the squared length of the witness only on numbered vertices whereas the fullwitness size (fwsize) measures the squared length on all vertices For [Rei09a] it was sufficient toconsider only span program witness size because for canonical span programs like in Figure 1(a)the two measures are equal (For technical reasons we will actually define fwsize to be 1 + wsizeeven in this case) For our analysis we will need to bound the full witness size in terms of thewitness size We maintain this bound in a recursion from the formularsquos leaves toward its root

A span program is called strict if every vertex on one half of the bipartite graph is either aninput vertex (vertices 1ndash7 in the graphs of Figure 1) or the output vertex (vertex 0) Thus the firstgraph in the example above corresponds to a strict span program and the second does not Theoriginal definition of span programs in [KW93] allowed for only strict span programs This wassensible because any other vertices on the inputoutput part of the graphrsquos bipartition can alwaysbe projected away yielding a strict span program that computes the same function For developingtime-efficient quantum algorithms though it seems important to consider span programs that arenot strict Unfortunately going backwards eg from 1(a) to 1(b) is probably difficult in general

Theorem 19 does not follow from the formula-evaluation techniques of [RS08] together withTheorem 14 from [Rei09a] This tempting approach falls into intractable technical difficulties Inparticular the same span program can be used at two vertices v and w in ϕ only if gv = gw andthe general adversary bounds of vrsquos input subformulas are the same as those for wrsquos inputs upto simultaneous scaling In general then an almost-balanced formula will require an unboundednumber of different span programs However the analysis in [RS08] loses a factor that dependsbadly on the individual span programs Since the dependence is not continuous even showingthat the span programs in use all lie within a compact set would not be sufficient to obtain anO(1) upper bound In contrast the approach we follow here allows bounding the lost factor by anexponential in k uniformly over different gate imbalances

10

14 Quantum algorithm to evaluate approximately balanced AND-OR formulas

Ambainis et al [ACR+07] use a weaker balance criterion for AND-OR formulas than Definition 18They define an AND-OR formula to be approximately balanced if σminus(ϕ) = O(1) and σ+(ϕ) = O(n)Here n is the size of the formula ie the number of leaves and σminus(ϕ) and σ+(ϕ) are defined by

Definition 110 For each vertex v in a formula ϕ let

σminus(v) = maxξ

sumwisinξ

1Advplusmn(ϕw)

σ+(v) = maxξ

sumwisinξ

Advplusmn(ϕw)2 (110)

with each maximum taken over all simple paths ξ from v to a leaf Let σplusmn(ϕ) = σplusmn(r) where r isthe root of ϕ

Recall that Advplusmn(ϕ) = Adv(ϕ) =radicn for an AND-OR formula Definition 18 is a stricter

balance criterion because β-balance of a formula ϕ implies (by Lemma 32) that σminus(ϕ) and σ+(ϕ) areboth dominated by geometric series However the same steps followed by the proof of Theorem 19still suffice for proving the [ACR+07] result and in fact for strengthening it We show

Theorem 111 Let ϕ be an AND-OR formula of size n Then after polynomial-time classicalpreprocessing that does not depend on the input x ϕ(x) can be evaluated by a quantum algo-rithm with error at most 13 using O

(radicnσminus(ϕ)

)input queries The algorithmrsquos running time isradic

nσminus(ϕ)(log n)O(1) assuming unit-cost coherent access to the preprocessed string

For the special case of AND-OR formulas with σminus(ϕ) = O(1) Theorem 111 strengthens The-orem 19 The requirement that σminus(ϕ) = O(1) allows for some gates in the formula to be veryunbalanced Theorem 111 also strengthens [ACR+07 Theorem 1] because it does not require thatσ+(ϕ) = O(n) For example a formula that is biased near the root but balanced at greater depthscan have σminus(ϕ) = O(1) and σ+(ϕ) = ω(n) By substituting the bound σminus(ϕ) = O(

radicd) for a depth-

d formula [ACR+07 Def 3] a corollary of Theorem 111 is that a depth-d size-n AND-OR formulacan be evaluated using O(

radicnd) queries This improves the depth-dependence from [ACR+07] and

matches the dependence from an earlier version of that article [Amb07]The essential reason that the Definition 18 balance condition can be weakened is that for the

specific gates AND and OR by writing out the optimal span programs explicitly we can prove thatthey satisfy stronger properties than are necessarily true for other functions

2 Span programs

21 Definitions

We briefly recall some definitions from [Rei09a Sec 2] Additionally we define a span programcomplexity measure the full witness size that charges even for the ldquofreerdquo inputs This quantity isimportant for developing quantum algorithms that are time efficient as well as query efficient

For a natural number n let [n] = 1 2 n For a finite set X let CX be the inner productspace C|X| with orthonormal basis |x〉 x isin X For vector spaces V and W over C let L(VW )be the set of linear transformations from V into W and let L(V ) = L(V V ) For A isin L(VW )A is the operator norm of A For a string x isin 0 1n let x denote its bitwise complement

11

Definition 21 ([HLS05 HLS07]) For finite sets C E and D sube Cn let f D rarr E An adversarymatrix for f is a real symmetric matrix Γ isin L(CD) that satisfies 〈x|Γ|y〉 = 0 whenever f(x) = f(y)

The general adversary bound for f with costs s isin [0infin)n is

Advplusmns (f) = maxadversary matrices Γforalljisin[n] Γ∆jlesj

Γ (21)

Here Γ ∆j denotes the entry-wise matrix product between Γ and ∆j =sum

xyxj 6=yj|x〉〈y| The

(nonnegative-weight) adversary bound for f with costs s is defined by the same maximizationexcept with Γ restricted to have nonnegative entries In particular Advplusmns (f) ge Advs(f)

Letting ~1 = (1 1 1) the adversary bound for f is Adv(f) = Adv~1(f) and the generaladversary bound for f is Advplusmn(f) = Advplusmn~1 (f) By [HLS07] Q(f) = Ω(Advplusmn(f))

Definition 22 (Span program [KW93]) A span program P consists of a natural number n afinite-dimensional inner product space V over C a ldquotargetrdquo vector |t〉 isin V disjoint sets Ifree andIjb for j isin [n] b isin 0 1 and ldquoinput vectorsrdquo |vi〉 isin V for i isin Ifree cup

⋃jisin[n]bisin01 Ijb

To P corresponds a function fP 0 1n rarr 0 1 defined on x isin 0 1n by

fP (x) =

1 if |t〉 isin Span(|vi〉 i isin Ifree cup

⋃jisin[n] Ijxj)

0 otherwise(22)

Some additional notation is convenient Fix a span program P Let I = Ifreecup⋃jisin[n]bisin01 Ijb

Let A isin L(CI V ) be given by A =sum

iisinI |vi〉〈i| For x isin 0 1n let I(x) = Ifree cup⋃jisin[n] Ijxj and

Π(x) =sum

iisinI(x) |i〉〈i| isin L(CI) Then fP (x) = 1 if |t〉 isin Range(AΠ(x)) A vector |w〉 isin CI is saidto be a witness for fP (x) = 1 if Π(x)|w〉 = |w〉 and A|w〉 = |t〉 A vector |wprime〉 isin V is said to be awitness for fP (x) = 0 if 〈t|wprime〉 = 1 and Π(x)Adagger|wprime〉 = 0

Definition 23 (Witness size) Consider a span program P and a vector s isin [0infin)n of nonnegativeldquocostsrdquo Let S =

sumjisin[n]bisin01iisinIjb

radicsj |i〉〈i| isin L(CI) For each input x isin 0 1n define the witness

size of P on x with costs s wsizes(P x) as follows

wsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉 S|w〉2 if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

SAdagger|wprime〉2 if fP (x) = 0 (23)

The witness size of P with costs s is

wsizes(P ) = maxxisin01n

wsizes(P x) (24)

Define the full witness size fwsizes(P ) by letting Sf = S +sum

iisinIfree|i〉〈i| and

fwsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉(1 + Sf |w〉2) if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

(|wprime〉2 + SAdagger|wprime〉2) if fP (x) = 0 (25)

fwsizes(P ) = maxxisin01n

fwsizes(P x) (26)

When the subscript s is omitted the costs are taken to be uniform s = ~1 = (1 1 1) egfwsize(P ) = fwsize~1(P ) The witness size is defined in [RS08] The full witness size is definedin [Rei09a Sec 8] but is not named there A strict span program has Ifree = empty so Sf = S and amonotone span program has Ij0 = empty for all j [Rei09a Def 49]

12

22 Quantum algorithm to evaluate a span program based on its full witness size

[Rei09a Theorem 93] gives a quantum query algorithm for evaluating span programs based on thefull witness size The algorithm is based on a quantum walk on a certain graph Provided that thedegree of the graph is not too large it can actually be implemented efficiently

Theorem 24 ([Rei09a Theorem 93]) Let P be a span program Then fP can be evaluated using

T = O(fwsize(P ) abs(AGP

))

(27)

quantum queries with error probability at most 13 Moreover if the maximum degree of a vertexin GP is d then the time complexity of the algorithm for evaluating fP is at most a factor of(log d)

(log(T log d)

)O(1) worse after classical preprocessing and assuming constant-time coherentaccess to the preprocessed string

Proof sketch The query complexity claim is actually slightly weaker than [Rei09a Theorem 93]which allows the target vector to be scaled downward by a factor of

radicfwsize(P )

The time-complexity claim will follow from the proof of [Rei09a Theorem 93] in [Rei09aProp 94 Theorem 95] The algorithm for evaluating fP (x) uses a discrete-time quantum walkon the graph GP (x) If the maximum degree of a vertex in GP is d then each coin reflec-tion can be implemented using O(log d) single-qubit unitaries and queries to the preprocessedstring [GR02 CNW09] Finally the

(log(T log d)

)O(1) factor comes from applying the Solovay-Kitaev Theorem [KSV02] to compile the single-qubit unitaries into products of elementary gatesto precision 1O(T log d)

We remark that together with [Rei09a Theorem 31] Theorem 24 gives a way of transforming aone-sided-error quantum algorithm into a span program and back into a quantum algorithm suchthat the time complexity is nearly preserved after preprocessing This is only a weak equivalencebecause aside from requiring preprocessing the algorithm from Theorem 24 also has two-sided errorTo some degree though it complements the equivalence results for best span program witness sizeand bounded-error quantum query complexity [Rei09a Theorem 71 Theorem 92]

23 Direct-sum span program composition

Let us study the full witness size of the direct-sum composition of span programs We begin byrecalling the definition of direct-sum composition

Let f 0 1n rarr 0 1 and S sube [n] For j isin [n] let mj be a natural number with mj = 1 forj isin S For j isin S let fj 0 1mj rarr 0 1 Define y 0 1m1 times middot middot middot times 0 1mn rarr 0 1n by

y(x)j =

fj(xj) if j isin Sxj if j isin S

(28)

Define g 0 1m1 times middot middot middottimes 0 1mn rarr 0 1 by g(x) = f(y(x)) For example if S = [n] r 1 then

g(x) = f(x1 f2(x2) fn(xn)

) (29)

Given span programs for the individual functions f and fj for j isin S we will construct a spanprogram for g We remark that although we are here requiring that the inner functions fj act on

13

disjoint sets of bits this assumption is not necessary for the definition It simplifies the notationthough for the cases S 6= [n] and will suffice for our applications

Let P be a span program computing fP = f Let P have inner product space V target vector|t〉 and input vectors |vi〉 indexed by Ifree and Ijc for j isin [n] and c isin 0 1

For j isin [n] let sj isin [0infin)mj be a vector of costs and let s isin [0infin)Pmj be the concatenation of

the vectors sj For j isin S let P j0 and P j1 be span programs computing fP j1 = fj 0 1mj rarr 0 1and fP j0 = notfj with rj = wsizesj (P j0) = wsizesj (P j1) For c isin 0 1 let P jc have inner productspace V jc with target vector |tjc〉 and input vectors indexed by Ijcfree and Ijckb for k isin [mj ] b isin 0 1For j isin S let rj = sj

Let IS =⋃jisinScisin01 Ijc Define ς IS rarr [n]times 0 1 by ς(i) = (j c) if i isin Ijc The idea is that

ς maps i to the input span program that must evaluate to 1 in order for |vi〉 to be available in P There are several ways of composing the span programs P and P jc to obtain a span program Q

computing the composed function fQ = g with wsizes(Q) le wsizer(P ) [Rei09a Defs 44 45 46]We focus on direct-sum composition

Definition 25 ([Rei09a Def 45]) The direct-sum-composed span program Qoplus is defined by

bull The inner product space is V oplus = V oplusoplus

jisinScisin01(CIjc otimes V jc) Any vector in V oplus can be

uniquely expressed as |u〉V +sum

iisinIS |i〉 otimes |ui〉 where |u〉 isin V and |ui〉 isin V ς(i)

bull The target vector is |toplus〉 = |t〉V

bull The free input vectors are indexed by Ioplusfree = Ifree cup IS cup⋃jisinScisin01(Ijc times Ijcfree) with for

i isin Ioplusfree

|voplusi 〉 =

|vi〉V if i isin Ifree

|vi〉V minus |i〉 otimes |tjc〉 if i isin Ijc and j isin S|iprime〉 otimes |viprimeprime〉 if i = (iprime iprimeprime) isin Ijc times Ijcfree

(210)

bull The other input vectors are indexed by Ioplus(jk)b for j isin [n] k isin [mj ] b isin 0 1 For j isin S

Ioplus(j1)b = Ijb with |voplusi 〉 = |vi〉V for i isin Ioplus(j1)b For j isin S let Ioplus(jk)b =⋃cisin01(Ijc times I

jckb) For

i isin Ijc and iprime isin Ijckb let|voplusiiprime〉 = |i〉 otimes |viprime〉 (211)

By [Rei09a Theorem 43] fQoplus = g and wsizes(Qoplus) le wsizer(P ) (While that theorem is statedonly for the case S = [n] it is trivially extended to other S sub [n]) We give a bound on how quicklythe full witness size can grow relative to the witness size

Lemma 26 Under the above conditions for each input x isin 0 1m1timesmiddot middot middottimes0 1mn with y = y(x)

bull If g(x) = 1 let |w〉 be a witness to fP (y) = 1 such thatsum

jisin[n]iisinIjyjrj |wi|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |w〉

)+

1 +sum

iisinIfree|wi|2

wsizer(P y)

where σ(y |w〉) = maxjisinS

existi isin Ijyj with 〈i|w〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(212)

14

bull If g(x) = 0 let |wprime〉 be a witness to fP (y) = 0 such thatsum

jisin[n]iisinIjyjrj |〈wprime|vi〉|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |wprime〉) +|wprime〉2

wsizer(P y)

where σ(y |wprime〉) = maxjisinS

existi isin Ijyj with 〈vi|wprime〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(213)

If S = empty then σ(y |w〉) and σ(y |wprime〉) should each be taken to be 1 in the above equations

Proof We follow the proof of [Rei09a Theorem 43] except keeping track of the full witness sizeNote that if S = empty then Eqs (212) and (213) are immediate by definition of fwsizes(Qoplus x)

Let I(y)prime = I(y) r Ifree =⋃jisin[n] Ijyj

In the first case g(x) = 1 for j isin S let |wjyj 〉 isin CIjyj be a witness to fP jyj (xj) = 1 such that

fwsizes(P jyj xj) = 1 +sum

iisinIjyjfree

|wjyj

i |2

+sum

kisin[mj ]iisinIjyjk(xj)k

(sj)k|wjyj

i |2 As in [Rei09a Theorem 43]

let |woplus〉 isin CIoplus(x) be given by

woplusi =

wi if i isin I(y)

wiprimewς(iprime)iprimeprime if i = (iprime iprimeprime) with iprime isin I(y)prime cap IS iprimeprime isin Iς(iprime)(x)

0 otherwise

(214)

Then |woplus〉 is a witness for fQoplus(x) = 1 and we compute

fwsizes(Qoplus x) le 1 +sumiisinIoplusfree

|woplusi |2 +

sumjisin[n]kisin[mj ]

iisinIoplus(jk)(xj)k

(sj)k|woplusi |2

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 (215)

+sum

jisinSiisinIjyj

|wi|2(

1 +sum

iprimeisinIjyjfree

|wjyj

iprime |2 +

sumkisin[mj ]iprimeisinI

jyjk(xj)k

(sj)k|wjyj

iprime |2

)

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 +sum

jisinSiisinIjyj

|wi|2 fwsizesj (P jyj xj)

Eq (212) follows using the bound fwsizesj (P jyj xj) le σ(y |w〉)rj for j isin S and sj = rj for j isin SNext consider the case g(x) = 0 For j isin S let |ujyj 〉 isin V jyj be a witness for f

P jyj (xj) = 0 withfwsizes(P jyj xj) = |ujyj 〉2 +

sumkisin[mj ]iisinI

jyj

k(xj)k

(sj)k|〈vi|ujyj 〉|2 As in [Rei09a Theorem 43] let

|uoplus〉 = |wprime〉V +sum

iisinISrI(y)

〈vi|wprime〉|i〉 otimes |uς(i)〉 (216)

15

Then |uoplus〉 is a witness for fQoplus(x) = 0 and moreover

fwsizes(Qoplus x) le |uoplus〉2 +sum

jisin[n]kisin[mj ]iisinIoplus(jk)(xj)k

(sj)k|〈voplusi |uoplus〉|2

= |uoplus〉2 +sum

jisin[n]rSiisinIjxj

sj |〈voplusi |uoplus〉|2 +

sumjisinSkisin[mj ]

iisinIjyjiprimeisinI

jyj

k(xj)k

(sj)k|〈voplusiiprime |uoplus〉|2

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

sj |〈vi|wprime〉|2 (217)

+sum

jisinSiisinIjyj

|〈vi|wprime〉|2(|ujyj 〉2 +

sumkisin[mj ]iprimeisinI

jyj

k(xj)k

(sj)k|〈viprime |ujyj 〉|2)

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

rj |〈vi|wprime〉|2 +sum

jisinSiisinIjyj

|〈vi|wprime〉|2 fwsizesj (P jyj xj)

Eq (213) follows using the bound fwsizesj (P jyj xj) le σ(y |wprime〉)rj for j isin S

Lemma 26 is a key step in the formula-evaluation results in this article and [Rei09b] Itis used to track the full witness size for span programs recursively composed in a direct-summanner along a formula The proof of Theorem 19 will require the lemma with the weakerbounds σ(y |w〉) σ(y |wprime〉) le maxjisinScisin01 fwsizesj (P jc)wsizesj (P jc) Theorem 111 will useonly the slightly stronger bounds σ(y |w〉) le maxjisinS fwsizesj (P jyj )wsizesj (P jyj ) σ(y |wprime〉) lemaxjisinS fwsizesj (P jyj )wsizesj (P jyj ) However the proof of [Rei09b Theorem 11] will require thebounds of Eqs (212) and (213)

3 Evaluation of almost-balanced formulas

In this section we will apply the span program framework from [Rei09a] to prove Theorem 19Our algorithm will be given by applying Theorem 24 to a certain span program Before beginningthe proof though we will give two necessary lemmas

Consider a span program P with corresponding weighted graph GP from [Rei09a Def 82]We will need a bound on the operator norm of abs(AGPv

) the entry-wise absolute value of theweighted adjacency matrix AGPv

If P is canonical [Rei09a Def 51] then we can indeed obtainsuch a bound in terms of the witness size of P

Lemma 31 Let s isin (0infin)k and let P be a canonical span program computing a function f 0 1k rarr 0 1 with input vectors indexed by the set I Assume that for each x isin 0 1k withf(x) = 0 an optimal witness to fP (x) = 0 is |x〉 itself Then

abs(AGP) le 2k

(1 +

wsizes(P )minjisin[k] sj

)+ |I| (31)

16

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 5: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

implemented efficiently on a quantum computer given a classical circuit that computes the func-tion j 7rarr xj [NC00] For a function f 0 1n rarr 0 1 let Q(f) be the number of input queriesrequired to evaluate f with error probability at most 13 It is immediate that Q(f) le R2(f)

Research on the formula-evaluation problem in the quantum model began with the n-bit ORfunction ORn Grover gave a quantum algorithm for evaluating ORn with bounded one-sided errorusing O(

radicn) oracle queries and O(

radicn log log n) time [Gro96 Gro02] In the classical case on the

other hand it is obvious that R2(ORn) R(ORn) and D(ORn) are all Θ(n)Groverrsquos algorithm can be applied recursively to speed up the evaluation of more general AND-

OR formulas Call a formula layered if the gates at the same depth are the same Buhrman Cleveand Wigderson show that a layered depth-d size-n AND-OR formula can be evaluated usingO(radicn logdminus1 n) queries [BCW98] The logarithmic factors come from using repetition at each level

to reduce the error probability from a constant to be polynomially smallHoslashyer Mosca and de Wolf [HMW03] consider the case of a unitary input oracle Ox that maps

Ox |ϕ〉 otimes |j〉 otimes |b〉 otimes |0〉 7rarr |ϕ〉 otimes |j〉 otimes(|boplus xj〉 otimes |ψxjxj 〉+ |boplus xj〉 otimes |ψxjxj 〉

) (12)

where |ψxjxj 〉 |ψxjxj 〉 are pure states with |ψxjxj 〉2 ge 23 Such an oracle can be implemented

when the function j 7rarr xj is computed by a bounded-error randomized subroutine Hoslashyer et alallow access to Ox and Ominus1

x both at unit cost and show that ORn can still be evaluated usingO(radicn) queries This robustness result implies that the log n steps of repetition used by [BCW98]

are not necessary and a depth-d layered AND-OR formula can be computed in O(radicn cdminus1) queries

for some constant c gt 1000 If the depth is constant this gives an O(radicn)-query quantum algorithm

but the result is not useful for the complete binary AND-OR formula for which d = log2 nIn 2007 Farhi Goldstone and Gutmann presented a quantum algorithm for evaluating com-

plete binary AND-OR formulas [FGG07] Their breakthrough algorithm is not based on iteratingGroverrsquos algorithm in any way but instead runs a quantum walkmdashanalogous to a classical ran-dom walkmdashon a graph based on the formula The algorithm runs in time O(

radicn) in a certain

continuous-time query modelAmbainis et al discretized the [FGG07] algorithm by reinterpreting a correspondence between

(discrete-time) random and quantum walks due to Szegedy [Sze04] as a correspondence betweencontinuous-time and discrete-time quantum walks [ACR+07] Applying this correspondence toquantum walks on certain weighted graphs they gave an O(

radicn)-query quantum algorithm for

evaluating ldquoapproximately balancedrdquo AND-OR formulas For example MAJ3(x1 x2 x3) = (x1 andx2) or

((x1 or x2) and x3

) so there is a size-5d AND-OR formula that computes MAJ3

d the completeternary majority formula of depth d Since the formula is approximately balanced Q(MAJ3

d) =O(radic

5d) better than the Ω

((73)d

)classical lower bound

The [ACR+07] algorithm also applies to arbitrary AND-OR formulas If ϕ has size n anddepth d then the algorithm applied directly evaluates ϕ using O(

radicnd) queries1 This can be as

bad as O(n32) if the depth is d = n However Bshouty Cleve and Eberly have given a formularebalancing procedure that takes AND-OR formula ϕ as input and outputs an equivalent AND-ORformula ϕprime with depth dprime = 2O(

radiclogn) and size nprime = n 2O(

radiclogn) [BCE91 BB94] The formula ϕprime

can then be evaluated using O(radicnprime dprime) =

radicn 2O(

radiclogn) queries

Our understanding of lower bounds for the formula-evaluation problem progressed in parallel1Actually [ACR+07 Sec 7] only shows a bound of O(

radicnd32) queries but this can be improved to O(

radicnd)

using the bounds on σplusmn(ϕ) below [ACR+07 Def 1]

5

to this progress on quantum algorithms There are essentially two techniques the polynomial andadversary methods for lower-bounding quantum query complexity

bull The polynomial method introduced in the quantum setting by Beals et al [BBC+01] is basedon the observation that after making q oracle Ox queries the probability of any measurementresult is a polynomial of degree at most 2q in the variables xj

bull Ambainis generalized the classical hybrid argument to consider the systemrsquos entanglementwhen run on a superposition of inputs [Amb02] A number of variants of Ambainisrsquos boundwere soon discovered including weighted versions [HNS02 BS04 Amb06 Zha05] a spectralversion [BSS03] and a version based on Kolmogorov complexity [LM04] These variants canbe asymptotically stronger than Ambainisrsquos original unweighted bound but are equivalent toeach other [SS06] We therefore term it simply ldquothe adversary boundrdquo denoted by Adv

The adversary bound is well-suited for lower-bounding the quantum query complexity for eval-uating formulas For example Barnum and Saks proved that for any size-n AND-OR formula ϕAdv(ϕ) =

radicn implying the lower bound Q(ϕ) = Ω(

radicn) [BS04] Thus the [ACR+07] algorithm is

optimal for approximately balanced AND-OR formulas and is nearly optimal for arbitrary AND-OR formulas This is a considerably more complete solution than is known classically

It is then natural to consider formulas over larger gate sets The adversary bound continues towork well because it transforms nicely under function composition

Theorem 11 (Adversary bound composition [Amb06 LLS06 HLS05]) Let f 0 1k rarr 0 1and let fj 0 1mj rarr 0 1 for j = 1 2 k Define g 0 1m1 times middot middot middot times 0 1mk rarr 0 1 byg(x) = f

(f1(x1) fk(xk)

) Let s = (Adv(f1) Adv(fk)) Then

Adv(g) = Advs(f) (13)

See Definition 21 for the definition of the adversary bound with ldquocostsrdquo Advs The Adv boundequals Advs with uniform unit costs s = ~1 For a function f Adv(f) can be computed using asemi-definite program in time polynomial in the size of f rsquos truth table Therefore Theorem 11gives a polynomial-time procedure for computing the adversary bound for a formula ϕ over anarbitrary finite gate set compute the bounds for subformulas moving from the leaves toward theroot At an internal node f having computed the adversary bounds for the input subformulasf1 fk Eq (13) says that the adversary bound for g the subformula rooted at f equals theadversary bound for the gate f with certain costs Computing this requires 2O(k) time which is aconstant if k = O(1) For example if f is an ORk or ANDk gate then Adv(s1sk)(f) =

radicsumj s

2j

from which follows immediately the [BS04] result Adv(ϕ) =radicn for a size-n AND-OR formula ϕ

A special case of Theorem 11 is when the functions fj all have equal adversary bounds soAdv(g) = Adv(f)Adv(f1) In particular for a function f 0 1k rarr 0 1 and a natural numberd isin N let fd 0 1kd rarr 0 1 denote the complete depth-d formula over f That is f1 = f andfd(x) = f

(fdminus1(x1 xkdminus1) fdminus1(xkdminuskdminus1+1 xkd)

)for d gt 1 Then we obtain

Corollary 12 For any function f 0 1k rarr 0 1

Adv(fd) = Adv(f)d (14)

6

In particular Ambainis defined a boolean function f 0 14 rarr 0 1 that can be representedexactly by a polynomial of degee two but for which Adv(f) = 52 [Amb06] Thus fd can berepresented exactly by a polynomial of degree 2d but by Corollary 12 Adv(fd) = (52)d For thisfunction the adversary bound is strictly stronger than any bound obtainable using the polynomialmethod Many similar examples are given in [HLS06] However for other functions the adversarybound is asymptotically worse than the polynomial method [SS06 AS04 Amb05]

In 2007 though Hoslashyer et al discovered a strict generalization of Adv that also lower-boundsquantum query complexity [HLS07] We call this new bound the general adversary bound or AdvplusmnFor example for Ambainisrsquos four-bit function f Advplusmn(f) ge 251 [HLS06] Like the adversarybound Advplusmns (f) can be computed in time polynomial in the size of f rsquos truth table and alsocomposes nicely

Theorem 13 ([HLS07 Rei09a]) Under the conditions of Theorem 11

Advplusmn(g) = Advplusmns (f) (15)

In particular if Advplusmn(f1) = middot middot middot = Advplusmn(fk) then Advplusmn(g) = Advplusmn(f) Advplusmn(f1)

Define a formula ϕ to be adversary balanced if at each internal node the general adversarybounds of the input subformulas are equal In particular by Theorem 13 this implies that Advplusmn(ϕ)is equal to the product of the general adversary bounds of the gates along any path from the rootto a leaf Complete layered formulas are an example of adversary-balanced formulas

Returning to upper bounds Reichardt and Spalek [RS08] generalized the algorithmic approachstarted by [FGG07] They gave an optimal quantum algorithm for evaluating adversary-balancedformulas over a considerably extended gate set including in particular all functions 0 1k rarr 0 1for k le 3 69 inequivalent four-bit functions and the gates ANDk ORk PARITYk and EQUALkfor k = O(1) For example Q(MAJ3

d) = Θ(2d)The [RS08] result follows from a framework for developing formula-evaluation quantum algo-

rithms based on span programs A span program introduced by Karchmer and Wigderson [KW93]is a certain linear-algebraic way of defining a function which corresponds closely to eigenvalue-zeroeigenvectors of certain bipartite graphs [RS08] derived a quantum algorithm for evaluating certainconcatenated span programs with a query complexity upper-bounded by the span program witnesssize denoted wsize In particular a special case of [RS08 Theorem 47] is

Theorem 14 ([RS08]) Fix a function f 0 1k rarr 0 1 If span program P computes f then

Q(fd) = O(wsize(P )d

) (16)

From Theorem 13 this result is optimal if wsize(P ) = Advplusmn(f) The question thereforebecomes how to find optimal span programs Using an ad hoc search [RS08] found optimal spanprograms for a variety of functions with Advplusmn = Adv Further work automated the search bygiving a semi-definite program (SDP) for the optimal span program witness size for any givenfunction [Rei09a] Remarkably the SDPrsquos value always equals the general adversary bound

Theorem 15 ([Rei09a]) For any function f 0 1n rarr 0 1

infP

wsize(P ) = Advplusmn(f) (17)

where the infimum is over span programs P computing f Moreover this infimum is achieved

7

This result greatly extends the gate set over which the formula-evaluation algorithm of [RS08]works optimally For example combined with Theorem 14 it implies that limdrarrinfinQ(fd)1d =Advplusmn(f) for every boolean function f More generally Theorem 15 allows the [RS08] algorithmto be run on formulas over any finite gate set S A factor is lost that depends on the gates in Sbut it will be a constant for S finite Combining Theorem 15 with [RS08 Theorem 47] gives

Theorem 16 ([Rei09a]) Let S be a finite set of gates Then there exists a quantum algorithm thatevaluates an adversary-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After efficient

classical preprocessing independent of the input x and assuming unit-time coherent access to thepreprocessed classical string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

In the discussion so far we have for simplicity focused on query complexity The query com-plexity is an information-theoretic quantity that does not charge for operations independent of theinput string even though these operations may require many elementary gates to implement Forpractical algorithms it is important to be able to bound the algorithmrsquos running time which countsthe cost of implementing the input-independent operations Theorem 16 puts an optimal boundon the query complexity and also puts a nearly optimal bound on the algorithmrsquos time complexityIn fact all of the query-optimal algorithms so far discussed are also nearly time optimal

In general though an upper bound on the query complexity does not imply an upper boundon the time complexity Ref [Rei09a] also generalized the span program framework of [RS08] toapply to quantum algorithms not based on formulas The main result of [Rei09a] is

Theorem 17 ([Rei09a]) For any function f D rarr 1 2 m with D sube 0 1n Q(f) satisfies

Q(f) = Ω(Advplusmn(f)) and Q(f) = O

(Advplusmn(f)

log Advplusmn(f)log log Advplusmn(f)

log(m) log logm) (18)

Theorem 17 in particular allows us to compute the query complexity of formulas up to thelogarithmic factor It does not give any guarantees on running time However the analysis requiredto prove Theorem 17 also leads to significantly simpler proofs of Theorem 16 and the AND-ORformula results of [ACR+07 FGG07] Moreover we will see that it allows the formula-evaluationalgorithms to be extended to formulas that are not adversary balanced

13 Quantum algorithm for evaluating almost-balanced formulas

We give a formula-evaluation algorithm that is both query-optimal without a logarithmic overheadand after an efficient preprocessing step nearly time optimal Define almost balance as follows

Definition 18 Consider a formula ϕ over a gate set S For a vertex v in the correspondingtree let ϕv denote the subformula of ϕ rooted at v and if v is an internal vertex let gv be thecorresponding gate The formula ϕ is β-balanced if for every vertex v with children c1 c2 ck

maxj Advplusmn(ϕcj )minj Advplusmn(ϕcj )

le β (19)

(If cj is a leaf Advplusmn(ϕcj ) = 1) Formula ϕ is almost balanced if it is β-balanced for some β = O(1)

In particular an adversary-balanced formula is 1-balanced We will show

8

Theorem 19 Let S be a fixed finite set of gates Then there exists a quantum algorithm thatevaluates an almost-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After polynomial-

time classical preprocessing independent of the input and assuming unit-time coherent access tothe preprocessed string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

Theorem 19 is significantly stronger than Theorem 16 which requires exact balance Thereare important classes of exactly balanced formulas such as complete layered formulas In fact it issufficient that the multiset of gates along the simple path from the root to a leaf not depend on theleaf Moreover sometimes different gates have the same Advplusmn bound see [HLS06] for examplesEven still exact adversary balance is a very strict condition

The proof of Theorem 19 is based on the span program framework developed in Ref [Rei09a]In particular [Rei09a Theorem 91] gives two quantum algorithms for evaluating span programsThe first algorithm is based on a discrete-time simulation of a continuous-time quantum walkIt applies to arbitrary span programs and is used in combination with Theorem 15 to proveTheorem 17 However the simulation incurs a logarithmic query overhead and potentially worsetime complexity overhead so this algorithm is not suitable for proving Theorem 19

The second algorithm in [Rei09a] is based directly on a discrete-time quantum walk similarto previous optimal formula-evaluation algorithms [ACR+07 RS08] However this algorithm doesnot apply to an arbitrary span program A bound is needed on the operator norm of the entry-wiseabsolute value of the weighted adjacency matrix for a corresponding graph Further graph sparsityconditions are needed for the algorithm to be time efficient (see Theorem 24)

Unfortunately the span program from Theorem 15 will not generally satisfy these conditionsTheorem 15 gives a canonical span program ([Rei09a Def 51]) Even for a simple formula theoptimal canonical span program will typically correspond to a dense graph with large norm

An example should clarify the problem Consider the AND-OR formula ψ(x) =([(x1 and x2) or

x3] and x4

)or(x5 and [x6 or x7]

) and consider the two graphs in Figure 1 For an input x isin 0 17

modify the graphs by attaching dangling edges to every vertex j for which xj = 0 Observe thenthat each graph has an eigenvalue-zero eigenvector supported on vertex 0mdashcalled a witnessmdashif andonly if ψ(x) = 1 The graphs correspond to different span programs computing ψ and the quantumalgorithm works essentially by running a quantum walk starting at vertex 0 in order to detect thewitness The graph on the left is a significantly simplified version of a canonical span program forψ and its density still makes it difficult to implement the quantum walk

We will be guided by the second simpler graph Instead of applying Theorem 15 to ϕ as awhole we apply it separately to every gate in the formula We then compose these span programsone per gate according to the formula using direct-sum composition (Definition 25) In terms ofgraphs direct-sum composition attaches the output vertex of one span programrsquos graph to an inputvertex of the next [RS08] This leads to a graph whose structure somewhat follows the structure ofthe formula ϕ as the graph in Figure 1(b) follows the structure of ψ (However the general casewill be more complicated than shown as we are plugging together constant-size graph gadgets andthere may be duplication of some subgraphs)

Direct-sum composition keeps the maximum degree and norm of the graph under controlmdasheachis at most twice its value for the worst single gate Therefore the second [Rei09a] algorithm appliesHowever direct-sum composition also leads to additional overhead In particular a witness in thefirst graph will be supported only on numbered vertices (note that the graph is bipartite) whereasa witness in the second graph will be supported on some of the internal vertices as well This meansroughly that the second witness will be harder to detect because after normalization its overlap on

9

0

1

2

3

4

5

6

7

(a)

3

6

7

0

1

2

4

5

(b)

Figure 1 Graphs corresponding to two span programs both computing the same function

vertex 0 will be smaller Scale both witnesses so that the amplitude on vertex 0 is one The witnesssize (wsize) measures the squared length of the witness only on numbered vertices whereas the fullwitness size (fwsize) measures the squared length on all vertices For [Rei09a] it was sufficient toconsider only span program witness size because for canonical span programs like in Figure 1(a)the two measures are equal (For technical reasons we will actually define fwsize to be 1 + wsizeeven in this case) For our analysis we will need to bound the full witness size in terms of thewitness size We maintain this bound in a recursion from the formularsquos leaves toward its root

A span program is called strict if every vertex on one half of the bipartite graph is either aninput vertex (vertices 1ndash7 in the graphs of Figure 1) or the output vertex (vertex 0) Thus the firstgraph in the example above corresponds to a strict span program and the second does not Theoriginal definition of span programs in [KW93] allowed for only strict span programs This wassensible because any other vertices on the inputoutput part of the graphrsquos bipartition can alwaysbe projected away yielding a strict span program that computes the same function For developingtime-efficient quantum algorithms though it seems important to consider span programs that arenot strict Unfortunately going backwards eg from 1(a) to 1(b) is probably difficult in general

Theorem 19 does not follow from the formula-evaluation techniques of [RS08] together withTheorem 14 from [Rei09a] This tempting approach falls into intractable technical difficulties Inparticular the same span program can be used at two vertices v and w in ϕ only if gv = gw andthe general adversary bounds of vrsquos input subformulas are the same as those for wrsquos inputs upto simultaneous scaling In general then an almost-balanced formula will require an unboundednumber of different span programs However the analysis in [RS08] loses a factor that dependsbadly on the individual span programs Since the dependence is not continuous even showingthat the span programs in use all lie within a compact set would not be sufficient to obtain anO(1) upper bound In contrast the approach we follow here allows bounding the lost factor by anexponential in k uniformly over different gate imbalances

10

14 Quantum algorithm to evaluate approximately balanced AND-OR formulas

Ambainis et al [ACR+07] use a weaker balance criterion for AND-OR formulas than Definition 18They define an AND-OR formula to be approximately balanced if σminus(ϕ) = O(1) and σ+(ϕ) = O(n)Here n is the size of the formula ie the number of leaves and σminus(ϕ) and σ+(ϕ) are defined by

Definition 110 For each vertex v in a formula ϕ let

σminus(v) = maxξ

sumwisinξ

1Advplusmn(ϕw)

σ+(v) = maxξ

sumwisinξ

Advplusmn(ϕw)2 (110)

with each maximum taken over all simple paths ξ from v to a leaf Let σplusmn(ϕ) = σplusmn(r) where r isthe root of ϕ

Recall that Advplusmn(ϕ) = Adv(ϕ) =radicn for an AND-OR formula Definition 18 is a stricter

balance criterion because β-balance of a formula ϕ implies (by Lemma 32) that σminus(ϕ) and σ+(ϕ) areboth dominated by geometric series However the same steps followed by the proof of Theorem 19still suffice for proving the [ACR+07] result and in fact for strengthening it We show

Theorem 111 Let ϕ be an AND-OR formula of size n Then after polynomial-time classicalpreprocessing that does not depend on the input x ϕ(x) can be evaluated by a quantum algo-rithm with error at most 13 using O

(radicnσminus(ϕ)

)input queries The algorithmrsquos running time isradic

nσminus(ϕ)(log n)O(1) assuming unit-cost coherent access to the preprocessed string

For the special case of AND-OR formulas with σminus(ϕ) = O(1) Theorem 111 strengthens The-orem 19 The requirement that σminus(ϕ) = O(1) allows for some gates in the formula to be veryunbalanced Theorem 111 also strengthens [ACR+07 Theorem 1] because it does not require thatσ+(ϕ) = O(n) For example a formula that is biased near the root but balanced at greater depthscan have σminus(ϕ) = O(1) and σ+(ϕ) = ω(n) By substituting the bound σminus(ϕ) = O(

radicd) for a depth-

d formula [ACR+07 Def 3] a corollary of Theorem 111 is that a depth-d size-n AND-OR formulacan be evaluated using O(

radicnd) queries This improves the depth-dependence from [ACR+07] and

matches the dependence from an earlier version of that article [Amb07]The essential reason that the Definition 18 balance condition can be weakened is that for the

specific gates AND and OR by writing out the optimal span programs explicitly we can prove thatthey satisfy stronger properties than are necessarily true for other functions

2 Span programs

21 Definitions

We briefly recall some definitions from [Rei09a Sec 2] Additionally we define a span programcomplexity measure the full witness size that charges even for the ldquofreerdquo inputs This quantity isimportant for developing quantum algorithms that are time efficient as well as query efficient

For a natural number n let [n] = 1 2 n For a finite set X let CX be the inner productspace C|X| with orthonormal basis |x〉 x isin X For vector spaces V and W over C let L(VW )be the set of linear transformations from V into W and let L(V ) = L(V V ) For A isin L(VW )A is the operator norm of A For a string x isin 0 1n let x denote its bitwise complement

11

Definition 21 ([HLS05 HLS07]) For finite sets C E and D sube Cn let f D rarr E An adversarymatrix for f is a real symmetric matrix Γ isin L(CD) that satisfies 〈x|Γ|y〉 = 0 whenever f(x) = f(y)

The general adversary bound for f with costs s isin [0infin)n is

Advplusmns (f) = maxadversary matrices Γforalljisin[n] Γ∆jlesj

Γ (21)

Here Γ ∆j denotes the entry-wise matrix product between Γ and ∆j =sum

xyxj 6=yj|x〉〈y| The

(nonnegative-weight) adversary bound for f with costs s is defined by the same maximizationexcept with Γ restricted to have nonnegative entries In particular Advplusmns (f) ge Advs(f)

Letting ~1 = (1 1 1) the adversary bound for f is Adv(f) = Adv~1(f) and the generaladversary bound for f is Advplusmn(f) = Advplusmn~1 (f) By [HLS07] Q(f) = Ω(Advplusmn(f))

Definition 22 (Span program [KW93]) A span program P consists of a natural number n afinite-dimensional inner product space V over C a ldquotargetrdquo vector |t〉 isin V disjoint sets Ifree andIjb for j isin [n] b isin 0 1 and ldquoinput vectorsrdquo |vi〉 isin V for i isin Ifree cup

⋃jisin[n]bisin01 Ijb

To P corresponds a function fP 0 1n rarr 0 1 defined on x isin 0 1n by

fP (x) =

1 if |t〉 isin Span(|vi〉 i isin Ifree cup

⋃jisin[n] Ijxj)

0 otherwise(22)

Some additional notation is convenient Fix a span program P Let I = Ifreecup⋃jisin[n]bisin01 Ijb

Let A isin L(CI V ) be given by A =sum

iisinI |vi〉〈i| For x isin 0 1n let I(x) = Ifree cup⋃jisin[n] Ijxj and

Π(x) =sum

iisinI(x) |i〉〈i| isin L(CI) Then fP (x) = 1 if |t〉 isin Range(AΠ(x)) A vector |w〉 isin CI is saidto be a witness for fP (x) = 1 if Π(x)|w〉 = |w〉 and A|w〉 = |t〉 A vector |wprime〉 isin V is said to be awitness for fP (x) = 0 if 〈t|wprime〉 = 1 and Π(x)Adagger|wprime〉 = 0

Definition 23 (Witness size) Consider a span program P and a vector s isin [0infin)n of nonnegativeldquocostsrdquo Let S =

sumjisin[n]bisin01iisinIjb

radicsj |i〉〈i| isin L(CI) For each input x isin 0 1n define the witness

size of P on x with costs s wsizes(P x) as follows

wsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉 S|w〉2 if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

SAdagger|wprime〉2 if fP (x) = 0 (23)

The witness size of P with costs s is

wsizes(P ) = maxxisin01n

wsizes(P x) (24)

Define the full witness size fwsizes(P ) by letting Sf = S +sum

iisinIfree|i〉〈i| and

fwsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉(1 + Sf |w〉2) if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

(|wprime〉2 + SAdagger|wprime〉2) if fP (x) = 0 (25)

fwsizes(P ) = maxxisin01n

fwsizes(P x) (26)

When the subscript s is omitted the costs are taken to be uniform s = ~1 = (1 1 1) egfwsize(P ) = fwsize~1(P ) The witness size is defined in [RS08] The full witness size is definedin [Rei09a Sec 8] but is not named there A strict span program has Ifree = empty so Sf = S and amonotone span program has Ij0 = empty for all j [Rei09a Def 49]

12

22 Quantum algorithm to evaluate a span program based on its full witness size

[Rei09a Theorem 93] gives a quantum query algorithm for evaluating span programs based on thefull witness size The algorithm is based on a quantum walk on a certain graph Provided that thedegree of the graph is not too large it can actually be implemented efficiently

Theorem 24 ([Rei09a Theorem 93]) Let P be a span program Then fP can be evaluated using

T = O(fwsize(P ) abs(AGP

))

(27)

quantum queries with error probability at most 13 Moreover if the maximum degree of a vertexin GP is d then the time complexity of the algorithm for evaluating fP is at most a factor of(log d)

(log(T log d)

)O(1) worse after classical preprocessing and assuming constant-time coherentaccess to the preprocessed string

Proof sketch The query complexity claim is actually slightly weaker than [Rei09a Theorem 93]which allows the target vector to be scaled downward by a factor of

radicfwsize(P )

The time-complexity claim will follow from the proof of [Rei09a Theorem 93] in [Rei09aProp 94 Theorem 95] The algorithm for evaluating fP (x) uses a discrete-time quantum walkon the graph GP (x) If the maximum degree of a vertex in GP is d then each coin reflec-tion can be implemented using O(log d) single-qubit unitaries and queries to the preprocessedstring [GR02 CNW09] Finally the

(log(T log d)

)O(1) factor comes from applying the Solovay-Kitaev Theorem [KSV02] to compile the single-qubit unitaries into products of elementary gatesto precision 1O(T log d)

We remark that together with [Rei09a Theorem 31] Theorem 24 gives a way of transforming aone-sided-error quantum algorithm into a span program and back into a quantum algorithm suchthat the time complexity is nearly preserved after preprocessing This is only a weak equivalencebecause aside from requiring preprocessing the algorithm from Theorem 24 also has two-sided errorTo some degree though it complements the equivalence results for best span program witness sizeand bounded-error quantum query complexity [Rei09a Theorem 71 Theorem 92]

23 Direct-sum span program composition

Let us study the full witness size of the direct-sum composition of span programs We begin byrecalling the definition of direct-sum composition

Let f 0 1n rarr 0 1 and S sube [n] For j isin [n] let mj be a natural number with mj = 1 forj isin S For j isin S let fj 0 1mj rarr 0 1 Define y 0 1m1 times middot middot middot times 0 1mn rarr 0 1n by

y(x)j =

fj(xj) if j isin Sxj if j isin S

(28)

Define g 0 1m1 times middot middot middottimes 0 1mn rarr 0 1 by g(x) = f(y(x)) For example if S = [n] r 1 then

g(x) = f(x1 f2(x2) fn(xn)

) (29)

Given span programs for the individual functions f and fj for j isin S we will construct a spanprogram for g We remark that although we are here requiring that the inner functions fj act on

13

disjoint sets of bits this assumption is not necessary for the definition It simplifies the notationthough for the cases S 6= [n] and will suffice for our applications

Let P be a span program computing fP = f Let P have inner product space V target vector|t〉 and input vectors |vi〉 indexed by Ifree and Ijc for j isin [n] and c isin 0 1

For j isin [n] let sj isin [0infin)mj be a vector of costs and let s isin [0infin)Pmj be the concatenation of

the vectors sj For j isin S let P j0 and P j1 be span programs computing fP j1 = fj 0 1mj rarr 0 1and fP j0 = notfj with rj = wsizesj (P j0) = wsizesj (P j1) For c isin 0 1 let P jc have inner productspace V jc with target vector |tjc〉 and input vectors indexed by Ijcfree and Ijckb for k isin [mj ] b isin 0 1For j isin S let rj = sj

Let IS =⋃jisinScisin01 Ijc Define ς IS rarr [n]times 0 1 by ς(i) = (j c) if i isin Ijc The idea is that

ς maps i to the input span program that must evaluate to 1 in order for |vi〉 to be available in P There are several ways of composing the span programs P and P jc to obtain a span program Q

computing the composed function fQ = g with wsizes(Q) le wsizer(P ) [Rei09a Defs 44 45 46]We focus on direct-sum composition

Definition 25 ([Rei09a Def 45]) The direct-sum-composed span program Qoplus is defined by

bull The inner product space is V oplus = V oplusoplus

jisinScisin01(CIjc otimes V jc) Any vector in V oplus can be

uniquely expressed as |u〉V +sum

iisinIS |i〉 otimes |ui〉 where |u〉 isin V and |ui〉 isin V ς(i)

bull The target vector is |toplus〉 = |t〉V

bull The free input vectors are indexed by Ioplusfree = Ifree cup IS cup⋃jisinScisin01(Ijc times Ijcfree) with for

i isin Ioplusfree

|voplusi 〉 =

|vi〉V if i isin Ifree

|vi〉V minus |i〉 otimes |tjc〉 if i isin Ijc and j isin S|iprime〉 otimes |viprimeprime〉 if i = (iprime iprimeprime) isin Ijc times Ijcfree

(210)

bull The other input vectors are indexed by Ioplus(jk)b for j isin [n] k isin [mj ] b isin 0 1 For j isin S

Ioplus(j1)b = Ijb with |voplusi 〉 = |vi〉V for i isin Ioplus(j1)b For j isin S let Ioplus(jk)b =⋃cisin01(Ijc times I

jckb) For

i isin Ijc and iprime isin Ijckb let|voplusiiprime〉 = |i〉 otimes |viprime〉 (211)

By [Rei09a Theorem 43] fQoplus = g and wsizes(Qoplus) le wsizer(P ) (While that theorem is statedonly for the case S = [n] it is trivially extended to other S sub [n]) We give a bound on how quicklythe full witness size can grow relative to the witness size

Lemma 26 Under the above conditions for each input x isin 0 1m1timesmiddot middot middottimes0 1mn with y = y(x)

bull If g(x) = 1 let |w〉 be a witness to fP (y) = 1 such thatsum

jisin[n]iisinIjyjrj |wi|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |w〉

)+

1 +sum

iisinIfree|wi|2

wsizer(P y)

where σ(y |w〉) = maxjisinS

existi isin Ijyj with 〈i|w〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(212)

14

bull If g(x) = 0 let |wprime〉 be a witness to fP (y) = 0 such thatsum

jisin[n]iisinIjyjrj |〈wprime|vi〉|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |wprime〉) +|wprime〉2

wsizer(P y)

where σ(y |wprime〉) = maxjisinS

existi isin Ijyj with 〈vi|wprime〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(213)

If S = empty then σ(y |w〉) and σ(y |wprime〉) should each be taken to be 1 in the above equations

Proof We follow the proof of [Rei09a Theorem 43] except keeping track of the full witness sizeNote that if S = empty then Eqs (212) and (213) are immediate by definition of fwsizes(Qoplus x)

Let I(y)prime = I(y) r Ifree =⋃jisin[n] Ijyj

In the first case g(x) = 1 for j isin S let |wjyj 〉 isin CIjyj be a witness to fP jyj (xj) = 1 such that

fwsizes(P jyj xj) = 1 +sum

iisinIjyjfree

|wjyj

i |2

+sum

kisin[mj ]iisinIjyjk(xj)k

(sj)k|wjyj

i |2 As in [Rei09a Theorem 43]

let |woplus〉 isin CIoplus(x) be given by

woplusi =

wi if i isin I(y)

wiprimewς(iprime)iprimeprime if i = (iprime iprimeprime) with iprime isin I(y)prime cap IS iprimeprime isin Iς(iprime)(x)

0 otherwise

(214)

Then |woplus〉 is a witness for fQoplus(x) = 1 and we compute

fwsizes(Qoplus x) le 1 +sumiisinIoplusfree

|woplusi |2 +

sumjisin[n]kisin[mj ]

iisinIoplus(jk)(xj)k

(sj)k|woplusi |2

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 (215)

+sum

jisinSiisinIjyj

|wi|2(

1 +sum

iprimeisinIjyjfree

|wjyj

iprime |2 +

sumkisin[mj ]iprimeisinI

jyjk(xj)k

(sj)k|wjyj

iprime |2

)

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 +sum

jisinSiisinIjyj

|wi|2 fwsizesj (P jyj xj)

Eq (212) follows using the bound fwsizesj (P jyj xj) le σ(y |w〉)rj for j isin S and sj = rj for j isin SNext consider the case g(x) = 0 For j isin S let |ujyj 〉 isin V jyj be a witness for f

P jyj (xj) = 0 withfwsizes(P jyj xj) = |ujyj 〉2 +

sumkisin[mj ]iisinI

jyj

k(xj)k

(sj)k|〈vi|ujyj 〉|2 As in [Rei09a Theorem 43] let

|uoplus〉 = |wprime〉V +sum

iisinISrI(y)

〈vi|wprime〉|i〉 otimes |uς(i)〉 (216)

15

Then |uoplus〉 is a witness for fQoplus(x) = 0 and moreover

fwsizes(Qoplus x) le |uoplus〉2 +sum

jisin[n]kisin[mj ]iisinIoplus(jk)(xj)k

(sj)k|〈voplusi |uoplus〉|2

= |uoplus〉2 +sum

jisin[n]rSiisinIjxj

sj |〈voplusi |uoplus〉|2 +

sumjisinSkisin[mj ]

iisinIjyjiprimeisinI

jyj

k(xj)k

(sj)k|〈voplusiiprime |uoplus〉|2

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

sj |〈vi|wprime〉|2 (217)

+sum

jisinSiisinIjyj

|〈vi|wprime〉|2(|ujyj 〉2 +

sumkisin[mj ]iprimeisinI

jyj

k(xj)k

(sj)k|〈viprime |ujyj 〉|2)

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

rj |〈vi|wprime〉|2 +sum

jisinSiisinIjyj

|〈vi|wprime〉|2 fwsizesj (P jyj xj)

Eq (213) follows using the bound fwsizesj (P jyj xj) le σ(y |wprime〉)rj for j isin S

Lemma 26 is a key step in the formula-evaluation results in this article and [Rei09b] Itis used to track the full witness size for span programs recursively composed in a direct-summanner along a formula The proof of Theorem 19 will require the lemma with the weakerbounds σ(y |w〉) σ(y |wprime〉) le maxjisinScisin01 fwsizesj (P jc)wsizesj (P jc) Theorem 111 will useonly the slightly stronger bounds σ(y |w〉) le maxjisinS fwsizesj (P jyj )wsizesj (P jyj ) σ(y |wprime〉) lemaxjisinS fwsizesj (P jyj )wsizesj (P jyj ) However the proof of [Rei09b Theorem 11] will require thebounds of Eqs (212) and (213)

3 Evaluation of almost-balanced formulas

In this section we will apply the span program framework from [Rei09a] to prove Theorem 19Our algorithm will be given by applying Theorem 24 to a certain span program Before beginningthe proof though we will give two necessary lemmas

Consider a span program P with corresponding weighted graph GP from [Rei09a Def 82]We will need a bound on the operator norm of abs(AGPv

) the entry-wise absolute value of theweighted adjacency matrix AGPv

If P is canonical [Rei09a Def 51] then we can indeed obtainsuch a bound in terms of the witness size of P

Lemma 31 Let s isin (0infin)k and let P be a canonical span program computing a function f 0 1k rarr 0 1 with input vectors indexed by the set I Assume that for each x isin 0 1k withf(x) = 0 an optimal witness to fP (x) = 0 is |x〉 itself Then

abs(AGP) le 2k

(1 +

wsizes(P )minjisin[k] sj

)+ |I| (31)

16

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 6: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

to this progress on quantum algorithms There are essentially two techniques the polynomial andadversary methods for lower-bounding quantum query complexity

bull The polynomial method introduced in the quantum setting by Beals et al [BBC+01] is basedon the observation that after making q oracle Ox queries the probability of any measurementresult is a polynomial of degree at most 2q in the variables xj

bull Ambainis generalized the classical hybrid argument to consider the systemrsquos entanglementwhen run on a superposition of inputs [Amb02] A number of variants of Ambainisrsquos boundwere soon discovered including weighted versions [HNS02 BS04 Amb06 Zha05] a spectralversion [BSS03] and a version based on Kolmogorov complexity [LM04] These variants canbe asymptotically stronger than Ambainisrsquos original unweighted bound but are equivalent toeach other [SS06] We therefore term it simply ldquothe adversary boundrdquo denoted by Adv

The adversary bound is well-suited for lower-bounding the quantum query complexity for eval-uating formulas For example Barnum and Saks proved that for any size-n AND-OR formula ϕAdv(ϕ) =

radicn implying the lower bound Q(ϕ) = Ω(

radicn) [BS04] Thus the [ACR+07] algorithm is

optimal for approximately balanced AND-OR formulas and is nearly optimal for arbitrary AND-OR formulas This is a considerably more complete solution than is known classically

It is then natural to consider formulas over larger gate sets The adversary bound continues towork well because it transforms nicely under function composition

Theorem 11 (Adversary bound composition [Amb06 LLS06 HLS05]) Let f 0 1k rarr 0 1and let fj 0 1mj rarr 0 1 for j = 1 2 k Define g 0 1m1 times middot middot middot times 0 1mk rarr 0 1 byg(x) = f

(f1(x1) fk(xk)

) Let s = (Adv(f1) Adv(fk)) Then

Adv(g) = Advs(f) (13)

See Definition 21 for the definition of the adversary bound with ldquocostsrdquo Advs The Adv boundequals Advs with uniform unit costs s = ~1 For a function f Adv(f) can be computed using asemi-definite program in time polynomial in the size of f rsquos truth table Therefore Theorem 11gives a polynomial-time procedure for computing the adversary bound for a formula ϕ over anarbitrary finite gate set compute the bounds for subformulas moving from the leaves toward theroot At an internal node f having computed the adversary bounds for the input subformulasf1 fk Eq (13) says that the adversary bound for g the subformula rooted at f equals theadversary bound for the gate f with certain costs Computing this requires 2O(k) time which is aconstant if k = O(1) For example if f is an ORk or ANDk gate then Adv(s1sk)(f) =

radicsumj s

2j

from which follows immediately the [BS04] result Adv(ϕ) =radicn for a size-n AND-OR formula ϕ

A special case of Theorem 11 is when the functions fj all have equal adversary bounds soAdv(g) = Adv(f)Adv(f1) In particular for a function f 0 1k rarr 0 1 and a natural numberd isin N let fd 0 1kd rarr 0 1 denote the complete depth-d formula over f That is f1 = f andfd(x) = f

(fdminus1(x1 xkdminus1) fdminus1(xkdminuskdminus1+1 xkd)

)for d gt 1 Then we obtain

Corollary 12 For any function f 0 1k rarr 0 1

Adv(fd) = Adv(f)d (14)

6

In particular Ambainis defined a boolean function f 0 14 rarr 0 1 that can be representedexactly by a polynomial of degee two but for which Adv(f) = 52 [Amb06] Thus fd can berepresented exactly by a polynomial of degree 2d but by Corollary 12 Adv(fd) = (52)d For thisfunction the adversary bound is strictly stronger than any bound obtainable using the polynomialmethod Many similar examples are given in [HLS06] However for other functions the adversarybound is asymptotically worse than the polynomial method [SS06 AS04 Amb05]

In 2007 though Hoslashyer et al discovered a strict generalization of Adv that also lower-boundsquantum query complexity [HLS07] We call this new bound the general adversary bound or AdvplusmnFor example for Ambainisrsquos four-bit function f Advplusmn(f) ge 251 [HLS06] Like the adversarybound Advplusmns (f) can be computed in time polynomial in the size of f rsquos truth table and alsocomposes nicely

Theorem 13 ([HLS07 Rei09a]) Under the conditions of Theorem 11

Advplusmn(g) = Advplusmns (f) (15)

In particular if Advplusmn(f1) = middot middot middot = Advplusmn(fk) then Advplusmn(g) = Advplusmn(f) Advplusmn(f1)

Define a formula ϕ to be adversary balanced if at each internal node the general adversarybounds of the input subformulas are equal In particular by Theorem 13 this implies that Advplusmn(ϕ)is equal to the product of the general adversary bounds of the gates along any path from the rootto a leaf Complete layered formulas are an example of adversary-balanced formulas

Returning to upper bounds Reichardt and Spalek [RS08] generalized the algorithmic approachstarted by [FGG07] They gave an optimal quantum algorithm for evaluating adversary-balancedformulas over a considerably extended gate set including in particular all functions 0 1k rarr 0 1for k le 3 69 inequivalent four-bit functions and the gates ANDk ORk PARITYk and EQUALkfor k = O(1) For example Q(MAJ3

d) = Θ(2d)The [RS08] result follows from a framework for developing formula-evaluation quantum algo-

rithms based on span programs A span program introduced by Karchmer and Wigderson [KW93]is a certain linear-algebraic way of defining a function which corresponds closely to eigenvalue-zeroeigenvectors of certain bipartite graphs [RS08] derived a quantum algorithm for evaluating certainconcatenated span programs with a query complexity upper-bounded by the span program witnesssize denoted wsize In particular a special case of [RS08 Theorem 47] is

Theorem 14 ([RS08]) Fix a function f 0 1k rarr 0 1 If span program P computes f then

Q(fd) = O(wsize(P )d

) (16)

From Theorem 13 this result is optimal if wsize(P ) = Advplusmn(f) The question thereforebecomes how to find optimal span programs Using an ad hoc search [RS08] found optimal spanprograms for a variety of functions with Advplusmn = Adv Further work automated the search bygiving a semi-definite program (SDP) for the optimal span program witness size for any givenfunction [Rei09a] Remarkably the SDPrsquos value always equals the general adversary bound

Theorem 15 ([Rei09a]) For any function f 0 1n rarr 0 1

infP

wsize(P ) = Advplusmn(f) (17)

where the infimum is over span programs P computing f Moreover this infimum is achieved

7

This result greatly extends the gate set over which the formula-evaluation algorithm of [RS08]works optimally For example combined with Theorem 14 it implies that limdrarrinfinQ(fd)1d =Advplusmn(f) for every boolean function f More generally Theorem 15 allows the [RS08] algorithmto be run on formulas over any finite gate set S A factor is lost that depends on the gates in Sbut it will be a constant for S finite Combining Theorem 15 with [RS08 Theorem 47] gives

Theorem 16 ([Rei09a]) Let S be a finite set of gates Then there exists a quantum algorithm thatevaluates an adversary-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After efficient

classical preprocessing independent of the input x and assuming unit-time coherent access to thepreprocessed classical string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

In the discussion so far we have for simplicity focused on query complexity The query com-plexity is an information-theoretic quantity that does not charge for operations independent of theinput string even though these operations may require many elementary gates to implement Forpractical algorithms it is important to be able to bound the algorithmrsquos running time which countsthe cost of implementing the input-independent operations Theorem 16 puts an optimal boundon the query complexity and also puts a nearly optimal bound on the algorithmrsquos time complexityIn fact all of the query-optimal algorithms so far discussed are also nearly time optimal

In general though an upper bound on the query complexity does not imply an upper boundon the time complexity Ref [Rei09a] also generalized the span program framework of [RS08] toapply to quantum algorithms not based on formulas The main result of [Rei09a] is

Theorem 17 ([Rei09a]) For any function f D rarr 1 2 m with D sube 0 1n Q(f) satisfies

Q(f) = Ω(Advplusmn(f)) and Q(f) = O

(Advplusmn(f)

log Advplusmn(f)log log Advplusmn(f)

log(m) log logm) (18)

Theorem 17 in particular allows us to compute the query complexity of formulas up to thelogarithmic factor It does not give any guarantees on running time However the analysis requiredto prove Theorem 17 also leads to significantly simpler proofs of Theorem 16 and the AND-ORformula results of [ACR+07 FGG07] Moreover we will see that it allows the formula-evaluationalgorithms to be extended to formulas that are not adversary balanced

13 Quantum algorithm for evaluating almost-balanced formulas

We give a formula-evaluation algorithm that is both query-optimal without a logarithmic overheadand after an efficient preprocessing step nearly time optimal Define almost balance as follows

Definition 18 Consider a formula ϕ over a gate set S For a vertex v in the correspondingtree let ϕv denote the subformula of ϕ rooted at v and if v is an internal vertex let gv be thecorresponding gate The formula ϕ is β-balanced if for every vertex v with children c1 c2 ck

maxj Advplusmn(ϕcj )minj Advplusmn(ϕcj )

le β (19)

(If cj is a leaf Advplusmn(ϕcj ) = 1) Formula ϕ is almost balanced if it is β-balanced for some β = O(1)

In particular an adversary-balanced formula is 1-balanced We will show

8

Theorem 19 Let S be a fixed finite set of gates Then there exists a quantum algorithm thatevaluates an almost-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After polynomial-

time classical preprocessing independent of the input and assuming unit-time coherent access tothe preprocessed string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

Theorem 19 is significantly stronger than Theorem 16 which requires exact balance Thereare important classes of exactly balanced formulas such as complete layered formulas In fact it issufficient that the multiset of gates along the simple path from the root to a leaf not depend on theleaf Moreover sometimes different gates have the same Advplusmn bound see [HLS06] for examplesEven still exact adversary balance is a very strict condition

The proof of Theorem 19 is based on the span program framework developed in Ref [Rei09a]In particular [Rei09a Theorem 91] gives two quantum algorithms for evaluating span programsThe first algorithm is based on a discrete-time simulation of a continuous-time quantum walkIt applies to arbitrary span programs and is used in combination with Theorem 15 to proveTheorem 17 However the simulation incurs a logarithmic query overhead and potentially worsetime complexity overhead so this algorithm is not suitable for proving Theorem 19

The second algorithm in [Rei09a] is based directly on a discrete-time quantum walk similarto previous optimal formula-evaluation algorithms [ACR+07 RS08] However this algorithm doesnot apply to an arbitrary span program A bound is needed on the operator norm of the entry-wiseabsolute value of the weighted adjacency matrix for a corresponding graph Further graph sparsityconditions are needed for the algorithm to be time efficient (see Theorem 24)

Unfortunately the span program from Theorem 15 will not generally satisfy these conditionsTheorem 15 gives a canonical span program ([Rei09a Def 51]) Even for a simple formula theoptimal canonical span program will typically correspond to a dense graph with large norm

An example should clarify the problem Consider the AND-OR formula ψ(x) =([(x1 and x2) or

x3] and x4

)or(x5 and [x6 or x7]

) and consider the two graphs in Figure 1 For an input x isin 0 17

modify the graphs by attaching dangling edges to every vertex j for which xj = 0 Observe thenthat each graph has an eigenvalue-zero eigenvector supported on vertex 0mdashcalled a witnessmdashif andonly if ψ(x) = 1 The graphs correspond to different span programs computing ψ and the quantumalgorithm works essentially by running a quantum walk starting at vertex 0 in order to detect thewitness The graph on the left is a significantly simplified version of a canonical span program forψ and its density still makes it difficult to implement the quantum walk

We will be guided by the second simpler graph Instead of applying Theorem 15 to ϕ as awhole we apply it separately to every gate in the formula We then compose these span programsone per gate according to the formula using direct-sum composition (Definition 25) In terms ofgraphs direct-sum composition attaches the output vertex of one span programrsquos graph to an inputvertex of the next [RS08] This leads to a graph whose structure somewhat follows the structure ofthe formula ϕ as the graph in Figure 1(b) follows the structure of ψ (However the general casewill be more complicated than shown as we are plugging together constant-size graph gadgets andthere may be duplication of some subgraphs)

Direct-sum composition keeps the maximum degree and norm of the graph under controlmdasheachis at most twice its value for the worst single gate Therefore the second [Rei09a] algorithm appliesHowever direct-sum composition also leads to additional overhead In particular a witness in thefirst graph will be supported only on numbered vertices (note that the graph is bipartite) whereasa witness in the second graph will be supported on some of the internal vertices as well This meansroughly that the second witness will be harder to detect because after normalization its overlap on

9

0

1

2

3

4

5

6

7

(a)

3

6

7

0

1

2

4

5

(b)

Figure 1 Graphs corresponding to two span programs both computing the same function

vertex 0 will be smaller Scale both witnesses so that the amplitude on vertex 0 is one The witnesssize (wsize) measures the squared length of the witness only on numbered vertices whereas the fullwitness size (fwsize) measures the squared length on all vertices For [Rei09a] it was sufficient toconsider only span program witness size because for canonical span programs like in Figure 1(a)the two measures are equal (For technical reasons we will actually define fwsize to be 1 + wsizeeven in this case) For our analysis we will need to bound the full witness size in terms of thewitness size We maintain this bound in a recursion from the formularsquos leaves toward its root

A span program is called strict if every vertex on one half of the bipartite graph is either aninput vertex (vertices 1ndash7 in the graphs of Figure 1) or the output vertex (vertex 0) Thus the firstgraph in the example above corresponds to a strict span program and the second does not Theoriginal definition of span programs in [KW93] allowed for only strict span programs This wassensible because any other vertices on the inputoutput part of the graphrsquos bipartition can alwaysbe projected away yielding a strict span program that computes the same function For developingtime-efficient quantum algorithms though it seems important to consider span programs that arenot strict Unfortunately going backwards eg from 1(a) to 1(b) is probably difficult in general

Theorem 19 does not follow from the formula-evaluation techniques of [RS08] together withTheorem 14 from [Rei09a] This tempting approach falls into intractable technical difficulties Inparticular the same span program can be used at two vertices v and w in ϕ only if gv = gw andthe general adversary bounds of vrsquos input subformulas are the same as those for wrsquos inputs upto simultaneous scaling In general then an almost-balanced formula will require an unboundednumber of different span programs However the analysis in [RS08] loses a factor that dependsbadly on the individual span programs Since the dependence is not continuous even showingthat the span programs in use all lie within a compact set would not be sufficient to obtain anO(1) upper bound In contrast the approach we follow here allows bounding the lost factor by anexponential in k uniformly over different gate imbalances

10

14 Quantum algorithm to evaluate approximately balanced AND-OR formulas

Ambainis et al [ACR+07] use a weaker balance criterion for AND-OR formulas than Definition 18They define an AND-OR formula to be approximately balanced if σminus(ϕ) = O(1) and σ+(ϕ) = O(n)Here n is the size of the formula ie the number of leaves and σminus(ϕ) and σ+(ϕ) are defined by

Definition 110 For each vertex v in a formula ϕ let

σminus(v) = maxξ

sumwisinξ

1Advplusmn(ϕw)

σ+(v) = maxξ

sumwisinξ

Advplusmn(ϕw)2 (110)

with each maximum taken over all simple paths ξ from v to a leaf Let σplusmn(ϕ) = σplusmn(r) where r isthe root of ϕ

Recall that Advplusmn(ϕ) = Adv(ϕ) =radicn for an AND-OR formula Definition 18 is a stricter

balance criterion because β-balance of a formula ϕ implies (by Lemma 32) that σminus(ϕ) and σ+(ϕ) areboth dominated by geometric series However the same steps followed by the proof of Theorem 19still suffice for proving the [ACR+07] result and in fact for strengthening it We show

Theorem 111 Let ϕ be an AND-OR formula of size n Then after polynomial-time classicalpreprocessing that does not depend on the input x ϕ(x) can be evaluated by a quantum algo-rithm with error at most 13 using O

(radicnσminus(ϕ)

)input queries The algorithmrsquos running time isradic

nσminus(ϕ)(log n)O(1) assuming unit-cost coherent access to the preprocessed string

For the special case of AND-OR formulas with σminus(ϕ) = O(1) Theorem 111 strengthens The-orem 19 The requirement that σminus(ϕ) = O(1) allows for some gates in the formula to be veryunbalanced Theorem 111 also strengthens [ACR+07 Theorem 1] because it does not require thatσ+(ϕ) = O(n) For example a formula that is biased near the root but balanced at greater depthscan have σminus(ϕ) = O(1) and σ+(ϕ) = ω(n) By substituting the bound σminus(ϕ) = O(

radicd) for a depth-

d formula [ACR+07 Def 3] a corollary of Theorem 111 is that a depth-d size-n AND-OR formulacan be evaluated using O(

radicnd) queries This improves the depth-dependence from [ACR+07] and

matches the dependence from an earlier version of that article [Amb07]The essential reason that the Definition 18 balance condition can be weakened is that for the

specific gates AND and OR by writing out the optimal span programs explicitly we can prove thatthey satisfy stronger properties than are necessarily true for other functions

2 Span programs

21 Definitions

We briefly recall some definitions from [Rei09a Sec 2] Additionally we define a span programcomplexity measure the full witness size that charges even for the ldquofreerdquo inputs This quantity isimportant for developing quantum algorithms that are time efficient as well as query efficient

For a natural number n let [n] = 1 2 n For a finite set X let CX be the inner productspace C|X| with orthonormal basis |x〉 x isin X For vector spaces V and W over C let L(VW )be the set of linear transformations from V into W and let L(V ) = L(V V ) For A isin L(VW )A is the operator norm of A For a string x isin 0 1n let x denote its bitwise complement

11

Definition 21 ([HLS05 HLS07]) For finite sets C E and D sube Cn let f D rarr E An adversarymatrix for f is a real symmetric matrix Γ isin L(CD) that satisfies 〈x|Γ|y〉 = 0 whenever f(x) = f(y)

The general adversary bound for f with costs s isin [0infin)n is

Advplusmns (f) = maxadversary matrices Γforalljisin[n] Γ∆jlesj

Γ (21)

Here Γ ∆j denotes the entry-wise matrix product between Γ and ∆j =sum

xyxj 6=yj|x〉〈y| The

(nonnegative-weight) adversary bound for f with costs s is defined by the same maximizationexcept with Γ restricted to have nonnegative entries In particular Advplusmns (f) ge Advs(f)

Letting ~1 = (1 1 1) the adversary bound for f is Adv(f) = Adv~1(f) and the generaladversary bound for f is Advplusmn(f) = Advplusmn~1 (f) By [HLS07] Q(f) = Ω(Advplusmn(f))

Definition 22 (Span program [KW93]) A span program P consists of a natural number n afinite-dimensional inner product space V over C a ldquotargetrdquo vector |t〉 isin V disjoint sets Ifree andIjb for j isin [n] b isin 0 1 and ldquoinput vectorsrdquo |vi〉 isin V for i isin Ifree cup

⋃jisin[n]bisin01 Ijb

To P corresponds a function fP 0 1n rarr 0 1 defined on x isin 0 1n by

fP (x) =

1 if |t〉 isin Span(|vi〉 i isin Ifree cup

⋃jisin[n] Ijxj)

0 otherwise(22)

Some additional notation is convenient Fix a span program P Let I = Ifreecup⋃jisin[n]bisin01 Ijb

Let A isin L(CI V ) be given by A =sum

iisinI |vi〉〈i| For x isin 0 1n let I(x) = Ifree cup⋃jisin[n] Ijxj and

Π(x) =sum

iisinI(x) |i〉〈i| isin L(CI) Then fP (x) = 1 if |t〉 isin Range(AΠ(x)) A vector |w〉 isin CI is saidto be a witness for fP (x) = 1 if Π(x)|w〉 = |w〉 and A|w〉 = |t〉 A vector |wprime〉 isin V is said to be awitness for fP (x) = 0 if 〈t|wprime〉 = 1 and Π(x)Adagger|wprime〉 = 0

Definition 23 (Witness size) Consider a span program P and a vector s isin [0infin)n of nonnegativeldquocostsrdquo Let S =

sumjisin[n]bisin01iisinIjb

radicsj |i〉〈i| isin L(CI) For each input x isin 0 1n define the witness

size of P on x with costs s wsizes(P x) as follows

wsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉 S|w〉2 if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

SAdagger|wprime〉2 if fP (x) = 0 (23)

The witness size of P with costs s is

wsizes(P ) = maxxisin01n

wsizes(P x) (24)

Define the full witness size fwsizes(P ) by letting Sf = S +sum

iisinIfree|i〉〈i| and

fwsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉(1 + Sf |w〉2) if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

(|wprime〉2 + SAdagger|wprime〉2) if fP (x) = 0 (25)

fwsizes(P ) = maxxisin01n

fwsizes(P x) (26)

When the subscript s is omitted the costs are taken to be uniform s = ~1 = (1 1 1) egfwsize(P ) = fwsize~1(P ) The witness size is defined in [RS08] The full witness size is definedin [Rei09a Sec 8] but is not named there A strict span program has Ifree = empty so Sf = S and amonotone span program has Ij0 = empty for all j [Rei09a Def 49]

12

22 Quantum algorithm to evaluate a span program based on its full witness size

[Rei09a Theorem 93] gives a quantum query algorithm for evaluating span programs based on thefull witness size The algorithm is based on a quantum walk on a certain graph Provided that thedegree of the graph is not too large it can actually be implemented efficiently

Theorem 24 ([Rei09a Theorem 93]) Let P be a span program Then fP can be evaluated using

T = O(fwsize(P ) abs(AGP

))

(27)

quantum queries with error probability at most 13 Moreover if the maximum degree of a vertexin GP is d then the time complexity of the algorithm for evaluating fP is at most a factor of(log d)

(log(T log d)

)O(1) worse after classical preprocessing and assuming constant-time coherentaccess to the preprocessed string

Proof sketch The query complexity claim is actually slightly weaker than [Rei09a Theorem 93]which allows the target vector to be scaled downward by a factor of

radicfwsize(P )

The time-complexity claim will follow from the proof of [Rei09a Theorem 93] in [Rei09aProp 94 Theorem 95] The algorithm for evaluating fP (x) uses a discrete-time quantum walkon the graph GP (x) If the maximum degree of a vertex in GP is d then each coin reflec-tion can be implemented using O(log d) single-qubit unitaries and queries to the preprocessedstring [GR02 CNW09] Finally the

(log(T log d)

)O(1) factor comes from applying the Solovay-Kitaev Theorem [KSV02] to compile the single-qubit unitaries into products of elementary gatesto precision 1O(T log d)

We remark that together with [Rei09a Theorem 31] Theorem 24 gives a way of transforming aone-sided-error quantum algorithm into a span program and back into a quantum algorithm suchthat the time complexity is nearly preserved after preprocessing This is only a weak equivalencebecause aside from requiring preprocessing the algorithm from Theorem 24 also has two-sided errorTo some degree though it complements the equivalence results for best span program witness sizeand bounded-error quantum query complexity [Rei09a Theorem 71 Theorem 92]

23 Direct-sum span program composition

Let us study the full witness size of the direct-sum composition of span programs We begin byrecalling the definition of direct-sum composition

Let f 0 1n rarr 0 1 and S sube [n] For j isin [n] let mj be a natural number with mj = 1 forj isin S For j isin S let fj 0 1mj rarr 0 1 Define y 0 1m1 times middot middot middot times 0 1mn rarr 0 1n by

y(x)j =

fj(xj) if j isin Sxj if j isin S

(28)

Define g 0 1m1 times middot middot middottimes 0 1mn rarr 0 1 by g(x) = f(y(x)) For example if S = [n] r 1 then

g(x) = f(x1 f2(x2) fn(xn)

) (29)

Given span programs for the individual functions f and fj for j isin S we will construct a spanprogram for g We remark that although we are here requiring that the inner functions fj act on

13

disjoint sets of bits this assumption is not necessary for the definition It simplifies the notationthough for the cases S 6= [n] and will suffice for our applications

Let P be a span program computing fP = f Let P have inner product space V target vector|t〉 and input vectors |vi〉 indexed by Ifree and Ijc for j isin [n] and c isin 0 1

For j isin [n] let sj isin [0infin)mj be a vector of costs and let s isin [0infin)Pmj be the concatenation of

the vectors sj For j isin S let P j0 and P j1 be span programs computing fP j1 = fj 0 1mj rarr 0 1and fP j0 = notfj with rj = wsizesj (P j0) = wsizesj (P j1) For c isin 0 1 let P jc have inner productspace V jc with target vector |tjc〉 and input vectors indexed by Ijcfree and Ijckb for k isin [mj ] b isin 0 1For j isin S let rj = sj

Let IS =⋃jisinScisin01 Ijc Define ς IS rarr [n]times 0 1 by ς(i) = (j c) if i isin Ijc The idea is that

ς maps i to the input span program that must evaluate to 1 in order for |vi〉 to be available in P There are several ways of composing the span programs P and P jc to obtain a span program Q

computing the composed function fQ = g with wsizes(Q) le wsizer(P ) [Rei09a Defs 44 45 46]We focus on direct-sum composition

Definition 25 ([Rei09a Def 45]) The direct-sum-composed span program Qoplus is defined by

bull The inner product space is V oplus = V oplusoplus

jisinScisin01(CIjc otimes V jc) Any vector in V oplus can be

uniquely expressed as |u〉V +sum

iisinIS |i〉 otimes |ui〉 where |u〉 isin V and |ui〉 isin V ς(i)

bull The target vector is |toplus〉 = |t〉V

bull The free input vectors are indexed by Ioplusfree = Ifree cup IS cup⋃jisinScisin01(Ijc times Ijcfree) with for

i isin Ioplusfree

|voplusi 〉 =

|vi〉V if i isin Ifree

|vi〉V minus |i〉 otimes |tjc〉 if i isin Ijc and j isin S|iprime〉 otimes |viprimeprime〉 if i = (iprime iprimeprime) isin Ijc times Ijcfree

(210)

bull The other input vectors are indexed by Ioplus(jk)b for j isin [n] k isin [mj ] b isin 0 1 For j isin S

Ioplus(j1)b = Ijb with |voplusi 〉 = |vi〉V for i isin Ioplus(j1)b For j isin S let Ioplus(jk)b =⋃cisin01(Ijc times I

jckb) For

i isin Ijc and iprime isin Ijckb let|voplusiiprime〉 = |i〉 otimes |viprime〉 (211)

By [Rei09a Theorem 43] fQoplus = g and wsizes(Qoplus) le wsizer(P ) (While that theorem is statedonly for the case S = [n] it is trivially extended to other S sub [n]) We give a bound on how quicklythe full witness size can grow relative to the witness size

Lemma 26 Under the above conditions for each input x isin 0 1m1timesmiddot middot middottimes0 1mn with y = y(x)

bull If g(x) = 1 let |w〉 be a witness to fP (y) = 1 such thatsum

jisin[n]iisinIjyjrj |wi|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |w〉

)+

1 +sum

iisinIfree|wi|2

wsizer(P y)

where σ(y |w〉) = maxjisinS

existi isin Ijyj with 〈i|w〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(212)

14

bull If g(x) = 0 let |wprime〉 be a witness to fP (y) = 0 such thatsum

jisin[n]iisinIjyjrj |〈wprime|vi〉|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |wprime〉) +|wprime〉2

wsizer(P y)

where σ(y |wprime〉) = maxjisinS

existi isin Ijyj with 〈vi|wprime〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(213)

If S = empty then σ(y |w〉) and σ(y |wprime〉) should each be taken to be 1 in the above equations

Proof We follow the proof of [Rei09a Theorem 43] except keeping track of the full witness sizeNote that if S = empty then Eqs (212) and (213) are immediate by definition of fwsizes(Qoplus x)

Let I(y)prime = I(y) r Ifree =⋃jisin[n] Ijyj

In the first case g(x) = 1 for j isin S let |wjyj 〉 isin CIjyj be a witness to fP jyj (xj) = 1 such that

fwsizes(P jyj xj) = 1 +sum

iisinIjyjfree

|wjyj

i |2

+sum

kisin[mj ]iisinIjyjk(xj)k

(sj)k|wjyj

i |2 As in [Rei09a Theorem 43]

let |woplus〉 isin CIoplus(x) be given by

woplusi =

wi if i isin I(y)

wiprimewς(iprime)iprimeprime if i = (iprime iprimeprime) with iprime isin I(y)prime cap IS iprimeprime isin Iς(iprime)(x)

0 otherwise

(214)

Then |woplus〉 is a witness for fQoplus(x) = 1 and we compute

fwsizes(Qoplus x) le 1 +sumiisinIoplusfree

|woplusi |2 +

sumjisin[n]kisin[mj ]

iisinIoplus(jk)(xj)k

(sj)k|woplusi |2

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 (215)

+sum

jisinSiisinIjyj

|wi|2(

1 +sum

iprimeisinIjyjfree

|wjyj

iprime |2 +

sumkisin[mj ]iprimeisinI

jyjk(xj)k

(sj)k|wjyj

iprime |2

)

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 +sum

jisinSiisinIjyj

|wi|2 fwsizesj (P jyj xj)

Eq (212) follows using the bound fwsizesj (P jyj xj) le σ(y |w〉)rj for j isin S and sj = rj for j isin SNext consider the case g(x) = 0 For j isin S let |ujyj 〉 isin V jyj be a witness for f

P jyj (xj) = 0 withfwsizes(P jyj xj) = |ujyj 〉2 +

sumkisin[mj ]iisinI

jyj

k(xj)k

(sj)k|〈vi|ujyj 〉|2 As in [Rei09a Theorem 43] let

|uoplus〉 = |wprime〉V +sum

iisinISrI(y)

〈vi|wprime〉|i〉 otimes |uς(i)〉 (216)

15

Then |uoplus〉 is a witness for fQoplus(x) = 0 and moreover

fwsizes(Qoplus x) le |uoplus〉2 +sum

jisin[n]kisin[mj ]iisinIoplus(jk)(xj)k

(sj)k|〈voplusi |uoplus〉|2

= |uoplus〉2 +sum

jisin[n]rSiisinIjxj

sj |〈voplusi |uoplus〉|2 +

sumjisinSkisin[mj ]

iisinIjyjiprimeisinI

jyj

k(xj)k

(sj)k|〈voplusiiprime |uoplus〉|2

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

sj |〈vi|wprime〉|2 (217)

+sum

jisinSiisinIjyj

|〈vi|wprime〉|2(|ujyj 〉2 +

sumkisin[mj ]iprimeisinI

jyj

k(xj)k

(sj)k|〈viprime |ujyj 〉|2)

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

rj |〈vi|wprime〉|2 +sum

jisinSiisinIjyj

|〈vi|wprime〉|2 fwsizesj (P jyj xj)

Eq (213) follows using the bound fwsizesj (P jyj xj) le σ(y |wprime〉)rj for j isin S

Lemma 26 is a key step in the formula-evaluation results in this article and [Rei09b] Itis used to track the full witness size for span programs recursively composed in a direct-summanner along a formula The proof of Theorem 19 will require the lemma with the weakerbounds σ(y |w〉) σ(y |wprime〉) le maxjisinScisin01 fwsizesj (P jc)wsizesj (P jc) Theorem 111 will useonly the slightly stronger bounds σ(y |w〉) le maxjisinS fwsizesj (P jyj )wsizesj (P jyj ) σ(y |wprime〉) lemaxjisinS fwsizesj (P jyj )wsizesj (P jyj ) However the proof of [Rei09b Theorem 11] will require thebounds of Eqs (212) and (213)

3 Evaluation of almost-balanced formulas

In this section we will apply the span program framework from [Rei09a] to prove Theorem 19Our algorithm will be given by applying Theorem 24 to a certain span program Before beginningthe proof though we will give two necessary lemmas

Consider a span program P with corresponding weighted graph GP from [Rei09a Def 82]We will need a bound on the operator norm of abs(AGPv

) the entry-wise absolute value of theweighted adjacency matrix AGPv

If P is canonical [Rei09a Def 51] then we can indeed obtainsuch a bound in terms of the witness size of P

Lemma 31 Let s isin (0infin)k and let P be a canonical span program computing a function f 0 1k rarr 0 1 with input vectors indexed by the set I Assume that for each x isin 0 1k withf(x) = 0 an optimal witness to fP (x) = 0 is |x〉 itself Then

abs(AGP) le 2k

(1 +

wsizes(P )minjisin[k] sj

)+ |I| (31)

16

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 7: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

In particular Ambainis defined a boolean function f 0 14 rarr 0 1 that can be representedexactly by a polynomial of degee two but for which Adv(f) = 52 [Amb06] Thus fd can berepresented exactly by a polynomial of degree 2d but by Corollary 12 Adv(fd) = (52)d For thisfunction the adversary bound is strictly stronger than any bound obtainable using the polynomialmethod Many similar examples are given in [HLS06] However for other functions the adversarybound is asymptotically worse than the polynomial method [SS06 AS04 Amb05]

In 2007 though Hoslashyer et al discovered a strict generalization of Adv that also lower-boundsquantum query complexity [HLS07] We call this new bound the general adversary bound or AdvplusmnFor example for Ambainisrsquos four-bit function f Advplusmn(f) ge 251 [HLS06] Like the adversarybound Advplusmns (f) can be computed in time polynomial in the size of f rsquos truth table and alsocomposes nicely

Theorem 13 ([HLS07 Rei09a]) Under the conditions of Theorem 11

Advplusmn(g) = Advplusmns (f) (15)

In particular if Advplusmn(f1) = middot middot middot = Advplusmn(fk) then Advplusmn(g) = Advplusmn(f) Advplusmn(f1)

Define a formula ϕ to be adversary balanced if at each internal node the general adversarybounds of the input subformulas are equal In particular by Theorem 13 this implies that Advplusmn(ϕ)is equal to the product of the general adversary bounds of the gates along any path from the rootto a leaf Complete layered formulas are an example of adversary-balanced formulas

Returning to upper bounds Reichardt and Spalek [RS08] generalized the algorithmic approachstarted by [FGG07] They gave an optimal quantum algorithm for evaluating adversary-balancedformulas over a considerably extended gate set including in particular all functions 0 1k rarr 0 1for k le 3 69 inequivalent four-bit functions and the gates ANDk ORk PARITYk and EQUALkfor k = O(1) For example Q(MAJ3

d) = Θ(2d)The [RS08] result follows from a framework for developing formula-evaluation quantum algo-

rithms based on span programs A span program introduced by Karchmer and Wigderson [KW93]is a certain linear-algebraic way of defining a function which corresponds closely to eigenvalue-zeroeigenvectors of certain bipartite graphs [RS08] derived a quantum algorithm for evaluating certainconcatenated span programs with a query complexity upper-bounded by the span program witnesssize denoted wsize In particular a special case of [RS08 Theorem 47] is

Theorem 14 ([RS08]) Fix a function f 0 1k rarr 0 1 If span program P computes f then

Q(fd) = O(wsize(P )d

) (16)

From Theorem 13 this result is optimal if wsize(P ) = Advplusmn(f) The question thereforebecomes how to find optimal span programs Using an ad hoc search [RS08] found optimal spanprograms for a variety of functions with Advplusmn = Adv Further work automated the search bygiving a semi-definite program (SDP) for the optimal span program witness size for any givenfunction [Rei09a] Remarkably the SDPrsquos value always equals the general adversary bound

Theorem 15 ([Rei09a]) For any function f 0 1n rarr 0 1

infP

wsize(P ) = Advplusmn(f) (17)

where the infimum is over span programs P computing f Moreover this infimum is achieved

7

This result greatly extends the gate set over which the formula-evaluation algorithm of [RS08]works optimally For example combined with Theorem 14 it implies that limdrarrinfinQ(fd)1d =Advplusmn(f) for every boolean function f More generally Theorem 15 allows the [RS08] algorithmto be run on formulas over any finite gate set S A factor is lost that depends on the gates in Sbut it will be a constant for S finite Combining Theorem 15 with [RS08 Theorem 47] gives

Theorem 16 ([Rei09a]) Let S be a finite set of gates Then there exists a quantum algorithm thatevaluates an adversary-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After efficient

classical preprocessing independent of the input x and assuming unit-time coherent access to thepreprocessed classical string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

In the discussion so far we have for simplicity focused on query complexity The query com-plexity is an information-theoretic quantity that does not charge for operations independent of theinput string even though these operations may require many elementary gates to implement Forpractical algorithms it is important to be able to bound the algorithmrsquos running time which countsthe cost of implementing the input-independent operations Theorem 16 puts an optimal boundon the query complexity and also puts a nearly optimal bound on the algorithmrsquos time complexityIn fact all of the query-optimal algorithms so far discussed are also nearly time optimal

In general though an upper bound on the query complexity does not imply an upper boundon the time complexity Ref [Rei09a] also generalized the span program framework of [RS08] toapply to quantum algorithms not based on formulas The main result of [Rei09a] is

Theorem 17 ([Rei09a]) For any function f D rarr 1 2 m with D sube 0 1n Q(f) satisfies

Q(f) = Ω(Advplusmn(f)) and Q(f) = O

(Advplusmn(f)

log Advplusmn(f)log log Advplusmn(f)

log(m) log logm) (18)

Theorem 17 in particular allows us to compute the query complexity of formulas up to thelogarithmic factor It does not give any guarantees on running time However the analysis requiredto prove Theorem 17 also leads to significantly simpler proofs of Theorem 16 and the AND-ORformula results of [ACR+07 FGG07] Moreover we will see that it allows the formula-evaluationalgorithms to be extended to formulas that are not adversary balanced

13 Quantum algorithm for evaluating almost-balanced formulas

We give a formula-evaluation algorithm that is both query-optimal without a logarithmic overheadand after an efficient preprocessing step nearly time optimal Define almost balance as follows

Definition 18 Consider a formula ϕ over a gate set S For a vertex v in the correspondingtree let ϕv denote the subformula of ϕ rooted at v and if v is an internal vertex let gv be thecorresponding gate The formula ϕ is β-balanced if for every vertex v with children c1 c2 ck

maxj Advplusmn(ϕcj )minj Advplusmn(ϕcj )

le β (19)

(If cj is a leaf Advplusmn(ϕcj ) = 1) Formula ϕ is almost balanced if it is β-balanced for some β = O(1)

In particular an adversary-balanced formula is 1-balanced We will show

8

Theorem 19 Let S be a fixed finite set of gates Then there exists a quantum algorithm thatevaluates an almost-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After polynomial-

time classical preprocessing independent of the input and assuming unit-time coherent access tothe preprocessed string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

Theorem 19 is significantly stronger than Theorem 16 which requires exact balance Thereare important classes of exactly balanced formulas such as complete layered formulas In fact it issufficient that the multiset of gates along the simple path from the root to a leaf not depend on theleaf Moreover sometimes different gates have the same Advplusmn bound see [HLS06] for examplesEven still exact adversary balance is a very strict condition

The proof of Theorem 19 is based on the span program framework developed in Ref [Rei09a]In particular [Rei09a Theorem 91] gives two quantum algorithms for evaluating span programsThe first algorithm is based on a discrete-time simulation of a continuous-time quantum walkIt applies to arbitrary span programs and is used in combination with Theorem 15 to proveTheorem 17 However the simulation incurs a logarithmic query overhead and potentially worsetime complexity overhead so this algorithm is not suitable for proving Theorem 19

The second algorithm in [Rei09a] is based directly on a discrete-time quantum walk similarto previous optimal formula-evaluation algorithms [ACR+07 RS08] However this algorithm doesnot apply to an arbitrary span program A bound is needed on the operator norm of the entry-wiseabsolute value of the weighted adjacency matrix for a corresponding graph Further graph sparsityconditions are needed for the algorithm to be time efficient (see Theorem 24)

Unfortunately the span program from Theorem 15 will not generally satisfy these conditionsTheorem 15 gives a canonical span program ([Rei09a Def 51]) Even for a simple formula theoptimal canonical span program will typically correspond to a dense graph with large norm

An example should clarify the problem Consider the AND-OR formula ψ(x) =([(x1 and x2) or

x3] and x4

)or(x5 and [x6 or x7]

) and consider the two graphs in Figure 1 For an input x isin 0 17

modify the graphs by attaching dangling edges to every vertex j for which xj = 0 Observe thenthat each graph has an eigenvalue-zero eigenvector supported on vertex 0mdashcalled a witnessmdashif andonly if ψ(x) = 1 The graphs correspond to different span programs computing ψ and the quantumalgorithm works essentially by running a quantum walk starting at vertex 0 in order to detect thewitness The graph on the left is a significantly simplified version of a canonical span program forψ and its density still makes it difficult to implement the quantum walk

We will be guided by the second simpler graph Instead of applying Theorem 15 to ϕ as awhole we apply it separately to every gate in the formula We then compose these span programsone per gate according to the formula using direct-sum composition (Definition 25) In terms ofgraphs direct-sum composition attaches the output vertex of one span programrsquos graph to an inputvertex of the next [RS08] This leads to a graph whose structure somewhat follows the structure ofthe formula ϕ as the graph in Figure 1(b) follows the structure of ψ (However the general casewill be more complicated than shown as we are plugging together constant-size graph gadgets andthere may be duplication of some subgraphs)

Direct-sum composition keeps the maximum degree and norm of the graph under controlmdasheachis at most twice its value for the worst single gate Therefore the second [Rei09a] algorithm appliesHowever direct-sum composition also leads to additional overhead In particular a witness in thefirst graph will be supported only on numbered vertices (note that the graph is bipartite) whereasa witness in the second graph will be supported on some of the internal vertices as well This meansroughly that the second witness will be harder to detect because after normalization its overlap on

9

0

1

2

3

4

5

6

7

(a)

3

6

7

0

1

2

4

5

(b)

Figure 1 Graphs corresponding to two span programs both computing the same function

vertex 0 will be smaller Scale both witnesses so that the amplitude on vertex 0 is one The witnesssize (wsize) measures the squared length of the witness only on numbered vertices whereas the fullwitness size (fwsize) measures the squared length on all vertices For [Rei09a] it was sufficient toconsider only span program witness size because for canonical span programs like in Figure 1(a)the two measures are equal (For technical reasons we will actually define fwsize to be 1 + wsizeeven in this case) For our analysis we will need to bound the full witness size in terms of thewitness size We maintain this bound in a recursion from the formularsquos leaves toward its root

A span program is called strict if every vertex on one half of the bipartite graph is either aninput vertex (vertices 1ndash7 in the graphs of Figure 1) or the output vertex (vertex 0) Thus the firstgraph in the example above corresponds to a strict span program and the second does not Theoriginal definition of span programs in [KW93] allowed for only strict span programs This wassensible because any other vertices on the inputoutput part of the graphrsquos bipartition can alwaysbe projected away yielding a strict span program that computes the same function For developingtime-efficient quantum algorithms though it seems important to consider span programs that arenot strict Unfortunately going backwards eg from 1(a) to 1(b) is probably difficult in general

Theorem 19 does not follow from the formula-evaluation techniques of [RS08] together withTheorem 14 from [Rei09a] This tempting approach falls into intractable technical difficulties Inparticular the same span program can be used at two vertices v and w in ϕ only if gv = gw andthe general adversary bounds of vrsquos input subformulas are the same as those for wrsquos inputs upto simultaneous scaling In general then an almost-balanced formula will require an unboundednumber of different span programs However the analysis in [RS08] loses a factor that dependsbadly on the individual span programs Since the dependence is not continuous even showingthat the span programs in use all lie within a compact set would not be sufficient to obtain anO(1) upper bound In contrast the approach we follow here allows bounding the lost factor by anexponential in k uniformly over different gate imbalances

10

14 Quantum algorithm to evaluate approximately balanced AND-OR formulas

Ambainis et al [ACR+07] use a weaker balance criterion for AND-OR formulas than Definition 18They define an AND-OR formula to be approximately balanced if σminus(ϕ) = O(1) and σ+(ϕ) = O(n)Here n is the size of the formula ie the number of leaves and σminus(ϕ) and σ+(ϕ) are defined by

Definition 110 For each vertex v in a formula ϕ let

σminus(v) = maxξ

sumwisinξ

1Advplusmn(ϕw)

σ+(v) = maxξ

sumwisinξ

Advplusmn(ϕw)2 (110)

with each maximum taken over all simple paths ξ from v to a leaf Let σplusmn(ϕ) = σplusmn(r) where r isthe root of ϕ

Recall that Advplusmn(ϕ) = Adv(ϕ) =radicn for an AND-OR formula Definition 18 is a stricter

balance criterion because β-balance of a formula ϕ implies (by Lemma 32) that σminus(ϕ) and σ+(ϕ) areboth dominated by geometric series However the same steps followed by the proof of Theorem 19still suffice for proving the [ACR+07] result and in fact for strengthening it We show

Theorem 111 Let ϕ be an AND-OR formula of size n Then after polynomial-time classicalpreprocessing that does not depend on the input x ϕ(x) can be evaluated by a quantum algo-rithm with error at most 13 using O

(radicnσminus(ϕ)

)input queries The algorithmrsquos running time isradic

nσminus(ϕ)(log n)O(1) assuming unit-cost coherent access to the preprocessed string

For the special case of AND-OR formulas with σminus(ϕ) = O(1) Theorem 111 strengthens The-orem 19 The requirement that σminus(ϕ) = O(1) allows for some gates in the formula to be veryunbalanced Theorem 111 also strengthens [ACR+07 Theorem 1] because it does not require thatσ+(ϕ) = O(n) For example a formula that is biased near the root but balanced at greater depthscan have σminus(ϕ) = O(1) and σ+(ϕ) = ω(n) By substituting the bound σminus(ϕ) = O(

radicd) for a depth-

d formula [ACR+07 Def 3] a corollary of Theorem 111 is that a depth-d size-n AND-OR formulacan be evaluated using O(

radicnd) queries This improves the depth-dependence from [ACR+07] and

matches the dependence from an earlier version of that article [Amb07]The essential reason that the Definition 18 balance condition can be weakened is that for the

specific gates AND and OR by writing out the optimal span programs explicitly we can prove thatthey satisfy stronger properties than are necessarily true for other functions

2 Span programs

21 Definitions

We briefly recall some definitions from [Rei09a Sec 2] Additionally we define a span programcomplexity measure the full witness size that charges even for the ldquofreerdquo inputs This quantity isimportant for developing quantum algorithms that are time efficient as well as query efficient

For a natural number n let [n] = 1 2 n For a finite set X let CX be the inner productspace C|X| with orthonormal basis |x〉 x isin X For vector spaces V and W over C let L(VW )be the set of linear transformations from V into W and let L(V ) = L(V V ) For A isin L(VW )A is the operator norm of A For a string x isin 0 1n let x denote its bitwise complement

11

Definition 21 ([HLS05 HLS07]) For finite sets C E and D sube Cn let f D rarr E An adversarymatrix for f is a real symmetric matrix Γ isin L(CD) that satisfies 〈x|Γ|y〉 = 0 whenever f(x) = f(y)

The general adversary bound for f with costs s isin [0infin)n is

Advplusmns (f) = maxadversary matrices Γforalljisin[n] Γ∆jlesj

Γ (21)

Here Γ ∆j denotes the entry-wise matrix product between Γ and ∆j =sum

xyxj 6=yj|x〉〈y| The

(nonnegative-weight) adversary bound for f with costs s is defined by the same maximizationexcept with Γ restricted to have nonnegative entries In particular Advplusmns (f) ge Advs(f)

Letting ~1 = (1 1 1) the adversary bound for f is Adv(f) = Adv~1(f) and the generaladversary bound for f is Advplusmn(f) = Advplusmn~1 (f) By [HLS07] Q(f) = Ω(Advplusmn(f))

Definition 22 (Span program [KW93]) A span program P consists of a natural number n afinite-dimensional inner product space V over C a ldquotargetrdquo vector |t〉 isin V disjoint sets Ifree andIjb for j isin [n] b isin 0 1 and ldquoinput vectorsrdquo |vi〉 isin V for i isin Ifree cup

⋃jisin[n]bisin01 Ijb

To P corresponds a function fP 0 1n rarr 0 1 defined on x isin 0 1n by

fP (x) =

1 if |t〉 isin Span(|vi〉 i isin Ifree cup

⋃jisin[n] Ijxj)

0 otherwise(22)

Some additional notation is convenient Fix a span program P Let I = Ifreecup⋃jisin[n]bisin01 Ijb

Let A isin L(CI V ) be given by A =sum

iisinI |vi〉〈i| For x isin 0 1n let I(x) = Ifree cup⋃jisin[n] Ijxj and

Π(x) =sum

iisinI(x) |i〉〈i| isin L(CI) Then fP (x) = 1 if |t〉 isin Range(AΠ(x)) A vector |w〉 isin CI is saidto be a witness for fP (x) = 1 if Π(x)|w〉 = |w〉 and A|w〉 = |t〉 A vector |wprime〉 isin V is said to be awitness for fP (x) = 0 if 〈t|wprime〉 = 1 and Π(x)Adagger|wprime〉 = 0

Definition 23 (Witness size) Consider a span program P and a vector s isin [0infin)n of nonnegativeldquocostsrdquo Let S =

sumjisin[n]bisin01iisinIjb

radicsj |i〉〈i| isin L(CI) For each input x isin 0 1n define the witness

size of P on x with costs s wsizes(P x) as follows

wsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉 S|w〉2 if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

SAdagger|wprime〉2 if fP (x) = 0 (23)

The witness size of P with costs s is

wsizes(P ) = maxxisin01n

wsizes(P x) (24)

Define the full witness size fwsizes(P ) by letting Sf = S +sum

iisinIfree|i〉〈i| and

fwsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉(1 + Sf |w〉2) if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

(|wprime〉2 + SAdagger|wprime〉2) if fP (x) = 0 (25)

fwsizes(P ) = maxxisin01n

fwsizes(P x) (26)

When the subscript s is omitted the costs are taken to be uniform s = ~1 = (1 1 1) egfwsize(P ) = fwsize~1(P ) The witness size is defined in [RS08] The full witness size is definedin [Rei09a Sec 8] but is not named there A strict span program has Ifree = empty so Sf = S and amonotone span program has Ij0 = empty for all j [Rei09a Def 49]

12

22 Quantum algorithm to evaluate a span program based on its full witness size

[Rei09a Theorem 93] gives a quantum query algorithm for evaluating span programs based on thefull witness size The algorithm is based on a quantum walk on a certain graph Provided that thedegree of the graph is not too large it can actually be implemented efficiently

Theorem 24 ([Rei09a Theorem 93]) Let P be a span program Then fP can be evaluated using

T = O(fwsize(P ) abs(AGP

))

(27)

quantum queries with error probability at most 13 Moreover if the maximum degree of a vertexin GP is d then the time complexity of the algorithm for evaluating fP is at most a factor of(log d)

(log(T log d)

)O(1) worse after classical preprocessing and assuming constant-time coherentaccess to the preprocessed string

Proof sketch The query complexity claim is actually slightly weaker than [Rei09a Theorem 93]which allows the target vector to be scaled downward by a factor of

radicfwsize(P )

The time-complexity claim will follow from the proof of [Rei09a Theorem 93] in [Rei09aProp 94 Theorem 95] The algorithm for evaluating fP (x) uses a discrete-time quantum walkon the graph GP (x) If the maximum degree of a vertex in GP is d then each coin reflec-tion can be implemented using O(log d) single-qubit unitaries and queries to the preprocessedstring [GR02 CNW09] Finally the

(log(T log d)

)O(1) factor comes from applying the Solovay-Kitaev Theorem [KSV02] to compile the single-qubit unitaries into products of elementary gatesto precision 1O(T log d)

We remark that together with [Rei09a Theorem 31] Theorem 24 gives a way of transforming aone-sided-error quantum algorithm into a span program and back into a quantum algorithm suchthat the time complexity is nearly preserved after preprocessing This is only a weak equivalencebecause aside from requiring preprocessing the algorithm from Theorem 24 also has two-sided errorTo some degree though it complements the equivalence results for best span program witness sizeand bounded-error quantum query complexity [Rei09a Theorem 71 Theorem 92]

23 Direct-sum span program composition

Let us study the full witness size of the direct-sum composition of span programs We begin byrecalling the definition of direct-sum composition

Let f 0 1n rarr 0 1 and S sube [n] For j isin [n] let mj be a natural number with mj = 1 forj isin S For j isin S let fj 0 1mj rarr 0 1 Define y 0 1m1 times middot middot middot times 0 1mn rarr 0 1n by

y(x)j =

fj(xj) if j isin Sxj if j isin S

(28)

Define g 0 1m1 times middot middot middottimes 0 1mn rarr 0 1 by g(x) = f(y(x)) For example if S = [n] r 1 then

g(x) = f(x1 f2(x2) fn(xn)

) (29)

Given span programs for the individual functions f and fj for j isin S we will construct a spanprogram for g We remark that although we are here requiring that the inner functions fj act on

13

disjoint sets of bits this assumption is not necessary for the definition It simplifies the notationthough for the cases S 6= [n] and will suffice for our applications

Let P be a span program computing fP = f Let P have inner product space V target vector|t〉 and input vectors |vi〉 indexed by Ifree and Ijc for j isin [n] and c isin 0 1

For j isin [n] let sj isin [0infin)mj be a vector of costs and let s isin [0infin)Pmj be the concatenation of

the vectors sj For j isin S let P j0 and P j1 be span programs computing fP j1 = fj 0 1mj rarr 0 1and fP j0 = notfj with rj = wsizesj (P j0) = wsizesj (P j1) For c isin 0 1 let P jc have inner productspace V jc with target vector |tjc〉 and input vectors indexed by Ijcfree and Ijckb for k isin [mj ] b isin 0 1For j isin S let rj = sj

Let IS =⋃jisinScisin01 Ijc Define ς IS rarr [n]times 0 1 by ς(i) = (j c) if i isin Ijc The idea is that

ς maps i to the input span program that must evaluate to 1 in order for |vi〉 to be available in P There are several ways of composing the span programs P and P jc to obtain a span program Q

computing the composed function fQ = g with wsizes(Q) le wsizer(P ) [Rei09a Defs 44 45 46]We focus on direct-sum composition

Definition 25 ([Rei09a Def 45]) The direct-sum-composed span program Qoplus is defined by

bull The inner product space is V oplus = V oplusoplus

jisinScisin01(CIjc otimes V jc) Any vector in V oplus can be

uniquely expressed as |u〉V +sum

iisinIS |i〉 otimes |ui〉 where |u〉 isin V and |ui〉 isin V ς(i)

bull The target vector is |toplus〉 = |t〉V

bull The free input vectors are indexed by Ioplusfree = Ifree cup IS cup⋃jisinScisin01(Ijc times Ijcfree) with for

i isin Ioplusfree

|voplusi 〉 =

|vi〉V if i isin Ifree

|vi〉V minus |i〉 otimes |tjc〉 if i isin Ijc and j isin S|iprime〉 otimes |viprimeprime〉 if i = (iprime iprimeprime) isin Ijc times Ijcfree

(210)

bull The other input vectors are indexed by Ioplus(jk)b for j isin [n] k isin [mj ] b isin 0 1 For j isin S

Ioplus(j1)b = Ijb with |voplusi 〉 = |vi〉V for i isin Ioplus(j1)b For j isin S let Ioplus(jk)b =⋃cisin01(Ijc times I

jckb) For

i isin Ijc and iprime isin Ijckb let|voplusiiprime〉 = |i〉 otimes |viprime〉 (211)

By [Rei09a Theorem 43] fQoplus = g and wsizes(Qoplus) le wsizer(P ) (While that theorem is statedonly for the case S = [n] it is trivially extended to other S sub [n]) We give a bound on how quicklythe full witness size can grow relative to the witness size

Lemma 26 Under the above conditions for each input x isin 0 1m1timesmiddot middot middottimes0 1mn with y = y(x)

bull If g(x) = 1 let |w〉 be a witness to fP (y) = 1 such thatsum

jisin[n]iisinIjyjrj |wi|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |w〉

)+

1 +sum

iisinIfree|wi|2

wsizer(P y)

where σ(y |w〉) = maxjisinS

existi isin Ijyj with 〈i|w〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(212)

14

bull If g(x) = 0 let |wprime〉 be a witness to fP (y) = 0 such thatsum

jisin[n]iisinIjyjrj |〈wprime|vi〉|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |wprime〉) +|wprime〉2

wsizer(P y)

where σ(y |wprime〉) = maxjisinS

existi isin Ijyj with 〈vi|wprime〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(213)

If S = empty then σ(y |w〉) and σ(y |wprime〉) should each be taken to be 1 in the above equations

Proof We follow the proof of [Rei09a Theorem 43] except keeping track of the full witness sizeNote that if S = empty then Eqs (212) and (213) are immediate by definition of fwsizes(Qoplus x)

Let I(y)prime = I(y) r Ifree =⋃jisin[n] Ijyj

In the first case g(x) = 1 for j isin S let |wjyj 〉 isin CIjyj be a witness to fP jyj (xj) = 1 such that

fwsizes(P jyj xj) = 1 +sum

iisinIjyjfree

|wjyj

i |2

+sum

kisin[mj ]iisinIjyjk(xj)k

(sj)k|wjyj

i |2 As in [Rei09a Theorem 43]

let |woplus〉 isin CIoplus(x) be given by

woplusi =

wi if i isin I(y)

wiprimewς(iprime)iprimeprime if i = (iprime iprimeprime) with iprime isin I(y)prime cap IS iprimeprime isin Iς(iprime)(x)

0 otherwise

(214)

Then |woplus〉 is a witness for fQoplus(x) = 1 and we compute

fwsizes(Qoplus x) le 1 +sumiisinIoplusfree

|woplusi |2 +

sumjisin[n]kisin[mj ]

iisinIoplus(jk)(xj)k

(sj)k|woplusi |2

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 (215)

+sum

jisinSiisinIjyj

|wi|2(

1 +sum

iprimeisinIjyjfree

|wjyj

iprime |2 +

sumkisin[mj ]iprimeisinI

jyjk(xj)k

(sj)k|wjyj

iprime |2

)

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 +sum

jisinSiisinIjyj

|wi|2 fwsizesj (P jyj xj)

Eq (212) follows using the bound fwsizesj (P jyj xj) le σ(y |w〉)rj for j isin S and sj = rj for j isin SNext consider the case g(x) = 0 For j isin S let |ujyj 〉 isin V jyj be a witness for f

P jyj (xj) = 0 withfwsizes(P jyj xj) = |ujyj 〉2 +

sumkisin[mj ]iisinI

jyj

k(xj)k

(sj)k|〈vi|ujyj 〉|2 As in [Rei09a Theorem 43] let

|uoplus〉 = |wprime〉V +sum

iisinISrI(y)

〈vi|wprime〉|i〉 otimes |uς(i)〉 (216)

15

Then |uoplus〉 is a witness for fQoplus(x) = 0 and moreover

fwsizes(Qoplus x) le |uoplus〉2 +sum

jisin[n]kisin[mj ]iisinIoplus(jk)(xj)k

(sj)k|〈voplusi |uoplus〉|2

= |uoplus〉2 +sum

jisin[n]rSiisinIjxj

sj |〈voplusi |uoplus〉|2 +

sumjisinSkisin[mj ]

iisinIjyjiprimeisinI

jyj

k(xj)k

(sj)k|〈voplusiiprime |uoplus〉|2

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

sj |〈vi|wprime〉|2 (217)

+sum

jisinSiisinIjyj

|〈vi|wprime〉|2(|ujyj 〉2 +

sumkisin[mj ]iprimeisinI

jyj

k(xj)k

(sj)k|〈viprime |ujyj 〉|2)

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

rj |〈vi|wprime〉|2 +sum

jisinSiisinIjyj

|〈vi|wprime〉|2 fwsizesj (P jyj xj)

Eq (213) follows using the bound fwsizesj (P jyj xj) le σ(y |wprime〉)rj for j isin S

Lemma 26 is a key step in the formula-evaluation results in this article and [Rei09b] Itis used to track the full witness size for span programs recursively composed in a direct-summanner along a formula The proof of Theorem 19 will require the lemma with the weakerbounds σ(y |w〉) σ(y |wprime〉) le maxjisinScisin01 fwsizesj (P jc)wsizesj (P jc) Theorem 111 will useonly the slightly stronger bounds σ(y |w〉) le maxjisinS fwsizesj (P jyj )wsizesj (P jyj ) σ(y |wprime〉) lemaxjisinS fwsizesj (P jyj )wsizesj (P jyj ) However the proof of [Rei09b Theorem 11] will require thebounds of Eqs (212) and (213)

3 Evaluation of almost-balanced formulas

In this section we will apply the span program framework from [Rei09a] to prove Theorem 19Our algorithm will be given by applying Theorem 24 to a certain span program Before beginningthe proof though we will give two necessary lemmas

Consider a span program P with corresponding weighted graph GP from [Rei09a Def 82]We will need a bound on the operator norm of abs(AGPv

) the entry-wise absolute value of theweighted adjacency matrix AGPv

If P is canonical [Rei09a Def 51] then we can indeed obtainsuch a bound in terms of the witness size of P

Lemma 31 Let s isin (0infin)k and let P be a canonical span program computing a function f 0 1k rarr 0 1 with input vectors indexed by the set I Assume that for each x isin 0 1k withf(x) = 0 an optimal witness to fP (x) = 0 is |x〉 itself Then

abs(AGP) le 2k

(1 +

wsizes(P )minjisin[k] sj

)+ |I| (31)

16

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 8: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

This result greatly extends the gate set over which the formula-evaluation algorithm of [RS08]works optimally For example combined with Theorem 14 it implies that limdrarrinfinQ(fd)1d =Advplusmn(f) for every boolean function f More generally Theorem 15 allows the [RS08] algorithmto be run on formulas over any finite gate set S A factor is lost that depends on the gates in Sbut it will be a constant for S finite Combining Theorem 15 with [RS08 Theorem 47] gives

Theorem 16 ([Rei09a]) Let S be a finite set of gates Then there exists a quantum algorithm thatevaluates an adversary-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After efficient

classical preprocessing independent of the input x and assuming unit-time coherent access to thepreprocessed classical string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

In the discussion so far we have for simplicity focused on query complexity The query com-plexity is an information-theoretic quantity that does not charge for operations independent of theinput string even though these operations may require many elementary gates to implement Forpractical algorithms it is important to be able to bound the algorithmrsquos running time which countsthe cost of implementing the input-independent operations Theorem 16 puts an optimal boundon the query complexity and also puts a nearly optimal bound on the algorithmrsquos time complexityIn fact all of the query-optimal algorithms so far discussed are also nearly time optimal

In general though an upper bound on the query complexity does not imply an upper boundon the time complexity Ref [Rei09a] also generalized the span program framework of [RS08] toapply to quantum algorithms not based on formulas The main result of [Rei09a] is

Theorem 17 ([Rei09a]) For any function f D rarr 1 2 m with D sube 0 1n Q(f) satisfies

Q(f) = Ω(Advplusmn(f)) and Q(f) = O

(Advplusmn(f)

log Advplusmn(f)log log Advplusmn(f)

log(m) log logm) (18)

Theorem 17 in particular allows us to compute the query complexity of formulas up to thelogarithmic factor It does not give any guarantees on running time However the analysis requiredto prove Theorem 17 also leads to significantly simpler proofs of Theorem 16 and the AND-ORformula results of [ACR+07 FGG07] Moreover we will see that it allows the formula-evaluationalgorithms to be extended to formulas that are not adversary balanced

13 Quantum algorithm for evaluating almost-balanced formulas

We give a formula-evaluation algorithm that is both query-optimal without a logarithmic overheadand after an efficient preprocessing step nearly time optimal Define almost balance as follows

Definition 18 Consider a formula ϕ over a gate set S For a vertex v in the correspondingtree let ϕv denote the subformula of ϕ rooted at v and if v is an internal vertex let gv be thecorresponding gate The formula ϕ is β-balanced if for every vertex v with children c1 c2 ck

maxj Advplusmn(ϕcj )minj Advplusmn(ϕcj )

le β (19)

(If cj is a leaf Advplusmn(ϕcj ) = 1) Formula ϕ is almost balanced if it is β-balanced for some β = O(1)

In particular an adversary-balanced formula is 1-balanced We will show

8

Theorem 19 Let S be a fixed finite set of gates Then there exists a quantum algorithm thatevaluates an almost-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After polynomial-

time classical preprocessing independent of the input and assuming unit-time coherent access tothe preprocessed string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

Theorem 19 is significantly stronger than Theorem 16 which requires exact balance Thereare important classes of exactly balanced formulas such as complete layered formulas In fact it issufficient that the multiset of gates along the simple path from the root to a leaf not depend on theleaf Moreover sometimes different gates have the same Advplusmn bound see [HLS06] for examplesEven still exact adversary balance is a very strict condition

The proof of Theorem 19 is based on the span program framework developed in Ref [Rei09a]In particular [Rei09a Theorem 91] gives two quantum algorithms for evaluating span programsThe first algorithm is based on a discrete-time simulation of a continuous-time quantum walkIt applies to arbitrary span programs and is used in combination with Theorem 15 to proveTheorem 17 However the simulation incurs a logarithmic query overhead and potentially worsetime complexity overhead so this algorithm is not suitable for proving Theorem 19

The second algorithm in [Rei09a] is based directly on a discrete-time quantum walk similarto previous optimal formula-evaluation algorithms [ACR+07 RS08] However this algorithm doesnot apply to an arbitrary span program A bound is needed on the operator norm of the entry-wiseabsolute value of the weighted adjacency matrix for a corresponding graph Further graph sparsityconditions are needed for the algorithm to be time efficient (see Theorem 24)

Unfortunately the span program from Theorem 15 will not generally satisfy these conditionsTheorem 15 gives a canonical span program ([Rei09a Def 51]) Even for a simple formula theoptimal canonical span program will typically correspond to a dense graph with large norm

An example should clarify the problem Consider the AND-OR formula ψ(x) =([(x1 and x2) or

x3] and x4

)or(x5 and [x6 or x7]

) and consider the two graphs in Figure 1 For an input x isin 0 17

modify the graphs by attaching dangling edges to every vertex j for which xj = 0 Observe thenthat each graph has an eigenvalue-zero eigenvector supported on vertex 0mdashcalled a witnessmdashif andonly if ψ(x) = 1 The graphs correspond to different span programs computing ψ and the quantumalgorithm works essentially by running a quantum walk starting at vertex 0 in order to detect thewitness The graph on the left is a significantly simplified version of a canonical span program forψ and its density still makes it difficult to implement the quantum walk

We will be guided by the second simpler graph Instead of applying Theorem 15 to ϕ as awhole we apply it separately to every gate in the formula We then compose these span programsone per gate according to the formula using direct-sum composition (Definition 25) In terms ofgraphs direct-sum composition attaches the output vertex of one span programrsquos graph to an inputvertex of the next [RS08] This leads to a graph whose structure somewhat follows the structure ofthe formula ϕ as the graph in Figure 1(b) follows the structure of ψ (However the general casewill be more complicated than shown as we are plugging together constant-size graph gadgets andthere may be duplication of some subgraphs)

Direct-sum composition keeps the maximum degree and norm of the graph under controlmdasheachis at most twice its value for the worst single gate Therefore the second [Rei09a] algorithm appliesHowever direct-sum composition also leads to additional overhead In particular a witness in thefirst graph will be supported only on numbered vertices (note that the graph is bipartite) whereasa witness in the second graph will be supported on some of the internal vertices as well This meansroughly that the second witness will be harder to detect because after normalization its overlap on

9

0

1

2

3

4

5

6

7

(a)

3

6

7

0

1

2

4

5

(b)

Figure 1 Graphs corresponding to two span programs both computing the same function

vertex 0 will be smaller Scale both witnesses so that the amplitude on vertex 0 is one The witnesssize (wsize) measures the squared length of the witness only on numbered vertices whereas the fullwitness size (fwsize) measures the squared length on all vertices For [Rei09a] it was sufficient toconsider only span program witness size because for canonical span programs like in Figure 1(a)the two measures are equal (For technical reasons we will actually define fwsize to be 1 + wsizeeven in this case) For our analysis we will need to bound the full witness size in terms of thewitness size We maintain this bound in a recursion from the formularsquos leaves toward its root

A span program is called strict if every vertex on one half of the bipartite graph is either aninput vertex (vertices 1ndash7 in the graphs of Figure 1) or the output vertex (vertex 0) Thus the firstgraph in the example above corresponds to a strict span program and the second does not Theoriginal definition of span programs in [KW93] allowed for only strict span programs This wassensible because any other vertices on the inputoutput part of the graphrsquos bipartition can alwaysbe projected away yielding a strict span program that computes the same function For developingtime-efficient quantum algorithms though it seems important to consider span programs that arenot strict Unfortunately going backwards eg from 1(a) to 1(b) is probably difficult in general

Theorem 19 does not follow from the formula-evaluation techniques of [RS08] together withTheorem 14 from [Rei09a] This tempting approach falls into intractable technical difficulties Inparticular the same span program can be used at two vertices v and w in ϕ only if gv = gw andthe general adversary bounds of vrsquos input subformulas are the same as those for wrsquos inputs upto simultaneous scaling In general then an almost-balanced formula will require an unboundednumber of different span programs However the analysis in [RS08] loses a factor that dependsbadly on the individual span programs Since the dependence is not continuous even showingthat the span programs in use all lie within a compact set would not be sufficient to obtain anO(1) upper bound In contrast the approach we follow here allows bounding the lost factor by anexponential in k uniformly over different gate imbalances

10

14 Quantum algorithm to evaluate approximately balanced AND-OR formulas

Ambainis et al [ACR+07] use a weaker balance criterion for AND-OR formulas than Definition 18They define an AND-OR formula to be approximately balanced if σminus(ϕ) = O(1) and σ+(ϕ) = O(n)Here n is the size of the formula ie the number of leaves and σminus(ϕ) and σ+(ϕ) are defined by

Definition 110 For each vertex v in a formula ϕ let

σminus(v) = maxξ

sumwisinξ

1Advplusmn(ϕw)

σ+(v) = maxξ

sumwisinξ

Advplusmn(ϕw)2 (110)

with each maximum taken over all simple paths ξ from v to a leaf Let σplusmn(ϕ) = σplusmn(r) where r isthe root of ϕ

Recall that Advplusmn(ϕ) = Adv(ϕ) =radicn for an AND-OR formula Definition 18 is a stricter

balance criterion because β-balance of a formula ϕ implies (by Lemma 32) that σminus(ϕ) and σ+(ϕ) areboth dominated by geometric series However the same steps followed by the proof of Theorem 19still suffice for proving the [ACR+07] result and in fact for strengthening it We show

Theorem 111 Let ϕ be an AND-OR formula of size n Then after polynomial-time classicalpreprocessing that does not depend on the input x ϕ(x) can be evaluated by a quantum algo-rithm with error at most 13 using O

(radicnσminus(ϕ)

)input queries The algorithmrsquos running time isradic

nσminus(ϕ)(log n)O(1) assuming unit-cost coherent access to the preprocessed string

For the special case of AND-OR formulas with σminus(ϕ) = O(1) Theorem 111 strengthens The-orem 19 The requirement that σminus(ϕ) = O(1) allows for some gates in the formula to be veryunbalanced Theorem 111 also strengthens [ACR+07 Theorem 1] because it does not require thatσ+(ϕ) = O(n) For example a formula that is biased near the root but balanced at greater depthscan have σminus(ϕ) = O(1) and σ+(ϕ) = ω(n) By substituting the bound σminus(ϕ) = O(

radicd) for a depth-

d formula [ACR+07 Def 3] a corollary of Theorem 111 is that a depth-d size-n AND-OR formulacan be evaluated using O(

radicnd) queries This improves the depth-dependence from [ACR+07] and

matches the dependence from an earlier version of that article [Amb07]The essential reason that the Definition 18 balance condition can be weakened is that for the

specific gates AND and OR by writing out the optimal span programs explicitly we can prove thatthey satisfy stronger properties than are necessarily true for other functions

2 Span programs

21 Definitions

We briefly recall some definitions from [Rei09a Sec 2] Additionally we define a span programcomplexity measure the full witness size that charges even for the ldquofreerdquo inputs This quantity isimportant for developing quantum algorithms that are time efficient as well as query efficient

For a natural number n let [n] = 1 2 n For a finite set X let CX be the inner productspace C|X| with orthonormal basis |x〉 x isin X For vector spaces V and W over C let L(VW )be the set of linear transformations from V into W and let L(V ) = L(V V ) For A isin L(VW )A is the operator norm of A For a string x isin 0 1n let x denote its bitwise complement

11

Definition 21 ([HLS05 HLS07]) For finite sets C E and D sube Cn let f D rarr E An adversarymatrix for f is a real symmetric matrix Γ isin L(CD) that satisfies 〈x|Γ|y〉 = 0 whenever f(x) = f(y)

The general adversary bound for f with costs s isin [0infin)n is

Advplusmns (f) = maxadversary matrices Γforalljisin[n] Γ∆jlesj

Γ (21)

Here Γ ∆j denotes the entry-wise matrix product between Γ and ∆j =sum

xyxj 6=yj|x〉〈y| The

(nonnegative-weight) adversary bound for f with costs s is defined by the same maximizationexcept with Γ restricted to have nonnegative entries In particular Advplusmns (f) ge Advs(f)

Letting ~1 = (1 1 1) the adversary bound for f is Adv(f) = Adv~1(f) and the generaladversary bound for f is Advplusmn(f) = Advplusmn~1 (f) By [HLS07] Q(f) = Ω(Advplusmn(f))

Definition 22 (Span program [KW93]) A span program P consists of a natural number n afinite-dimensional inner product space V over C a ldquotargetrdquo vector |t〉 isin V disjoint sets Ifree andIjb for j isin [n] b isin 0 1 and ldquoinput vectorsrdquo |vi〉 isin V for i isin Ifree cup

⋃jisin[n]bisin01 Ijb

To P corresponds a function fP 0 1n rarr 0 1 defined on x isin 0 1n by

fP (x) =

1 if |t〉 isin Span(|vi〉 i isin Ifree cup

⋃jisin[n] Ijxj)

0 otherwise(22)

Some additional notation is convenient Fix a span program P Let I = Ifreecup⋃jisin[n]bisin01 Ijb

Let A isin L(CI V ) be given by A =sum

iisinI |vi〉〈i| For x isin 0 1n let I(x) = Ifree cup⋃jisin[n] Ijxj and

Π(x) =sum

iisinI(x) |i〉〈i| isin L(CI) Then fP (x) = 1 if |t〉 isin Range(AΠ(x)) A vector |w〉 isin CI is saidto be a witness for fP (x) = 1 if Π(x)|w〉 = |w〉 and A|w〉 = |t〉 A vector |wprime〉 isin V is said to be awitness for fP (x) = 0 if 〈t|wprime〉 = 1 and Π(x)Adagger|wprime〉 = 0

Definition 23 (Witness size) Consider a span program P and a vector s isin [0infin)n of nonnegativeldquocostsrdquo Let S =

sumjisin[n]bisin01iisinIjb

radicsj |i〉〈i| isin L(CI) For each input x isin 0 1n define the witness

size of P on x with costs s wsizes(P x) as follows

wsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉 S|w〉2 if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

SAdagger|wprime〉2 if fP (x) = 0 (23)

The witness size of P with costs s is

wsizes(P ) = maxxisin01n

wsizes(P x) (24)

Define the full witness size fwsizes(P ) by letting Sf = S +sum

iisinIfree|i〉〈i| and

fwsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉(1 + Sf |w〉2) if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

(|wprime〉2 + SAdagger|wprime〉2) if fP (x) = 0 (25)

fwsizes(P ) = maxxisin01n

fwsizes(P x) (26)

When the subscript s is omitted the costs are taken to be uniform s = ~1 = (1 1 1) egfwsize(P ) = fwsize~1(P ) The witness size is defined in [RS08] The full witness size is definedin [Rei09a Sec 8] but is not named there A strict span program has Ifree = empty so Sf = S and amonotone span program has Ij0 = empty for all j [Rei09a Def 49]

12

22 Quantum algorithm to evaluate a span program based on its full witness size

[Rei09a Theorem 93] gives a quantum query algorithm for evaluating span programs based on thefull witness size The algorithm is based on a quantum walk on a certain graph Provided that thedegree of the graph is not too large it can actually be implemented efficiently

Theorem 24 ([Rei09a Theorem 93]) Let P be a span program Then fP can be evaluated using

T = O(fwsize(P ) abs(AGP

))

(27)

quantum queries with error probability at most 13 Moreover if the maximum degree of a vertexin GP is d then the time complexity of the algorithm for evaluating fP is at most a factor of(log d)

(log(T log d)

)O(1) worse after classical preprocessing and assuming constant-time coherentaccess to the preprocessed string

Proof sketch The query complexity claim is actually slightly weaker than [Rei09a Theorem 93]which allows the target vector to be scaled downward by a factor of

radicfwsize(P )

The time-complexity claim will follow from the proof of [Rei09a Theorem 93] in [Rei09aProp 94 Theorem 95] The algorithm for evaluating fP (x) uses a discrete-time quantum walkon the graph GP (x) If the maximum degree of a vertex in GP is d then each coin reflec-tion can be implemented using O(log d) single-qubit unitaries and queries to the preprocessedstring [GR02 CNW09] Finally the

(log(T log d)

)O(1) factor comes from applying the Solovay-Kitaev Theorem [KSV02] to compile the single-qubit unitaries into products of elementary gatesto precision 1O(T log d)

We remark that together with [Rei09a Theorem 31] Theorem 24 gives a way of transforming aone-sided-error quantum algorithm into a span program and back into a quantum algorithm suchthat the time complexity is nearly preserved after preprocessing This is only a weak equivalencebecause aside from requiring preprocessing the algorithm from Theorem 24 also has two-sided errorTo some degree though it complements the equivalence results for best span program witness sizeand bounded-error quantum query complexity [Rei09a Theorem 71 Theorem 92]

23 Direct-sum span program composition

Let us study the full witness size of the direct-sum composition of span programs We begin byrecalling the definition of direct-sum composition

Let f 0 1n rarr 0 1 and S sube [n] For j isin [n] let mj be a natural number with mj = 1 forj isin S For j isin S let fj 0 1mj rarr 0 1 Define y 0 1m1 times middot middot middot times 0 1mn rarr 0 1n by

y(x)j =

fj(xj) if j isin Sxj if j isin S

(28)

Define g 0 1m1 times middot middot middottimes 0 1mn rarr 0 1 by g(x) = f(y(x)) For example if S = [n] r 1 then

g(x) = f(x1 f2(x2) fn(xn)

) (29)

Given span programs for the individual functions f and fj for j isin S we will construct a spanprogram for g We remark that although we are here requiring that the inner functions fj act on

13

disjoint sets of bits this assumption is not necessary for the definition It simplifies the notationthough for the cases S 6= [n] and will suffice for our applications

Let P be a span program computing fP = f Let P have inner product space V target vector|t〉 and input vectors |vi〉 indexed by Ifree and Ijc for j isin [n] and c isin 0 1

For j isin [n] let sj isin [0infin)mj be a vector of costs and let s isin [0infin)Pmj be the concatenation of

the vectors sj For j isin S let P j0 and P j1 be span programs computing fP j1 = fj 0 1mj rarr 0 1and fP j0 = notfj with rj = wsizesj (P j0) = wsizesj (P j1) For c isin 0 1 let P jc have inner productspace V jc with target vector |tjc〉 and input vectors indexed by Ijcfree and Ijckb for k isin [mj ] b isin 0 1For j isin S let rj = sj

Let IS =⋃jisinScisin01 Ijc Define ς IS rarr [n]times 0 1 by ς(i) = (j c) if i isin Ijc The idea is that

ς maps i to the input span program that must evaluate to 1 in order for |vi〉 to be available in P There are several ways of composing the span programs P and P jc to obtain a span program Q

computing the composed function fQ = g with wsizes(Q) le wsizer(P ) [Rei09a Defs 44 45 46]We focus on direct-sum composition

Definition 25 ([Rei09a Def 45]) The direct-sum-composed span program Qoplus is defined by

bull The inner product space is V oplus = V oplusoplus

jisinScisin01(CIjc otimes V jc) Any vector in V oplus can be

uniquely expressed as |u〉V +sum

iisinIS |i〉 otimes |ui〉 where |u〉 isin V and |ui〉 isin V ς(i)

bull The target vector is |toplus〉 = |t〉V

bull The free input vectors are indexed by Ioplusfree = Ifree cup IS cup⋃jisinScisin01(Ijc times Ijcfree) with for

i isin Ioplusfree

|voplusi 〉 =

|vi〉V if i isin Ifree

|vi〉V minus |i〉 otimes |tjc〉 if i isin Ijc and j isin S|iprime〉 otimes |viprimeprime〉 if i = (iprime iprimeprime) isin Ijc times Ijcfree

(210)

bull The other input vectors are indexed by Ioplus(jk)b for j isin [n] k isin [mj ] b isin 0 1 For j isin S

Ioplus(j1)b = Ijb with |voplusi 〉 = |vi〉V for i isin Ioplus(j1)b For j isin S let Ioplus(jk)b =⋃cisin01(Ijc times I

jckb) For

i isin Ijc and iprime isin Ijckb let|voplusiiprime〉 = |i〉 otimes |viprime〉 (211)

By [Rei09a Theorem 43] fQoplus = g and wsizes(Qoplus) le wsizer(P ) (While that theorem is statedonly for the case S = [n] it is trivially extended to other S sub [n]) We give a bound on how quicklythe full witness size can grow relative to the witness size

Lemma 26 Under the above conditions for each input x isin 0 1m1timesmiddot middot middottimes0 1mn with y = y(x)

bull If g(x) = 1 let |w〉 be a witness to fP (y) = 1 such thatsum

jisin[n]iisinIjyjrj |wi|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |w〉

)+

1 +sum

iisinIfree|wi|2

wsizer(P y)

where σ(y |w〉) = maxjisinS

existi isin Ijyj with 〈i|w〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(212)

14

bull If g(x) = 0 let |wprime〉 be a witness to fP (y) = 0 such thatsum

jisin[n]iisinIjyjrj |〈wprime|vi〉|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |wprime〉) +|wprime〉2

wsizer(P y)

where σ(y |wprime〉) = maxjisinS

existi isin Ijyj with 〈vi|wprime〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(213)

If S = empty then σ(y |w〉) and σ(y |wprime〉) should each be taken to be 1 in the above equations

Proof We follow the proof of [Rei09a Theorem 43] except keeping track of the full witness sizeNote that if S = empty then Eqs (212) and (213) are immediate by definition of fwsizes(Qoplus x)

Let I(y)prime = I(y) r Ifree =⋃jisin[n] Ijyj

In the first case g(x) = 1 for j isin S let |wjyj 〉 isin CIjyj be a witness to fP jyj (xj) = 1 such that

fwsizes(P jyj xj) = 1 +sum

iisinIjyjfree

|wjyj

i |2

+sum

kisin[mj ]iisinIjyjk(xj)k

(sj)k|wjyj

i |2 As in [Rei09a Theorem 43]

let |woplus〉 isin CIoplus(x) be given by

woplusi =

wi if i isin I(y)

wiprimewς(iprime)iprimeprime if i = (iprime iprimeprime) with iprime isin I(y)prime cap IS iprimeprime isin Iς(iprime)(x)

0 otherwise

(214)

Then |woplus〉 is a witness for fQoplus(x) = 1 and we compute

fwsizes(Qoplus x) le 1 +sumiisinIoplusfree

|woplusi |2 +

sumjisin[n]kisin[mj ]

iisinIoplus(jk)(xj)k

(sj)k|woplusi |2

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 (215)

+sum

jisinSiisinIjyj

|wi|2(

1 +sum

iprimeisinIjyjfree

|wjyj

iprime |2 +

sumkisin[mj ]iprimeisinI

jyjk(xj)k

(sj)k|wjyj

iprime |2

)

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 +sum

jisinSiisinIjyj

|wi|2 fwsizesj (P jyj xj)

Eq (212) follows using the bound fwsizesj (P jyj xj) le σ(y |w〉)rj for j isin S and sj = rj for j isin SNext consider the case g(x) = 0 For j isin S let |ujyj 〉 isin V jyj be a witness for f

P jyj (xj) = 0 withfwsizes(P jyj xj) = |ujyj 〉2 +

sumkisin[mj ]iisinI

jyj

k(xj)k

(sj)k|〈vi|ujyj 〉|2 As in [Rei09a Theorem 43] let

|uoplus〉 = |wprime〉V +sum

iisinISrI(y)

〈vi|wprime〉|i〉 otimes |uς(i)〉 (216)

15

Then |uoplus〉 is a witness for fQoplus(x) = 0 and moreover

fwsizes(Qoplus x) le |uoplus〉2 +sum

jisin[n]kisin[mj ]iisinIoplus(jk)(xj)k

(sj)k|〈voplusi |uoplus〉|2

= |uoplus〉2 +sum

jisin[n]rSiisinIjxj

sj |〈voplusi |uoplus〉|2 +

sumjisinSkisin[mj ]

iisinIjyjiprimeisinI

jyj

k(xj)k

(sj)k|〈voplusiiprime |uoplus〉|2

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

sj |〈vi|wprime〉|2 (217)

+sum

jisinSiisinIjyj

|〈vi|wprime〉|2(|ujyj 〉2 +

sumkisin[mj ]iprimeisinI

jyj

k(xj)k

(sj)k|〈viprime |ujyj 〉|2)

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

rj |〈vi|wprime〉|2 +sum

jisinSiisinIjyj

|〈vi|wprime〉|2 fwsizesj (P jyj xj)

Eq (213) follows using the bound fwsizesj (P jyj xj) le σ(y |wprime〉)rj for j isin S

Lemma 26 is a key step in the formula-evaluation results in this article and [Rei09b] Itis used to track the full witness size for span programs recursively composed in a direct-summanner along a formula The proof of Theorem 19 will require the lemma with the weakerbounds σ(y |w〉) σ(y |wprime〉) le maxjisinScisin01 fwsizesj (P jc)wsizesj (P jc) Theorem 111 will useonly the slightly stronger bounds σ(y |w〉) le maxjisinS fwsizesj (P jyj )wsizesj (P jyj ) σ(y |wprime〉) lemaxjisinS fwsizesj (P jyj )wsizesj (P jyj ) However the proof of [Rei09b Theorem 11] will require thebounds of Eqs (212) and (213)

3 Evaluation of almost-balanced formulas

In this section we will apply the span program framework from [Rei09a] to prove Theorem 19Our algorithm will be given by applying Theorem 24 to a certain span program Before beginningthe proof though we will give two necessary lemmas

Consider a span program P with corresponding weighted graph GP from [Rei09a Def 82]We will need a bound on the operator norm of abs(AGPv

) the entry-wise absolute value of theweighted adjacency matrix AGPv

If P is canonical [Rei09a Def 51] then we can indeed obtainsuch a bound in terms of the witness size of P

Lemma 31 Let s isin (0infin)k and let P be a canonical span program computing a function f 0 1k rarr 0 1 with input vectors indexed by the set I Assume that for each x isin 0 1k withf(x) = 0 an optimal witness to fP (x) = 0 is |x〉 itself Then

abs(AGP) le 2k

(1 +

wsizes(P )minjisin[k] sj

)+ |I| (31)

16

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 9: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

Theorem 19 Let S be a fixed finite set of gates Then there exists a quantum algorithm thatevaluates an almost-balanced formula ϕ over S using O

(Advplusmn(ϕ)

)input queries After polynomial-

time classical preprocessing independent of the input and assuming unit-time coherent access tothe preprocessed string the running time of the algorithm is Advplusmn(ϕ)

(log Advplusmn(ϕ)

)O(1)

Theorem 19 is significantly stronger than Theorem 16 which requires exact balance Thereare important classes of exactly balanced formulas such as complete layered formulas In fact it issufficient that the multiset of gates along the simple path from the root to a leaf not depend on theleaf Moreover sometimes different gates have the same Advplusmn bound see [HLS06] for examplesEven still exact adversary balance is a very strict condition

The proof of Theorem 19 is based on the span program framework developed in Ref [Rei09a]In particular [Rei09a Theorem 91] gives two quantum algorithms for evaluating span programsThe first algorithm is based on a discrete-time simulation of a continuous-time quantum walkIt applies to arbitrary span programs and is used in combination with Theorem 15 to proveTheorem 17 However the simulation incurs a logarithmic query overhead and potentially worsetime complexity overhead so this algorithm is not suitable for proving Theorem 19

The second algorithm in [Rei09a] is based directly on a discrete-time quantum walk similarto previous optimal formula-evaluation algorithms [ACR+07 RS08] However this algorithm doesnot apply to an arbitrary span program A bound is needed on the operator norm of the entry-wiseabsolute value of the weighted adjacency matrix for a corresponding graph Further graph sparsityconditions are needed for the algorithm to be time efficient (see Theorem 24)

Unfortunately the span program from Theorem 15 will not generally satisfy these conditionsTheorem 15 gives a canonical span program ([Rei09a Def 51]) Even for a simple formula theoptimal canonical span program will typically correspond to a dense graph with large norm

An example should clarify the problem Consider the AND-OR formula ψ(x) =([(x1 and x2) or

x3] and x4

)or(x5 and [x6 or x7]

) and consider the two graphs in Figure 1 For an input x isin 0 17

modify the graphs by attaching dangling edges to every vertex j for which xj = 0 Observe thenthat each graph has an eigenvalue-zero eigenvector supported on vertex 0mdashcalled a witnessmdashif andonly if ψ(x) = 1 The graphs correspond to different span programs computing ψ and the quantumalgorithm works essentially by running a quantum walk starting at vertex 0 in order to detect thewitness The graph on the left is a significantly simplified version of a canonical span program forψ and its density still makes it difficult to implement the quantum walk

We will be guided by the second simpler graph Instead of applying Theorem 15 to ϕ as awhole we apply it separately to every gate in the formula We then compose these span programsone per gate according to the formula using direct-sum composition (Definition 25) In terms ofgraphs direct-sum composition attaches the output vertex of one span programrsquos graph to an inputvertex of the next [RS08] This leads to a graph whose structure somewhat follows the structure ofthe formula ϕ as the graph in Figure 1(b) follows the structure of ψ (However the general casewill be more complicated than shown as we are plugging together constant-size graph gadgets andthere may be duplication of some subgraphs)

Direct-sum composition keeps the maximum degree and norm of the graph under controlmdasheachis at most twice its value for the worst single gate Therefore the second [Rei09a] algorithm appliesHowever direct-sum composition also leads to additional overhead In particular a witness in thefirst graph will be supported only on numbered vertices (note that the graph is bipartite) whereasa witness in the second graph will be supported on some of the internal vertices as well This meansroughly that the second witness will be harder to detect because after normalization its overlap on

9

0

1

2

3

4

5

6

7

(a)

3

6

7

0

1

2

4

5

(b)

Figure 1 Graphs corresponding to two span programs both computing the same function

vertex 0 will be smaller Scale both witnesses so that the amplitude on vertex 0 is one The witnesssize (wsize) measures the squared length of the witness only on numbered vertices whereas the fullwitness size (fwsize) measures the squared length on all vertices For [Rei09a] it was sufficient toconsider only span program witness size because for canonical span programs like in Figure 1(a)the two measures are equal (For technical reasons we will actually define fwsize to be 1 + wsizeeven in this case) For our analysis we will need to bound the full witness size in terms of thewitness size We maintain this bound in a recursion from the formularsquos leaves toward its root

A span program is called strict if every vertex on one half of the bipartite graph is either aninput vertex (vertices 1ndash7 in the graphs of Figure 1) or the output vertex (vertex 0) Thus the firstgraph in the example above corresponds to a strict span program and the second does not Theoriginal definition of span programs in [KW93] allowed for only strict span programs This wassensible because any other vertices on the inputoutput part of the graphrsquos bipartition can alwaysbe projected away yielding a strict span program that computes the same function For developingtime-efficient quantum algorithms though it seems important to consider span programs that arenot strict Unfortunately going backwards eg from 1(a) to 1(b) is probably difficult in general

Theorem 19 does not follow from the formula-evaluation techniques of [RS08] together withTheorem 14 from [Rei09a] This tempting approach falls into intractable technical difficulties Inparticular the same span program can be used at two vertices v and w in ϕ only if gv = gw andthe general adversary bounds of vrsquos input subformulas are the same as those for wrsquos inputs upto simultaneous scaling In general then an almost-balanced formula will require an unboundednumber of different span programs However the analysis in [RS08] loses a factor that dependsbadly on the individual span programs Since the dependence is not continuous even showingthat the span programs in use all lie within a compact set would not be sufficient to obtain anO(1) upper bound In contrast the approach we follow here allows bounding the lost factor by anexponential in k uniformly over different gate imbalances

10

14 Quantum algorithm to evaluate approximately balanced AND-OR formulas

Ambainis et al [ACR+07] use a weaker balance criterion for AND-OR formulas than Definition 18They define an AND-OR formula to be approximately balanced if σminus(ϕ) = O(1) and σ+(ϕ) = O(n)Here n is the size of the formula ie the number of leaves and σminus(ϕ) and σ+(ϕ) are defined by

Definition 110 For each vertex v in a formula ϕ let

σminus(v) = maxξ

sumwisinξ

1Advplusmn(ϕw)

σ+(v) = maxξ

sumwisinξ

Advplusmn(ϕw)2 (110)

with each maximum taken over all simple paths ξ from v to a leaf Let σplusmn(ϕ) = σplusmn(r) where r isthe root of ϕ

Recall that Advplusmn(ϕ) = Adv(ϕ) =radicn for an AND-OR formula Definition 18 is a stricter

balance criterion because β-balance of a formula ϕ implies (by Lemma 32) that σminus(ϕ) and σ+(ϕ) areboth dominated by geometric series However the same steps followed by the proof of Theorem 19still suffice for proving the [ACR+07] result and in fact for strengthening it We show

Theorem 111 Let ϕ be an AND-OR formula of size n Then after polynomial-time classicalpreprocessing that does not depend on the input x ϕ(x) can be evaluated by a quantum algo-rithm with error at most 13 using O

(radicnσminus(ϕ)

)input queries The algorithmrsquos running time isradic

nσminus(ϕ)(log n)O(1) assuming unit-cost coherent access to the preprocessed string

For the special case of AND-OR formulas with σminus(ϕ) = O(1) Theorem 111 strengthens The-orem 19 The requirement that σminus(ϕ) = O(1) allows for some gates in the formula to be veryunbalanced Theorem 111 also strengthens [ACR+07 Theorem 1] because it does not require thatσ+(ϕ) = O(n) For example a formula that is biased near the root but balanced at greater depthscan have σminus(ϕ) = O(1) and σ+(ϕ) = ω(n) By substituting the bound σminus(ϕ) = O(

radicd) for a depth-

d formula [ACR+07 Def 3] a corollary of Theorem 111 is that a depth-d size-n AND-OR formulacan be evaluated using O(

radicnd) queries This improves the depth-dependence from [ACR+07] and

matches the dependence from an earlier version of that article [Amb07]The essential reason that the Definition 18 balance condition can be weakened is that for the

specific gates AND and OR by writing out the optimal span programs explicitly we can prove thatthey satisfy stronger properties than are necessarily true for other functions

2 Span programs

21 Definitions

We briefly recall some definitions from [Rei09a Sec 2] Additionally we define a span programcomplexity measure the full witness size that charges even for the ldquofreerdquo inputs This quantity isimportant for developing quantum algorithms that are time efficient as well as query efficient

For a natural number n let [n] = 1 2 n For a finite set X let CX be the inner productspace C|X| with orthonormal basis |x〉 x isin X For vector spaces V and W over C let L(VW )be the set of linear transformations from V into W and let L(V ) = L(V V ) For A isin L(VW )A is the operator norm of A For a string x isin 0 1n let x denote its bitwise complement

11

Definition 21 ([HLS05 HLS07]) For finite sets C E and D sube Cn let f D rarr E An adversarymatrix for f is a real symmetric matrix Γ isin L(CD) that satisfies 〈x|Γ|y〉 = 0 whenever f(x) = f(y)

The general adversary bound for f with costs s isin [0infin)n is

Advplusmns (f) = maxadversary matrices Γforalljisin[n] Γ∆jlesj

Γ (21)

Here Γ ∆j denotes the entry-wise matrix product between Γ and ∆j =sum

xyxj 6=yj|x〉〈y| The

(nonnegative-weight) adversary bound for f with costs s is defined by the same maximizationexcept with Γ restricted to have nonnegative entries In particular Advplusmns (f) ge Advs(f)

Letting ~1 = (1 1 1) the adversary bound for f is Adv(f) = Adv~1(f) and the generaladversary bound for f is Advplusmn(f) = Advplusmn~1 (f) By [HLS07] Q(f) = Ω(Advplusmn(f))

Definition 22 (Span program [KW93]) A span program P consists of a natural number n afinite-dimensional inner product space V over C a ldquotargetrdquo vector |t〉 isin V disjoint sets Ifree andIjb for j isin [n] b isin 0 1 and ldquoinput vectorsrdquo |vi〉 isin V for i isin Ifree cup

⋃jisin[n]bisin01 Ijb

To P corresponds a function fP 0 1n rarr 0 1 defined on x isin 0 1n by

fP (x) =

1 if |t〉 isin Span(|vi〉 i isin Ifree cup

⋃jisin[n] Ijxj)

0 otherwise(22)

Some additional notation is convenient Fix a span program P Let I = Ifreecup⋃jisin[n]bisin01 Ijb

Let A isin L(CI V ) be given by A =sum

iisinI |vi〉〈i| For x isin 0 1n let I(x) = Ifree cup⋃jisin[n] Ijxj and

Π(x) =sum

iisinI(x) |i〉〈i| isin L(CI) Then fP (x) = 1 if |t〉 isin Range(AΠ(x)) A vector |w〉 isin CI is saidto be a witness for fP (x) = 1 if Π(x)|w〉 = |w〉 and A|w〉 = |t〉 A vector |wprime〉 isin V is said to be awitness for fP (x) = 0 if 〈t|wprime〉 = 1 and Π(x)Adagger|wprime〉 = 0

Definition 23 (Witness size) Consider a span program P and a vector s isin [0infin)n of nonnegativeldquocostsrdquo Let S =

sumjisin[n]bisin01iisinIjb

radicsj |i〉〈i| isin L(CI) For each input x isin 0 1n define the witness

size of P on x with costs s wsizes(P x) as follows

wsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉 S|w〉2 if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

SAdagger|wprime〉2 if fP (x) = 0 (23)

The witness size of P with costs s is

wsizes(P ) = maxxisin01n

wsizes(P x) (24)

Define the full witness size fwsizes(P ) by letting Sf = S +sum

iisinIfree|i〉〈i| and

fwsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉(1 + Sf |w〉2) if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

(|wprime〉2 + SAdagger|wprime〉2) if fP (x) = 0 (25)

fwsizes(P ) = maxxisin01n

fwsizes(P x) (26)

When the subscript s is omitted the costs are taken to be uniform s = ~1 = (1 1 1) egfwsize(P ) = fwsize~1(P ) The witness size is defined in [RS08] The full witness size is definedin [Rei09a Sec 8] but is not named there A strict span program has Ifree = empty so Sf = S and amonotone span program has Ij0 = empty for all j [Rei09a Def 49]

12

22 Quantum algorithm to evaluate a span program based on its full witness size

[Rei09a Theorem 93] gives a quantum query algorithm for evaluating span programs based on thefull witness size The algorithm is based on a quantum walk on a certain graph Provided that thedegree of the graph is not too large it can actually be implemented efficiently

Theorem 24 ([Rei09a Theorem 93]) Let P be a span program Then fP can be evaluated using

T = O(fwsize(P ) abs(AGP

))

(27)

quantum queries with error probability at most 13 Moreover if the maximum degree of a vertexin GP is d then the time complexity of the algorithm for evaluating fP is at most a factor of(log d)

(log(T log d)

)O(1) worse after classical preprocessing and assuming constant-time coherentaccess to the preprocessed string

Proof sketch The query complexity claim is actually slightly weaker than [Rei09a Theorem 93]which allows the target vector to be scaled downward by a factor of

radicfwsize(P )

The time-complexity claim will follow from the proof of [Rei09a Theorem 93] in [Rei09aProp 94 Theorem 95] The algorithm for evaluating fP (x) uses a discrete-time quantum walkon the graph GP (x) If the maximum degree of a vertex in GP is d then each coin reflec-tion can be implemented using O(log d) single-qubit unitaries and queries to the preprocessedstring [GR02 CNW09] Finally the

(log(T log d)

)O(1) factor comes from applying the Solovay-Kitaev Theorem [KSV02] to compile the single-qubit unitaries into products of elementary gatesto precision 1O(T log d)

We remark that together with [Rei09a Theorem 31] Theorem 24 gives a way of transforming aone-sided-error quantum algorithm into a span program and back into a quantum algorithm suchthat the time complexity is nearly preserved after preprocessing This is only a weak equivalencebecause aside from requiring preprocessing the algorithm from Theorem 24 also has two-sided errorTo some degree though it complements the equivalence results for best span program witness sizeand bounded-error quantum query complexity [Rei09a Theorem 71 Theorem 92]

23 Direct-sum span program composition

Let us study the full witness size of the direct-sum composition of span programs We begin byrecalling the definition of direct-sum composition

Let f 0 1n rarr 0 1 and S sube [n] For j isin [n] let mj be a natural number with mj = 1 forj isin S For j isin S let fj 0 1mj rarr 0 1 Define y 0 1m1 times middot middot middot times 0 1mn rarr 0 1n by

y(x)j =

fj(xj) if j isin Sxj if j isin S

(28)

Define g 0 1m1 times middot middot middottimes 0 1mn rarr 0 1 by g(x) = f(y(x)) For example if S = [n] r 1 then

g(x) = f(x1 f2(x2) fn(xn)

) (29)

Given span programs for the individual functions f and fj for j isin S we will construct a spanprogram for g We remark that although we are here requiring that the inner functions fj act on

13

disjoint sets of bits this assumption is not necessary for the definition It simplifies the notationthough for the cases S 6= [n] and will suffice for our applications

Let P be a span program computing fP = f Let P have inner product space V target vector|t〉 and input vectors |vi〉 indexed by Ifree and Ijc for j isin [n] and c isin 0 1

For j isin [n] let sj isin [0infin)mj be a vector of costs and let s isin [0infin)Pmj be the concatenation of

the vectors sj For j isin S let P j0 and P j1 be span programs computing fP j1 = fj 0 1mj rarr 0 1and fP j0 = notfj with rj = wsizesj (P j0) = wsizesj (P j1) For c isin 0 1 let P jc have inner productspace V jc with target vector |tjc〉 and input vectors indexed by Ijcfree and Ijckb for k isin [mj ] b isin 0 1For j isin S let rj = sj

Let IS =⋃jisinScisin01 Ijc Define ς IS rarr [n]times 0 1 by ς(i) = (j c) if i isin Ijc The idea is that

ς maps i to the input span program that must evaluate to 1 in order for |vi〉 to be available in P There are several ways of composing the span programs P and P jc to obtain a span program Q

computing the composed function fQ = g with wsizes(Q) le wsizer(P ) [Rei09a Defs 44 45 46]We focus on direct-sum composition

Definition 25 ([Rei09a Def 45]) The direct-sum-composed span program Qoplus is defined by

bull The inner product space is V oplus = V oplusoplus

jisinScisin01(CIjc otimes V jc) Any vector in V oplus can be

uniquely expressed as |u〉V +sum

iisinIS |i〉 otimes |ui〉 where |u〉 isin V and |ui〉 isin V ς(i)

bull The target vector is |toplus〉 = |t〉V

bull The free input vectors are indexed by Ioplusfree = Ifree cup IS cup⋃jisinScisin01(Ijc times Ijcfree) with for

i isin Ioplusfree

|voplusi 〉 =

|vi〉V if i isin Ifree

|vi〉V minus |i〉 otimes |tjc〉 if i isin Ijc and j isin S|iprime〉 otimes |viprimeprime〉 if i = (iprime iprimeprime) isin Ijc times Ijcfree

(210)

bull The other input vectors are indexed by Ioplus(jk)b for j isin [n] k isin [mj ] b isin 0 1 For j isin S

Ioplus(j1)b = Ijb with |voplusi 〉 = |vi〉V for i isin Ioplus(j1)b For j isin S let Ioplus(jk)b =⋃cisin01(Ijc times I

jckb) For

i isin Ijc and iprime isin Ijckb let|voplusiiprime〉 = |i〉 otimes |viprime〉 (211)

By [Rei09a Theorem 43] fQoplus = g and wsizes(Qoplus) le wsizer(P ) (While that theorem is statedonly for the case S = [n] it is trivially extended to other S sub [n]) We give a bound on how quicklythe full witness size can grow relative to the witness size

Lemma 26 Under the above conditions for each input x isin 0 1m1timesmiddot middot middottimes0 1mn with y = y(x)

bull If g(x) = 1 let |w〉 be a witness to fP (y) = 1 such thatsum

jisin[n]iisinIjyjrj |wi|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |w〉

)+

1 +sum

iisinIfree|wi|2

wsizer(P y)

where σ(y |w〉) = maxjisinS

existi isin Ijyj with 〈i|w〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(212)

14

bull If g(x) = 0 let |wprime〉 be a witness to fP (y) = 0 such thatsum

jisin[n]iisinIjyjrj |〈wprime|vi〉|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |wprime〉) +|wprime〉2

wsizer(P y)

where σ(y |wprime〉) = maxjisinS

existi isin Ijyj with 〈vi|wprime〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(213)

If S = empty then σ(y |w〉) and σ(y |wprime〉) should each be taken to be 1 in the above equations

Proof We follow the proof of [Rei09a Theorem 43] except keeping track of the full witness sizeNote that if S = empty then Eqs (212) and (213) are immediate by definition of fwsizes(Qoplus x)

Let I(y)prime = I(y) r Ifree =⋃jisin[n] Ijyj

In the first case g(x) = 1 for j isin S let |wjyj 〉 isin CIjyj be a witness to fP jyj (xj) = 1 such that

fwsizes(P jyj xj) = 1 +sum

iisinIjyjfree

|wjyj

i |2

+sum

kisin[mj ]iisinIjyjk(xj)k

(sj)k|wjyj

i |2 As in [Rei09a Theorem 43]

let |woplus〉 isin CIoplus(x) be given by

woplusi =

wi if i isin I(y)

wiprimewς(iprime)iprimeprime if i = (iprime iprimeprime) with iprime isin I(y)prime cap IS iprimeprime isin Iς(iprime)(x)

0 otherwise

(214)

Then |woplus〉 is a witness for fQoplus(x) = 1 and we compute

fwsizes(Qoplus x) le 1 +sumiisinIoplusfree

|woplusi |2 +

sumjisin[n]kisin[mj ]

iisinIoplus(jk)(xj)k

(sj)k|woplusi |2

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 (215)

+sum

jisinSiisinIjyj

|wi|2(

1 +sum

iprimeisinIjyjfree

|wjyj

iprime |2 +

sumkisin[mj ]iprimeisinI

jyjk(xj)k

(sj)k|wjyj

iprime |2

)

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 +sum

jisinSiisinIjyj

|wi|2 fwsizesj (P jyj xj)

Eq (212) follows using the bound fwsizesj (P jyj xj) le σ(y |w〉)rj for j isin S and sj = rj for j isin SNext consider the case g(x) = 0 For j isin S let |ujyj 〉 isin V jyj be a witness for f

P jyj (xj) = 0 withfwsizes(P jyj xj) = |ujyj 〉2 +

sumkisin[mj ]iisinI

jyj

k(xj)k

(sj)k|〈vi|ujyj 〉|2 As in [Rei09a Theorem 43] let

|uoplus〉 = |wprime〉V +sum

iisinISrI(y)

〈vi|wprime〉|i〉 otimes |uς(i)〉 (216)

15

Then |uoplus〉 is a witness for fQoplus(x) = 0 and moreover

fwsizes(Qoplus x) le |uoplus〉2 +sum

jisin[n]kisin[mj ]iisinIoplus(jk)(xj)k

(sj)k|〈voplusi |uoplus〉|2

= |uoplus〉2 +sum

jisin[n]rSiisinIjxj

sj |〈voplusi |uoplus〉|2 +

sumjisinSkisin[mj ]

iisinIjyjiprimeisinI

jyj

k(xj)k

(sj)k|〈voplusiiprime |uoplus〉|2

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

sj |〈vi|wprime〉|2 (217)

+sum

jisinSiisinIjyj

|〈vi|wprime〉|2(|ujyj 〉2 +

sumkisin[mj ]iprimeisinI

jyj

k(xj)k

(sj)k|〈viprime |ujyj 〉|2)

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

rj |〈vi|wprime〉|2 +sum

jisinSiisinIjyj

|〈vi|wprime〉|2 fwsizesj (P jyj xj)

Eq (213) follows using the bound fwsizesj (P jyj xj) le σ(y |wprime〉)rj for j isin S

Lemma 26 is a key step in the formula-evaluation results in this article and [Rei09b] Itis used to track the full witness size for span programs recursively composed in a direct-summanner along a formula The proof of Theorem 19 will require the lemma with the weakerbounds σ(y |w〉) σ(y |wprime〉) le maxjisinScisin01 fwsizesj (P jc)wsizesj (P jc) Theorem 111 will useonly the slightly stronger bounds σ(y |w〉) le maxjisinS fwsizesj (P jyj )wsizesj (P jyj ) σ(y |wprime〉) lemaxjisinS fwsizesj (P jyj )wsizesj (P jyj ) However the proof of [Rei09b Theorem 11] will require thebounds of Eqs (212) and (213)

3 Evaluation of almost-balanced formulas

In this section we will apply the span program framework from [Rei09a] to prove Theorem 19Our algorithm will be given by applying Theorem 24 to a certain span program Before beginningthe proof though we will give two necessary lemmas

Consider a span program P with corresponding weighted graph GP from [Rei09a Def 82]We will need a bound on the operator norm of abs(AGPv

) the entry-wise absolute value of theweighted adjacency matrix AGPv

If P is canonical [Rei09a Def 51] then we can indeed obtainsuch a bound in terms of the witness size of P

Lemma 31 Let s isin (0infin)k and let P be a canonical span program computing a function f 0 1k rarr 0 1 with input vectors indexed by the set I Assume that for each x isin 0 1k withf(x) = 0 an optimal witness to fP (x) = 0 is |x〉 itself Then

abs(AGP) le 2k

(1 +

wsizes(P )minjisin[k] sj

)+ |I| (31)

16

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 10: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

0

1

2

3

4

5

6

7

(a)

3

6

7

0

1

2

4

5

(b)

Figure 1 Graphs corresponding to two span programs both computing the same function

vertex 0 will be smaller Scale both witnesses so that the amplitude on vertex 0 is one The witnesssize (wsize) measures the squared length of the witness only on numbered vertices whereas the fullwitness size (fwsize) measures the squared length on all vertices For [Rei09a] it was sufficient toconsider only span program witness size because for canonical span programs like in Figure 1(a)the two measures are equal (For technical reasons we will actually define fwsize to be 1 + wsizeeven in this case) For our analysis we will need to bound the full witness size in terms of thewitness size We maintain this bound in a recursion from the formularsquos leaves toward its root

A span program is called strict if every vertex on one half of the bipartite graph is either aninput vertex (vertices 1ndash7 in the graphs of Figure 1) or the output vertex (vertex 0) Thus the firstgraph in the example above corresponds to a strict span program and the second does not Theoriginal definition of span programs in [KW93] allowed for only strict span programs This wassensible because any other vertices on the inputoutput part of the graphrsquos bipartition can alwaysbe projected away yielding a strict span program that computes the same function For developingtime-efficient quantum algorithms though it seems important to consider span programs that arenot strict Unfortunately going backwards eg from 1(a) to 1(b) is probably difficult in general

Theorem 19 does not follow from the formula-evaluation techniques of [RS08] together withTheorem 14 from [Rei09a] This tempting approach falls into intractable technical difficulties Inparticular the same span program can be used at two vertices v and w in ϕ only if gv = gw andthe general adversary bounds of vrsquos input subformulas are the same as those for wrsquos inputs upto simultaneous scaling In general then an almost-balanced formula will require an unboundednumber of different span programs However the analysis in [RS08] loses a factor that dependsbadly on the individual span programs Since the dependence is not continuous even showingthat the span programs in use all lie within a compact set would not be sufficient to obtain anO(1) upper bound In contrast the approach we follow here allows bounding the lost factor by anexponential in k uniformly over different gate imbalances

10

14 Quantum algorithm to evaluate approximately balanced AND-OR formulas

Ambainis et al [ACR+07] use a weaker balance criterion for AND-OR formulas than Definition 18They define an AND-OR formula to be approximately balanced if σminus(ϕ) = O(1) and σ+(ϕ) = O(n)Here n is the size of the formula ie the number of leaves and σminus(ϕ) and σ+(ϕ) are defined by

Definition 110 For each vertex v in a formula ϕ let

σminus(v) = maxξ

sumwisinξ

1Advplusmn(ϕw)

σ+(v) = maxξ

sumwisinξ

Advplusmn(ϕw)2 (110)

with each maximum taken over all simple paths ξ from v to a leaf Let σplusmn(ϕ) = σplusmn(r) where r isthe root of ϕ

Recall that Advplusmn(ϕ) = Adv(ϕ) =radicn for an AND-OR formula Definition 18 is a stricter

balance criterion because β-balance of a formula ϕ implies (by Lemma 32) that σminus(ϕ) and σ+(ϕ) areboth dominated by geometric series However the same steps followed by the proof of Theorem 19still suffice for proving the [ACR+07] result and in fact for strengthening it We show

Theorem 111 Let ϕ be an AND-OR formula of size n Then after polynomial-time classicalpreprocessing that does not depend on the input x ϕ(x) can be evaluated by a quantum algo-rithm with error at most 13 using O

(radicnσminus(ϕ)

)input queries The algorithmrsquos running time isradic

nσminus(ϕ)(log n)O(1) assuming unit-cost coherent access to the preprocessed string

For the special case of AND-OR formulas with σminus(ϕ) = O(1) Theorem 111 strengthens The-orem 19 The requirement that σminus(ϕ) = O(1) allows for some gates in the formula to be veryunbalanced Theorem 111 also strengthens [ACR+07 Theorem 1] because it does not require thatσ+(ϕ) = O(n) For example a formula that is biased near the root but balanced at greater depthscan have σminus(ϕ) = O(1) and σ+(ϕ) = ω(n) By substituting the bound σminus(ϕ) = O(

radicd) for a depth-

d formula [ACR+07 Def 3] a corollary of Theorem 111 is that a depth-d size-n AND-OR formulacan be evaluated using O(

radicnd) queries This improves the depth-dependence from [ACR+07] and

matches the dependence from an earlier version of that article [Amb07]The essential reason that the Definition 18 balance condition can be weakened is that for the

specific gates AND and OR by writing out the optimal span programs explicitly we can prove thatthey satisfy stronger properties than are necessarily true for other functions

2 Span programs

21 Definitions

We briefly recall some definitions from [Rei09a Sec 2] Additionally we define a span programcomplexity measure the full witness size that charges even for the ldquofreerdquo inputs This quantity isimportant for developing quantum algorithms that are time efficient as well as query efficient

For a natural number n let [n] = 1 2 n For a finite set X let CX be the inner productspace C|X| with orthonormal basis |x〉 x isin X For vector spaces V and W over C let L(VW )be the set of linear transformations from V into W and let L(V ) = L(V V ) For A isin L(VW )A is the operator norm of A For a string x isin 0 1n let x denote its bitwise complement

11

Definition 21 ([HLS05 HLS07]) For finite sets C E and D sube Cn let f D rarr E An adversarymatrix for f is a real symmetric matrix Γ isin L(CD) that satisfies 〈x|Γ|y〉 = 0 whenever f(x) = f(y)

The general adversary bound for f with costs s isin [0infin)n is

Advplusmns (f) = maxadversary matrices Γforalljisin[n] Γ∆jlesj

Γ (21)

Here Γ ∆j denotes the entry-wise matrix product between Γ and ∆j =sum

xyxj 6=yj|x〉〈y| The

(nonnegative-weight) adversary bound for f with costs s is defined by the same maximizationexcept with Γ restricted to have nonnegative entries In particular Advplusmns (f) ge Advs(f)

Letting ~1 = (1 1 1) the adversary bound for f is Adv(f) = Adv~1(f) and the generaladversary bound for f is Advplusmn(f) = Advplusmn~1 (f) By [HLS07] Q(f) = Ω(Advplusmn(f))

Definition 22 (Span program [KW93]) A span program P consists of a natural number n afinite-dimensional inner product space V over C a ldquotargetrdquo vector |t〉 isin V disjoint sets Ifree andIjb for j isin [n] b isin 0 1 and ldquoinput vectorsrdquo |vi〉 isin V for i isin Ifree cup

⋃jisin[n]bisin01 Ijb

To P corresponds a function fP 0 1n rarr 0 1 defined on x isin 0 1n by

fP (x) =

1 if |t〉 isin Span(|vi〉 i isin Ifree cup

⋃jisin[n] Ijxj)

0 otherwise(22)

Some additional notation is convenient Fix a span program P Let I = Ifreecup⋃jisin[n]bisin01 Ijb

Let A isin L(CI V ) be given by A =sum

iisinI |vi〉〈i| For x isin 0 1n let I(x) = Ifree cup⋃jisin[n] Ijxj and

Π(x) =sum

iisinI(x) |i〉〈i| isin L(CI) Then fP (x) = 1 if |t〉 isin Range(AΠ(x)) A vector |w〉 isin CI is saidto be a witness for fP (x) = 1 if Π(x)|w〉 = |w〉 and A|w〉 = |t〉 A vector |wprime〉 isin V is said to be awitness for fP (x) = 0 if 〈t|wprime〉 = 1 and Π(x)Adagger|wprime〉 = 0

Definition 23 (Witness size) Consider a span program P and a vector s isin [0infin)n of nonnegativeldquocostsrdquo Let S =

sumjisin[n]bisin01iisinIjb

radicsj |i〉〈i| isin L(CI) For each input x isin 0 1n define the witness

size of P on x with costs s wsizes(P x) as follows

wsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉 S|w〉2 if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

SAdagger|wprime〉2 if fP (x) = 0 (23)

The witness size of P with costs s is

wsizes(P ) = maxxisin01n

wsizes(P x) (24)

Define the full witness size fwsizes(P ) by letting Sf = S +sum

iisinIfree|i〉〈i| and

fwsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉(1 + Sf |w〉2) if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

(|wprime〉2 + SAdagger|wprime〉2) if fP (x) = 0 (25)

fwsizes(P ) = maxxisin01n

fwsizes(P x) (26)

When the subscript s is omitted the costs are taken to be uniform s = ~1 = (1 1 1) egfwsize(P ) = fwsize~1(P ) The witness size is defined in [RS08] The full witness size is definedin [Rei09a Sec 8] but is not named there A strict span program has Ifree = empty so Sf = S and amonotone span program has Ij0 = empty for all j [Rei09a Def 49]

12

22 Quantum algorithm to evaluate a span program based on its full witness size

[Rei09a Theorem 93] gives a quantum query algorithm for evaluating span programs based on thefull witness size The algorithm is based on a quantum walk on a certain graph Provided that thedegree of the graph is not too large it can actually be implemented efficiently

Theorem 24 ([Rei09a Theorem 93]) Let P be a span program Then fP can be evaluated using

T = O(fwsize(P ) abs(AGP

))

(27)

quantum queries with error probability at most 13 Moreover if the maximum degree of a vertexin GP is d then the time complexity of the algorithm for evaluating fP is at most a factor of(log d)

(log(T log d)

)O(1) worse after classical preprocessing and assuming constant-time coherentaccess to the preprocessed string

Proof sketch The query complexity claim is actually slightly weaker than [Rei09a Theorem 93]which allows the target vector to be scaled downward by a factor of

radicfwsize(P )

The time-complexity claim will follow from the proof of [Rei09a Theorem 93] in [Rei09aProp 94 Theorem 95] The algorithm for evaluating fP (x) uses a discrete-time quantum walkon the graph GP (x) If the maximum degree of a vertex in GP is d then each coin reflec-tion can be implemented using O(log d) single-qubit unitaries and queries to the preprocessedstring [GR02 CNW09] Finally the

(log(T log d)

)O(1) factor comes from applying the Solovay-Kitaev Theorem [KSV02] to compile the single-qubit unitaries into products of elementary gatesto precision 1O(T log d)

We remark that together with [Rei09a Theorem 31] Theorem 24 gives a way of transforming aone-sided-error quantum algorithm into a span program and back into a quantum algorithm suchthat the time complexity is nearly preserved after preprocessing This is only a weak equivalencebecause aside from requiring preprocessing the algorithm from Theorem 24 also has two-sided errorTo some degree though it complements the equivalence results for best span program witness sizeand bounded-error quantum query complexity [Rei09a Theorem 71 Theorem 92]

23 Direct-sum span program composition

Let us study the full witness size of the direct-sum composition of span programs We begin byrecalling the definition of direct-sum composition

Let f 0 1n rarr 0 1 and S sube [n] For j isin [n] let mj be a natural number with mj = 1 forj isin S For j isin S let fj 0 1mj rarr 0 1 Define y 0 1m1 times middot middot middot times 0 1mn rarr 0 1n by

y(x)j =

fj(xj) if j isin Sxj if j isin S

(28)

Define g 0 1m1 times middot middot middottimes 0 1mn rarr 0 1 by g(x) = f(y(x)) For example if S = [n] r 1 then

g(x) = f(x1 f2(x2) fn(xn)

) (29)

Given span programs for the individual functions f and fj for j isin S we will construct a spanprogram for g We remark that although we are here requiring that the inner functions fj act on

13

disjoint sets of bits this assumption is not necessary for the definition It simplifies the notationthough for the cases S 6= [n] and will suffice for our applications

Let P be a span program computing fP = f Let P have inner product space V target vector|t〉 and input vectors |vi〉 indexed by Ifree and Ijc for j isin [n] and c isin 0 1

For j isin [n] let sj isin [0infin)mj be a vector of costs and let s isin [0infin)Pmj be the concatenation of

the vectors sj For j isin S let P j0 and P j1 be span programs computing fP j1 = fj 0 1mj rarr 0 1and fP j0 = notfj with rj = wsizesj (P j0) = wsizesj (P j1) For c isin 0 1 let P jc have inner productspace V jc with target vector |tjc〉 and input vectors indexed by Ijcfree and Ijckb for k isin [mj ] b isin 0 1For j isin S let rj = sj

Let IS =⋃jisinScisin01 Ijc Define ς IS rarr [n]times 0 1 by ς(i) = (j c) if i isin Ijc The idea is that

ς maps i to the input span program that must evaluate to 1 in order for |vi〉 to be available in P There are several ways of composing the span programs P and P jc to obtain a span program Q

computing the composed function fQ = g with wsizes(Q) le wsizer(P ) [Rei09a Defs 44 45 46]We focus on direct-sum composition

Definition 25 ([Rei09a Def 45]) The direct-sum-composed span program Qoplus is defined by

bull The inner product space is V oplus = V oplusoplus

jisinScisin01(CIjc otimes V jc) Any vector in V oplus can be

uniquely expressed as |u〉V +sum

iisinIS |i〉 otimes |ui〉 where |u〉 isin V and |ui〉 isin V ς(i)

bull The target vector is |toplus〉 = |t〉V

bull The free input vectors are indexed by Ioplusfree = Ifree cup IS cup⋃jisinScisin01(Ijc times Ijcfree) with for

i isin Ioplusfree

|voplusi 〉 =

|vi〉V if i isin Ifree

|vi〉V minus |i〉 otimes |tjc〉 if i isin Ijc and j isin S|iprime〉 otimes |viprimeprime〉 if i = (iprime iprimeprime) isin Ijc times Ijcfree

(210)

bull The other input vectors are indexed by Ioplus(jk)b for j isin [n] k isin [mj ] b isin 0 1 For j isin S

Ioplus(j1)b = Ijb with |voplusi 〉 = |vi〉V for i isin Ioplus(j1)b For j isin S let Ioplus(jk)b =⋃cisin01(Ijc times I

jckb) For

i isin Ijc and iprime isin Ijckb let|voplusiiprime〉 = |i〉 otimes |viprime〉 (211)

By [Rei09a Theorem 43] fQoplus = g and wsizes(Qoplus) le wsizer(P ) (While that theorem is statedonly for the case S = [n] it is trivially extended to other S sub [n]) We give a bound on how quicklythe full witness size can grow relative to the witness size

Lemma 26 Under the above conditions for each input x isin 0 1m1timesmiddot middot middottimes0 1mn with y = y(x)

bull If g(x) = 1 let |w〉 be a witness to fP (y) = 1 such thatsum

jisin[n]iisinIjyjrj |wi|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |w〉

)+

1 +sum

iisinIfree|wi|2

wsizer(P y)

where σ(y |w〉) = maxjisinS

existi isin Ijyj with 〈i|w〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(212)

14

bull If g(x) = 0 let |wprime〉 be a witness to fP (y) = 0 such thatsum

jisin[n]iisinIjyjrj |〈wprime|vi〉|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |wprime〉) +|wprime〉2

wsizer(P y)

where σ(y |wprime〉) = maxjisinS

existi isin Ijyj with 〈vi|wprime〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(213)

If S = empty then σ(y |w〉) and σ(y |wprime〉) should each be taken to be 1 in the above equations

Proof We follow the proof of [Rei09a Theorem 43] except keeping track of the full witness sizeNote that if S = empty then Eqs (212) and (213) are immediate by definition of fwsizes(Qoplus x)

Let I(y)prime = I(y) r Ifree =⋃jisin[n] Ijyj

In the first case g(x) = 1 for j isin S let |wjyj 〉 isin CIjyj be a witness to fP jyj (xj) = 1 such that

fwsizes(P jyj xj) = 1 +sum

iisinIjyjfree

|wjyj

i |2

+sum

kisin[mj ]iisinIjyjk(xj)k

(sj)k|wjyj

i |2 As in [Rei09a Theorem 43]

let |woplus〉 isin CIoplus(x) be given by

woplusi =

wi if i isin I(y)

wiprimewς(iprime)iprimeprime if i = (iprime iprimeprime) with iprime isin I(y)prime cap IS iprimeprime isin Iς(iprime)(x)

0 otherwise

(214)

Then |woplus〉 is a witness for fQoplus(x) = 1 and we compute

fwsizes(Qoplus x) le 1 +sumiisinIoplusfree

|woplusi |2 +

sumjisin[n]kisin[mj ]

iisinIoplus(jk)(xj)k

(sj)k|woplusi |2

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 (215)

+sum

jisinSiisinIjyj

|wi|2(

1 +sum

iprimeisinIjyjfree

|wjyj

iprime |2 +

sumkisin[mj ]iprimeisinI

jyjk(xj)k

(sj)k|wjyj

iprime |2

)

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 +sum

jisinSiisinIjyj

|wi|2 fwsizesj (P jyj xj)

Eq (212) follows using the bound fwsizesj (P jyj xj) le σ(y |w〉)rj for j isin S and sj = rj for j isin SNext consider the case g(x) = 0 For j isin S let |ujyj 〉 isin V jyj be a witness for f

P jyj (xj) = 0 withfwsizes(P jyj xj) = |ujyj 〉2 +

sumkisin[mj ]iisinI

jyj

k(xj)k

(sj)k|〈vi|ujyj 〉|2 As in [Rei09a Theorem 43] let

|uoplus〉 = |wprime〉V +sum

iisinISrI(y)

〈vi|wprime〉|i〉 otimes |uς(i)〉 (216)

15

Then |uoplus〉 is a witness for fQoplus(x) = 0 and moreover

fwsizes(Qoplus x) le |uoplus〉2 +sum

jisin[n]kisin[mj ]iisinIoplus(jk)(xj)k

(sj)k|〈voplusi |uoplus〉|2

= |uoplus〉2 +sum

jisin[n]rSiisinIjxj

sj |〈voplusi |uoplus〉|2 +

sumjisinSkisin[mj ]

iisinIjyjiprimeisinI

jyj

k(xj)k

(sj)k|〈voplusiiprime |uoplus〉|2

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

sj |〈vi|wprime〉|2 (217)

+sum

jisinSiisinIjyj

|〈vi|wprime〉|2(|ujyj 〉2 +

sumkisin[mj ]iprimeisinI

jyj

k(xj)k

(sj)k|〈viprime |ujyj 〉|2)

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

rj |〈vi|wprime〉|2 +sum

jisinSiisinIjyj

|〈vi|wprime〉|2 fwsizesj (P jyj xj)

Eq (213) follows using the bound fwsizesj (P jyj xj) le σ(y |wprime〉)rj for j isin S

Lemma 26 is a key step in the formula-evaluation results in this article and [Rei09b] Itis used to track the full witness size for span programs recursively composed in a direct-summanner along a formula The proof of Theorem 19 will require the lemma with the weakerbounds σ(y |w〉) σ(y |wprime〉) le maxjisinScisin01 fwsizesj (P jc)wsizesj (P jc) Theorem 111 will useonly the slightly stronger bounds σ(y |w〉) le maxjisinS fwsizesj (P jyj )wsizesj (P jyj ) σ(y |wprime〉) lemaxjisinS fwsizesj (P jyj )wsizesj (P jyj ) However the proof of [Rei09b Theorem 11] will require thebounds of Eqs (212) and (213)

3 Evaluation of almost-balanced formulas

In this section we will apply the span program framework from [Rei09a] to prove Theorem 19Our algorithm will be given by applying Theorem 24 to a certain span program Before beginningthe proof though we will give two necessary lemmas

Consider a span program P with corresponding weighted graph GP from [Rei09a Def 82]We will need a bound on the operator norm of abs(AGPv

) the entry-wise absolute value of theweighted adjacency matrix AGPv

If P is canonical [Rei09a Def 51] then we can indeed obtainsuch a bound in terms of the witness size of P

Lemma 31 Let s isin (0infin)k and let P be a canonical span program computing a function f 0 1k rarr 0 1 with input vectors indexed by the set I Assume that for each x isin 0 1k withf(x) = 0 an optimal witness to fP (x) = 0 is |x〉 itself Then

abs(AGP) le 2k

(1 +

wsizes(P )minjisin[k] sj

)+ |I| (31)

16

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 11: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

14 Quantum algorithm to evaluate approximately balanced AND-OR formulas

Ambainis et al [ACR+07] use a weaker balance criterion for AND-OR formulas than Definition 18They define an AND-OR formula to be approximately balanced if σminus(ϕ) = O(1) and σ+(ϕ) = O(n)Here n is the size of the formula ie the number of leaves and σminus(ϕ) and σ+(ϕ) are defined by

Definition 110 For each vertex v in a formula ϕ let

σminus(v) = maxξ

sumwisinξ

1Advplusmn(ϕw)

σ+(v) = maxξ

sumwisinξ

Advplusmn(ϕw)2 (110)

with each maximum taken over all simple paths ξ from v to a leaf Let σplusmn(ϕ) = σplusmn(r) where r isthe root of ϕ

Recall that Advplusmn(ϕ) = Adv(ϕ) =radicn for an AND-OR formula Definition 18 is a stricter

balance criterion because β-balance of a formula ϕ implies (by Lemma 32) that σminus(ϕ) and σ+(ϕ) areboth dominated by geometric series However the same steps followed by the proof of Theorem 19still suffice for proving the [ACR+07] result and in fact for strengthening it We show

Theorem 111 Let ϕ be an AND-OR formula of size n Then after polynomial-time classicalpreprocessing that does not depend on the input x ϕ(x) can be evaluated by a quantum algo-rithm with error at most 13 using O

(radicnσminus(ϕ)

)input queries The algorithmrsquos running time isradic

nσminus(ϕ)(log n)O(1) assuming unit-cost coherent access to the preprocessed string

For the special case of AND-OR formulas with σminus(ϕ) = O(1) Theorem 111 strengthens The-orem 19 The requirement that σminus(ϕ) = O(1) allows for some gates in the formula to be veryunbalanced Theorem 111 also strengthens [ACR+07 Theorem 1] because it does not require thatσ+(ϕ) = O(n) For example a formula that is biased near the root but balanced at greater depthscan have σminus(ϕ) = O(1) and σ+(ϕ) = ω(n) By substituting the bound σminus(ϕ) = O(

radicd) for a depth-

d formula [ACR+07 Def 3] a corollary of Theorem 111 is that a depth-d size-n AND-OR formulacan be evaluated using O(

radicnd) queries This improves the depth-dependence from [ACR+07] and

matches the dependence from an earlier version of that article [Amb07]The essential reason that the Definition 18 balance condition can be weakened is that for the

specific gates AND and OR by writing out the optimal span programs explicitly we can prove thatthey satisfy stronger properties than are necessarily true for other functions

2 Span programs

21 Definitions

We briefly recall some definitions from [Rei09a Sec 2] Additionally we define a span programcomplexity measure the full witness size that charges even for the ldquofreerdquo inputs This quantity isimportant for developing quantum algorithms that are time efficient as well as query efficient

For a natural number n let [n] = 1 2 n For a finite set X let CX be the inner productspace C|X| with orthonormal basis |x〉 x isin X For vector spaces V and W over C let L(VW )be the set of linear transformations from V into W and let L(V ) = L(V V ) For A isin L(VW )A is the operator norm of A For a string x isin 0 1n let x denote its bitwise complement

11

Definition 21 ([HLS05 HLS07]) For finite sets C E and D sube Cn let f D rarr E An adversarymatrix for f is a real symmetric matrix Γ isin L(CD) that satisfies 〈x|Γ|y〉 = 0 whenever f(x) = f(y)

The general adversary bound for f with costs s isin [0infin)n is

Advplusmns (f) = maxadversary matrices Γforalljisin[n] Γ∆jlesj

Γ (21)

Here Γ ∆j denotes the entry-wise matrix product between Γ and ∆j =sum

xyxj 6=yj|x〉〈y| The

(nonnegative-weight) adversary bound for f with costs s is defined by the same maximizationexcept with Γ restricted to have nonnegative entries In particular Advplusmns (f) ge Advs(f)

Letting ~1 = (1 1 1) the adversary bound for f is Adv(f) = Adv~1(f) and the generaladversary bound for f is Advplusmn(f) = Advplusmn~1 (f) By [HLS07] Q(f) = Ω(Advplusmn(f))

Definition 22 (Span program [KW93]) A span program P consists of a natural number n afinite-dimensional inner product space V over C a ldquotargetrdquo vector |t〉 isin V disjoint sets Ifree andIjb for j isin [n] b isin 0 1 and ldquoinput vectorsrdquo |vi〉 isin V for i isin Ifree cup

⋃jisin[n]bisin01 Ijb

To P corresponds a function fP 0 1n rarr 0 1 defined on x isin 0 1n by

fP (x) =

1 if |t〉 isin Span(|vi〉 i isin Ifree cup

⋃jisin[n] Ijxj)

0 otherwise(22)

Some additional notation is convenient Fix a span program P Let I = Ifreecup⋃jisin[n]bisin01 Ijb

Let A isin L(CI V ) be given by A =sum

iisinI |vi〉〈i| For x isin 0 1n let I(x) = Ifree cup⋃jisin[n] Ijxj and

Π(x) =sum

iisinI(x) |i〉〈i| isin L(CI) Then fP (x) = 1 if |t〉 isin Range(AΠ(x)) A vector |w〉 isin CI is saidto be a witness for fP (x) = 1 if Π(x)|w〉 = |w〉 and A|w〉 = |t〉 A vector |wprime〉 isin V is said to be awitness for fP (x) = 0 if 〈t|wprime〉 = 1 and Π(x)Adagger|wprime〉 = 0

Definition 23 (Witness size) Consider a span program P and a vector s isin [0infin)n of nonnegativeldquocostsrdquo Let S =

sumjisin[n]bisin01iisinIjb

radicsj |i〉〈i| isin L(CI) For each input x isin 0 1n define the witness

size of P on x with costs s wsizes(P x) as follows

wsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉 S|w〉2 if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

SAdagger|wprime〉2 if fP (x) = 0 (23)

The witness size of P with costs s is

wsizes(P ) = maxxisin01n

wsizes(P x) (24)

Define the full witness size fwsizes(P ) by letting Sf = S +sum

iisinIfree|i〉〈i| and

fwsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉(1 + Sf |w〉2) if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

(|wprime〉2 + SAdagger|wprime〉2) if fP (x) = 0 (25)

fwsizes(P ) = maxxisin01n

fwsizes(P x) (26)

When the subscript s is omitted the costs are taken to be uniform s = ~1 = (1 1 1) egfwsize(P ) = fwsize~1(P ) The witness size is defined in [RS08] The full witness size is definedin [Rei09a Sec 8] but is not named there A strict span program has Ifree = empty so Sf = S and amonotone span program has Ij0 = empty for all j [Rei09a Def 49]

12

22 Quantum algorithm to evaluate a span program based on its full witness size

[Rei09a Theorem 93] gives a quantum query algorithm for evaluating span programs based on thefull witness size The algorithm is based on a quantum walk on a certain graph Provided that thedegree of the graph is not too large it can actually be implemented efficiently

Theorem 24 ([Rei09a Theorem 93]) Let P be a span program Then fP can be evaluated using

T = O(fwsize(P ) abs(AGP

))

(27)

quantum queries with error probability at most 13 Moreover if the maximum degree of a vertexin GP is d then the time complexity of the algorithm for evaluating fP is at most a factor of(log d)

(log(T log d)

)O(1) worse after classical preprocessing and assuming constant-time coherentaccess to the preprocessed string

Proof sketch The query complexity claim is actually slightly weaker than [Rei09a Theorem 93]which allows the target vector to be scaled downward by a factor of

radicfwsize(P )

The time-complexity claim will follow from the proof of [Rei09a Theorem 93] in [Rei09aProp 94 Theorem 95] The algorithm for evaluating fP (x) uses a discrete-time quantum walkon the graph GP (x) If the maximum degree of a vertex in GP is d then each coin reflec-tion can be implemented using O(log d) single-qubit unitaries and queries to the preprocessedstring [GR02 CNW09] Finally the

(log(T log d)

)O(1) factor comes from applying the Solovay-Kitaev Theorem [KSV02] to compile the single-qubit unitaries into products of elementary gatesto precision 1O(T log d)

We remark that together with [Rei09a Theorem 31] Theorem 24 gives a way of transforming aone-sided-error quantum algorithm into a span program and back into a quantum algorithm suchthat the time complexity is nearly preserved after preprocessing This is only a weak equivalencebecause aside from requiring preprocessing the algorithm from Theorem 24 also has two-sided errorTo some degree though it complements the equivalence results for best span program witness sizeand bounded-error quantum query complexity [Rei09a Theorem 71 Theorem 92]

23 Direct-sum span program composition

Let us study the full witness size of the direct-sum composition of span programs We begin byrecalling the definition of direct-sum composition

Let f 0 1n rarr 0 1 and S sube [n] For j isin [n] let mj be a natural number with mj = 1 forj isin S For j isin S let fj 0 1mj rarr 0 1 Define y 0 1m1 times middot middot middot times 0 1mn rarr 0 1n by

y(x)j =

fj(xj) if j isin Sxj if j isin S

(28)

Define g 0 1m1 times middot middot middottimes 0 1mn rarr 0 1 by g(x) = f(y(x)) For example if S = [n] r 1 then

g(x) = f(x1 f2(x2) fn(xn)

) (29)

Given span programs for the individual functions f and fj for j isin S we will construct a spanprogram for g We remark that although we are here requiring that the inner functions fj act on

13

disjoint sets of bits this assumption is not necessary for the definition It simplifies the notationthough for the cases S 6= [n] and will suffice for our applications

Let P be a span program computing fP = f Let P have inner product space V target vector|t〉 and input vectors |vi〉 indexed by Ifree and Ijc for j isin [n] and c isin 0 1

For j isin [n] let sj isin [0infin)mj be a vector of costs and let s isin [0infin)Pmj be the concatenation of

the vectors sj For j isin S let P j0 and P j1 be span programs computing fP j1 = fj 0 1mj rarr 0 1and fP j0 = notfj with rj = wsizesj (P j0) = wsizesj (P j1) For c isin 0 1 let P jc have inner productspace V jc with target vector |tjc〉 and input vectors indexed by Ijcfree and Ijckb for k isin [mj ] b isin 0 1For j isin S let rj = sj

Let IS =⋃jisinScisin01 Ijc Define ς IS rarr [n]times 0 1 by ς(i) = (j c) if i isin Ijc The idea is that

ς maps i to the input span program that must evaluate to 1 in order for |vi〉 to be available in P There are several ways of composing the span programs P and P jc to obtain a span program Q

computing the composed function fQ = g with wsizes(Q) le wsizer(P ) [Rei09a Defs 44 45 46]We focus on direct-sum composition

Definition 25 ([Rei09a Def 45]) The direct-sum-composed span program Qoplus is defined by

bull The inner product space is V oplus = V oplusoplus

jisinScisin01(CIjc otimes V jc) Any vector in V oplus can be

uniquely expressed as |u〉V +sum

iisinIS |i〉 otimes |ui〉 where |u〉 isin V and |ui〉 isin V ς(i)

bull The target vector is |toplus〉 = |t〉V

bull The free input vectors are indexed by Ioplusfree = Ifree cup IS cup⋃jisinScisin01(Ijc times Ijcfree) with for

i isin Ioplusfree

|voplusi 〉 =

|vi〉V if i isin Ifree

|vi〉V minus |i〉 otimes |tjc〉 if i isin Ijc and j isin S|iprime〉 otimes |viprimeprime〉 if i = (iprime iprimeprime) isin Ijc times Ijcfree

(210)

bull The other input vectors are indexed by Ioplus(jk)b for j isin [n] k isin [mj ] b isin 0 1 For j isin S

Ioplus(j1)b = Ijb with |voplusi 〉 = |vi〉V for i isin Ioplus(j1)b For j isin S let Ioplus(jk)b =⋃cisin01(Ijc times I

jckb) For

i isin Ijc and iprime isin Ijckb let|voplusiiprime〉 = |i〉 otimes |viprime〉 (211)

By [Rei09a Theorem 43] fQoplus = g and wsizes(Qoplus) le wsizer(P ) (While that theorem is statedonly for the case S = [n] it is trivially extended to other S sub [n]) We give a bound on how quicklythe full witness size can grow relative to the witness size

Lemma 26 Under the above conditions for each input x isin 0 1m1timesmiddot middot middottimes0 1mn with y = y(x)

bull If g(x) = 1 let |w〉 be a witness to fP (y) = 1 such thatsum

jisin[n]iisinIjyjrj |wi|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |w〉

)+

1 +sum

iisinIfree|wi|2

wsizer(P y)

where σ(y |w〉) = maxjisinS

existi isin Ijyj with 〈i|w〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(212)

14

bull If g(x) = 0 let |wprime〉 be a witness to fP (y) = 0 such thatsum

jisin[n]iisinIjyjrj |〈wprime|vi〉|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |wprime〉) +|wprime〉2

wsizer(P y)

where σ(y |wprime〉) = maxjisinS

existi isin Ijyj with 〈vi|wprime〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(213)

If S = empty then σ(y |w〉) and σ(y |wprime〉) should each be taken to be 1 in the above equations

Proof We follow the proof of [Rei09a Theorem 43] except keeping track of the full witness sizeNote that if S = empty then Eqs (212) and (213) are immediate by definition of fwsizes(Qoplus x)

Let I(y)prime = I(y) r Ifree =⋃jisin[n] Ijyj

In the first case g(x) = 1 for j isin S let |wjyj 〉 isin CIjyj be a witness to fP jyj (xj) = 1 such that

fwsizes(P jyj xj) = 1 +sum

iisinIjyjfree

|wjyj

i |2

+sum

kisin[mj ]iisinIjyjk(xj)k

(sj)k|wjyj

i |2 As in [Rei09a Theorem 43]

let |woplus〉 isin CIoplus(x) be given by

woplusi =

wi if i isin I(y)

wiprimewς(iprime)iprimeprime if i = (iprime iprimeprime) with iprime isin I(y)prime cap IS iprimeprime isin Iς(iprime)(x)

0 otherwise

(214)

Then |woplus〉 is a witness for fQoplus(x) = 1 and we compute

fwsizes(Qoplus x) le 1 +sumiisinIoplusfree

|woplusi |2 +

sumjisin[n]kisin[mj ]

iisinIoplus(jk)(xj)k

(sj)k|woplusi |2

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 (215)

+sum

jisinSiisinIjyj

|wi|2(

1 +sum

iprimeisinIjyjfree

|wjyj

iprime |2 +

sumkisin[mj ]iprimeisinI

jyjk(xj)k

(sj)k|wjyj

iprime |2

)

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 +sum

jisinSiisinIjyj

|wi|2 fwsizesj (P jyj xj)

Eq (212) follows using the bound fwsizesj (P jyj xj) le σ(y |w〉)rj for j isin S and sj = rj for j isin SNext consider the case g(x) = 0 For j isin S let |ujyj 〉 isin V jyj be a witness for f

P jyj (xj) = 0 withfwsizes(P jyj xj) = |ujyj 〉2 +

sumkisin[mj ]iisinI

jyj

k(xj)k

(sj)k|〈vi|ujyj 〉|2 As in [Rei09a Theorem 43] let

|uoplus〉 = |wprime〉V +sum

iisinISrI(y)

〈vi|wprime〉|i〉 otimes |uς(i)〉 (216)

15

Then |uoplus〉 is a witness for fQoplus(x) = 0 and moreover

fwsizes(Qoplus x) le |uoplus〉2 +sum

jisin[n]kisin[mj ]iisinIoplus(jk)(xj)k

(sj)k|〈voplusi |uoplus〉|2

= |uoplus〉2 +sum

jisin[n]rSiisinIjxj

sj |〈voplusi |uoplus〉|2 +

sumjisinSkisin[mj ]

iisinIjyjiprimeisinI

jyj

k(xj)k

(sj)k|〈voplusiiprime |uoplus〉|2

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

sj |〈vi|wprime〉|2 (217)

+sum

jisinSiisinIjyj

|〈vi|wprime〉|2(|ujyj 〉2 +

sumkisin[mj ]iprimeisinI

jyj

k(xj)k

(sj)k|〈viprime |ujyj 〉|2)

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

rj |〈vi|wprime〉|2 +sum

jisinSiisinIjyj

|〈vi|wprime〉|2 fwsizesj (P jyj xj)

Eq (213) follows using the bound fwsizesj (P jyj xj) le σ(y |wprime〉)rj for j isin S

Lemma 26 is a key step in the formula-evaluation results in this article and [Rei09b] Itis used to track the full witness size for span programs recursively composed in a direct-summanner along a formula The proof of Theorem 19 will require the lemma with the weakerbounds σ(y |w〉) σ(y |wprime〉) le maxjisinScisin01 fwsizesj (P jc)wsizesj (P jc) Theorem 111 will useonly the slightly stronger bounds σ(y |w〉) le maxjisinS fwsizesj (P jyj )wsizesj (P jyj ) σ(y |wprime〉) lemaxjisinS fwsizesj (P jyj )wsizesj (P jyj ) However the proof of [Rei09b Theorem 11] will require thebounds of Eqs (212) and (213)

3 Evaluation of almost-balanced formulas

In this section we will apply the span program framework from [Rei09a] to prove Theorem 19Our algorithm will be given by applying Theorem 24 to a certain span program Before beginningthe proof though we will give two necessary lemmas

Consider a span program P with corresponding weighted graph GP from [Rei09a Def 82]We will need a bound on the operator norm of abs(AGPv

) the entry-wise absolute value of theweighted adjacency matrix AGPv

If P is canonical [Rei09a Def 51] then we can indeed obtainsuch a bound in terms of the witness size of P

Lemma 31 Let s isin (0infin)k and let P be a canonical span program computing a function f 0 1k rarr 0 1 with input vectors indexed by the set I Assume that for each x isin 0 1k withf(x) = 0 an optimal witness to fP (x) = 0 is |x〉 itself Then

abs(AGP) le 2k

(1 +

wsizes(P )minjisin[k] sj

)+ |I| (31)

16

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 12: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

Definition 21 ([HLS05 HLS07]) For finite sets C E and D sube Cn let f D rarr E An adversarymatrix for f is a real symmetric matrix Γ isin L(CD) that satisfies 〈x|Γ|y〉 = 0 whenever f(x) = f(y)

The general adversary bound for f with costs s isin [0infin)n is

Advplusmns (f) = maxadversary matrices Γforalljisin[n] Γ∆jlesj

Γ (21)

Here Γ ∆j denotes the entry-wise matrix product between Γ and ∆j =sum

xyxj 6=yj|x〉〈y| The

(nonnegative-weight) adversary bound for f with costs s is defined by the same maximizationexcept with Γ restricted to have nonnegative entries In particular Advplusmns (f) ge Advs(f)

Letting ~1 = (1 1 1) the adversary bound for f is Adv(f) = Adv~1(f) and the generaladversary bound for f is Advplusmn(f) = Advplusmn~1 (f) By [HLS07] Q(f) = Ω(Advplusmn(f))

Definition 22 (Span program [KW93]) A span program P consists of a natural number n afinite-dimensional inner product space V over C a ldquotargetrdquo vector |t〉 isin V disjoint sets Ifree andIjb for j isin [n] b isin 0 1 and ldquoinput vectorsrdquo |vi〉 isin V for i isin Ifree cup

⋃jisin[n]bisin01 Ijb

To P corresponds a function fP 0 1n rarr 0 1 defined on x isin 0 1n by

fP (x) =

1 if |t〉 isin Span(|vi〉 i isin Ifree cup

⋃jisin[n] Ijxj)

0 otherwise(22)

Some additional notation is convenient Fix a span program P Let I = Ifreecup⋃jisin[n]bisin01 Ijb

Let A isin L(CI V ) be given by A =sum

iisinI |vi〉〈i| For x isin 0 1n let I(x) = Ifree cup⋃jisin[n] Ijxj and

Π(x) =sum

iisinI(x) |i〉〈i| isin L(CI) Then fP (x) = 1 if |t〉 isin Range(AΠ(x)) A vector |w〉 isin CI is saidto be a witness for fP (x) = 1 if Π(x)|w〉 = |w〉 and A|w〉 = |t〉 A vector |wprime〉 isin V is said to be awitness for fP (x) = 0 if 〈t|wprime〉 = 1 and Π(x)Adagger|wprime〉 = 0

Definition 23 (Witness size) Consider a span program P and a vector s isin [0infin)n of nonnegativeldquocostsrdquo Let S =

sumjisin[n]bisin01iisinIjb

radicsj |i〉〈i| isin L(CI) For each input x isin 0 1n define the witness

size of P on x with costs s wsizes(P x) as follows

wsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉 S|w〉2 if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

SAdagger|wprime〉2 if fP (x) = 0 (23)

The witness size of P with costs s is

wsizes(P ) = maxxisin01n

wsizes(P x) (24)

Define the full witness size fwsizes(P ) by letting Sf = S +sum

iisinIfree|i〉〈i| and

fwsizes(P x) =

min|w〉AΠ(x)|w〉=|t〉(1 + Sf |w〉2) if fP (x) = 1min |wprime〉 〈t|wprime〉=1

Π(x)Adagger|wprime〉=0

(|wprime〉2 + SAdagger|wprime〉2) if fP (x) = 0 (25)

fwsizes(P ) = maxxisin01n

fwsizes(P x) (26)

When the subscript s is omitted the costs are taken to be uniform s = ~1 = (1 1 1) egfwsize(P ) = fwsize~1(P ) The witness size is defined in [RS08] The full witness size is definedin [Rei09a Sec 8] but is not named there A strict span program has Ifree = empty so Sf = S and amonotone span program has Ij0 = empty for all j [Rei09a Def 49]

12

22 Quantum algorithm to evaluate a span program based on its full witness size

[Rei09a Theorem 93] gives a quantum query algorithm for evaluating span programs based on thefull witness size The algorithm is based on a quantum walk on a certain graph Provided that thedegree of the graph is not too large it can actually be implemented efficiently

Theorem 24 ([Rei09a Theorem 93]) Let P be a span program Then fP can be evaluated using

T = O(fwsize(P ) abs(AGP

))

(27)

quantum queries with error probability at most 13 Moreover if the maximum degree of a vertexin GP is d then the time complexity of the algorithm for evaluating fP is at most a factor of(log d)

(log(T log d)

)O(1) worse after classical preprocessing and assuming constant-time coherentaccess to the preprocessed string

Proof sketch The query complexity claim is actually slightly weaker than [Rei09a Theorem 93]which allows the target vector to be scaled downward by a factor of

radicfwsize(P )

The time-complexity claim will follow from the proof of [Rei09a Theorem 93] in [Rei09aProp 94 Theorem 95] The algorithm for evaluating fP (x) uses a discrete-time quantum walkon the graph GP (x) If the maximum degree of a vertex in GP is d then each coin reflec-tion can be implemented using O(log d) single-qubit unitaries and queries to the preprocessedstring [GR02 CNW09] Finally the

(log(T log d)

)O(1) factor comes from applying the Solovay-Kitaev Theorem [KSV02] to compile the single-qubit unitaries into products of elementary gatesto precision 1O(T log d)

We remark that together with [Rei09a Theorem 31] Theorem 24 gives a way of transforming aone-sided-error quantum algorithm into a span program and back into a quantum algorithm suchthat the time complexity is nearly preserved after preprocessing This is only a weak equivalencebecause aside from requiring preprocessing the algorithm from Theorem 24 also has two-sided errorTo some degree though it complements the equivalence results for best span program witness sizeand bounded-error quantum query complexity [Rei09a Theorem 71 Theorem 92]

23 Direct-sum span program composition

Let us study the full witness size of the direct-sum composition of span programs We begin byrecalling the definition of direct-sum composition

Let f 0 1n rarr 0 1 and S sube [n] For j isin [n] let mj be a natural number with mj = 1 forj isin S For j isin S let fj 0 1mj rarr 0 1 Define y 0 1m1 times middot middot middot times 0 1mn rarr 0 1n by

y(x)j =

fj(xj) if j isin Sxj if j isin S

(28)

Define g 0 1m1 times middot middot middottimes 0 1mn rarr 0 1 by g(x) = f(y(x)) For example if S = [n] r 1 then

g(x) = f(x1 f2(x2) fn(xn)

) (29)

Given span programs for the individual functions f and fj for j isin S we will construct a spanprogram for g We remark that although we are here requiring that the inner functions fj act on

13

disjoint sets of bits this assumption is not necessary for the definition It simplifies the notationthough for the cases S 6= [n] and will suffice for our applications

Let P be a span program computing fP = f Let P have inner product space V target vector|t〉 and input vectors |vi〉 indexed by Ifree and Ijc for j isin [n] and c isin 0 1

For j isin [n] let sj isin [0infin)mj be a vector of costs and let s isin [0infin)Pmj be the concatenation of

the vectors sj For j isin S let P j0 and P j1 be span programs computing fP j1 = fj 0 1mj rarr 0 1and fP j0 = notfj with rj = wsizesj (P j0) = wsizesj (P j1) For c isin 0 1 let P jc have inner productspace V jc with target vector |tjc〉 and input vectors indexed by Ijcfree and Ijckb for k isin [mj ] b isin 0 1For j isin S let rj = sj

Let IS =⋃jisinScisin01 Ijc Define ς IS rarr [n]times 0 1 by ς(i) = (j c) if i isin Ijc The idea is that

ς maps i to the input span program that must evaluate to 1 in order for |vi〉 to be available in P There are several ways of composing the span programs P and P jc to obtain a span program Q

computing the composed function fQ = g with wsizes(Q) le wsizer(P ) [Rei09a Defs 44 45 46]We focus on direct-sum composition

Definition 25 ([Rei09a Def 45]) The direct-sum-composed span program Qoplus is defined by

bull The inner product space is V oplus = V oplusoplus

jisinScisin01(CIjc otimes V jc) Any vector in V oplus can be

uniquely expressed as |u〉V +sum

iisinIS |i〉 otimes |ui〉 where |u〉 isin V and |ui〉 isin V ς(i)

bull The target vector is |toplus〉 = |t〉V

bull The free input vectors are indexed by Ioplusfree = Ifree cup IS cup⋃jisinScisin01(Ijc times Ijcfree) with for

i isin Ioplusfree

|voplusi 〉 =

|vi〉V if i isin Ifree

|vi〉V minus |i〉 otimes |tjc〉 if i isin Ijc and j isin S|iprime〉 otimes |viprimeprime〉 if i = (iprime iprimeprime) isin Ijc times Ijcfree

(210)

bull The other input vectors are indexed by Ioplus(jk)b for j isin [n] k isin [mj ] b isin 0 1 For j isin S

Ioplus(j1)b = Ijb with |voplusi 〉 = |vi〉V for i isin Ioplus(j1)b For j isin S let Ioplus(jk)b =⋃cisin01(Ijc times I

jckb) For

i isin Ijc and iprime isin Ijckb let|voplusiiprime〉 = |i〉 otimes |viprime〉 (211)

By [Rei09a Theorem 43] fQoplus = g and wsizes(Qoplus) le wsizer(P ) (While that theorem is statedonly for the case S = [n] it is trivially extended to other S sub [n]) We give a bound on how quicklythe full witness size can grow relative to the witness size

Lemma 26 Under the above conditions for each input x isin 0 1m1timesmiddot middot middottimes0 1mn with y = y(x)

bull If g(x) = 1 let |w〉 be a witness to fP (y) = 1 such thatsum

jisin[n]iisinIjyjrj |wi|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |w〉

)+

1 +sum

iisinIfree|wi|2

wsizer(P y)

where σ(y |w〉) = maxjisinS

existi isin Ijyj with 〈i|w〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(212)

14

bull If g(x) = 0 let |wprime〉 be a witness to fP (y) = 0 such thatsum

jisin[n]iisinIjyjrj |〈wprime|vi〉|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |wprime〉) +|wprime〉2

wsizer(P y)

where σ(y |wprime〉) = maxjisinS

existi isin Ijyj with 〈vi|wprime〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(213)

If S = empty then σ(y |w〉) and σ(y |wprime〉) should each be taken to be 1 in the above equations

Proof We follow the proof of [Rei09a Theorem 43] except keeping track of the full witness sizeNote that if S = empty then Eqs (212) and (213) are immediate by definition of fwsizes(Qoplus x)

Let I(y)prime = I(y) r Ifree =⋃jisin[n] Ijyj

In the first case g(x) = 1 for j isin S let |wjyj 〉 isin CIjyj be a witness to fP jyj (xj) = 1 such that

fwsizes(P jyj xj) = 1 +sum

iisinIjyjfree

|wjyj

i |2

+sum

kisin[mj ]iisinIjyjk(xj)k

(sj)k|wjyj

i |2 As in [Rei09a Theorem 43]

let |woplus〉 isin CIoplus(x) be given by

woplusi =

wi if i isin I(y)

wiprimewς(iprime)iprimeprime if i = (iprime iprimeprime) with iprime isin I(y)prime cap IS iprimeprime isin Iς(iprime)(x)

0 otherwise

(214)

Then |woplus〉 is a witness for fQoplus(x) = 1 and we compute

fwsizes(Qoplus x) le 1 +sumiisinIoplusfree

|woplusi |2 +

sumjisin[n]kisin[mj ]

iisinIoplus(jk)(xj)k

(sj)k|woplusi |2

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 (215)

+sum

jisinSiisinIjyj

|wi|2(

1 +sum

iprimeisinIjyjfree

|wjyj

iprime |2 +

sumkisin[mj ]iprimeisinI

jyjk(xj)k

(sj)k|wjyj

iprime |2

)

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 +sum

jisinSiisinIjyj

|wi|2 fwsizesj (P jyj xj)

Eq (212) follows using the bound fwsizesj (P jyj xj) le σ(y |w〉)rj for j isin S and sj = rj for j isin SNext consider the case g(x) = 0 For j isin S let |ujyj 〉 isin V jyj be a witness for f

P jyj (xj) = 0 withfwsizes(P jyj xj) = |ujyj 〉2 +

sumkisin[mj ]iisinI

jyj

k(xj)k

(sj)k|〈vi|ujyj 〉|2 As in [Rei09a Theorem 43] let

|uoplus〉 = |wprime〉V +sum

iisinISrI(y)

〈vi|wprime〉|i〉 otimes |uς(i)〉 (216)

15

Then |uoplus〉 is a witness for fQoplus(x) = 0 and moreover

fwsizes(Qoplus x) le |uoplus〉2 +sum

jisin[n]kisin[mj ]iisinIoplus(jk)(xj)k

(sj)k|〈voplusi |uoplus〉|2

= |uoplus〉2 +sum

jisin[n]rSiisinIjxj

sj |〈voplusi |uoplus〉|2 +

sumjisinSkisin[mj ]

iisinIjyjiprimeisinI

jyj

k(xj)k

(sj)k|〈voplusiiprime |uoplus〉|2

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

sj |〈vi|wprime〉|2 (217)

+sum

jisinSiisinIjyj

|〈vi|wprime〉|2(|ujyj 〉2 +

sumkisin[mj ]iprimeisinI

jyj

k(xj)k

(sj)k|〈viprime |ujyj 〉|2)

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

rj |〈vi|wprime〉|2 +sum

jisinSiisinIjyj

|〈vi|wprime〉|2 fwsizesj (P jyj xj)

Eq (213) follows using the bound fwsizesj (P jyj xj) le σ(y |wprime〉)rj for j isin S

Lemma 26 is a key step in the formula-evaluation results in this article and [Rei09b] Itis used to track the full witness size for span programs recursively composed in a direct-summanner along a formula The proof of Theorem 19 will require the lemma with the weakerbounds σ(y |w〉) σ(y |wprime〉) le maxjisinScisin01 fwsizesj (P jc)wsizesj (P jc) Theorem 111 will useonly the slightly stronger bounds σ(y |w〉) le maxjisinS fwsizesj (P jyj )wsizesj (P jyj ) σ(y |wprime〉) lemaxjisinS fwsizesj (P jyj )wsizesj (P jyj ) However the proof of [Rei09b Theorem 11] will require thebounds of Eqs (212) and (213)

3 Evaluation of almost-balanced formulas

In this section we will apply the span program framework from [Rei09a] to prove Theorem 19Our algorithm will be given by applying Theorem 24 to a certain span program Before beginningthe proof though we will give two necessary lemmas

Consider a span program P with corresponding weighted graph GP from [Rei09a Def 82]We will need a bound on the operator norm of abs(AGPv

) the entry-wise absolute value of theweighted adjacency matrix AGPv

If P is canonical [Rei09a Def 51] then we can indeed obtainsuch a bound in terms of the witness size of P

Lemma 31 Let s isin (0infin)k and let P be a canonical span program computing a function f 0 1k rarr 0 1 with input vectors indexed by the set I Assume that for each x isin 0 1k withf(x) = 0 an optimal witness to fP (x) = 0 is |x〉 itself Then

abs(AGP) le 2k

(1 +

wsizes(P )minjisin[k] sj

)+ |I| (31)

16

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 13: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

22 Quantum algorithm to evaluate a span program based on its full witness size

[Rei09a Theorem 93] gives a quantum query algorithm for evaluating span programs based on thefull witness size The algorithm is based on a quantum walk on a certain graph Provided that thedegree of the graph is not too large it can actually be implemented efficiently

Theorem 24 ([Rei09a Theorem 93]) Let P be a span program Then fP can be evaluated using

T = O(fwsize(P ) abs(AGP

))

(27)

quantum queries with error probability at most 13 Moreover if the maximum degree of a vertexin GP is d then the time complexity of the algorithm for evaluating fP is at most a factor of(log d)

(log(T log d)

)O(1) worse after classical preprocessing and assuming constant-time coherentaccess to the preprocessed string

Proof sketch The query complexity claim is actually slightly weaker than [Rei09a Theorem 93]which allows the target vector to be scaled downward by a factor of

radicfwsize(P )

The time-complexity claim will follow from the proof of [Rei09a Theorem 93] in [Rei09aProp 94 Theorem 95] The algorithm for evaluating fP (x) uses a discrete-time quantum walkon the graph GP (x) If the maximum degree of a vertex in GP is d then each coin reflec-tion can be implemented using O(log d) single-qubit unitaries and queries to the preprocessedstring [GR02 CNW09] Finally the

(log(T log d)

)O(1) factor comes from applying the Solovay-Kitaev Theorem [KSV02] to compile the single-qubit unitaries into products of elementary gatesto precision 1O(T log d)

We remark that together with [Rei09a Theorem 31] Theorem 24 gives a way of transforming aone-sided-error quantum algorithm into a span program and back into a quantum algorithm suchthat the time complexity is nearly preserved after preprocessing This is only a weak equivalencebecause aside from requiring preprocessing the algorithm from Theorem 24 also has two-sided errorTo some degree though it complements the equivalence results for best span program witness sizeand bounded-error quantum query complexity [Rei09a Theorem 71 Theorem 92]

23 Direct-sum span program composition

Let us study the full witness size of the direct-sum composition of span programs We begin byrecalling the definition of direct-sum composition

Let f 0 1n rarr 0 1 and S sube [n] For j isin [n] let mj be a natural number with mj = 1 forj isin S For j isin S let fj 0 1mj rarr 0 1 Define y 0 1m1 times middot middot middot times 0 1mn rarr 0 1n by

y(x)j =

fj(xj) if j isin Sxj if j isin S

(28)

Define g 0 1m1 times middot middot middottimes 0 1mn rarr 0 1 by g(x) = f(y(x)) For example if S = [n] r 1 then

g(x) = f(x1 f2(x2) fn(xn)

) (29)

Given span programs for the individual functions f and fj for j isin S we will construct a spanprogram for g We remark that although we are here requiring that the inner functions fj act on

13

disjoint sets of bits this assumption is not necessary for the definition It simplifies the notationthough for the cases S 6= [n] and will suffice for our applications

Let P be a span program computing fP = f Let P have inner product space V target vector|t〉 and input vectors |vi〉 indexed by Ifree and Ijc for j isin [n] and c isin 0 1

For j isin [n] let sj isin [0infin)mj be a vector of costs and let s isin [0infin)Pmj be the concatenation of

the vectors sj For j isin S let P j0 and P j1 be span programs computing fP j1 = fj 0 1mj rarr 0 1and fP j0 = notfj with rj = wsizesj (P j0) = wsizesj (P j1) For c isin 0 1 let P jc have inner productspace V jc with target vector |tjc〉 and input vectors indexed by Ijcfree and Ijckb for k isin [mj ] b isin 0 1For j isin S let rj = sj

Let IS =⋃jisinScisin01 Ijc Define ς IS rarr [n]times 0 1 by ς(i) = (j c) if i isin Ijc The idea is that

ς maps i to the input span program that must evaluate to 1 in order for |vi〉 to be available in P There are several ways of composing the span programs P and P jc to obtain a span program Q

computing the composed function fQ = g with wsizes(Q) le wsizer(P ) [Rei09a Defs 44 45 46]We focus on direct-sum composition

Definition 25 ([Rei09a Def 45]) The direct-sum-composed span program Qoplus is defined by

bull The inner product space is V oplus = V oplusoplus

jisinScisin01(CIjc otimes V jc) Any vector in V oplus can be

uniquely expressed as |u〉V +sum

iisinIS |i〉 otimes |ui〉 where |u〉 isin V and |ui〉 isin V ς(i)

bull The target vector is |toplus〉 = |t〉V

bull The free input vectors are indexed by Ioplusfree = Ifree cup IS cup⋃jisinScisin01(Ijc times Ijcfree) with for

i isin Ioplusfree

|voplusi 〉 =

|vi〉V if i isin Ifree

|vi〉V minus |i〉 otimes |tjc〉 if i isin Ijc and j isin S|iprime〉 otimes |viprimeprime〉 if i = (iprime iprimeprime) isin Ijc times Ijcfree

(210)

bull The other input vectors are indexed by Ioplus(jk)b for j isin [n] k isin [mj ] b isin 0 1 For j isin S

Ioplus(j1)b = Ijb with |voplusi 〉 = |vi〉V for i isin Ioplus(j1)b For j isin S let Ioplus(jk)b =⋃cisin01(Ijc times I

jckb) For

i isin Ijc and iprime isin Ijckb let|voplusiiprime〉 = |i〉 otimes |viprime〉 (211)

By [Rei09a Theorem 43] fQoplus = g and wsizes(Qoplus) le wsizer(P ) (While that theorem is statedonly for the case S = [n] it is trivially extended to other S sub [n]) We give a bound on how quicklythe full witness size can grow relative to the witness size

Lemma 26 Under the above conditions for each input x isin 0 1m1timesmiddot middot middottimes0 1mn with y = y(x)

bull If g(x) = 1 let |w〉 be a witness to fP (y) = 1 such thatsum

jisin[n]iisinIjyjrj |wi|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |w〉

)+

1 +sum

iisinIfree|wi|2

wsizer(P y)

where σ(y |w〉) = maxjisinS

existi isin Ijyj with 〈i|w〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(212)

14

bull If g(x) = 0 let |wprime〉 be a witness to fP (y) = 0 such thatsum

jisin[n]iisinIjyjrj |〈wprime|vi〉|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |wprime〉) +|wprime〉2

wsizer(P y)

where σ(y |wprime〉) = maxjisinS

existi isin Ijyj with 〈vi|wprime〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(213)

If S = empty then σ(y |w〉) and σ(y |wprime〉) should each be taken to be 1 in the above equations

Proof We follow the proof of [Rei09a Theorem 43] except keeping track of the full witness sizeNote that if S = empty then Eqs (212) and (213) are immediate by definition of fwsizes(Qoplus x)

Let I(y)prime = I(y) r Ifree =⋃jisin[n] Ijyj

In the first case g(x) = 1 for j isin S let |wjyj 〉 isin CIjyj be a witness to fP jyj (xj) = 1 such that

fwsizes(P jyj xj) = 1 +sum

iisinIjyjfree

|wjyj

i |2

+sum

kisin[mj ]iisinIjyjk(xj)k

(sj)k|wjyj

i |2 As in [Rei09a Theorem 43]

let |woplus〉 isin CIoplus(x) be given by

woplusi =

wi if i isin I(y)

wiprimewς(iprime)iprimeprime if i = (iprime iprimeprime) with iprime isin I(y)prime cap IS iprimeprime isin Iς(iprime)(x)

0 otherwise

(214)

Then |woplus〉 is a witness for fQoplus(x) = 1 and we compute

fwsizes(Qoplus x) le 1 +sumiisinIoplusfree

|woplusi |2 +

sumjisin[n]kisin[mj ]

iisinIoplus(jk)(xj)k

(sj)k|woplusi |2

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 (215)

+sum

jisinSiisinIjyj

|wi|2(

1 +sum

iprimeisinIjyjfree

|wjyj

iprime |2 +

sumkisin[mj ]iprimeisinI

jyjk(xj)k

(sj)k|wjyj

iprime |2

)

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 +sum

jisinSiisinIjyj

|wi|2 fwsizesj (P jyj xj)

Eq (212) follows using the bound fwsizesj (P jyj xj) le σ(y |w〉)rj for j isin S and sj = rj for j isin SNext consider the case g(x) = 0 For j isin S let |ujyj 〉 isin V jyj be a witness for f

P jyj (xj) = 0 withfwsizes(P jyj xj) = |ujyj 〉2 +

sumkisin[mj ]iisinI

jyj

k(xj)k

(sj)k|〈vi|ujyj 〉|2 As in [Rei09a Theorem 43] let

|uoplus〉 = |wprime〉V +sum

iisinISrI(y)

〈vi|wprime〉|i〉 otimes |uς(i)〉 (216)

15

Then |uoplus〉 is a witness for fQoplus(x) = 0 and moreover

fwsizes(Qoplus x) le |uoplus〉2 +sum

jisin[n]kisin[mj ]iisinIoplus(jk)(xj)k

(sj)k|〈voplusi |uoplus〉|2

= |uoplus〉2 +sum

jisin[n]rSiisinIjxj

sj |〈voplusi |uoplus〉|2 +

sumjisinSkisin[mj ]

iisinIjyjiprimeisinI

jyj

k(xj)k

(sj)k|〈voplusiiprime |uoplus〉|2

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

sj |〈vi|wprime〉|2 (217)

+sum

jisinSiisinIjyj

|〈vi|wprime〉|2(|ujyj 〉2 +

sumkisin[mj ]iprimeisinI

jyj

k(xj)k

(sj)k|〈viprime |ujyj 〉|2)

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

rj |〈vi|wprime〉|2 +sum

jisinSiisinIjyj

|〈vi|wprime〉|2 fwsizesj (P jyj xj)

Eq (213) follows using the bound fwsizesj (P jyj xj) le σ(y |wprime〉)rj for j isin S

Lemma 26 is a key step in the formula-evaluation results in this article and [Rei09b] Itis used to track the full witness size for span programs recursively composed in a direct-summanner along a formula The proof of Theorem 19 will require the lemma with the weakerbounds σ(y |w〉) σ(y |wprime〉) le maxjisinScisin01 fwsizesj (P jc)wsizesj (P jc) Theorem 111 will useonly the slightly stronger bounds σ(y |w〉) le maxjisinS fwsizesj (P jyj )wsizesj (P jyj ) σ(y |wprime〉) lemaxjisinS fwsizesj (P jyj )wsizesj (P jyj ) However the proof of [Rei09b Theorem 11] will require thebounds of Eqs (212) and (213)

3 Evaluation of almost-balanced formulas

In this section we will apply the span program framework from [Rei09a] to prove Theorem 19Our algorithm will be given by applying Theorem 24 to a certain span program Before beginningthe proof though we will give two necessary lemmas

Consider a span program P with corresponding weighted graph GP from [Rei09a Def 82]We will need a bound on the operator norm of abs(AGPv

) the entry-wise absolute value of theweighted adjacency matrix AGPv

If P is canonical [Rei09a Def 51] then we can indeed obtainsuch a bound in terms of the witness size of P

Lemma 31 Let s isin (0infin)k and let P be a canonical span program computing a function f 0 1k rarr 0 1 with input vectors indexed by the set I Assume that for each x isin 0 1k withf(x) = 0 an optimal witness to fP (x) = 0 is |x〉 itself Then

abs(AGP) le 2k

(1 +

wsizes(P )minjisin[k] sj

)+ |I| (31)

16

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 14: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

disjoint sets of bits this assumption is not necessary for the definition It simplifies the notationthough for the cases S 6= [n] and will suffice for our applications

Let P be a span program computing fP = f Let P have inner product space V target vector|t〉 and input vectors |vi〉 indexed by Ifree and Ijc for j isin [n] and c isin 0 1

For j isin [n] let sj isin [0infin)mj be a vector of costs and let s isin [0infin)Pmj be the concatenation of

the vectors sj For j isin S let P j0 and P j1 be span programs computing fP j1 = fj 0 1mj rarr 0 1and fP j0 = notfj with rj = wsizesj (P j0) = wsizesj (P j1) For c isin 0 1 let P jc have inner productspace V jc with target vector |tjc〉 and input vectors indexed by Ijcfree and Ijckb for k isin [mj ] b isin 0 1For j isin S let rj = sj

Let IS =⋃jisinScisin01 Ijc Define ς IS rarr [n]times 0 1 by ς(i) = (j c) if i isin Ijc The idea is that

ς maps i to the input span program that must evaluate to 1 in order for |vi〉 to be available in P There are several ways of composing the span programs P and P jc to obtain a span program Q

computing the composed function fQ = g with wsizes(Q) le wsizer(P ) [Rei09a Defs 44 45 46]We focus on direct-sum composition

Definition 25 ([Rei09a Def 45]) The direct-sum-composed span program Qoplus is defined by

bull The inner product space is V oplus = V oplusoplus

jisinScisin01(CIjc otimes V jc) Any vector in V oplus can be

uniquely expressed as |u〉V +sum

iisinIS |i〉 otimes |ui〉 where |u〉 isin V and |ui〉 isin V ς(i)

bull The target vector is |toplus〉 = |t〉V

bull The free input vectors are indexed by Ioplusfree = Ifree cup IS cup⋃jisinScisin01(Ijc times Ijcfree) with for

i isin Ioplusfree

|voplusi 〉 =

|vi〉V if i isin Ifree

|vi〉V minus |i〉 otimes |tjc〉 if i isin Ijc and j isin S|iprime〉 otimes |viprimeprime〉 if i = (iprime iprimeprime) isin Ijc times Ijcfree

(210)

bull The other input vectors are indexed by Ioplus(jk)b for j isin [n] k isin [mj ] b isin 0 1 For j isin S

Ioplus(j1)b = Ijb with |voplusi 〉 = |vi〉V for i isin Ioplus(j1)b For j isin S let Ioplus(jk)b =⋃cisin01(Ijc times I

jckb) For

i isin Ijc and iprime isin Ijckb let|voplusiiprime〉 = |i〉 otimes |viprime〉 (211)

By [Rei09a Theorem 43] fQoplus = g and wsizes(Qoplus) le wsizer(P ) (While that theorem is statedonly for the case S = [n] it is trivially extended to other S sub [n]) We give a bound on how quicklythe full witness size can grow relative to the witness size

Lemma 26 Under the above conditions for each input x isin 0 1m1timesmiddot middot middottimes0 1mn with y = y(x)

bull If g(x) = 1 let |w〉 be a witness to fP (y) = 1 such thatsum

jisin[n]iisinIjyjrj |wi|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |w〉

)+

1 +sum

iisinIfree|wi|2

wsizer(P y)

where σ(y |w〉) = maxjisinS

existi isin Ijyj with 〈i|w〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(212)

14

bull If g(x) = 0 let |wprime〉 be a witness to fP (y) = 0 such thatsum

jisin[n]iisinIjyjrj |〈wprime|vi〉|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |wprime〉) +|wprime〉2

wsizer(P y)

where σ(y |wprime〉) = maxjisinS

existi isin Ijyj with 〈vi|wprime〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(213)

If S = empty then σ(y |w〉) and σ(y |wprime〉) should each be taken to be 1 in the above equations

Proof We follow the proof of [Rei09a Theorem 43] except keeping track of the full witness sizeNote that if S = empty then Eqs (212) and (213) are immediate by definition of fwsizes(Qoplus x)

Let I(y)prime = I(y) r Ifree =⋃jisin[n] Ijyj

In the first case g(x) = 1 for j isin S let |wjyj 〉 isin CIjyj be a witness to fP jyj (xj) = 1 such that

fwsizes(P jyj xj) = 1 +sum

iisinIjyjfree

|wjyj

i |2

+sum

kisin[mj ]iisinIjyjk(xj)k

(sj)k|wjyj

i |2 As in [Rei09a Theorem 43]

let |woplus〉 isin CIoplus(x) be given by

woplusi =

wi if i isin I(y)

wiprimewς(iprime)iprimeprime if i = (iprime iprimeprime) with iprime isin I(y)prime cap IS iprimeprime isin Iς(iprime)(x)

0 otherwise

(214)

Then |woplus〉 is a witness for fQoplus(x) = 1 and we compute

fwsizes(Qoplus x) le 1 +sumiisinIoplusfree

|woplusi |2 +

sumjisin[n]kisin[mj ]

iisinIoplus(jk)(xj)k

(sj)k|woplusi |2

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 (215)

+sum

jisinSiisinIjyj

|wi|2(

1 +sum

iprimeisinIjyjfree

|wjyj

iprime |2 +

sumkisin[mj ]iprimeisinI

jyjk(xj)k

(sj)k|wjyj

iprime |2

)

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 +sum

jisinSiisinIjyj

|wi|2 fwsizesj (P jyj xj)

Eq (212) follows using the bound fwsizesj (P jyj xj) le σ(y |w〉)rj for j isin S and sj = rj for j isin SNext consider the case g(x) = 0 For j isin S let |ujyj 〉 isin V jyj be a witness for f

P jyj (xj) = 0 withfwsizes(P jyj xj) = |ujyj 〉2 +

sumkisin[mj ]iisinI

jyj

k(xj)k

(sj)k|〈vi|ujyj 〉|2 As in [Rei09a Theorem 43] let

|uoplus〉 = |wprime〉V +sum

iisinISrI(y)

〈vi|wprime〉|i〉 otimes |uς(i)〉 (216)

15

Then |uoplus〉 is a witness for fQoplus(x) = 0 and moreover

fwsizes(Qoplus x) le |uoplus〉2 +sum

jisin[n]kisin[mj ]iisinIoplus(jk)(xj)k

(sj)k|〈voplusi |uoplus〉|2

= |uoplus〉2 +sum

jisin[n]rSiisinIjxj

sj |〈voplusi |uoplus〉|2 +

sumjisinSkisin[mj ]

iisinIjyjiprimeisinI

jyj

k(xj)k

(sj)k|〈voplusiiprime |uoplus〉|2

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

sj |〈vi|wprime〉|2 (217)

+sum

jisinSiisinIjyj

|〈vi|wprime〉|2(|ujyj 〉2 +

sumkisin[mj ]iprimeisinI

jyj

k(xj)k

(sj)k|〈viprime |ujyj 〉|2)

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

rj |〈vi|wprime〉|2 +sum

jisinSiisinIjyj

|〈vi|wprime〉|2 fwsizesj (P jyj xj)

Eq (213) follows using the bound fwsizesj (P jyj xj) le σ(y |wprime〉)rj for j isin S

Lemma 26 is a key step in the formula-evaluation results in this article and [Rei09b] Itis used to track the full witness size for span programs recursively composed in a direct-summanner along a formula The proof of Theorem 19 will require the lemma with the weakerbounds σ(y |w〉) σ(y |wprime〉) le maxjisinScisin01 fwsizesj (P jc)wsizesj (P jc) Theorem 111 will useonly the slightly stronger bounds σ(y |w〉) le maxjisinS fwsizesj (P jyj )wsizesj (P jyj ) σ(y |wprime〉) lemaxjisinS fwsizesj (P jyj )wsizesj (P jyj ) However the proof of [Rei09b Theorem 11] will require thebounds of Eqs (212) and (213)

3 Evaluation of almost-balanced formulas

In this section we will apply the span program framework from [Rei09a] to prove Theorem 19Our algorithm will be given by applying Theorem 24 to a certain span program Before beginningthe proof though we will give two necessary lemmas

Consider a span program P with corresponding weighted graph GP from [Rei09a Def 82]We will need a bound on the operator norm of abs(AGPv

) the entry-wise absolute value of theweighted adjacency matrix AGPv

If P is canonical [Rei09a Def 51] then we can indeed obtainsuch a bound in terms of the witness size of P

Lemma 31 Let s isin (0infin)k and let P be a canonical span program computing a function f 0 1k rarr 0 1 with input vectors indexed by the set I Assume that for each x isin 0 1k withf(x) = 0 an optimal witness to fP (x) = 0 is |x〉 itself Then

abs(AGP) le 2k

(1 +

wsizes(P )minjisin[k] sj

)+ |I| (31)

16

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 15: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

bull If g(x) = 0 let |wprime〉 be a witness to fP (y) = 0 such thatsum

jisin[n]iisinIjyjrj |〈wprime|vi〉|2 = wsizer(P y)

Then

fwsizes(Qoplus x)wsizer(P y)

le σ(y |wprime〉) +|wprime〉2

wsizer(P y)

where σ(y |wprime〉) = maxjisinS

existi isin Ijyj with 〈vi|wprime〉 6= 0

fwsizesj (P jyj )wsizesj (P jyj )

(213)

If S = empty then σ(y |w〉) and σ(y |wprime〉) should each be taken to be 1 in the above equations

Proof We follow the proof of [Rei09a Theorem 43] except keeping track of the full witness sizeNote that if S = empty then Eqs (212) and (213) are immediate by definition of fwsizes(Qoplus x)

Let I(y)prime = I(y) r Ifree =⋃jisin[n] Ijyj

In the first case g(x) = 1 for j isin S let |wjyj 〉 isin CIjyj be a witness to fP jyj (xj) = 1 such that

fwsizes(P jyj xj) = 1 +sum

iisinIjyjfree

|wjyj

i |2

+sum

kisin[mj ]iisinIjyjk(xj)k

(sj)k|wjyj

i |2 As in [Rei09a Theorem 43]

let |woplus〉 isin CIoplus(x) be given by

woplusi =

wi if i isin I(y)

wiprimewς(iprime)iprimeprime if i = (iprime iprimeprime) with iprime isin I(y)prime cap IS iprimeprime isin Iς(iprime)(x)

0 otherwise

(214)

Then |woplus〉 is a witness for fQoplus(x) = 1 and we compute

fwsizes(Qoplus x) le 1 +sumiisinIoplusfree

|woplusi |2 +

sumjisin[n]kisin[mj ]

iisinIoplus(jk)(xj)k

(sj)k|woplusi |2

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 (215)

+sum

jisinSiisinIjyj

|wi|2(

1 +sum

iprimeisinIjyjfree

|wjyj

iprime |2 +

sumkisin[mj ]iprimeisinI

jyjk(xj)k

(sj)k|wjyj

iprime |2

)

= 1 +sumiisinIfree

|wi|2 +sum

jisin[n]rSiisinIjxj

sj |wi|2 +sum

jisinSiisinIjyj

|wi|2 fwsizesj (P jyj xj)

Eq (212) follows using the bound fwsizesj (P jyj xj) le σ(y |w〉)rj for j isin S and sj = rj for j isin SNext consider the case g(x) = 0 For j isin S let |ujyj 〉 isin V jyj be a witness for f

P jyj (xj) = 0 withfwsizes(P jyj xj) = |ujyj 〉2 +

sumkisin[mj ]iisinI

jyj

k(xj)k

(sj)k|〈vi|ujyj 〉|2 As in [Rei09a Theorem 43] let

|uoplus〉 = |wprime〉V +sum

iisinISrI(y)

〈vi|wprime〉|i〉 otimes |uς(i)〉 (216)

15

Then |uoplus〉 is a witness for fQoplus(x) = 0 and moreover

fwsizes(Qoplus x) le |uoplus〉2 +sum

jisin[n]kisin[mj ]iisinIoplus(jk)(xj)k

(sj)k|〈voplusi |uoplus〉|2

= |uoplus〉2 +sum

jisin[n]rSiisinIjxj

sj |〈voplusi |uoplus〉|2 +

sumjisinSkisin[mj ]

iisinIjyjiprimeisinI

jyj

k(xj)k

(sj)k|〈voplusiiprime |uoplus〉|2

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

sj |〈vi|wprime〉|2 (217)

+sum

jisinSiisinIjyj

|〈vi|wprime〉|2(|ujyj 〉2 +

sumkisin[mj ]iprimeisinI

jyj

k(xj)k

(sj)k|〈viprime |ujyj 〉|2)

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

rj |〈vi|wprime〉|2 +sum

jisinSiisinIjyj

|〈vi|wprime〉|2 fwsizesj (P jyj xj)

Eq (213) follows using the bound fwsizesj (P jyj xj) le σ(y |wprime〉)rj for j isin S

Lemma 26 is a key step in the formula-evaluation results in this article and [Rei09b] Itis used to track the full witness size for span programs recursively composed in a direct-summanner along a formula The proof of Theorem 19 will require the lemma with the weakerbounds σ(y |w〉) σ(y |wprime〉) le maxjisinScisin01 fwsizesj (P jc)wsizesj (P jc) Theorem 111 will useonly the slightly stronger bounds σ(y |w〉) le maxjisinS fwsizesj (P jyj )wsizesj (P jyj ) σ(y |wprime〉) lemaxjisinS fwsizesj (P jyj )wsizesj (P jyj ) However the proof of [Rei09b Theorem 11] will require thebounds of Eqs (212) and (213)

3 Evaluation of almost-balanced formulas

In this section we will apply the span program framework from [Rei09a] to prove Theorem 19Our algorithm will be given by applying Theorem 24 to a certain span program Before beginningthe proof though we will give two necessary lemmas

Consider a span program P with corresponding weighted graph GP from [Rei09a Def 82]We will need a bound on the operator norm of abs(AGPv

) the entry-wise absolute value of theweighted adjacency matrix AGPv

If P is canonical [Rei09a Def 51] then we can indeed obtainsuch a bound in terms of the witness size of P

Lemma 31 Let s isin (0infin)k and let P be a canonical span program computing a function f 0 1k rarr 0 1 with input vectors indexed by the set I Assume that for each x isin 0 1k withf(x) = 0 an optimal witness to fP (x) = 0 is |x〉 itself Then

abs(AGP) le 2k

(1 +

wsizes(P )minjisin[k] sj

)+ |I| (31)

16

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 16: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

Then |uoplus〉 is a witness for fQoplus(x) = 0 and moreover

fwsizes(Qoplus x) le |uoplus〉2 +sum

jisin[n]kisin[mj ]iisinIoplus(jk)(xj)k

(sj)k|〈voplusi |uoplus〉|2

= |uoplus〉2 +sum

jisin[n]rSiisinIjxj

sj |〈voplusi |uoplus〉|2 +

sumjisinSkisin[mj ]

iisinIjyjiprimeisinI

jyj

k(xj)k

(sj)k|〈voplusiiprime |uoplus〉|2

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

sj |〈vi|wprime〉|2 (217)

+sum

jisinSiisinIjyj

|〈vi|wprime〉|2(|ujyj 〉2 +

sumkisin[mj ]iprimeisinI

jyj

k(xj)k

(sj)k|〈viprime |ujyj 〉|2)

= |wprime〉2 +sum

jisin[n]rSiisinIjxj

rj |〈vi|wprime〉|2 +sum

jisinSiisinIjyj

|〈vi|wprime〉|2 fwsizesj (P jyj xj)

Eq (213) follows using the bound fwsizesj (P jyj xj) le σ(y |wprime〉)rj for j isin S

Lemma 26 is a key step in the formula-evaluation results in this article and [Rei09b] Itis used to track the full witness size for span programs recursively composed in a direct-summanner along a formula The proof of Theorem 19 will require the lemma with the weakerbounds σ(y |w〉) σ(y |wprime〉) le maxjisinScisin01 fwsizesj (P jc)wsizesj (P jc) Theorem 111 will useonly the slightly stronger bounds σ(y |w〉) le maxjisinS fwsizesj (P jyj )wsizesj (P jyj ) σ(y |wprime〉) lemaxjisinS fwsizesj (P jyj )wsizesj (P jyj ) However the proof of [Rei09b Theorem 11] will require thebounds of Eqs (212) and (213)

3 Evaluation of almost-balanced formulas

In this section we will apply the span program framework from [Rei09a] to prove Theorem 19Our algorithm will be given by applying Theorem 24 to a certain span program Before beginningthe proof though we will give two necessary lemmas

Consider a span program P with corresponding weighted graph GP from [Rei09a Def 82]We will need a bound on the operator norm of abs(AGPv

) the entry-wise absolute value of theweighted adjacency matrix AGPv

If P is canonical [Rei09a Def 51] then we can indeed obtainsuch a bound in terms of the witness size of P

Lemma 31 Let s isin (0infin)k and let P be a canonical span program computing a function f 0 1k rarr 0 1 with input vectors indexed by the set I Assume that for each x isin 0 1k withf(x) = 0 an optimal witness to fP (x) = 0 is |x〉 itself Then

abs(AGP) le 2k

(1 +

wsizes(P )minjisin[k] sj

)+ |I| (31)

16

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 17: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

Proof Recall from [Rei09a Def 51] that P being in canonical form implies that its target vectoris |t〉 =

sumxf(x)=0 |x〉 and that the matrix A whose columns are the input vectors of P can be

expressed asA =

sumiisinI|vi〉〈i| =

sumjisin[k] xf(x)=0

|x〉〈j xj | otimes 〈vxj | (32)

By assumption for each x isin fminus1(0)sumjisin[k]

sj|vxj〉2 = wsizes(P x) le wsizes(P ) (33)

In particular letting σ = minjisin[k] sj gt 0 we can boundsumjisin[k]

|vxj〉2 le1σ

sumjisin[k]

sj|vxj〉2

le wsizes(P )σ

(34)

The rest of the argument follows from the definition of the weighted adjacency matrix AGP

From [Rei09a Def 81 Prop 88] abs(AGP) le abs(BGP

)2 where BGPis the biadjacency

matrix corresponding to P

BGP=(|t〉 A0 1

) (35)

and 1 is an |I| times |I| identity matrix Now bound abs(BGP) by its Frobenius norm

abs(AGP) le abs(BGP

)2

le abs(BGP)2F

= |t〉2 +sum

xf(x)=0jisin[k]

|vxj〉2 + |I|

le 2k + 2k maxxf(x)=0

sumjisin[k]

|vxj〉2 + |I|

(36)

Eq (31) follows by substituting in Eq (34)

An important quantity in the proof of Theorem 19 will be σminus(ϕ) from Definition 110 For analmost-balanced formula ϕ σminus(ϕ) = O(1)

Lemma 32 Consider a β-balanced formula ϕ over a gate set S in which every gate depends onat least two input bits Then for every vertex v with children c1 c2 ck

Advplusmn(ϕv)maxj Advplusmn(ϕcj )

geradic

1 +1β2

(37)

In particularσminus(ϕ) le (2 +

radic2)β2 (38)

17

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 18: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

Proof Consider a vertex v with corresponding gate g = gv 0 1k rarr 0 1 By Theorem 13Advplusmn(ϕv) = Advplusmns (g) where sj = Advplusmn(ϕcj ) It is immediate from the definitions that Advplusmns (g) geAdvs(g) We will show that Advs(g) ge

radic1 + 1β2(maxj sj) using that maxj sjminj sj le β

Use the weighted minimax formulation of the adversary bound from [HLS07 Theorem 18]

Advs(g) = minp

maxxyisin01kg(x)6=g(y)

1sumjxj 6=yj

radicpx(j)py(j)sj

(39)

where the minimization is over all choices of probability distributions px over [k] for x isin 0 1kSince the adversary bound is monotone increasing in each weight the worst case is when all

but one of the weights are equal to maxj sjβ Since for a scalar c Advcs(g) = cAdvs(g) we mayscale so that one weight is β and all other weights are 1 Assume that the first weight is s1 = βthe other k minus 1 cases s2 = β and so on are symmetrical Assume also that g depends on the firstbit otherwise Advplusmns (g) will not depend on s1 so one of the other cases will be worse Thereforethere exist inputs x y isin 0 1k that differ only on the first bit but for which g(x) 6= g(y)

Since the function g depends on at least two input bits there also exists a third input z isin 0 1kwith x1 = z1 but g(z) = g(y) 6= g(x) Indeed if g(z) = g(x) for every z with z1 = x1 and ifg(z) = g(y) for every z with z1 = y1 then g depends only on the first bit

By Eq (39)

Advplusmns (g) ge minpxpy pz

max 1radic

px(1)py(1)s1

1sum

jge2xj 6=zj

radicpx(j)pz(j)sj

(310)

where the minimization is over only the three probability distributions px py and pz In the aboveexpression we may clearly take py(1) = 1 and py(j) = 0 for j ge 2 We may also use the Cauchy-Schwarz inequality to bound the second term above and finally substitute s1 = β sj = 1 for j ge 2to obtain

Advplusmns (g) ge minpx

max βradic

px(1)

1radicsumjge2 px(j)

(311)

The optimum is achieved for px(1) = β2(1 + β2) so Advplusmns (g) geradic

1 + β2 as claimedTo derive Eq (38) note that β ge 1 necessarily Then the sum σminus(ϕ) is dominated by the

geometric seriesinfinsumk=0

(1 +

1β2

)minusk2 (312)

which is at most (2 +radic

2)β2 with equality at β = 1

Note that the 1-balanced formulas over S = OR2 satisfy the inequality (37) with equalityand come arbitrarily close to saturating the inequality (38)

With Lemma 31 and Lemma 32 in hand we are ready to prove Theorem 19

Proof of Theorem 19 First of all we may assume without loss of generality that every gate in Sdepends on at least two input bits Indeed if a gate g 0 1k rarr 0 1 depends on no inputbits ie is the constant 0 or constant 1 function then g can be eliminated from any formulaover S without changing the adversary balance condition since Advplusmns (g) = 0 for all cost vectors

18

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 19: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

s isin [0infin)k If a gate g 0 1k rarr 0 1 depends only on one input bit say the first bit thenAdvplusmns (g) = s1 for all cost vectors s and therefore similarly g can be eliminated without affectingthe adversary balance condition

Consider ϕ an n-variable β-balanced read-once formula over the finite gate set S Let r be theroot of ϕ We begin by recursively constructing a span program Pϕ that computes ϕ and has witnesssize wsize(Pϕ) = Advplusmn(ϕ) Pϕ is constructed using direct-sum composition of span programs foreach node in ϕ (Direct-sum composition is also the composition method used in [RS08])

The construction works recursively starting at the leaves of ϕ and moving toward the rootConsider an internal vertex v with children c1 ck Let αj = Advplusmn(ϕcj ) where ϕcj is thesubformula of ϕ rooted at cj (Definition 18) In particular if cj is a leaf then αj = 1 Assumethat for j isin [k] we have inductively constructed span programs Pϕcj

and P daggerϕcjcomputing ϕcj

and notϕcj respectively with wsize(Pϕcj) = wsize(P daggerϕcj

) = αj Apply [Rei09a Theorem 61] a

generalization of Theorem 15 twice to obtain span programs Pv and P daggerv computing fPv = gv andfP daggerv

= notgv with wsizeα(Pv) = wsizeα(P daggerv ) = Advplusmnα (gv) = Advplusmn(ϕv)

Then let Pϕv and P daggerϕv be the direct-sum-composed span programs of Pv and P daggerv respectivelywith the span programs Pϕcj

P daggerϕcjaccording to the formula ϕ By definition of direct-sum compo-

sition the graph GPϕvis built by replacing the input edges of GPv with the graphs GPϕcj

or GP daggerϕcj

and similarly for GP daggerϕv

Some examples are given in [Rei09a App B] and in [RS08] By [Rei09a

Theorem 43] Pϕv (resp P daggerϕv) computes ϕv (notϕv) with wsize(Pϕv) = wsize(P daggerϕv) = Advplusmn(ϕv)Let Pϕ = Pϕr We wish to apply Theorem 24 to Pϕ to obtain a quantum algorithm but to do so

will need some more properties of the span programs Pv and P daggerv Recall from [Rei09a Theorem 52]that each Pv may be assumed to be in canonical form satisfying in particular that for any inputy isin 0 1k with gv(y) = 0 an optimal witness is |y〉 isin Cgminus1

v (0) itself Therefore Lemma 31 appliesand we obtain

abs(AGPv) = 2k

(1 +

wsizeα(Pv)minj αj

)+ |I| (313)

where |I| is the number of input vectors in Pv Now use

wsizeα(Pv)minj αj

=maxj αjminj αj

Advplusmnα (gv)maxj αj

le βk

(314)

where we have applied Eq (19) and also Advplusmnα (gv)maxj αj le Advplusmn(gv) le k Additionallyby [Rei09a Lemma 66] we may assume that |I| le 2k22k Thus

abs(AGPv) = β 2O(k) (315)

By repeating this argument for the negated function notgv computed by a dual span program P daggerv([Rei09a Lemma 41]) we also have abs(AG

Pdaggerv

) = β 2O(k)A consequence is that

abs(AGPϕ) = β 2O(kmax) (316)

where kmax is the maximum fan-in of any gate used in ϕ Indeed GPϕ is built by ldquoplugging togetherrdquothe graphs GPv and G

P daggervfor the different vertices v Split the graph GPϕ into two pieces G0 and

19

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 20: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

G1 comprising those subgraphs GPv and GP daggerv

for which the distance of v from r is even or oddrespectively Then abs(AGPϕ

) le abs(AG0) + abs(AG1) Since each Gb is the disconnectedunion of graphs GPv and G

P daggerv abs(AGb

) le maxv max abs(AGPv) abs(AG

Pdaggerv

)Let us bound the full witness size of Pϕ

Lemma 33 Let v be a vertex of ϕ Then

max

fwsize(Pϕv) fwsize(P daggerϕv)le σminus(v)Advplusmn(ϕv) (317)

Proof The proof is by induction in the maximum distance from v to a leaf The base case that allof vrsquos inputs are themselves leaves is by definition of Pv and P daggerv since then σminus(v) = 1+1Advplusmn(gv)

Let v have children c1 ck By Lemma 26 with s = ~1 and S = j isin [k] cj is not a leaf

fwsize(Pϕv)Advplusmn(ϕv)

le 1Advplusmn(ϕv)

+ maxjisinS

max

fwsize(Pϕcj

)

Advplusmn(ϕcj )fwsize(P daggerϕcj

)

Advplusmn(ϕcj )

(318)

In the case ϕv(x) = 1 this follows since Pv is strict so in Eq (212) the sum over Ifree is zero Inthe case ϕv(x) = 0 this follows since Pv is in canonical form so in Eq (213) |wprime〉2 = 1

Now by induction the right-hand side is at most Advplusmn(ϕv)minus1 + maxjisinS σminus(ϕcj ) = σminus(v)

In particular applying Lemma 33 for the case v = r we find

fwsize(Pϕ) le σminus(ϕ)Advplusmn(ϕ) = O(β2Advplusmn(ϕ)

)(319)

since σminus(ϕ) = O(β2) by Lemma 32 Combining Eqs (316) and (319) gives

fwsize(Pϕ) abs(AGPϕ) = β3 2O(kmax)Advplusmn(ϕ) (320)

This is O(Advplusmn(ϕ)) since the gate set S is fixed and finite kmax = O(1) Theorem 19 now followsfrom Theorem 24

Note that the lost constant in the theorem grows cubically in the balance parameter β andexponentially in the maximum fan-in kmax of a gate in S It is conceivable that this exponentialdependence can be improved

For future reference we state separately the bound used above to derive Eq (316)

Lemma 34 If Pϕ is the direct-sum composition along a formula ϕ of span programs Pv and P daggerv then

abs(AGP) le 2 max

visinϕmax abs(AGPv

) abs(AGPdaggerv

) (321)

If the span programs Pv are monotone then abs(AGP) le 2 maxv abs(AGPv

)

The claim for monotone span programs follows because then the dual span programs P daggerv arenot used in Pϕ

20

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 21: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

4 Evaluation of approximately balanced AND-OR formulas

The proof of Theorem 111 will again be a consequence of Lemma 26 and Theorem 24We will use the following strict monotone span programs for fan-in-two AND and OR gates

Definition 41 For s1 s2 gt 0 define span programs PAND(s1 s2) and POR(s1 s2) computingAND2 and OR2 0 12 rarr 0 1 respectively by

PAND(s1 s2) |t〉 =(α1

α2

) |v1〉 =

(β1

0

) |v2〉 =

(0β2

)(41)

POR(s1 s2) |t〉 = δ |v1〉 = ε1 |v2〉 = ε2 (42)

Both span programs have I11 = 1 I21 = 2 and Ifree = I10 = I20 = empty Here the parametersαj βj δ εj for j isin [2] are given by

αj = (sjsp)14 βj = 1 (43)

δ = 1 εj = (sjsp)14 (44)

where sp = s1 + s2 Let α =radicα2

1 + α22 and ε =

radicε21 + ε22

Note that α ε isin (1 214] They are largest when s1 = s2

Claim 42 The span programs PAND(s1 s2) and POR(s1 s2) satisfy

wsize(radics1radics2)(PAND x) =

radicsp if x isin 11 10 01radicsp

2 if x = 00

wsize(radics1radics2)(POR x) =

radicsp if x isin 00 10 01radicsp

2 if x = 11

(45)

Proof These are calculations using Definition 23 for the witness size Letting σ = (radics1radics2)

Q = PAND(s1 s2) and R = POR(s1 s2) we have

wsizeσ(Q 11) =(α1

β1

)2radics1 +

(α2

β2

)2radics2 =

radicsp wsizeσ(Q 10) =

(β2

α2

)2radics2 =

radicsp (46)

wsizeσ(Q 00) =((α1

β1

)2 1radics1

+(α2

β2

)2 1radics2

)minus1

=radicsp

2wsizeσ(Q 01) =

(β1

α1

)2radics1 =

radicsp

and

wsizeσ(R 11) = δ2( ε21radic

s1+

ε22radics2

)minus1=radicsp

2wsizeσ(R 10) =

( δε1

)2radics1 =

radicsp (47)

wsizeσ(R 00) =(ε1δ

)2radics1 +

(ε2δ

)2radics2 =

radicsp wsizeσ(R 01) =

( δε2

)2radics2 =

radicsp

It is not a coincidence that wsizeσ(Q x) = wsizeσ(R x) for all x isin 0 12 This can be seen as aconsequence of De Morganrsquos laws and span program dualitymdashsee [Rei09a Lemma 41]

21

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 22: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

Proof of Theorem 111 Let ϕ be an AND-OR formula of size n ie on n input bitsFirst expand out the formula so that every AND gate and every OR gate has fan-in two This

expansion can be carried out without increasing σminus(ϕ) by more than a factor of 10

Lemma 43 ([ACR+07 Lemma 8]) For any AND-OR formula ϕ one can efficiently constructan equivalent AND-OR formula ϕprime of the same size such that all gates in ϕprime have fan-in at mosttwo and σminus(ϕprime) = O(σminus(ϕ))

Therefore we may assume that ϕ is a formula over fan-in-two AND and OR gatesNow use direct-sum composition to compose the AND and OR gates according to the formula

ϕ as in the proof of Theorem 19 Since the span programs for AND and OR are monotone direct-sum composition does not make use of dual span programs computing NAND or NOR Thereforethere is no need to specify these span programs At a vertex v set the weights s1 and s2 to equalthe sizes of vrsquos two input subformulas Let Pv be the span program used at vertex v Pϕv be thespan program thus constructed for the subformula ϕv and Pϕ be the span program constructedcomputing ϕ With this choice of weights it follows from Claim 42 and [Rei09a Theorem 43]that wsize(Pϕv) = Advplusmn(ϕv) = Adv(ϕv)

Notice that for all s1 s2 isin [0infin) abs(AGPAND(s1s2)) = O(1) and abs(AGPOR(s1s2)

) = O(1)Therefore by Lemma 34 we obtain that abs(AGPϕ

) = O(1)Thus to apply Theorem 24 we need only bound fwsize(Pϕ) Lemma 33 does not apply because

for PAND(s1 s2) an optimal witness |wprime〉 to fPAND(x) = 0 might have |wprime〉2 gt 1 as each αj lt 1

(Lemma 33 would apply had we set the parameters to be α1 = α2 = 1 βj = (spsj)14 but thenAGPAND

would not necessarily be O(1)) However analogous to Lemma 33 we will show

Lemma 44 Let v be a vertex of ϕ Then

fwsize(Pϕv x) le

σminus(v)Adv(ϕv) if ϕv(x) = 12σminus(v)Adv(ϕv)minus 1 if ϕv(x) = 0

(48)

Proof The proof is by induction in the maximum distance from v to a leaf The base case thatvrsquos two inputs are themselves leaves is by definition of Pv since then σminus(v) = 1 + 1

radic2

Let v have children c1 and c2 We will use Lemma 26 with s = ~1 S = j isin [2] cj is not a leafIf ϕv(x) = 1 then since Pv is a strict span program ie Ifree = empty Eq (212) gives

fwsize(Pϕv x)Adv(ϕv)

le 1Adv(ϕv)

+ maxjisinS

fwsize(Pϕcj)

Adv(ϕcj ) (49)

By induction the right-hand side is at most 1Adv(ϕv) + maxj σminus(cj) = σminus(v)If ϕv(x) = 0 and gv is an OR gate then the unique witness |wprime〉 for Pv has |wprime〉 = 1 from

Definition 41 From Eq (213) and the induction hypothesis

fwsize(Pϕv x)Advplusmn(ϕv)

le 1Adv(ϕv)

+ maxjisinS

(2σminus(cj)minus

1Adv(ϕcj )

)lt 2σminus(v)minus 1

Adv(ϕv)

(410)

as claimed

22

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 23: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

Therefore assume that ϕv(x) = 0 and gv is an AND gate Let s1 and s2 be the sizes of thetwo input subformulas to v sp = s1 + s2 = Adv(ϕv)2 and assume without loss of generalitythat ϕc1(x) = 0 If ϕc2(x) = 0 as well then assume without loss of generality that 2σminus(c1) minus

1radics1ge 2σminus(c2) minus 1radic

s2 so σ(y) le 2σminus(c1) minus 1radic

s1 Then the witness |wprime〉 may be taken to be

|wprime〉 = (1α1 0) =((sps1)14 0

) From Eq (213)

fwsize(Pϕv x)Advplusmn(ϕv)

leradicsps1

Advplusmn(ϕv)+ σ(y)

le 1radics1

+(

2σminus(c1)minus 1radics1

)lt 2σminus(v)minus 1

radicsp

(411)

as claimed

In particular applying Lemma 44 for the case v = r we find

fwsize(Pϕ) le 2σminus(ϕ)Adv(ϕ) = 2σminus(ϕ)radicn (412)

Theorem 111 now follows from Theorem 24

5 Open problems

In order to begin to relax the balance condition for general formulas it seems that we need a betterunderstanding of the canonical span programs For example can the norm bound Lemma 31 beimproved

Although the two-sided bounded-error quantum query complexity of evaluating formulas isbeginning to be understood the zero-error quantum query complexity [BCdWZ99] appears to bemore complicated For example the exact and zero-error quantum query complexities for ORn

are both n [BBC+01] On the other hand Ambainis et al [ACGT09] use the [ACR+07] algorithmas a subroutine in the construction of a self-certifying zero-error quantum algorithm that makesO(radicn log2 n) queries to evaluate the balanced binary AND-OR formula It is not known how to

relax the balance requirement or extend the gate setCan we develop further methods for constructing span programs with small full witness size

norm and maximum degree A companion paper [Rei09b] studies reduced tensor-product spanprogram composition in order to complement the direct-sum composition that we have used here

The case of formulas over non-boolean gates may be more complicated [Rei09a] but is stillintriguing

Acknowledgements

I thank Andrew Landahl and Robert Spalek for helpful discussions Research supported by NSERCand ARO-DTO

23

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 24: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

References

[ACGT09] Andris Ambainis Andrew M Childs Francois Le Gall and Seiichiro Tani The quan-tum query complexity of certification 2009 arXiv09031291 [quant-ph]

[ACR+07] Andris Ambainis Andrew M Childs Ben W Reichardt Robert Spalek and ShengyuZhang Any AND-OR formula of size N can be evaluated in time N12+o(1) on aquantum computer In Proc 48th IEEE FOCS pages 363ndash372 2007

[Amb02] Andris Ambainis Quantum lower bounds by quantum arguments J Comput SystSci 64750ndash767 2002 Earlier version in STOCrsquo00

[Amb05] Andris Ambainis Polynomial degree and lower bounds in qu complexity Collisionand element distinctness with small range Theory of Computing 137ndash46 2005

[Amb06] Andris Ambainis Polynomial degree vs quantum query complexity J Comput SystSci 72(2)220ndash238 2006 arXivquant-ph0305028 Earlier version in Proc 44thIEEE FOCS 2003

[Amb07] Andris Ambainis A nearly optimal discrete query quantum algorithm for evaluatingNAND formulas 2007 arXiv07043628 [quant-ph]

[AS04] Scott Aaronson and Yaoyun Shi Quantum lower bounds for the collision and theelement distinctness problem J ACM 51(4)595ndash605 2004

[BB94] Maria Luisa Bonet and Samuel R Buss Size-depth tradeoffs for Boolean formulaeInformation Processing Letters 49(3)151ndash155 1994

[BBBV97] Charles H Bennett Ethan Bernstein Gilles Brassard and Umesh Vazirani Strengthsand weaknesses of quantum computing SIAM J Comput 26(5)1510ndash1523 1997arXivquant-ph9701001

[BBC+01] Robert Beals Harry Buhrman Richard Cleve Michele Mosca and Ronaldde Wolf Quantum lower bounds by polynomials J ACM 48(4)778ndash797 2001arXivquant-ph9802049

[BCdWZ99] Harry Buhrman Richard Cleve Ronald de Wolf and Christof Zalka Bounds forsmall-error and zero-error quantum algorithms 1999 arXivcs9904019 [csCC]

[BCE91] Nader H Bshouty Richard Cleve and Wayne Eberly Size-depth tradeoffs for algebraicformulae In Proc 32nd IEEE FOCS pages 334ndash341 1991

[BCW98] Harry Buhrman Richard Cleve and Avi Wigderson Quantum vs classical com-munication and computation In Proc 30th ACM STOC pages 63ndash68 1998arXivquant-ph9802040

[BS04] Howard Barnum and Michael Saks A lower bound on the quantum querycomplexity of read-once functions J Comput Syst Sci 69(2)244ndash258 2004arXivquant-ph0201007

24

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 25: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

[BSS03] Howard Barnum Michael Saks and Mario Szegedy Quantum decision trees andsemidefinite programming In Proc 18th IEEE Complexity pages 179ndash193 2003

[CNW09] Chen-Fu Chiang Daniel Nagaj and Pawl Wocjan An efficient circuit for the quantumwalk update rule 2009 arXiv09033465 [quant-ph]

[FGG07] Edward Farhi Jeffrey Goldstone and Sam Gutmann A quantum algorithm for theHamiltonian NAND tree 2007 arXivquant-ph0702144

[GR02] Lov K Grover and Terry Rudolph Creating superpositions that correspond to effi-ciently integrable probability distributions 2002 arXivquant-ph0208112

[Gro96] Lov K Grover A fast quantum mechanical algorithm for database search In Proc28th ACM STOC pages 212ndash219 1996 arXivquant-ph9605043

[Gro02] Lov K Grover Tradeoffs in the quantum search algorithm 2002arXivquant-ph0201152

[HLS05] Peter Hoslashyer Troy Lee and Robert Spalek Tight adversary bounds for compositefunctions 2005 arXivquant-ph0509067

[HLS06] Peter Hoslashyer Troy Lee and Robert Spalek Source codes of semidefinite programs forADVplusmn httpwwwucwcz~robertpapersadv 2006

[HLS07] Peter Hoslashyer Troy Lee and Robert Spalek Negative weights make adversariesstronger In Proc 39th ACM STOC pages 526ndash535 2007 arXivquant-ph0611054

[HMW03] Peter Hoslashyer Michele Mosca and Ronald de Wolf Quantum search on bounded-errorinputs In Proc 30th ICALP pages 291ndash299 2003 arXivquant-ph0304052 LNCS2719

[HNS02] Peter Hoslashyer Jan Neerbek and Yaoyun Shi Quantum complexities of orderedsearching sorting and element distinctness Algorithmica 34(4)429ndash448 2002arXivquant-ph0102078 Special issue on Quantum Computation and Cryptog-raphy

[HNW93] Rafi Heiman Ilan Newman and Avi Wigderson On read-once threshold formulae andtheir randomized decision tree complexity Theoretical Computer Science 107(1)63ndash76 1993

[HW91] Rafi Heiman and Avi Wigderson Randomized vs deterministic decision tree complex-ity for read-once boolean functions Computational Complexity 1(4)311ndash329 1991Earlier version in Structure in Complexity Theory rsquo91

[JKS03] T S Jayram Ravi Kumar and D Sivakumar Two applications of informationcomplexity In Proc 35th ACM STOC pages 673ndash682 2003

[KSV02] Alexei Yu Kitaev Alexander H Shen and Mikhail N Vyalyi Classical and QuantumComputation volume 47 of Graduate Studies in Mathematics American MathematicalSociety Providence Rhode Island 2002

25

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 26: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

[KW93] Mauricio Karchmer and Avi Wigderson On span programs In Proc 8th IEEE SympStructure in Complexity Theory pages 102ndash111 1993

[LLS06] Sophie Laplante Troy Lee and Mario Szegedy The quantum adversary method andclassical formula size lower bounds Computational Complexity 15163ndash196 2006arXivquant-ph0501057 Earlier version in Complexityrsquo05

[LM04] Sophie Laplante and Frederic Magniez Lower bounds for randomized and quantumquery complexity using Kolmogorov arguments In Proc 19th IEEE Complexity pages294ndash304 2004 arXivquant-ph0311189

[NC00] Michael A Nielsen and Isaac L Chuang Quantum computation and quantum infor-mation Cambridge University Press Cambridge 2000

[Rei09a] Ben W Reichardt Span programs and quantum query complexity The generaladversary bound is nearly tight for every boolean function 2009 arXiv09042759[quant-ph]

[Rei09b] Ben W Reichardt Faster quantum algorithm for evaluating game trees 2009arXiv09071623 [quant-ph]

[RS08] Ben W Reichardt and Robert Spalek Span-program-based quantum algorithmfor evaluating formulas In Proc 40th ACM STOC pages 103ndash112 2008arXiv07102630 [quant-ph]

[San95] Miklos Santha On the Monte Carlo decision tree complexity of read-once formulaeRandom Structures and Algorithms 6(1)75ndash87 1995 Earlier version in Proc 6thIEEE Structure in Complexity Theory 1991

[Sni85] Marc Snir Lower bounds on probabilistic linear decision trees Theoretical ComputerScience 3869ndash82 1985

[SS06] Robert Spalek and Mario Szegedy All quantum adversary methods are equivalentTheory of Computing 2(1)1ndash18 2006 arXivquant-ph0409116 Earlier version inICALPrsquo05

[SW86] Michael Saks and Avi Wigderson Probabilistic Boolean decision trees and the com-plexity of evaluating game trees In Proc 27th IEEE FOCS pages 29ndash38 1986

[Sze04] Mario Szegedy Quantum speed-up of Markov chain based algorithms In Proc 45thIEEE FOCS pages 32ndash41 2004

[Zha05] Shengyu Zhang On the power of Ambainisrsquos lower bounds Theoretical Computer Sci-ence 339(2-3)241ndash256 2005 arXivquant-ph0311060 Earlier version in ICALPrsquo04

A Spectral gap for approximately balanced AND-OR formulas

It is perhaps of interest to understand why [ACR+07] imposes the unnecessary condition thatσ+(ϕ) = O(n) The proof in [ACR+07] has two main cases an eigenvalue-zero analysis of a

26

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 27: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

certain graph and a small nonzero eigenvalue analysis of the graph The quantity σ+(ϕ) appearsonly in the small-eigenvalue analysis and not in the eigenvalue-zero analysis However [Rei09aTheorem 87] states roughly that the small-eigenvalue analysis of a span program is unnecessaryas it follows from the eigenvalue-zero analysis This provides a strong indication that the small-eigenvalue analysis in [ACR+07] is overly conservative However this conclusion is not certain tobe the case since [Rei09a Theorem 87] only shows the existence of an ldquoeffectiverdquo spectral gapbased on the eigenvalue-zero analysis whereas [ACR+07] in fact proves an actual spectral gap

In this appendix we therefore prove a stronger version of [ACR+07 Lemma 5] that doesnot depend on σ+(ϕ) This proof can be seen as an alternative more direct way of provingTheorem 111 without relying on the span program framework It confirms that the spectral gapis of the same size up to constants as the effective spectral gap from [Rei09a Theorem 87]

Replacing [ACR+07 Lemma 5] with Lemma A1 below gives an alternative proof of Theo-rem 111 We use the notation from [ACR+07]

Lemma A1 Let 0 lt E le 1(8σminus(ϕ)3N

)12 For vertices v 6= rprimeprime in T define yv by

yv =radicsv middot

σminus(v)1minus γvE2

(A1)

where γv = 4σminus(ϕ)2sv σminus(v) Then for every vertex v 6= rprimeprime in T having parent p either av = ap =0 or

and(v) = 0 rArr 0 lt (hpvap)av le yvEand(v) = 1 rArr 0 gt av(hpvap) ge minusyvE

(A2)

Proof The proof is by induction on the height of the tree Recall that hpv = (svsp)14 By [ACR+07Eq (5)] we have the equation

Eav = hpvap +sumc

hvcac (A3)

where the sum is over the children c of v By [ACR+07 Lemma 8] we may assume that v has atmost two children

For a leaf v and(v) = 0 and Eav = hpvap Thus either av = ap = 0 or

hpvapav

= E le yvE (A4)

This settles the base case of the induction argumentThe induction proceeds as follows First consider the case that av = 0 Then the induction

hypothesis implies that ac = 0 for every child c of v whether and(v) is 0 or 1 From Eq (A3) thenindeed ap = 0 Assume now that av 6= 0 Dividing Eq (A3) by av and simplifying we find

hpvapav

= E minussumc

h2vc

achvcav

(A5)

By the induction assumption we have

minusachvcav

le

ycE if and(c) = 1minus1ycE

if and(c) = 0(A6)

27

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas
Page 28: for evaluating unbalanced formulas - arXivMIN-MAX tree, also known as a two-player game tree. Unfortunately, the complexity of evaluating Unfortunately, the complexity of evaluating

Substituting this bound into Eq (A5) gives

hpvapav

le E +sum

cand(c)=1

radicscsvycE minus

sumcand(c)=0

radicscsv

1ycE

= E(

1 +sum

cand(c)=1

scradicsv

σminus(c)1minus γcE2

)minus

sumcand(c)=0

radicscsv

1ycE

le E(

maxc

11minus γcE2

)(1 +

(maxcσminus(c)

) 1radicsv

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A7)

In particular using thatsum

cand(c)=1 sc le sv and σminus(v) = 1radicsv

+ maxc σminus(c) we obtain the bound

hpvapav

le yvE minussum

cand(c)=0

radicscsv

1ycE

(A8)

Using instead γcE2 le 12 and maxc σminus(c) le σminus(ϕ) we obtain the bound

hpvapav

le 2σminus(ϕ)Eradicsv

(radicsv +

sumcand(c)=1

sc

)minus

sumcand(c)=0

radicscsv

1ycE

(A9)

We will apply both Eq (A8) and Eq (A9) belowNow we consider two cases depending on whether and(v) is 0 or 1 ie on whether c and(c) = 0

is empty or notIf and(v) = 0 then all children of v evaluate to 1 Therefore from Eq (A8) hpvapav le yvE as

claimed The induction hypothesis also gives from Eq (A5) that hpvapav ge E gt 0If and(v) = 1 then there is a child clowast with and(clowast) = 0 Using that γvE2 le 12 and

radicsvsclowastyclowastE le

yvE le 1radic

2 Eq (A8) gives hpvapav le 1radic2minusradic

2 lt 0 so ap 6= 0 We wish to argue thatminusav(hpvap) le yvE Indeed from Eq (A9) letting C = σminus(ϕ) and S1 =

sumcand(c)=1 sc

minusavhpvap

le 11q

svsclowast

yclowastEminus 2CEradic

sv(radicsv + S1)

leradicsvσminus(v)E

1minus(γclowast +

radicsvsclowastyclowast

2Cradicsv

(radicsv + S1)

)E2

(A10)

where in the second step we have multiplied numerator and denominator byradic

svsclowastyclowastE and applied

the inequality 11minusa

11minusb le

11minus(a+b) The coefficient of E2 in the denominator is bounded by

γclowast + 4C2(radicsv + S1) = 4C2(sclowastσminus(clowast) +

radicsv + S1)

le 4C2(svσminus(clowast) +radicsv)

le 4C2svσminus(v) = γv

(A11)

where we have used in the first inequality that sclowast + S1 le sv Hence minusav(hpvap) le yvE

28

  • Introduction
    • History of the formula-evaluation problem for classical algorithms
    • History of the formula-evaluation problem for quantum algorithms
    • Quantum algorithm for evaluating almost-balanced formulas
    • Quantum algorithm to evaluate approximately balanced AND-OR formulas
      • Span programs
        • Definitions
        • Quantum algorithm to evaluate a span program based on its full witness size
        • Direct-sum span program composition
          • Evaluation of almost-balanced formulas
          • Evaluation of approximately balanced AND-OR formulas
          • Open problems
          • Spectral gap for approximately balanced AND-OR formulas