arXiv:cs/0611018v1 [cs.LO] 3 Nov 2006ccs.neu.edu ... because the formula Φ has prefix ......

30
arXiv:cs/0611018v1 [cs.LO] 3 Nov 2006 SIGACT News Logic Column 17 Riccardo Pucella Northeastern University Boston, MA 02115 USA [email protected] I am always looking for contributions. If you have any suggestion concerning the content of the Logic Column, or if you would like to contribute by writing a column yourself, feel free to get in touch with me. A Rendezvous of Logic, Complexity, and Algebra 1 Hubie Chen Universitat Pompeu Fabra 1 Pop quiz Recall the propositional satisfiability (SAT) problem: we are given a propositional formula such as (s t) (¬s) (¬u s ∨¬t) (¬s t) consisting of a conjunction of clauses, where a clause is a disjunction of literals; a literal is either a variable v (a positive literal) or the negation of a variable ¬v (a negative literal). We are to decide if there is an assignment to the variables satisfying the formula, that is, an assignment under which every clause contains at least one true literal. The example formula is satisfied by the assignment f where f (s)= f (u)= false and f (t)= true. The SAT problem is famously regarded as the first natural problem to be identified as NP-complete. Two special cases of the SAT problem that are well-known to be decidable in polynomial time are the 2-SAT problem, in which every clause is a 2-clause, a clause having exactly two literals, as in the formula (¬u v) (¬u ∨¬v) (¬v w) (¬w t) (¬t v) and the HORN-SAT problem, in which every clause is a Horn clause, a clause having at most one positive literal, as in the formula (¬y x 1 ) (¬y ∨¬x 1 y) (¬x 2 ∨¬y) (¬x 1 x 2 ). Now consider the QUANTIFIED SAT problem. We are given a quantified formula such as vtuw((¬u v) (¬u ∨¬v) (¬v w) (¬w t) (¬t v)) 1 c Hubie Chen, 2006. ACM SIGACT News 1 Vol. —, No. —

Transcript of arXiv:cs/0611018v1 [cs.LO] 3 Nov 2006ccs.neu.edu ... because the formula Φ has prefix ......

arX

iv:c

s/06

1101

8v1

[cs.

LO]

3 N

ov 2

006

SIGACT News Logic Column 17

Riccardo PucellaNortheastern UniversityBoston, MA 02115 [email protected]

I am always looking for contributions. If you have any suggestion concerning the content of the LogicColumn, or if you would like to contribute by writing a columnyourself, feel free to get in touch with me.

A Rendezvous of Logic, Complexity, and Algebra1

Hubie ChenUniversitat Pompeu Fabra

1 Pop quiz

Recall thepropositional satisfiability(SAT) problem: we are given a propositional formula such as

(s ∨ t) ∧ (¬s) ∧ (¬u ∨ s ∨ ¬t) ∧ (¬s ∨ t)

consisting of a conjunction ofclauses, where a clause is a disjunction of literals; a literal is either a variablev (a positive literal) or the negation of a variable¬v (a negativeliteral). We are to decide if there is anassignment to the variables satisfying the formula, that is, an assignment under which every clause containsat least one true literal. The example formula is satisfied bythe assignmentf wheref(s) = f(u) = false

andf(t) = true. The SAT problem is famously regarded as the first natural problem to be identified asNP-complete.

Two special cases of the SAT problem that are well-known to bedecidable in polynomial time are the2-SAT problem, in which every clause is a2-clause, a clause having exactly two literals, as in the formula

(¬u ∨ v) ∧ (¬u ∨ ¬v) ∧ (¬v ∨ w) ∧ (¬w ∨ t) ∧ (¬t ∨ v)

and the HORN-SAT problem, in which every clause is aHorn clause, a clause having at most one positiveliteral, as in the formula

(¬y ∨ x1) ∧ (¬y′ ∨ ¬x1 ∨ y) ∧ (¬x2 ∨ ¬y) ∧ (¬x1 ∨ x2).

Now consider the QUANTIFIED SAT problem. We are given a quantified formula such as

∀v∀t∃u∃w((¬u ∨ v) ∧ (¬u ∨ ¬v) ∧ (¬v ∨ w) ∧ (¬w ∨ t) ∧ (¬t ∨ v))

1 c© Hubie Chen, 2006.

ACM SIGACT News 1 Vol. —, No. —

or∀y∀y′∀y′′∃x1∃x2((¬y ∨ x1) ∧ (¬y′ ∨ ¬x1 ∨ y) ∧ (¬x2 ∨ ¬y) ∧ (¬y′′ ∨ ¬x1 ∨ x2)),

that is, a formula consisting of a conjunction of clauses preceded by a quantifier prefix in which all of thevariables are quantified. Our task is to decide if the formulais true or false.

In general, QUANTIFIED SAT is known to be PSPACE-complete. However, we can very wellconsiderthe special cases QUANTIFIED 2-SAT and QUANTIFIED HORN-SAT, where the clauses are restricted tobe 2-clauses and Horn clauses, respectively. These two special cases of QUANTIFIED SAT are known tobe polynomial-time decidable [2, 43]. Let us focus onΠ2 (or “∀∃”) formulas, that is, quantified formulaswhere the quantifier prefix consists of a sequence of universally quantified variables followed by a sequenceof existentially quantified variables (as in the above two examples). I claim that there is asimpleproofthat theΠ2 formulas of QUANTIFIED 2-SAT and QUANTIFIED HORN-SAT are polynomial-time tractable.More precisely, I claim that there are simple reductions from QUANTIFIED 2-SAT to 2-SAT and fromQUANTIFIED HORN-SAT to HORN-SAT that can be justified by short proofs. At this point, I would like tokindly ask the reader to stop reading, and attempt to demonstrate this.

Warning: spoilers ahead. I now present the claimed reductions and accompanying proofs. Let us beginwith QUANTIFIED HORN-SAT. What do we want to do? We are given aΠ2 formula

Φ = ∀y1 . . . ∀ym∃x1 . . . ∃xnφ

whereφ is the conjunction of Horn clauses, and we want to efficientlydecide ifΦ is true. LetYΦ denote theuniversally quantified variables ofΦ, and letXΦ denote the existentially quantified variables ofΦ. Here,because the formulaΦ has prefix classΠ2, we may observe that it is true if and only if for every assignmentf : YΦ → {true, false}, there exists an extensionf ′ : YΦ∪XΦ → {true, false} of f under which the clausesφ is true. How might we check this property?

Given asingleassignmentf : YΦ → {true, false}, we can certainly check efficiently whether or not ithas an extensionf ′ : YΦ ∪XΦ → {true, false} under whichφ is true: we simply instantiate the universallyquantified variablesYΦ according tof , and then use any polynomial-time algorithm for HORN-SAT todecide if the resulting HORN-SAT formula is satisfiable. However, if we are to act in polynomial time, wedefinitely do not have time to perform this check forall assignments to the universally quantified variables,as there are2|YΦ| such assignments—too many!

Interestingly enough, it turns out that it suffices to perform the “extension check” for a restricted setof assignments, in order to determine truth of the formulaΦ. For an integerj ≥ 1 and a constantb ∈{true, false}, let [≤ j, b]Φ denote the set of all assignmentsf : YΦ → {true, false} to the universallyquantified variables ofΦ such that the number of variables mapped tob is less than or equal toj. Forexample,[≤ 1, false]Φ contains the assignment sending all variables inYΦ to true, and all assignmentson YΦ in which exactly one variable is sent tofalse. I claim thatΦ is true as long as all assignments in[≤ 1, false]Φ have a satisfying extension.

Proposition 1.1. Let Φ be an instance ofQUANTIFIED HORN-SAT having prefix classΠ2. The formulaΦ is true if and only if for every assignmentf ∈ [≤ 1, false]Φ, there exists an extensionf ′ : YΦ ∪ XΦ →{true, false} of f satisfying all clauses ofΦ.

Clearly, this proposition yields the correctness of the following procedure for deciding a formulaΦfrom our class: for every assignmentf ∈ [≤ 1, false]Φ, instantiate the variablesYΦ according tof anduse a polynomial-time algorithm for HORN-SAT to check if the resulting clauses are satisfiable; if theyare satisfiable for every assignmentf , return “true”, otherwise, return “false”. Since—relative to the size

ACM SIGACT News 2 Vol. —, No. —

of Φ—there are polynomially many (in fact, linearly many) assignments in[≤ 1, false]Φ this procedure isindeed a polynomial-time procedure.

In order to prove the proposition, we will make use of the following concept. Say that a proposi-tional formulaψ is preservedby an operationg : {true, false}k → {true, false} if for any k assignmentsf1, . . . , fk under whichψ is true, the formulaψ is also true under the assignmentg(f1, . . . , fk) defined by(g(f1, . . . , fk))(v) = g(f1(v), . . . , fk(v)) for all variablesv.

Example 1.2. We can verify that the boolean AND operation∧ preserves any Horn clause. Letl1 ∨ . . .∨ lcbe a Horn clause, where theli denote literals, and letvi denote the variable underlying the literalli. Letf1, f2 be assignments under which the clause is true. If one of the assignmentsf1, f2 satisfies a negativeliteral li = ¬vi, then (∧(f1, f2))(vi) = false and the clause is true under∧(f1, f2). Otherwise, everynegative literal is false under bothf1 andf2, and sincef1, f2 are satisfying assignments, there must be apositive literallj = vj with f1(vj) = f2(vj) = true. Then(∧(f1, f2))(vj) = true and the clause is trueunder∧(f1, f2). �

Example 1.3. Now let φ = C1 ∧ . . . ∧ Cl be a conjunction of clauses for which there is an operationg : {true, false}k → {true, false} preserving each clauseCi. We can verify thatφ itself is preserved byg. Indeed, letf1, . . . , fk be any assignments under whichφ is true. Then, consider any clauseCi. TheclauseCi is true under all of the assignmentsf1, . . . , fk. Sinceg preservesCi we have thatCi is true underg(f1, . . . , fk), and since our choice ofCi was arbitrary we have thatφ is true underg(f1, . . . , fk). �

From these two examples, we see that every conjunction of Horn clauses is preserved by the operation∧.With this fact in hand, we may now turn to the proof of the proposition.Proof. (Proposition 1.1) The “only if” direction is clear, so we prove the “if” direction. Letm denote|YΦ|.We prove by induction that the following holds for alli = 1, . . . ,m: every assignmentf ∈ [≤ i, false]Φ hasan extensionf ′ : YΦ ∪XΦ → {true, false} satisfying the clausesφ of Φ. This suffices, since[≤ m, false]Φis the set of all assignments toYΦ.

The base casei = 1 holds by hypothesis.Suppose thati ≥ 2. Let f be an assignment in[≤ i, false]Φ. If f ∈ [≤ i − 1, false]Φ then the desired

extensionf ′ exists by induction. So suppose thatf maps exactlyi variablesS = {s1, . . . , si} to the valuefalse. Let f1 : YΦ → {true, false} be the assignment mapping exactly the variablesS \ {s1} to false,and letf2 : YΦ → {true, false} be the assignment mapping exactly the variablesS \ {s2} to false. Sincef1, f2 ∈ [≤ i − 1, false]Φ, they have extensionsf ′1, f

′2 satisfyingφ. Since∧ preservesφ, the assignment

f ′ = ∧(f ′1, f′2) also satisfiesφ. The assignmentf ′ is an extension off :

• f ′(s1) = ∧(f ′1(s1), false) = false

• f ′(s2) = ∧(false, f ′2(s2)) = false

• for all s ∈ S \ {s1, s2}, f ′(s) = ∧(false, false) = false

• for all y ∈ YΦ \ S, f ′(y) = ∧(true, true) = true

Looking now at QUANTIFIED 2-SAT, we give a proof of tractability (again, forΠ2 formulas) thatis similar in spirit to the proof we just gave for QUANTIFIED HORN-SAT. Whereas Horn clauses werepreserved by the operation∧, 2-clauses are preserved by a different operation. Letmajority denote theternary operation defined bymajority(x, y, z) = (x ∧ y) ∨ (x ∧ z) ∨ (y ∧ z). That is,majority returns the

ACM SIGACT News 3 Vol. —, No. —

input value occurring at least twice. It is straightforwardto verify thatmajority preserves any 2-clause.2

Having observed this, we can now establish a result similar in spirit to Proposition 1.1.

Proposition 1.4. LetΦ be an instance ofQUANTIFIED 2-SAT having prefix classΠ2. The formulaΦ is trueif and only if for every assignmentf ∈ [≤ 2, false]Φ, there exists an extensionf ′ : YΦ ∪XΦ → {true, false}of f satisfying all clauses ofΦ.

As with Proposition 1.1, we can readily infer a polynomial-time algorithm for the quantified formulasunder study from Proposition 1.4. Namely, using a polynomial-time algorithm for 2-SAT, it can be decidedwhether or not for allf ∈ [≤ 2, false]Φ, the desired extensionf ′ exists. Since there are polynomially manyassignments in[≤ 2, false]Φ, this can be carried out in polynomial time.Proof. This proof is structurally identical to the proof of Proposition 1.1. As in that proof, the “only if”direction is clear, so we prove the “if” direction. Letm denote|YΦ|. We prove by induction that the followingholds for alli = 2, . . . ,m: every assignmentf ∈ [≤ i, false]Φ has an extensionf ′ : YΦ∪XΦ → {true, false}satisfying the clausesφ of Φ. This suffices, since[≤ m, false]Φ is the set of all assignments toYΦ.

The base casei = 2 holds by hypothesis.Suppose thati ≥ 3. Let f be an assignment in[≤ i, false]Φ. If f ∈ [≤ i − 1, false]Φ then the desired

extensionf ′ exists by induction. So suppose thatf maps exactlyi variablesS = {s1, . . . , si} to the valuefalse. Forj ∈ {1, 2, 3}, letfj : YΦ → {true, false} be the assignment mapping exactly the variablesS\{sj}to false. Since the assignmentsf1, f2, f3 are in[≤ i − 1, false]Φ, they have extensionsf ′1, f

′2, f

′3 satisfying

φ. Sincemajority preserves any 2-clause, by the discussion in Example 1.3 it also preservesφ, and thus theassignmentf ′ = majority(f ′1, f

′2, f

′3) also satisfiesφ. The assignmentf ′ is an extension off :

• f ′(s1) = majority(f ′1(s1), false, false) = false

• f ′(s2) = majority(false, f ′2(s2), false) = false

• f ′(s3) = majority(false, false, f ′3(s3)) = false

• for all s ∈ S \ {s1, s2, s3}, f ′(s) = majority(false, false, false) = false

• for all y ∈ YΦ \ S, f ′(y) = majority(true, true, true) = true

I mention that the polynomial-time tractability of the special cases of QUANTIFIED SAT that have beendiscussed,without theΠ2 restriction, is proved using the notion of preservation by an operation in [25].

2 What’s this all about?

What just happened? The question of how to efficiently decidethe truth of certain logical formulas wasposed, and answered by considering operations preserving the formulas. This situation exemplifies a themeunderlying an emerging line of research that studies the complexity of constraint satisfaction problems.

2 Here is a verification: letl1∨l2 be a 2-clause, letf1, f2, f3 be assignments satisfying this clause, and letv1, v2 denote the vari-ables underlying the literalsl1, l2, respectively. If two of the assignmentsf1, f2, f3 are equal on{v1, v2}, thenmajority(f1, f2, f3)is equal to those two assignments on{v1, v2} and hence satisfies the clause. Otherwise,f1, f2, andf3, restricted to{v1, v2}, are ex-actly the three distinct assignments satisfyingl1∨ l2, and it is can be seen that both literalsl1, l2 are true undermajority(f1, f2, f3).

ACM SIGACT News 4 Vol. —, No. —

More details on that, please. The constraint satisfaction problem (CSP) is a general framework in whichmany search problems can be readily modeled; an instance of the CSP consists of a set of constraintson variables, and the goal is to determine if there is an assignment to the variables satisfying every oneof the given constraints. A broad family of problems can be obtained from the CSP by restricting theso-calledconstraint language—a set of relations that can be used to form constraints. EachconstraintlanguageΓ gives rise to a particular computational problem, denoted by CSP(Γ), and a focal researchquestion is to describe the complexity ofCSP(Γ) for all constraint languagesΓ. The family of problemsCSP(Γ) is extremely rich, and includes graph homomorphism problems, the problem of solving a system ofequations over various algebraic structures, and the problems SAT, 2-SAT and HORN-SAT. The researcharea studying the problemsCSP(Γ) has recognized that a set of operations—analgebra—can be associatedto each constraint languageΓ in such a way that information on the complexity of the problem CSP(Γ) canbe derived from these operations. This association has given way to a fruitful interaction among the areas oflogic, complexity, and algebra.

What of the results presented in the previous section? Both Propositions 1.1 and 1.4 have been known.For example, they were proved by Gradel [37] to obtain results in descriptive complexity; Proposition 1.1was also derived by Karpinski et al. [43] from theory establishing the tractability of QUANTIFIED HORN-SAT. In those papers these propositions were derived by arguments strongly based on the clausal forms ofthe formulas under study, in contrast to the algebraic arguments given here based onoperations. I hope thereader will agree that the proofs given here are particularly short and simple, and yield evidence that theutilized algebraic viewpoint can shed light even on classically studied fragments of propositional logic. Ibelieve it is also worth emphasizing that the proofs of Propositions 1.1 and 1.4 are structurally identical,and thus that the reasoning employed in both cases is genericand not heavily tied to the particular formulasunder study.

What happens in this article? In this expository article, I give a contemporary, algebraic treatment ofthe inaugural result on constraint languages, Schaefer’s theorem on boolean constraint satisfaction prob-lems [56]. This theorem classifies the complexity ofCSP(Γ) for all constraint languagesΓ over atwo-element domain. In particular, it gives a description of theconstraint languagesΓ such thatCSP(Γ) ispolynomial-time tractable, and shows that for all other constraint languagesΓ, the problemCSP(Γ) is NP-complete. This theorem is of broad interest, as it provides arich class of NP-complete boolean satisfiabilityproblems, some of which have extremely simple descriptions, and which—as Schaefer himself envisioned—often facilitate the development of a NP-hardness proof. Following an introduction to the algebraic view-point on constraint satisfaction (Section 3), I give a relatively short but complete proof of Schaefer’s theorem(Sections 4 and 5). After this, I prove—again using algebraic techniques—an analog of Schaefer’s theoremfor quantified satisfiability problems (Section 6), and thengive a “fine” classification theorem for quantifiedsatisfiability problems where the number of quantifier alternations is bounded (Section 7). In the last sectionof this paper (Section 8), I discuss a recently discovered application of the algebraic viewpoint to a class oflogical formulas falling outside the framework of constraint satisfaction, and open the question of findingmore results of this form.

Almost all of the results presented here appear either explicitly or implicitly in the literature: the ex-position draws upon many previous publications, includingthe works of Post [53] and Rosenberg [55] onclone theory; the papers of Geiger [36] and Bodnarchuk et al.[11] identifying a relevant Galois connection;the paper of Schaefer [56]; the papers of Jeavons, Cohen, andGyssens [42], Jeavons [40], and Bulatov,Jeavons, and Krokhin [20] connecting constraint satisfaction to clone theory and universal algebra; and thetractability result of Jeavons, Cohen, and Cooper [41]. Thenovelty here is that I attempt to give a unifiedand relatively short account of these results, and include anumber of lesser-known proofs.

ACM SIGACT News 5 Vol. —, No. —

Care has been taken to make the presentation of this article self-contained, and I do not assume anybackground in any of the areas touched by this article, otherthan familiarity with basic complexity-theoreticnotions such as reducibility and the complexity classes P and NP. I hope that a wide variety of readers willbe able to take something away from this article—from those who would like to understand (a nice versionof) the statement of Schaefer’s theorem and catch a glimpse of its inner workings, to those interested inincorporating the presented ideas and techniques into their research toolboxes. Indeed, I have endeavoredto give a streamlined proof of Schaefer’s theorem and the other classification theorems, and believe that thepresented proof of Schaefer’s theorem could reasonably be taught in a few lectures of a course, under theassumption of a mature audience.

Throughout this article, I provide exercises for the reader; some are relatively routine, while others offera taste of deeper ideas. To close this section, the followingexercises expanding upon the discussion inSection 1 are offered.

Exercise 2.1.Define the operationminority to be the the ternary operation such thatminority(x, y, z) =x⊕ y⊕ z, where⊕ denotes the usual exclusive OR operation. That is, if all of the inputs tominority are thesame value, that value is the output; otherwise,minority returns whichever one of its inputs occurs exactlyonce. Show that any equation of the formv1 ⊕ · · · ⊕ vk = c where thevi are variables andc ∈ {0, 1} is aconstant, is preserved byminority.

Exercise 2.2.Using the previous exercise, prove a result analogous to Propositions 1.1 and 1.4 forΠ2

formulas where the quantifier-free part is the conjunction of equations of the form described in the previousexercise.

Exercise 2.3.Show that Proposition 1.4 holds with([≤ 1, false]Φ ∪ [≤ 0, true]Φ) in place of[≤ 2, false]Φ.Observe that the set of assignments([≤ 1, false]Φ ∪ [≤ 0, true]Φ) is in general smaller than[≤ 2, false]Φ!Also observe that, by duality, this proposition holds with([≤ 1, true]Φ ∪ [≤ 0, false]Φ) or [≤ 2, true]Φ inplace of[≤ 2, false]Φ.

3 Constraint satisfaction and polymorphisms

In this section, we describe the computational problems of interest and the algebraic tools that will be usedto study them.

Definition 3.1. A relationover domainD is a subset ofDk for somek ≥ 1; k is said to be thearity of therelation. Aconstraint languageover domainD is a set of relations overD. A constraint language isfinite ifit contains finitely many relations, and isbooleanif it is over the two-element domain{0, 1}.

By a domainD, we simply mean a set. Other than in the last section, we will be concerned primarilywith constraint languages over a finite domainD. Also, note that we will use0 and1 to denote the booleanvaluesfalse andtrue.

Definition 3.2. A constraintover a constraint languageΓ is an expression of the formR(v1, . . . , vk) whereR is a relation of arityk contained inΓ, and thevi are variables. A constraint is satisfied by a mappingfdefined on thevi if (f(v1), . . . , f(vk)) ∈ R.

The computational problems we are interested in are defined as follows.

Definition 3.3. Let Γ be a finite constraint language over domainD. The problemCSP(Γ) is to decide,given a finite set of variablesV and a finite set of constraints overΓ with variables fromV , whether or notthere exists asolution(or satisfying assignment), a mappingf : V → D satisfying all of the constraints.

ACM SIGACT News 6 Vol. —, No. —

Observe that, for all constraint languagesΓ, the problemCSP(Γ) is in NP: a variable assignmentf :V → D has polynomial size, and whether or not it satisfies all constraints can be checked in polynomialtime. We remark that when discussing problems of the formCSP(Γ), we will confine our attention tofiniteconstraint languagesΓ. This permits us to avoid certain technicalities and discussion of how relations arerepresented, although we should note that the complexity ofinfinite constraint languages is considered inthe literature.

Example 3.4. We demonstrate that 3-SAT, the case of the SAT problem where every clause has exactlythree literals, can be viewed as a problem of the formCSP(Γ) for a boolean constraint languageΓ. Definethe relationsR0,3,R1,3,R2,3, andR3,3 by

R0,3 = {0, 1}3 \ {(0, 0, 0)}R1,3 = {0, 1}3 \ {(1, 0, 0)}R2,3 = {0, 1}3 \ {(1, 1, 0)}R3,3 = {0, 1}3 \ {(1, 1, 1)}

Notice that for any variablesx, y, z, we have the following equivalences:

R0,3(x, y, z) ≡ (x ∨ y ∨ z)R1,3(x, y, z) ≡ (¬x ∨ y ∨ z)R2,3(x, y, z) ≡ (¬x ∨ ¬y ∨ z)R3,3(x, y, z) ≡ (¬x ∨ ¬y ∨ ¬z)

That is, (as an example) the constraintR1,3(x, y, z) is satisfied by an assignment if and only if the clause(¬x ∨ y ∨ z) is satisfied by the assignment.

Let Γ3 be the constraint language{R0,3, R1,3, R2,3, R3,3}. Every instance of the 3-SAT problem canbe readily translated into an instance ofCSP(Γ3) having the same satisfying assignments. For instance,consider the 3-SAT instance

(¬u ∨ s ∨ ¬t) ∧ (¬s ∨ t ∨ v) ∧ (s ∨ t ∨ ¬v) ∧ (v ∨ u ∨ s).

It is equivalent to theCSP(Γ3) instance with variables{s, t, u, v} and constraints

{R2,3(u, t, s), R1,3(s, t, v), R1,3(v, s, t), R0,3(v, u, s)}.

Similarly, any instance ofCSP(Γ3) can be formulated as an instance of 3-SAT. �

It is well-known that 3-SAT is NP-hard; we formulate this as follows.

Proposition 3.5. The problemCSP(Γ3), whereΓ3 as is defined in Example 3.4, is NP-hard.

Example 3.6. Schaefer [56] identified the problem NOT-ALL -EQUAL SATISFIABILITY : given a collectionof setsS1, . . . , Sm each having at most3 members, can the members be colored with two colors so that noset is all one color? We show that this problem is equivalent to CSP(Γ) whereΓ contains the single relationRNAE = {0, 1}3 \ {(0, 0, 0), (1, 1, 1)}.

Take an instanceS1, . . . , Sm of NOT-ALL -EQUAL SATISFIABILITY ; we translate it to an instance ofCSP(Γ) by creating, for each setSi, a constraintRNAE(s, t, u) wheres, t, u are such thatSi = {s, t, u}. Itis readily seen that a coloringf : (∪m

i=1Si) → {0, 1} satisfies the condition given in the problem descriptionif and only if it satisfies all of the constraints. Similarly,an instance ofCSP(Γ) can be translated to aninstance of NOT-ALL -EQUAL SATISFIABILITY by creating, for each constraintRNAE(s, t, u), a set{s, t, u}.�

ACM SIGACT News 7 Vol. —, No. —

We now give a notion of definability for relations. As we will see momentarily, this notion will permit aconstraint language to “simulate” relations that might notbe inside the constraint language.

Definition 3.7. We say that a relationR ⊆ Dk is pp-definable(short forprimitive positive definable) froma constraint languageΓ if for somem ≥ 0 there exists a finite conjunctionC consisting of constraints andequalities(u = v) over variables{v1, . . . , vk, x1, . . . , xm} such that

R(v1, . . . , vk) ≡ ∃x1 . . . ∃xmC.

That is,R contains exactly those tuples of the form(g(v1), . . . , g(vk)) whereg is an assignment that can beextended to a satisfying assignment ofC. We use〈Γ〉 to denote the set of all relations that are pp-definablefromΓ.

Example 3.8. Let S = {(0, 1), (1, 0)} be the disequality relation over{0, 1}. The following is a pp-definition ofS from the constraint languageΓ3 of Example 3.4:

S(y, z) = ∃x(R0,3(x, y, z) ∧R1,3(x, y, z) ∧R2,3(z, y, x) ∧R3,3(z, y, x)).

When all relations in a constraint languageΓ′ are pp-definable in another constraint languageΓ, we havethat the constraint satisfaction problem overΓ′ reduces to that overΓ.

Proposition 3.9. (implicit in [40]) Let Γ andΓ′ be finite constraint languages. IfΓ′ ⊆ 〈Γ〉, thenCSP(Γ′)reduces toCSP(Γ).

Note that the only notion of reduction used in this article ismany-one polynomial-time reduction.3

Proof. From an instanceφ of CSP(Γ′), we create an instance ofCSP(Γ) in the following way. We loop overeach constraintC = R(v1, . . . , vk) in φ, performing the following operations for each: let∃x1 . . . ∃xmCbe a pp-definition ofC overΓ, rename the existentially quantified variablesx1, . . . , xm if necessary so thatthey are distinct from all variables of other constraints, and replaceC with the constraints inC. It is clear thateach replacement preserves the satisfiability of the CSP instance; moreover, since there are finitely manyrelations inΓ′, each has a pp-definition of constant size, and all of the replacements can be carried out inpolynomial time. The result is a set of constraints overΓ and equalities; each equality(u = v) can beeliminated by removing it from the set and replacing all instances of (say)v with u. �

From this proposition, it can be seen that a finite constraintlanguageΓ is tractable if and only if all finitesubsetsΓ′ of 〈Γ〉 are tractable: the forward direction follows from the proposition, while the backwardsdirection follows by takingΓ′ = Γ. This observation can be interpreted as saying that the tractability of aconstraint languageΓ is characterized by the set〈Γ〉, and justifies focusing on the sets〈Γ〉. Interestingly, wewill show that the set of relations〈Γ〉 is in turn characterized by a set of operations called thepolymorphismsof Γ.

Definition 3.10. An operationf : Dm → D is a polymorphismof a relationR ⊆ Dk if for any choice ofm tuples(t11, . . . , t1k), . . . , (tm1, . . . , tmk) fromR, it holds that the tuple obtained from thesem tuples byapplyingf coordinate-wise,(f(t11, . . . , tm1), . . . , f(t1k, . . . , tmk)), is inR.

That is, an operationf is a polymorphism of a relationR if R satisfies a closure property: applyingf to any tuples inR yields another tuple insideR. This notion of closure is essentially equivalent to thatrequired by the notion of preservation used in Section 1; however, whereas there we spoke offormulasbeingpreserved by operations, here we speak ofrelationshaving polymorphisms. We now give some examples,which consider the constraint languageΓ3 = {R0,3, R1,3, R2,3, R3,3} from Example 3.4.

3 We remark that, by making use of the result of Reingold [54], the reduction of Proposition 3.9 can be carried out in logarithmicspace.

ACM SIGACT News 8 Vol. —, No. —

Example 3.11. The relationR0,3 has the boolean OR∨ operation as a polymorphism; we can see this asfollows. Suppose that(t11, t12, t13), (t21, t22, t23) are two tuples fromR0,3. There is some coordinate of thefirst tuple equal to1, that is, there existsj ∈ {1, 2, 3} such thatt1j = 1. It follows thatt1j ∨ t2j = 1, andthus the tuple(t11 ∨ t21, t12 ∨ t22, t13 ∨ t23) is also contained inR0,3.

The relationR1,3 also has the boolean OR∨ operation as a polymorphism. Let us take two tuples(t11, t12, t13), (t21, t22, t23) fromR1,3. If the first tuple(t11, t12, t13) is equal to(0, 0, 0), the OR of the twotuples(t11 ∨ t21, t12 ∨ t22, t13 ∨ t23) is equal to the second tuple, which is contained inR by assumption.Otherwise, eithert12 or t13 is equal to1, implying that one of the values(t12 ∨ t22), (t13 ∨ t23) is equal to1and that(t11 ∨ t21, t12 ∨ t22, t13 ∨ t23) is contained inR1,3.

The relationR2,3 does not have the boolean OR∨ operation as a polymorphism. This is because thetwo tuples(1, 0, 0), (0, 1, 0) are both inR2,3, but their OR, the tuple(1, 1, 0), is not. �

Example 3.12.None of the relations inΓ3 = {R0,3, R1,3, R2,3, R3,3} have themajority operation as a poly-morphism. Indeed, letR be any relation of the form{0, 1}3\{(a1, a2, a3)} with a1, a2, a3 ∈ {0, 1}. Observethat the tuples(¬a1, a2, a3) (a1,¬a2, a3) (a1, a2,¬a3) are all contained inR, but applying themajority op-eration to these tuples yields the tuple(majority(¬a1, a1, a1),majority(a2,¬a2, a2),majority(a3, a3,¬a3))which is equal to(a1, a2, a3) and is hence not inR. �

Upon initial acquaintance, the notion of polymorphism may appear unrelated to the notion of pp-definability. Actually, it turns out that the polymorphismsof a constraint languageΓ contain enough in-formation to derive the set of relations〈Γ〉! We say that an operationf : Dm → D is apolymorphismof aconstraint languageΓ if it is a polymorphism of all relationsR ∈ Γ, and we usePol(Γ) to denote the set ofall polymorphisms ofΓ, that is,

Pol(Γ) = {f : ∀R ∈ Γ, f is a polymorphism ofR}.

Also, for a set of operationsO, we useInv(O) to denote the set of relations having all operations inO as apolymorphism, that is,

Inv(O) = {R : ∀f ∈ O, f is a polymorphism ofR}.

Theorem 3.13.LetΓ be a finite constraint language over a finite domainD. It holds that〈Γ〉 = Inv(Pol(Γ)).

In words, this theorem states that a relation is pp-definablefrom Γ exactly when all polymorphisms ofΓ are polymorphisms of it. Again, this result shows that the set of relations〈Γ〉 can be derived from the setof operationsPol(Γ), in particular, by applying theInv(·) operator. This theorem was established by Geigerand Bodnarchuk et al. [36, 11].4 The proof of the⊇ direction given here is based on a proof that appearedin Dalmau’s Ph.D. thesis [29].Proof. We first show that〈Γ〉 ⊆ Inv(Pol(Γ)); this is the more straightforward direction. Let

R(v1, . . . , vk) ≡ ∃x1 . . . ∃xmC

be the pp-definition of a relationR overΓ. Suppose thatg : Dn → D is a polymorphism ofΓ; we want toshow thatg is a polymorphism ofR.

Consider first the relationR′ defined by

R′(v1, . . . , vk, x1, . . . , xm) ≡ C.

Let t1, . . . , tn be tuples inR′. Each tupleti has the form(fi(v1), . . . , fi(vk), fi(x1), . . . , fi(xm)) for an as-signmentfi satisfyingC. LetS(w1, . . . , wl) be any constraint or equality ofC. We have that(fi(w1), . . . , fi(wl)) ∈

4 We remark that thePol(·) andInv(·) operators give rise to an instance of aGalois connection.

ACM SIGACT News 9 Vol. —, No. —

S for eachfi. SinceS hasg as a polymorphism, we have that the arityl tuple withg(f1(wi), . . . , fn(wi))as itsith coordinate is inS. Thus the mapping sending each variablev ∈ {v1, . . . , vk, x1, . . . , xm} tog(f1(v), . . . , fn(v)), satisfies all constraints ofC. We then have that the the tupleg(t1, . . . , tn), whereg isapplied coordinate-wise, is inR′, and thus thatg is a polymorphism ofR′. (This is essentially the argumentof Example 1.3, but in slightly different language.)

Now, we have thatR′ hasg as a polymorphism, and want to show that

R(v1, . . . , vk) ≡ ∃x1 . . . ∃xmR′(v1, . . . , vk, x1, . . . , xm)

hasg as a polymorphism. Lett1, . . . , tn be tuples inR. Each tupleti = (ti1, . . . , tik) has an extensiont′i = (ti1, . . . , ti(k+m)) contained inR′. We want to show that the tupleg(t1, . . . , tn), whereg is applied

coordinate-wise, has an extension inR′. The tupleg(t′1, . . . , t′n) is such an extension.

We now prove〈Γ〉 ⊇ Inv(Pol(Γ)). Suppose thatR ∈ Inv(Pol(Γ)). Let n denote the arity ofR, letmdenote the number of tuples inR, and let(t11, . . . , t1n), . . . , (tm1, . . . , tmn) denote the tuples ofR (in anyorder). We may assume that there are no distinct coordinatesi, j such that(t1i, . . . , tmi) = (t1j , . . . , tmj),as these may be eliminated one by one using the following observation: letσ(1), . . . , σ(n − 1) denote thesequence1, . . . , n with j removed; then, if∃x1 . . . ∃xmC is a pp-definition for the relationR′ defined byR′(vσ(1), . . . , vσ(n−1)) ≡ ∃vj(R(v1, . . . , vn)), we have that∃x1 . . . ∃xm(C ∧ (vi = vj)) is a pp-definitionfor R(v1, . . . , vn).

We create a conjunction of constraintsC over the variable setDm. Our conjunctionC contains, foreach relationS ∈ Γ and sequence ofm tuples (s11, . . . , s1k), . . . , (sm1, . . . , smk) ∈ S, a constraintS((s11, . . . , sm1), . . . , (s1k, . . . , smk)); here,k denotes the arity ofS. It is straightforward to verify thatan assignmentf : Dm → D satisfies all of the constraints inC if and only if it is anm-ary polymorphismof Γ.

Now consider the relationR′ defined by

R′((t11, . . . , tm1), . . . , (t1n, . . . , tmn)) = ∃v1 . . . ∃vpC

wherev1, . . . , vp are the tuples inDm\{(t11, . . . , tm1), . . . , (t1n, . . . , tmn)}, in any order. Since it is exactlythem-ary polymorphisms ofΓ that satisfyC, we have

R′ = {(f(t11, . . . , tm1), . . . , f(t1n, . . . , tmn)) : f ∈ Pol(Γ), f has aritym}.

We claim thatR′ = R, which yields the proof.R′ ⊆ R: The tuples(t11, . . . , t1n), . . . , (tm1, . . . , tmn) are inR; since everyf ∈ Pol(Γ) is a polymor-

phism ofR, it follows that(f(t11, . . . , tm1), . . . , f(t1n, . . . , tmn)) ∈ R.R ⊆ R′: Let πi : Dm → D denote the function that projects onto theith coordinate, that is, the

function such thatπi(d1, . . . , dm) = di for all (d1, . . . , dm) ∈ Dm. Each functionπi is a polymorphismof all relations, and is hence a polymorphism ofΓ; it follows that for eachi ∈ {1, . . . ,m}, the tuple(ti1, . . . , tin) = (π(t11, . . . , tm1), . . . , π(t1n, . . . , tmn)) is inR′. �

Theorem 3.13 also holds for infinite constraint languages; we leave the proof of this as an exercise.

Exercise 3.14.Prove Theorem 3.13 for infinite constraint languages (constraint languages containing in-finitely many relations) over finite domains by adapting the given proof for Theorem 3.13.

We have observed that the complexity ofCSP(Γ) effectively depends on the set〈Γ〉, and we just showedthat the set〈Γ〉 can be computed from the polymorphisms ofΓ. This suggests that the polymorphisms of aconstraint languageΓ can be used to derive information on the complexity ofCSP(Γ), which we show asfollows.

ACM SIGACT News 10 Vol. —, No. —

Theorem 3.15. Let Γ and Γ′ be finite constraint languages. IfPol(Γ) ⊆ Pol(Γ′), thenΓ′ ⊆ 〈Γ〉 andCSP(Γ′) reduces toCSP(Γ).

This theorem was proved by Jeavons [40], and can be seen as an operational analog of Proposition 3.9.Note that this theorem implies that two constraint languages Γ, Γ′ having the same polymorphisms reduceto each other, and hence are of the same complexity.Proof. The containmentPol(Γ) ⊆ Pol(Γ′) implies the containmentInv(Pol(Γ)) ⊇ Inv(Pol(Γ′)). InvokingTheorem 3.13, we obtain that〈Γ〉 ⊇ 〈Γ′〉. This implies thatΓ′ ⊆ 〈Γ〉, and the conclusion follows fromProposition 3.9. �

Having established that the complexity of a constraint languageΓ is intimately linked to its set of poly-morphismsPol(Γ), a natural inclination at this point is to inquire as to the structure of the setsPol(Γ). Infact, each set of operations having this form is an instance of an algebraic object called aclone.

Definition 3.16. A cloneis a set of operations that

• contains all projections, that is, the operationsπmi : Dm → D with 1 ≤ i ≤ m such that

πmi (d1, . . . , dm) = di for all d1, . . . , dm ∈ D, and

• is closed under composition, where the composition of an arity n operationf : Dn → D andn aritym operationsf1, . . . , fn : Dm → D is defined to be the aritym operationg : Dm → D such thatg(d1, . . . , dm) = f(f1(d1, . . . , dm), . . . , fn(d1, . . . , dm)) for all d1, . . . , dm ∈ D.

We will say that an operationf (or more generally, a set of operationsF ) generatesan operationg ifevery clone containingf (respectively,F ) also containsg.

Example 3.17. Let f : Dn → D be an operation. The operationf generates any operationg : Dm → Dobtained by reordering and identifying arguments off . Formally, leti : {1, . . . , n} → {1, . . . ,m} beany mapping. We claim thatf generates the operationg such thatg(d1, . . . , dm) = f(di(1), . . . , di(n))for all d1, . . . , dm ∈ D. This is becauseg may be viewed as the composition off with the projectionsπm

i(1), . . . , πmi(n). �

Example 3.18.Let f : D2 → D be a binary operation. We show thatf generates the operationg(x, y, z) =f(x, f(y, z)). By the previous example,f generates the operationf23(x, y, z) = f(y, z). The operationgmay be viewed as the composition off with π3

1 andf23. �

The computer scientist will recognize that a set of operationsF generates any operationg(x1, . . . , xm)that can be represented as an acyclic circuit where the inputs are the variablesx1, . . . , xm and the gates areoperations fromF .

Proposition 3.19. For all constraint languagesΓ, the set of operationsPol(Γ) is a clone.

Proof. Let Γ be a constraint language, and lett1, . . . , tm be elements of a relationR from Γ,For anyi, we haveπm

i (t1, . . . , tm) = ti which is inR by assumption. Note that we intend that operationsare applied coordinate-wise to tuples, as in Definition 3.10.

Now, suppose thatf : Dn → D andf1, . . . , fn : Dm → D are polymorphisms ofR, and thatg isthe composition off andf1, . . . , fn. Definesi = fi(t1, . . . , tm) for all i = 1, . . . , n. Since thefi arepolymorphisms ofR, we have that all tuplessi are inR. Sincef is also a polymorphism ofR, it followsthat the tuples = f(s1, . . . , sn) is contained inR. Clearly,g(t1, . . . , tm) = s, and we conclude thatg is apolymorphism ofR. �

ACM SIGACT News 11 Vol. —, No. —

We are now ready to state Schaefer’s theorem, which describes the complexity ofCSP(Γ) for all booleanconstraint languagesΓ. Given the connection between the complexity ofCSP(Γ) and the set of polymor-phisms ofΓ, it should come as no surprise that there is a description of the complexity ofCSP(Γ) in termsof polymorphisms. Not only is this the case, but there is a remarkably clean description based on polymor-phisms, stating that a boolean problemCSP(Γ) is tractable precisely when the constraint languageΓ hasone of six polymorphisms.

Here comes the theorem statement. We refer to the unary operation u0 : {0, 1} → {0, 1} such thatu0(0) = u0(1) = 0 astheconstant operation0, and similarly to the unary operationu1 : {0, 1} → {0, 1}such thatu1(0) = u1(1) = 1 asthe constant operation1. Recall that the operationmajority : {0, 1}3 →{0, 1} is defined bymajority(x, y, z) = (x∧ y)∨ (x∧ z)∨ (y ∧ z), and the operationminority : {0, 1}3 →{0, 1} is defined byminority(x, y, z) = x⊕ y ⊕ z.

Theorem 3.20. (Schaefer’s theorem [56] – algebraic formulation) LetΓ be a finite boolean constraintlanguage. The problemCSP(Γ) is polynomial-time tractable ifΓ has one of the following six operations asa polymorphism:

• the constant operation0,

• the constant operation1,

• the boolean AND operation∧,

• the boolean OR operation∨,

• the operationmajority,

• the operationminority.

Otherwise, the problemCSP(Γ) is NP-complete.

Schaefer’s theorem was originally formulated in terms of properties of relations [56]; Jeavons [40]recognized that the algebraic formulation was possible. Jeavons [40] also pointed out that the algebraicformulation gives rise to a polynomial-time test for deciding if a given constraint language satisfies one ofthe six tractability conditions. However, the algebraic formulation not only makes it easy for machines totest for tractability, it makes it easy for human beings as well!

Exercise 3.21.LetΓ be the constraint language{R0,3, R3,3} whereR0,3 andR3,3 are defined as in Exam-ple 3.4. Show, using Theorem 3.20, thatCSP(Γ) is NP-complete.

Exercise 3.22.Let Γ be the constraint language{RNAE}, whereRNAE = {0, 1}3 \ {(0, 0, 0), (1, 1, 1)} isthe relation from Example 3.6. Show, using Theorem 3.20, that CSP(Γ) is NP-complete.

Exercise 3.23.Let Γ be the constraint language{R1in3}, whereR1in3 denotes the ternary relation con-taining all tuples with exactly one1, that is,{(1, 0, 0), (0, 1, 0), (0, 0, 1)}. Show, using Theorem 3.20, thatCSP(Γ) is NP-complete.

Exercise 3.24.Let C0 be the arity one relation{(0)}, C1 be the arity one relation{(1)}, andS be theternary relation

{(a, b, c) ∈ {0, 1}3 : (a = b) ∨ (b = c)}.

LetΓ be the constraint language{C0, C1, S}. Show, using Theorem 3.20, thatCSP(Γ) is NP-complete.

ACM SIGACT News 12 Vol. —, No. —

4 Schaefer tractability: the good news, first

In this section and the next, we establish Schaefer’s Theorem 3.20. We begin with the good news in thissection by establishing that each of the six operations listed in the theorem statement, as polymorphisms,guarantee tractability. We consider each of the operationsin turn. In each case, we assume thatΓ is afinite constraint language having the operation being considered as a polymorphism, and demonstrate thatCSP(Γ) is polynomial-time tractable.

The constant operation0. In this case, an instance ofCSP(Γ) is satisfiable if and only if for all constraintsR(v1, . . . , vk), the relationR is non-empty. Clearly, this condition is necessary for satisfiability. When thecondition holds, we claim that the function mapping all variables to0 satisfies all constraints. This isbecause, in a constraintR(v1, . . . , vk), if R is non-empty, applying the polymorphism0 to any tuple inRyields the all-zero tuple(0, . . . , 0).

The constant operation1. The reasoning in this case is identical to the case of the constant operation0,but with the value1 in place of0.

The boolean AND operation∧. In this case, we can apply a general inference algorithm for constraintsatisfaction problems calledarc consistency.5 Assume that we have an instance of the CSP with variablesetV and domainD. For a constraintC = R(v1, . . . , vk), defineπvi

(C) = {ti : (t1, . . . , tk) ∈ R}, for allvariablesv1, . . . , vk, andπw(C) = D for all variablesw ∈ V \ {v1, . . . , vk}. Note that for any solutionfto the CSP, and any constraintC, and variablev, it must hold thatf(v) ∈ πv(C).

The following is the arc consistency algorithm. The intuition is that, using the setsπv(C), we “tighten”the constraints by removing unusable tuples from the relations. If some relation becomes empty, we canconclude that the entire problem is unsatisfiable.

ARC CONSISTENCY ALGORITHM

Input: an instance of the CSP.1 For each variablev, defineDv to be∩Cπv(C) where the intersection is over all constraintsC.2 For each constraintR(v1, . . . , vk), replaceR with R ∩ (Dv1

× · · · ×Dvk).

If R becomes empty, then terminate and report “unsatisfiable”.3 If any relations were changed in step 2, goto step 1. Otherwise, halt.

Let us study this algorithm. First, we show that if it reports“unsatisfiable”, it does so correctly. As wementioned, iff is a solution to the input CSP, then for all constraintsC and all variablesv, it must hold thatf(v) ∈ πv(C). This implies that iff is a solution to the CSP, we havef(v) ∈ Dv for all variablesv, whereDv is the set computed in step 1. It follows that step 2 preservesthe set of solutions to the CSP: since anysolutionf obeysf(v) ∈ Dv for all variablesv, a constraintR(v1, . . . , vk) is satisfied byf even whenR isreplaced withR ∩ (Dv1

× · · · ×Dvk).

Next, we show that if the algorithm halts in step 3, then thereexists a solution, assuming that eachrelation originally had the∧ operation as a polymorphism. Define the setsDv as in step 1 of the algorithm,and define a mappingf : V → {0, 1} as follows:

f(v) =

0 if Dv = {0}1 if Dv = {1}0 if Dv = {0, 1}

5 It should be noted that the literature contains many variants and definitions of arc consistency.

ACM SIGACT News 13 Vol. —, No. —

We claim thatf is a satisfying assignment. LetR(v1, . . . , vk) be any constraint. Lets = (s1, . . . , sk) bethe tuple obtained by applying the∧ operation to all tuples ofR, in any order. That is, lett1, . . . , tm be thetuples ofR (in any order), and defines to be

((. . . ((t1 ∧ t2) ∧ t3) ∧ . . .) ∧ tm)

where the∧ operator is applied to two tuples coordinate-wise, as in Definition 3.10. Since the rela-tion R originally had∧ as a polymorphism and contained the tuplest1, . . . , tm, it suffices to show that(f(v1), . . . , f(vk)) = (s1, . . . , sk). Let vj be one of the variablesv1, . . . , vk, and for eachi = 1, . . . ,m, letus denote the tupleti by (ti1, . . . , tik). If 0 ∈ Dvj

, then there exists a tupletl such thattlj = 0, and thussj = 0. Otherwise,Dvj

= {1}, and for all tuplesti we havetij = 1, from which it follows thatsj = 1.

The boolean OR operation∨. The reasoning in this case is identical to the case of the boolean ANDoperation∧, but with the roles of the values0 and1 swapped.

The operation majority. Let φ be a set of constraints over variable setV . We say thatf : W → D, forW a subset ofV , is apartial solutionof φ if for every constraintR(v1, . . . , vk) ∈ φ, there exists a tuple(d1, . . . , dk) ∈ R such thatf(vi) = di for all vi ∈ W . We give an inference algorithm in the spirit of thearc consistency algorithm given for the boolean AND operation.

ALGORITHM FOR MAJORITY POLYMORPHISM

Input: an instanceφ of the CSP with variable setV .1 For each non-empty subsetW = {w1, . . . , wl} of V of sizel ≤ 3,

add the constraintDl(w1, . . . , wl) to φ.2 For each constraintR(w1, . . . , wl) of φ with l ≤ 3, compute the set

R′ = {(f(w1), . . . , f(wl)) | f : {w1, . . . , wl} → D is a partial solution of the instanceφ}.Then, replaceR with R′.If R becomes empty, terminate and report “unsatisfiable”.

3 If any relations were changed in step 2, goto step 2 and repeat it. Otherwise, halt.

First, we observe that each replacement in step 2 preserves the set of solutions. This is because anyrestriction of a solution is a partial solution. It follows that if the algorithm reports “unsatisfiable” in step 2,it does so correctly.

We thus need to show that if the algorithm halts in step 3, thenthere exists a solution, assuming thateach relation originally had themajority operation as a polymorphism. (We assume that the CSP has threeor more variables; if it has two or fewer, it is clear that there exists a solution.) It is straightforward to verifythat each replacement of step 2 preserves all polymorphismsof the CSP, so when the algorithm halts, theresulting CSP has themajority operation as a polymorphism. The following definition is key.

Definition 4.1. Letn ≥ 0. An instance of the CSP with variable setV has then-extension propertyif, givenany subsetW ⊆ V of size|W | = n and a variablev ∈ V , any partial solutionf : W → D can be extendedto a partial solutionf ′ : W ∪ {v} → D.

Assume that the algorithm halts in step 3; then, for every pair of variablesW = {w,w′} there existsa partial solutionf : W → D. This is because there exists a constraintS(w,w′) with W as its variables;the relationS is non-empty and so we can definef to be any assignment such that(f(w), f(w′)) ∈ S.Moreover,φ has the2-extension property: suppose thatW = {w,w′} is a pair of variables,v ∈ V is avariable, andf : W → D is a partial solution. Ifv ∈ W , thenf itself is the desired extension, so weassume thatv /∈ W . There exists a constraintT (w,w′, v) in the CSP instance; sincef is a partial solution,

ACM SIGACT News 14 Vol. —, No. —

there exists a tuple(b, b′, d) ∈ T such thatf(w) = b, f(w′) = b′. The extensionf ′ : {w,w′, v} → D of fsuch thatf ′(v) = d is a partial solution.

The following theorem shows that, as a consequence ofφ having the2-extension property, it has then-extension property for alln ≥ 3.

Theorem 4.2. Letφ be an instance ofCSP(Γ) whereΓ has themajority operation as a polymorphism. Ifφhas the2-extension property, then for alln ≥ 3 it holds thatφ has then-extension property.

Let u1, . . . , um be an ordering of the variablesV in φ. We have shown that there is a partial solution onany pair of variables, so in particular there is a partial solution f2 : {u1, u2} → D. In addition, we showedthat the2-extension property holds, so there is a partial solutionf3 : {u1, u2, u3} → D. By the theorem, inan iterative manner we can define, for alln ≥ 3, a partial solutionfn+1 : {u1, . . . , un+1} → D extendingthe partial solutionfn : {u1, . . . , un} → D. The mappingfm : V → D is then a total solution. Therefore,we need only prove the theorem to conclude our discussion of themajority operation.Proof. We prove this by induction. Suppose thatφ has then-extension property, withn ≥ 2; we showthatφ has the(n + 1)-extension property. LetW be a set of sizen + 1, let v be a variable inV , and letf : W → D be a partial solution. We want to prove that there is an extension f ′ : W ∪ {v} → D of f thatis a partial solution. Ifv ∈ W , we can takef ′ = f , so we assume thatv /∈ W . Letw1, w2, w3 be distinctvariables inW , and setWi = W \ {wi} for i ∈ {1, 2, 3}. Let f1, f2, f3 be the restrictions off toW1,W2,andW3, respectively. Sinceφ has then-extension property, for eachi ∈ {1, 2, 3} there exists an extensionf ′i : Wi ∪ {v} → D of fi. Definef ′ to be the extension off with f ′(v) = majority(f ′1(v), f

′2(v), f

′3(v)).

We claim thatf ′ is a partial solution. LetR(v1, . . . , vk) be any constraint. Since eachf ′i is a partialsolution, for eachi ∈ {1, 2, 3} there exists a tuple(di

1, . . . , dik) ∈ R such thatf ′i(vj) = di

j whenf ′i is definedonvj . We show thatf ′ is a partial solution via the tuple(majority(d1

1, d21, d

31), . . . ,majority(d1

k, d2k, d

3k)). We

consider each variablevj , in cases.

• Case: vj = wi for somei ∈ {1, 2, 3}. For the valuess ∈ {1, 2, 3} \ {i}, we have thatfs(vj)is defined and equal tods

j = f(vj). So, two of the valuesd1j , d

2j , d

3j are equal tof(vj) and thus

f ′(vj) = f(vj) = majority(d1j , d

2j , d

3j ).

• Case:vj ∈W \ {w1, w2, w3}. For eachi ∈ {1, 2, 3}, it holds thatf ′(vj) = f(vj) = fi(vj) = dij and

thusf ′(vj) = majority(d1j , d

2j , d

3j ).

• Case:vj = v. We havef ′(v) = majority(f ′1(v), f′2(v), f

′3(v)) = majority(d1

j , d2j , d

3j ).

We remark that the presentation of this proof is based on the proof of a more general result in [26].

The operation minority. We begin by showing that any constraint can be converted intoa conjunction oflinear equations. Here, by a linear equation we mean an equation of the forma1 ⊕ · · · ⊕ al = b1 ⊕ · · · ⊕ bmwhere eachai and eachbi is either a constant or a variable.

Theorem 4.3. LetR ⊆ {0, 1}k be a relation having theminority operation as a polymorphism. Then theconstraintR(x1, . . . , xk) can be expressed as the conjunction of linear equations.

Proof. We prove this theorem by induction on the arityk. The theorem is straightforward to prove for arityk = 1, so we assume thatk ≥ 2. Define the relationR0 ⊆ Dk−1 by R0(x2, . . . , xk) ≡ R(0, x2, . . . , xk)and define the relationR1 ⊆ Dk−1 by R1(x2, . . . , xk) ≡ R(1, x2, . . . , xk). Let ψ0(x2, . . . , xk) andψ1(x2, . . . , xk) be conjunctions of equations expressingR0(x2, . . . , xk) andR1(x2, . . . , xk), respectively;these conjunctions exist by induction.

ACM SIGACT News 15 Vol. —, No. —

If R0 is empty, we may expressR(x1, . . . , xk) by (x1 = 1) ∧ ψ1. Similarly, if R1 is empty, we mayexpressR(x1, . . . , xk) by (x1 = 0)∧ψ0. So, assume that bothR0 andR1 are non-empty, fix(c02, . . . , c

0k) to

be a tuple inR0, and fix(c12, . . . , c1k) to be a tuple inR1. Definec0 = (0, c02, . . . , c

0k) andc1 = (1, c12, . . . , c

1k).

Let b ⊆ {0, 1}k be an arbitrary tuple. Observe that ifb ∈ R, then (b ⊕ c0 ⊕ c1) ∈ R. Moreover, if(b⊕ c0 ⊕ c1) ∈ R, then((b⊕ c0 ⊕ c1) ⊕ c0 ⊕ c1) = b ∈ R. Thus,b ∈ R if and only if (b⊕ c0 ⊕ c1) ∈ R.Specializing this tob1 = 1, we obtain

(b2, . . . , bk) ∈ R1 ⇔ (b2 ⊕ c02 ⊕ c12, . . . , bk ⊕ c0k ⊕ c1k) ∈ R0.

This implies(b1, . . . , bk) ∈ R⇔ (b2 ⊕ c02b1 ⊕ c12b1, . . . , bk ⊕ c0kb1 ⊕ c1kb1) ∈ R0.

Thus, the desired equations forR(x1, . . . , xk) can be obtained from the equationsψ0(x′2, . . . , x

′k) by sub-

stitutingx′i with (xi ⊕ c0ix1 ⊕ c1i x1). �

An instance ofCSP(Γ) can thus be reduced to the problem of deciding if a conjunction of linear equa-tions has a solution: we simply replace each constraint withthe equations that are given by Theorem 4.3.The resulting conjunction of linear equations can be solvedby the well-known Gaussian elimination algo-rithm. For the sake of completeness, we give a brief description of a polynomial-time algorithm for solvingthese linear equations. First, we observe that it is possible to simplify linear equations so that in each equa-tion, each variable appears at most once: this is because twoinstances of a variable in an equation can beremoved together. Also, on each side of an equation constants may be added together so that there is at mostone constant on each side. Next, we observe that an equatione may be removed in the following way. If itdoes not contain a variable, then just check to see if it is true; if it is, then remove it, otherwise report “unsat-isfiable”. If it does contain a variable, let us suppose for notation that the variable isa1 and the equation isa1⊕· · ·⊕al = b1⊕· · ·⊕ bm. The equation is equivalent to the equationa1 = a2⊕· · ·⊕al ⊕ b1⊕· · ·⊕ bm,which we denote bye′. For each of the equations other thane, replace each instance ofa1 with the right-handside ofe′; then, removee. Perform this equation removal iteratively. Note that by simplifying equationsafter replacements are performed, we may ensure that the number of variable instances in each equationnever exceeds2n, wheren is the number of variables.

Exercise 4.4.Generalize the tractability of the operations∧ and∨ by showing that any constraint language(over a finite domain) having a semilattice operation as a polymorphism is polynomial-time tractable via thegiven arc consistency algorithm. Recall that a semilatticeoperation is a binary operation that is associative,commutative, and idempotent. This tractability result wasfirst proved in [42].

Exercise 4.5.A near-unanimity operationis an operationf : Dk → D of arity k ≥ 3 such that for allelementsd, d′ ∈ D, it holds thatd = f(d′, d, d, . . . , d) = f(d, d′, d, . . . , d) = · · · = f(d, . . . , d, d′). Inwords, this means that if all but at most one of the inputs tof “agree”, then the output is the agreed value.(Observe thatmajority is the unique near-unanimity operation of arityk = 3 over the domainD = {0, 1}.)Prove, by adapting the argument given for themajority operation, that any constraint languageΓ (overa finite domain) having anear-unanimity operationas a polymorphism is polynomial-time tractable. Thistractability result was demonstrated in [41].

5 Schaefer intractability

In this section, we want to complete our proof of Schaefer’s theorem by showing that those constraintlanguages not having one of the identified polymorphisms areNP-hard. We first establish a general result

ACM SIGACT News 16 Vol. —, No. —

on clones over the boolean domain, showing thatanysuch clone either contains one of the four non-unaryoperations of Schaefer’s theorem, or is of a highly restricted form, namely, only has operations that areessentially unary. We say that an operationf : Dk → D is essentially unaryif there exists a coordinatei ∈{1, . . . , k} and a unary operationg : D → D such thatf(d1, . . . , dk) = g(di) for all valuesd1, . . . , dk ∈ D.

Theorem 5.1. A clone over{0, 1} either contains only essentially unary operations, or contains one of thefollowing four operations:

• the boolean AND operation∧,

• the booelan OR operation∨,

• the operationmajority,

• the operationminority.

Theorem 5.1 follows from a result proved by Post in 1941 whichgave a description ofall clones overthe boolean domain [53]; see [12] for a nice presentation of this theorem. Those readers familiar withRosenberg’s theorem on minimal clones [55] will recognize that our proof draws on ideas present in theproof of that result, although our proof is specialized to the boolean case.

Whenf : Dk → D is an operation, we will usef to denote the unary function defined byf(d) =f(d, . . . , d) for all d ∈ D. We say that an operationf : Dk → D is idempotentif the operationf is theidentity function. As usual, we will use¬ to denote the unary operation on{0, 1} mapping0 to 1 and1 to 0.Proof. Suppose thatC is a clone containing an operationf : {0, 1}k → {0, 1} that is not essentially unary.We will show thatf generates one of the four operations given in the statement of the theorem.

We first consider the case whenf is a constant operation. Suppose thatf is the constant0; the casewheref is the constant1 is dual. Sincef is not essentially unary, there exist elementsa1, . . . , ak ∈ {0, 1}such thatf(a1, . . . , ak) = 1. Note that sincef = 0 we have{a1, . . . , ak} = {0, 1}. Now, we define thebinary functiong by g(x1, x0) = f(xa1

, . . . , xak). We haveg(0, 0) = g(1, 1) = 0 andg(1, 0) = 1. We

consider two cases depending on the value ofg(0, 1). If g(0, 1) = 1 we have thatg is the exclusive ORoperation, and thusg generates the operationminority: minority(x, y, z) = g(x, g(y, z)). If g(0, 1) = 0then it can be verified thatx ∧ y = g(x, g(x, y)).

We now suppose thatf is not a constant operation. It follows thatf must be the identity mapping or theoperation¬. Fromf , we claim that we can generate an idempotent operationf ′ that is not essentially unary.If f itself is idempotent, we takef ′ = f ; if f is the operation¬, we takef ′(x1, . . . , xk) = f(f(x1, . . . , xk)).We have established that the clone contains an idempotent operation that is not essentially unary, or equiv-alently, an idempotent operation that is not a projection. Let g : {0, 1}m → {0, 1} be an operation of thistype having minimal arity. We now break into cases dependingon the aritym of g.

Casem = 2: We cannot haveg(0, 1) 6= g(1, 0), otherwise the operationg is a projection. Thusg(0, 1) = g(1, 0). If g(0, 1) = g(1, 0) = 0, we have thatg is the operation∧, and ifg(0, 1) = g(1, 0) = 1,we have thatg is the operation∨.

Casem = 3: By the minimality of the arity ofg, if any two arguments ofg are identified, we obtain abinary operation that is a projection onto either its first orsecond coordinate. Considering the three possibleways of identifying two arguments ofg, we obtain the following eight possibilities:

(1) (2) (3) (4) (5) (6) (7) (8)g(x, x, y) = x x x x y y y yg(x, y, x) = x x y y x x y yg(y, x, x) = x y x y x y x y

ACM SIGACT News 17 Vol. —, No. —

In case (1), we haveg = majority, and in case (8), we haveg = minority. The cases (2), (3), and (5) cannotoccur, since thenf is a projection. The remaining cases, (4), (6), and (7), are symmetric; in each of them,ggenerates the operationmajority. For example, in case (6), we havemajority(x, y, z) = g(x, g(x, y, z), z).

Casem ≥ 4: We show that this case cannot occur. First suppose that whenever two coordinates ofg areidentified, the result is a projection onto the identified coordinates. Then, we haveg(x1, x1, x3, . . . , xm) =x1 and g(x1, x2, x3, . . . , x3) = x3. But, this implies thatg(0, 0, 1, . . . , 1) is equal to both0 and 1, acontradiction. So, there exist two coordinates such that, when identified, the result is a projection ontoa different coordinate. Assume for the sake of notation thatg(x1, x1, x3, x4, . . . , xm) = x4. We claimthat g(x1, x2, x1, x4, . . . , xm) = x4. Let j be such thatg(x1, x2, x1, x4, . . . , xm) = xj. This impliesg(x1, x1, x1, x4, . . . , xm) = xj. Observe that

g(x1, x1, x3, x4, . . . , xm) = x4 impliesg(x1, x1, x1, x4, . . . , xm) = x4

and hencexj = x4. We can similarly show thatg(x1, x2, x2, x4, . . . , xm) = x4. For any assignment to thevariablesx1, . . . , xm, one of the equalitiesx1 = x2, x1 = x3, x2 = x3 must hold, since our domain{0, 1}has two elements, and thusg is a projection. �

Next, we establish a lemma on which all of our intractabilityresults will be based. Let us say that anessentially unary operationf : Dk → D acts as a permutationif there exists a coordinatei ∈ {1, . . . , k}and a bijective operationπ : D → D such thatf(x1, . . . , xk) = π(xi).

Lemma 5.2. If Γ is a finite boolean constraint language such thatPol(Γ) contains only essentially unaryoperations that act as permutations, then for any finite boolean constraint languageΓ′, it holds thatCSP(Γ′)reduces toCSP(Γ).

Proof. If Pol(Γ) contains only projections, thenPol(Γ) ⊆ Pol(Γ′) and we can apply Theorem 3.15.Otherwise, we define a constraint languageΓ′′ that contains, for every relationR′ ∈ Γ′, a relationR′′

defined byR′′ = {(0, t1, . . . , tk) : (t1, . . . , tk) ∈ R′} ∪ {(1,¬t1, . . . ,¬tk) : (t1, . . . , tk) ∈ R′}. Theconstraint languageΓ′′ has the operation¬ as a polymorphism, and hence, by the assumption, all operationsin Pol(Γ) as a polymorphism. Thus, by Theorem 3.15,CSP(Γ′′) reduces toCSP(Γ), and it suffices to showthatCSP(Γ′) reduces toCSP(Γ′′).

Given an instanceφ′ of CSP(Γ′) having variablesV , we create an instanceφ′′ of CSP(Γ′′) as follows.Introduce a fresh variableb0 /∈ V , and for every constraintR′(v1, . . . , vk) occurring in our instanceφ′, wecreate a constraintR′′(b0, v1, . . . , vk) in the instanceφ′′. Suppose thatf : V → {0, 1} satisfiesφ′; then,the extension off mappingb0 to 0 satisfiesφ′′. Suppose thatg : V ∪ {b0} → {0, 1} satisfiesφ′′; then, ifg(b0) = 0, the restriction ofg to V satisfiesφ′, and if g(b0) = 1, the mappingf : V → {0, 1} defined byf(v) = ¬g(v) for all v ∈ V , satisfiesφ′. �

We can now prove Schaefer’s Theorem.Proof. (Theorem 3.20) LetΓ be a finite boolean constraint language. IfΓ has one of the six operationsgiven in the theorem statement as a polymorphism, then, as discussed in Section 4, the problemCSP(Γ) ispolynomial-time tractable. Otherwise, sinceΓ does not have any of the operations{∧,∨,majority,minority}as a polymorphism, by Theorem 5.1, the clonePol(Γ) contains only essentially unary operations. The onlyunary operations on{0, 1} are the two constant operations and the two permutations (the identity and¬).SincePol(Γ) does not contain either of the two constant operations, the setPol(Γ) contains only essentiallyunary operations that act as permutations, and the result follows from Lemma 5.2 by takingΓ′ to be a finiteboolean constraint language whereCSP(Γ′) is known to be NP-hard. For instance, we can takeΓ′ to be theconstraint language identified by Proposition 3.5. �

We close the section with some exercises.

ACM SIGACT News 18 Vol. —, No. —

Exercise 5.3.Using Theorem 5.1, observe that for each of the constraint languagesΓ in Exercises 3.21-3.24, the only polymorphisms ofΓ are the projections. Then, using Theorem 3.13, observe that〈Γ〉 is the setof all relations.

Exercise 5.4.Prove that ifΓ is a finite constraint language (over a finite domainD), then there exists afinite constraint languageΓ′ (over a finite domain) such thatCSP(Γ) reduces to and fromCSP(Γ′), and allessentially unary polymorphisms ofΓ act as permutations. This result was established in [20].Hint: letf : D → D be a unary polymorphism ofΓ having minimal image size, and considerΓ′ = f(Γ).

The following generalization of Lemma 5.2 is known [20].

Lemma 5.5. (follows from [20]) If Γ is a finite constraint language (over a finite domainD) whose essen-tially unary polymorphisms all act as permutations, then the problemCSP(Γ) reduces to and fromCSP(Γc),whereΓc = Γ ∪ {{(d)} : d ∈ D}. That is,Γc is the constraint language obtained by augmentingΓ with allunary relations of size one.

Exercise 5.6.Derive Lemma 5.2 from Lemma 5.5.

Exercise 5.7.Prove Lemma 5.5.Hint: construct an instance ofCSP(Γ) with variable setD whose solutionsf : D → D are the unary polymorphisms ofΓ.

6 Adding quantification to the mix

In this section, we considerquantifiedconstraint satisfaction problems. We prove a classification result forthe boolean domain analogous to Schaefer’s theorem. The problems we study are defined as follows.

Definition 6.1. Let Γ be a finite constraint language. The problemQCSP(Γ) is to decide the truth of aformula of the formQ1v1 . . . QnvnC, where

• eachQi ∈ {∀,∃} is a quantifier,

• eachvi is a variable, and

• C is the finite conjunction of constraints having relations fromΓ and variables from{v1, . . . , vn}.

The sequenceQ1v1 . . . Qnvn is called thequantifier prefixof the formula.

For each constraint languageΓ, the problemQCSP(Γ) is a generalization ofCSP(Γ): the problemCSP(Γ) can be viewed as the restriction ofQCSP(Γ) to instances having only existential quantifiers. It iswell-known that each problemQCSP(Γ) belongs to the complexity class PSPACE; it is also known thatthere exist constraint languagesΓ such thatQCSP(Γ) is PSPACE-hard.

Proposition 6.2. [58] The problemQCSP(Γ3), whereΓ3 as is defined in Example 3.4, is PSPACE-hard.

This section will prove the following theorem, which classifies every problem of the formQCSP(Γ) astractable or PSPACE-complete.

Theorem 6.3. Let Γ be a finite boolean constraint language. The problemQCSP(Γ) is polynomial-timetractable ifΓ has one of the four operations{∧,∨,majority,minority} as a polymorphism; otherwise, theproblemQCSP(Γ) is PSPACE-complete.

ACM SIGACT News 19 Vol. —, No. —

Theorem 6.3 is a “wide dichotomy theorem”: it shows that onlythe complexity classes P and PSPACE—and none of the complexity classes inbetween—are characterized by the boolean problemsQCSP(Γ). Alsonote that, in contrast to Schaefer’s theorem, here the constant polymorphisms are not strong enough toguarantee tractability ofQCSP(Γ); however, see Exercise 6.8 below for a related result.

A full proof of Theorem 6.3 was given by Creignou et al. [28], although a partial classification wasclaimed by Schaefer [56]. Related work by Dalmau [30] established the full classification given by thistheorem, assuming Schaefer’s unproved partial classification.

As for the CSP, we can give a notion of definability for the QCSPthat allows a constraint language to“simulate” further relations. Whereas for the CSP we considered pp-definability, here we consider a moregeneral notion of definability where universal quantification is permitted.

Definition 6.4. We say that a relationR ⊆ Dk is few-definable6 from a constraint languageΓ if for somem ≥ 0 there exists a finite conjunctionC consisting of constraints and equalities(u = v) over variables{v1, . . . , vk, x1, . . . , xm} and quantifiersQ1, . . . , Qm ∈ {∀,∃} such that

R(v1, . . . , vk) ≡ Q1x1 . . . QmxmC.

We use[Γ] to denote the set of all relations that are few-definable fromΓ.

Note that a pp-definition is a special case of a few-definition, and so a relationR that is pp-definablefrom a constraint languageΓ is also few-definable fromΓ, that is, the containment〈Γ〉 ⊆ [Γ] holds.

Proposition 6.5. Let Γ and Γ′ be finite constraint languages. IfΓ′ ⊆ [Γ], thenQCSP(Γ′) reduces toQCSP(Γ).

Proof. The proof resembles the proof of Proposition 3.9. From an instanceΦ = Pφ of QCSP(Γ′), wecreate an instance ofQCSP(Γ) in the following way. We loop over each constraintC = R(v1, . . . , vk) inthe original instance, performing the following operations for each: letQ1x1 . . . QmxmC be a few-definitionof C overΓ, rename the quantified variablesx1, . . . , xm if necessary so that they are distinct from all othervariables in the formula, replaceC with C in φ, and addQ1x1 . . . Qmxm to the end of the quantifier prefixP. The resulting quantified formula may contain equalities(u = v); we can process such equalities oneby one as follows. Suppose that an equality(u = v) is present and thatu comes beforev in the quantifierprefix. If v is universally quantified, then the formula is false. Otherwise, removev from the quantifierprefix, and replace all instances ofv with u. �

We now give a theorem that will be used to establish the neededhardness results in the classification.

Theorem 6.6. If Γ is a finite boolean constraint language such thatPol(Γ) contains only essentially unaryoperations, then for any finite boolean constraint languageΓ0, it holds thatQCSP(Γ0) reduces toQCSP(Γ).

Proof. We prove this theorem in a sequence of steps.

Step 1. We define a constraint languageΓ′ that contains, for each relationR ∈ Γ0, the relationR′ =(R × {0, 1}) ∪ {(0, . . . , 0), (1, . . . , 1)}. Observe thatΓ′ has both constant polymorphisms. In addition, foreach relationR ∈ Γ0, it holds thatR(v1, . . . , vk) = ∀y(R′(v1, . . . , vk, y)) and thusR ∈ [Γ′]. Thus, byProposition 6.5, we have thatQCSP(Γ0) reduces toQCSP(Γ′).

6 Where does the namefew-definable come from? The LaTeX commands for the symbols∀, ∃, and∧.

ACM SIGACT News 20 Vol. —, No. —

Step 2. In this step, we show thatQCSP(Γ′) reduces toQCSP(Γ′′) for a constraint languageΓ′′ havingall unary operations (over{0, 1}) as polymorphisms. We proceed as in the proof of Lemma 5.2. Foreach relationR′ ∈ Γ′, there is a relationR′′ ∈ Γ′′ defined byR′′ = {(0, t1, . . . , tk) : (t1, . . . , tk) ∈R′} ∪ {(1,¬t1, . . . ,¬tk) : (t1, . . . , tk) ∈ R′}. Using the fact thatΓ′ has the constant0 operation as apolymorphism, it can be seen thatΓ′′ has all unary operations as polymorphisms. Given an instance Φ′

of QCSP(Γ′), we create an instance ofQCSP(Γ′′) as follows. We introduce a new variableb0, and forevery constraintR′(v1, . . . , vk) appearing in our instanceΦ′, we create a constraintR′′(b0, v1, . . . , vk) inthe instanceΦ′′. The quantifier prefix ofΦ′′ isQb0 for either quantifierQ ∈ {∀,∃} followed by the quantifierprefix ofΦ′; that is, the quantifier prefix ofΦ′′ is obtained by adding, to the quantifier prefix ofΦ′, b0 as theoutermost quantified variable. It is straightforward to show thatΦ′ is true if and only ifΦ′′ is true.

Step 3. SinceΓ′′ has all unary operations as polymorphisms, it has all essentially unary operations aspolymorphisms, and we havePol(Γ′′) ⊇ Pol(Γ). By Theorem 3.15, we have the containmentΓ′′ ⊆ 〈Γ〉,and thusQCSP(Γ′′) reduces toQCSP(Γ) by Proposition 6.5. �

We can now prove the classification theorem.Proof. (Theorem 6.3) IfΓ has one of the given operations as a polymorphism, then the problemQCSP(Γ)is tractable; we refer the reader to the original proofs [2, 43, 22, 28] and to [25] for an algebraic approach.If Γ does not have one of the four given operations as a polymorphism, then by Theorem 5.1, the setPol(Γ) contains only essentially unary operations, andQCSP(Γ) is PSPACE-hard by Proposition 6.2 andTheorem 6.6. �

Exercise 6.7.WhenΓ is a constraint language, letsPol(Γ) denote the set containing allsurjectivepolymor-phisms ofΓ. Prove the following result, which was established by Borner et al. [14].

Theorem. LetΓ be a constraint language over a finite domainD. It holds that[Γ] = Inv(sPol(Γ)).

Hint: to show that a relationR ∈ Inv(sPol(Γ)) is in [Γ], defineR′ to be

R′ = {f(t1, . . . , tm) : f ∈ Pol(Γ), ti ∈ R×Dd}

which is the smallest relation in〈Γ〉 containingR×Dd, and consider

∀y1 . . . ∀yd(R′(v1, . . . , vk, y1, . . . , yd)).

Here, we used to denote the size ofD.

Exercise 6.8. Let Γ be a finite boolean constraint language. Prove that if[Γ] has one of the constantoperations0, 1 as a polymorphism, thenQCSP(Γ) is polynomial-time tractable.

7 Bounded alternation

In this section, we study the problemsQCSP(Γ) under restrictedprefix classes. What do we mean by aprefix class? For each instance of the QCSP, we may take the quantifier prefix, eliminate the variables, andthen group together consecutive quantifiers that are identical to obtain a pattern. For example, from thequantifier prefix∃w1∃w2∃w3∀y1∀y2∃x1∃x2∃x3∃x4 we obtain the pattern∃∀∃. An instance is said to haveprefix classΣ1 if its pattern is∃, prefix classΠ1 if its pattern is∀, prefix classΣ2 if its pattern is∃∀, prefixclassΠ2 if its pattern is∀∃, and so forth. The collection of formulas having prefix classΣk or Πk for somek ≥ 1 are said to be ofbounded alternationbecause in their quantifier prefixes, the number of alternationsbetween the two different quantifiers is bounded above by a constant. For allk ≥ 1 and finite constraint

ACM SIGACT News 21 Vol. —, No. —

languagesΓ, we defineΣk-QCSP(Γ) (Πk-QCSP(Γ)) to be the restriction ofQCSP(Γ) to instances havingprefix classesΣk (respectively,Πk). We study the prefix classes where the innermost quantifier is existential,that is, the classesΣk for oddk andΠk for evenk. It is known that the corresponding problems characterizethe complexity classesΣp

k, Πpk of the polynomial hierarchy.

Proposition 7.1. [57, 60] Let Γ be a finite constraint language over a finite domain. For evenk ≥ 2,the problemΠk-QCSP(Γ) is in Πp

k, and for oddk ≥ 3, the problemΣk-QCSP(Γ) is in Σpk. In addition,

letting Γ3 denote the constraint language from Example 3.4, for evenk ≥ 2, the problemΠk-QCSP(Γ3) isΠp

k-complete, and the problemΣk-QCSP(Γ3) is Σpk-complete.

This section proves the following classification theorem.

Theorem 7.2. LetΓ be a finite boolean constraint language. For allk ≥ 1, the problemsΠk-QCSP(Γ) andΣk-QCSP(Γ) are polynomial-time tractable ifΓ has one of the four operations{∧,∨,majority,minority}as a polymorphism; otherwise,

• the problemΠk-QCSP(Γ) is Πpk-complete for evenk ≥ 2, and

• the problemΣk-QCSP(Γ) is Σpk-complete for oddk ≥ 3.

Theorem 7.2 can be taken as a fine version of the last section’sclassification theorem (Theorem 6.3),showing that the constraint languages shown to be hard in that theorem are also hard under bounded alter-nation. Theorem 7.2 has been previously established by Hemaspaandra [39] and Bauland et al. [4].

How can we prove this theorem? The tractable cases clearly follow from those of the last section’sclassification theorem, so we are left with proving the hardness results. What happens if we try to establishthese hardness results by imitating the proof of the hardness results of the last section (that is, the proof ofTheorem 6.6)? We become faced with a difficulty: this proof relied on Proposition 6.5, which showed thatQCSP(Γ′) reduces toQCSP(Γ), assumingΓ′ ⊆ [Γ]. However, the given proof of this proposition doesnotpreserve the prefix class of the original formula: an instance Φ of QCSP(Γ′) is transformed into an instanceof QCSP(Γ) by taking few-definitions for the constraints inΦ and appending these few-definitions to theend of the quantifier prefix ofΦ! To overcome this difficulty, we establish a version of Proposition 6.5 whichdoespreserve the prefix class.

Theorem 7.3. LetΓ andΓ′ be finite constraint languages over the same finite domain. IfΓ′ ⊆ [Γ], then

• for evenk ≥ 2, there is a reduction fromΠk-QCSP(Γ′) to Πk-QCSP(Γ), and

• for oddk ≥ 3, there is a reduction fromΣk-QCSP(Γ′) to Σk-QCSP(Γ).

To the best of my knowledge, this theorem is new. Although here we only apply this theorem to thecase of a boolean domain, I would like to emphasize that the theorem gives a general tool that applies for allfinite domains, which I believe will be useful for studying the bounded alternation QCSP over domains oflarger size.

In order to prove Theorem 7.3, we establish a lemma that showsthat the relations in[Γ] can be expressedin a particular way.

Definition 7.4. LetR ⊆ Dk be a relation of arityk over a finite domainD of sized = |D|. Say thatR isspread-expressedbyR′ ⊆ Dk+d if the following two properties hold:

• (monotonicity) ifb1, . . . , bd, b′1, . . . , b′d ∈ D are elements such that{b1, . . . , bd} ⊇ {b′1, . . . , b

′d}, then

for all (a1, . . . , ak) ∈ Dk, R′(a1, . . . , ak, b1, . . . , bd) impliesR′(a1, . . . , ak, b′1, . . . , b

′d).

ACM SIGACT News 22 Vol. —, No. —

• (expression) ifb1, . . . , bd ∈ D are elements such that{b1, . . . , bd} = D, then for all(a1, . . . , ak) ∈Dk,R(a1, . . . , ak) if and only ifR′(a1, . . . , ak, b1, . . . , bd).

Lemma 7.5. LetΓ be a constraint language over a finite domainD. For every relationR ∈ [Γ], there existsa relationR′ ∈ 〈Γ〉 such thatR is spread-expressed byR′.

Proof. We letd denote the size ofD andk denote the arity ofR. If R is pp-definable fromΓ withoutthe use of quantifiers, then letφ(v1, . . . , vk) denote such a definition ofR(v1, . . . , vk). We defineR′ byR′(v1, . . . , vk, y1, . . . , yd) = φ(v1, . . . , vk).

Now suppose that the lemma is true for a relationR. We want to show that it is true for a relation obtainedfrom R by “quantifying away” a coordinate ofR. Suppose thatR2(x1, . . . , xk−1) = QxkR(x1, . . . , xk),with Q ∈ {∀,∃}. We consider two cases depending on the quantifierQ. In both cases, we useR′ to denotea relation such thatR is spread-expressed byR′.

CaseQ = ∃: It is straightforward to verify thatR2 is spread-expressed by the relationR′2 defined by

R′2(x1, . . . , xk−1, y1, . . . , yd) = ∃xkR

′(x1, . . . , xk, y1, . . . , yd).

CaseQ = ∀: We claim thatR2 is spread-expressed by the relationR′2 defined by

R′2(x1, . . . , xk−1, y1, . . . , yd) =

d∧

i=1

R′(x1, . . . , xk−1, yi, y1, . . . , yd).

We verify this as follows.First, we verify monotonicity. Suppose thatb1, . . . , bd, b′1, . . . , b

′d ∈ D are elements such that the con-

tainment{b1, . . . , bd} ⊇ {b′1, . . . , b′d} holds. Let(a1, . . . , ak−1) ∈ Dk−1 be a tuple, and suppose that

R′2(a1, . . . , ak−1, b1, . . . , bd) holds. Then, by the definition ofR′

2, we have

b∈{b1,...,bd}

R′(a1, . . . , ak−1, b, b1, . . . , bd), implying∧

b∈{b′1,...,b′

d}

R′(a1, . . . , ak−1, b, b1, . . . , bd).

By the monotonicity ofR′, this in turn implies that∧

b∈{b′1,...,b′

d}R

′(a1, . . . , ak−1, b, b′1, . . . , b

′d) holds, which

is equivalent toR′2(a1, . . . , ak−1, b

′1, . . . , b

′d).

Next, suppose thatb1, . . . , bd ∈ D are elements such that{b1, . . . , bd} = D, and let(a1, . . . , ak−1) ∈Dk−1 be a tuple. We have

R2(a1, . . . , ak−1) ⇔

∀b ∈ D(R(a1, . . . , ak−1, b)) ⇔

∀b ∈ D(R′(a1, . . . , ak−1, b, b1, . . . , bd)) ⇔

R′2(a1, . . . , ak−1, b1, . . . , bd).

We now give the proof of Theorem 7.3.Proof. (Theorem 7.3) For each relationR′ ∈ Γ′, there exists a relationR′′ ∈ 〈Γ〉 such thatR′ is spread-expressed byR′′. LetΦ′ be an instance ofΠk-QCSP(Γ′) or Σk-QCSP(Γ′) (with k as described in the state-ment of the theorem). Denote the quantifier prefix ofΦ′ byP ′ and the conjunction of constraints ofΦ′ byφ′,so thatΦ′ = P ′φ′. We create an instanceΦ′′ of Πk-QCSP(Γ) or Σk-QCSP(Γ) as follows. First, defineP ′′

to be a quantifier prefix obtained fromP ′ by introducing new universally quantified variablesy1, . . . , yd andplacing them next to any group of universally quantified variables inP ′, so that the prefix class is preserved.Next, defineφ′′ to be the conjunction of constraints containing a constraint R′′(v1, . . . , yk, y1, . . . , yd) for

ACM SIGACT News 23 Vol. —, No. —

every constraintR′(v1, . . . , vk) in φ′. The output of the reduction is the formulaΦ′′ = P ′′φ′′, but whereevery constraint is replaced with a pp-formula overΓ, as in the proof of Proposition 6.5.

To verify the correctness of the reduction, we need to show that Φ′ = P ′φ′ is true if and only ifΦ′′ =P ′′φ′′ is true. This follows from the following cycle of implications. Fixg0 : {y1, . . . , yd} → D to be asurjective mapping.

P ′φ′ ⇒ P ′∀y1 . . . ∀ydφ′′ ⇒ P ′′φ′′ ⇒ ∀y1 . . . ∀ydP

′φ′′ ⇒ P ′φ′′ is true underg0 ⇒ P ′φ′

We can now prove the classification theorem.Proof. (Theorem 7.2) Following the discussion earlier in this section, we need to show that, whenP = Πk

for an evenk ≥ 2 or P = Σk for an oddk ≥ 3, the problemP -QCSP(Γ) is hard for the correspondingclass of the polynomial hierarchy, assuming thatΓ does not have one of the four given polymorphisms.By Theorem 5.1, all polymorphisms ofΓ are essentially unary operations. LetΓ0 be the finite booleanconstraint language of Proposition 7.1, so thatP -QCSP(Γ0) is hard for the complexity class for which wewant to prove hardness.

We now follow the proof of Theorem 6.6. The main modification we need to make is in step 1. Step 1defines a constraint languageΓ′ having both constant polymorphisms such thatΓ0 ⊆ [Γ′]. Here, we appealto Theorem 7.3 (instead of Proposition 6.5) to obtain a reduction fromP -QCSP(Γ0) to P -QCSP(Γ′). Step2 can be carried out in a way that preserves the prefix class of the formula, since the new variableb0 can bequantified using either quantifier (as noted); this gives us areduction fromP -QCSP(Γ′) to P -QCSP(Γ′′)for a constraint languageΓ′′ having all unary operations as polymorphisms. Finally, in step 3, we havePol(Γ′′) ⊇ Pol(Γ) and henceΓ′′ ⊆ 〈Γ〉, that is, every relation inΓ′′ has a pp-definition inΓ. Since theinnermost quantifier ofP is existential, it follows thatP -QCSP(Γ′′) can be reduced toP -QCSP(Γ). �

Exercise 7.6.Describe the complexity of all finite constraint languages in the problemsΠk-QCSP(Γ) forall oddk ≥ 1, and the problemsΣk-QCSP(Γ) for all evenk ≥ 2.

Exercise 7.7.Give an alternative, algebraic proof of Lemma 7.5 by considering the hint of Exercise 6.7.

8 To infinity... and beyond?

In recent joint work, Manuel Bodirsky and I considered the quantified CSP over domains ofinfinite size [8].One class of constraint languages that we have considered isthe class ofequality constraint languages. Wesay that a constraint language over domainD is anequality constraint languageif each relation isequalitydefinable, by which we mean definable using equalities(u = v) and the usual boolean connectives¬, ∧,and∨. As an example, consider the ternary relationR ⊆ D3 defined by

R(x, y, z) ≡ (¬(x = y)) ∨ (y = z).

Clearly, the disequality relation6= is another example of an equality definable relation:

(x 6= y) ≡ (¬(x = y)).

As an intuition pump, considerCSP({6=}), the constraint satisfaction problem over the disequalityrelation.The problemCSP({6=}) is the |D|-colorability problem: given a set of pairs of variables, decide if thevariables can be colored with elements fromD such that each pair has different colors. Over afinitedomain,the problemCSP({6=}) is of course known to be NP-complete for|D| ≥ 3. On the other hand, over an

ACM SIGACT News 24 Vol. —, No. —

infinite domain, the problemCSP({6=}) is trivial: if an instance contains a constraint of the formv 6= v, itis not satisfiable, otherwise it is satisfiable by the assignment sending all variables to different values!

Within the class of equality constraint languages, we were able to establish a complexity upper bound.Let us define apositive constraint languageto be an equality constraint language where each relation isdefinable using equalities(u = v) and thepositiveboolean connectives∧ and∨. As an example, take therelationS ⊆ D4 defined by

S(w, x, y, z) ≡ ((w = x) ∧ (x = y)) ∨ (y = z).

It can be verified that a positive constraint language has allunary operations as polymorphisms.For a domainD of any size, the CSP over a positive constraint language is trivial; every instance is sat-

isfiable by the assignment sending all variables to the same value. In contrast, the QCSP is more interesting.We have shown that there exist positive constraint languages Γ over an infinite domain such thatQCSP(Γ)is NP-hard [7]; in fact, the constraint language containingthe single relationS just given is an example ofsuch a language. This negative result is complemented by thefollowing complexity upper bound.

Theorem 8.1. [8] Let Γ be a positive constraint language over an infinite domain, and let

Φ = Q1v1 . . . Qnvnφ

be an instance ofQCSP(Γ). The formulaΦ is true if and only if the formula

Φ′ = ∃v1 . . . ∃vn(φ ∧∧

i<j,Qj=∀

vi 6= vj)

is true. Hence,QCSP(Γ) reduces toCSP(Γ ∪ {6=}), and is in NP.

I would like to highlight a facet of our proof of Theorem 8.1: this proof only uses the fact that thequantifier-free partφ of aQCSP(Γ) instanceΦ has all unary operations as polymorphisms. We can thus usethe same proof to establish an NP upper bound on the more general class of quantified formulas where thequantifier-free part is anarbitrary positive formula!

Theorem 8.2. (follows from [8]) LetΦ = Q1v1 . . . Qnvnφ

be a formula whereφ is composed from equalities(u = v) and the connectives∧, ∨, and the variablesare interpreted over an infinite domain. The formulaΦ is true if and only if the formulaΦ′ defined in thestatement of Theorem 8.1 is true. Hence, deciding formulasΦ of the described form is in NP.

It should be pointed out that the NP upper bound established by Theorems 8.1 and 8.2 can be derivedfrom a result of Kozen [46]. However, I believe that the direct reduction to an existentially quantifiedformula given here constitutes a particularly transparentexplanation for the inclusion in NP. Again, as withthe results discussed in the first section of this article, these results are not tied to the particular syntacticform of the quantifier-free partφ, but only use the fact thatφ possesses certain polymorphisms. Indeed, ourproof demonstrates that Theorem 8.2 holds even if the quantifier-free partφ is given succinctly, say, as acircuit; this extension cannot, to the best of my knowledge,be readily derived from the proof of Kozen [46].

What I personally find most interesting here is that we are able to obtain a positive complexity result(Theorem 8.2) using the notion of polymorphism, for a class of formulas that fallsbeyondthe CSP frame-work, that is, does not require a conjunction of constraints. This is a twist of high intrigue: the concept ofpolymorphism has recently come into close focus for its relevance to thespecificclass of CSP formulas,but has now been brought to shed light on a moregeneralclass of logical formulas (namely, the positiveformulas of Theorem 8.2). I would like to suggest the search for further applications of polymorphisms togeneral logical formulas.

ACM SIGACT News 25 Vol. —, No. —

Further reading. For the reader interested in further studying the topics of this article, I offer some point-ers. I focus on the topics directly addressed by this article, such as algebraic methods for studying theproblemsCSP(Γ). However, even regarding these topics, the selection and discussion of references hereis not at all meant to be comprehensive, but rather is a sampling of the literature that reflects my personalinterests and biases.

As we have discussed, Schaefer [56] was the first to systematically consider the family of problemsCSP(Γ); he studied constraint languagesΓ over a two-element domain. While there does not appear tohave been work on these problems in the 80’s, the early 90’s saw papers of Hell and Nesetril [38] and Federand Vardi [34, 35] on these problems. Feder and Vardi [34, 35]conjectured that every problem of the formCSP(Γ) for Γ over a finite domain is either in P or NP-complete; this has become known as the Feder-Vardidichotomy conjecture. The algebraic, polymorphism-basedapproach to studying the problemsCSP(Γ) wasintroduced in the papers of Jeavons, Cohen, and Gyssens [42]and Jeavons [40]; the given references are forjournal papers which appeared in the late 90’s. Other foundational work on this algebraic approach appearsin the journal paper by Bulatov, Jeavons, and Krokhin [20].

Two major complexity classification results onCSP(Γ) were achieved by Bulatov: the classificationof all constraint languagesΓ over a three-element domain [21], and the classification of all conservativeconstraint languagesΓ, defined to be constraint languages containing all unary relations [15]. There is bynow a rich literature onCSP(Γ) tractability and complexity, including the papers [41, 33,19, 16, 45, 17, 31,18, 44, 51, 50].

PlacingCSP(Γ) problems in complexity classes “below” P has also been studied. Allender et al. [1] gavea refinement of Schaefer’s theorem showing each problemCSP(Γ), whereΓ is a constraint language overa two-element domain, to be complete for a known complexity class under AC0 reductions. See [32, 3, 49]for examples of other papers along these lines.

A framework for studying the CSP overinfinitedomains was proposed by Bodirsky [5]; see [6, 9, 10] forsubsequent work. The quantified CSP has been studied algebraically in papers including [14, 4, 8, 25, 24].For references on relevant algebra, we mention [59, 52, 23].Other surveys/overviews on these and relatedtopics include [28, 48, 47, 12, 13, 27].

Acknowledgements. I extend special thanks to Manuel Bodirsky and Vıctor Dalmau for many enjoyableconversations on the topics of this article. I am also indebted to Andrei Bulatov, Neil Immerman, BenoitLarose, Riccardo Pucella, Pascal Tesson, and Matt Valeriote for their numerous helpful comments andencouragement.

References

[1] Eric Allender, Michael Bauland, Neil Immerman, HenningSchnoor, and Heribert Vollmer. The com-plexity of satisfiability problems: Refining schaefer’s theorem. InProc. 30th International Symposiumon Mathematical Foundations of Computer Science (MFCS ’05), volume 3618 ofLecture Notes inComputer Science, pages 71–82, 2005.

[2] Bengt Aspvall, Michael F. Plass, and Robert Endre Tarjan. A linear-time algorithm for testing the truthof certain quantified boolean formulas.Information Processing Letters, 8(3):121–123, 1979.

[3] A. Atserias. On digraph coloring problems and treewidthduality. InLICS, 2005.

[4] Michael Bauland, Elmar Bohler, Nadia Creignou, Steffen Reith, Henning Schnoor, and HeribertVollmer. Quantified constraints: The complexity of decision and counting for bounded alternation.ECCC technical report, 2005.

ACM SIGACT News 26 Vol. —, No. —

[5] Manuel Bodirsky. Constraint satisfaction with infinitedomains. PhD thesis, Humboldt-Universitat zuBerlin, 2004.

[6] Manuel Bodirsky. The core of a countably categorical structure. In Volker Diekert and Bruno Du-rand, editors,Proceedings of the 22nd Annual Symposium on Theoretical Aspects of Computer Science(STACS’05), Stuttgart (Germany), LNCS 3404, pages 100–110, Springer-Verlag Berlin Heidelberg,2005.

[7] Manuel Bodirsky and Hubie Chen. Quantified equality constraints. Manuscript.

[8] Manuel Bodirsky and Hubie Chen. Collapsibility in infinite-domain quantified constraint satisfaction.In CSL 2006, 2006.

[9] Manuel Bodirsky and Victor Dalmau. Datalog for constraint satisfaction with infinite domains. InSTACS, 2006.

[10] Manuel Bodirsky and Jan Kara. The complexity of equality constraint languages. InProceedings ofthe International Computer Science Symposium in Russia (CSR’06), 2006.

[11] V. G. Bodnarchuk, L. A. Kaluzhnin, V. N. Kotov, and B. A. Romov. Galois theory for Post algebras. I,II. Cybernetics, 5:243–252, 531–539, 1969.

[12] E. Bohler, N. Creignou, S. Reith, and H. Vollmer. Playing with boolean blocks, part I: Post’s latticewith applications to complexity theory.ACM SIGACT-Newsletter, 34(4):38–52, 2003.

[13] E. Bohler, N. Creignou, S. Reith, and H. Vollmer. Playing with boolean blocks, part II: constraintsatisfaction problems.ACM SIGACT-Newsletter, 35(1):22–35, 2004.

[14] F. Borner, A. Bulatov, A. Krokhin, and P. Jeavons. Quantified constraints: Algorithms and complexity.In Computer Science Logic 2003, 2003.

[15] Andrei Bulatov. Tractable conservative constraint satisfaction problems. InProceedings of 18th IEEESymposium on Logic in Computer Science (LICS ’03), pages 321–330, 2003.

[16] Andrei Bulatov. A graph of a relational structure and constraint satisfaction problems. InProceedingsof 19th IEEE Annual Symposium on Logic in Computer Science (LICS’04), 2004.

[17] Andrei Bulatov. H-coloring dichotomy revisited.Theoretical Computer Science, 349(1):31–39, 2005.

[18] Andrei Bulatov and Victor Dalmau. A simple algorithm for Mal’tsev constraints.SIAM Journal ofComputing, 36(1):16–27, 2006.

[19] Andrei Bulatov and Peter Jeavons. An algebraic approach to multi-sorted constraints. InCP 2003,2003.

[20] Andrei Bulatov, Peter Jeavons, and Andrei Krokhin. Classifying the complexity of constraints usingfinite algebras.SIAM J. Computing, 34(3):720–742, 2005.

[21] Andrei A. Bulatov. A dichotomy theorem for constraint satisfaction problems on a 3-element set.Journal of the ACM (JACM), 53, 2006.

[22] Hans Kleine Buning, Marek Karpinski, and Andreas Flogel. Resolution for quantified boolean formu-las. Information and Computation, 117(1):12–18, 1995.

ACM SIGACT News 27 Vol. —, No. —

[23] Stanley N. Burris and H.P. Sankappanavar.A Course in Universal Algebra. Available on-line.

[24] Hubie Chen. Existentially restricted quantified constraint satisfaction. Arxiv cs.CC/0506059.

[25] Hubie Chen. The complexity of quantified constraint satisfaction: Collapsibility, sink algebras, andthe three-element case, 2006. arXiv.org:cs/0607106.

[26] Hubie Chen and Victor Dalmau. From pebble games to tractability: An ambidextrous consistencyalgorithm for quantified constraint satisfaction. InComputer Science Logic, 2005.

[27] David Cohen and Peter Jeavons. The complexity of constraint languages.Handbook of ConstraintProgramming, Elsevier, Chapter 8, 2006.

[28] Nadia Creignou, Sanjeev Khanna, and Madhu Sudan.Complexity Classification of Boolean ConstraintSatisfaction Problems. SIAM Monographs on Discrete Mathematics and Applications. Society forIndustrial and Applied Mathematics, 2001.

[29] Victor Dalmau. Computational complexity of problems over generalized formulas. Ph.D. thesis, LSI-UPC, 2000.

[30] Victor Dalmau. Some dichotomy theorems on constant-free quantified boolean formulas. TechnicalReport LSI-97-43-R, Llenguatges i Sistemes Informatics -Universitat Politecnica de Catalunya, 1997.

[31] Victor Dalmau. Generalized majority-minority operations are tractable. InLICS, 2005.

[32] Victor Dalmau. Linear datalog and bounded path dualityof relational structures.Logical Methods inComputer Science, 1(1), 2005.

[33] Victor Dalmau and Justin Pearson. Closure functions and width 1 problems. InCP 1999, pages159–173, 1999.

[34] Tomas Feder and Moshe Y. Vardi. Monotone monadic snp and constraint satisfaction. InSTOC 1993,pages 612–622, 1993.

[35] Tomas Feder and Moshe Y. Vardi. The computational structure of monotone monadic snp and con-straint satisfaction: A study through datalog and group theory. SIAM J. Comput., 28(1):57–104, 1998.

[36] D. Geiger. Closed systems of functions and predicates.Pac. J. Math., 27:95–100, 1968.

[37] E. Gradel. Capturing complexity classes by fragmentsof second order logic.Theoretical ComputerScience, 101:35–57, 1992.

[38] P. Hell and J. Nesetril. On the complexity ofH-coloring. Journal of Combinatorial Theory, Ser.B,48:92–110, 1990.

[39] Edith Hemaspaandra. Dichotomy theorems for alternation-bounded quantified boolean formulas.CoRR, cs.CC/0406006, 2004.

[40] Peter Jeavons. On the algebraic structure of combinatorial problems.Theoretical Computer Science,200:185–204, 1998.

[41] Peter Jeavons, David Cohen, and Martin Cooper. Constraints, consistency, and closure.ArticialIntelligence, 101(1-2):251–265, 1998.

ACM SIGACT News 28 Vol. —, No. —

[42] P.G. Jeavons, D.A. Cohen, and M. Gyssens. Closure properties of constraints.Journal of the ACM,44:527–548, 1997.

[43] Marek Karpinski, Hans Kleine Buning, and Peter H. Schmitt. On the computational complexity ofquantified horn clauses. InCSL 1987, pages 129–137, 1987.

[44] E. Kiss and M. Valeriote. On tractability and congruence distributivity. InLICS, 2006.

[45] Ondrej Klıma, Pascal Tesson, and Denis Therien. Dichotomies in the complexity of solving systems ofequations over finite semigroups. Electronic Colloquium onComputational Complexity (ECCC)(091),2004.

[46] Dexter Kozen. Positive first-order logic is NP-complete. IBM Journal of Research and Development,25(4):327–332, 1981.

[47] Andrei Krokhin, Andrei Bulatov, and Peter Jeavons. Thecomplexity of constraint satisfaction: analgebraic approach.Structural Theory of Automata, Semigroups, and Universal Algebra, Proceedingsof SMS-NATO ASI, University of Montreal, pages 181–213, 2003.

[48] Andrei Krokhin, Andrei Bulatov, and Peter Jeavons. Functions of multiple-valued logic and the com-plexity of constraint satisfaction: A short survey. InProceedings of 33rd IEEE International Sympo-sium on Multiple-Valued Logic (ISMVL’03), pages 343–351, 2003.

[49] B. Larose, C. Loten, and C. Tardif. A characterisation of first-order constraint satisfaction problems.In LICS, 2006.

[50] B. Larose and L. Zadori. Bounded width problems and algebras. To appear in Algebra Universalis.

[51] B. Larose and L. Zadori. Taylor terms, constraint satisfaction and the complexity of polynomial equa-tions over finite algebras.Internat. J. Algebra Comput., 16(3):563–581, 2006.

[52] R.N. McKenzie, G.F. McNulty, and W.F. Taylor. Algebras, Lattices and Varieties, volume I.Wadsworth and Brooks, California, 1987.

[53] Emil L. Post. The Two-Valued Iterative Systems of Mathematical Logic. Princeton University Press,1941.

[54] Omer Reingold. Undirected st-connectivity in log-space. Electronic Colloquium on ComputationalComplexity (ECCC), 094, 2004.

[55] I.G. Rosenberg. Minimal clones I: the five types. InLectures in Universal Algebra (Proc. Conf. Szeged1983), volume 43 ofColloq. Math. Soc. Janos Bolyai, pages 405–427. North-Holland, 1986.

[56] Thomas J. Schaefer. The complexity of satisfiability problems. InProceedings of the ACM Symposiumon Theory of Computing (STOC), pages 216–226, 1978.

[57] L. Stockmeyer. The polynomial-time hierarchy.Theoretical Computer Science, 3(1):1–22, 1976.

[58] L. Stockmeyer and A. R. Meyer. Word problems requiring exponential time. In5th ACM Symp. onTheory of Computing, pages 1–10, 1973.

[59] A. Szendrei.Clones in Universal Algebra, volume 99 ofSeminaires de Mathematiques Superieures.University of Montreal, 1986.

ACM SIGACT News 29 Vol. —, No. —

[60] Celia Wrathall. Complete sets and the polynomial-timehierarchy. Theoretical Computer Science,3(1):23–33, 1976.

ACM SIGACT News 30 Vol. —, No. —