key: cord-0046006-xdiytfye authors: Arodz, Tomasz title: Generalized Quantum Deutsch-Jozsa Algorithm date: 2020-05-25 journal: Computational Science - ICCS 2020 DOI: 10.1007/978-3-030-50433-5_36 sha: 856e742f682c99953b2e91ad5a15e41638ad6b01 doc_id: 46006 cord_uid: xdiytfye Quantum computing aims to provide algorithms and hardware that allows for solving computational problems asymptotically faster than on classical computers. Yet, design of new, fast quantum algorithms is not straightforward, and the field faces high barriers of entry for traditional computer scientists. One of the main didactic examples used to introduce speedup resulting from quantum computing is the Deutsch-Jozsa algorithm for discriminating between constant and balanced functions. Here, we show a generalization of the Deutsch-Jozsa algorithm beyond balanced functions that can be used to further illustrate the design choices underpinning quantum algorithms. Quantum computing studies algorithms and hardware for performing computation using systems that exploit quantum physics. In the gate model of quantum computing [6] , the information storage and processing are done using tools from linear algebra. The information is stored in a quantum register composed of quantum bits. Each quantum bit is represented as a unit-norm vector in a two-dimensional complex Hilbert space. A multi-qubit register is modeled as a tensor product space arising from the individual quantum bits. The information in the quantum register can evolve in time according to invertible, inner product-preserving transformations, modeled mathematically in the gate model of quantum computing as unitary operators. The information in the quantum register can be accessed, to some extent, through quantum measurement, typically modeled as a randomized projection on vectors from the computational basis of the Hilbert space. The key promise of quantum computing is to achieve speedup compared to classical computers [10] , leading to faster algorithms in many domains, including linear algebra [5] , database search [4] , or machine learning [1, 3, 9] . The study of quantum algorithms can also lead to more efficient classical methods [7, 11] . One of the first, didactic example of a problem for which a quantum computer abstracted using the gate model shows speedup is a promise problem known as the Deutsch-Jozsa problem [2] . Assume that you are given a Boolean function on n-bits: f : {0, 1} n → {0, 1} with a black-box access. That is, on a classical computer, you can call it on any bit string and see the result, but you cannot decompile it. On a quantum computer, you have access to an oracle, a unitary transformation U f that performs the function using some form of input and output encoding. In the Deutsch-Jozsa problem, we are promised that the function is of one of two types constant, that is, always returns 0, or always returns 1, -balanced, that is, for half of the 2 n possible inputs it returns 0, for the remaining 2 n−1 inputs, it returns 1. The task is to use the ability to execute f (x) for any x to figure out if f is constant, or balanced. Let N = 2 n be the number of distinct inputs x. On a classical computer, we need at least two calls to f to be able to decide if the function is constant or balanced -in the most optimistic scenario when first call returns 0 and the second returns 1, we know the answer after these two calls to f . But if we see zeros all the time, we need N/2 + 1 calls to have the answer -if value number N/2 + 1 is also 0, it is a constant function, if the value is 1, it is a balanced function. Thus, pessimistically, we need O (N ) = O (2 n ) calls to f to solve the Deutsch-Jozsa problem on a classical computer. It is well-known that on a quantum computer, we can solve the Deutsch-Jozsa problem much quicker, using just one call to the unitary oracle U f . The Deutsch-Jozsa algorithm has been recently generalized to include discrimination between balanced functions and almost-constant functions [8] , with the query complexity increasing with the distance from a constant function. Here, we show that it can be generalized in a different way, to a family of promise problems involving discrimination between a specific constant function f l , for example an all-zero function, and a family of functions f k that have fixed level of imbalance, that is, have exactly k outputs equal to one, as long as k ≥ N/2. We show that this problem can be solved with only one query to the function oracle. To define the Deutsch-Jozsa algorithm, we need to have ability to evaluate Boolean functions using unitary operators, and the ability to use Boolean function evaluation to provide the answer whether the function is constant or balanced. A Boolean function on n bits returning an m bit string is a function f : m . Consider n = m, and a function f (x) = NOT x that negates all bits of x. It is a permutation -a one-to-one mapping -on the set {0, 1} n . Now consider where ⊕ is a modulo-two addition. If a bit in y is 0, the corresponding bit in x is not changed -an identity mapping, a particular form of permutation, on those bits. If a bit in y is 1, the corresponding bit in x is negated -a permutation on those bits. That is, for arbitrary nbit y, x → y ⊕ x is a permutation on the set {0, 1} n -|y ⊕ x vectors for all possible x are mutually orthogonal, same as |x are. Then, a linear mapping U y = x∈{0,1} n |y ⊕ x x| will produce |y ⊕ x when we perform U y |x . Since y ⊕x is a permutation on {0, 1} n , it is a one-to-one mapping. It also preserves the inner product. The inner product among basis vectors |x , x ∈ {0, 1} n is null, and the inner products among the outputs U y |x are also null. This mapping is innerproduct-preserving, and thus compatible with the rules of quantum mechanics. Not all functions f : {0, 1} n → {0, 1} n are permutations; a constant function that always returns all bits set to 0 is not a permutation. Consider an arbitrary function f : where |x is one of the 2 n basis states of (C 2 ) n , and |z is one of the 2 m basis states of (C 2 ) m . We wish to have a linear transformation U f , a unitary operator, that takes the vector, and produces, on output, a state |x |z ⊕ f (x) , in particular, for z = 0 m , it produces |x |f (x) . For each x, z → z ⊕f (x) is a permutation on the basis states of (C 2 ) m , and thus |x |z ⊕ f (x) is a permutation on the basis states of H. Hence, which performs |x |0 → |x |f (x) , is a one-to-one mapping that preserves the inner product -and thus can describe unitary evolution of a quantum system. Consider m = 1, arbitrary n, and an n + 1-qubit system in an arbitrary state of the form |ψ |0 . Let E = HX be a Pauli X gate followed by Hadamard gate; it transforms |0 to |− and |1 to |+ , and is Hermitian. Let E n = I ⊗n ⊗ E denote application of E to the last, n + 1 qubit. We have Then we used phase kickback to the top qubits. Value of f (x) = 1 is reflected in change of phase of |x by π, whereas f (x) = 0 results in no change. We now see two ways of representing the result of applying f (x) as encoded by U f = x,z (|x |z ⊕ f (x) )( x| z|): The first option is to encode the result in the state of the last qubit, the second is to encode it in the phase of the input qubits. Consider four query states |0u +|1v , and correspond to the two one-bit balanced functions. If someone prepares a two-qubit system in one of the four query states, can we distinguish whether it is any of these two |F F and |T T , or any of these two |T F and |F T ? We have T T | F F = T F | F T = 0, that is, it is easy to distinguish |T T from |F F , and |T F from |F T . All other inner products of these four states are equal to 1 /2. Any unitary transformation has to preserve the dimensionality of the space, and the inner products. Thus, there is no mapping that would map |T T to be orthogonal to |T F or |F T ; same for |F F . If we want to use orthogonality of any member from one group of states to any member from the other group of states to reliably distinguish states from one group from the other, then a group composed of |T T and |F F cannot be reliably distinguished from group consisting of |T F and |F T . We have seen above two ways of representing the result of applying a binary function f (x) given a state |x : encoding the result as an additional qubit, or as a phase change of the input qubit. Consider a n-bit binary function f . We can construct a state |+ ⊗n = 2 n −1 x=0 |x using Hadamard transform. Then, we can construct a state |+ ⊗n , 0 = |+ ⊗n |0 , and apply our two options of evaluating f quantum mechanically to this n + 1-qubit state. We will get These two options are not equivalent. The four query states we have seen above can be seen as the first option for n = 1 if we equate u = f (0) and v = f (1); indeed . We have seen that we cannot use this representation to decide, based on orthogonality, if we got a function that is constant, or that returns equal number of 0's and 1's. On the other hand, consider the second representation, or actually just its first qubit 1 . A constant function will have ± |+ , while a balanced function will have ± |− . We can ignore the global phase, that is, the sign, and we end up with two orthogonal states, |+ for constant and |− for balanced function. As we can see, while unitary actions after applying the black-box unitary oracle cannot change the distinguishability of states because they must preserve the inner products, differences prior to applying the function oracle can affect our ability to distinguish states. We show here that the ability to distinguish all-zeros from all-ones that we get from U f = U f (I ⊗n ⊗ I) and the ability to distinguish all-zeros and all-ones from a balanced function that we get from U f E n = U f (I ⊗n ⊗ E) are not the only possibilities for quickly solving promise problems involving two groups of binary functions. We can form a class of single-qubit unitary operators A defined by the condition |a| 2 + |b| 2 = 1, and observe that unitaries I and E are at the extreme ends of the family, with a spectrum of other operators in between. These operators can each solve a different promise problem of discriminating between two classes of functions. Consider two functions f l and f k with the corresponding black-box unitaries U l and U k , and let y j = f k (j) and x j = f l (j). Also, let ξ j = 1 if y j = x j and ξ j = 0 otherwise, and δ j = 1− ξ j ; we will use Ξ to denote the number of outputs on which the functions agree, and Δ to denote the Hamming distance between the outputs, that is, the number of outputs that differ; we have Ξ + Δ = 2 n . Let A n = I ⊗n ⊗ A denote application of A to the last, n + 1-st qubit of an n + 1-qubit system. Then, we have and a similar expression for U l , with y j replaced by x j . The inner product of the two states is where α = −2 (ab * ). Indeed, we have The last equality comes from the fact that (ȳ jxj + x j y j ) = 1 if and only if x j = y j , and (x jȳj + y jxj ) = 1 if and only if x j =ȳ j . To achieve perfect distinguishability of the resulting states through quantum measurement, which corresponds to having inner product h Δ = 0, we need to set a, b such that α = −2 (ab * ) becomes α = Ξ/Δ = 2 n /Δ − 1. Since α ∈ [−1, 1] for any two unit-norm quantum states, we can do that as long as Δ ≥ 1 2 2 n ; the promised functions f k and f l must differ on at least half of their outputs to be perfectly distinguishable through orthogonality of the results of U k A n |+ ⊗n , 0 and U l A n |+ ⊗n , 0 . For any k ∈ [2 n−1 , 2 n ], we can perfectly distinguish functions f k with exactly k outputs of 1 from the all-zero constant function f l using just one oracle access by using unitary defined by (ab * ) = − 2 n /k−1 2 ; note that here Δ = k. On a classical computer, the same task can be achieved quickly if k ∼ 2 n , but can take O (N ) = O (2 n ) function calls if k is close to 2 n−1 . As an example, consider a problem involving functions defined over n = 4 bits. Let f l be an all-zero function, that is, for any of the 16 possible input bitstrings, it returns null. Let f k be an imbalanced function with exactly k = 12 out of 16 inputs returning one, and with four null outputs. To discriminate f l from any possible f k , we need to find a, b such that (ab * ) = −(16/12 − 1)/2 = −1/6 and |a| 2 + |b| 2 = 1: we can have a = 1/ √ 6 − 1/ √ 3 and b = 1/ √ 3 + 1/ √ 6. In contrast to applying A prior to U f to help solve the problem of discriminating an all-zero function f l and a function f k with k ones and N − k zeros on outputs, we can consider the result of applying I n or E n instead. For I n , we arrive at the state N −1/2 |{j}|=N |j |0 for the all-zero f l , while for f k we arrive at N −1/2 |{j}|=N −k |j |0 + N −1/2 |{j}|=k |j |1 , which has inner product N −k N . Only the all-one function f k is distinguishable from the all-zero function f l . Using E n instead leads to N −1/2 |{j}|=N |j for f l and to N −1/2 |{j}|=N −k |j − N −1/2 |{j}|=k |j for f k . These have inner product of N −2k N . Here, only setting k = N/2, that is, using a balanced function f k as in the original Deutsch-Jozsa problem, leads to the ability to distinguish f l from f k without error using a single measurement. With minor changes, we can also, for any k ∈ [0, 2 n−1 ], distinguish a function with k zero outputs from an all-one constant function. The original Deutsch-Jozsa choice of k = 2 n−1 is the only case when we can distinguish f k from both all-zero and all-one functions f l . The Deutsch-Jozsa problem is often used to illustrate basic concepts in the gate model of quantum computing. Here, we show that the balance-vs-constant function promise problem lies at the edge of a family of promise problems involving discriminating between two subclasses of Boolean functions. The analysis of this broader family of problems can provide improved understanding of the conditions that lead to quantum speedup in Deutsch-Jozsa algorithm. Quantum sparse support vector machines Rapid solution of problems by quantum computation Machine learning & artificial intelligence in the quantum domain: a review of recent progress A fast quantum mechanical algorithm for database search Quantum algorithm for linear systems of equations Quantum Computation and Quantum Information word2ket: space-efficient word embeddings inspired by quantum entanglement Generalized Deutsch-Jozsa problem and the optimal quantum algorithm Quantum support vector machine for big data classification Defining and detecting quantum speedup A quantum-inspired classical algorithm for recommendation systems Acknowledgements. TA is supported by NSF grant CCF-1617710.