An instance of Constraint Satisfaction Problem (CSP) is specified by a domain , a set of relations over domain , a set of variables, and a set of constraints of the form , where is one of the relations with arity and . An assignment to a set of variables is a mapping from to . An assignment to the set of variables of a constraint satisfies the constraint if evaluating the tuple of variables of the constraint according to the assignment, gives a tuple in the corresponding relation. An assignment to is a satisfying assignment of , if it satisfies all the constraints in . When seen as a decision problem, the question in CSP is whether the given instance has a satisfying assignment. On Boolean domains, that is , the size of an assignment is the number of variables that are mapped to .
Kolaitis and Vardi  made a distinction between nonuniform CSP, where the domain and the family of relations are fixed, and uniform CSP, where the input contains the domain and the list of tuples of each relation in the instance. They showed that uniform CSP is polynomial time equivalent to evaluation of conjunctive queries on relational databases. Feder and Vardi  observed that uniform CSP (which had already applications in artificial intelligence) and the homomorphism problem are polynomial time equivalent.
We study uniform CSP on Boolean domain in the settings of parameterized complexity. Parameterized Weighted CSP is defined as follows:
Many parameterized problems ask, given a structure (on univers ), if there is a set of a given cardinality (the parameter) such that the substructure induced by has a special property. Many of these problems can be readily reduced to -WCSP, such that the size parameter in the resulting -WCSP instance has the same value as the cardinality of the set looked for. A good example is -Clique, which, given an instance , asks if Graph has a clique of size . -Vertex-Cover is another example. These problems, however, can be expressed with -WCSP restricted to a finite family of relations. To capture the full expressiveness of -WCSP on Boolean domain, we introduce the following problem which is fixed parameter equivalent to -WCSP:
Our main contribution is the following containment theorem:
We prove the theorem by giving a tail-nondeterministic -restricted NRAM program (explained in the next section) deciding the problem. The significance of our containment result is that it is for the general problem, without restricting it to any (finite or infinite) family of relations.
Our work builds upon the work of Cesati , which, answering a longstanding open problem, proved that -Exact-Weighted-CNF is in . Downey and Fellow  had already showen that this problem is -hard and had conjectured that it either represents a natural degree intermediate between and , or is complete for . This problem is to decide, given a CNF without negation symbols and a natural number , whether there is an assignment of size , such that exactly one variable in each clause is mapped to . This can be seen as -WCSP restricted to a specific (infinite) family of Boolean relations, where a tuple is in a relation, if and only if the tuple has exactly one (this implies that -WCSP is -hard). Notice that because we do not restrict the problem to any family of relations, our result generalizes that of Cesati in at least two ways: The size of the tuples in the relation are not bounded, and the relations do not need to be symmetric (symmetric means that a tuple being in the relation depends only on the number of s in the tuple).
In fact, -Exact-Weighted-CNF is an example of an interesting special case of our containment result: -WCSP restricted to any (infinite) family of symmetric relations, provided that there is a bound on the size of the tuples of any relation in the family. Notice that the bound implies that the number of tuples of each relation is bounded by a polynomial in the arity of the relation. Thus, listing all the tuples in the input makes the size of input at most polynomially bigger, and uniform and nonuniform CSP in this case have the same complexity.
It is not hard to see that -WCSP is in , by reducing it to the problem of weighted circuit satisfiability for a class of circuits with bounded depth and weft : One for the conjunction of all constraints in the instance, one for disjunction of all satisfying assignments of each constraint, and one to specify each satisfying assignment of a constraint. So what is the significance of placing a problem from  down to ? First, although it is a fundamental conjecture that -complete problems are not fixed-parameter tractable, many of them can still be solved substantially faster than exhaustive search over all subsets. For example,  gives an time algorithm for -Clique. In contrast, the -complete problem -Dominating Set, was shown by  not to have such algorithms, unless CNF Satisfiablity has an time algorithm for some , which is an important open problem. Second, we can express the problems in  by a logic that is (conjectured to be) a proper subclass of that of  problems. This means that putting a problem in  decreases the descriptive complexity of the problem.
It is easy to see that -WCSP restricted to some finite family of Boolean relations (implying the arity of relations is bounded) is in . Notice that listing the tuples of all relations in the input adds just a constant to the size of input. Thus, uniform and nonuniform CSP in this case have the same complexity. These problems are studied by Marx , where he provides a dichotomy: If the family of relations has a property that he calls weak-separability, then the problem is fixed-parameter tractable (like -Vertex-Cover), otherwise it is -complete (like -Clique). This result is extended by Bulatov and Marx  to any finite domain.
For the basic concepts, definitions and notation of the parameterized complexity theory, we refer the reader to .
2 A Machine Characterization of 
We use a nondeterministic random access machine model. It is based on a standard deterministic random access machine (RAM) model. Registers store nonnegative integers. Register is the accumulator. The arithmetic operations are addition, subtraction (cut off at ), and division by two (rounded off), and we use a uniform cost measure. For more details see . We define a nondeterministic RAM, or NRAM, to be a RAM with an additional instruction “GUESS” whose semantics is:
Guess a natural number less that or equal to the number stored in the accumulator and store it in the accumulator.
Acceptance of an input by an NRAM program is defined as usually for non-deterministic machines. Steps of a computation of an NRAM that execute a GUESS instruction are called nonde terministic steps.
Let be a parameterization. An NRAM program is -restricted if there are computable functions and and a polynomial such that on every run with input the program
performs at most steps, at most of them being nondeterministic;
uses at most the first registers;
contains numbers in any register at any time.
Here , and .
A -restricted NRAM program is tail-nondeterministic if there is a computable function such that for every run of on any input all nondeterministic steps are among the last steps of the computation.
The machine characterization of reads as follows:
Theorem 2.3 ().
Let be a parameterized problem. Then if and only if there is a tail-nondeterministic -restricted NRAM program deciding .
3 Containment in 
First, we describe the following transformation, taken from Papadimitru and Yannakakis . Given an instance of -WCSP with the set of variables and parameter value , we construct a second instance with the same set of variables and the same parameter value, such that and have the same set of satisfying assignments of size . Furthermore, for each subset , there is at most one constraint with this set of variables, and each variable appears in each constraint at most once.
Because our domain is Boolean, henceforth we characterize an assignment with its support set, that is the set of variables that are mapped to .
Fix an order on . For each subset , if has a constraint such that the set of variables of the constraint are exactly (possibly with repetitions), then has the relation of arity and the constraint defined as follows. Each is a satisfying assignment of if and only if and is a satisfying assignment of every constraint in , such that the set of variables of are exactly (possibly with repetitions). The order of variables in is determined by the order on . Relation is defined accordingly. Notice that there is a one-to-one relation between the tuples in and satisfying assignments of .
For , we write , to mean that is (the support set of) a satisfying assignment of .
For a constraint in , define as a set with exactly the following elements:
if , and
for all , for all , such that .
For and , define
The main idea of the proof of Theorem 3.4 is the following lemma.
Let . if and only if , for all such that .
The forward direction follows from (1). We give a contrapositive proof for the backward direction. Suppose . If there exists a maximal subset such that , then there is such that . Thus, , and . Otherwise, we have (thus ) and . ∎
And a variant of the above:
Let . If and , then for some such that .
Adapt the proof of the backward direction of Lemma 3.2, by adding the requirement that . ∎
Our containment theorem reads as follows:
We give a tail-nondeterministic -restricted NRAM program deciding the problem. The result follows by Theorem 2.3. Let be the given instance with the set of variables and the parameter value . Program first constructs Instance from Instance as described above. This can easily be done in polynomial time. Let
Next, calculates two tries:
Trie 1 stores the values for all , where
Trie 2 stores the values
for all , and every such that
and using the recursive definition
and otherwise. The number of keys stored in Trie 1 and Trie 2 is bounded by a fixed polynomial in (size of ) and the stored values are of polynomial size. To verify this, remember that for each relation in , all the tuples in the relation are listed in the input. Thus has at most satisfying assignments, for all . It follows that the summation in the recursive definition (3) has at most summands, and moreover, is bounded by a fixed polynomial in .
The tries are arranged such that for all of size , the queries for and is answered in time (a general property of the trie data structure), and for nonexistent keys is returned. The tries can easily be computed in polynomial time.
Now the nondeterministic part of the computation starts: Program guesses variables in and checks it they are distinct. Let be the set of variables. Then iterates over subsets , and if , checks if
The summation in Check (4) has at most summands, thus Program Q is tail-nondeterministic.
We should show now that actually decides -WCSP. By construction, and have the same set of satisfying assignments of size . Thus, it is enough to prove, that on a computation branch of Program , where the set of guessed variables is of size , the following four statements are equivalent:
is a satisfying assignment of , that is, satisfies all the constraints in .
(By Lemma 3.2) For all , for all such that ,
(By swapping the universal quantifiers) For all such that T,
For all such that T, Check (4) is passed.
The equivalence of the first three statements should be evident. The rest of the proof is to show that the third and forth statements are equivalent.
Let and . There are two possibilities handled by the two claims below.
We rewrite the summation in (4) as
To complete the proof, we show that the inner summation (as a function of ) is the indicator function for the statement . That is, for all ,
In the second case, the summation is empty, thus it sums to . In the first case, by hypothesis, the set has a maximum, , with respect to inclusion. Thus, we have
Then, by plugging (3) for , it all sums to , as desired. ∎
Suppose is not empty and it does not have a maximum, for some . Then there is a such that and
for some , and
either is empty or it has a maximum, for all .
We have . Otherwise, is the maximum of , a contradiction.
Now, let . By Lemma 3.3, there is such that and . Notice that , thus we have .
If is empty or has a maximum, for all , then set (and ). Otherwise, we recursively apply the above argument to a counterexample (and ), getting sets and . Now, because and for all , this recursion ends in steps. Then, set (and ). ∎
The author thanks Johannes Köbler and Frank Fuhlbrück for helpful discussions.
-  Andrei A. Bulatov and Dániel Marx. Constraint satisfaction parameterized by solution size. SIAM Journal on Computing, 43(2):573–616, 2014. https://doi.org/10.1137/120882160.
-  Marco Cesati. Perfect code is W-complete. Information Processing Letters, 81(3):163–168, 2002. https://doi.org/10.1016/S0020-0190(01)00207-1.
-  Yijia Chen, Jörg Flum, and Martin Grohe. Machine-based methods in parameterized complexity theory. Theoretical Computer Science, 339(2-3):167–199, 2005. https://doi.org/10.1016/j.tcs.2005.02.003.
-  Rod G. Downey and Michael R. Fellows. Fixed-parameter tractability and completeness II: On completeness for W. Theoretical Computer Science, 141(1-2):109–131, 1995. https://doi.org/10.1016/0304-3975(94)00097-3.
-  Tomás Feder and Moshe Y. Vardi. The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory. SIAM J. Comput., 28(1):57–104, 1998. https://doi.org/10.1137/S0097539794266766.
-  Jörg Flum and Martin Grohe. Parameterized Complexity Theory. Texts in Theoretical Computer Science. An EATCS Series. Springer, 2006. https://doi.org/10.1007/3-540-29953-X.
-  Phokion G. Kolaitis and Moshe Y. Vardi. Conjunctive-query containment and constraint satisfaction. Journal of Computer and System Sciences, 61(2):302–332, 2000. https://doi.org/10.1006/jcss.2000.1713.
-  Dániel Marx. Parameterized complexity of constraint satisfaction problems. Computational Complexity, 14(2):153–183, 2005. https://doi.org/10.1007/s00037-005-0195-9.
-  Jaroslav Nešetřil and Svatopluk Poljak. On the complexity of the subgraph problem. Commentationes Mathematicae Universitatis Carolinae, 26(2):415–419, 1985.
-  Christos H. Papadimitriou and Mihalis Yannakakis. On the complexity of database queries. Journal of Computer and System Sciences, 58(3):407–427, 1999. https://doi.org/10.1006/jcss.1999.1626.
-  Mihai Patrascu and Ryan Williams. On the possibility of faster SAT algorithms. In Proceedings of the Twenty-First Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2010, Austin, Texas, USA, January 17-19, 2010, pages 1065–1075, 2010. https://doi.org/10.1137/1.9781611973075.86.