22
International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing Company INTERPRETING GRAPH COLORABILITY IN FINITE SEMIGROUPS MARCEL JACKSON Department of Mathematics, La Trobe University, Melbourne, Australia [email protected] RALPH McKENZIE Department of Mathematics, Vanderbilt University, Nashville, USA [email protected] Received 4 February 2004 Accepted 10 October 2004 Communicated by J. Meakin We show that a number of natural membership problems for classes associated with finite semigroups are computationally difficult. In particular, we construct a 55-element semigroup S such that the finite membership problem for the variety of semigroups generated by S interprets the graph 3-colorability problem. Keywords : Computational complexity; semigroups; variety membership problem; quasi- varieties; finite equational bases for finite algebras. Mathematics Subject Classification 2000: 20M07, 68Q17 1. Introduction During his lectures at the conference on Structural Theory of Automata, Semi- groups and Universal Algebra (a NATO Advanced Study Institute) held at the Universit´ e de Montr´ eal from 7 to 18 July, 2003, Mikhail Volkov introduced the problem, “does there exist a finite monoid M such that the problem, to determine of any finite monoid M whether M HSP(M) (the finite membership problem for HSP(M)) is NP-complete?” Volkov recalled that the corresponding problem for finite general algebras was solved by Zoltan Szekely who produced (see [15]) a seven-element algebra A such that the finite membership problem for HSP(A) is NP-complete. In this paper, we modify Szekely’s example to obtain a 55-element semigroup S and a 56-element monoid S 1 such that the finite membership prob- lems, both for the variety of semigroups generated by S, ·, and for the variety of monoids generated by S 1 , ·, 1, are at least as difficult as determining if a finite graph is 3-colorable. 119

pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

International Journal of Algebra and ComputationVol. 16, No. 1 (2006) 119–140c© World Scientific Publishing Company

INTERPRETING GRAPH COLORABILITYIN FINITE SEMIGROUPS

MARCEL JACKSON

Department of Mathematics, La Trobe University, Melbourne, [email protected]

RALPH McKENZIE

Department of Mathematics, Vanderbilt University, Nashville, [email protected]

Received 4 February 2004Accepted 10 October 2004

Communicated by J. Meakin

We show that a number of natural membership problems for classes associated withfinite semigroups are computationally difficult. In particular, we construct a 55-elementsemigroup S such that the finite membership problem for the variety of semigroupsgenerated by S interprets the graph 3-colorability problem.

Keywords: Computational complexity; semigroups; variety membership problem; quasi-varieties; finite equational bases for finite algebras.

Mathematics Subject Classification 2000: 20M07, 68Q17

1. Introduction

During his lectures at the conference on Structural Theory of Automata, Semi-groups and Universal Algebra (a NATO Advanced Study Institute) held at theUniversite de Montreal from 7 to 18 July, 2003, Mikhail Volkov introduced theproblem, “does there exist a finite monoid M such that the problem, to determineof any finite monoid M′ whether M′ ∈ HSP(M) (the finite membership problemfor HSP(M)) is NP-complete?” Volkov recalled that the corresponding problemfor finite general algebras was solved by Zoltan Szekely who produced (see [15]) aseven-element algebra A such that the finite membership problem for HSP(A) isNP-complete. In this paper, we modify Szekely’s example to obtain a 55-elementsemigroup S and a 56-element monoid S1 such that the finite membership prob-lems, both for the variety of semigroups generated by 〈S, ·〉, and for the variety ofmonoids generated by 〈S1, ·, 1〉, are at least as difficult as determining if a finitegraph is 3-colorable.

119

Page 2: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

120 M. Jackson & R. McKenzie

Table 1. Complexity results for semigroups and monoids: lower bounds.

K A ∈ K() ∈ K(A) ∈ K() K() = K(A) K() = K()

HSP ? NP-hard NP-hard NP-hard NP-hardSP ? NP↑ NP↑ NP↑ NP↑HS ? — NP↑ — GIH NP↑ — NP↑ — GIS ? — NP↑ — GI

We also look at a number of other membership problems on finitely generatedclasses related to a class operator K amongst S, H, HS, SP and HSP (here S, H andP denote respectively isomorphic copies of subalgebras, homomorphic images andproducts).

Most of these problems do not appear to have been investigated for semigroupsor monoids, so we present our results in Table 1. The rows of the table correspondto choices of K. An instance of one of these problems is a finite algebra B (or alge-bras) in place of the star (or stars). When the symbol A appears in the columntitle, we mean that we can find A (depending on the column and on the choice ofK) for which the corresponding problem has the stated complexity. NP↑ abbrevi-ates NP-complete, P abbreviates polynomial-time, while GI abbreviates the graphisomorphism problem (the exact complexity of which is a long standing open prob-lem; see [2]). All the results presented in Table 1 are the same for semigroups asfor monoids and, except for the final three rows of Column 5, are new. We notethat most of the solutions in the third and fifth column can be found for generalalgebras and unary algebras in [1].

For example, in the first row, column two asserts that there is a finite semigroup(monoid) A such that the finite membership problem for HSP(A) polynomiallyinterprets the NP-complete graph 3-colorability problem. In the fifth row, the entryGI in the fifth column indicates that the problem of deciding if two finite semigroups(monoids) share the same subalgebras is polynomially equivalent to the problem ofdeciding when two finite graphs are isomorphic (this is a well-known result of Booth[2]). The entries containing question marks appear to be open, even for generalalgebras (note that the problem A ∈ S() is known to lie in P — see below — butwe do not know precisely where in this class the problem lies). The blank entries ofTable 1 indicate that no interesting lower bounds are possible. This is explained byTable 2, which lists the known upper bounds for the complexity of the problems inTable 1. In Table 2, when the symbol A appears in the column title we mean thatfor every finite algebra A the corresponding problem lies in the given complexityclass. Thus the blank entries in Table 1 correspond to problems that can be solvedin constant time for any fixed finite algebra A. The notation 2-ET abbreviates thecomplexity class 2-EXPTIME corresponding to those problem solvable in doublyexponential time (O(22p(n)

) for some polynomial p). The entries in rows 2–5 ofTable 2 are all quite easy and are discussed in relevant sections below. The bounds

Page 3: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

Interpreting Graph Colorability in Finite Semigroups 121

Table 2. Complexity results for finite algebras: upper bounds.

K A ∈ K() ∈ K(A) ∈ K() K() = K(A) K() = K()

HSP 2-ET 2-ET 2-ET 2-ET 2-ETSP NP NP NP NP NPHS NP constant NP constant GIH NP constant NP constant GIS P constant NP constant GI

given in the first row (and many of the others) can be found in [1]. We note thatTable 2 shows that all bounds given in rows 2–5 of Table 1 are sharp.

For further definitions and details on complexity, see [5] for example.The most involved of our proofs are associated with the first row of Table 1;

these arguments are given in Sec. 3. Section 5 contains proofs of the results in thesecond row, while the last three rows of both Tables 1 and 2 are given in Sec. 6.Our results from Sec. 3 also have some interesting applications to the finite basisproblem for semigroups that are investigated in Sec. 4.

2. Graphs and Relational Structures

A universal Horn class is a class of relational structures of one signature axiomatizedby a set of universal Horn sentences, that is, first-order sentences of the followingkinds: (∀x) (&i∈IΦi → Φ) and (∀x)

(∨i∈I ¬Φi

), where I is a finite set and the Φi

and Φ are atomic formulas. If the set of axioms consists entirely of sentences of thefirst kind, the axiomatized class is called a quasi-variety.

Let G = 〈VG, EG〉 be a relational structure where EG ⊆ VG × VG is a binaryrelation on VG. In the case where EG is irreflexive and symmetric, this is of course asimple graph (that is, without loops or multiple edges). We will also use the symbola ∼ b to denote (a, b) ∈ EG. If H = 〈VH , EH〉 is another relational structure withEH a binary relation on VH , then by a homomorphism from G to H is meantany mapping ϕ : VG → VH with the property that (ϕ(a), ϕ(b)) ∈ EH whenever(a, b) ∈ EG.

An atomic formula in the first-order language of binary relations is an expres-sion u ≈ v or u ∼ v where u and v are variables. It is a well-known result of Mal’cevthat the universal Horn class generated by G (that is, the class of all binary rela-tional structures that satisfy all the universal Horn sentences that are valid in G)is the class of all isomorphic copies of substructures of non-empty direct productsof ultrapowers of G, that is SP+Pu(G). Similarly, the quasi-variety generated by G

is the class SPPu(G). Note that SPPu(G) contains the one-element relational struc-ture I = 〈0, E〉 with (0, 0) ∈ E (isomorphic to the product of an empty family ofstructures), and we have SPPu(G) = SP+Pu(G) if and only if I ∈ SP+Pu(G) if andonly if (a, a) ∈ EG for some a ∈ VG. If G is finite, the universal Horn class and thequasi-variety generated by G reduce to SP+(G) and SP(G), respectively.

Page 4: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

122 M. Jackson & R. McKenzie

Thus, if G is finite, then a binary relational structure H = 〈VH , EH〉 lies in thequasi-variety generated by G if and only if for every pair a, b ∈ VH with a = b, thereis a homomorphism ϕ : H → G with ϕ(a) = ϕ(b) and for every pair c, d ∈ VH with(c, d) ∈ EH , there is a homomorphism ψ : H → G with (ψ(c), ψ(d)) ∈ EG. Also, H

lies in the universal Horn class generated by G precisely if, in addition, there is atleast one homomorphism from H to G (this follows from the SP, SP+ descriptions).

The analogous notions and results are meaningful and valid for algebras, excepthere atomic formulas are of the form s ≈ t (for terms s and t), and homomorphismsare the usual thing, that is, mappings that preserve the truth of atomic formulas.

Both irreflexivity (∀x)(¬x∼x) and symmetry (∀x, y)(x∼y → y∼x) of binaryrelations are universal Horn sentences and hence the class of all simple graphsis a universal Horn class. We note that disjunctions of negated atomic formulasare in fact equivalent to implications in structures with more than one-element:(∀x)

(∨i∈I ¬Φi

)becomes (∀x, y, z) (&i∈IΦi → y ≈ z), where y and z are two differ-

ent variables distinct from those contained in x. However, the one-element loopedgraph (which is not in SP+(G) for any simple graph G) satisfies all implications,but fails the sentence (∀x)(¬x∼x).

Let Kn denote the complete simple graph on vertices 0, 1, . . . , n − 1. Ann-coloring of a graph G is a homomorphism c : G → Kn. The class of all n-colorable simple graphs will be denoted by Cn. The key to our approach (and alsothat of Szekely in [15]) lies in the fact that Cn is a universal Horn class. Finitegraphs generating Cn were found by Nesetril and Pultr [10] and also by Wheeler[16]. The more efficient of these constructions is the first.

For n ≥ 2 let Cn denote the graph on vertices 0, 1, . . . , n, n + 1 with edgesmaking 0, 1, . . . , n − 1 a complete graph and with additional edges (i, n), (n, i)for each i ∈ 1, . . . , n− 1 and (j, n + 1), (n + 1, j) for j ∈ 0, 2, 3, . . . , n− 1. Thisconstruction produces a graph isomorphic to those given in [10]. The graph C3 hasa special role in this paper.

0 1

4 2 3

The graph C3

Lemma 2.1 [10]. For n ∈ N, the class SP+(Cn) is equal to Cn.

Proof. The map i → i mod(n) is an n-coloring of Cn. Now let G ∈ SP+(Cn). Sothere is at least one graph homomorphism ϕ : G → Cn. Thus G is n-colorable viathe map c : G → Kn given by v → ϕ(v) mod(n).

Page 5: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

Interpreting Graph Colorability in Finite Semigroups 123

Now suppose that G is n-colorable, and let c : G → Kn be a coloring. If u

and v are distinct elements of VG and u ∼ v, then c is a homomorphism into Cn

separating u and v. Now assume that u, v ⊆ VG and (u, v) ∈ EG. If u = v, then(c(u), c(v)) ∈ ECn . So we can assume that u = v. We can also assume that c(u) = 0.Define ϕ : VG → VCn so that ϕ(u) = n and ϕ(x) = c(x) for all x ∈ VG\u.Now ϕ is a homomorphism of G into Cn, for if x ∈ VG and (u, x) ∈ EG thenc(x) ∈ 1, . . . , n − 1 and so (ϕ(u), ϕ(x)) ∈ ECn . Moreover, ϕ(u) = ϕ(v).

We have yet to find a homomorphism c′ : G → Cn with (c′(u), c′(v)) ∈ ECn .If c(v) = 0 (= c(u)), then we can take c′ = c. If c(v) = 0 then we can assumethat (c(u), c(v)) = (0, 1). Define c′(u) = n, c′(v) = n + 1, and put c′(x) = c(x) forall x ∈ VG\u, v. Since (u, v) ∈ EG, then c′ is a homomorphism G → Cn, and(c′(u), c′(v)) ∈ ECn , as required.

For n > 1 it is easily seen that Cn has a minimal number of elements withrespect to the property of generating Cn. Indeed if the simple graph G generatesCn, then as Cn ∈ Cn, there exists a graph homomorphism ϕ : Cn → G with(ϕ(n + 1), ϕ(n)) ∈ EG. If |G| < n + 2 then ϕ must identify at least two elementsof 0, 1, . . . , n + 1. Now ϕ cannot identify n and n + 1, because identifying theseproduces a complete graph on n + 1 vertices, which cannot be homomorphicallymapped into the n-colorable graph G. As G has no loops, the only remainingidentifications possible are ϕ(n) = ϕ(0) or ϕ(n + 1) = ϕ(1). However under eitherof these identifications, we obtain ϕ(n) ∼ ϕ(n + 1).

Szekely [15] constructs a seven-element groupoid generating a variety with NP-complete finite membership problem from a six-element graph which generates C3.We wish to observe that a six-element groupoid with this property can be producedin the same way, from the five-element graph C3.

For a given simple graph G = 〈VG, EG〉, let G∆ denote the graph obtainedfrom G by adding a new vertex wu,v for each unordered pair of vertices u, v

with (u, v), (v, u) ∈ EG and by adding the new edges (u, wu,v), (wu,v, u) and(v, wu,v), (wu,v, v). Let GCn be a graph obtained by taking the disjoint unionof Cn with G and then connecting one vertex of Cn to a vertex of G (any pairwill suffice). It is easy to see that if n ≥ 3, then G is n-colorable if and only ifG∆ is n-colorable. Also, G is n-colorable if and only if SP+(GCn) = SP+(Cn).Summarizing, we have the following.

Lemma 2.2. These statements are pairwise equivalent, for a simple graph G:

(i) G is n-colorable;(ii) G ∈ SP+(Cn);(iii) |hom(G, Cn)| ≥ 1;(iv) |hom(G, Kn)| ≥ 1;(v) G∆ is n-colorable (so long as n ≥ 3);(vi) SP+(GCn) = SP+(Cn).

Page 6: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

124 M. Jackson & R. McKenzie

3. Variety Membership

3.1. The construction

Recall that B2 denotes the five-element Brandt semigroup with zero generated byA, B subject to the relations ABA = A, BAB = B and A2 = B2 = 0. For a givenbinary relational structure G = 〈VG, EG〉 we are going to construct a semigroupS(G) embedding B2 as follows. We assume that VG ∩ A, B = ∅. Then S(G) isthe semigroup with zero generated by A, B ∪ VG subject to the relations:

A2 = B2 = Bx = xB = AxA = 0 (when x ∈ VG)

ABA = A, BAB = B

xy = B (when (x, y) ∈ EG)

xy = 0 (when x, y ⊆ VG and (x, y) ∈ EG).

To make the construction more transparent, we recall the definition of a Reesmatrix semigroup. Because our construction turns out to have only trivial sub-groups, the following definition will suffice. Let I and J be sets and P be a J × I

matrix over 0, 1. The Rees matrix semigroup M[P ] over P is the set (I×J)∪0endowed with the multiplication (i, j)(k, ) = (i, ) if Pj,k = 1 and all other productsequal 0.

Let I = VG ∪ A, B and let P (= PG) denote the I × I matrix with entriesfrom the submatrix PVG×VG corresponding to the adjacency matrix of G and allremaining entries 0, except for PA,B = PB,A = 1

(so P is the direct sum of the

adjacency matrix of G with(

0 11 0

)). Then S(G) is isomorphic to the semigroup

defined on the set M[P ] ∪ VG with multiplication extending that of M[P ] bysetting, for x, y ⊆ VG:

xy =

(B, B) if (x, y) ∈ EG,

0 otherwise,

x(i, j) =

(B, j) if i ∈ VG and (x, i) ∈ EG,

(x, j) if i = A,

0 otherwise,

and

(i, j)x =

(i, B) if j ∈ VG and (j, x) ∈ EG,

(i, x) if j = A,

0 otherwise.

It can be checked that the following is a one-to-one list of all the elements ofS(G) under the first definition:

A, B (= xy when (x, y) ∈ EG), AB, BA, 0 (= AA)

and for x, y ⊆ VG : x, Ax, BAx, xA, xAB, xAy.

Page 7: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

Interpreting Graph Colorability in Finite Semigroups 125

Each element is represented above in shortest form with respect to the set of gener-ators A, B ∪ VG; and for all elements except 0, the given representations are theunique shortest representations. The isomorphism between the first and second def-initions is determined by its action on the generators as follows: x → x for x ∈ VG,C → (C, C) for C ∈ A, B. For example, BAx → (B, B)(A, A)x = (B, A)x =(B, x).

A final approach to our construction is to let Σ = A ∪ VG and write Σ+

for the free semigroup consisting of all finite non-void sequences from Σ, underthe operation of concatenation. For u, v ∈ Σ+, write u ≤ v to denote that wehave v = rus for some pair of possibly empty words r, s. Define SEQ to be thesubsemigroup of Σ+ generated by all words Axy where (x, y) ∈ EG. Define J to bethe set of all u ∈ Σ+ such that u ≤ v holds for no v ∈ SEQ. Now J is a two-sidedideal in Σ+ and so we have the ideal congruence θ1 = (J × J)∪ idΣ+ . Let θ2 be thecongruence on Σ+ generated by all pairs (xy, uv) with (x, y), (u, v) ∈ EG, togetherwith all pairs (AxyA, A), (xyAxy, xy) with (x, y) ∈ EG.

Then J is a union of equivalence classes for θ2 and so the equivalence relationjoin of θ1 and θ2 is the congruence

θ = (J × J) ∪ (θ2 ∩ [(Σ+ × Σ+)\J ]) .

It can be checked that S(G) ∼= Σ+/θ. Furthermore, if we assume that no twodistinct elements of VG have identical adjacencies with respect to ∼, then θ can beseen to be the largest congruence on Σ+ for which SEQ is a union of congruenceclasses. Hence S(G) is in this case the syntactic semigroup of the language SEQ.

Note that S(G) has precisely |VG|2 + 5|VG| + 5 elements, and the construc-tion can be created from an efficient encoding of G (say, its adjacency matrix) inpolynomial time.

We write S1(G) for the monoid obtained by adjoining a unit element 1 toS(G). The following lemma collects together some useful information about thesubsemigroup S1(G)\VG.

Lemma 3.1. Let x, a, a1, . . . , an ∈ S(G)\VG where n ≥ 1, and let b, c, d ∈S1(G)\VG.

(i) a1a2 · · ·an = 0 if and only if aiai+1 = 0 for each i ≤ n − 1.(ii) If a1 · · ·an = 0 and a1xan = 0 then a1 · · ·an = a1xan.(iii) If abca, abda and acda are non-zero, then abca = abda = acda = abcda = a.

Proof. The first two claims follow immediately from the definition of a Rees matrixsemigroup with trivial subgroups and the second definition of S(G). Now consider(iii). By (ii) (with n = 1 and a1 = a), if these products are all non-zero, then theyall equal a. If one or more of b, c, d are 1, then abcda is in fact equal to one ofthe three given non-zero products. Otherwise abcda is a product within the Reesmatrix semigroup M[P ].

Here is the chief result of this section.

Page 8: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

126 M. Jackson & R. McKenzie

Theorem 3.2. Let G be any finite graph and n be a positive integer. The followingare equivalent:

(i) G is n-colorable;(ii) S(G) ∈ HSP(S(Cn));(iii) S1(G∆) ∈ HSP(S1(Cn)) (for n ≥ 3);(iv) HSP(S(GCn)) = HSP(S(Cn));(v) HSP(S1((GCn)∆)) = HSP(S1(Cn)).

If G is the 5-element graph C3, then S(C3) is a 55-element semigroup. Since theproblem to determine if G is 3-colorable is NP-complete, we obtain the followingcorollary.

Corollary 3.3. The following problems are NP-hard:

(i) ∈ HSP(S(C3));(ii) ∈ HSP(S1(C3)) (for semigroups or monoids);(iii) HSP() = HSP(S(C3));(iv) HSP() = HSP(S1(C3)) (for semigroups or monoids).

In order that we can derive some other interesting corollaries, we prove Theo-rem 3.2 by way of the following two lemmas.

Lemma 3.4. Let G and H be binary relational structures. If H ∈ SP+(G) thenS(H) ∈ HSP(S(G)) and S1(H) ∈ HSP(S1(G)).

Lemma 3.5. Let H = 〈VH , EH〉 be a finite non-directed graph, and G = 〈VG, EG〉be a finite binary relational structure. If S(H) ∈ HSP(S(G)), then |hom(H, G)| ≥ 1.If S1(H) ∈ HSP(S1(G)) and every pair of adjacent elements in VH forms part of atriangle, then |hom(H, G)| ≥ 1.

In view of the equivalences of Lemma 2.2, Theorem 3.2 will follow from Lem-mas 3.4 and 3.5.

3.2. Proof of Lemma 3.4

Let G = 〈VG, EG〉 and H = 〈VH , EH〉 be binary relational structures with H ∈SP+(G). We are going to find S(H) as a quotient of a subsemigroup of S(G)hom(H,G)

which is the direct power of S(G) consisting of all maps from hom(H, G) into S(G).We denote this semigroup by SH→G.

If α : H → G is a homomorphism, there is an associated map α from S(H)into S(G) defined as follows. We let α agree with α on VH , and be the iden-tity on A, B, 0. On elements of the form uAv, where u and v are each eitherempty, elements of VH or equal to B, we let α(uAv) = α(u)Aα(v) (where ofcourse, this product is calculated in S(G)). Note that α is well defined butmay not be a homomorphism, because if x, y ∈ VH have (x, y) ∈ EH and(α(x), α(y)) ∈ EG, then α(xy) = α(0) = 0 while α(x)α(y) = B. Now define amap ϕ : S(H) → SH→G by ϕ(w)(α) = α(w), for α ∈ hom(H, G). This again will

Page 9: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

Interpreting Graph Colorability in Finite Semigroups 127

rarely be a homomorphism, however if w1, w2 ∈ S(H)\0 and w1w2 = 0, then wedo have ϕ(w1w2) = ϕ(w1)ϕ(w2). This is easily proved by considering the variouspossible forms for w1 and w2. For example, if w1 = Ax and w2 = y ∈ VH , thenw1w2 = 0 implies (x, y) ∈ EH and w1w2 = AB so that for every α ∈ hom(H, G)we have ϕ(w1w2)(α) = AB, while [ϕ(w1)ϕ(w2)](α) = Aα(x) · α(y) = AB (because(α(x), α(y)) ∈ EG). The other cases are all similar and we leave them to the reader.

Now consider the situation when w1, w2 ∈ S(H)\0 are such that w1w2 = 0.We claim that there is α : H → G such that [ϕ(w1)ϕ(w2)](α) = 0. To prove this, onemust again consider the possible ways in which w1w2 may equal 0. Let us assumethat w1 and w2 are written in their shortest forms. If w1 finishes with x ∈ VH

and w2 begins with y ∈ VH , but (x, y) ∈ EH , then we can find a homomorphismα : H → G with (α(x), α(y)) ∈ EG and then α(w1)α(w2) = 0. For all other cases,any homomorphism α in hom(H, G) will suffice.

Now let T denote the subsemigroup of SH→G generated by the image of ϕ, and J

denote the subset of T consisting of all elements which take the value 0 somewhere.By the above observations, we have for w1, w2 ∈ S(H)\0 that w1w2 = 0 impliesϕ(w1w2) = ϕ(w1)ϕ(w2) and w1w2 = 0 implies that ϕ(w1)ϕ(w2) ∈ J . Hence themap ϕ : S(H) → T/J defined by w → ϕ(w)/J is a surjective homomorphism.Because for distinct x, y ∈ VH , there is α : H → G with α(x) = α(y), the mapϕ can also be seen to be injective. This completes the proof of Lemma 3.4 inthe non-monoid case. For the monoid case, note that S(H) ∈ HSP(S(G)) impliesS1(H) ∈ HSP(S1(G)).

3.3. Proof of Lemma 3.5 — without unit

Assume that S(H) ∈ HSP(S(G)). We wish to prove that |hom(H, G)| ≥ 1. We firstprove this under the assumption that H is connected and EH = ∅.

Since S(H) ∈ HSP(S(G)) and S(G) and S(H) are finite, there is a finite set L,a semigroup D ≤ [S(G)]L and a surjective homomorphism ϕ : D → S(H).

We shall write Λ for the set of f ∈ D such that ϕ(f) = 0, and we put Ω =ϕ−1(AB) ⊆ Λ. Now note that for every w ∈ S(H)\0, there are w1 and w2

(possibly empty) such that w1ww2 = AB (that is, w divides AB). (This requiresonly that every element of VH is edge-related to some element of VH .) Hence forevery f ∈ Λ, we have that DfD ∩ Ω = ∅. Writing the finite set Ω as f0, . . . , fkand putting ε = (f0f1 · · · fk)2, it follows that for every f ∈ Λ, there are g, h ∈ D

with gfh = ε. Note that S(G) satisfies the equation x2 ≈ x3, and from this itfollows that ε = ε2.

For f ∈ D, write supp(f) for the set ∈ L : f() = 0. From the aboveconsiderations, it follows that for all f ∈ Λ,

supp(ε) ⊆ supp(f);

that is, if f ∈ Λ and ∈ supp(ε), then f() = 0.Let us now choose, for each x ∈ VH , an element fx ∈ D with ϕ(fx) = x. Since

ε2 = ε and ABA = A in S(H), we can also choose α ∈ D with ϕ(α) = A and

Page 10: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

128 M. Jackson & R. McKenzie

εα = α. The elements ε, α and fx (x ∈ VH) are held fixed for the remainder of thisargument. Note that supp(ε) = supp(α).

Our objective now is to prove that there exists ∈ supp(ε) such that fx() ∈ VG,for all x ∈ VH . For such an , the map x → fx() will clearly be the desiredhomomorphism from H to G — for if (x, y) ∈ EH then fxfy ∈ Λ, implying that[fxfy]() = 0, that is, (fx(), fy()) ∈ EG. Let M denote S(G)\(VG ∪ 0).

For an element w ∈ M , we let the left character, L(w) of w be defined as follows

L(w) =

0 if w ∈ AS

1 if w ∈ xAS

2 if w ∈ BS

(where S = S(G) and x ∈ VG). We define the right character R(w) dually. Twoelements will have the same character if they have identical left and right characters.The following observation is trivial.

Observation 1. If a1 · · · an is a product of elements of M that does not equal 0,then for each i ≤ n − 1, R(ai) + L(ai+1) = 2. Similarly, if a, c ∈ M and b ∈ VG,then abc = 0 implies that R(a) + 1 + L(c) = 2.

Claim 1. For ∈ supp (ε), α() ∈ M .

To see this, note that α() = 0 by definition of supp(ε), while εα = α, whichshows that α() ∈ VG.

Claim 2. Let ∈ supp (ε). If x ∈ VH has fx() ∈ VG, then fy() ∈ VG, for ally ∈ VH .

Let y be adjacent to x, where fx() ∈ VG. We prove the claim for y and then theclaim will follow for all elements of VH because H is connected. Now in S(H) wehave AxyA = A = AyxA, so α()fx()fy()α() = 0 and α()fy()fx()α() = 0. Iffy() ∈ VG, then the first equation, Observation 1 and Claim 1 give R(α()) + 1 +L(fy()) = 2 while the second equation gives R(α()) + L(fy()) = 2, a contradic-tion. Claim 2 is proved.

Claim 3. Let ∈ supp(ε). If x ∈ VH has fx() ∈ M , then for every y ∈ VH , theelements fx(), fy() and α() have the same character. Furthermore, L(fy()) +R(fy()) = L(α()) + R(α()) = 2.

Fix some x ∈ VH with fx() ∈ M . By connectivity it will suffice to provethe claim for an arbitrary y ∈ VH adjacent to x. We again have that bothα()fx()fy()α() and α()fy()fx()α() are non-zero, while Claim 2 impliesfy() ∈ M . By Observation 1 and Claim 1, we have the following equations:

R(α()) + L(fx()) = 2, R(α()) + L(fy()) = 2,

R(fx()) + L(fy()) = 2, R(fy()) + L(fx()) = 2,

R(fy()) + L(α()) = 2, R(fx()) + L(α()) = 2.

Solving these (over integers) easily gives the claim.

Page 11: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

Interpreting Graph Colorability in Finite Semigroups 129

We are now ready to prove that there is ∈ supp(ε) with fx() ∈ VG for everyx ∈ VH . Assume otherwise. By Claim 2, for every ∈ supp(ε) and every x ∈ VH

we have fx() ∈ M . Let (x, y) ∈ EH . Then both fxfy and fyfx are in Λ so thatfor every ∈ supp(ε) we have fx()fy() = 0 and fy()fx() = 0. By Lemma 3.1(i)and (ii) we have fx()fy()fx()fy() = fx()fy(). Hence αfxfyα = αfxfyfxfyα,because these elements agree on supp(ε) but are zero elsewhere. This contradictsthe fact that αfxfyα ∈ ϕ−1(A), while αfxfyfxfyα ∈ ϕ−1(0). Thus the desired ∈ supp(ε) exists, and we have a homomorphism from H into G. This completesthe proof under the assumption that H is connected and not a one-element simplegraph.

If H is a one-element simple graph, then certainly |hom(H, G)| ≥ 1.Now say that H is not connected and let Hi : i ∈ I be the set of connected

components of H . For each i ∈ I, the semigroup S(Hi) is a subsemigroup of S(H).Hence if S(H) ∈ HSP(S(G)), then S(Hi) ∈ HSP(S(G)). But then, there is a homo-morphism φi : Hi → G. As H is a disjoint union of the subgraphs Hi : i ∈ I, thefamily of maps φi : i ∈ I are easily seen to give a homomorphism from H into G.

3.4. The monoid case

We now consider the case where S1(H) ∈ HSP(S1(G)) and every edge of H formspart of a triangle.

We wish to extend our proof of the previous section to the present case. Again, itsuffices to prove the result under the assumption that H is connected and EH = ∅.Everything up to the definition of L(w) and R(w) holds with only trivial modifi-cation. Note that if ε() = 1 for some ∈ supp(ε), then f() = 1 for every f ∈ Λ.Now there must be ∈ supp(ε) such that ε() = 1, because α2 = α, yet εα = α.Let K denote ∈ L : ε() ∈ 0, 1; thus, K = ∈ L : α() ∈ 0, 1 = ∅.

Claim 4. For ∈ K, α() ∈ M .

To see this, note that ε(), α() ⊆ S(G)\0, 1 and ε()α() = α(), implyingthat α() ∈ VG.

Claim 5: Let (x, y) ∈ EH , ∈ K, and fx() ∈ VG. Then fy() ∈ VG.

To prove this claim, observe that we have α() ∈ M and α()fx()fy()α() =0 = α()fy()fx()α(). Observation 1 easily yields that fy() ∈ M . It remains toshow that fy() = 1. So suppose that fy() = 1.

Choose z ∈ VH so that x, y, z is a triangle. Since fy() = 1, the productsα()fx()α(), α()fx()fz()α() and α()fz()α() are non-zero. The first expres-sion gives R(α()) + L(α()) = 1. Then fz() = 1, else Observation 1 impliesR(α()) + L(α()) = 2. Also, if fz() ∈ M , then α()fx()fz() = 0 impliesR(α())+L(fz()) = 1; but also, α()fz() = 0 implies R(α())+L(fz()) = 2. Thiscontradiction shows that fz() ∈ M . We conclude that fz() ∈ VG. Finally, sinceR(α()) + L(α()) = 1 then α() ∈ SAw or α() ∈ wAS for some w ∈ VG — either

Page 12: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

130 M. Jackson & R. McKenzie

way, α()fx()fz()α() = 0 since fx(), fz() ⊆ VG. This contradiction finishesour proof of Claim 5.

Now to complete the proof of the monoid case, we need to show that there isan ∈ K such that fx() ∈ VG for every x ∈ VH . Assume that this is not thecase. By Claim 5 and connectivity, we have fx() ∈ M ∪ 1 for every x ∈ VH

and every ∈ K. Let x, y, z be a triangle in H . For every two-element subseta, b ⊂ x, y, z, the product α()fa()fb()α() is non-zero. By Lemma 3.1(iii),we have α()fx()fy()fz()α() = α() and then (as [αfxfyfzα]() is 0 if ∈supp(ε) and 1 if ∈ supp(ε)\K) we have αfxfyfzα = α, contradicting the fact thatϕ(αfxfyfzα) = 0, while ϕ(α) = A.

Our proof of Lemmas 3.4 and 3.5, and of Theorem 3.2, is now complete. Thetheorem has this corollary.

Corollary 3.6. For each of the algebras S = 〈S(C3), ·〉, 〈S1(C3), ·〉, 〈S1(C3), ·, 1〉,the finite algebra membership problem and variety equivalence problem for HSP(S)interpret the graph 3-colorability problem.

3.5. The syntactic approach

If H is a non-3-colorable graph, then we have shown that S(H) ∈ HSP(S(C3)) andso it follows that there must be an equation satisfied by S(C3) that fails on S(H).We are going to find such an equation.

We use an idea from [11]. Let H = 〈VH , EH〉 be a finite connected graph. Weconstruct an equation pH ≈ qH that fails in S(H), and for any binary relationalstructure G, holds (as a law) in S(G) if and only if hom(H, G) is empty. Let |H | = n,say VH = a1, . . . , an, and let v1, . . . , vn be distinct variables. It is trivial thathom(H, G) is empty if and only if G satisfies the universal Horn sentence

d(H) : (∀v1, . . . , vn)(∨

¬vi∼vj : (ai, aj) ∈ EH)

.

Essentially, we convert the sentence d(H) into the desired semigroup equation.Because H is symmetric, we may consider it as a directed graph in which every

vertex has equal indegree and outdegree. Under this directed graph interpretationwe may find, in polynomial time, an Eulerian circuit. Considered in the non-directedsense, this is a bi-Eulerian circuit — a path through H that passes through eachedge exactly once in each direction. See Fig. 1.

Let b1, b2, . . . , bm = b1 be a bi-Eulerian circuit for H , so that EH = (bi, bi+1) :1 ≤ i < m. Let H = a1, . . . , an as above, let v1, . . . , vn be distinct variables, andchoose a variable x distinct from all vi. For 1 ≤ i ≤ m, say bi = aπi .

We define pH to be the semigroup word

vπ1xvπ1vπ2xvπ2 · · · vπmxvπm

and qH to be the word pHvπm−1vπm . For example, if H denotes the graph in Fig. 1with the given bi-Eulerian circuit, then pH is the word

v0xv0 v1xv1 v2xv2 v3xv3 v1xv1 v0xv0 v3xv3 v2xv2 v1xv1 v3xv3 v0xv0.

Page 13: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

Interpreting Graph Colorability in Finite Semigroups 131

v0 v3

v1 v2

v0, v1, v2, v3, v1, v0, v3, v2, v1, v3, v0

v0 v3

v1 v2

Fig. 1. A graph and a bi-Eulerian circuit.

Lemma 3.7. Let G be a binary relational structure and H be a finite connectedgraph. Then |hom(H, G)| = 0 if and only if S(G) |= pH ≈ qH .

Proof. (⇒) Suppose that hom(H, G) = ∅ and let θ : v1, . . . , vn, x → S(G) be anassignment. Note that pH and qH start and finish with the same letter and containthe same sets of two letter subwords, so Lemma 3.1(ii) shows that θ(pH) = θ(qH)if θ maps into M = S(G)\VG. So we may assume that some letter appearing in pH

is mapped by θ into VG.If θ(pH) = 0 then obviously θ(qH) = 0, so we assume that θ(pH) = 0. Now

consider the case where θ(x) ∈ VG. If ai ∈ VH has θ(vi) ∈ VG, then θ(vixvi) = 0contradicts the fact that products of length 3 from VG equal 0. Thus we haveθ(vi) ∈ M for every i. Now let ai = bm−1 and aj = bm be the final two verticesvisited in the bi-Eulerian circuit used for pH (so pH finishes · · · vivjxvj). As vivj

and vjvi appear in pH and both θ(vi) and θ(vj) lie in S(G)\VG, it follows fromLemma 3.1(ii) that θ(vj) = θ(vjvivj). This gives θ(pH) = θ(qH) again.

Finally, we consider the case where θ(x) ∈ M . We have that for every edge(ar, as) ∈ EH , the value of θ(xvrvsx) and θ(xvsvrx) are non-zero. This situationwas encountered in the proof of Lemma 3.5, and we proved that if θ(vi) ∈ VG forsome ai ∈ VH , then θ(vj) ∈ VG for every aj ∈ VH . As we are assuming that θ mapssome letter of pH into VG, it follows that θ(v1, . . . , vn) ⊆ VG. However, whenever(ar, as) ∈ EH , the product θ(vr)θ(vs) is non-zero, and this means that we have agraph homomorphism from H into G, a contradiction.

(⇐) We prove the contrapositive. Say ϕ : H → G is a graph homomorphism.Then the assignment ϕ given by ϕ(vi) = ϕ(ai) for 1 ≤ i ≤ n and ϕ(x) = A givesqH the value 0 and pH a non-zero value.

For example, there is no graph homomorphism from the one-element loopedgraph 1 into a simple graph. Thus for any simple graph G we have S(G) |=yxyyxy ≈ yxyyxyyy while S(1) fails this equation. (In fact, we can use the equationyy ≈ yyy for this H .)

Remark 3.8. With some slight modifications, one can also give a monoid versionof Lemma 3.7 under the additional assumption that H is triangulated, however weomit this here.

Page 14: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

132 M. Jackson & R. McKenzie

Recall that the term-equivalence problem for an algebra A is the problem ofdeciding for two terms s, t in the signature of A, if A |= s ≈ t. This problem isknown to be in co-NP and there are now a number of known semigroups for whichthis problem is co-NP-complete (such as B1

2 ; see [14] and [8]).

Corollary 3.9. The term equivalence problem for S(C3) is co-NP-complete.

Proof. Given a connected graph G, we find that G is 3-colorable if and onlyif S(C3) |= pG ≈ qG. This reduction is polynomial because the construction ofpG ≈ qG is of polynomial complexity (as discussed during the definition of pG).

4. The Finite Basis Problem

If V is a variety with a finite basis of equations, then the finite membership problemfor V can be solved in polynomial time (simply test for satisfaction of the finite set ofequations). Assuming that P = NP, it follows that the semigroup variety generatedby S(C3) is not finitely based.

The same holds in the monoid case and in this case the absence of a finiteequational basis is easily established using the fact that for any binary relationalstructure G, the monoid S1(G) contains a submonoid isomorphic to the inherentlynon-finitely based semigroup B1

2 (see [13]) and hence has no finite equational basisitself. Results of [13] also show that the semigroup S(G) is never inherently non-finitely based. However, we will show that in most cases S(G) is non-finitely based.

Theorem 4.1. Let G be a graph with finite chromatic number that is not a disjointunion of complete bipartite graphs. Then S(G) is not finitely based.

Proof. We use an idea of Nesetril and Pultr [10] and then Caicedo [3] whoproved that the graph G generates a non-finitely axiomatizable graph quasi-variety.Caicedo also proved that a graph that is not a disjoint union of complete bipartitegraphs generates a quasi-variety containing C2 (the quasi-variety of all 2-colorablegraphs).

Let k be the chromatic number of the simple graph G and let n be an arbitrarypositive integer. Erdos proved in [4] that there is a graph Gn,k that is not k-colorableand that has no cycle of length at most 2n. By Lemma 3.5, S(Gn,k) ∈ HSP(S(G)).Let T be an n-generated subsemigroup of S(Gn,k). It is clear that T is also a sub-semigroup of S(H) for some 2n vertex substructure H of Gn,k. By the choice ofGn,k, H has no cycles so is a forest and hence 2-colorable. By the result of Caicedo,H ∈ SP(G). Then by Lemma 3.4, we have T ∈ HSP(S(H)) ⊆ HSP(S(G)). HenceS(Gn,k) satisfies all n-variable equations of S(G) but is not in HSP(S(G)), andsince n was arbitrary, it follows that there is no finite basis of equations for S(G).

Page 15: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

Interpreting Graph Colorability in Finite Semigroups 133

Erdos used probabilistic methods to establish the existence of the graphs Gn,k,but a constructive approach was later found by Lovasz [9]. These graphs are largeand complicated, however for the particular graphs Ck, one can substitute some eas-ily constructed graphs for the Gn,k — one simply needs for each n, a non-k-colorablegraph whose n-vertex subgraphs are k-colorable. A non-finitely based system ofequations corresponding to these graphs may be constructed using Lemma 3.7.

Consider the graph 2 = 〈0, 1, E〉 with E = 0, 12\(1, 1).

Lemma 4.2. If G is a simple graph, then G ∈ SP+(2).

Proof. This proof is quite easy, and we leave it to the reader.

By Lemma 3.4, if G is any simple graph, then S(G) ∈ HSP(S(2)).

Proposition 4.3. The semigroup variety generated by S(2) has 2ℵ0 subvarieties.

Proof. This again will follow an idea of Caicedo in [3]. We say that two graphsG, H are homomorphism independent if |hom(G, H)| = |hom(H, G)| = 0. In [3],Caicedo finds an infinite homomorphism independent family F := Gi : i ∈ N offinite, connected simple graphs with the properties that if i > j then the chromaticnumber of Gi is greater than that of Gj , and the smallest odd cycle in Gi has strictlylarger length than the smallest odd cycle in Gj . Let P be any subset of N, and letGP denote the (possibly infinite) graph obtained by taking the disjoint union of Gi

for each i ∈ P . Now by Lemma 3.4, for each i ∈ P we have S(Gi) ∈ HSP(S(GP )).However, for j ∈ P , there is no homomorphism ϕ : Gj → GP , and so by Lemma3.5, S(Gj) ∈ HSP(S(GP )). It follows that distinct subsets P, Q ⊆ N give distinctvarieties HSP(S(GP )) and HSP(S(GQ)). As these graphs are loopless, Lemmas 4.2and 3.4 show that the HSP(S(GP )) are subvarieties of HSP(S(2)).

Results of [7] show that the semigroup variety generated by S1(2) also hascontinuum many (semigroup) subvarieties, but this is simply by virtue of the factthat B1

2 embeds into S1(2). However the existence of finite monoids whose monoidvariety has uncountably many subvarieties has been an open question. We canmodify the above proof to show that the monoid S1(2) has this property.

A technical lemma is needed first. Let ∆ denote the triangle on 0, 1, 2. Fora given graph G, let G ∆ denote the graph on the disjoint union VG ∪ 0, 1, 2with edge set EG ∪ E∆ ∪ VG × 0, 1, 2 ∪ 0, 1, 2× VG.

Lemma 4.4. Let G and H be simple connected graphs containing no triangles andwith chromatic number at least 5. Then |hom(H, G)| ≥ 1 if and only if |hom(H

∆, G ∆)| ≥ 1.

Proof. Clearly any graph homomorphism from H to G extends to a graph homo-morphism from H ∆ to G ∆. Now assume that ϕ : H ∆ → G ∆ is

Page 16: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

134 M. Jackson & R. McKenzie

a graph homomorphism. We are going to show that the restriction of ϕ to H is agraph homomorphism into G.

Now, as G contains no triangles, ϕ(0, 1, 2) ⊆ VG. Say ϕ(0, 1) ⊆ VG andϕ(2) ∈ 0, 1, 2. Let v be any vertex in VH . Then as 0, 1, v is a triangle, we musthave ϕ(v) ∈ 0, 1, 2. But then ϕ maps H into ∆, contradicting non-3-colorability.Now say that ϕ(2) ∈ VG and ϕ(0, 1) ⊆ 0, 1, 2. Define a map c : VH → 0, 1, 2, 3by c(u) = ϕ(u) if ϕ(u) ∈ 0, 1, 2 and c(u) = 3 otherwise. We claim this is a validcoloring of H (contradicting the fact that H is not 4-colorable). Let (u, v) ∈ EH .Now u, v, 2 is a triangle in H ∆, and ϕ(2) ∈ VG, so at least one of u or v mustmap into 0, 1, 2. As ϕ(u) = ϕ(v) (because G ∆ contains no loops), it followsthat c(u) = c(v) as required.

By symmetry, we have proved that ϕ(0, 1, 2) ⊆ 0, 1, 2. In fact ϕ is a bijectionon 0, 1, 2 because there are no loops. Now let u ∈ VH . As u is adjacent to all thevertices 0, 1, 2, and there are no loops, it follows that ϕ(u) ∈ VG. That is, ϕ mapsVH into VG, giving us the desired element of hom(H, G).

Proposition 4.5. The monoid variety HSP(S1(2)) has 2ℵ0 subvarieties.

Proof. Consider the family F of homomorphism independent graphs found byCaicedo (see proof of Proposition 4.3). By dropping off the first few members (andrelabelling) if necessary, we may assume that these graphs contain no trianglesand are not 4-colorable. Now let F∆ denote Gi ∆ : i ∈ N. By Lemma 4.4,this family is also homomorphism independent, and furthermore, in every member,every edge is contained in a triangle. Hence the monoid version of Lemma 3.5 isavailable, and we can repeat the proof of Proposition 4.3.

Note that if 2− is the connected, non-directed, simple graph on 0, 1, thenS1(2−) ∈ HSP(S1(Gi ∆)), so there is a continuum of monoid varieties betweenHSP(S1(2)) and HSP(S1(2−)).

5. Quasi-Variety Membership

5.1. Semigroups

The maximal degree of complexity of the variety membership problem is currentlyunknown; however testing membership in finitely-generated quasi-varieties is knownto be in NP. Indeed, to test membership of an algebra A in the quasi-varietygenerated by some finite algebra B, it suffices to guess separating homomorphismsfor each pair of distinct elements in A (see [1]). This gives the upper bounds listedin the second row of Table 2. In this section we give a 12-element semigroup withNP-complete finite membership problem for its quasi-variety.

We again use graph 3-colorability and the graph C3. Let G = 〈VG, EG〉 bea finite graph without loops. We define a semigroup T (G) as follows. Let Ec

G

denote (VG × VG)\(EG ∪ ∆G) where ∆G = (x, x) : x ∈ G. The universe ofT (G) is VG ∪ 0, a, f, e ∪ fi,j : (i, j) ∈ Ec

G (these unions are assumed to be

Page 17: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

Interpreting Graph Colorability in Finite Semigroups 135

disjoint — we may need to relabel the vertices of G). For u, v ∈ VG, let

uv :=

e if (u, v) ∈ EG,

f if u = v,

fu,v if (u, v) ∈ EcG,

let av = va = e and all other products equal 0. It is easy to verify that T (G) is asemigroup because every product of more than 2 elements (under any bracketing)gives the value 0 (such a semigroup is called 3-nilpotent). It is obvious that T (G)can be constructed in polynomial time from G. Note that T (C3) has 12 elements.

Lemma 5.1. Let G be a simple graph. The following are equivalent:

(i) G is 3-colorable;(ii) T (G) ∈ SP(T (C3));(iii) T 1(G) ∈ SP(T 1(C3)).

Proof. First assume that T (G) ∈ SP(T (C3)). So there is a homomorphism ϕ :T (G) → T (C3) with ϕ(e) = ϕ(0). Now in T (G), we have for each v ∈ VG, va = e

and also a2 = 0, so ϕ(a) has the property (∃b) bϕ(a) = 0 & ϕ(a)ϕ(a) = 0. Thusϕ(a) = a. But then, as ϕ(v)a = ϕ(e) = ϕ(0) = 0, we have ϕ(v)a = e showing thatϕ(e) = e and for each v ∈ VG, ϕ(v) ∈ VC3 . Now let (u, v) ∈ EG. Then in T (G), wehave uv = e. Hence ϕ(u)ϕ(v) = e in T (C3), showing that (ϕ(u), ϕ(v)) ∈ EC3 . Sothe restriction of ϕ to VG is a graph homomorphism from G into C3, showing thatG is 3-colorable.

A very similar argument holds in the monoid case. Indeed if ϕ : T 1(G) → T 1(C3)has ϕ(e) = ϕ(0), then we must have ϕ(T (G)) ⊆ T (C3) and ϕ(1) = 1. The aboveargument now shows that G is 3-colorable.

Now say that G is 3-colorable. As (ii) implies (iii), it will suffice to show thatT (G) ∈ SP(T (C3)). So, for every pair x = y in T (G) we need to find a homo-morphism ϕ : T (G) → T (C3) with ϕ(x) = ϕ(y). If one of x or y (say, x) is inVG ∪ a, then this is easy: map x → e and send all other elements to 0. Thus wemay assume that x, y ∈ T (G)\(VG ∪a). We are going to construct our homomor-phisms from graph homomorphisms between G and C3. Given a graph homomor-phism ψ : G → C3, let ψ : T (G) → T (C3) be given by

ψ(w) =

ψ(w) if w ∈ VG

w if w ∈ 0, a, e, fe if w = fi,j and (ψ(i), ψ(j)) ∈ ECn

f if w = fi,j and ψ(i) = ψ(j)fψ(i),ψ(j) if w = fi,j and (ψ(i), ψ(j)) ∈ Ec

Cn.

It is routine to check that ψ is well defined and a homomorphism.If one of x or y is 0, then any homomorphism ψ : G → C3 has ψ(x) = ψ(y), so we

assume that x, y = 0. Say that x is e. If y = fi,j, then any graph homomorphismψ : G → Cn for which (ψ(i), ψ(j)) ∈ ECn gives ψ(x) = ψ(y). Likewise if x = e and

Page 18: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

136 M. Jackson & R. McKenzie

y = f , then any graph homomorphism gives rise to a semigroup homomorphismseparating x and y. By symmetry, we may assume that x and y are either f or ofthe form fi,j.

Now say that x = f and y = fi,j. So i = j and there is a graph homomorphismψ : G → C3 with ψ(i) = ψ(j). Then ψ separates x and y. So it remains to considerthe case when x = fu1,v1 and y = fu2,v2, where u1, v1 = u2, v2 and ui = vi

for i = 1, 2. Clearly it is sufficient to find a graph homomorphism ψ : G → C3

with ψ(u1), ψ(v1) and ψ(u2), ψ(v2) non-equal, not both edges and not bothsingletons.

Recall that the elements of C3 are 0, 1, 2, 3, 4 with edges obtained from thecomplete graph by removing (3, 4), (0, 3) and (1, 4) and their reverse. As before,we let ∆ be the triangle on 0, 1, 2. By relabeling if necessary, we may assumethat either u1 = u2 or all four vertices are distinct. Let c : G → ∆ be a 3-coloring.If c(u1) = c(v1) then we can arrange that c(u1) = 0 and c(v1) = 1. The mapψ with ψ(u1) = 3, ψ(v1) = 4 and ψ(w) = c(w) for all w ∈ VG\u1, v1 is ahomomorphism G → C3, and ψ(u1), ψ(v1) is a non-singleton, non-edge whileψ(u2), ψ(v2) = ψ(u1), ψ(v1) — so we are done in this case. If c(u1) = c(v1)then we can arrange that c(u1) = c(v1) = 0. Then the map ψ with ψ(v1) = 3and ψ(w) = c(w) otherwise is a homomorphism, and ψ(fu1,v1) = f0,3 whileψ(fu2,v2) ∈ e, f.

Recall the graph GC3 from Sec. 2. It is easy to see that T (C3) embeds intoT (GC3) giving SP(T (GC3)) ⊇ SP(T (C3)). Therefore SP(T (GC3)) = SP(T (C3)) ifand only if T (GC3) ∈ SP(T (C3)), if and only G is 3-colorable.

Corollary 5.2. The following problems are NP-complete:

(i) ∈ SP(T (C3));(ii) ∈ SP(T 1(C3));(iii) SP() = SP(T (C3));(iv) SP() = SP(T 1(C3)).

This gives row 3 of Table 1.As in the variety case, (assuming that P = NP) we must have SP(T (C3)) not

finitely axiomatizable (this can be proved directly). We also note that Sapir [12] hasshown that the three element semigroup with presentation 〈a : a3 = a4〉 generatesa not finitely axiomatizable quasi-variety. However in contrast with SP(T (C3)), analgorithm for testing membership is given in [12] and this is routinely seen to bepolynomial time.

5.2. Unary algebras

Problem 5.6 of [1] asks for the complexity of the problem SP() = SP() for unaryalgebras (algebras whose operations are all unary operations). It is not hard to usemethods given in [1] to show that there is in fact a fixed unary algebra U with twounary operations (bi-unary) for which SP() = SP(U) is NP-complete.

Page 19: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

Interpreting Graph Colorability in Finite Semigroups 137

Given a graph G, a construction due to Hedrlın and Pultr [6] produces (inpolynomial time) a bi-unary algebra U(G) on the set VG ∪EG ∪ u, v such thatevery graph homomorphism ψ : G → H extends uniquely to a homomorphism ψ∗ :U(G) → U(H), and every homomorphism ϕ : U(G) → U(H) arises in this fashion.In [1] it is shown that G ∈ SP(H) implies U(G) ∈ SP(U(H)) ([1, Proposition 5.4];actually this is done for two particular graphs, but the arguments are general).On the other hand, if U(G) ∈ SP(U(H)) there is at least one homomorphismψ∗ : U(G) → U(H), showing that there is at least one homomorphism ψ : G → H .Choosing H to be C3 and using Lemma 2.2, we find that G is 3-colorable if andonly if U(G) ∈ SP(U(C3)) if and only if SP(U(GC3)) = SP(U(C3)) (note thatSP(U(GC3)) ⊇ SP(U(C3)) follows because U(C3) embeds into U(GC3)).

Corollary 5.3. The following problems are NP-complete for bi-unary algebras: ∈ SP(U(C3)); and SP() = SP(U(C3)).

6. Other Membership Problems

The last three rows of Tables 1 and 2 are more easily established.We first consider the upper bounds listed in rows 3–5 of Table 2. We omit the

obvious proof that all of these problems are in NP. Let K be amongst HS, H, S.For a fixed finite semigroup A, membership in K(A) is only possible for algebrasup to the size of |A|, and this gives (large!) constant time complexity. This givesthe second column of Table 2. Similar arguments apply for column 4. For column 5and K ∈ H, S, HS, note that K(B) = K(A) if and only if B ∼= A. Booth [2] showedthat this is polynomially equivalent to the graph isomorphism problem (thought tobe easier than NP-complete). This gives the entries in column 5, rows 3–5 in bothTables 1 and 2.

Now we consider the last remaining entry of Table 2; row 5, column 1. Todetermine if A ∈ S(B) for finite semigroups or monoids A and B, one can simplycheck all possible embeddings of A into B. If A is fixed, then this is a polynomialtime algorithm because there are fewer than |B||A| possible embeddings, and eachcan be checked in at most O(|B|2) time. So for fixed A, the problem A ∈ S() is inP (row 5, column 1 of Table 2). In contrast we now find a semigroup A for whichA ∈ H() is NP-complete (row 4, column 1 of Table 1). We use the constructionof Sec. 5. Recall that ∆ denotes the triangle graph. For notational purposes, wenow rename its vertices as v0, v1, v2. Recall that G∆ is the graph obtained froma graph G by triangulating each edge.

Lemma 6.1. Let G be a simple graph with at least one edge. The following areequivalent:

(i) G is 3-colorable;(ii) T (∆) ∈ H(T (G∆));(iii) T 1(∆) ∈ H(T 1(G∆)).

Page 20: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

138 M. Jackson & R. McKenzie

Proof. By Lemma 2.2, G is 3-colorable if and only if hom(G∆, ∆) is non-empty.As G∆ contains a triangle, any homomorphism into ∆ must be surjective. If ϕ issuch a homomorphism, then the map ϕ from the proof of Lemma 5.1 is a surjectivehomomorphism from T (G∆) onto T (∆).

Now say that G is a graph and ϕ : T (G∆) → T (∆) is a surjective homomor-phism. If a′ ∈ ϕ−1(a), then a′2 ∈ ϕ−1(0), while there is b′ with a′b′ ∈ ϕ−1(e).This means that a′ ∈ VG∆ ∪ a. However, if a′ ∈ VG∆ , then 0 = ϕ(a′2) = ϕ(f),implying that for every v ∈ VG∆ , ϕ(v)2 = ϕ(v2) = ϕ(f) = 0. This means thatϕ−1(v0, v1, v2) is empty, a contradiction. Hence ϕ(a) = a. Likewise, for v ∈ VG∆ ,we must have ϕ(v) ∈ v0, v1, v2. As in the proof of Lemma 5.1, this means thatwhen restricted to VG∆ , ϕ is a graph homomorphism. Therefore G is 3-colorable.The monoid case is obtained by trivial modifications once it is noted that anysurjective homomorphism from T 1(G∆) onto T 1(∆) must have ϕ(1) = 1.

Corollary 6.2. The problems T (∆) ∈ H() for semigroups and T 1(∆) ∈ H() formonoids are NP-complete.

This gives row 3, columns 1 and 3 of Table 1.

Remark 6.3. It is clear from the discussion in Sec.5.2 that the correspondingproblem for bi-unary algebras is also NP-complete (using U(∆)).

The last remaining claims from the tables are the NP-completeness of ∈ HS()and ∈ S() (column 3, rows 3 and 5 of Table 1). We again encode a graph theoreticproblem. If G = 〈VG, EG〉 is a finite simple graph and ≤ |VG| then (G, ) is aninstance of the problem clique. The pair (G, ) is a yes instance if G contains acomplete subgraph with at least vertices.

For a given graph G = 〈VG, EG〉, construct a 3-nilpotent semigroup R(G) onthe set VG ∪ 0, e (these sets are assumed to be disjoint) by setting

xy =

e if x, y ⊆ VG and (x, y) ∈ EG

0 otherwise.

Lemma 6.4. Let G be a simple graph on n vertices, n ≥ ≥ 3. Then the followingare equivalent:

(i) G has an vertex complete subgraph;(ii) R(K) ∈ S(R(G));(iii) R(K) ∈ HS(R(G));(iv) R1(K) ∈ S(R1(G));(v) R1(K) ∈ HS(R1(G)).

Proof. The proof that (i) implies the other conditions is trivial. Clearly also, anyof (ii), (iii) or (iv) imply (v).

Now say that R1(K) ∈ HS(R1(G)) holds (our argument will work in both thelanguage of semigroups and of monoids). Now, any subsemigroup of R1(G) is of

Page 21: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

Interpreting Graph Colorability in Finite Semigroups 139

one of the following forms: R1(H) or R(H) for some subgraph H of G; a semigroupwith null multiplication or such a semigroup with adjoined identity element. It isclear that R1(K) is not a homomorphic image of these latter semigroups and alsothat R1(K) is not a quotient of R(H) for any H (which lack an identity element).So we may assume that we have a subgraph H of G and a surjective homomorphismϕ : R1(H) → R1(K). Note that ϕ(1) = 1, regardless of whether or not this elementis distinguished. For u a vertex in K, choose some element u′ ∈ ϕ−1(u). Thenu′ ∈ VH and for every pair of distinct vertices u, v in K we have uv = e so thatu′v′ = 0 and then u′v′ = e. Thus the vertices u′ : u′ ∈ ϕ−1(VK

) form a completesubgraph of H , and therefore also of G. That is, (i) holds.

Clique is NP-complete, and the reduction of an instance (G, ) of clique to thepair (R(K), R(G)) is clearly polynomial.

Corollary 6.5. The problem ∈ K() is NP-complete for finite semigroups ormonoids when K ∈ S, HS.

Acknowledgments

While working on this paper, the first author was supported by ARC DiscoveryProject Grant DP0342459 and the second author was supported by the US NationalScience Foundation grant no. DMS–0245622.

References

[1] C. Bergman and G. Slutzki, Complexity of some problems concerning varieties andquasi-varieties of algebras, SIAM J. Comput. 30 (2000) 359–382.

[2] K. S. Booth, Isomorphism testing for graphs, semigroups and finite automata arepolynomially equivalent problems, SIAM J. Comput. 7 (1978) 273–279.

[3] X. Caicedo, Finitely axiomatizable quasivarieties of graphs, Algebra Universalis 34(1995) 314–321.

[4] P. Erdos, Graph theory and probability, Canadian J. Math. 11 (1959) 34–38.[5] M. Garey and D. Johnson, Computers and Intractability: A Guide to the Theory of

NP-Completeness (W. H. Freeman and Company, San Fransisco, 1979).[6] Z. Hedrlın and A. Pultr, On full embeddings of categories of algebras, Illinois J.

Math. 10 (1966) 392–405.[7] M. Jackson, Finite semigroups whose varieties have uncountably many subvarieties,

J. Algebra 228 (2000) 512–535.[8] O. Klıma, Complexity issues of checking identities in finite monoids (2003), unpub-

lished.[9] L. Lovasz, On chromatic number of finite set systems, Acta Math. Acad. Sci. Hungar.

19 (1968) 59–67.[10] J. Nesetril and A. Pultr, On classes of relations and graphs determined by subobjects

and factorobjects, Disc. Math. 22 (1978) 287–300.[11] M. Volkov, Checking quasi-identities in a finite semigroup may be computationally

hard, Studia Logic 78 (2004) 349–356.[12] M. Sapir, On the quasivarieties generated by finite semigroups, Semigroup Forum 20

(1980) 73–88.

Page 22: pdfs.semanticscholar.org€¦ · March 3, 2006 10:0 WSPC/132-IJAC 00284 International Journal of Algebra and Computation Vol. 16, No. 1 (2006) 119–140 c World Scientific Publishing

March 3, 2006 10:0 WSPC/132-IJAC 00284

140 M. Jackson & R. McKenzie

[13] M. Sapir, Inherently non-finitely based finite semigroups, Math. USSR Sbornik 61(1988) 155–166.

[14] S. Seif, The Perkins semigroup has co-NP-complete term-equivalence problem, Inter-nat. J. Algebra Comput. 15 (2005) 317–326.

[15] Z. Szekely, Computational complexity of the finite algebra membership problem forvarieties, Internat. J. Algebra Comput. 12 (2002) 811–823.

[16] W. Wheeler, The first order theory of n-colorable graphs, Trans. Amer. Math. Soc.250 (1979) 289–310.