 # Existence of cube terms in finite finitely generated clones

We study the problem of whether a given finite clone generated by finitely many operations contains a cube term and give both structural and algorithmic results. We show that if such a clone has a cube term then it has a cube term of dimension at most N, where the number N depends on the arities of the generators of the clone and the size of the basic set. For idempotent clones we give a tight bound on N that matches an earlier result of K. Kearnes and A. Szendrei. On the algorithmic side, we show that deciding the existence of cube terms is in P for idempotent clones and in EXPTIME in general. Since a clone contains a k-ary near unanimity operation if and only if it contains a cube term and a chain of Jónsson terms, our results can also be also used to decide whether a given finite algebra has a near unanimity operation.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

A finite algebra has few subalgebras of powers if and only if it has a cube term (equivalently, edge term or parallelogram term) of some dimension. See  and  for an introduction to these terms, and  for the application to the Constraint Satisfaction Problem.

How to efficiently decide if a given finite algebra has a cube term? This question has practical significance: When coming up with hypotheses about few subpowers, one might want to quickly know if a candidate for a counterexample actually has few subpowers. Deciding existence of various operations is also of interest in computational universal algebra (e.g. in the software package UAcalc ). Conveniently, deciding whether has a cube term goes a long way towards telling us whether also has a near unanimity operation, see Theorem 2.

Our goal in this paper is to explore the conditions for the existence of a cube term in the clone of operations of an algebra (with finitely many basic operations), or equivalently, in a finitely generated finite clone.

Before we begin, we would like to point out that the part of our paper devoted to clones of idempotent algebras (Section 4) has a significant overlap with the results in  by Keith Kearnes and Agnes Szendrei. To be specific, [10, Theorem 4.1] is a stronger version of our Theorem 4. While Theorem 4 requires finiteness, [10, Theorem 4.1] only requires that the algebras in question be idempotent and have finitely many basic operations. Also, this paper and  both give example algebras proving that the bound on cube term dimension from Theorem 4 (or [10, Theorem 4.1]) is tight; this is Theorem 4 here and Example 4.4 in . While the outcome is similar, our construction is novel in that it works for any (finite, greater than 2) size of the base set.

When constructing the proof of Theorem 4, we had heard the statement of Theorem 4.1 in , thus priority for the result belongs to Keith Kearnes and Agnes Szendrei. It also turns out that our methods for idempotent algebras resemble those of  (in particular, our “chipped cubes” are basically the same thing as “crosses” of Keith Kearnes and Agnes Szendrei). However, we produced the proof of Theorem 4 on our own as we only knew the statement, not the proof of [10, Theorem 4.1] when writing our proof.

We include a full proof of Theorem 4 in this paper because it illustrates the ideas we later develop for the non-idempotent case and also because Theorem 4 naturally leads to Theorem 4 which shows that the bounds on cube term arity of Theorem 4 are tight for all applicable sizes of the base set of the algebra in question, improving the state of the art.

## 2 Preliminaries

We will spend much time and effort designing and examining tuples. A tuple on of arity (or -tuple on ) is a sequence of members of the set . If we want to emphasize that an object is a tuple we print it in bold: . The set of all -tuples on will be denoted by . If and , we denote the -th entry of by or sometimes by . On the other hand, indices without parentheses and in bold shall refer to a particular member of a sequence of tuples, so e.g. is the third tuple from some sequence, not the third entry of . If confusion is unlikely, we will write the tuple in a more compact form as .

When are tuples, we will denote by their concatenation, i.e. the tuple .

If are positive integers and is an tuple, then by we mean the -tuple .

If and then is the -tuple whose all entries are (the boldface signals that we are turning into a tuple), i.e. . If for some , we will call the interval the -th block of . The partition into blocks can be ambiguous if e.g. , but this will not be an issue as we will usually fix the partition in advance. A careful reader might have noticed that we have overloaded e.g. to mean both the second element and the -th element of . We did this to keep our notation short; when is broken into obvious blocks then always stands for the element forming up the second block of .

Finally, if is a (finite) set then is the -tuple that lists all elements of in a fixed order (for example, ). We will denote the set by .

The following way to combine tuples, introduced in , will be useful when talking about cube terms and blockers: Let , be two tuples. We then define for each the tuple

 (χI(a,b))i={biifi∈Iaiifi∉I.

In particular, we will often consider the matrix . If , then is an matrix whose -th column is where is the -th nonempty subset of (ordered, say, lexicographically for some fixed linear order on )

An operation of arity on a set is a mapping . The table of the operation is the -tuple that lists all the values of in some agreed upon order. The -ary projection to the -th coordinate is the operation . If is an -ary operation and are -ary operations, then we can compose with getting the -ary operation

 f∘(g1,…,gn):(a1,…,am)↦f(g1(a1,…,am),…,gn(a1,…,am)).

A clone on a set is any set of operations on that contains projections and is closed under composition of operations. A clone is finite if is finite. A clone is finitely generated if there is a finite list of operations inside such that every other operation of can be obtained by a sequence of compositions from and projections.

An algebra consists of a base set together with a set of operations where ranges over some index set . The operations are called basic operations of . The arities of operations form the signature of a given algebra.

An algebra is finite if is finite. A term operation of (or just operation of for short) is any operation we can get from the basic operations of and projection operations by a sequence of compositions. If is an algebra with finitely many basic operations and is finite, then the set of term operations of is finitely generated finite clone and, on the other hand, every finite finitely generated clone is the clone of operations of a finite algebra with finitely many basic operations. We will mostly talk about algebras in the rest of our paper, but this is only matter of taste – all our arguments easily translate into the language of clones.

A subuniverse of is any set that is closed under the (basic) operations of . We denote the statement that is a subuniverse of by .

We will often apply a term operation to a matrix. Let be an algebra and let be an -ary operation of . If is an matrix, then is the -tuple that we obtain by applying on the rows of .

If is an algebra and , then the -th power of , denoted by , is the algebra with universe and operations “inherited” from : If is an -ary operation of , then is also an -ary operation of . To evaluate , apply on the matrix with columns .

For , we will denote by the subuniverse of generated by . is the smallest subset of that contains and is closed under all (basic) operations of . If we want to emphasize the dimension and the algebra we are talking about, we will write . To simplify notation, we will often omit curly brackets in the argument of , writing e.g. instead of .

Given a set , we can find the subalgebra of generated by in time , where is the maximum arity of a basic operation of . The algorithm works by generating a sequence of subsets of that terminates with . We obtain from by applying all the basic operations of to tuples from that contain at least one element outside of (this last condition ensures that we handle each tuple at most once for each basic operation; in the step, we let ). We do not claim authorship of this algorithm; it was previously mentioned in .

The algebra or a clone is idempotent if for each of its operations and all the identity

 t(a,a,…,a)=a

holds (this is equivalent to demanding that the identity holds for each of ’s basic or generating operations, respectively).

A variety of algebras is a family of algebras of the same signature that is closed under taking powers, subalgebras and homomorphic images, or equivalently (by Birkhoff’s theorem) a family of algebras of the same signature that satisfy a fixed set of identities (see e.g.  for details).

Our situation in the rest of the paper is that we are given a finite algebra described by a list of its elements and the tables of its (finitely many) basic operations, and we want to decide if there is a cube term in the clone of . Occasionally, we shall need to distinguish the number of elements of , denoted by , from the total size of the input which includes the list of elements plus a table of size for each basic operation of of arity . We denote the total size of ’s description by .

Let be an algebra. A relation is compatible with for (also called -invariant or admissible in the literature) if is a subuniverse of . In other words, if for every -ary basic operation of the operation extended to maps into itself: For every we have where is the matrix whose -th column is .

The following proposition is easily proved from the definition of relations compatible with an algebra. We note that this proposition is part of a larger theory of Galois correspondence between clones of operations and relational clones (sets of relations closed under primitive positive definitions) [4, 7]. Let be relations compatible with . Then the following relations are also compatible with :

1. The unary relations and ,

2. the projection of to any subset of ,

3. the relation ,

4. if , the relation , and

5. the unary relation , where , if is idempotent.

One application of Proposition 2 that we will use is that if is an -ary relation compatible with an idempotent algebra and is an element of , then the relation we get from by “fixing the first coordinate to and projecting it out” is also compatible with .

An -ary operation on is called a cube operation of dimension if for all we have

 t(χI(a,b):∅≠I⊆[d])=a.

The reason for this name is that if we view as a -dimensional cube, then the cube term will, given a cube with one missing vertex, fill in the empty spot.

A -ary term is called an edge operation of dimension (or just a -edge term) if for any we have

 u(χI(a,b):I={1,2},{1},{2},…,{d})=a

Finally, a -ary term is a -ary near unanimity operation (abbreviated to ) if for any we have

 n(χI(a,b):I={1},{2},…,{d})=a.

(This is not the usual way to write the NU equalities, but we chose it here to show the similarity between NUs and cube/edge terms.)

Note that since all three of the above definitions (cube, edge, and near unanimity operations) require that an equality holds for any , we could have also easily rewritten them as systems of equations in two variables. For example, NU operation is an operation satisfying the following identities for all :

 f(y,x,…,x)=f(x,y,x,…,x)=⋯=f(x,…,x,y)=x.

It is easy to see that a -dimensional edge term implies the existence of a -dimensional cube term. It turns out that one can also prove the converse: [[3, Theorem 2.12]] Let be a finite algebra. Then has a -dimensional edge term operation if and only if admits a -dimensional cube term.

The situation with near unanimity is a bit more complicated since admitting an operation is a strictly stronger condition than admitting an edge or a cube term. However, it turns out that is equivalent to having a -edge term (or, by Theorem 2, -dimensional cube term) for congruence distributive algebras (for an earlier result of a similar flavor, see [13, Theorem 3.16]).

[[3, Theorem 4.4]] For each , a variety is congruence distributive and has a -edge term if and only if has a -ary near-unanimity term.

Thus any bound on the minimal arity of a cube term is also a bound on the minimal arity of a near unanimity operation.

Note that deciding the existence of near unanimity (NU) term reduces to deciding the existence of a cube term: By Theorem 2, an algebra has an NU term if and only if it has a cube term and lies in a congruence distributive variety. One can test whether generates a congruence distributive variety in time polynomial in for idempotent algebras (see ) and in time exponential in for general algebras (by taking the idempotent algorithm and adding the prefix to all tuples; see Lemma 3 below). In both of these cases, deciding congruence distributivity of the variety generated by is much easier than deciding the existence of a cube term.

To decide the existence of a cube term, we want to translate the problem from the language of operations into the language of relations. We have a good description of the shape of relations that, when compatible with an algebra , prevent from having cube terms:

We say that an -ary relation on is elusive if there exist tuples such that for all , but . In this situation, the tuple is called an elusive tuple for (this is a notion similar to, but stricter than, essential tuples used ; we note that elusive tuples were used, unnamed, already in ). Elusive relations prevent the existence of cube terms of low dimensions:

###### Observation

If is an idempotent algebra which admits an -ary elusive relation, then does not have any cube term of dimension or less.

Let be elusive and let be a pair of tuples that witness the elusiveness of .

Since we can trivially obtain an

dimensional cube term from a cube term of lower dimension by introducing dummy variables, we only consider the case that

has a cube term of arity . Then applying this cube term on would give us , a contradiction.

Let be an idempotent algebra. Then a pair is a cube term blocker (or just a “blocker” for short) if and are nonempty subuniverses of , and . The reason for the name “cube term blockers” comes from the following result: [] Let be a finite idempotent algebra. Then has a cube term if and only if it possesses no cube term blockers.

Viewed in -dimensional space, the relation looks like a hypercube with one corner chipped off (the missing corner prevents cube terms from working properly). The following proposition gives a logically equivalent way to describe cube term blockers (note that the original paper  actually used this as the definition of cube term blockers and showed equivalence with our Definition 2). [[12, Lemma 3.2]] Let be an idempotent algebra and let be two subuniverses of . Denote the arity of by . Then is a cube term blocker of if and only if for each there exists a coordinate between 1 and such that for each and all we have

 f(d1,…,dj−1,c,dj+1,…,dmi)∈C.

Proposition 2 immediately gives us an algorithm (first described in ) that decides in polynomial time if is a blocker for an algebra given by its idempotent basic operations: First test if and , then for every basic operation try out all the coordinates and see if for some position of . If we can find such a coordinate for all basic operations, then we have a blocker; else is not a blocker. The testing of coordinates can be implemented in time , by passing through each table of each operation exactly once and keeping track of the coordinates that each tuple rules out (here is the maximum arity of a basic operation of ).

In the following, we will need a more general version of cube term blocker. Let and where . We then define the -ary relation which we call a chipped cube by

 ⎡⎢ ⎢ ⎢ ⎢ ⎢⎣C1|Dn11C2|Dn22⋮Ck|Dnkk⎤⎥ ⎥ ⎥ ⎥ ⎥⎦=k∏i=1Dnii∖k∏i=1(Di∖Ci)ni.

The coordinates of a chipped cube naturally break down into blocks: The -th block, which we will often denote by , consists of integers from to (inclusively).

We will sometimes omit unnecessary brackets as well as exponents equal to 1, so for example we have

 [a|{a,b}2c|c,d]={a,b}2×{c,d}∖⎧⎪⎨⎪⎩⎛⎜⎝bbd⎞⎟⎠⎫⎪⎬⎪⎭.

The following two observations are immediate consequences of the definition of an elusive relation:

###### Observation

Let be an elusive tuple for some relation compatible with the algebra . Then there exist elements such that is an elusive tuple for the relation

 S=Sg⎡⎢ ⎢ ⎢ ⎢ ⎢⎣b1|a1,b1b2|a2,b2⋮bn|an,bn⎤⎥ ⎥ ⎥ ⎥ ⎥⎦,

and .

###### Observation

Let be an algebra. Let

 E=⎡⎢ ⎢ ⎢ ⎢ ⎢⎣C1|Dn11C2|Dn22⋮Ck|Dnkk⎤⎥ ⎥ ⎥ ⎥ ⎥⎦

be a chipped cube where each is a subuniverse of and assume that the relation is not elusive. Then

 Sg(E)=Dn1×Dn22×⋯×Dnkk.

## 3 General cube term results

Let be a finite algebra. Then the following are equivalent:

1. has a cube term of dimension ,

2. For all we have

 seq(A)a∈Sg({u:u=seq(A)χI(a,b),I≠∅}).

If has a -dimensional cube term then consider the matrix that we obtain by prefixing each column of the matrix by . Since cube terms are idempotent, it is easy to see that all columns of are of the form for some and that .

In the other direction, assume that the condition (2) holds. Then we can bootstrap our way to a stronger version of (2): Assume part (2) (of Lemma 3). Then for all and all we have that

 seq(A)a∈Sg({seq(A)χJ(a,b):∃I,∅≠I⊆[d],J=∪i∈IBi})

where is the -th block. For this is exactly (2). If we manage to prove the above claim then we will get (1) by choosing and choosing and so that for each .

It remains to prove Claim 3. We proceed by induction on . We already know that the statement is true for . Assume now that the statement is true whenever and consider with . Let us denote by the set of generators

 E={seq(A)χJ(a,b):∃I,∅≠I⊆[d],J=∪i∈IBi}.

We will view as a matrix whose columns are indexed by sets such that .

Without loss of generality let . Pick so that is the first entry of the last block of .

Considering the projection of to coordinates and applying the induction hypothesis (taking and instead of and ), we obtain that there exists an such that

 seq(A)a[1,q−1]ea[q+1,n]∈Sg(E).

Therefore, there is a term such that . Observe that is idempotent since it maps to . Our next goal is to go from blocks to blocks .

Consider the matrices , where . Given a , we obtain from by replacing, in each column, blocks of by corresponding blocks of as prescribed by . To be more precise, we let and replace each column of by . The columns of lie in and by idempotency of , we have for each

 t(FK)=seq(A)χL(K)(a[1,q−1]ea[q+1,n],b[1,q−1]ea[q+1,n])∈Sg(E).

From this, it follows that contains all tuples of the form

 seq(A)χL(a[1,q],b[1,q−1]e)a[q+1,n]

where is a nonempty union of some of the blocks . Applying the induction hypothesis (with the sum of block sizes ), we get that contains the tuple

 seq(A)a[1,q]a[q+1,n]=seq(A)a,

finishing the proof. (Here we used the fact that membership of tuples beginning with in is witnessed by idempotent terms, so the suffix is not changed by using the induction hypothesis).

The following lemma sheds some light on how minimal elusive relations look like. The additional assumption that we are dealing with a chipped cube is reasonable – see Lemma 4.

Let be an algebra, an inclusion minimal elusive relation compatible with . Assume moreover that is equal to the chipped cube

 ⎡⎢ ⎢⎣C1|D1⋮Cn|Dn⎤⎥ ⎥⎦.

Let and be two tuples witnessing the elusiveness of . Then:

1. ,

2. there is no subuniverse of such that for some ; in particular for each ,

3. if are such that , then ,

4. if for some and then either or .

Note that for each we have and .

The first point follows from the fact that is the smallest relation that contains all the tuples that witness the elusiveness of .

The proof of the second point is similar. Were there strictly between and , we could restrict the -th coordinate of to and obtain a smaller elusive relation, proving (b).

To see that (c) holds, take and such that and . Without loss of generality let . Then the set of generators of is invariant under the permutation that swaps -th and -th coordinates. Therefore, is invariant under such a permutation of coordinates as well. Consider now

 R′={(e,f):(a1,…,ai−1,e,ai+1,…,aj−1,f,aj+1,…,an)∈R}.

Since is a chipped cube, it follows that and from the symmetry of , we get that is symmetric as a binary relation. It is straightforward to verify that this can only happen when and .

Finally, assume (without loss of generality) that and . Consider then the chipped cube we get from by switching the first two coordinates:

 R′=⎡⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢⎣C2|DC1|DC3|D3⋮Cn|Dn⎤⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥⎦.

By symmetry, is a relation compatible with . Moreover, is the chipped cube

 R∩R′=⎡⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢⎣C|DC|DC3|D3⋮Cn|Dn⎤⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥⎦,

which is also an elusive relation (because ). From the assumption that is minimal, we get , proving (d). In the proof above, we took advantage of swapping two coordinates of . Later in the paper, we will be working with a general mapping that moves coordinates of tuples around.

## 4 Cube terms in idempotent algebras

Let be an idempotent algebra, an inclusion minimal elusive relation compatible with . Then is a chipped cube.

Given that is minimal, our strategy will be to fit a maximal chipped cube into and show that this chipped cube is equal to .

Let be an elusive tuple for . Let moreover

 E=⎡⎢ ⎢⎣C1|D1⋮Cn|Dn⎤⎥ ⎥⎦

be an inclusion-maximal chipped cube such that (1) and (2) for each . (At least one such chipped cube exists by Observation 2.)

We prepare ground for our proof by exploring properties of the sets . From the maximality of , it follows that each of the sets is a subuniverse of : Were, say, then for some operation of and suitable . Take such that for each we have and for at least one we have . By definition of a chipped cube, for each we have and applying thus gives us . Therefore contains the chipped cube

 F=⎡⎢ ⎢ ⎢ ⎢ ⎢⎣C1|D1∪{u}C2|D2⋮Cn|Dn⎤⎥ ⎥ ⎥ ⎥ ⎥⎦,

a contradiction with the maximality of .

From the minimality of , we immediately get and what is more for each . The latter equality follows from the fact that is an elusive relation and we chose to be a minimal elusive relation. Since for each we have and the outer pair of sets is equal, it follows that actually for each .

We are now ready to show that . Assume otherwise and choose that agrees with on as many coordinates as possible. Up to reordering of coordinates, we thus have a tuple such that .

Since , we see that for all . We will show that contains the chipped cube

 ⎡⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢⎣C1∪{u1}|D1C2|D2C3|D3⋮Cn|Dn⎤⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥⎦,

yielding a contradiction with the maximality of . To prove this, we need to show that .

Observe first that This follows from the inclusion and the idempotence of .

Let . Since , we obtain , making strictly smaller than .

Consider now the relation . From we see that is not elusive. However, contains the chipped cube

 ⎡⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢⎣C1|D′C2|D2C3|D3⋮Cn|Dn⎤⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥⎦.

This is only possible if , which is exactly what we needed. We would like to remark that Lemma 4 does not hold for general algebras. As an example, consider the algebra on the set with one unary constant operation . For any let

 R={2n}∪{0,1}n∖{10n−1}.

This relation is compatible with and elusive. It is straightforward to verify that is also minimal such (-ary elusive relation needs to contain at least tuples; is just one tuple larger than this theoretical minimum, and a case consideration shows that we can’t discard any tuple from ). However, is not a chipped cube: The projections of to each coordinate are all equal to and contains the tuple . It is not hard to show that any chipped cube with these two properties contains at least tuples whose some entry is 2, which does not.

Let be a finite idempotent algebra, and let be an integer. Then has a cube term of dimension if and only if there is no -ary chipped cube relation compatible with . Cube terms are incompatible with chipped cubes, so the interesting implication is that the absence of a -dimensional cube term gives us a -ary compatible chipped cube.

Assume thus that has no -dimensional cube term. We claim that then is compatible with some -ary elusive relation. By Lemma 3, there exist such that . Since is idempotent, we can remove the prefix and have . This amounts to saying that is an elusive tuple for . To finish the proof, we take an inclusion minimal -ary elusive relation compatible with . By Lemma 4, this is a chipped cube.

The following Lemma is a nontrivial consequence of Proposition 2. Let be an idempotent algebra that admits a cube term. Denote by the arities of . Assume that the chipped cube

 F=⎡⎢ ⎢ ⎢ ⎢ ⎢⎣C1|D1C2|D2⋮Ck|Dk⎤⎥ ⎥ ⎥ ⎥ ⎥⎦

is compatible with . Let for each

 Ui={j:(Cj,Dj) is \emph{not} a cube term blocker in the % algebra (A;fi)}

where goes from 1 to (see Definition 2 for what a cube term blocker is). Then:

1. , and

2. for each we have .

Note that we implicitly have for each from the definition of a chipped cube.

Since has a cube term, there is no cube term blocker in . In particular none of , , …, are blockers for . Were, say, a blocker for all algebras then each maps each relation into itself, making a blocker for the whole algebra . Therefore, for each there exists an so that , i.e. , giving us part (a).

It remains to show that for each we have . Assume for a contradiction that for some . Without loss of generality we can assume that in fact (we are free to reorder the ’s and ’s). We then consider the chipped cube

 E=⎡⎢ ⎢ ⎢ ⎢ ⎢⎣C1|D1C2|D2⋮Cm1|Dm1⎤⎥ ⎥ ⎥ ⎥ ⎥⎦.

It is easy to see that can be obtained from by restricting all but the first coordinates to some singleton values from and projecting the result to the first coordinates (here we need that is idempotent). Therefore preserves .

However, are not blockers for . By Proposition 2, for each we then can find a tuple

 (aj,1,aj,2,…,aj,m1)∈Dm1j

such that and .

Arrange the above mentioned tuples into rows of an matrix . Since for all , each column of belongs to . Therefore, we should have as well. But applied to the -th row of the matrix gives us an element from for each , so fails to be in , a contradiction.

Since the sets in the above theorem depend only on and the sets , we can generalize the result to the case when appears multiple times in : Let be an idempotent algebra that admits a cube term. Denote by the arities of . Assume that the chipped cube

 F=⎡⎢ ⎢ ⎢ ⎢ ⎢⎣C1|Dn11C2|Dn22⋮Ck|Dnkk⎤⎥ ⎥ ⎥ ⎥ ⎥⎦

is compatible with . Then there exists a family of sets such that and for each we have .

We are now ready to give a lower bound on the arity of a cube term in finite idempotent algebras with cube terms. For a version of the following theorem that works for infinite idempotent algebras, see [10, Theorem 4.1] (we discuss the relationship between our paper and  in detail at the end of the Introduction). Let