General Lower Bounds and Improved Algorithms for Infinite–Domain CSPs

We study the fine-grained complexity of NP-complete, infinite-domain constraint satisfaction problems (CSPs) parameterised by a set of first-order definable relations (with equality). Such CSPs are of central importance since they form a subclass of any infinite-domain CSP parameterised by a set of first-order definable relations over a relational structure (possibly containing more than just equality). We prove that under the randomised exponential-time hypothesis it is not possible to find c>1\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$c > 1$$\end{document} such that a CSP over an arbitrary finite equality language is solvable in O(cn)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$O(c^n)$$\end{document} time (n is the number of variables). Stronger lower bounds are possible for infinite equality languages where we rule out the existence of 2o(nlogn)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$2^{o(n \log n)}$$\end{document} time algorithms; a lower bound which also extends to satisfiability modulo theories solving for an arbitrary background theory. Despite these lower bounds we prove that for each c>1\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$c > 1$$\end{document} there exists an NP-hard equality CSP solvable in O(cn)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$O(c^n)$$\end{document} time. Lower bounds like these immediately ask for closely matching upper bounds, and we prove that a CSP over a finite equality language is always solvable in O(cn)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$O(c^n)$$\end{document} time for a fixed c, and manage to extend this algorithm to the much broader class of CSPs where constraints are formed by first-order formulas over a unary structure.


Introduction
In this article we study the fine-grained, rather than classical, coarse, complexity of infinite-domain constraint satisfaction problems. We approach the subject in a systematic manner and obtain powerful lower bounds applicable to all infinite-domain CSPs where constraints consists of first-order definable relations over a fixed relational structure. In the direction of upper bounds we obtain improved, single-exponential time algorithms for equality CSPs, and the broader class of CSPs over reducts of unary structures. Some parts of this article have been presented in preliminary form in a conference publication [20].

Background
Let Γ denote a (finite or infinite) set of finitary relations over a (finite or infinite) set D. The input to the constraint satisfaction problem over Γ (CSP(Γ )) is a pair (V , C) where V is a set of variables (with domain D) and C is a set of constraints over Γ . A constraint is an expression R(x 1 , . . . , x n ) where x 1 , . . . , x n are variables in V and n equals the arity of the relation R. The problem is to find an assignment f : V → D that satisfies every constraint in C, i.e. ( f (x 1 ), . . . , f (x n )) ∈ R for every constraint R(x 1 , . . . , x n ) in C. The set Γ is called the constraint language or the template. The CSP is computationally hard in the general case; if the variable domains are finite, then the problem is NP-complete, and otherwise it may be of arbitrarily high complexity or even undecidable [6].
Depending on the constraint language Γ , it is possible to formulate many natural problems as CSP(Γ ) problems. This is especially true if we allow templates over an infinite universe, which increases the expressive power of CSPs and e.g. makes it possible to formulate a rich amount of problems from artificial intelligence [7,15]. The complexity of CSPs have also been the subject of intense theoretical research: for each constraint language Γ over a finite domain CSP(Γ ) is always either polynomial-time solvable or is NP-complete [13,41]. Infinite-domain CSPs are in general undecidable, but there exists a wealth of results when additional restrictions are imposed. Early examples include the CSP formulation of Allen's interval algebra [25], the region connection calculus [31], CSPs over first-order definable relations with equality [8] (equality CSPs), and temporal CSPs [9], i.e. CSPs where the constraint language is first-order definable in the structure (Q; <) whose domain is the set of rational numbers Q and where < denotes the usual strict order of the rationals. More generally, it is common to consider first-order reducts of a fixed relational structure A, i.e., languages that are first-order definable with equality over A. Equality CSPs then correspond to CSP(Γ ) when Γ is a first-order reduct of (A; ∅) for some universe A (an equality language) while temporal CSPs correspond to CSP(Γ ) when Γ is a first-order reduct of (Q; <). To make the intended meaning clearer we sometimes treat equality languages as first-order reducts of (A; =), where = is the equality relation over the universe A, even though this is strictly speaking not needed since the equality relation is always allowed in first-order formulas. Equality CSPs have previously been intensively studied due to their fundamental importance for understanding more complex CSPs, since any classification of a larger relational structure A necessarily also needs to include a classification of equality CSPs (an equality language Γ is a reduct of any countably infinite structure A). Let us also remark that CSPs in this setting are very similar to reasoning problems occurring in artificial intelligence, where one fixes a set of "base relations" A, typically binary, and then consider a satisfiability problem where constraints are taken from e.g. the relation algebra generated by A, or the set of all disjunctive clauses over A [15]. A recent comparison may also be found in satisfiability modulo theories (SMT) where a background theory A is fixed, and where one considers the satisfiability problem of first-order formulas (with equality) restricted to interpretations agreeing with A [3].
While theoretical CSP research has concentrated on classical complexity, complexity theory itself has partially shifted towards parameterised complexity and fine-grained complexity, which e.g. encompasses constructing improved exponentialtime algorithms, and proving lower bounds with stronger assumptions than P = NP. A popular conjecture for this purpose is the exponential-time hypothesis (ETH). It states that the 3-SAT problem is not solvable in subexponential time, i.e. it is not solvable in 2 o(n) time, where n is the number of variables. Another popular conjecture is the strong ETH (SETH) which, roughly, states that the fine-grained complexity of k-SAT tends to 2 n for increasing values of k.
In this article we study the fine-grained complexity of NP-hard infinite-domain CSPs, with a particular focus on equality CSPs using the number of variables, n, as the complexity parameter. As remarked, equality CSPs constitute a natural starting point for questions of fine-grained complexity, since if we cannot even overcome this obstacle there is little hope of understanding fine-grained complexity questions for larger classes of CSPs. Assume, for example, that we prove that there exists an equality language Γ such that CSP(Γ ) is not solvable in O( f (n)) time, for some function f . Then, regardless of which relational structure A that we choose, we cannot hope to construct an algorithm with a running time of O( f (n)) which is applicable to CSP(Δ) for every first-order reduct Δ of A. Under this viewpoint it is therefore crucial to prove lower bounds for equality CSPs before moving on to construct faster exponential-time algorithms for broader classes of infinite-domain CSPs.
Thus, among the class of NP-hard equality CSPs, how does the choice of Γ affect the fine-grained complexity of CSP(Γ )? For example, it is known that CSP(Γ ) is solvable in O * (2 n·log( 0.792n ln(n+1) ) ) time when Γ is an arbitrary equality language [18] (the O * notation is used to suppress polynomial factors). Concerning lower bounds it is known that no NP-complete equality CSP(Γ ) problem is solvable in subexponential time without violating the ETH. This follows from Barto & Pinsker [2]: if Γ is an equality language and CSP(Γ ) is NP-hard, then Γ pp-interprets 3-SAT since Γ is a first-order reduct of the finitely bounded homogeneous structure (N; =). This fact combined with Theorem 3.1 in [22] gives the result. Furthermore, if Γ is the full firstorder reduct of (A; =) then there cannot exist an O * (c n ) time algorithm for CSP(Γ ) for any constant c without violating the SETH [18]. Despite bounds like these, there are still large gaps in our understanding of fine-grained complexity of infinite-domain CSPs in general, and of equality CSPs in particular. For example, is it possible to find an equality language Γ such that CSP(Γ ) is NP-complete but solvable in O(c n ) time for a constant c > 1? Is it possible to solve CSP(Γ ) in O(c n ) time whenever Γ is a finite equality language, and in that case, does c depend on Γ or is it possible to find a uniform value? Furthermore, since no NP-complete equality CSP is solvable in subexponential time without violating the ETH, does there exist a c > 1 such that no NP-complete equality CSP is solvable in O(c n ) time?

Our Results
After defining the necessary preliminaries (in Sect. 2) we in Sect. 3 begin to answer the aforementioned questions by a careful study of lower bounds. First, we prove that under the randomised ETH for each c > 1 there exists a finite equality language Γ c such that CSP(Γ c ) is not solvable in O(c n ) time. Second, we showcase a striking difference between finite and infinite languages and prove the existence of an infinite equality language Γ such that CSP(Γ ) is not solvable in 2 o(n log n) time (under the ETH). In particular this lower bound rules out a uniform O(c n ) time algorithm, c > 1, applicable to arbitrary equality CSPs (which previously was only known to hold under the much stronger SETH). We also manage to lift this lower bound to SMT, where little is known about the fine-grained complexity, despite being a framework with a wide range of applications due to the availability of efficient SAT solvers. We provide the first known lower bound under the ETH and show that regardless of the background theory it is not possible to solve the resulting SMT in 2 o(n log n) time without violating the ETH. Importantly, this shows that existing algorithms for SMT running in 2 O(n log n) time are close to being optimal (cf. Rodeh & Strichman [32]). It should also be noted that we are able to prove this as a straightforward consequence of our general bounds for equality CSPs, indicating yet another advantage of studying fine-grained complexity in this setting. Third, we prove that for each constant c > 1 there exists an NP-complete equality CSP which is solvable in O(c n ) time, and thus rule out the existence of an "easiest NP-complete equality CSP". Such CSPs are known to exist for finite-domain CSPs [22] so we see a clear dividing line between finite and infinite-domain CSPs. We also provide an algebraic explanation of the lack of such an "easiest CSP problem", based on a connection between finegrained complexity of CSPs and algebraic invariants called partial polymorphisms. Since partial polymorphisms recently have become an important tool for studying finegrained complexity of CSPs and related problems [21-23, 26, 27] it therefore appears important to chart any differences to the finite-domain case. In short, an "easiest NPcomplete CSP" would have a maximally large set of partial polymorphisms, and we prove that such a maximal set cannot exist for the set of all equality relations. The proof also generalises to other classes of languages, e.g., temporal languages, and can, interestingly, be proven independently of any complexity theoretical assumptions.
In light of these lower bounds, what is the best possible exponential-time algorithm for equality CSPs that we could hope for? We tackle this question in Sect. 4 and construct an O * (c n ) time algorithm for CSP(Γ ) whenever Γ is a finite equality language, where c is a constant depending only on the arities of relations in Γ . Note that while the constant c likely can be improved, we have already established (under the randomised ETH) that it is not possible to find a uniform value. Similarly, it appears difficult to extend the algorithm to non-trivial classes of infinite equality languages since we have already proved that there is an infinite equality language that cannot be solved in 2 o(n log n) time under the ETH. Here, it is also interesting to note that certain classes of infinite-domain CSPs do not admit an O(c n ) algorithm even if the template is finite. For instance, there is a finite temporal language whose CSP (under the randomised ETH) cannot be solved in 2 o(n log n) time [19]. Could it even be the case that finite equality CSPs are the only reasonable class of infinite-domain CSPs solvable in single-exponential time, and that every non-trivial structure results in CSPs of higher complexity? This, however, is not the case, and we do manage to construct an O * (c n ) time algorithm applicable to a much richer and broader class of problems, namely CSPs over reducts of unary structures. More precisely, say that Γ is a unary structure (US) language if Γ is a first-order reduct of a structure (A; U 1 , . . . , U k ) where each U i is unary. Such CSPs are a subclass of first-order definable structures with atoms and have attracted recent attention from the automata theory community [11,12,24]. They have also been studied by the CSP community and the complexity has been fully classified [5,10]. The algorithm works by partitioning the domains of the unary relations U 1 , . . . , U k in such a way that we create a finite "pseudo-universe" U where each element gives an implicit description of a finite equality language. This makes it possible to enumerate the elements of U and in each iteration test the satisfiability of the corresponding equality CSP instance.
These results paint a peculiar picture of the fine-grained complexity of equality CSPs (and all classes of infinite-domain CSPs over first-order reducts of relational structures). On the one hand, equality CSPs are incredibly hard to solve (no uniform O(c n ) time algorithm for finite languages under the randomised ETH, and no 2 o(n log n) time algorithm for infinite languages), but on the other hand one for any c > 1, say, c = 1.00001, can find an NP-hard equality CSP solvable in O(c n ) time. These conflicting messages indicate that a complete understanding of fine-grained complexity of equality CSPs is well out of reach, but we have simultaneously unravelled several interesting research directions. We discuss some of these in Sect. 5.

Preliminaries
A relational structure is a tuple (A; σ, I ) where A is a set typically called a domain, or a universe, σ is a relational signature, and I is a function from σ to the set of all relations over A which assigns each relation symbol a corresponding relation over A. For simplicity, we will typically write a relational structure as (A; R 1 , . . . , R k ) where each R i is a relation over A, and will not make a sharp distinction between relations and their corresponding signatures. A set of relations Γ over A is a first-order reduct of a relational structure A = (A; R 1 , . . . , R k ) if each R ∈ Γ is the set of models of a σ -formula (with equality) interpreted in (A; R 1 , . . . , R k ). Alternatively, one may view Γ as a set of relations where each relation has a first-order definition (without parameters) in A. In symbols, we write R(x 1 , . . . , x n ) ≡ ϕ(x 1 , . . . , x n ) if R is the set of models of the first-order formula ϕ(x 1 , . . . , x n ) with respect to the free variables x 1 , . . . , x n .

The Constraint Satisfaction Problem
Let Γ be a set of finitary relations over some set A of values, occasionally called a constraint language. The constraint satisfaction problem over Γ (CSP(Γ )) is defined as follows.
Instance: A set V of variables and a set C of constraints of the form R(x 1 , . . . , x k ), where k is the arity of R, x 1 , . . . , x k ∈ V and R ∈ Γ . Question: Is there a function f : Concerning representation, we take a simple approach and only consider the case when Γ is a first-order reduct of a relational structure, and represent each relation R ∈ Γ by a first-order formula. However, the exact representation is only important if Γ is infinite, since any reasonable representation can be chosen and precomputed if Γ is finite.

Primitive Positive Definitions and Interpretations
Let Γ be a constraint language over a domain A. A k-ary relation R is said to have a primitive positive definition (pp-definition) over Γ if where each R i ∈ Γ ∪ {Eq A } and each x i is a tuple of variables over x 1 , . . . , x k , y 1 , . . . , y k matching the arity of R i . Here, and in the sequel, Eq A is the equality relation {(a, a) | a ∈ A)} over A. Thus, R is definable by a first-order formula consisting only of existential quantification and conjunction over positive atoms from Γ and equality constraints. If Γ is a constraint language we let Γ be the smallest set of relations containing Γ closed under pp-definitions. Pp-definitions are typically only useful for comparing similar languages over the same domain, but can be generalised as follows.

Definition 1 Let
A and B be two domains and let Γ and Δ be two constraint languages over A and B, respectively. A primitive positive interpretation (pp-interpretation) of Δ over Γ consists of: Hence, pp-interpretations are generalisations of pp-definitions, and can be used to obtain polynomial-time reductions between CSPs. We invite the reader to verify that a standard reduction from the 3-coloring problem (formulable as a CSP over the inequality relation over a ternary domain) to 3-SAT (formulable as a Boolean CSP) can be expressed as a pp-interpretation of the 3-coloring relation over 3-SAT.

Equality Languages
We say that Γ is an equality language if each R ∈ Γ admits a first-order definition over a relational structure (A; ∅), i.e. the empty structure. Recall here that the equality relation is always accessible in first-order logic. Without loss of generality we henceforth assume that A = N, write Eq (or = in infix notation) for the equality relation over N, and R = or = (in infix notation) for the inequality relation {(x, y) ∈ N 2 | x = y} over N. Via these conventions an equality language can also be viewed as a set of firstorder definable relations over (N; =), and we typically prefer this notation over (A; ∅) since the intended meaning is clearer. The computational problem we consider is then CSP(Γ ) when Γ is an equality language. This problem is easily seen to belong to NP for any finite language, and its classical complexity has been completely classified [8].
Theorem 2 Let Γ be an equality language. Then either Thus, {S} is an equality language, and it is known that {S} pp-interprets a language Δ where CSP(Δ) is NP-hard, which implies that CSP({S}) is NP-hard, too. For tractability, if we take {Eq, R = } then CSP({Eq, R = }) is well-known to be polynomial-time solvable. This can be proven via Theorem 2, however, CSP({Eq, R = }) can also be solved by elementary propagation methods.

Fine-Grained Complexity and the Exponential-Time Hypothesis
Assume that CSP(Γ ) is NP-complete. How fast can we solve CSP(Γ ), and is it possible to prove stronger lower bounds than an expected superpolynomial running time (under P = NP)? Such questions, especially when the complexity parameter is the number of variables |V | or the number of constraints |C|, fall under the umbrella of fine-grained complexity. To prove non-trivial lower bounds for NP-complete problems we typically need stronger assumptions than P = NP. Say that CSP(Γ ) is solvable in The conjecture that 3-SAT is not solvable in subexponential time is called the exponential-time hypothesis (ETH). There exists several stronger variants of the ETH. First, an algorithm A is said to be a 2 c·|V | -randomised algorithm if its running time is bounded by 2 c·|V | · poly(||I ||) and its error probability is at most 1/3 (||I || is the number of bits required to represent a CSP instance I ). For k, d ≥ 1 we then define where Γ d,k is the set of all relations over the set {0, . . . , d − 1} of arity at most k. The randomised exponential-time hypothesis (r-ETH) is then the conjecture that c 2,3 > 0, i.e., that 3-SAT is not solvable in subexponential time even with randomised algorithms, and the strong exponential-time hypothesis (SETH) is the conjecture that the limit of the sequence c 3 , c 4 , . . . is equal to 1.

Lower Bounds on the Complexity of Equality Constraints
In this section we investigate lower bounds for equality CSPs. As remarked in Sect. 1, such lower bounds are valuable since if it is possible to prove that, for an equality for some function f ) then, for some arbitrary relational structure A, there exists a Δ such that CSP(Δ) is not solvable in O( f (|V |)) time and Δ is a first-order reduct of A. Let us recapitulate two known lower bounds.

Theorem 3
Let Γ be an equality language.

If CSP(Γ ) is NP-hard then it is not solvable in subexponential time unless the ETH is false (Theorem 3.1 in [22]), and 2. If Γ is the full first-order reduct of (N; =) then CSP(Γ ) is not solvable in O(c |V | )
time for any c > 1 unless the SETH is false (Theorem 19 in [18]).

Finite Versus Infinite Equality Languages
We begin by proving that for every c > 1 there exists a finite equality language Γ c such For arbitrary d then define the finite equality language We present a polynomial-time reduction from CSP( Thus, assuming the r-ETH, there cannot exist an algorithm solving CSP(Γ ) in O(c |V | ) time for every finite equality language Γ . This can be strengthened even further for infinite equality languages, and we will show the existence of Γ such that CSP(Γ ) is not solvable in O(2 o(|V | log |V |) ) time without contradicting the ETH. In contrast, the second statement of Theorem 3 is only valid under the much stronger SETH, and only if Γ consists of all first-order definable relations over (N; =). For this lower bound we provide a reduction from the k × k Independent Set problem: given a graph G over the vertex set {1, . . . , k} × {1, . . . , k} (where k is part of the input), is there an independent set of size k in G with exactly one element from each row? One may view this problem as a variant of the standard Independent Set problem where the vertices are the elements of a k × k table and one wants to find an independent set that contain exactly one element from each row. The following lower bound is known under the ETH [29].
Proof To prove the result, we present a polynomial-time reduction from k × k Independent Set to CSP(Γ inf ) such that the resulting CSP(Γ inf ) instance only contains 2k variables. Let G = (V , E) denote an arbitrary graph where V = {1, . . . , k} × {1, . . . , k}. We then begin by introducing k variables a 1 , . . . , a k together with the con- a 1 , . . . , a k ). This constraint ensures that x i equals one of the variables a 1 , . . . , a k . Third, for each edge e = ((a, b), (c, d)) ∈ E, introduce the constraint R(x a , a b , x c , a d ). This constraint guarantees that both endpoints of an edge are not put into the independent set simultaneously.
Hence, we cannot even hope to solve CSP(Γ ) in O(c |V | ) time for any c when Γ is allowed to be infinite. Furthermore, since an equality CSP is always solvable in 2 O(|V | log |V |) time [18], the bound in Theorem 7 is asymptotically tight.
Thus, the distinction between finite and infinite languages seems to be rather important in the context of equality CSPs, but if one considers slightly richer structures than (N; =) then significantly stronger bounds can be obtained also for finite languages. Let ≺ ⊆ D 2 denote a binary relation over a set D and let denote its converse where x y holds if and only if y ≺ x holds. We say that ≺ is an acyclic order if there does not exist any finite subset Acyclic orders are irreflexive (i.e. they do not contain any element d such that d ≺ d) by definition. We say that ≺ is a strict partial order if it is irreflexive and for arbitrary Finally, we say that ≺ contains unbounded total orders if for every k ∈ N, there exists a subset L ⊆ D such that |L| ≥ k and ≺ is a strict total order on L.

Example 2
The less-than relation < over Q is an acyclic order containing unbounded total orders. For the latter property, simply observe that < is a strict total order {1, . . . , k}. However, there exists a wealth of examples of acyclic orders containing unbounded total orders in the artificial intelligence literature, especially in combination with qualitative reasoning problems, e.g., temporal and spatial reasoning problems such as Allen's interval algebra and the region connection calculus. For many additional examples of this kind, see e.g. the survey by Dylla et al [15].
The following result is a significant strengthening of Theorem 11 in [19].
Theorem 8 Let ≺ ⊆ D 2 be an acyclic order that contains unbounded total orders. Then, there exists a constraint language Γ such that Clearly, Γ is finite and (quantifier-free) first-order definable in (D; ≺). Assume that CSP(Γ ) can be solved in 2 o(n log n) time. We show how to polynomial-time reduce k ×k Independent Set to CSP(Γ ) in a way such that only O(k) variables are used. Hence, k × k Independent Set can be solved in 2 o(k log k) time and this contradicts the ETH via Theorem 6.
Let G = (V , E) be an arbitrary instance of k × k Independent Set. Introduce 2k + 1 fresh variables y 1 , . . . , y k , t 1 , . . . , t k+1 . The idea behind these variables is that y i , 1 ≤ i ≤ k, points out the vertex in row i that is to be included in the independent set. This is done with the aid of variables t 1 , . . . , t k+1 . Informally speaking, if y i "lies between" t j and t j+1 , then we will put the jth vertex on row i into the independent set. Now, let V 1 = {y 1 , . . . , y k , t 1 , . . . , t k+1 } and Since ≺ is a acyclic order that contains unbounded total orders, we know that In every solution s to I 1 , it holds that Let C 2 denote the corresponding set of constraints and let It is easy to verify that in every solution s to I 2 and for each 1 ≤ j ≤ k, the variable y j , satisfies s(t i ) ≺ s(y j ) ≺ s(t i+1 ) for exactly one 1 ≤ i ≤ d. We will interpret this as "the ith vertex on row j is chosen for inclusion in the independent set". Note that a solution always exists to I 2 since ≺ is a acyclic order that contains unbounded total orders. For With the given interpretations of y a , t b , y c , t d , this constraint implies that we cannot simultaneously choose vertex b on row a and vertex d on row c for inclusion in the independent set. Let C 3 denote the resulting set of constraints and let I 3 = (V 1 , C 1 ∪ C 2 ∪ C 3 ). Given the explanations above, it is easy to verify that I 3 is satisfiable if and only if G is a yes-instance. We conclude the proof by noting that I 3 can be computed in polynomial time and contains O(k) variables.

Satisfiability Modulo Theories
We will now consider a problem which is related to equality CSPs, for which we rather effortlessly can obtain lower bounds by reducing from CSP(Γ inf ). Satisfiability modulo theories (SMT) is a decision problem for logical formulas with respect to a given background theory. The logical formulas are expressed in classical first-order logic with equality. However, it is quite common to not use the full power of this framework; for instance, a frequent restriction is to require that the formulas are quantifier-free (and we will use this fragment ourselves below). An accessible introducion to SMT can be found in the survey by Barrett et al. [1]. Let SMT(T ) be the problem of determining whether a first-order formula (with respect to a background theory T ) is satisfiable, and let SMT ∀ (T ) be the subproblem where universal quantifiers are not allowed. We can then readily prove a matching lower bound valid for any background theory T .  y, x 1 , . . . , x n ), and y, z, w).
It is obvious that F is true if and only if (V , C) has a solution, that F can easily be constructed in polynomial time, and that F contains as many variables as there are variables in V . The result then follows from Theorem 7.
SMT ∀ (∅) is often referred to as equality logic and this problem is important in, for instance, hardware verification [14]. In fact, a slightly more expressive logic known as the logic of equality with uninterpreted functions (EUF) is extensively used in hardware verification. There are several known algorithms that solve EUF in O(|V |!) = 2 O(|V | log |V |) time -see, for instance, the discussion in Sect. 12 in the article by Rodeh & Strichman [32]. We conclude, with the aid of Theorem 9, that such algorithms are close to optimal.
To present another optimality result in SMT, we consider the well-known unit two variable per inequality (UTVPI) class of constraints, i.e., SMT ∀ (UTVPI) where UTVPI for each integer b and coefficients c 1 , c 2 ∈ {−1, 1} contains the relation {(x, y) ∈ Z 2 | c 1 · x + c 2 · y ≥ b}. The UTVPI class has many applications in, for instance, abstract interpretation, spatial databases, and theorem proving (cf. Schutt and Stuckey [37] and the references therein). It is known [38] that SMT ∀ (UTVPI) can be solved in 2 O(|V | log d) time where d = 2|V |(b max + 1) + 1 and b max is the maximum over the absolute values of constant terms in the constraints. Using Theorem 9 we can prove that this algorithm is close to optimal.
The formulas constructed in Theorem 9 are SMT ∀ (UTVPI) formulas (degenerate ones, though, since they do not contain UTVPI constraints). Thus, b max for this class X of formulas is 0, implying that A can solve SMT ∀ (UTVPI) restricted to X in 2 o(n log n) time, contradicting Theorem 9.
Difference logic is an interesting fragment of SMT ∀ (UTVPI) where only constraints of the form x − y ≥ b are allowed. Difference logic has found applications in, for example, verification of timed automata [30] and analysis of dynamic fault trees [40]. The lower bound in Theorem 10 naturally holds also in this restricted case.

No Easiest NP-Hard Infinite-Domain CSP
Our lower bounds suggest that equality CSPs are rather different from finite-domain CSPs when viewed under the lens of fine-grained complexity. In this section we prove yet another differentiating factor. For each finite A it is known that there exists a constraint language Γ A with domain A such that CSP(Γ A ) is NP-complete, and if an NP-complete CSP(Δ) 1 [22]. More generally, if G is a set of constraint languages over A, Contrary to the finite-domain case we will prove that there does not exist an easiest NP-complete equality CSP, unless the ETH is false. In order to prove this, we show that for every c > 1 there exists an equality language Γ c such that CSP(Γ c ) is NPcomplete but solvable in O * (c |V | ) time. First, recall from Example 1 that the ternary relation S = {(x, x, y), (x, y, y) | x, y ∈ N, x = y} has an NP-complete CSP. We will show how S can be extended with additional arguments in order to decrease the time complexity of the resulting CSP. If v = (v 1 , . . . , v k ) and w = (w 1 , . . . , w k ) are two k-ary tuples of variables, x is a variable, and R is a binary relation, then we where v = (v 1 , . . . , v k ) and w = (w 1 , . . . , w k ) are two distinct k-ary tuples of variables.
The general idea behind the relation S k is that we want to take an existing relation S yielding an NP-hard CSP and add a number of variables, depending on the given parameter k, so that these variables depend on the original variables from S but cannot be identified with each other. The latter point is important since it allows us to construct a branching algorithm with a sufficiently good branching factor.
It is straightforward to verify that the problem CSP({S k }) is NP-complete with the aid of Theorem 1 since S ∈ {S k } . We will now prove that the fine-grained complexity of CSP({S k }) decreases with increasing k, in the following sense.  Fig. 1. The set L is used to keep track of inequality constraints induced by the constraints in the instance. For correctness, the algorithm branches on a constraint S k (x, y, z, v, w) ∈ C, and either identifies x with y, or y with z; in the process, it identifies variables and introduces inequality constraints according to the definition of S k . Furthermore, the algorithm answers 'yes' if and only if it for each constraint S k (x, y, z, v, w) ∈ C is possible to identify x with y, or y with z, in a non-contradictory way, and answers 'no', otherwise. Concerning time complexity, note first that all variables in v and w are distinct, once step (7) is reached. This follows from the tests undertaken in step 4 where we systematically verify that {w 1 , . . . , w k } and {v 1 , . . . , v k } are disjoint and that |{w 1 , . . . , w k }| = |{v 1 , . . . , v k }| = k. Furthermore, if (7)(b) or (7)(c) is reached then |{x, y, z}| = 3, as otherwise the current instance is unsatisfiable (|{x, y, z}| = 1) or no branching was required (|{x, y, z}| = 2). Thus, in each branch in step 7 we eliminate k variables via variable identification, which implies that the time complexity is bounded by the recurrence T (n) = 2T (n −k)+poly(||I ||). Thus, algorithm Y has total running time O * (2 n k ), and therefore it solves CSP({S k }) in O * (c n ) time for a sufficiently large k.
We immediately obtain the following corollary.

Corollary 1 Let A = (A; R 1 , . . . , R k ) be a relational structure over a countably infinite A. Assume that a first-order reduct Γ of A is NP-complete if and only if Γ pp-interprets 3-SAT. Let G = {Γ | Γ is a first-order reduct of A and CSP(Γ ) is NP-complete}. If G has an easiest CSP, then the ETH is false.
Proof For each c > 1 there exists a constraint language Γ c ∈ G such that CSP(Γ c ) is NP-complete and solvable in O * (c |V | ) time (Theorem 11). If G has an easiest NPcomplete problem CSP(Γ ) then (1) CSP(Γ ) pp-interprets 3-SAT, and (2) CSP(Γ ) is solvable in O * (c |V | ) time for each c > 1. Thus, CSP(Γ ) is solvable in subexponential time, but this violates the ETH by Theorem 3.1 in [22].
Observe that the class of relational structures considered in Corollary 1 includes the NP-hard cases of the CSP dichotomy conjecture over finitely bounded homogeneous structures [2]. It is worth noting that after the Feder-Vardi conjecture on finite-domain CSPs was settled (independently) by Bulatov [13] and Zhuk [41], a large part of the complexity-oriented CSP work has concentrated on homogeneous infinite-domain CSPs.

Algebra and Fine-Grained Complexity of Equality CSPs
Our lower bounds suggest a large difference in fine-grained complexity between equality CSPs and finite-domain CSPs. In this section we take a different viewpoint and investigate this difference through the lens of universal algebra and partial clone theory, with the aim of achieving an algebraic explanation of the results obtained in the previous section. We will see a correspondence to the non-existence of certain relations known as weak bases. Via the results from Sect. 3.3 we are first able to give a straightforward proof conditional to the ETH (Theorem 1) which we then strengthen to an unconditional proof (Theorem 14) but which requires more elaborate arguments.

Algebraic Background
The basic setting on the functional side is to consider partial functions over a universe A. We view a partial function as a mapping of the form f : X → A for a set X ⊆ A k called the domain of f , and denoted by domain( f ) = X . Then a partial function f of arity k is said to be a partial polymorphism of an n-ary relation R over A if f (t 1 , . . . , t k ) ∈ R for each sequence of tuples t 1 , . . . , t k ∈ R such that (t 1 If f is total, i.e., f is always defined, then f is simply called a polymorphism. If we let pPol(R) be the set of all partial polymorphisms of a relation R, and pPol(Γ ) = R∈Γ pPol(R) be the set of all partial polymorphisms of the set of relations Γ , the resulting sets of partial functions are called strong partial clones. Similarly, we write Pol(Γ ) for the set of all polymorphisms of Γ , and the resulting sets of functions are known as clones. If F is a set of (total or partial) functions then we write Inv(F) to denote the set of relations invariant under each function in F.
Let us also briefly mention some properties of strong partial clones. In this context the term strong means that if f ∈ pPol(Γ ) then f |X ∈ pPol(Γ ) for each restriction of f on the domain X ⊆ domain( f ), i.e., domain( f |X ) = X and f (x) = f |X (x) for each x ∈ X . More generally, if X domain( f ) then we let f |X be the restriction of f to the set domain( f ) ∩ X . Then strong partial clones of the form pPol(Γ ) are precisely the local strong partial clones over A [34], meaning that f ∈ pPol(Γ ) for a k-ary (partial) function f if f |X ∈ pPol(Γ ) for each finite X ⊆ A k . On the relational side strong partial clones pPol(Γ ) correspond to sets of relations closed under pp-definitions without existential quantification, quantifier-free pp-definitions (qfppdefinitions). We write Γ for the smallest set of relations containing Γ which is closed under qfpp-definitions. For ω-categorical structures we then have the following useful correspondence between Inv(·) and pPol(·). The theorem follows almost directly from Romov [33], but for completeness we include a proof sketch where the ω-categorical case differs.

Theorem 12 Let Γ and Δ be two ω-categorical sets of relations over a domain A. Then (1) Inv(pPol(Γ )) = Γ and (2) Γ ⊆ Δ if and only if pPol(Δ) ⊆ pPol(Γ ).
Proof Since Γ is ω-categorical there for each n ≥ 1 only exists a finite number of first-order definable relations of arity n (see, e.g., Theorem 6.3.1 in Hodges [17]). The first claim then follows from Proposition 2 in Romov [33] since infinite intersections of relations and direct limits of relations can always be expressed via qfpp-definitions over a finite number of relations from Γ . The second claim then readily follows by standard arguments.
There is a similar connection between Pol(·) and · which we omit since it is not directly useful for our purposes (see, e.g., the introductory textbook by Lau [28]). Theorem 12 then implies that partial polymorphisms determine the fine-grained complexity of CSPs in the following sense, as originally proved by Jonsson et al. for Boolean CSPs [21].

Theorem 13
Let Γ and Δ be two finite ω-categorical languages. If pPol(Δ) ⊆ pPol(Γ ) then there exists a polynomial-time many-one reduction f from CSP(Γ ) The lattice of strong partial clones is uncountable in the Boolean domain [16] and it is to a large extent unexplored. Quite naturally, even less is known for arbitrary finite domains or infinite domains. However, we can simplify the task of analysing strong partial clones by restricting our attention to strong partial clones pPol(Γ ) where Pol(Γ ) = C for a fixed clone C. It is then of particular interest to determine whether the set of strong partial clones of this form, sometimes called an interval, has a largest element.
Definition 2 Let C be a clone over a finite or countably infinite domain A. If there exists a set of relations Γ w over A such that Pol(Γ w ) = C and pPol(Γ w ) = {pPol(Δ) | Pol(Δ) = C} then we say that Γ w is a weak base of Inv(C).
Thus, pPol(Γ w ) is the largest element in {pPol(Δ) | Pol(Δ) = C}, which on the relational side means that Γ w ⊆ Δ for every set of relations Δ such that Pol(Δ) = C. Hence, Γ w is minimally expressive with respect to qfpp-definitions among the generating sets of Inv(C), which explains the name "weak base". If A is finite and C can be generated by a finite set of functions over A, then it is known that Inv(C) has a weak base [36]. For infinite domains the situation differs, and weak bases do not necessarily exist. For both negative and positive examples, see Romov [35].
Might it then be possible that Γ admits a weak base whenever Γ is an equality language? And which implications would that have if CSP(Γ ) is NP-complete? Let E be the set of all first-order definable relations over (N; =). Now, recall the definition of the relation S from Example 1. It is then known that S ∈ Γ (and thus, CSP(Γ ) is NP-complete) for an equality language Γ if and only if Γ = E [8]. Thus, we are interested in determining whether E has a weak base, and we may now observe that the existence of a weak base would have far-reaching implications.

Proposition 1 If E has a weak base then the ETH is false.
Proof Assume that E has a weak base Γ w . Assume first that Γ w is infinite. It is then known that there exists a finite set Δ ⊆ Γ w such that Γ w = Δ , implying also that Γ w = Γ (see, e.g., the second condition of Theorem 7.4.2 in Bodirsky [4]. Thus, assume that Γ w is finite. But then Theorem 13 together with the relations constructed in Theorem 11 implies that CSP(Γ w ) is solvable in O(c |V | ) time for every c > 1. However, then Theorem 3 implies that 3-SAT is solvable in subexponential time, thus contradicting the ETH.

The Non-Existence of a Weak Base
Due to Proposition 1 we strongly suspect that E does not have a weak base, but we will see that one can unconditionally prove that E does not have a weak base. In fact, we will prove a fairly general condition which determines the non-existence of a weak base, which is particularly poignant in the relationship of NP-hard CSPs. For a universe A, let R A = = {(x, y) ∈ A 2 | x = y} be the inequality relation over A.

Lemma 1 Let Γ be a finite, ω-categorical set of relations over an infinite domain A.
If R A = ∈ Γ then Γ does not admit a weak base.
Proof Let f be an arbitrary k-ary function over A. Our goal is to show that there for every finite X ⊂ domain( f ) = A k exists an equality constraint language Γ such that Γ = E and such that f |X preserves Γ . If Γ admits a weak base Γ w then, clearly, f X ∈ pPol(Γ w ) for every finite X ⊂ A k , which implies that f ∈ pPol(Γ w ) for every function f (since pPol(Γ w ) is local). This contradicts the assumption that R A = ∈ Γ since R A = , for example, is not preserved by any constant function over D. Hence, let X ⊂ A k be finite. Let N = {d 1 , . . . , d k | (d 1 , . . . , d k ) ∈ X } be the set of values occuring in tuples in X , and let |N | = n. Let Γ = {R 1 , . . . , R l } and define the relation R to be the Cartesian product of all relations in Γ , i.e., R = R 1 × . . . × R l . Let m be the arity of the relation R. Clearly, {R} = Γ , since Γ can pp-define R via a conjunction, and R can pp-define each relation in Γ by projecting away every other argument. Define the (m + n + 1)-ary relation R n such that R n (x 1 , . . . , x m , y 1 , . . . , y n , y n+1 This relation is pp-definable by R since we assumed that R can pp-define the inequality relation R A = , and since R(x 1 , . . . , x m ) ≡ ∃y 1 , . . . , y n+1 : R n (x 1 , . . . , x m , y 1 , . . . , y n , y n+1 ), we also have that {R} = {R n } = Γ . Next, we claim that f |X preserves R n . Consider any sequence of tuples t 1 , . . . , t k ∈ R n . Due to the definition of R n we then have that t[m is undefined, and that f preserves R n . Last, assume there exists Γ w such that pPol(Γ w ) = Δ = Γ pPol(Δ), i.e., that Γ w is a weak base of Γ . Then, by the above construction, f |X ∈ pPol(Γ w ) for every finite X since pPol({R n }) ⊆ pPol(Γ w ), which then implies that f ∈ pPol(Γ w ) since pPol(Γ w ) is local. Hence, the strong partial clone pPol(Γ w ) would need to contain all total functions over A. But then Γ w cannot be a weak base of Γ since the assumption that R A = ∈ Γ = Γ w e.g. implies that Γ w cannot be preserved by any constant function over A.
This condition is sufficient to establish non-existence of weak bases in the context of both equality languages and temporal languages.

Theorem 14 E does not have a weak base.
Proof Since E is the set of all first-order definable relations it clearly follows that R = ∈ E. But since all equality languages are ω-categorical, and since E = {S} , the result then directly follows from Lemma 1.
Observe that Theorem 14 together with Theorem 12 implies that To see this, assume otherwise, i.e., that there exists R / ∈ Eq such that R ∈ Δ for Γ such that Γ = E. This, however, would imply that pPol(Eq) ⊃ pPol(R) ⊇ Γ =E pPol(Γ ). This contradicts the Proof of Theorem 14 since it is shown that Γ =E contains all (total and partial) functions. One interpretation of this result is that equality languages resulting in NP-hard CSPs have rather little in common with regards to qfpp-definability. For example, we may conclude that not all such languages can qfpp-define the inequality relation Neq N .
Last, we will show that the non-existence of weak bases is not solely a property of equality CSPs, and that an analogous property can be proven also for temporal CSPs, i.e., CSP(Γ ) where each relation in Γ has a first-order definition in the structure (Q; <).
This class of CSPs is a strict generalisation of equality CSPs and includes many natural problems, e.g., the betweenness problem and the cyclic ordering problem. For many other examples, see Bodirsky & Kára [9]. Let T be the set of all firstorder definable relations over (Q; <). For x 1 , . . . , x k ∈ Q, we write − −−−− → x 1 . . . x k when x 1 < · · · < x k . The following dichotomy holds for temporal CSPs.
Theorem 15 (Bodirsky and Kára [9]) Let Γ ⊆ T be a temporal constraint language. If there is a primitive positive definition of Betw, Cycl, Sep, T 3 , −T 3 , or S in Γ , where With the help of this classification we can then prove that Γ cannot admit a weak base whenever CSP(Γ ) is NP-complete (assuming P = NP).

Theorem 16
Let Γ ⊆ T be a finite temporal language. If Γ pp-defines Betw, Cycl, Sep, T 3 , −T 3 , or S, then Γ does not admit a weak base.
Proof We want to apply Lemma 1, and thus need to show that Γ can pp-define the inequality relation R Q = over Q. To prove this it is sufficient to show that Betw, Cycl, Sep, T 3 , −T 3 , and S, can all pp-define the inequality relation, which can be done with straightforward arguments. For example, R Q = (x, y) ≡ ∃z : Betw(x, y, z), and R Q = (x, y) ≡ ∃z : Cycl(x, y, z). The result then directly follows from Lemma 1.

Upper Bounds for Equality CSPs and Reducts of Unary Structures
The lower bounds established in Sect. 3 suggest that we cannot construct an O(c |V | ) time algorithm (c > 1) which is applicable to arbitrary equality languages. However, if we fix a finite equality language Γ , this still leaves the possibility of constructing an O(c |V | ) time algorithm for a constant c depending on Γ . In this section we tackle this problem, and the more general problem of constructing faster exponential-time algorithms for CSP(Γ ) whenever Γ is a finite unary reduct. We begin in Sect. 4.1 by constructing an improved algorithm for the case when Γ is a finite equality language, and in Sect. 4.2 consider the more involved case of reducts of unary structures.

An Algorithm for Finite Equality Languages
We begin by describing a novel algorithm for CSP(Γ ), where Γ is a finite equality language with maximum arity α, with a running time of O * (( α(α−1) 2 ) |V | ). Thus, the algorithm runs in O * (c |V | ) time for a constant c depending on Γ , which is a significant improvement over the algorithm proposed by [18] which solves CSP(Γ ) in

Theorem 17 The CSP of an arbitrary finite equality language Γ can be solved in
Proof Consider the algorithm A for instances of CSP(Γ ) presented in Fig. 2. We begin by proving correctness by induction over |V | = n. If n = 1, then the tests in steps (3) and (4) provide the correct answer. Assume the algorithm is correct when n > 1. Let I = (V , C) be an instance where |V | = n + 1. First, assume that I has an injective solution. Then it is readily verified that f : V → {1, . . . , |V |} defined as f (x i ) = i for each x i ∈ V = {x 1 , . . . , x |V | }, is a solution to I as well (in technical terms this follows from the well-known fact that the automorphisms of Γ is the full symmetric group [8]). Hence, the algorithm answers 'yes' via step (3). Otherwise I does not have an injective solution and at least one constraint c = R(x i 1 , . . . , x i p ) ∈ C is not satisfied by the function s. This implies that (at least) two variables in {x i 1 , . . . , x i p } must be assigned the same value. This is systematically tested in step (6), and the correctness follows from the inductive hypothesis. Concerning the time complexity, it is bounded from above by the recurrence T (n) = α(α−1) 2 · T (n − 1) + poly(||I ||) since i p ≤ α for each possible choice of constraint 2 ) n ), and we get the desired bound on the time complexity.

An Algorithm for Finite Reducts of Unary Structures
We recall that a structure A = (A; U 1 , U 2 , . . . , U k ) is unary if U 1 , U 2 , . . . , U k are unary relations. The classical complexity of the constraint satisfaction problem for finite first-order reducts of unary structures has been thoroughly analysed by Bodirsky & Mottet [10] and Bodirsky & Bodor [5]: they prove that such problems are either polynomial-time solvable or NP-complete. We refer the reader to their articles for more background information about unary structures and their reducts.
Throughout this section we let Θ = (N; U 1 , . . . , U k ), k ≥ 1, be an arbitrary unary structure where each U i ⊆ N, and we let Γ = {R 1 , . . . , R m } be a finite first-order reduct of Θ. We can (without loss of generality) focus on structures with a countably infinite domain since every reduct of a unary structure has the same CSP as a reduct of a structure on a countably infinite domain. Since Θ admits quantifier-elimination, and since Γ is finite, we may without loss of generality assume that each R i is defined via a DNF formula where an atom consists of either a unary relation from Θ or an equality constraint. Let α denote the maximum arity of Γ , i.e. α = max{ar(R 1 ), . . . , ar(R m )}.
Our algorithm for CSP(Γ ) is based on the following steps. First, we show that there for each instance I = (V , C) of CSP(Γ ) exists a particular set of functions F with c |V | elements (where c is a constant that only depends on Γ ). These functions can be viewed as "high-level descriptions" of the solution we are searching for. Second, we prove that for each f ∈ F, one can construct an instance I f of CSP(Γ eq ) where Γ eq is a finite equality language that only depends on the choice of Γ . The instances I f are constructed in such a way that I is satisfiable if and only if I f is satisfiable for some f ∈ F.
We proceed with a few definitions. For every set S ⊆ N we denote the complement The set U can be viewed as a refinement of S: it is still a basis for U 1 , . . . , U k but it contains more elements. The functions in the set F that we briefly discussed earlier have the set U as their codomain.

Lemma 2
The following statements are true. Proof We first make the following claims concerning the set S.
1. S is a partitioning of N, 2. S is finite, and 3. for every U i , 1 ≤ i ≤ k, there exist S 1 , . . . , S p ∈ S such that U i = p j=1 S j . We prove each case in turn.
1. Arbitrarily choose p ∈ N. Let S = {i | p ∈ U i } and note that p ∈ U (S). In particular, if S = ∅, then U (∅) = k i=1Ū i and p ∈ U (∅). We conclude that every element in N appears in at least one of the sets U (S). Assume, with the aim of getting a contradiction, that p ∈ U (S), p ∈ U (S ), and S = S where S ⊆ {1, . . . , k}. It is clear that the only sets among U 1 , . . . , U k ,Ū 1 , . . . ,Ū k that contain p are U i , i ∈ S, andŪ j , j ∈ {1, . . . , k} \ S. Thus, there is at least one set in that does not contain p. We know that U (S ) = X so p / ∈ U (S ) and this leads to a contradiction. 2. S contains at most 2 k elements.

Arbitrarily choose
We show that U i ⊆ T and conclude that there exists a set of elements in S whose union equals U i . Arbitrarily choose e ∈ U i and assume to the contrary that e / ∈ T . There exists exactly one set E ∈ S that contains e since S is a partitioning of N. We know that E = U (S) for some S ⊆ {1, . . . , k} by the definition of S. If i ∈ S, then E ⊆ U i and {e} ⊆ E ⊆ U i ⊆ T which leads to a contradiction. Hence, i / ∈ S and E = E ∩Ū i by the definition of U (S). This implies that e / ∈ E since e ∈ U i and this contradicts the choice of E.
The statements for the set U now become straightforward consequences. The family of sets U is still a partitioning of N since we have only "refined" the finite sets of S into single-element sets. Since S is a finite set, U is finite, too. Finally, every U i , 1 ≤ i ≤ k, can be expressed as a union of elements in U since this is possible in S.
Let us remark that a partition where every part is either infinite or one-element (such as U) is called a stabilised partition in the terminology of Bodirsky & Mottet [10]. We define the algorithm D (see Fig. 3) for instances (V , C) of CSP(Γ ) and functions f : V → U. Algorithm D checks whether a given instance (V , C) has a solution that respects the function f : we say that a solution g : If a conjunct becomes empty, then we view it (as usual) as satisfiable and it can be removed. If a disjunction becomes empty, then it is not satisfiable and the algorithm can immediately report that the instance is not satisfiable. The algorithm A that appears within D is the algorithm for equality languages presented in Sect. 4.1. It will only be applied to constraints that are based on equality relations with arity at most α. We let Γ eq denote this set of equality relations.
The language Γ eq is finite so algorithm A solves CSP(Γ eq ) in time O * implying that the call to algorithm A in step (4) is valid. For this purpose it is sufficient to show that S ⊆ U i or S ∩ U i = ∅ for each U i ∈ {U 1 , . . . , U k } and S ∈ U, since the filtering in step (1) then guarantees that any constraint involving U i is replaced by a constraint over Γ eq . Lemma 3 Arbitrarily choose U i , 1 ≤ i ≤ k, and a set S ∈ U. Either S ⊆ U i or S ∩ U i = ∅.
Proof There exist S 1 , . . . , S p ∈ U such that U i = p j=1 S j by the third statement of Lemma 2. Since U is a partitioning of N (by the first statement of Lemma 2), this decomposition is unique.
We continue the correctness proof by establishing a close connection between (V , C) and (V , C ). Proof We begin by showing that (V , C) has a solution g : V → N which respects f if and only if the instance (V , C ) computed in step 1 of the algorithm has such a solution. Therefore, first assume that (V , C) has a solution g that respects f . If a formula in C contains the atom U i (x) (respectively, ¬U i (x)) and f (x) ∩ U i = ∅ (respectively, f (x) ⊆ U i ), then we can safely remove the entire conjunction containing U i (x) since it cannot be satisfied by a solution that respects f (such as g). Furthermore, every is vacuously satisifed by any solution that respects f so such atoms can be removed. We conclude that g is a solution to (V , C ).
Second, assume that (V , C ) has a solution g : V → N that respects f . First note that the atoms that are removed in step 1(c) and 1(d) are satisfied by the solution f .
Since g respects f , these atoms are satisfied by g, too. Thus, if we take all constraints in C and extend them with the conjuncts and atoms that were removed in step 1, then g is a solution to this set of constraints. Note here that adding back the removed conjuncts only makes the instance easier in the sense that it is satisfied by a potentially larger set of variable assignments. Clearly, the new set of constraints equals C and we conclude that g is a solution to (V , C). Now, assume that g : V → N is a solution to (V , C ) that respects f . The additional constraints {x = y | f (x) = f (y)} are always satisfied when we are only interested in solutions that respect f -this follows from the fact that U is a partitioning of N by the first statement of Lemma 2. The constraints {x = y | f (x) = f (y) = S and |S| = 1} are always satisfied when the domain of a variable consists of a single element. Thus, g is a solution to (V , C ).
Last, assume that (V , C ) has a solution g : V → N that respects f . Since C ⊆ C , C can be viewed as a relaxation of C . Consequently, g is a solution to (V , C ) which respects f . the constraint x = y is in C whenever f (x) = f (y) = S and |S| = 1.
These two observations imply that there exist injective functions h S from D S to S for all S ∈ U (recall that a set in U is either infinite or one-element). The sets in {D S | S ∈ U} are pairwise disjoint and so are the sets in U. Hence, there exists an injective function h : N → N such that {h(d) | d ∈ D S } ⊆ S for all S ∈ U. We see that the function g : V → N defined by g (x) = h(g(x)) is a solution to (V , C ) that respects f . By Lemma 4, there is a solution to (V , C) that respects f .
For the other direction, assume that D does not accept the instance ((V , C), f ). This implies that there does not exist any solution to the instance (V , C ). By Lemma 4, there is no solution g : V → N to (V , C) that respects f .
We can now state and prove the main result by combining the results presented in this section. }. However, if the arity of the formulas in C are at most 2, then the algorithm runs in polynomial time since C only contains formulas of arity at most 2-such a formula is either x = y or x = y.
We continue by proving the main result. Let I = (V , C) denote an arbitrary instance of CSP(Γ ). Let F denote the set of functions from V to U and note that |F| = |U| |V | is finite since U is a finite set by the second statement of Lemma 2. If (V , C) has a solution g, then there exists an f ∈ F such that g respects f since U is a partitioning of N by the first statement of Lemma 2. We can thus check the satisfiability of I by applying the algorithm D (which is correct by Lemma 5) to the set of input instances {((V , C), f ) | f ∈ F}. The time complexity is consequently O * ((|U| · α(α−1) 2 ) |V | ).

Concluding Remarks
We have studied the fine-grained complexity of infinite-domain equality CSPs, and have proven that this class of problems differ from finite-domain CSPs in almost every way conceivable. Despite the disarray of this complexity landscape, it is possible to outline several concrete future research directions. First, since we know that all finite equality languages can be solved in O(c |V | ) time and that there exists infinite equality languages not solvable in O(c |V | ) time for any c > 1, is it possible to prove a complete dichotomy separating the equality language CSPs that are solvable in O(c |V | ) time from those that are not?
More generally, one may ask the following question: which infinite-domain CSPs are solvable in O(c |V | ) time? This is naturally a question that is too broad so it needs to be narrowed down. An interesting starting point is the class of temporal CSPs, i.e., CSPs over first-order reducts of (Q; <). Temporal languages are well-behaved from a model theoretic viewpoint (they are ω-categorical), admit a dichotomy between P and NP-complete, and are always solvable in O * (2 |V | log |V | ) time, so one would expect similarities between equality CSPs and temporal CSPs when it comes to finegrained complexity. Thus, which temporal CSPs are solvable in O(c |V | ) time? Despite the aforementioned similarities there are still large differences to equality CSPs. For example, there exists a finite first-order reduct Γ of (Q; <) such that CSP(Γ ) is not solvable in 2 o(|V | log |V | ) time without violating the r-ETH [19].
Last, we have seen that the class of NP-complete equality CSPs does not admit an "easiest problem" unless the ETH is violated, contrary to satisfiability problems [21] and finite-domain CSPs [22]. This discrepancy stems from the constructions in Sect. 3.3 where we proved that one can construct NP-hard equality CSPs with arbitrarily low fine-grained complexity. Furthermore, we gave an algebraic explanation of this difference, namely the non-existence of a weak base for the set of all equality relations. Here, it is important to stress that whether a set of relations admits a weak base or not is a purely algebraic property and it can be formulated entirely without mentioning either CSPs or complexity theory. Interestingly, we first gave a conditional proof under the ETH (Proposition 1), and later strengthened this to an unconditional proof (Theorem 14). Furthermore, the conditional proof turned out to be simpler and more straightforward than the algebraic proof. To the best of our knowledge, proofs of algebraic properties under the ETH are exceedingly rare, if not non-existent, and this raises the question on whether this is an isolated incidence, or a fragment of a larger phenomena.