Quantum Algorithm for Finding the Optimal Variable Ordering for Binary Decision Diagrams
QQuantum Algorithm for Finding the Optimal Variable Orderingfor Binary Decision Diagrams
Seiichiro TaniNTT Communication Science Laboratories, NTT Corporation. [email protected]
Abstract
An ordered binary decision diagram (OBDD) is a directed acyclic graph that represents a Booleanfunction. OBDDs are also known as special cases of oblivious read-once branching programs in thefield of complexity theory. Since OBDDs have many nice properties as data structures, they havebeen extensively studied for decades in both theoretical and practical fields, such as VLSI design,formal verification, machine learning, and combinatorial problems. Arguably, the most crucial prob-lem in using OBDDs is that they may vary exponentially in size depending on their variable ordering(i.e., the order in which the variables are to read) when they represent the same function. Indeed,it is NP hard to find an optimal variable ordering that minimizes an OBDD for a given function.Hence, numerous studies have sought heuristics to find an optimal variable ordering. From practi-cal as well as theoretical points of view, it is also important to seek algorithms that output optimalsolutions with lower (exponential) time complexity than trivial brute-force algorithms do. Friedmanand Supowit provided a clever deterministic algorithm with time/space complexity O ∗ (3 n ), where n is the number of variables of the function, which is much better than the trivial brute-force bound O ∗ ( n !2 n ). This paper shows that a further speedup is possible with quantum computers by demon-strating the existence of a quantum algorithm that produces a minimum OBDD together with thecorresponding variable ordering in O ∗ (2 . n ) time and space with an exponentially small error.Moreover, this algorithm can be adapted to constructing other minimum decision diagrams such aszero-suppressed BDDs, which provide compact representations of sparse sets and are often used inthe field of discrete optimization and enumeration. a r X i v : . [ qu a n t - ph ] F e b Introduction
Ordered binary decision diagrams.
The ordered binary decision diagram (OBDD) [Lee59, Ake78]is one of the data structures that have been most often used for decades to represent Boolean functions inpractical situations, such as VLSI design, formal verification, optimization of combinatorial problems,and machine learning, and it has been extensively studied from both theoretical and practical standpoints(see standard textbooks and surveys, e.g., Refs. [Bry92, MT98, DB98, Weg00, Knu09, Bry18]). More-over, many variants of OBDDs have been invented to more efficiently represent data with propertiesobserved frequently in specific applications (e.g., Refs. [Min93, BC95, BFG +
97, CMZ +
97, Min11]).More technically speaking, OBDDs are directed acyclic graphs that represent Boolean functions andalso known as special cases of oblivious read-once branching programs in the field of complexity the-ory. The reason for OBDDs’ popularity lies in their nice properties — they can be uniquely determinedup to the isomorphism for each function once variable ordering (i.e., the order in which to read the vari-ables) is fixed and, thanks to this property, the equivalence of functions can be checked by just testingthe isomorphism between the OBDDs representing the functions. In addition, binary operations suchas AND and OR between two functions can be performed efficiently over the OBDDs representingthose functions [Bry86]. Since these properties are essential in many applications, OBDDs have gath-ered much attention from various research fields. To enjoy these nice properties, however, we actuallyneed to address a crucial problem, which is that OBDDs may vary exponentially in size depending ontheir variable ordering. For instance, a Boolean function f ( x , . . . , x n ) = x x + x x + · · · + x n − x n has the a (2 n + x , . . . , x n ) and a 2 n + -sized OBDD for the ordering( x , x , . . . , x n − , x , x , . . . , x n ) [MT98, Sec. 8.1] (see Fig. 1 for the case where n = n ! permutations over n variables, the brute-force search requires at least n ! = Ω ( n log n ) time to find an optimal variable ordering. Indeed, finding anoptimal variable ordering for a given function is an NP hard problem.To tackle this high complexity, many heuristics have been proposed to find an optimal variableordering or a relatively good one. These heuristics work well for Boolean functions appearing in specificapplications since they are based on very insightful observations, but they do not guarantee a worst-casetime complexity lower than that achievable with the brute-force search. The only algorithm with a muchlower worst-case time complexity bound, O ∗ (3 n ) time, than the brute-force bound O ∗ ( n !2 n ) for all Boolean functions with n variables was provided by Friedman and Supowit [FS90], and that was almostthirty years ago!In practice, it is often too costly to construct a minimum OBDD and the optimal variable order-ing may change as the function changes during a procedure, say, by imposing additional constraints.Nevertheless, theoretically sound methods for finding an optimal variable ordering are worth studyingfor several reasons, such as to judge the optimization quality of heuristics and to be able to apply suchmethods at least to parts of the OBDDs within a heuristics procedure [MT98, Sec. 9.22]. Quantum Speedups of Dynamic Programming
Grover’s quantum search algorithm [Gro96] and itsvariants achieve quadratic speedups over any classical algorithm for the very fundamental problem of exhaustive search . Thus, one of the merits of the quantum search is its wide applicability. However, itdoes not immediately mean quantum speedups for all problems to which the quantum search is appli-cable, since there may exist better classical algorithms than simple exhaustive search. Indeed, quantumsearch for an optimal variable ordering of the OBDD from among n ! candidates takes approximately √ n ! ≈ n log n time, while the best classical algorithm takes only O ∗ (3 n ) = O ∗ (2 (log n ). These clas-sical algorithms often employ powerful algorithmic techniques such as dynamic programming, divide- O ∗ ( · ) hides a polynomial factor. This hidden polynomial factor can be improved [BW96, Knu09]. O ∗ (2 n ) time by aclassical dynamic programming algorithm, but locally applying the quantum search can attain at mosta polynomial-factor improvement. Recently, Ambainis et al. [ABI +
19] has introduced break-throughtechniques to speed up dynamic programming approaches. They provide quantum algorithms that solvea variety of vertex ordering problems on graphs in O ∗ (1 . n ) time, graph bandwidth in O ∗ (2 . n ) time,and TSP and minimum set cover in O ∗ (1 , n ) time, where n is the number of vertices in the graphs. In this paper, we show that quantum speedup is possible for the problem of finding an optimal variableordering of the OBDD for a given function. This is the first quantum speedup for the OBDD-relatedproblems. Our algorithms assume the quantum random access memory (QRAM) model [GLM08],which is commonly used in the literature concerned with quantum algorithms. In the model, one canread contents from or write them into quantum memory in a superposition.We provide our main result in the following theorem.
Theorem 1 (Informal)
There exists a quantum algorithm that, for a function f : { , } n → { , } givenas its truth table, produces a minimum OBDD representing f together with the corresponding variableordering in O ∗ ( γ n ) time and space with an exponentially small error with respect to n, where the constant γ is at most . . Moreover, the OBDD produced by our algorithm is always a valid one for f ,although it is not minimum with an exponentially small probability. This improves upon the classical best bound O ∗ (3 n ) [FS90] on time/space complexity. The classicalalgorithm achieving this bound is a deterministic one. However, there are no randomized algorithms thatcompute an optimal variable ordering in asymptotically less time complexity as far as we know.It may seem somewhat restricted to assume that the function f is given as its truth table, sincethere are other common representations of Boolean functions such as DNFs, CNFs, Boolean circuitsand OBDDs. However, this is not the case. Our algorithm actually works in more general settingswhere the input function f is given as any representation such that the value of f on any specifiedassignment can be computed over the representation in polynomial time in n , such as polynomial-sizeDNFs/CNFs/circuits and OBDDs of any size. This is because, in such cases, the truth table of f can beprepared in O ∗ (2 n ) time and the minimum OBDD is computable from that truth table with our algorithm.We restate Theorem 1 in a more general form as follows. Corollary 2
Let R ( f ) be any representation of a Boolean function f with n variables such that the valueof f ( x ) on any given assignment x ∈ { , } n can be computed on R ( f ) in polynomial time with respect ton. Then, there exists a quantum algorithm that, for a function f : { , } n → { , } given as R ( f ) , producesa minimum OBDD representing f together with the corresponding variable ordering in O ∗ ( γ n ) time andspace with an exponentially small error with respect to n, where the constant γ is at most . .Possible representations as R ( f ) are polynomial-size DNFs/CNFs/circuits and OBDDs of any size forfunction f . There are many variants of OBDDs, among which the zero-suppressed BDDs (ZDDs or ZBDDs)introduced by Minato [Min93] have been shown to be very powerful in dealing with combinatorialproblems (see Knuth’s famous textbook [Knu09] for how to apply ZDDs to such problems). Withjust two-line modifications, our algorithm can construct a minimum ZDD with the same time/space2 " 𝑥 𝑥 $ 𝑥 % 𝑥 & 𝑥 ’ TF 𝑥 " 𝑥 $ 𝑥 $ 𝑥 & 𝑥 & 𝑥 & 𝑥 & 𝑥 𝑥 𝑥 𝑥 𝑥 % 𝑥 % 𝑥 ’ TF 𝑉 ) 𝑉 ’ 𝑉 & 𝑉 % 𝑉 $ 𝑉 𝑉 " Figure 1: The OBDDs represent the function f ( x , x , x , x , x , x ) = x x + x x + x x under twovariable orderings: ( x , x , x , x , x , x ) (left) and ( x , x , x , x , x , x ) (right), where the solid and dot-ted arcs express 1-edges and 0-edges, respectively, and the terminal nodes for true and false are labeledwith T and F , respectively. In general, the function f ( x , . . . , x n ) = x x + x x + · · · + x n − x n has the a (2 n + x , . . . , x n ) and a 2 n + -sized OBDD for the ordering( x , x , . . . , x n − , x , x , . . . , x n ). As defined in Sec. 2.2 , for each OBDD, { V , . . . , V } is the partitionof the node set, the top node is identified with r , and the bottom two nodes are identified with t and f . Amore detailed explanation of these OBDDs is provided in Example 1 in Sec. 2.2 .complexity. We believe that similar speedups are possible for many other variants of OBDDs (adaptingour algorithm to multiterminal BDDs (MTBDDs) [BFG +
97, CMZ +
97] is almost trivial).
The first step to take is to somehow adapt the dynamic programming approach of the classical algo-rithm [FS90] (called, FS ) to the framework provided by Ambainis et al. [ABI + f over n variables: x , . . . , x n . Intuitively, FS determines the variable ordering of the minimumOBDD for f by performing dynamic programming from the variable to be read last toward that to beread first. More concretely, let ( x π [1] , . . . , x π [ n ] ) be the variable ordering from the one read last ( x π [1] )to the one read first ( x π [ n ] ), where π = ( π [1] , . . . , π [ n ]) is a permutation over [ n ] : = { , . . . , n } . For k = , . . . , n in this order, and for every subset K ⊆ [ n ] of cardinality k , the algorithm FS computesa lower bound on OBDD size when { π [1] , . . . , π [ k ] } = K from the lower bounds on OBDD size when { π [1] , . . . , π [ k − } = K \ { h } for all h ∈ K . Thus, by thinking of each node z ∈ { , } n of weight k ina Boolean hypercube as the characteristic vector of K , the algorithm FS can be seen as solving a kindof shortest path problem on a Boolean hypercube. Hence, Ambainis et al.’s framework seems appli-cable. Their results depend on the property that a large problem can be divided into the same kind ofsubproblems or, in other words, symmetric subproblems in the sense that they can be solved with thesame algorithm. This property naturally holds in many graph problems. In our case, firstly, it is unclearwhether the problem can be divided into subproblems. Secondly, subproblems would be to optimizethe ordering of variable starting from the middle variable or even from the opposite end, i.e., from thevariable to be read first , toward the one to be read last . Such subproblems cannot be solved with thealgorithm FS , and, in particular, optimizing in the latter case essentially requires the equivalence checkof subfunctions of f , which is very costly.Our technical contribution is to find, by carefully observing the unique properties of OBDDs, thatit is actually possible to even recursively divide the original problem into asymmetric subproblems, togeneralize the algorithm FS so that it can solve the subproblems, and to use the quantum minimum3nding algorithm in order to efficiently select the subproblems that essentially contribute to the optimalvariable ordering.More concretely, we show that, for any k ∈ [ n ], it is possible to divide the problem into two collec-tions of subproblems as follows: for all K ⊆ [ n ] of cardinality k , • problems of finding the ordering ( π [1] , . . . , π [ k ]) that minimizes the size of the bottom k -layers ofthe corresponding OBDD, assuming that the set { π [1] , . . . , π [ k ] } equals K , • problems of finding the ordering ( π [ k + , . . . , π [ n ]) that minimizes the size of the upper ( n − k )-layers of the corresponding OBDD, assuming that the set { π [ k + , . . . , π [ n ] } equals [ n ] \ K .Then, taking the minimum of the OBDD size over all K and k with the quantum minimum finding pro-vides a minimum OBDD and the corresponding variable ordering. To obtain a better bound, a straight-forward strategy is to consider m division points (0 < k < · · · < k m < n ) and optimize each of the( m +
1) suborderings ( π [1] , . . . , π [ k ]) , ( π [ k + , . . . , π [ k ]) , . . . , ( π [ k m + , . . . , π [ n ]). However, thismakes subproblems even more asymmetric. To deal with this asymmetry, we generalize the algorithm FS so that it can cover all the subproblems. Then, by applying it to each subproblem, we optimizethe suborderings with the quantum minimum finding so that the OBDD size is minimized. To improvethe complexity bound further, a simple idea would be to replace the generalized FS with the quantumalgorithm we have just obtained. However, the latter algorithm works only for the original problem.Thus, we generalize the quantum algorithm so that it can be applied to the asymmetric subproblems. Byrepeating this composition and generalization, we obtain the final algorithm. The studies related to minimizing OBDDs are so numerous that we cannot cover all of them. We thuspick up some of purely theoretical work.Meinel and Slobodov´a [MS94] proved that it is NP hard to construct an optimal OBDD for a Booleanfunction given by a logical circuit, a DNF, a CNF, or an OBDD, even if the optimal OBDD is of constantsize. Tani, Hamaguchi and Yajima [THY96] proved that it is NP hard to improve the variable ordering(and thus, to find an optimal variable ordering) for a given multi -rooted OBDD, where the NP hardnessis proved by a reduction from Optimal Linear Arrangement [GJ79]. Bollig and Wegener [BW96] finallyproved the NP hardness for a given single -rooted OBDD. This is still true if the input function is re-stricted to monotone functions [INY98]. Minimizing the width of an OBDD is also NP hard [Bol16].As for approximation hardness, Sieling [Sie02a, Sie02b] proved that if there exists a polynomial-timeapproximation scheme for computing the size of the minimum OBDD for a given OBDD, it then holdsthat NP = P.It would be nice if, for every function, there exists at least one variable ordering under which theOBDD for the function is of a size bounded by a polynomial. As one may expect, this is not the case.It can be proved by a counting argument that there exists a function for which the OBDD size growsexponentially in the number of variables under any variable ordering [Lee59, HC92, HM94]. Examplesof such functions include practical ones such as the multiplication function [Bry91], a threshold func-tion [HTKY97], and the division function [HY97]. The sizes of OBDDs for several classes of Booleanfunctions are investigated [STY94, Hea93, HM00]. The OBDD size is also studied from the viewpointof computational learning and knowledge-bases [TY00, HI02].In applying OBDDs to graph problems, it is possible to find variable orderings for which OBDD sizeis nontrivially upper-bounded in terms of certain measures characterizing graph structures [TI94, SIT95].A similar concept was discoved for ZDDs [Min93] by Knuth [Knu09]. This concept is now called the frontier method , and lots of work is based on it. 4
Preliminaries
Let N , Z and R be the sets of natural numbers, integers, and real numbers, respectively. For each n ∈ N ,let [ n ] be the set { , . . . , n } , and S n be the permutation group over [ n ]. We may denote a singleton set { k } by k for notational simplicity if it is clear from the context; for instance, I \ { k } may be denoted by I \ k ,if we know I is a set. For any subset I ⊆ [ n ], let Π n ( I ) be the set of π ∈ S n such that the first | I | members { π [1] , . . . , π [ | I | ] } constitutes I , i.e., Π n ( I ) : = { π ∈ S n : { π [1] , . . . , π [ | I | ] } = I } ⊆ S n . For simplicity, we omit the subscript n and write Π ( I ). More generally, for any two disjoint subsets I , J ⊆ [ n ], let Π n ( (cid:104) I , J (cid:105) ) : = { π ∈ S n : { π [1] , . . . , π [ | I | ] } = I , { π [ | I | + , . . . , π [ | I | + | J | ] } = J } ⊆ S n . For any disjoint subsets I , . . . , I m ⊆ [ n ] for m ∈ [ n ], Π n ( (cid:104) I , . . . , I m (cid:105) ) is defined similarly. For simplicity,we may denote (cid:104) I (cid:105) by I , if it is clear from the context.We denote the union operation over disjoint sets by (cid:116) (instead of ∪ ) when we emphasize the disjoint-ness of the sets. For example, the union of the disjoint sets { , } and { , } is denoted by { , } (cid:116) { , } .For n Boolean variables x , . . . , x n , any set I ⊆ [ n ], and any vector b = ( b , . . . , b | I | ) ∈ { , } | I | , x I denotes the ordered set ( x j , . . . , x j | I | ), where { j , . . . , j | I | } = I and j < · · · < j | I | , and x I = b denotes x j i = b i for each i = [ | I | ]. For any Boolean function f : { , } n → { , } with variables x , . . . , x n , wedenote by f | x I = b the function obtained by restricting f with x I = b . If I is a singleton set, say, I = { i } , wemay write x i and f | x i = b to mean x { i } and f | x { i } = b , respectively, for notational simplicity. We say that g is a subfunction of f if g is equivalent to the function f | x I = b for some I ⊆ [ n ] and b ∈ { , } | I | .For any function g ( n ) in n , we use the notation O ∗ ( g ( n )) to hide a polynomial factor in n . Forinstance, n n and 2 n are both in O ∗ (2 n ). We further denote X = O ∗ ( Y ) by X (cid:47) Y .We use the following upper bound many times in this paper. For n ∈ N and k ∈ [ n ] ∪ { } , it holds that (cid:16) nk (cid:17) ≤ n H ( k / n ) , where H ( · ) represents the binary entropy function H ( δ ) : = − δ log δ − (1 − δ ) log (1 − δ ). This subsection briefly introduces ordered binary decision diagrams (OBDDs). For interested readers,see standard textbooks and survey papers (e.g., Refs. [Bry92, MT98, DB98, Weg00, Bry18]).OBDDs are a special case of read-once oblivious branching programs in complexity-theoretic termsthat is, branching programs that satisfy the following conditions: each variable is read at most once oneach directed path from the root to a terminal node, and the orderings of variables to be read on all suchpaths are consistent with a certain fixed ordering.In the following, we formally define OBDDs in graph-theoretic terms and provide several notations.For any Boolean function f : { , } n → { , } over variables x , . . . , x n and any permutation π ∈ S n (called a variable ordering ), an OBDD B ( f , π ) is a directed acyclic graph G ( V , E ) defined as follows:1. The node set V is the union of two disjoint sets N and T of non-terminal nodes with out-degreetwo and terminal nodes with out-degree zero, respectively, where T contains exactly two nodes: T = { f , t } . The set N contains a unique source node r , called the root .2. B ( f , π ) is a leveled graph with n + n subsets: V : = V (cid:116) V (cid:116) · · · (cid:116) V n , where V n = { r } and V = T = { t , f } , such that each directed edge ( u , v ) ∈ E is in V i × V j for a pair ( i , j ) ∈ [ n ] × ( { } (cid:116) [ n − i > j . For each i ∈ [ n ], subset V i (called the level i ) is associated with the variable x π [ i ] , or alternatively, each node in V i is labeled with x π [ i ] . For convenience, we define a map var : N → [ n ] such that if v ∈ V i then var = π [ i ]. In the standard definition, V i is associated with the variable x π [ n − i ] . Our definition follows the one given in [FS90] to avoidcomplicated subscripts of variables. " 𝑥 " remove 𝑥 " 𝑥 " 𝑥 " 𝑥 " 𝑥 " remove 𝑥 " 𝑥 " 𝑥 " Redundant node Equivalent nodes
Figure 2: Examples of a redundant node (left) and equivalent nodes (right), and their removal rules,where the solid and dotted arcs express 1-edges and 0-edges, respectively,3. The two edges emanating from every non-terminal node v are called the 0 -edge and the 1 -edge ,which are labeled with 0 and 1, respectively. For every u ∈ N , let u and u be the destinations ofthe 0-edge and 1-edge of u , respectively.4. Let F ( f ) be the set of all subfunctions of f . Define a bijective map F : V → F ( f ) as follows:(a) F ( r ) = f for r ∈ V n ; (b) F ( t ) = true and F ( f ) = false for t , f ∈ V ; (c) For every u ∈ N and b ∈ { , } , F ( u b ) is the subfunction obtained from F ( u ) by substituting x var ( u ) with b , i.e., F ( u b ) = F ( u ) | x var ( u ) = b .5. B ( f , π ) must be minimal in the sense that the following reduction rules cannot be applied. In otherwords, B ( f , π ) is obtained by maximally applying the following rules (Fig. 2):(a) if there exists a redundant node u ∈ N , then remove u and its outgoing edges, and redirectall the incoming edges of u to u , where a node u is redundant if u is the same node as u .(b) if there exist equivalent nodes { u , v } ⊂ N , then remove v (i.e., any one of them) and itsoutgoing edges, and redirect all incoming edges of v to u , where u and v are equivalent if (1) var ( u ) is equal to var ( v ), and (2) u and u are the same nodes as v and v , respectively. Example 1
For ease of understanding the above notations, let us consider the OBDD on the right sidein Fig. 1. The root r is the uppermost node labeled with x . The ordering π is (1 , , , , , . Every nodein V i ( i = , . . . , is represented by a circle labeled with x π [ i ] . For instance, V consists of all the fournodes labeled with x . For each node v ∈ V , it holds that var ( v ) = . Let u be the left node labeled withx . Since the path from r to u consists of three edges labeled with , , and in this order from the rootside, F ( u ) is represented as F ( r ) | x = , x = , x = = f | x = , x = , x = = x . For each j ∈ [ n ], Cost j ( f , π ) denotes the width at the level associated with the variable x j , namely,the number of nodes in the level π − [ j ] (Fig. 3). For I ⊆ [ n ], let π I be a permutation π in Π ( I ) thatminimizes the number of nodes in level 1 to level | I | : π I : = arg min | I | (cid:88) j = Cost π [ j ] ( f , π ) : π ∈ Π ( I ) . (1)Note that (cid:80) | I | j = Cost π [ j ] ( f , π ) = (cid:80) i ∈ I Cost i ( f , π ) for π ∈ Π ( I ). More generally, for disjoint subsets I , . . . , I m ⊆ [ n ], π (cid:104) I ,..., I m (cid:105) is a permutation in Π ( (cid:104) I , . . . , I m (cid:105) ) that minimizes the number of the nodes inlevel 1 to level | I | + · · · + | I m | over all π ∈ Π ( (cid:104) I , . . . , I m (cid:105) ): π (cid:104) I ,..., I m (cid:105) : = arg min | I | + ··· + | I m | (cid:88) j = Cost π [ j ] ( f , π ) : π ∈ Π ( (cid:104) I , . . . , I m (cid:105) ) . (2)6 TF 𝑥 " 𝑥 " 𝑥 " 𝑥 " 𝑓𝑉 % 𝜋 𝑘 = 𝑗 = Cost . % 𝑓, 𝜋Cost " 𝑓, 𝜋 Figure 3: Schematic expression of
Cost j ( f , π )Note that min (cid:80) | I | + ··· + | I m | j = Cost π [ j ] ( f , π ) = (cid:80) i ∈ I (cid:116)···(cid:116) I m Cost i ( f , π ) for any π ∈ Π ( (cid:104) I , . . . , I m (cid:105) ). The follow-ing well-known lemma captures the essential property of OBDDs. It states that the number of nodes atlevel i ∈ [ n ] is constant over all π , provided that the two sets { π [1] , . . . , π [ i − } and { π [ i + , . . . , π [ n ] } are fixed. Lemma 3 ([FS90])
For any non-empty subset I ⊆ [ n ] and any i ∈ I, there exists a constant c f such that,for each π ∈ Π ( (cid:104) I \ { i } , { i }(cid:105) ) , Cost π [ | I | ] ( f , π ) ≡ Cost i ( f , π ) = c f . For convenience, we define shorthand for the minimums of the sums in Eqs. (1) and (2). For I (cid:48) ⊆ I ⊆ [ n ], MINCOST I [ I (cid:48) ] is defined as the number of nodes in the levels associated with variables indexedby elements in I (cid:48) under permutation π I , namely, MINCOST I [ I (cid:48) ] : = (cid:80) i ∈ I (cid:48) Cost i ( f , π I ) . More generally, fordisjoint subsets I , . . . , I m ⊆ [ n ] and I (cid:48) ⊆ I (cid:116) · · · (cid:116) I m , MINCOST (cid:104) I ,..., I m (cid:105) [ I (cid:48) ] : = (cid:88) i ∈ I (cid:48) Cost i ( f , π (cid:104) I ,..., I m (cid:105) ) . As a special case, we denote
MINCOST (cid:104) I ,..., I m (cid:105) [ I (cid:116) · · · (cid:116) I m ] by MINCOST (cid:104) I ,..., I m (cid:105) . We define MINCOST ∅ as 0. This subsection reviews the algorithm by Friedman and Supowit [FS90]. We will generalize their idealater and heavily use the generalized form in our quantum algorithm. Hereafter, we call their algorithm FS . The following lemma is the basis of the dynamic programming approach used in the algorithm.
Lemma 4
For any non-empty subset I ⊆ [ n ] and any Boolean function f : { , } n → { , } , the followingholds: MINCOST I = min k ∈ I (cid:0) MINCOST I \ k + Cost k ( f , π (cid:104) I \ k , k (cid:105) ) (cid:1) = min k ∈ I (cid:0) MINCOST (cid:104) I \ k , k (cid:105) (cid:1) . The proof is given in Appendix A.Before sketching algorithm FS , we provide several definitions. For any I ⊆ [ n ], TABLE I is an arraywith 2 n −| I | cells each of which stores a non-negative integer. Intuitively, for b ∈ { , } n −| I | , the cell TABLE I [ b ] stores (the pointer to) the unique node of B ( f , π I ) associated via F with function f | x [ n ] \ I = b .Hence, we may write TABLE I [ x [ n ] \ I = b ] instead of TABLE I [ b ] to clearly indicate the value assigned toeach variable x j for j ∈ [ n ] \ I . The purpose of TABLE I is to relate all subfunctions f | x [ n ] \ I = b ( b ∈ { , } n −| I | )7 TF 𝑥 " 𝑥 " 𝑥 " 𝑥 " 𝑓 Cost " 𝑓, 𝜋 = Cost " 𝑓, 𝜋 + 𝜋 1𝜋 𝐼 − 1⋮𝜋 𝐼𝜋 𝐼 + 1⋮𝜋 𝑛 a TF 𝑥 " 𝑥 " 𝑥 " 𝑥 " 𝑓 𝜋 + + 𝐼 − 1⋮𝜋 + 𝐼𝜋 + 𝐼 + 1⋮𝜋 + 𝑛𝐼 𝐼𝑖 = = 𝑖 Figure 4: Schematic expression of Lemma 3: For any two permutations π, π (cid:48) ∈ S n such that { π [1] , . . . , π [ | I | − } = { π (cid:48) [1] , . . . , π (cid:48) [ | I | − } and π [ | I | ] = π (cid:48) [ | I | ], it holds that the number of nodeslabeled with x i is equal to that of nodes labeled with x i , where it is assumed that π [ | I | ] = π (cid:48) [ | I | ].to the corresponding nodes of B ( f , π I ). We assume without loss of generality that the pointers to nodesof B ( f , π I ) are non-negative integers and, in particular, those to the two terminal nodes corresponding to false and true are the integers 0 and 1, respectively. Thus, TABLE ∅ is merely the truth table of f .Algorithm FS computes TABLE I together with π I , MINCOST I , and another data structure, NODE I for all I ⊆ [ n ], starting from TABLE ∅ via dynamic programming. NODE I is the set of all triples of (thepointers to) nodes, ( u , u , u ) ∈ N × ( N (cid:116) T ) × ( N (cid:116) T ), in B ( f , π I ), where var ( u ) = π I [ | I | ], and ( u , u ) and( u , u ) are the 0-edge and 1-edge of u , respectively. Thus, NODE I contains the structure of the subgraph of B ( f , π I ) induced by V | I | . The purpose of the NODE I is to prevent the algorithm from duplicating existingnodes, i.e., creating nodes associated with the same subfunctions as those with which the existing nodesare associated. By the definition, NODE ∅ is the empty set. We assume that NODE I is implemented with anappropriate data structure, such as a balanced tree, so that the time complexity required for membershiptesting and insertion is the order of logarithm in the number of triples stored in NODE I . An example of TABLE I and NODE I is shown in Fig. 5.More generally, for disjoint subset I , . . . , I m ⊆ [ n ], TABLE (cid:104) I ,..., I m (cid:105) is an array with 2 n −| I (cid:116)···(cid:116) I m | cellssuch that, for b ∈ { , } n −| I (cid:116)···(cid:116) I m | , TABLE (cid:104) I ,..., I m (cid:105) [ b ] stores the nodes of B ( f , π (cid:104) I ,..., I m (cid:105) ) associated with thefunction f | x [ n ] \ I (cid:116)···(cid:116) Im = b . NODE (cid:104) I ,..., I m (cid:105) is defined similarly for B ( f , π (cid:104) I ,..., I m (cid:105) ). For simplicity, we hereafterdenote by F S ( (cid:104) I , . . . , I m (cid:105) ) the quadruplet ( π (cid:104) I ,..., I m (cid:105) , MINCOST (cid:104) I ,..., I m (cid:105) , TABLE (cid:104) I ,..., I m (cid:105) , NODE (cid:104) I ,..., I m (cid:105) ). FS [FS90] Algorithm FS performs the following operations for k = , . . . , n in this order. For each k -elementsubset I ⊆ [ n ], compute F S ( (cid:104) I \ i , i (cid:105) ) from F S ( (cid:104) I \ i (cid:105) ) for each i ∈ I in the manner described later (notethat, since the cardinality of the set I \ i is k − F S ( (cid:104) I \ i (cid:105) ) has already been computed). Then set F S ( I ) ←− F S ( (cid:104) I \ i ∗ , i ∗ (cid:105) ) , where i ∗ is the index i ∈ I that minimizes MINCOST (cid:104) I \ i , i (cid:105) , implying that π I is π (cid:104) I \ i ∗ , i ∗ (cid:105) . This is justified by Lemma 4. A schematic view of the algorithm is shown in Fig. 6.To compute F S ( (cid:104) I \ i , i (cid:105) ) from F S ( (cid:104) I \ i (cid:105) ), do the following. First set NODE (cid:104) I \ i , i (cid:105) ← ∅ and MINCOST (cid:104) I \ i , i (cid:105) ← MINCOST I \ i as their initial values. Then, for each b ∈ { , } n −| I | , set u ← TABLE I \ i [ x [ n ] \ I = b , x i = , u ← TABLE I \ i [ x [ n ] \ I = b , x i = . If u = u , then store u in TABLE (cid:104) I \ i , i (cid:105) [ b ]. Otherwise, test whether ( u , u , u ) for some u is a mem-ber of NODE I \ i . If it is, store u in the TABLE (cid:104) I \ i , i (cid:105) [ b ]; otherwise create a new triple ( u (cid:48) , u , u ), insertit to NODE (cid:104) I \ i , i (cid:105) and increment MINCOST (cid:104) I \ i , i (cid:105) . Since u (cid:48) is the pointer to the new node, u (cid:48) must be dif-ferent from any pointer already included in NODE (cid:104) I \ i , i (cid:105) and from any pointer to a node in V (cid:116) · · · (cid:116) 𝑛] − 𝐼𝑥 ’ 𝑥 ( 𝑥 ( 𝑥 ) 𝑥 ) 𝑥 ) 𝑥 ) 𝑥 * 𝑥 * 𝑥 * 𝑥 * 𝑥 + 𝑥 + 𝑥 , TF 𝐼0 13 4 25 6 7 8𝑢 𝑢 𝑢 NODE = 𝑥 ’ 𝑥 ( 𝑥 ) pointer000 0001 2010 3011 4100 6101 7110 5111 8 Table = 𝐼 = {1,3,5} 𝜋 = = (1,3,5,2,4,6) Figure 5: An example of data structure used in Algorithm FS . TABLE I and NODE I for the OBDD (rhs)are shown, where the pointers (integers) to the nodes labeled with x , x , x are each shown at the top-leftpositions of the nodes. V k − in B ( f , π (cid:104) I \ i (cid:105) ), where k = | I | . Such u (cid:48) can be easily chosen by setting u (cid:48) to two plus the valueof MINCOST (cid:104) I \ i , i (cid:105) before the increment, since the MINCOST (cid:104) I \ i , i (cid:105) is exactly the number of triples in NODE (cid:104) I \ i , i (cid:105) plus | V (cid:116) · · · (cid:116) V k − | , and the numbers 0 and 1 are reserved for the terminal nodes. Wecall the above procedure table folding with respect to x i , because it halves the size of TABLE (cid:104) I \ i (cid:105) . Wealso mean it by “folding TABLE (cid:104) I \ i (cid:105) with respect to x i ”.The complexity analysis is fairly simple. For each k , we need to compute F S ( I ) for (cid:16) nk (cid:17) possible I ’s with | I | = k . For each I , it takes O ∗ (2 n − k ) time since the the size of TABLE I \ i is 2 n − k + and eachoperation to NODE I \ i takes a polynomial time in n . Thus, the total time is (cid:80) nk = n − k (cid:16) nk (cid:17) = n , up to apolynomial factor. The point is that computing each F S ( I ) takes time linear to the size of TABLE I \ i upto a polynomial factor. The space required by Algorithm FS during the process for k is dominated bythat for TABLE I , TABLE I \ i and NODE I for all I and i ∈ I , which is O ∗ (cid:16) n − k (cid:16) nk (cid:17)(cid:17) . The space complexity isthus O ∗ (cid:16) max k ∈{ }∪ [ n ] n − k (cid:16) nk (cid:17)(cid:17) = O ∗ (3 n ). Theorem 5 (Friedman and Supowit [FS90])
Suppose that the truth table of f : { , } n → { , } isgiven as input. Algorithm FS produces F S ([ n ]) in O ∗ (3 n ) time and space. We assume that readers have a basic knowledge of quantum computing (e.g., Refs. [NC00, KSV02,KLM07]). We provide only a lemma used to obtain our results.The quantum search algorithm discovered by Grover [Gro96] has been generalized in many ways.For instance, Buhrman et al. [BCdWZ99] provided a small error version of quantum search, while D¨urr9 " Each dot corresponds to a subset of size %%% − 1 ( ∗ = argmin mincost ⟨8∖:, ⟩: > ? = > ⟨?∖1 ∗ , ⟩1 ∗ Figure 6: Schematic view of Friedman-Supowit Algorithm. The algorithm goes from the left to theright. On the vertical line indicated by k , there are (cid:16) nk (cid:17) dots, each of which corresponds to a subset I ⊆ [ n ]of size k (or, more strictly speaking, F S ( I )). FS ( I ) is computed from the collection of F S ( (cid:104) I \ i (cid:105) ) overall i ∈ I , which are arranged as dots on the line indicated by k − Lemma 6 (Quantum Minimum Finding [DH96, BCdWZ99, LGM18])
For every ε > there existsa quantum algorithm that, for a function f : [ N ] → Z given as an oracle, find an element x ∈ [ N ] atwhich f ( x ) achieves the minimum, with error probability at most ε by making O ( (cid:112) N log(1 /ε )) queries. In this paper, the search space N is exponentially large in n and we are interested in exponential com-plexities, ignoring polynomial factors in them. We can thus safely assume ε = / p ( n ) for a polynomial p ( n ), so that the overhead is polynomially bounded. Since our algorithms use Lemma 6 constant times,their overall error probabilities are exponentially small. In the following proofs, we thus assume that ε is exponentially small whenever we use Lemma 6, and do not explicitly analyze the error probability forsimplicity.Our algorithms assume that the quantum random access memory (QRAM) model [GLM08], whichis commonly used in the literature when considering quantum algorithms. In the model, one can readcontents from or write them into quantum memory in a superposition. We generalize Lemma 4 and Theorem 5 and use them in our quantum algorithm.
Lemma 7
For any disjoint subsets I , . . . , I m , J ⊆ [ n ] with J (cid:44) ∅ and any Boolean function f : { , } n →{ , } , the following holds: MINCOST (cid:104) I ,..., I m , J (cid:105) = min k ∈ J (cid:0) MINCOST (cid:104) I ,..., I m , J \{ k }(cid:105) + Cost k ( f , π (cid:104) I ,..., I m , J \{ k } , { k }(cid:105) ) (cid:1) = min k ∈ J (cid:0) MINCOST (cid:104) I ,..., I m , J \{ k } , { k }(cid:105) (cid:1) . The proof of this lemma is very similar to that of Lemma 4 and deferred to Appendix A. Based onLemma 7, we generalize Theorem 5 to obtain algorithm FS ∗ (its pseudo code is given in Appendix D).Recall that F S ( (cid:104) I , . . . , I m (cid:105) ) denotes the quadruplet ( π (cid:104) I ,..., I m (cid:105) , MINCOST (cid:104) I ,..., I m (cid:105) , TABLE (cid:104) I ,..., I m (cid:105) , NODE (cid:104) I ,..., I m (cid:105) ).A schematic view of FS ∗ is shown in Fig. 7. 10 emma There is a deterministic algorithm FS* that, given the partial OBDD for ! " and , produces the partial OBDD for ! "⊔) in time * ∗ -. " . ) ) time/space. ∅ %1 1 ⊔ Figure 7: Schematic view of FS ∗ . This view corresponds to the case where m = J ⊂ [ n ] \ I inLemma 8. The shaded area is the one that FS ∗ sweeps to produce F S ( (cid:104) I , J (cid:105) ). Lemma 8 (Classical Composition Lemma)
For disjoint subsets I , . . . , I m , J ⊆ [ n ] with J (cid:44) ∅ , thereexists a deterministic algorithm FS ∗ that produces F S ( (cid:104) I , . . . , I m , J (cid:105) ) from F S ( (cid:104) I , . . . , I m (cid:105) ) for an un-derlying function f : { , } n → { , } in O ∗ (cid:16) n −| I (cid:116)···(cid:116) I m (cid:116) J | · | J | (cid:17) time and space. More generally, for eachk ∈ [ | J | ] , the algorithm produces the set {F S ( (cid:104) I , . . . , I m , K (cid:105) ) : K ⊆ J , | K | = k } from F S ( (cid:104) I , . . . , I m (cid:105) ) inO ∗ (cid:16) n −| I (cid:116)···(cid:116) I m (cid:116) J | (cid:80) kj = | J |− j (cid:16) | J | j (cid:17)(cid:17) time and space. Note that if I (cid:116) · · · (cid:116) I m = ∅ and J = [ n ], then we obtain Theorem 5. Proof.
We focuses on the simplest case of m =
1, for which our goal is to show an algorithm thatproduces
F S ( (cid:104) I , J (cid:105) ) from F S ( I ). It is straightforward to generalize the proof to the case of m ≥ F S ( I ), the algorithm first folds TABLE I with respect to each variable in { x j : j ∈ J } toobtain F S ( (cid:104) I , j (cid:105) ) for every j ∈ J , then fold TABLE (cid:104) I , j (cid:105) with respect to x j and TABLE (cid:104) I , j (cid:105) with respectto x j to obtain F S ( (cid:104) I , { j , j }(cid:105) ) by taking the minimum of MINCOST (cid:104) I , j , j (cid:105) and MINCOST (cid:104) I , j , j (cid:105) forevery j , j ∈ J , and repeat this to finally obtain F S ( (cid:104) I , J (cid:105) ). This algorithms is justified by Lemma 7.The details of algorithm FS ∗ are shown in Appendix D. For each j ∈ [ | J | ], K ⊆ J with | K | = j , and h ∈ K ,the time complexity of computing F S ( (cid:104) I , K (cid:105) ) from F S ( (cid:104) I , K − h (cid:105) ) is linear to the size of TABLE (cid:104) I , K (cid:105) ,i.e., 2 n −| I |− j , up to a polynomial factor. The total time is thus, up to a polynomial factor, | J | (cid:88) j = n −| I |− j (cid:32) | J | j (cid:33) < n −| I |−| J | | J | (cid:88) j = | J |− j (cid:32) | J | j (cid:33) = n −| I (cid:116) J | · | J | . If we stop the algorithm at j = k , then the algorithm produces the set {F S ( (cid:104) I , K (cid:105) ) : K ⊆ J , | K | = k } .The time complexity in this case is at most 2 n −| I |−| J | (cid:80) kj = | J |− j (cid:16) | J | j (cid:17) , up to a polynomial factor.Since the space complexity is trivially upper-bounded by the time complexity, we complete theproof. (cid:3) Remark 1
One may think that the actual space complexity could be much less than the time complexity.However, this is not the case. The size of
TABLE (cid:104) I , K (cid:105) is also the dominant factor determining the spacecomplexity. When computing TABLE (cid:104) I , K (cid:105) with | K | = j, it suffices to keep TABLE (cid:104) I , K (cid:105) and TABLE (cid:104) I , K − h (cid:105) for every h ∈ K in memory. The space complexity is thus, up to a polynomial factor, the maximum of n −| I |− j (cid:16) | J | j (cid:17) + n −| I |− ( j − (cid:16) | J | j − (cid:17) over all j ∈ [ | J | ] , which is the same order as the time complexity. emark 2 It is not difficult to see that the algorithm FS ∗ works even when the function f has a multival-ued function: f : { , } n → Z . The only difference from the Boolean case is that the truth table maps eachBoolean assignment to a value in Z . In this case, the algorithm produces a variant of an OBDD (calleda multi-terminal BDD, MTBDD) of minimum size. In addition, our algorithm with two-line modifica-tions to the table folding rule in FS ∗ can construct a minimum zero-suppressed BDD (ZDD) [Min93]for a given Boolean function. The details are described in Appendix D. These modifications are alsopossible for the quantum algorithms described later, since they perform table folding by running FS ∗ asa subroutine. The following theorem is the basis of our quantum algorithms.
Lemma 9 (Divide-and-Conquer)
For any disjoint subsets I , . . . , I m , J ⊆ [ n ] with J (cid:44) ∅ and any k ∈ [ | J | ] , it holds that MINCOST (cid:104) I ,..., I m , J (cid:105) [ J ] = min K : K ⊆ J , | K | = k (cid:0) MINCOST (cid:104) I ,..., I m , K (cid:105) [ K ] + MINCOST (cid:104) I ,..., I m , K , J \ K (cid:105) [ J \ K ] (cid:1) . (3) In particular, when I (cid:116) · · · (cid:116) I m = ∅ and J = [ n ] , it holds that MINCOST [ n ] = min K ⊆ [ n ] , | K | = k (cid:0) MINCOST K + MINCOST (cid:104) K , [ n ] \ K (cid:105) [[ n ] \ K ] (cid:1) . (4) Proof.
We first prove the special case of I (cid:116) · · · (cid:116) I m = ∅ and J = [ n ]. By the definition, we have MINCOST [ n ] = n (cid:88) j = Cost π [ j ] ( f , π ) = k (cid:88) j = Cost π [ j ] ( f , π ) + n (cid:88) j = k + Cost π [ j ] ( f , π ) , for the optimal permutation π = π [ n ] . Let K = { π [1] , . . . , π [ k ] } . By Lemma 3, the first sum is independentof how π maps { k + , . . . , n } to [ n ] \ K . Thus, it is equal to the minimum of (cid:80) kj = Cost π [ j ] ( f , π ) over all π ∈ Π ( K ), i.e., MINCOST K . Similarly, the second sum is independent of how π maps [ k ] to K . Thus, it isequal to the minimum of (cid:80) nj = k + Cost π [ j ] ( f , π ) over all π ∈ Π ( (cid:104) K , [ n ] \ K (cid:105) ), i.e., MINCOST (cid:104) K , [ n ] \ K (cid:105) [[ n ] \ K ]. This completes the proof of Eq. (4).We can generalize this in a straightforward manner. Let π = π (cid:104) I ,..., I m , J (cid:105) and (cid:96) = | I (cid:116) · · · (cid:116) I m | . Then,we have MINCOST (cid:104) I ,..., I m , J (cid:105) [ J ] = k (cid:88) j = Cost π [ (cid:96) + j ] ( f , π ) + | J | (cid:88) j = k + Cost π [ (cid:96) + j ] ( f , π ) . By defining K : = { π [ (cid:96) + , . . . , π [ (cid:96) + k ] } , the same argument as the special case of (cid:96) = MINCOST (cid:104) I ,..., I m , K (cid:105) [ K ] and MINCOST (cid:104) I ,..., I m , K , J \ K (cid:105) [ J \ K ], respectively. Thiscompletes the proof of Eq. (3). (cid:3) A schematic view of the above lemma is shown in Fig. 8.
We provide simple quantum algorithms on the basis of Lemma 9. The lemma states that, for any k ∈ [ n ], MINCOST [ n ] is the minimum of MINCOST K + MINCOST (cid:104) K , [ n ] \ K (cid:105) [[ n ] \ K ] over all K ⊆ [ n ] with | K | = k . Tofind K from among (cid:16) nk (cid:17) possibilities that minimizes this amount, we use the quantum minimum finding(Lemma 6). To compute MINCOST K + MINCOST (cid:104) K , [ n ] \ K (cid:105) [[ n ] \ K ] = MINCOST (cid:104) K , [ n ] \ K (cid:105) , it suffices tofirst compute F S ( K ) (including MINCOST K ), and then F S ( (cid:104) K , [ n ] \ K (cid:105) ) (including MINCOST (cid:104) K , [ n ] \ K (cid:105) )from F S ( K ). The time complexity for computing F S ( K ) from F S ( ∅ ) is O ∗ (2 n − k k ) by Lemma 8 with I (cid:116) · · · (cid:116) I m = ∅ and J = K , while that for computing F S ( (cid:104) K , [ n ] \ K (cid:105) ) from F S ( K ) is O ∗ (3 n − k ) byLemma 8 with m = I = K , and J = [ n ] \ K . Thus, the time complexity for computing F S ( (cid:104) K , [ n ] \ K (cid:105) )12 " This corresponds to . | Output ' (, * ∖(' * = ' -, * ∖- such that K achieves the minimum of mincost
6, 7 ∖6
Figure 8: Schematic view of Eq. (4) in Lemma 9. Intuitively, the lemma says that it is possible todecompose FS ∗ into the parts each of which goes through the dot corresponding to a subset I ⊆ [ n ] ofsome fixed size, and the optimal variable ordering is induced by one of the parts.from F S ( ∅ ) is O ∗ (2 n − k k + n − k ). Thus, for k = α n with α ∈ (0 ,
1) fixed later, the total time complexityup to a polynomial factor is T ( n ) = (cid:115)(cid:32) n α n (cid:33) (cid:16) (1 − α ) n α n + (1 − α ) n (cid:17) ≤ H ( α ) n (cid:110) [(1 − α ) + α log n + [(1 − α ) log n (cid:111) . To balance the both terms, we set (1 − α ) + α log = (1 − α ) log α = α ∗ , where α ∗ = log −
12 log − ≈ . . We have min α ∈ [0 , T ( n ) = O (cid:16) H ( α ∗ ) n + (1 − α ∗ ) n + α ∗ (log n (cid:17) = O ( γ n ) , where γ = . . . . . This slightly improves the classical best bound O ∗ (3 n ) on the time complexity. To improvethe bound further, we introduce a preprocess that classically computes F S ( K ) for every K with | K | = α n ( α ∈ (0 , ∗ . By Lemma 7, the preprocessing time is then α n (cid:88) j = n − j · (cid:32) nj (cid:33) ≤ α n · max j ∈ [ α n ] n − j (cid:32) nj (cid:33) (cid:47) (cid:40) (1 − α ) n + H ( α ) n ( α < / n + H (1 / n ( α ≥ / , (5)since 2 n − j (cid:16) nj (cid:17) increases when j < n / F S ( K ) for free and assume that the cost for accessing F S ( K ) is polynomiallybounded for all K ⊆ [ n ] with | K | = α n .Then, assuming that α < /
3, the total time complexity up to a polynomial factor is T ( n ) = α n (cid:88) j = n − j · (cid:32) nj (cid:33) + (cid:115)(cid:32) n α n (cid:33) (cid:16) n O (1) + (1 − α ) n (cid:17) (cid:47) [(1 − α ) + H ( α )] n + [ H ( α ) + (1 − α ) log n . To balance the both terms, we set (1 − α ) + H ( α ) = H ( α ) + (1 − α ) log α = α ∗ , where α ∗ : = . . . . , which is less than 1 / α = α ∗ , we have T ( n ) (cid:47) [(1 − α ∗ ) + H ( α ∗ )] n = O ∗ ( γ n ) , where γ is at most 2 . < γ ). Thus, introducing the preprocessimproves the complexity bound. A schematic view of the above algorithm is shown in Fig. 9.Appendix B shows that, by using Lemma 9 twice, we have a better complexity bound O ∗ ( γ n ), where γ is at most 2 . < γ ). 13 𝑛𝑘 Quantumly find the minimum
FS*Computed by classical preprocess (truncation of FS*)
Figure 9: Schematic view of our algorithm in the simplest case (one-parameter case). The dotted areais computed in the classical preprocess, which is realized by truncating the process of FS ∗ as stated inLemma 8. The shaded area is computed by using FS ∗ . The actual algorithm runs the quantum minimumfinding, which calls FS ∗ to coherently compute the shaded area corresponding to every dot on the verticalline indicated by k . We can improve this bound further by applying Lemma 9 k times. We denote the resulting algorithmwith parameters k and α : = ( α , . . . , α k ) by OptOBDD ( k , α ) where 0 < α < · · · < α k <
1. Its pseudocode is given in Appendix D. In addition, we assume α < / α k + = x , y ∈ R such that 0 < x < y < f ( x , y ) : = y · H (cid:32) xy (cid:33) + g ( x , y ) , g ( x , y ) : = (1 − y ) + ( y − x ) log (3) . The time required for the preprocess is (cid:80) α n (cid:96) = n − (cid:96) · (cid:16) n (cid:96) (cid:17) up to a polynomial factor. Thus, the total timecomplexity can be described as the following recurrence: T ( n ) = α n (cid:88) (cid:96) = n − (cid:96) · (cid:32) n (cid:96) (cid:33) + L k + ( n ) , (6) L j + ( n ) = (cid:115)(cid:32) α j + n α j n (cid:33) (cid:16) L j ( n ) + (1 − α j + ) n ( α j + − α j ) n (cid:17) = (cid:115)(cid:32) α j + n α j n (cid:33) (cid:16) L j ( n ) + g ( α j ,α j + ) n (cid:17) , (7) L ( n ) = O ∗ (1) , (8)for each j ∈ [ k ]. Intuitively, L j ( n ) is the time required for producing F S ( (cid:104) K , K \ K , . . . , K j \ K j − (cid:105) )such that MINCOST (cid:104) K , K \ K ,..., K j \ K j − (cid:105) is minimum over all K , . . . , K j − satisfying | K (cid:96) | = α (cid:96) n for every (cid:96) ∈ [ k +
1] and K (cid:96) ⊂ K (cid:96) + for every (cid:96) ∈ [ k ].Since L ( n ) = O ∗ (1), we have L ( n ) (cid:47) (cid:113)(cid:16) α n α n (cid:17) · g ( α ,α ) n (cid:47) f ( α ,α ) n . By setting f ( α , α ) = g ( α , α ),we have L ( n ) = (cid:115)(cid:32) α n α n (cid:33) · ( L ( n ) + g ( α ,α ) n ) (cid:47) (cid:115)(cid:32) α n α n (cid:33) · g ( α ,α ) n (cid:47) f ( α ,α ) n . In general, for j = , . . . , k , setting f ( α j − , α j ) = g ( α j , α j + ) yields L j + ( n ) (cid:47) f ( α j ,α j + ) n . Therefore, the14otal complexity [Eq. (6)] is T ( n ) (cid:47) α n (cid:88) (cid:96) = n − (cid:96) · (cid:32) n (cid:96) (cid:33) + f ( α k ,α k + ) n (cid:47) (1 − α ) n + H ( α ) n + f ( α k , n , where we use α < / α k + =
1, and Eq. (5). To optimize the right-hand side, we set parameters sothat 1 − α + H ( α ) = f ( α k , α , . . . , α k that satisfy the following system ofequations and α < /
3: 1 − α + H ( α ) = f ( α k , , (9) f ( α j − , α j ) = g ( α j , α j + ) ( j = , . . . , k ) . (10)By numerically solving this system of equations, we obtain T ( n ) = O ( γ nk ), where γ k and the correspond-ing α i ’s for k = , . . . , α < / γ k becomes smaller as k increases. However, incrementing k beyond 6 provides only negligibleimprovement of γ k . The value of γ is at most 2 . α i ’s are notsymmetric with respect to 1 /
2. This reflects the fact that optimizing cost is not symmetric with respectto 1 /
2, contrasting with many other combinatorial problems.
Theorem 10
There exists a quantum algorithm that, for the truth table of f : { , } n → { , } given asinput, produces F S ([ n ]) with probability − exp( − Ω ( n )) in O ∗ ( γ n ) time and space, where the constant γ is at most . , which is achieved by OptOBDD ( k , α ) with k = and α = (0 . , . , . , . , . , . . Recall that the classical composition lemma (Lemma 8) states that algorithm FS can be generalized tocompute F S ( (cid:104) I , . . . , I m , J (cid:105) ) from F S ( (cid:104) I , . . . , I m (cid:105) ). By generalizing the quantum algorithm given inTheorem 10, we now provide a quantum version of Lemma 8, called the quantum composition lemma . Lemma 11 (Quantum Composition: Base Part)
For any disjoint subsets I , . . . , I m , J ⊆ [ n ] , thereexists a quantum algorithm that, with probability − exp( − Ω ( n )) , produces F S ( (cid:104) I , . . . , I m , J (cid:105) ) from F S ( (cid:104) I , . . . , I m (cid:105) ) for an underlying function f : { , } n → { , } in O ∗ (cid:16) n −| I (cid:116)···(cid:116) I m (cid:116) J | · γ | J | (cid:17) time andspace, where γ is the constant defined in Theorem 10. A pseudo code of the algorithm provided in Lemma 11 is shown as
OptOBDD ∗ Γ ( k , α ) in Appendix D,where the subscript Γ , which represents the subroutine appearing in line 16, will be set to the determin-istic algorithm FS ∗ , and k and α will be set to the values specified in Theorem 10. Proof.
Since the space complexity is trivially upper-bounded by the time complexity, we analyze thetime complexity in the following. For simplicity, we assume m = I instead of I . It isstraightforward to generalize to the case of m ≥ OptOBDD ∗ Γ ( k , α ) that produces F S ( (cid:104) I , J (cid:105) ) from F S ( (cid:104) I (cid:105) ), where thesubroutine Γ used in line 16 is set to algorithm FS ∗ . As parameters, the algorithm has an integer k ∈ N and a vector α : = ( α , . . . , α k ) ∈ R k such that 0 < α < · · · < α k <
1. Set k and α to the same valuesassumed in the algorithm in Theorem 10. In addition, we assume α k + = n (cid:48) = | J | . In the preprocess, the algorithm computes the collection {F S ( (cid:104) I , K (cid:105) ) : K ⊆ J , | K | = α n (cid:48) } based on Lemma 8 for given F S ( I ) with the time complexity 2 n −| I |− n (cid:48) (cid:80) α n (cid:48) (cid:96) = n (cid:48) − (cid:96) (cid:16) n (cid:48) (cid:96) (cid:17) up to a poly-nomial factor. Thus, the total time complexity is expressed as T (cid:48) ( n , n (cid:48) ) = n −| I |− n (cid:48) α n (cid:48) (cid:88) (cid:96) = n (cid:48) − (cid:96) (cid:32) n (cid:48) (cid:96) (cid:33) + L (cid:48) k + ( n , n (cid:48) ) , (11)where L (cid:48) k + ( n , n (cid:48) ) is the time taken to perform all but the preprocess.Based on Lemma 9, the algorithm proceeds in a way similar to the one given in Theorem 10, whichcorresponds to the special case of I = ∅ and J = [ n ]. The complexity L (cid:48) k + ( n , n (cid:48) ) is then expressed by thefollowing recurrence: L (cid:48) j + ( n , n (cid:48) ) = (cid:115)(cid:32) α j + n (cid:48) α j n (cid:48) (cid:33) (cid:16) L (cid:48) j ( n , n (cid:48) ) + n −| I |− α j + n (cid:48) ( α j + − α j ) n (cid:48) (cid:17) [ j ∈ [ k ]] , L (cid:48) ( n , n (cid:48) ) = O ∗ (1) . In the following, we prove by induction that T (cid:48) ( n , n (cid:48) ) (cid:47) n −| I |− n (cid:48) T ( n (cid:48) ), where the function T ( · ) isdefined in Eq. (6). Since n (cid:48) = | J | and T ( n (cid:48) ) = O ∗ ( γ n (cid:48) ), this completes the proof for m = L (cid:48) ( n , n (cid:48) ) = O ∗ (1), we have L (cid:48) ( n , n (cid:48) ) (cid:47) n −| I |− n (cid:48) (cid:115)(cid:32) α n (cid:48) α n (cid:48) (cid:33) (1 − α ) n (cid:48) ( α − α ) n (cid:48) = n −| I |− n (cid:48) L ( n (cid:48) ) , where the function L ( · ) is defined in Eq. (7) for j =
1. This is the base case of the induction. Then,assuming that L (cid:48) j ( n , n (cid:48) ) (cid:47) n −| I |− n (cid:48) L j ( n (cid:48) ), we have L (cid:48) j + ( n , n (cid:48) ) (cid:47) (cid:115)(cid:32) α j + n (cid:48) α j n (cid:48) (cid:33) (cid:16) n −| I |− n (cid:48) L j ( n (cid:48) ) + n −| I |− α j + n (cid:48) ( α j + − α j ) n (cid:48) (cid:17) = n −| I |− n (cid:48) (cid:115)(cid:32) α j + n (cid:48) α j n (cid:48) (cid:33) (cid:16) L j ( n (cid:48) ) + n (cid:48) − α j + n (cid:48) ( α j + − α j ) n (cid:48) (cid:17) = n −| I |− n (cid:48) L j + ( n (cid:48) ) . Therefore, it holds that L (cid:48) k + ( n , n (cid:48) ) (cid:47) n −| I |− n (cid:48) L k + ( n (cid:48) ) by induction. Then, it follows from Eq. (11) that T (cid:48) ( n , n (cid:48) ) (cid:47) n −| I |− n (cid:48) α n (cid:48) (cid:88) (cid:96) = n (cid:48) − (cid:96) (cid:32) n (cid:48) (cid:96) (cid:33) + n −| I |− n (cid:48) L k + ( n (cid:48) ) = n −| I |− n (cid:48) T ( n (cid:48) ) . Since T ( n (cid:48) ) = T ( | J | ) = O ∗ ( γ | J | ) by Theorem 10, the lemma follows. (cid:3) Lemma 12 (Quantum Composition: Induction Part)
Suppose that Γ is a quantum algorithm that, forany disjoint subsets I , . . . , I m , J ⊆ [ n ] with J (cid:44) ∅ , produces F S ( (cid:104) I , . . . , I m , J (cid:105) ) from F S ( (cid:104) I , . . . , I m (cid:105) ) with probability − exp( − Ω ( n )) in O ∗ (cid:16) n −| I (cid:116)···(cid:116) I m (cid:116) J | · γ | J | (cid:17) time and space for an underlying functionf : { , } n → { , } . Then, for any possible k ∈ N and α ∈ R k and for any disjoint subsets I , . . . , I m , J ⊆ [ n ] with J (cid:44) ∅ , OptOBDD ∗ Γ ( k , α ) produces F S ( (cid:104) I , . . . , I m , J (cid:105) ) from F S ( (cid:104) I , . . . , I m (cid:105) ) with probability − exp( − Ω ( n )) in O ∗ (cid:16) n −| I (cid:116)···(cid:116) I m (cid:116) J | · β | J | k (cid:17) time and space for the function f , where β nk upper-bounds,up to a polynomial factor, the time complexity required for OptOBDD ∗ Γ ( k , α ) to compute F S ([ n ]) from S ( ∅ ) , that is, T ( n ) = O ∗ ( β nk ) for T ( n ) that satisfies the following recurrence:T ( n ) = α n (cid:88) (cid:96) = n − (cid:96) (cid:32) n (cid:96) (cid:33) + L k + , (12) L j + = (cid:115)(cid:32) α j + n α j n (cid:33) (cid:16) L j + (1 − α j + ) n γ ( α j + − α j ) n (cid:17) = (cid:115)(cid:32) α j + n α j n (cid:33) (cid:16) L j + g γ ( α j ,α j + (cid:17) ( j ∈ [ k ]) , (13) L = O ∗ (1) , (14) where g γ ( x , y ) : = (1 − y ) + ( y − x ) log γ .Proof. Recall that algorithm FS ∗ is used as a subroutine in OptOBDD ( k , α ) provided in Theorem 10.Since the input and output of Γ assumed in the statement are the same as those of algorithm FS ∗ , onecan use Γ instead of algorithm FS ∗ in OptOBDD ( k , α ) (compromising on an exponentially small errorprobability). Let OptOBDD Γ ( k , α ) be the resulting algorithm. Then, one can see that the time complexity T ( n ) of OptOBDD Γ ( k , α ) satisfies the recurrence: Eqs. (12)-(14), which are obtained by just replacing g ( x , y ) with g γ ( x , y ) in Eqs. (6)-(8). Suppose that T ( n ) = O ∗ ( β nk ) follows from the recurrence.Next, we generalize OptOBDD Γ ( k , α ) so that it produces F S ( (cid:104) I , . . . , I m , J (cid:105) ) from F S ( (cid:104) I , . . . , I m (cid:105) )for any disjoint subsets I , . . . , I m , J ⊆ [ n ] with J (cid:44) ∅ . The proof is very similar to that of Lemma 11. Theonly difference is that the time complexity of Γ is O ∗ (cid:16) n −| I (cid:116)···(cid:116) I m (cid:116) J | · γ | J | (cid:17) , instead of O ∗ (cid:16) n −| I (cid:116)···(cid:116) I m (cid:116) J | · | J | (cid:17) .Namely, when m = n (cid:48) = | J | , the time complexity of OptOBDD ∗ Γ ( k , α ) satisfies the following recur-rence: for each j ∈ [ n ], T (cid:48) ( n , n (cid:48) ) = n −| I |− n (cid:48) α n (cid:48) (cid:88) (cid:96) = n (cid:48) − (cid:96) (cid:32) n (cid:48) (cid:96) (cid:33) + L (cid:48) k + ( n , n (cid:48) ) , L (cid:48) j + ( n , n (cid:48) ) = (cid:115)(cid:32) α j + n (cid:48) α j n (cid:48) (cid:33) (cid:16) L (cid:48) j ( n , n (cid:48) ) + n −| I |− α j + n (cid:48) γ ( α j + − α j ) n (cid:48) (cid:17) [ j ∈ [ n ]] , L (cid:48) ( n , n (cid:48) ) = O ∗ (1) , from which it follows that T (cid:48) ( n , n (cid:48) ) = n −| I |− n (cid:48) T ( n (cid:48) ) = O ∗ (cid:16) n −| I (cid:116) J | · β | J | k (cid:17) . It is straightforward to general-ize to the case of m ≥ (cid:3) Lemmas 11 and 12 naturally lead to the following algorithm. We first define Γ as OptOBDD ∗ FS ∗ ( k (0) , α (0) )for some k (0) ∈ N and α (0) ∈ R k (0) . Then, we define Γ as OptOBDD ∗ Γ ( k (1) , α (1) ) for some k (1) ∈ N and α (1) ∈ R k (1) . In this way, we can define Γ i + as OptOBDD ∗ Γ i ( k ( i ) , α ( i ) ) for some k ( i ) ∈ N and α ( i ) ∈ R k ( i ) .Fix k ( i ) = i . Note that, in the proof of Lemmas 11 and 12, parameter α ( i ) = ( α ( i )1 , . . . , α ( i )6 ) ∈ [0 , is set for each i so that it satisfies the system of equations, a natural generalization of Eqs. (9)(10),1 − α ( i )1 + H ( α ( i )1 ) = f γ ( α ( i )6 ,
1) (15) f γ ( α ( i ) j − , α ( i ) j ) = g γ ( α ( i ) j , α ( i ) j + ) ( j = , . . . , , (16)where f γ ( x , y ) : = y · H (cid:16) xy (cid:17) + g γ ( x , y ) and g γ ( x , y ) : = (1 − y ) + ( y − x ) log γ .By numerically solving this system of equations for γ =
3, we have β < . γ = . β < . γ less than 2 . heorem 13 There exists a quantum algorithm that, for the truth table of f : { , } n → { , } given asinput, produces F S ([ n ]) in O ∗ ( γ n ) time and space with probability − exp( − Ω ( n )) , where the constant γ is at most . . AppendixA Proofs of Lemmas
Proof of Lemma 4.
To show the first equality, assume k = π I [ | I | ]. By the definition, we have MINCOST I = (cid:88) i ∈ I Cost i ( f , π I ) = (cid:88) i ∈ I \{ k } Cost i ( f , π I ) + Cost k ( f , π I ) . The first term is equal to
MINCOST I \ k , since otherwise there exists π (cid:48) ∈ Π ( I ) with π (cid:48) [ | I | ] = k and π (cid:48) [ j ] (cid:44) π I [ j ] for some j ∈ [ | I | −
1] such that (cid:88) i ∈ I Cost i ( f , π (cid:48) ) = (cid:88) i ∈ I \{ k } Cost i ( f , π (cid:48) ) + Cost k ( f , π (cid:48) ) < (cid:88) i ∈ I \{ k } Cost i ( f , π I ) + Cost k ( f , π I ) = MINCOST I , which contradicts the definition of MINCOST I , where we use Cost k ( f , π (cid:48) ) = Cost k ( f , π I ) by Lemma 3.The remaining term Cost k ( f , π I ) is equal to Cost k ( f , π (cid:104) I \ k , k (cid:105) ) by Lemma 3. Thus, the first equalityin the statement of the lemma holds. Since MINCOST I \ k = (cid:80) i ∈ I \ k Cost i ( f , π I \ k ) by the definition, andLemma 3 implies that Cost i ( f , π I \ k ) = Cost i ( f , π (cid:104) I \ k , k (cid:105) ) for every i ∈ I \ k , it holds that MINCOST I \ k = (cid:80) i ∈ I \ k Cost i ( f , π (cid:104) I \ k , k (cid:105) ). Therefore, MINCOST I \ k + Cost k ( f , π (cid:104) I \ k , k (cid:105) ) = (cid:80) i ∈ I Cost i ( f , π (cid:104) I \ k , k (cid:105) ). This impliesthat the second equality in the lemma. (cid:3) Proof of Lemma 7.
We focus on the simplest case of m = I instead of I , since it isstraightforward to generalize the proof to the case of m ≥ k = π (cid:104) I , J (cid:105) [ | I (cid:116) J | ]. By the definition, we have MINCOST (cid:104) I , J (cid:105) = (cid:88) i ∈ I (cid:116) J Cost i ( f , π (cid:104) I , J (cid:105) ) = (cid:88) i ∈ I (cid:116) J \{ k } Cost i ( f , π (cid:104) I , J (cid:105) ) + Cost k ( f , π (cid:104) I , J (cid:105) ) . The first term is equal to
MINCOST (cid:104) I , J \{ k }(cid:105) , since otherwise there exists π (cid:48) ∈ Π ( (cid:104) I , J (cid:105) ) with π (cid:48) [ | I (cid:116) J | ] = k and π (cid:48) [ j ] (cid:44) π (cid:104) I , J (cid:105) [ j ] for some j ∈ [ | I (cid:116) J | −
1] such that (cid:88) i ∈ I (cid:116) J Cost i ( f , π (cid:48) ) = (cid:88) i ∈ I (cid:116) J \{ k } Cost i ( f , π (cid:48) ) + Cost k ( f , π (cid:48) ) < (cid:88) i ∈ I (cid:116) J \{ k } Cost i ( f , π (cid:104) I , J (cid:105) ) + Cost k ( f , π (cid:104) I , J (cid:105) ) = MINCOST (cid:104) I , J (cid:105) , which contradicts the definition of MINCOST (cid:104) I , J (cid:105) , where we use Cost k ( f , π (cid:48) ) = Cost k ( f , π (cid:104) I , J (cid:105) ) by Lemma 3.The remaining term Cost k ( f , π (cid:104) I , J (cid:105) ) is equal to Cost k ( f , π (cid:104) I , J − k , k (cid:105) ) by Lemma 3. Thus, the first equalityin the statement of the lemma holds. Since MINCOST (cid:104) I , J \ k (cid:105) = (cid:80) i ∈ I (cid:116) J \ k Cost i ( f , π (cid:104) I , J \ k (cid:105) ) by the defini-tion, and Lemma 3 implies that Cost i ( f , π (cid:104) I , J \ k (cid:105) ) = Cost i ( f , π (cid:104) I , J \ k , k (cid:105) ) for every i ∈ I (cid:116) J \ k , it holdsthat MINCOST (cid:104) I , J \ k (cid:105) = (cid:80) i ∈ I (cid:116) J \ k Cost i ( f , π (cid:104) I , J \ k , k (cid:105) ). Therefore, MINCOST (cid:104) I , J \ k (cid:105) + Cost k ( f , π (cid:104) I , J \ k , k (cid:105) ) = (cid:80) i ∈ I (cid:116) J Cost i ( f , π (cid:104) I , J \ k , k (cid:105) ). This implies that the second equality in the lemma. (cid:3) Two-Parameter Case
To improve the complexity bound further, we use Lemma 9 recursively. Let k and k be parametersfixed later such that 0 < k < k < n . By applying the lemma once, we have MINCOST [ n ] = min K ⊂ [ n ] , | K (cid:48) | = k (cid:0) MINCOST K + MINCOST (cid:104) K , [ n ] \ K (cid:105) [[ n ] \ K ] (cid:1) . Then, we apply the lemma again to
MINCOST K (cid:48) to obtain MINCOST K = min K ⊂ K : | K | = k (cid:0) MINCOST K + MINCOST (cid:104) K , K \ K (cid:105) [ K \ K ] (cid:1) . To find the optimal K from among (cid:16) k k (cid:17) possibilities and the optimal K from among (cid:16) nk (cid:17) , we usethe quantum minimum finding (Lemma 6). As in the previous case, we perform the classical preprocessthat computes F S ( K ) for all K ⊆ [ n ] with | K | = k .If we set k = α n and k = α n , assuming that α < /
3, the total time complexity (up to apolynomial factor) is T ( n ) = α n (cid:88) (cid:96) = n − (cid:96) · (cid:32) n (cid:96) (cid:33) + L ( n ) (cid:47) (1 − α ) n + H ( α ) n + L ( n ) , (17)where L ( n ) = (cid:115)(cid:32) n α n (cid:33) (cid:16) L ( n ) + (1 − α ) n (cid:17) (cid:47) H ( α ) n ( L ( n ) + (1 − α )(log n ) , (18) L ( n ) = (cid:115)(cid:32) α n α n (cid:33) (cid:16) L ( n ) + (1 − α ) n ( α − α ) n (cid:17) (cid:47) H ( α /α ) α n ( L ( n ) + (1 − α ) n + ( α − α )(log n ) , (19) L ( n ) = O ∗ (1) . (20)Intuitively, L ( n ) represents the time required for producing F S ( (cid:104) K , K \ K (cid:105) ) for fixed K such that MINCOST (cid:104) K , K (cid:105) is minimum over all K ( ⊂ K ) for the given collection of F S ( K ) for all K . Note that,by Lemma 8, the time required for computing F S ( (cid:104) K , K \ K , [ n ] \ K (cid:105) ) from F S ( (cid:104) K , K \ K (cid:105) ) is O ∗ (3 (1 − α ) n ), and the time required for computing F S ( (cid:104) K , K \ K (cid:105) ) from F S ( K ) is O ∗ (2 (1 − α ) n ( α − α ) n ).Since we are not interested in polynomial factors in T ( n ), we ignore them in the following analysisof this system.From Eqs. (19) and (20), L ( n ) is at most 2 H ( α /α ) α n · (1 − α ) n + ( α − α )(log n . Suppose that L ( n )equals this upper bound, since our goal is to upper-bound the complexity. To balance the two terms onthe right-hand side of Eq. (18), we set L ( n ) = (1 − α )(log n , which implies12 α H ( α /α ) + (1 − α ) + ( α − α ) log = (1 − α ) log . (21)On the condition that this holds, L ( n ) is at most 2 H ( α ) n (1 − α )(log n . Suppose again that L ( n ) equalsthis upper bound. To balance the two terms on the right-hand side in Eq. (17), we have L ( n ) = (1 − α ) n + H ( α ) n , implying that(1 − α ) + H ( α ) = H ( α ) + (1 − α ) log . (22)By numerically solving Eqs. (21) and (22), we have α ∗ = . α ∗ = . α ∗ isless than 1 /
3, as we assumed. For α = α ∗ and α = α ∗ , T ( n ) (cid:47) (1 − α ∗ ) + H ( α ∗ ) ] n = O ∗ ( γ ) , where γ = . < γ . 19 Numerical Optimization Data
Table 1: Values of γ k and the corresponding α i ’s of algorithm OptOBDD ( k , α ): Each value is writtenwith 6 digits, but the actual calculation is done with 20-digit precision. k γ k α α α α α α γ and the corresponding α i ’s of algorithm OptOBDD ∗ Γ ( k , α ): Each value is writtenwith 6 digits, but the actual calculation is done with 20-digit precision. γ β α α α α α α Pseudo Codes of Algorithms
Algorithm FS ∗ : Composable variant of algorithm FS .“ A ← B ” means that B is substituted for A . Input: disjoint subsets I , J ∈ [ n ] and F S ( I ) Output:
F S ( (cid:104) I , J (cid:105) ) Function
Main () for (cid:96) : = to | J | do for each (cid:96) -element subset K ⊆ J do MINCOST (cid:104) I , K (cid:105) ← + ∞ ; // initialization for each k ∈ K do F S ( (cid:104) I , K − k , k (cid:105) ) ← FOLD ( I , K , k , F S ( (cid:104) I , K − k (cid:105) )); if MINCOST (cid:104) I , K (cid:105) > MINCOST (cid:104) I , K − k , k (cid:105) then F S ( (cid:104) I , K (cid:105) ) ← F S ( (cid:104) I , K − k , k (cid:105) ); end end end end return F S ( (cid:104) I , J (cid:105) ) end Function
FOLD ( I , K , k , F S ( (cid:104) I , K − k (cid:105) )) // produce F S ( (cid:104) I , K − k , k (cid:105) ) from F S ( (cid:104) I , K − k (cid:105) ) π (cid:104) I , K − k , k (cid:105) ← ( π (cid:104) I , K − k (cid:105) [1] , . . . , π (cid:104) I , K − k (cid:105) [ | I (cid:116) K | − , k ) ; // initialization MINCOST (cid:104) I , K − k , k (cid:105) ← MINCOST (cid:104) I , K − k (cid:105) ; // initialization NODE (cid:104) I , K − k , k (cid:105) ← ∅ ; // initialization for b ∈ { , } n −| I |−| K | do u ← TABLE (cid:104) I , K − k (cid:105) [ x [ n ] \ ( I (cid:116) K ) = b , x k = u ← TABLE (cid:104) I , K − k (cid:105) [ x [ n ] \ ( I (cid:116) K ) = b , x k = if u = u then TABLE (cid:104) I , K − k , k (cid:105) [ x [ n ] \ ( I (cid:116) K ) = b ] ← u else if ∃ u ( u , u , u ) ∈ NODE (cid:104) I , K − k , k (cid:105) then TABLE (cid:104) I , K − k , k (cid:105) [ x [ n ] \ ( I (cid:116) K ) = b ] ← u else // create a new node TABLE (cid:104) I , K − k , k (cid:105) [ x [ n ] \ ( I (cid:116) K ) = b ] ← MINCOST (cid:104) I , K − k , k (cid:105) + MINCOST (cid:104) I , K − k , k (cid:105) ← MINCOST (cid:104) I , K − k , k (cid:105) + Insert ( u , u , u ) into NODE (cid:104) I , K − k , k (cid:105) end end return F S ( (cid:104) I , K − k , k (cid:105) ) end Adaptation to ZDD
To adapt FS ∗ to ZDD, it suffices to modify lines 22 and 23 in algorithm FS ∗ follows: if u = then TABLE (cid:104) I , K − k , k (cid:105) [ x [ n ] \ ( I (cid:116) K ) = b ] ← u lgorithm OptOBDD ( k , α ) : Quantum OBDD-minimization algorithm with parameters k ∈ N and α : = ( α , . . . , α k ) ∈ R k satisfying 0 < α < · · · < α k <
1, where the quantum minimum finding algorithm is usedin line 8, and FS ∗ is used in lines 2 and 15. “ A ← B ” means that B is substituted for A . Input:
F S ( ∅ ) := { TABLE ∅ , π ∅ , MINCOST ∅ , NODE ∅ } (accessible from all Functions) Output:
F S ([ n ]) Function
Main () compute the set {F S ( K ) : K ⊆ [ n ] , | K | = α n } by algorithm FS (or FS ∗ ); make the set of these F S ( K ) global (i.e., accessible from all Functions); return DivideAndConquer ([ n ] , k + end Function
DivideAndConquer ( L , t ) // Compute F S ( L ) with α , . . . , α t ( = | L | / n ) if t=1 then return F S ( L ); // F S ( L ) has been precomputed. Find K ( ⊂ L ) of cardinality α t − n , with Lemma 6, that minimizes MINCOST (cid:104) K , L \ K (cid:105) , which is computed as an component of F S ( (cid:104) K , L \ K (cid:105) ) by calling ComputeFS ( K , L \ K , t ); let K ∗ be the set that achieves the minimum; return F S ( (cid:104) K ∗ , L \ K ∗ (cid:105) ) end Function
ComputeFS ( K , M , t ) // Compute F S ( (cid:104) K , M (cid:105) ) with α , . . . , α t F S ( K ) ← DivideAndConquer ( K , t − F S ( (cid:104) K , M (cid:105) ) ← FS ∗ ( K , M , F S ( K )); return F S ( (cid:104) K , M (cid:105) ) endAlgorithm OptOBDD ∗ Γ ( k , α ) : Composable Quantum OBDD-minimization algorithm with subroutine Γ and pa-rameters k ∈ N and α = ( α , . . . , α k ) ∈ R k satisfying 0 < α < · · · < α k <
1, where the quantum minimumfinding algorithm is used in line 9, and subroutine Γ is used in line 16. “ A ← B ” means that B is substituted for A . Γ ( I , I , J , F S ( I , I )) produces F S ( I , I , J ) from F S ( I , I ). Input: I ⊆ [ n ], J ⊆ [ n ], F S ( I ). (accessible from all Functions) Output:
F S ( (cid:104) I , J (cid:105) ) Function
Main () n (cid:48) ← | J | ; // initialization compute the set {F S ( (cid:104) I , K (cid:105) ) : K ⊆ J , | K | = α n (cid:48) } by algorithm FS ∗ ; make n (cid:48) and the above set of F S ( (cid:104) I , K (cid:105) ) global (i.e., accessible from all Functions); return DivideAndConquer ( J , k + end Function
DivideAndConquer ( L , t ) // Compute F S ( (cid:104) I , L (cid:105) ) with α , . . . , α t if t=1 then return F S ( I , L ); // F S ( I , L ) has been precomputed. Find K ( ⊂ L ) of cardinality α t − n (cid:48) , with Lemma 6, that minimizes MINCOST (cid:104) I , K , L \ K (cid:105) which is computed as an component of F S ( (cid:104) I , K , L \ K (cid:105) ) by calling ComputeFS ( I , K , L \ K , t ); let K ∗ be the set that achieves the minimum; return F S ( (cid:104) I , K ∗ , L \ K ∗ (cid:105) ) end Function
ComputeFS ( I , K , M , t ) // Compute F S ( (cid:104) K , M (cid:105) ) with α , . . . , α t F S ( I , K ) ← DivideAndConquer ( K , t − F S ( (cid:104) I , K , M (cid:105) ) ← Γ ( I , K , M , F S ( I , K )); return F S ( (cid:104) I , K , M (cid:105) ) end eferences [ABI +
19] Andris Ambainis, Kaspars Balodis, Janis Iraids, Martins Kokainis, Krisjanis Prusis, andJevgenijs Vihrovs. Quantum speedups for exponential-time dynamic programming al-gorithms. In
Proceedings of the Thirtieth Annual ACM-SIAM Symposium on DiscreteAlgorithms, SODA 2019 , pages 1783–1793, 2019.[Ake78] S. B. Akers. Binary decision diagrams.
IEEE Trans. Comput. , 27(6):509–516, June 1978.[BC95] Randal E. Bryant and Yirng-An Chen. Verification of arithmetic circuits with binary mo-ment diagrams. In
Proceedings of the 32st Conference on Design Automation, San Fran-cisco, California, USA, Moscone Center, June 12-16, 1995. , pages 535–541, 1995.[BCdWZ99] Harry M. Buhrman, Richard E. Cleve, Ronald de Wolf, and Christof Zalka. Bounds forsmall-error and zero-error quantum algorithms. In
Proceedings of 40th Annual Symposiumon Foundations of Computer Science, FOCS ’99 , pages 358–368, 1999.[BFG +
97] R. I. Bahar, E. A. Frohm, C. M. Gaona, G. D. Hachtel, E. Macii, A. Pardo, and F. Somenzi.Algebric decision diagrams and their applications.
Formal Methods in System Design ,10(2–3):171–206, 1997.[Bol16] Beate Bollig. On the minimization of (complete) ordered binary decision diagrams.
The-ory of Computing Systems , 59(3):532–559, Oct 2016.[Bry86] Randal E. Bryant. Graph-based algorithms for boolean function manipulation.
IEEETrans. Comput. , 35(8):677–691, August 1986.[Bry91] Randal E. Bryant. On the complexity of VLSI implementations and graph representationsof boolean functions with application to integer multiplication.
IEEE Transactions onComputers , 40(2):205–213, Feb 1991.[Bry92] Randal E. Bryant. Symbolic boolean manipulation with ordered binary-decision diagrams.
ACM Comput. Surv. , 24(3):293–318, September 1992.[Bry18] Randal E. Bryant. Binary decision diagrams.
Handbook of Model Checking , pages 191–217, 2018.[BW96] B. Bollig and I. Wegener. Improving the variable ordering of OBDDs is NP-complete.
IEEE Transactions on Computers , 45(9):993–1002, Sep. 1996.[CMZ +
97] E.M. Clarke, K. L. Mcmillan, X. Zhao, M. Fujita, and J. Yang. Spectral transforms forlarge boolean functions with applications to technology mapping.
Formal Methods inSystem Design , 10(2–3):137–148, 1997.[DB98] Rolf Drechsler and Bernd Becker.
Binary Decision Diagrams: Theory and Implementa-tion . Springer, 1998.[DH96] Christoph D¨urr and Peter Høyer. A quantum algorithm for finding the minimum. TechnicalReport quant-ph/9607014, arXiv, 1996.[DHHM06] Christoph D¨urr, Mark Heiligman, Peter Høyer, and Mehdi Mhalla. Quantum query com-plexity of some graph problems.
SIAM Journal on Computing , 35(6):1310–1328, 2006.[FS90] S. J. Friedman and K. J. Supowit. Finding the optimal variable ordering for binary decisiondiagrams.
IEEE Transactions on Computers , 39(5):710–713, May 1990.23GJ79] Michael R. Garey and David S. Johnson.
COMPUTERS AND INTRACTABILITY — AGuide to the Theory of NP-Completeness . W. H. Freeman and Company, New York, 2edition, 1979.[GLM08] Vittorio Giovannetti, Seth Lloyd, and Lorenzo Maccone. Quantum random access mem-ory.
Phys. Rev. Lett. , 100:160501, Apr 2008.[Gro96] Lov K. Grover. A fast quantum mechanical algorithm for database search. In
Proceedingsof the Twenty-Eighth Annual ACM Symposium on Theory of Computing , pages 212–219,1996.[HC92] Heh-Tyan Liaw and Chen-Shang Lin. On the obdd-representation of general booleanfunctions.
IEEE Transactions on Computers , 41(6):661–664, June 1992.[Hea93] Mark Heap. On the exact ordered binary decision diagram size of totally symmetric func-tions.
Journal of Electronic Testing , 4(2):191–195, 1993.[HI02] Takashi Horiyama and Toshihide Ibaraki. Ordered binary decision diagrams asknowledge-bases.
Artif. Intell. , 136(2):189–213, 2002.[HM94] M. A. Heap and M. R. Mercer. Least upper bounds on obdd sizes.
IEEE Transactions onComputers , 43(6):764–767, June 1994.[HM00] L. Heinrich-Litan and P. Molitor. Least upper bounds for the size of obdds using symmetryproperties.
IEEE Transactions on Computers , 49(4):360–368, April 2000.[HTKY97] K. Hosaka, Y. Takenaga, T. Kaneda, and S. Yajima. Size of ordered binary decision di-agrams representing threshold functions.
Theoretical Computer Science , 180(1):47 – 60,1997.[HY97] Takashi Horiyama and Shuzo Yajima. Exponential lower bounds on the size of obddsrepresenting integer divistion. In
Proceedings of the 8th International Symposium on Al-gorithms and Computation, (ISAAC ’97), Singapore, December 17-19, 1997, Proceedings ,Lecture Notes in Computer Science, pages 163–172. Springer, 1997.[INY98] Kazuo Iwama, Mitsushi Nouzoe, and Shuzo Yajima. Optimizing obdds is still intractablefor monotone functions. In
Proceedings of the 23rd International Symposium on Mathe-matical Foundations of Computer Science (MFCS’98) , volume 1450 of
Lecture Notes inComputer Science , pages 625–635. Springer, 1998.[KLM07] Phillip Kaye, Raymond Laflamme, and Michele Mosca.
An Introduction to QuantumComputing . Oxford University Press, 2007.[Knu09] Donald E. Knuth.
The Art of Computer Programming, Volume 4, Fascicle 1: BitwiseTricks & Techniques; Binary Decision Diagrams . Addison-Wesley Professional, 1 edition,March 2009.[KSV02] Alexei Yu. Kitaev, Alexander H. Shen, and Mikhail N. Vyalyi.
Classical and QuantumComputation , volume 47 of
Graduate Studies in Mathematics . AMS, 2002.[Lee59] C. Y. Lee. Representation of switching circuits by binary-decision programs.
The BellSystem Technical Journal , 38(4):985–999, July 1959.[LGM18] Franc¸ois Le Gall and Fr´ed´eric Magniez. Sublinear-time quantum computation of the di-ameter in congest networks. In
Proceedings of the 2018 ACM Symposium on Principlesof Distributed Computing , PODC ’18, pages 337–346, New York, NY, USA, 2018. ACM.24Min93] Shin-ichi Minato. Zero-suppressed BDDs for set manipulation in combinatorial problems.In
Proceedins of the 30th ACM/IEEE Design Automation Conference , pages 272–277,June 1993.[Min11] Shin-ichi Minato. π DD: A new decision diagram for efficient problem solving in permu-tation space. In
Proceedings of the 14th International Conference on Theory and Appli-cations of Satisfiability Testing (SAT 2011) , volume 6695 of
Lecture Notes in ComputerScience , pages 90–104, 2011.[MS94] Christoph Meinel and Anna Slobodov´a. On the complexity of constructing optimal or-dered binary decision diagrams. In
Proceedings of 19th Mathematical Foundations ofComputer Science 1994 , pages 515–524, Berlin, Heidelberg, 1994. Springer Berlin Hei-delberg.[MT98] Christoph Meinel and Thorsten Theobald.
Algorithms and Data Structures in VLSI De-sign: OBDD - Foundations and Applications . Springer, 1998.[NC00] Michael A. Nielsen and Isaac L. Chuang.
Quantum Computation and Quantum Informa-tion . Cambridge University Press, 2000.[Sie02a] Detlef Sieling. The complexity of minimizing and learning OBDDs and FBDDs.
DiscreteApplied Mathematics , 122(1):263 – 282, 2002.[Sie02b] Detlef Sieling. The nonapproximability of OBDD minimization.
Information and Com-putation , 172(2):103 – 138, 2002.[SIT95] Kyoko Sekine, Hiroshi Imai, and Seiichiro Tani. Computing the Tutte polynomial ofa graph of moderate size. In
Proceedings of the Sixth International Symposium on Algo-rithms and Computation (ISAAC ’95) , volume 1004 of
Lecture Notes in Computer Science ,pages 224–233. Springer, 1995.[STY94] Hiroshi Sawada, Yasuhiko Takenaga, and Shuzo Yajima. On the computational power ofbinary decision diagrams.
IEICE Trans. Info. & Syst., D , 77(6):611–618, 1994.[THY96] Seiichiro Tani, Kiyoharu Hamaguchi, and Shuzo Yajima. The complexity of the optimalvariable ordering problems of a shared binary decision diagram.
IEICE Transactions onInformation and Systems , E79-D(4):271–281, 1996. (Conference version is in
Proceed-ings of the Fourth International Symposium on Algorithms and Computation (ISAAC’93) ,vol. 2906, pp.389–398, Lecture Notes in Computer Science, Springer, 1993).[TI94] Seiichiro Tani and Hiroshi Imai. A reordering operation for an ordered binary decisiondiagram and an extended framework for combinatorics of graphs. In
Proceedings of theFifth International Symposium on Algorithms and Computation (ISAAC’94) , volume 834of
Lecture Notes in Computer Science , pages 575–583. Springer-Verlag, 1994.[TY00] Yasuhiko Takenaga and Shuzo Yajima. Hardness of identifying the minimum orderedbinary decision diagram.
Discrete Applied Mathematics , 107(1-3):191–201, 2000.[Weg00] Ingo Wegener.