Faster than Classical Quantum Algorithm for dense Formulas of Exact Satisfiability and Occupation Problems

We present an exact quantum algorithm for solving the Exact Satisfiability (XSAT) problem, which belongs to the important NP-complete complexity class. The algorithm is based on an intuitive approach that can be divided into two parts: First, the identification and efficient characterization of a restricted subspace that contains all the valid assignments of the XSAT; Second, a quantum search in such restricted subspace. The quantum algorithm can be used either to find a valid assignment (or to certify that no solution exists) or to count the total number of valid assignments. The query complexities for the worst-case are respectively bounded by $O(\sqrt{2^{n-M^{\prime}}})$ and $O(2^{n-M^{\prime}})$, where $n$ is the number of variables and $M^{\prime}$ the number of linearly independent clauses. Remarkably, the proposed quantum algorithm results to be faster than any known exact classical algorithm to solve dense formulas of XSAT. As a concrete application, we provide the worst-case complexity for the Hamiltonian cycle problem obtained after mapping it to a suitable XSAT. Specifically, we show that the time complexity for the proposed quantum algorithm is bounded by $O(2^{n/4})$ for 3-regular undirected graphs, where $n$ is the number of nodes. The same worst-case complexity holds for $(3,3)$-regular bipartite graphs (the current best classical algorithm has a (worst-case) running time bounded by $O(2^{31n/96})$). Finally, when compared to heuristic techniques for XSAT, the proposed quantum algorithm is faster than the classical WalkSAT and Adiabatic Quantum Optimization for random instances with a density of constraints close to the satisfiability threshold, the regime in which instances are typically the hardest to solve. The proposed quantum algorithm can be also extended to the generalized version of the XSAT known as Occupation problem.


I. INTRODUCTION
Constraint satisfaction problems (CSPs) play a fundamental role in both theoretical and applied computer science. Even though the specific formulation of such problems may vary, all CSPs are characterized by a certain number M of clauses (or constraints) involving n boolean variables: An assignment is valid if and only if all the clauses are satisfied. The central question of many CSPs is either to exhibit a valid assignment or to prove that there is none. Despite its simplicity, answering this question is a hard task. Accordingly, many CSPs belong to the class of NP-complete problems [1, 2], namely the class of the hardest decision problems whose solution can be efficiently verified. The first problem proved to belong to the NP-complete class was the Satisfiability (SAT) problem [3]. In SAT problems, clauses are composed by variables which may appear either negated or not, and each clause is satisfied if it contains at least one true literal. The problem remains NP-complete even if any clause contains only three variables (3SAT) [1]. Although no theorem has yet confirmed this assumption, it is widely believed that no polynomial time algorithm exists to solve NP-complete problems: This is the famous question of P being different from NP. Indeed, the computational time for either heuristics (namely those algorithms which may provide a valid assignment in case of success, but without certifying that there is none in case of their failure) or exact algorithms (which always provide such certification) is expected to scale exponentially with the system size n.
Quantum computing can be used to solve classical problems and, in particular, CSPs.
In general, quantum algorithms are believed to have a better scaling than their classical counterparts. A few remarkable examples, like integer factorization [4], pattern matching [5] or solving systems of linear equations [6,7], achieve an exponential speedup over the known best classical alternative. However, it seems that only a polynomial speedup can be reached by quantum algorithms in the context of NP-complete problems, meaning that NP-complete problems remain hard to solve for both classical and quantum computers.
The Occupation problem (also called q-in-p-SAT) is a variant of the general Satisfiability (SAT) problem [8]. In this case, clauses are satisfied if and only if they contain exactly q ≥ 1 true literal. The case of q = 1 is also known as Exact Satisfiability (XSAT) and has been extensively studied [2]. Both Occupation and XSAT problems belong to the NP-Complete complexity class, even in the restricted case in which all the literals occur only unnegated [2]. FIG. 1. A necessary condition for a given assignment to satisfy a generic XSAT or Occupation problem clause is that the same assignment satisfies the corresponding XORSAT clause. Here, for example, R(x, y, z) represents a 1in3-SAT clause that is true if and only if exactly one betweenx, y and z is true. As a consequence, inside the set of all the possible 2 n assignments for the n variables, there is an intermediate set that contains all the solutions of a specific XSAT instance and that represents all the solutions to a related XORSAT instance.

XORSAT XSAT
Recently, 1in3-SAT (also known as X3SAT or Exact Cover) and 2in4-SAT problems have been used for the benchmark of both classical and quantum optimization algorithms [9][10][11][12] and for the theoretical understanding of the satisfiability transition in correspondence to the critical density of constraints α SAT [13] (specifically, α SAT is the maximum α = M/n such that randomly chosen instances have, with high probability, a solution in the limit of large number of variables). Indeed, the definition of NP-completeness regards the worst-case scenario while it has been shown that the randomly chosen instances are typically hard only close to the satisfiability transition α SAT [14][15][16].
In the last three decades, the upper bound for the computational time of exact algorithms for both XSAT and 1in3-SAT have progressively improved. The first algorithm proved to be faster than the trivial 2 n scaling (corresponding to the exhaustive enumeration of all the possible assignments) was provided by Schroeppel and Shamir [17]. Their algorithm solves a class of problems, of which XSAT is the most relevant, in time O(2 n/2 ) but in exponential space O(2 n/4 ). In the same year, a better result was provided by Monien, Speckenmeyer and Vornberger with an algorithm which runs in time O(2 0.2441n ) and requires polynomial space [18]. Later on, the upper bound for the computational complexity for both XSAT and 1in3-SAT has further lowered [19,20]. Currently, the best exact algorithm has been proposed by Byskov, Madsen and Skjerna, which solves XSAT and 1in3-SAT respectively in time O(2 0.2325n ) and O(2 0.1379n ) [21] and polynomial space. The better scaling has been achieved by branching only on those variables which appears in at least three clauses and solving the remaining problem as a perfect matching problem. Since the perfect matching is in the P-Class, what remains after the branching can then be solved in polynomial time.
Surprisingly, there are only few algorithms for which the complexity is computed in terms of the number of clauses M . Among them, Skjernaa presented an algorithm for XSAT with a time bound O(2 M ), but using exponential space [22]. A better algorithm which uses polynomial space and time O(2 0.2123M ) has been provided by Zhou and Yin [23]. Excluding the algorithm by Schroeppel and Shamir [17], all the algorithms mentioned above are branchand-reduce algorithms, which means that the variables (or alternatively the clauses) are iteratively removed before a reduction step [24,25].
While algorithms for many NP-Complete problems are well studied little is known for the case of their #P-Complete counterparts [26], namely the problem of counting the number of valid assignments. The counting version of many satisfiability problems is not only interesting from the mathematical point of view, but it has important applications in other fields like artificial intelligence [27,28] and simulation of physical systems (see, for example, the recent problem of boson sampling [29][30][31]). At the moment, the fastest algorithm for #XSAT and #1in3-SAT are respectively bounded by O(2 0.262n ) [32] and O(2 0.197n ) [33].
In this work, we present an exact algorithm for the XSAT and Occupation problems which runs, in the worst-case, in a time bounded by O(2 n−M ) on classical computer and by O( √ 2 n−M ) on a quantum computer, while using only polynomial space. Here, M ≤ min {n, M } is the number of linearly independent clauses. In the quantum case, with the term exact we do not intend that the algorithm is deterministic, but rather that the quantum algorithm has a bounded error to either provide a solution or certify that none exists which decreases exponentially with the number of repetitions.
For the corresponding counting problem, our classical and quantum algorithms are, respectively, bounded by O(2 n−M ) and O( √ V 2 n−M ), where V ≤ 2 n−M is the number of valid assignments not known a priori. We arrived to this result by introducing a novel reduction of the Occupation problem in order to identify a subset of assignments that is guaranteed to contain all the solutions (see Figure 1). Such reduction, that we refer to with the name XOR-Reduction, differs from the branch-and-reduce approach used in the past and leads to an efficient way to find and characterize the appropriate subset. The quadratic speedup for the quantum version of the algorithm is achieved by performing a Grover-type search [34][35][36][37] among the candidate solutions. As the main result, we found that our quantum algorithm is faster than the (known) best exact classical algorithms for dense formulas. For specific problems, it is even possible to find a lower bound for M expressed as a function of n only. As a concrete example, we consider the Hamiltonian cycle problem, namely the problem to find a closed and non-intersecting path that explores all the nodes of a given graph. Specifically, we show that the worst-case complexity for 3-regular undirected graphs is bounded by O 2 n/4 , where n is the number of nodes of the graph. The same bound holds for (3, 3)-regular bipartite graphs. As a comparison, the (known) best classical algorithm is bounded by O 2 31n/96 [38].
In addition, we analyze the performance of the proposed algorithm on random instances of Occupation problems to evaluate its computational cost for the typical-case. This analysis is particularly significant to estimate the actual advantage of our quantum algorithm in real world situations which, arguably, is represented by typical, rather than worst-case, instances.
We observe that, differently from the worst-case complexity, the typical computational cost is reduced when additional strategies inspired by the classical backtracking technique are applied [39,40]. Thus, we show that the proposed quantum algorithm still remains the fastest one (compared to classical heuristics like WalkSAT or quantum heuristics like Adiabatic Quantum Optimization) for random instances of 1in3-SAT and 2in4-SAT problems close to the satisfiability threshold [11,12], where the instances are typically the hardest ones to solve.
The paper is organized as follows: In Section II we present and characterize our XOR-Reduction algorithm. Section III is dedicated to the analysis of the worst-case complexity and includes the explicit construction of the quantum oracle involved in the Grover search.
The explicit application of our algorithm to the Hamiltonian cycle problem is the topic of Section IV, while in Section V we discuss classical and quantum backtracking techniques and evaluate the typical computational cost of the proposed algorithm. Finally, in the last Section we provide additional discussions and draw conclusions.

II. REDUCTION METHOD FOR XSAT AND OCCUPATION PROBLEMS
Any Occupation (q-in-p-SAT) problem instance is composed of n variables and M constraints, whereas each constraint accepts exactly p variables as input. More specifically, let R(x 1 , x 2 , . . . , x p ) be a boolean function that is true if and only if exactly q among all the p literals x i are true. An arbitrary instance I of the Occupation problem can be written as where {a 1 , a 2 , . . . , a p } indicates what variables are involved in the constraint a, and the symbol ∼ means that the variable may appear either negated or unnegated. In the rest of the paper, we will focus on locked instances of the Occupation problem, where all the variables appear in at least two clauses. Indeed, variables which appear in only one clause can be iteratively removed from the problem, while locked instances are typically hard to solve [13,41].
At the core of both the classical and quantum algorithms that we propose lies the observation that R is satisfied only if the corresponding XORSAT clause is also satisfied: where ⊕ represents the XOR sum (namely, the sum of integer modulo 2 using the convention 0 ≡ f alse and 1 ≡ true) and r = (q + 1) mod 2 . Therefore, any valid assignment {x 1 , . . . , x n } for I must be a valid assignment for the corresponding XORSAT instances, namely: It is important to observe that, unlike the original q-in-p-SAT problem, there exists a classical algorithm which solves the XORSAT problem in polynomial time. Indeed, any valid assignment for I XOR is also a solution of the following non-homogeneous linear problem [42,43]: where A is a M × n binary-matrix, for which A ai = 1 if and only if variable i appears (either negated or not) in clause a, and is zero otherwise. Here, b a = (ν a + q) mod 2 with ν a being the number of negations that appear in the clause a. To make the description more concrete, for the locked 1in3-SAT class of instances, the matrix A results to be sparse with exactly three ones in each row and at least two ones in each column.
Let us define {ξ 1 , ξ 2 , . . . , ξ k } as the set of k−independent vectors which solve the following kernel equation and denote by M = (n − k) ≤ min {n, M } the number of linearly independent (with arithmetic modulo 2) rows of the matrix A. Therefore, M represents the number of independent clauses. It is important to stress that all the theorems of linear algebra are still valid in arithmetic modulo 2. Hence, the set {ξ 1 , ξ 2 , . . . , ξ k } can be found in polynomial time using a classical computer (for example, via Gaussian elimination [42]). Moreover, all the solutions of Equation (4), i.e. all the valid assignment for I XOR , can be expressed as where v i ∈ {0, 1} andξ is a particular solution (of the inhomogeneous part) of Equation (4), that is to say Aξ = b. This implies that the number of valid assignment for I XOR is 2 k = 2 n−M . Observe that, given the rank-nullity theorem, the number of independent rows M is always smaller or equal to the total number of clauses M . Moreover, if A is a sparse random matrix, it happens that M /M = O(1) in the limit of large n and fixed α = M/n [43][44][45] (see Figure 2 for a numerical confirmation for locked instances of the 1in3-SAT problem).

III. WORST-CASE ANALYSIS FOR THE PROPOSED CLASSICAL AND QUAN-TUM ALGORITHMS
The classical algorithm that we introduce with this work relies on the fact that the configuration space of all the valid assignments for I XOR , which is given by Equation (6), is actually much smaller than the whole configuration space associated with n variables.
Consequently, it is possible to find a valid assignment for any specific instance I of the  only a polynomial number of operations, which is always possible since the Occupation problem belongs to the NP class (we provide an explicit construction in Figure 3 and analyze the number of gates required at the end of this Section). More specifically, the quantum oracleÔ corresponds to the operator defined bŷ with x given by Equation (6). The oracleÔ is central to the application of the Grover algorithm that finds a valid assignment for I and, as we show below, it can be implemented with only a polynomial overhead. Therefore, the Grover algorithm results to be quadratically faster than a classical exhaustive search in the reduced XORSAT solution space [34]. The same speedup holds even in the presence of multiple valid assignments [46][47][48][49] and represents the optimal speedup achievable for unstructured searches. Therefore, the prosed quantum algorithm uses only polynomial space and it is bounded in time by O( It is important to stress that the proposed quantum algorithm is exact, namely it is possible to certify that no valid assignments exist: This property is based on the possibility of running a generalized Grover quantum algorithm that preserves the quadratic speedup even if the number of target states (i.e. our valid assignments) is not known a priori, but larger then zero [48]. The case in which no solution is actually present can be included by slightly modifying n ≥3 /n F a s t e r t h a n c la s s ic a l X S A T F a s te r th a n c la s s ic a l 1 in 3 -S A T M'/n n ≥3 /n the quantum oracleÔ and forcing it to accept a specific configuration as a valid assignment and verifying that this represents the only (in this case "artificial") solution.
The Grover algorithm, with the same quantum oracleÔ, can also be applied for counting the number of valid assignments [47,48]. In this case, the number of calls ofÔ is bounded In order to provide an explicit example, in Figure 4 we compare the complexity of the proposed quantum to the (known) best classical algorithms for XSAT/1in3-SAT [21] (left panel) and #XSAT/#1in3-SAT [32,33] (right panel). In the comparison, we also take into account that the complexity for the best classical XSAT/1in3-SAT algorithm depends only in the number of variables which enter in at least three clauses n ≥3 , namely O(2 0.1379 n ≥3 ). As it has been originally shown by Cheeseman et al. [14] for the SAT problem (and successively for many other satisfiability problems including the Exact Satisfiability problem [13]), random instances are actually hard only when the problems' parameters are chosen so that instances have a similar probability to either have a valid assignment or not. In most cases, the relevant parameter is the density of constraints α = M/n: Indeed, for small α, random instances are likely to have a valid assignment while, for large α, random instances most likely do not have any valid assignment. On the contrary, at the satisfiability threshold α SAT , random instances might have or not a valid assignment with comparable probability. Interestingly, our quantum algorithm has a better scaling for dense formulas characterized by a sufficiently large density of independent constraints M /n, far away from the simple case of low α. Our algorithm results particularly fast for those instances which are, instead, expected to be hard for the classical XSAT/1in3-SAT algorithms (see Section V for the analysis of the proposed quantum algorithm by using random instances extracted at the satisfiability threshold).
Also the vice-versa seems true, as indicated by the apparent complexity of the trivial case in which the density of constraints is small. We discuss this fact more extensively in the final discussions. A careful reader could observe that the computational complexity of the (known) best classical algorithm for the XSAT/1in3-SAT is expressed only in terms of number of variables n and then, it might have a better computational complexity if the number of linearly independent clauses M would be taken into account. However, the classical algorithm is expected to perform the worse when the density n ≥3 /n becomes large, which is exactly the region where the proposed quantum algorithm performs the best.
To conclude this Section, we provide an explicit construction for the quantum oracleÔ that is polynomial in both space (i.e. number of ancilla qubits) and time (i.e. number of gates).
The quantum oracle accepts k qubits as input {|v 1 , . . . , |v k } (see Figure 3 for a graphical representation), so that a computational basis state represents a specific valid assignment for I XOR as described in Equation (6)). The oracleÔ per se is composed by four modules, as depicted in Figure 3. Their action is best described in the computational basis, even if they can (and obviously will) be applied to an initial superposition: (I) A module to construct the n-qubit state |x as given in Equation (6)

IV. APPLICATION TO THE HAMILTONIAN CYCLE PROBLEM
The Hamiltonian cycle (HC) problem, together with the SAT problem, can be considered one of the fundamental and most studied NP-complete problem [50]. The HC problem consists in finding a closed path (namely, an Hamiltonian cycle) which "visits" once, and only once, all the nodes of a given n-nodes graph G. Unlike the SAT problem, which is called a subset problem whose configuration space is 2 n , HC is a permutation problem whose configuration space is n! [38]. Compared to SAT, HC results much harder to solve and, at the moment, no algorithm has been found to obtain Hamiltonian cycles for arbitrary graphs with worst-case complexity better than O (2 n ) [51]. However, improved scalings have been obtained for bounded degree graphs [38,52]. For example, for 3-regular graphs, the (known) best classical algorithm has the worst-case complexity bounded by O 2 31n/96 [38]. In this Section we show that our quantum algorithm can find a Hamiltonian cycle in a time bounded by O 2 (K−2) n/4 , where K is the maximum degree of G. This result can be achieved by reducing the HC problem to an Occupation problem. In case of bounded graphs with K = 3, the worst-case complexity is given by O 2 n/4 . The same worst-case complexity holds for (3, 3)-regular bipartite graphs. For the rest of the Section, it is assumed that the graph G is an undirected graph with a single connected component and all the nodes having the same degree equals to K (to avoid trivial cases, we consider K ≥ 3). Results for bipartite graphs follow directly.
As a first step to apply the proposed XOR-Reduction, it is necessary to reduce the HC problem to an Occupation problem. The simplest way to achieve this is to define a variable One of the most important and successful classical techniques to solve satisfiability problems is the backtracking algorithm [39]. This technique has a very broad applicability and can be used whenever it is possible to efficiently verify, using an oracle P (x), if a partial assignment x is compatible with a solution or not. If such P (x) exists, the algorithm provides an efficient way to extend partial configurations to valid assignments, with the effect of drastically a heuristic h(x) which gives the position j of an indeterminate variable, the configuration x is expanded by fixing x j to either true or f alse. At this point, if P (x) returns that the partial configuration x can lead to a valid assignment, then another branching is made to the next indeterminate variable. Otherwise, if an unsatisfied clause already exists, the branch is "cut" and the algorithm starts to explore another branch. The set of partial configurations that the backtracking algorithms explores is called "decision tree". The computational complexity of the backtracking algorithm is therefore bounded by the size T (n) of the decision tree.
In general, for satisfiability problems, T (n) is expected to be exponential with the number of variables n. In Figure 5, a graphical illustration of the logic behind the backtracking algorithm is depicted.
Recently, an approach analogous to the backtracking algorithm has been applied in the context of quantum computation [40]. The central idea of the quantum backtracking algorithm consists in using a quantum walker [53][54][55][56] to explore the tree of partial configurations and then "mark" a valid assignment for the satisfiability problem. More precisely, given the two oracles P (x) and h(x) that can be evaluated in poly(n) operations, the quantum backtracking algorithm exhibits a valid assignment in a number of oracle calls bounded by O( T (n)), which is quadratically faster than its classical counterpart. Observe that the quantum backtracking algorithm provides the same quantum speedup as the Grover algorithm. However, the quantum backtracking algorithm can take advantage of the underlying structure of the satisfiability problem, having an overall better performance since T (n) ≤ 2 n and usually much smaller. In the rest of the Section, we show how to apply the quantum backtracking algorithm to the proposed quantum XOR-Reduction. We also compare the quantum XOR-Reduction algorithm with the classical WalkSAT heuristic [12] and the quantum Adiabatic Quantum Optimization [11] to solve random instances of both 1in3-SAT and 2in4-SAT at the satisfiability transition [13], and provide numerical evidence that our algorithm remains the fastest one.
As described in Section II, the proposed XOR-Reduction algorithm is based on a nontrivial (but polynomial in both space and time) reduction so that any valid assignment x of an Occupation problem is the combination (modulo 2) of {ξ 1 , ξ 2 , . . . , ξ k } linearly independent vectors plus the inhomogeneous solutionξ (see Eq. (6) for more details), namely: with {ξ 1 , ξ 2 , . . . , ξ k } andξ depending on the specific instance I of the Occupation problem.
The size of the configuration space spanned by v is 2 k and, since k = n − M (with M representing the number of independent clauses), it results to be effectively smaller than 2 n .
In Section III we show that the worst-case complexity is bounded by O(2 k/2 ). Nevertheless, we expect that the application of the quantum backtracking algorithm to the space spanned by ν would lead, on average, to a better performance. However, in order to apply the quantum backtracking technique to the proposed XOR-Reduction algorithm, it is necessary to rewrite the assignment x in Eq. (9) in a form suitable to verify whether a partial assignment can be extended to a solution or not. To achieve this goal, let us observe that one can always construct (in polynomial time and space) a linear transformation U acting on the vector v such that Eq. (9) can be rewritten as with P an appropriate permutation matrix that reorders the rows of K. More precisely, the application of U reduces the matrix K to a standard form comprising two blocks: The first k rows constitute the k × k identity matrix 1 while the lower block corresponds to the (n − k) × k matrix H. Since v is arbitrary, we can directly express Eq. (10) in terms of v as where x P and x differ only by the permutation P , namely only by a reorder of the variables.
It is important to observe that, after the transformation given by U , the assignment x P of the Occupation problem is divided in two parts: The first k variables correspond exactly to the arbitrary reduced configuration v , while the last (n − k) variables are a linear combination of the reduced configuration. The proposed quantum algorithm remains exact even if it is combined with the quantum backtracking technique [40]. In addition, the use of the quantum backtracking technique may give a better scaling on average than for the worst-case: Indeed, if no bounds on T (n) are known, the computational complexity in the worst-case remains the same obtained by using the Grover algorithm.
In Figure 6, we show the scaling of the proposed quantum XOR-Reduction, when the quantum backtracking technique is used, for random instances of locked 1in3-SAT and 2in4-SAT at the satisfiability threshold (which are respectively α SAT = 0.789 and α SAT = 0.707), where typical instances are the hardest to solve. In the implementation of the backtracking procedure, we have not optimized over the order of exploration of the decision tree. Therefore, a better performance might be reached by considering heuristics able to exploit the tree structure. In the figure, we also compare the quantum XOR-Reduction to the numerical results for the classical WalkSAT heuristic (numerical data have been extracted from Ref. [12]) and for the Adiabatic Quantum Optimization (AQO) (numerical data have been extracted from Ref. [11]). Unlike in [11,12], random instances are not pre-selected to have a unique solution and may or may not have any solution. In the figure, γ(n) is either the computational time scaling (for WalkSAT and AQO) or γ(n) = 1 n log 2 T (n) . The mean value of T (n) has been computed by averaging over 1000 random instances. For each random instance, the permutation matrix P in Eq. (10) has also been optimized in order to maximize the number of clauses in which the v variables appears, by running 100 time an optimization heuristic. The aforementioned reduction in Eq. (11) can be done in polynomial time and space before exploring the decision tree. As one can see, for both the satisfiability problems the quantum XOR-Reduction is the fastest among classical WalkSAT and AQO.
In principle, the quantum amplitude amplification can be applied to the classical WalkSAT Ref. [12] and Ref. [11], respectively. Results for the quantum WalkSAT have been obtained by assuming that a quantum amplitude amplification [57] would give a quadratic speedup with respect to the classical results. Here, γ(n) is either the computational time scaling (for WalkSAT and AQO) or γ(n) = 1 n log 2 T (n) , with T (n) the size of the decision tree at fixed number of variables n.
The average · is computed by sampling 1000 instances for each n. The scaling has been computed by fitting the numerical data (dashed lines intersects the data points actually used in the fit). Error bars for the proposed model represent the 10% − 90% interval of confidence. As one can see, the quantum version of the WalkSAT has a slightly better performance than the proposed quantum algorithm. However, numerical results in [11,12] have been obtained by pre-selecting instances with at least a valid assignment. Therefore, a worse performance is expected for both the classical and quantum WalKSAT heuristics when instances with no valid assignments are taken into account.
as well [57], obtaining a quadratic speedup with respect to the classical performance. To have an idea of the performance of the quantum WalkSAT (without explicitly running the quantum algorithm), we simply divide the computational time scaling γ(n) of the classical WalkSAT by a factor 2. In this case, as shown in Figure 6, the proposed quantum algorithm performs slightly worse. However, it is important to stress that the WalkSAT is a widely used and hence well optimized algorithm while, for the proposed quantum algorithm, there is still space for improvement (for example, by proposing a better heuristic for exploring the decision tree). Moreover, it is important to mention that, whereas both WalkSAT and AQO are not exact and may potentially run forever if the instance does not admit any valid assignment, the proposed quantum XOR-SAT reduction either provides a solution or certifies that no solutions exist in the given bound. In addition, the scaling proposed in Ref. [12] is obtained by pre-selecting instances with at least one ground states. A worse scaling is expected when instances are randomly chosen with an α close to the transition threshold, value for which many instances do not have any valid assignment. Finally, we want to stress that the proposed XOR-Reduction explores the XSAT configuration space in a non-local fashion. Hence, it can potentially exploit long-range structures that are, instead, precluded to local search algorithms like WalkSAT and AQO.

VI. CONCLUSIONS
In this work we have presented an exact quantum algorithm to solve instances of Exact Satisfiability or, more generally, of Occupation problems. The proposed quantum algorithm is based on a novel approach which consists to identify a restricted subspace in which all the valid assignments of an Occupation problem are contained (in our case, the solution space of an appropriate XORSAT problem) and whose elements can be efficiently enumerated.
This approach led us to the development of an algorithm able to solve a great variety of different Occupation problems, as opposed to dedicated solvers that address specific problems.
Moreover, it can be potentially used to reduce the computational cost of other satisfiability problems.
Regarding the worst-case scenario, we show that the proposed quantum algorithm finds a valid assignment (or certify that none exists) using only polynomial space and a number of oracle calls which is bounded by O( It is also interesting to observe that the proposed quantum algorithm monotonically improves the performance by increasing the density of clauses. However, this is not in contradiction with the naïve idea that instances of satisfiability problems are (typically) easy to solve for either very low or very dense formulas and hard to solve in the overlapping region, since the worst-case bound is strictly algorithmic dependent rather than problem dependent. As a concrete example, we provide the worst-case bound to solve the Hamiltonian cycle by directly applying our algorithm. More precisely, the quantum algorithm proposed in this work can find a Hamiltonian cycle (or certify that none exists) for 3-regular graphs in a time bounded by O 2 n/4 , where n is the number of nodes in the graph. The same worst-case bound holds for (3, 3)-regular bipartite graphs.
In addition, we showed that our quantum algorithm can be modified to include techniques as the quantum backtracking algorithm. We verified with numerical simulations that, on the typical instance, the performance is indeed better than the expected worst-case bound.
Noteworthy, the proposed quantum algorithm remains the fastest solver (compared to the classical WalkSAT heuristic and Adiabatic Quantum Optimization) close to the satisfiability transition for the locked 1in3-SAT and 2in4-SAT random instances.