We generally assume that in an instance of the CSP, the left-hand side structure ${\mathbf{A}}$ contains finitely many tuples. For any structure ${\mathbf{B}}$ (over $\sigma$), the *constraint satisfaction problem for ${\mathbf{B}}$*, denoted by ${{\mathsf{CSP}}}({\mathbf{B}})$, is the constraint satisfaction problem where the right-hand side structure is fixed to be ${\mathbf{B}}$, that is, the problem of deciding, given as input a structure ${\mathbf{A}}$ over $\sigma$, whether or not there exists a homomorphism from ${\mathbf{A}}$ to ${\mathbf{B}}$. In discussing a problem of the form ${{\mathsf{CSP}}}({\mathbf{B}})$, the structure ${\mathbf{B}}$ is often referred to as the *template* or *constraint language*. There are several equivalent definitions of the constraint satisfaction problem. For instance, in logic, the constraint satisfaction problem can be formulated as the model checking problem for primitive positive sentences over relational structures, and in database theory, it can be formulated as the containment problem for conjunctive queries [@ChandraMerlin].

#### Polymorphisms.

When $f: B^n \rightarrow B$ is an operation on $B$ and $${\overline{t_1}} = (t_{11}, \ldots, t_{1k}), \ldots, {\overline{t_n}} = (t_{n1}, \ldots, t_{nk}) \in B^k$$ are tuples of the same arity $k$ over $B$, we use $f({\overline{t_1}}, \ldots, {\overline{t_n}})$ to denote the arity $k$ tuple obtained by applying $f$ coordinatewise, that is, $$f({\overline{t_1}}, \ldots, {\overline{t_n}}) 