NP PROBLEM IN QUANTUM ALGORITHM

Masanori Ohya and Natsuki Masuda Science University of Tokyo Noda City, Chiba 278-8510, JAPAN

Abstract

In complexity theory, there exists a famous unsolved problem whether NP can be P or not. In this paper, we discuss this aspect in SAT (satisfiability) problem, and it is shown that the SAT can be solved in plynomial time by means of quantum algorithm.

1 Introduction

Although the ability of computer is highly progressed, there are several problems which may not be solved effectively, namely, in polynomial time. Among such problems, NP problem and NP complete problem are fundamental. It is known[5] that all NP complete problems are equivalent and an essential question is whether there exists an algorithm to solve a NP complete problem in polynomial time.

After pioneering works of Feymann[4] and Deutsch[1], several important works have been done on quantum algorithms by Deutsch and Josa[2], Shor[7], Ekert and Josa[3] and many others[6]. The computation in quantum computer is performed on a tensor product Hilbert space, and its fundamental point is to use quantum coherence of states. All mathematical features of quantum computer and computation are summarized in [6].

In this paper, we discuss the quantum algorithm of the SAT problem and point out that this problem, hence all other NP problems, can be solved in polynomial time by quantum computer if the superposition of two orthogonal vectors |0⟩ and |1⟩ is physically detected.

2 SAT Problem

Let X ≡ \{x_{1}, ⋯, x_{n}\} be a set. Then x_{k} and its negation \overline{x}_{k} (k = 1, 2, ⋯, n) are called literals and the set of all such literals is denoted by X′ = \{x_{1}, \overline{x}_{1}, ⋯, x_{n}, \overline{x}_{n}\}. The set of all subsets of X′ is denoted by F(X′) and an element C ∈ F(X′) is called a clause. We take a truth assignment to all variables x_{k}. If we can assign the truth value to at least one element of C, then C is called satisfiable. When C is satisfiable, the truth value t(C) of C is regarded as true, otherwise, that of C is false. Take the truth values as ”true↔ 1, false↔ 0”. Then

C is satisfiable iff t(C) = 1.

Let L = {0, 1} be a Boolean lattice with usual join ∨ and meet ∧, and t(x) be the truth value of a literal x in X. Then the truth value of a clause C is written as t(C) ≡ ∨_{x∈C}t(x). Moreover the set C of all clauses C_{j} (j = 1, 2, ⋯ m) is called satisfiable iff the meet of all truth values of C_{j} is 1; t(C) ≡ ∧_{j=1}^{m}t(C_{j}) = 1. Thus the SAT problem is written as follows:

Definition 1. SAT Problem: Given a set X ≡ {x_{1}, ⋯, x_{n}} and a set C = {C_{1}, C_{2}, ⋯, C_{m}} of clauses, determine whether C is satisfiable or not.

That is, this problem is to ask whether there exsits a truth assignment to make C satisfiable.

It is known[5] in usual algorithm that it is polynomial time to check the satisfiability only when a specific truth assignment is given, but we can not determine the satisfiability in polynomial time when an assignment is not specified.

3 Quantum Algorithm of SAT

Let 0 and 1 of the Boolean lattice L be denoted by the vectors |0⟩ ≡ ( \begin{matrix}1 \\ 0 \end{matrix} )

and |1⟩ ≡ ( \begin{matrix}0 \\ 1 \end{matrix} ) in the Hilbert space C^{2}, respectively. That is, the vector

|0⟩ corresponds to falseness and |1⟩ does to truth.

As we explained in the previous section, an element x ∈ X can be denoted by 0 or 1, so by |0⟩ or |1⟩ . In order to describe a clause C with at most n length by a quantum state, we need the n-tuple tensor product Hilbert space H ≡ ⊗_{1}^{n}C^{2}. For instance, in the case of n = 2, given C = {x_{1}, x_{2}} with an assignment x_{1} = 0 and x_{2} = 1, then the corresponding quantum state vector is |0⟩⊗|1⟩ , so that the quantum state vector describing C is generally written by |C⟩ = |x_{1}⟩ ⊗ |x_{2}⟩ ∈ H with x_{k} = 0 or 1 (k=1,2).

The quantum computation is performed by a unitary gate constructed from several fundamental gates such as Not gate, Controlled-Not gate, Controlled-Controlled Not gate [3, 6]. Once X ≡ {x_{1}, ⋯, x_{n}} and C = {C_{1}, C_{2}, ⋯, C_{m}} are given, the SAT is to find the vector |f (C)⟩ ≡ ∧_{j=1}^{m} ∨_{x∈C_{j}} t(x), where t(x) is |0⟩ or |1⟩ when x = 0 or 1, respectively, and t(x) ∧ t(y) ≡ t(x ∧ y), t(x) ∨ t(y) ≡ t(x ∨ y).

We consider the quantum algorithm for the SAT problem. Since we have n variables x_{k} (k = 1, ⋯ n) and a quantum computation produces some dust bits, the assignments of the n variables and the dusts are represented by n qubits and l qubits in the Hilbert space ⊗_{1}^{n}C^{2} ⊗_{1}^{l} C^{2}. Moreover the resulting state vector |f (C)⟩ should be added, so that the total Hilbert space is

H ≡ ⊗_{1}^{n} C^{2} ⊗_{1}^{l} C^{2} ⊗ C^{2}.

Let us start the quantum computation of SAT problem from an initial vector |v_{0}⟩ ≡ ⊗_{1}^{n} |0⟩⊗_{1}^{l}|0⟩⊗|0⟩ when C contains n Boolean variables x_{1}, ⋯ x_{n}. We

apply the discrete Fourier transformation denoted by U_{F} ≡ ⊗_{1}^{n} \frac{1}{\sqrt{2}} ( \begin{matrix}1 & 1 \\ 1 & −1 \end{matrix} )

to the part of the Boolean variables of the vector |v_{0}⟩ , then the resulting state vector becomes

|v⟩ ≡ U_{F} ⊗_{1}^{l} I |v_{0}⟩ = \frac{1}{\sqrt{2^{n}}} ⊗_{1}^{n} (|0⟩ + |1⟩) ⊗_{1}^{l} |0⟩ ⊗ |0⟩ ,

where I is the identity matrix in C^{2}. This vector can be written as

|v⟩ = \frac{1}{\sqrt{2^{n}}} ∑_{x_{1},···,x_{n}=0}^{1} ⊗_{j=1}^{n} |x_{j}⟩ ⊗_{1}^{l} |0⟩ ⊗ |0⟩ .

Now, we perform the quantum computer to check the satisfiability, which will be done by a unitary operator U_{f} properly constructed by unitary gates. Then after the computation by U_{f}, the vector |v⟩ goes to

|v_{f}⟩ ≡ U_{f} |v⟩ = \frac{1}{\sqrt{2^{n}}} ∑_{x_{1},···,x_{n}=0}^{1} U_{f} ⊗_{j=1}^{n} |x_{j}⟩ ⊗_{1}^{l} |0⟩ ⊗ |0⟩

= \frac{1}{\sqrt{2^{n}}} ∑_{x_{1},···,x_{n}=0}^{1} ⊗_{j=1}^{n} |x_{j}⟩ ⊗_{i=1}^{l} |y_{i}⟩ ⊗ |f (x_{1}, ⋯, x_{n})⟩ ,

where f (x_{1}, ⋯, x_{n}) ≡ f (C) because C contains x_{1}, ⋯ x_{n}, and |y_{i}⟩ are the dust bits produced by the computation. As we will explain in an example below, the unitary operator U_{f} is concretely constructed.

The final step to check the satisfiability of C is to apply the projection E ≡ ⊗_{1}^{n+l}I ⊗|1⟩ ⟨1| to the state |v_{f}⟩ , mathematically equivalent , to compute the value ⟨v_{f}| E |v_{f}⟩ . If the vector E |v_{f}⟩ exists or the value ⟨v_{f}| E |v_{f}⟩ is not 0, then we conclude that C is satisfiable.The value of ⟨v_{f}| E |v_{f}⟩ corresponds to that of the ramdom algorithm as we will see in an example of the next section and it may or may not be obtained in polynominal time. Let us consider an operator V_{θ}, given by

V_{θ} ≡ ⊗_{1}^{n+l}(A |0⟩ ⟨0| + B |1⟩ ⟨1|) ⊗ e^{iθf(C)}I,

and apply it to the vector |v_{f}⟩ , where A ≡ \frac{1}{\sqrt{2}} ( \begin{matrix}1 & 1 \\ 1 & −1 \end{matrix} ) and B ≡ \frac{1}{\sqrt{2}} ( \begin{matrix}1 & 1 \\ −1 & 1 \end{matrix} )

and θ is a certain constant describing the phase of the vector |f (C)⟩ . The resulting vector is the superposition of two vectors with some constants α, β such as

V_{θ} |v_{f}⟩ = \frac{1}{\sqrt{2^{n+l}}} ⊗_{1}^{n+l} (|0⟩ + |1⟩) ⊗ (α |0⟩ + βe^{iθ} |1⟩) ,

one of which is polarized with θ and another is non-polarized. The existence of the mixture of two vectors |0⟩ and e^{iθ} |1⟩ is a starting point of quantum computation, which implies the satisfiability.

4 Example of Computation

Let us explain the quantum computation for SAT in tha case X = {x_{1}, x_{2}, x_{3}} and C = \{\{x_{1}\} , \{x_{2}, x_{3}\} , \{x_{1}, \overline{x}_{3}\} , \{\overline{x}_{1}, \overline{x}_{2}, x_{3}\}\} . The resulting state |f (x_{1}, x_{2}, x_{3})⟩ is written as

|f (x_{1}, x_{2}, x_{3})⟩ = |x_{1}⟩ ∧ (|x_{2}⟩ ∨ |x_{3}⟩) ∧ (|x_{1}⟩ ∨ |\overline{x}_{3}⟩) ∧ (|\overline{x}_{1}⟩ ∨ |\overline{x}_{2}⟩ ∨ |x_{3}⟩)

In the quantum computation, it is not necessary to substitute all values of x_{j} (j = 1, 2, 3) as the classical computation, we have only to use a unitary operator U_{f} for the computation of |f (x_{1}, x_{2}, x_{3})⟩ . This unitary operator U_{f} is constructed as follows: Let U_{NOT} , U_{CN} and U_{CCN} be Not gate on C^{2}, Controlled-Not gate on C^{2} ⊗ C^{2} and Controlled-Controlled-Not gate on C^{2} ⊗ C^{2} ⊗ C^{2}, respectively, which are given by

U_{NOT} = |0⟩ ⟨1| + |1⟩ ⟨0| U_{CN} = |0⟩ ⟨0| ⊗ I + |1⟩ ⟨1| ⊗ (|0⟩ ⟨1| + |1⟩ ⟨0|) U_{CCN} = |0⟩ ⟨0| ⊗ |0⟩ ⟨0| ⊗ I + |0⟩ ⟨0| ⊗ |1⟩ ⟨1| ⊗ I + |1⟩ ⟨1| ⊗ (|0⟩ ⟨0| ⊗ |1⟩ ⟨0|)

Then the unitary operator U_{f} is determined by the combination of the above three unitaries as

U_{f} ≡ U_{36}U_{35} ⋯ U_{2}U_{1},

where, for instance,

U_{1} ≡ |0⟩ ⟨0| ⊗_{1}^{23} I + |1⟩ ⟨1| ⊗_{1}^{2} I ⊗ (|0⟩ ⟨1| + |1⟩ ⟨0|) ⊗_{1}^{20} I
U_{2} ≡ I ⊗ |0⟩ ⟨0| ⊗_{1}^{22} I + I ⊗ |1⟩ ⟨1| ⊗_{1}^{2} I ⊗ (|0⟩ ⟨1| + |1⟩ ⟨0|) ⊗_{1}^{19} I
U_{3} ≡ ⊗_{1}^{2}I ⊗ |0⟩ ⟨0| ⊗_{1}^{21} I + ⊗_{1}^{2}I ⊗ |1⟩ ⟨1| ⊗_{1}^{2} I ⊗ (|0⟩ ⟨1| + |1⟩ ⟨0|) ⊗_{1}^{18} I

and other U_{4}, ⋯, U_{36} are similarly constructed (see the computation diagram 1). In this case, we need 20 dust bits (the number of the dust bits needed in a general case is counted in the next section), so that U_{f} is operated on the Hilbert space ⊗_{1}^{24}C^{2}.

Starting from the initial vector |v_{0}⟩ ≡ ⊗_{1}^{3} |0⟩ ⊗_{1}^{20} |0⟩ ⊗ |0⟩ , the final vector is

|v_{f}⟩ = U_{36} ⋯ U_{1}U_{F} |v_{0}⟩ = U_{f}U_{F} |v_{0}⟩
= \frac{1}{\sqrt{2^{3}}} (|0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1; 0⟩
+ |1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1; 0⟩
+ |0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1; 0⟩
+ |0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0; 0⟩
+ |1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0; 0⟩
+ |1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1; 1⟩
+ |0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0; 0⟩
+ |1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1; 1⟩) ,

where we used the notation |x_{1}, x_{2}, x_{3}, y_{1}, ⋯, y_{20}; f (x_{1}, x_{2}, x_{3})⟩ ≡ ⊗_{j=1}^{3} |x_{j}⟩ ⊗_{i=1}^{20} |y_{i}⟩ ⊗ |f (x_{1}, x_{2}, x_{3})⟩ Applying the operator V_{θ} of the previous section to the vector |v_{f}⟩ , we obtain

\frac{1}{\sqrt{2^{23}}} ⊗_{1}^{23} (|0⟩ + |1⟩) ⊗ (\frac{\sqrt{3}}{2} |0⟩ + \frac{1}{2}e^{iθ} |1⟩),

which is the superposition of two vectors |0⟩ and the polarized vector |f (C)⟩ = |1⟩ . Moreover when we measure the operator E ≡ ⊗_{1}^{23}I ⊗ |1⟩ ⟨1| in the state V_{θ} |v_{f}⟩ , we obtain

⟨v_{f}V_{θ}| E |V_{θ}v_{f}⟩ = \frac{1}{4}.

These conclude the satisfiability of C.

5 Complexity of Quantum Algorithm for SAT

Here we discuss the number of steps for the quantum algorithm of the SAT problem. The size of input with n variables x_{k} and their negations \overline{x}_{k} (k = 1, ⋯, n)and also C = {C_{1}, ⋯, C_{m}} is N_{1} = log n + 2mn like the classical algorithm because |C_{k}| , the number of the elements in C_{k}, is at most n, so that it is the polynominal order (O(mn)). The number of the dust bits to compute f (C) is caused from that of the operations and substitutions of AND and OR, so that the maximum number (complexity) N_{2} of the dust bits needed is the same as that of the classical case, namely, N_{2} = (the numbers of AND and OR operations )− (the steps to take the negation) = (5mn − 1) − mn = 4mn − 1.

The steps N_{3} needed to obtain the vector |f (C)⟩ is counted as follows: Fisrt take 1 step for the discrete Fourier transform to get the entangled vector, and we need 3mn steps for truth assignment and substitution to n variables. Secondly to compute the logical sum in each clause and take their logical product, the complexity corresponding to the logical sum, whose gate is made from four unitaries, is 4m(2n − 1) and that corresponding to the logical product is m − 1. Thus N_{3} = 1 + 3mn + 4m(2n − 1) + m − 1 = 11mn − 3m.

Finally to check the satisfiability of C, we have to look at the situation of |f(C)⟩ registered at the last position of the tensor product state such as the last position of physical registers (e.g., spins) lined up. This can be easily done by applying the operator V_{θ} to |v_{f}⟩ , and the resulting vector is a superposition of two vectors |0⟩ and e^{iθ} |1⟩ . We can obtain in polynominal time (at most n + l + 1) the vector |V_{θ}v_{f}⟩ and the value of < V_{θ}v_{f}, EV_{θ}v_{f}>= |β|^{2} for the projection E if needed. The existence of the above superposition is a starting point of quantum computation, so that it should be physically detected being different from both |0⟩ and |1⟩ , which implies the satisfiability. Thus the quantum algorithm of the SAT problem is in polynominal order.

Acknowledgment: One of the authors (MO) appreciate Professor A. Ekert for his critical reading and valuable comments.

References

[1] D. Deutsch, Quantum theory, the Church-Turing principle and the universal quantum computer, Proc. of Royal Society of London series A,

400, pp.97-117, 1985.

[2] D. Deutsch and R. Jozsa, Rapid solution of problems by quantum computation, Proc. of Royal Society of London series A, 439, pp.553-558, 1992.

[3] A. Ekert and R.Jozsa, Quantum computation and Shor’s factoring algorithm, Reviews of Modern Physics, 68 No.3,pp.733-753, 1996.

[4] R. Feymann, Quantum mechanical computer, Optics News, 11 ,pp.11-20, 1985.

[5] M. Garey and D. Johnson, ”Computers and Intractability - a guide to the theory of NP-completeness”, Freeman, 1979.

[6] M. Ohya,“Mathematical Foundation of Quantum Computer”, “Mathematical Foundation of Quantum Information”, Maruzen Publ. Company, 1998

[7] P.W. Shor, Algorithm for quantum computation : Discrete logarithm and factoring algorithm, Proceedings of the 35th Annual IEEE Symposium on Foundation of Computer Science, pp.124-134, 1994.