18 January 1986
Information Processing Letters 22 (1986) 91-95 North-Holland
VERIFYING NONRIGIDITY v ,
Pavel G O R A L C I K Faculty of Mathematics and Physics, Charles University, Sokolovski~ 83, 186 O0 Praha 8, Czechoslovakia
Vhclav K O U B E K Faculty of Mathematics and Physics, Charles University, Malostranskb ni~m. 25, 118 O0 Praha 1, Czechoslovakia
Communicated by L. Boasson Received March 1985
An algebra is called rigid if it has no other endomorphism than identity. We prove that the problem whether a finite algebra A is nonrigid is NP-complete as soon as the type of A has either one binary or two unary symbols. The apparently harder problem whether IEndA[ > k, for a given integer k>~l, can be reduced to the nonrigidity problem and thereby is NP-complete. By contrast, the endomorphisms of a mono-unary algebra can be counted in polynomial time.
Keywords: NP-completeness, algebra, rigidity C.R. Classification: F.1.3, G.2.1
Introduction G i v e n a finite algebra A, we m a y wish to find out w h e t h e r A has a nonidentity e n d o m o r p h i s m (i.e., w h e t h e r A is nonrigid). The aim of this article is to show that this p r o b l e m is N P - c o m p l e t e as soon as A has one binary or two unary basic operations. M o r e generally, we m a y ask whether A has, for a given integer k, k >/1, k or m o r e endomorphisms. Via well-known constructions this seemingly harder p r o b l e m can be reduced to the nonrigidity problem. A nontrivial algebra A with just one unary operation (a m o n o - u n a r y algebra) is always nonrigid, thus there is no nonrigidity p r o b l e m for algebras of this type. As for the exact n u m b e r of e n d o m o r p h i s m s , we show that there is a polynomial-time algorithm counting the endomorpkisms, or m o r e generally, the h o m o m o r p h i s m s b e t w e e n m o n o - u n a r y algebras.
F o r complexity of algorithms and N P - c o m pleteness, we refer the reader to [1,2].
1. Counting homomorphisms of mono-unary algebras--usefulness of distributivity Given a m o n o - u n a r y algebra A = (A, f), we define for each x ~ A its d e p t h d(x) in N u ( ~ }, the nonnegative integers N with a greatest element adjoined, b y d(x) = s u p ( k ~ N " f k ( x ) * g ) . The elements of A of depth ~ form a subalgeb r a of A which is called the core of A. Put otherwise, the core of A is the union of the cycles of f. Each element x in the core is assigned its period r(x), defined as r(x) --- min{r" f r(x) = x}.
0020-0190/86/$3.50 © 1986, Elsevier Science Publishers B.V. (North-Holland)
91
Volume 22, Number 2
INFORMATION PROCESSING LETTERS
Let be given m o n o - u n a r y (finite) algebras A = (A, f) and B = (B, g). For a partial m a p q~ from A to B, its d o m a i n and c o d o m a i n are defined by Dom(q~) = {x ~ A : qD(x)is d e f i n e d } , Codom(q~)= {y+B:y=cp(x)
forsomex~A}.
A partial m a p q~ from A to B will be called depth-increasing "ff d(x) ~< d(~p(x))
for every x ~ D o m ( c p ) .
A partial m a p qp from A to B will be called homomorphic if it can be extended to a h o m o m o r p h i s m of A to B. Lemma 1.1. Let e~ be a homomorphic partial map from A to B, and/et x ~ Dom(q~). Then, a partial map ~ from A to B with
18 January 1986
x ~ D with f - l ( x ) - D ~ g . This process can be c o n t i n u e d until we get all h o m o m o r p h i c partial m a p s from A to B with the d o m a i n equal to A, i.e., all h o m o m o r p h i s m s of A to B. We can express every set Y of partial m a p s f r o m A to B canonically as
E ¢pe5
YI (x, y).
(1)
(x,y)~
Substituting 1 E • for each (x, y) ~ A x B which occurs in this expression, we get an arithmetic expression whose value is I ~ l - - t h e n u m b e r of m a p s in ~ . Obviously, the same can be said of any of the expressions obtained from the canonical one by rewriting it using the distributive law. By L e m m a 1.2, the set of all h o m o m o r p h i c partial maps q~ from A to B with D o m ( q ~ ) = D is given by
D o m ( q J ) = f - ' ( x ) U Dom(q~) I-[ Z (x, y). x~ D d(y)= o~, r(y) 1r(x)
is homomorphic iff C o d o m ( + - q~) _c g - l ( q ~ ( x ) )
and + - q~ is depth-increasing. Proof. The p r o o f can easily be seen to hold. Also it can be derived from the results in [6]. []
W h a t the l e m m a says is that all h o m o r p h i c extensions of a given h o m o m o r p h i c partial m a p q~ to a (possibly) bigger d o m a i n f-~(x) o Dom(q~) are o b t a i n e d by combining q~ with all the depthincreasing m a p s from f - l(x) - Dom(q~) into
gLet D d e n o t e some m i n i m a l set of generators of the core of A (D meets each cycle of f in one point). Lemma 1.2. A partial map q~ from A to B with Dom(q~) = D is homomorphic iff the period of q~(x) divides the period of x for every x ~ D.
Proof. T h e p r o o f obviously follows.
[]
Starting with the set of all h o m o m o r p h i c partial m a p s q~ with D o m ( q 0 = D, we can extend each of t h e m (if any) in all possible ways, by L e m m a 1.1, to a bigger d o m a i n f - l ( x ) w D, whenever we find 92
(2)
Clearly, this expression is distributively equivalent to the canonical one for the set of partial m a p s in question. Moreover, this expression is simple in the sense that each variable (x, y ) ~ A × B occurs in it at m o s t once. Let n o w a ~ D be such that D, = f - l ( a ) - D 4: g. T h e simple expression ta,b =
H E (X, y), x~D a y~g-l(b),d(x)~
(3)
for b E B, corresponds to the set of all depth-increasing partial m a p s ¢e f r o m A to B with Dom(qJ) = Da, C o d o m ( + ) _c g - l ( b ) . If we substitute (a, b)t,, b for each occurrence of (a, b) in (2), we shall get, by L e m m a 1.1, a simple expression for the set of all h o m o m o r p h i c partial m a p s q~ f r o m A to B with d o m a i n D U D,. Iterating this process of extensions, m a t c h e d by the appropriate substitutions into the expressions o b t a i n e d on each step, we finally get a simple expression, in a time p r o p o r t i o n a l to n = IA x B I, for the set of all h o m o m o r p h i s m s from A to B. T o evaluate the corresponding arithmetic expression, we have to add or multiply at most n - 1 times n u m b e r s of binary length at mos~ n log n.
Volume 22, Number 2
INFORMATION PROCESSING LETTERS
(The n u m b e r s involved do not exceed n".) By [8], the whole evaluation consumes O ( n 2 log 2 n - log log n- log log log n) time. We n o w have proved the following theorem.
Theorem 1.3. There is a polynomial-time algorithm which determines the number of homomorphisms of a mono-unary algebra (A, f) into a mono-unary algebra (B, g). I f n = IA X B I, the algorithm consumes
O ( n 2 log 2 n - l o g log n- log log log n)
18 January 1986
pairs (H, K) of digraphs with these properties follows from the results by Hell and Ne~etfil [3]. Choose five points Pl . . . . ,P5 in H such that h(p,) = qi are distinct for i = 1 . . . . . 4 and h ( p s ) = h(pl). Take n + k disjoint copies H s of H (both the copies and their elements will be distinguished by the superscript s = 1 , . . . , n + k), identify p~ and p~+ 1 for s = 1 . . . . . n + k - 1. Call the resulting dig r a p h L = H 1 + • • • + H n+k + K.
Lemma 2.1. (1) I f g ~ E n d L, then either g = 1i. or ImgcK. (2) h1 + . . . + h n + k + 1K ~ E n d L, where h ~ : H s ---, K is a natural copy of h : H ~ K.
time.
Proof. The copies H s, s = 1 . . . . , n + k, and K are 2. Nonrigidity of digraphs NP-complete, consequences--handiness of full embeddings C o n s i d e r a boolean formula f = f(x I . . . . . x n ) = (a, V b I v c , ) A (a 2 V b 2 v c2)
A ..-A(akVbkVCk), where a,, b~, c i are distinct for each i = 1 , . . . , k and equal either to variables or negations thereof (it is a s s u m e d that x l , . . . , x n all occur in f) and such that a i =gbi (the bar stands for negation). Assign to f a g r a p h G = G(f) with vertices U, V, W; X l , . . . , X n ,
X1,...,Xn,
til,...,ti5
for i = 1 , . . . , n~ with triangles {u;v,w},
{u, x i , ~ i }
fori=l,...,n,
{tjl , tj2 , tj3}, {tj3 , tj4 , tjs}, {tjs, u, v} for j = 1 . . . . . k, and edges {tjl, a j } , {tja, b j } , {tj4, cj}
disjoint 5-connected subgraphs of L; hence, every e n d o m o r p h i s m of L m u s t preserve the partition of L it defines. Since there is no h o m o m o r p h i s m of K i n t o H, or into H s for that matter, every g e E n d L m u s t carry K identically o n t o K. If some p o i n t of L, n o t in K, is taken to K by g, then by connectedoess the whole c o m p l e m e n t of K is taken to K. If g preserves the c o m p l e m e n t of K, then g restricted to H s , s = l . . . . , n + k - 1 , is a unique isomorp h i s m of H s onto some Hr. But then we have g(p~+l) = g(p~) = p~ = ptl+ 1 f r o m which, by a suitable iteration of the argum e n t , we conclude that s = t, thus g is identity on L. Part (2) is straightforward. [] R e t u r n i n g to our f o r m u l a f a n d its Karp's graph G(f), we n o w construct a d i g r a p h M(f) as follows. Considering G(f) as a s y m m e t r i c digraph, we f o r m a disjoint sum of G(f) a n d L, and add the following new arcs: (u, q 2 ) , (v, q2), (w, q 2 ) , (v, q3),
forj =l,...,k.
This c o n s t r u c t i o n is d u e to Karp [4], w h o proved that f is satisfiable iff G(f) is 3-colorable. Let H a n d . K be asymmetric 5-connected rigid digraphs such that there exists a noninjective hom o m o r p h i s m h : H ---, K with II m h I >~ 4 and there is no h o m o m o r p h i s m of K to H. T h e existence of
(w, q3), (w, q4), (tij, P~)
fori=l,...,5,
(xj, p i + k ) , (~j, pi+k )
j=l,...,k, forj = 1,...,n.
Lemma 2.2. Every g ~ E n d M(f) preserves both G(f) and L. 93
Volume 22, Number 2
INFORMATION PROCESSING LETTERS
Proof. Since g carries symmetric arcs to symmetric arcs, it carries G(f) into itself. Each point of L lies in some 5-tournament, while no point of G(f) has this property, thus also L must be carried into itself by g. [] Lemma 2.3. There exists g ~ End M(f) nonidentical on L iff G(f) is 3-colorable. If G(f) is 3-colorable, then G(f) has an idempotent endomorphism projecting it on the triangle (u, v, w}. It is easy to check that this endomorphism of G(f) can be extended to an endomorphism of M(f) by the endomorphism of L from Lemma 2.1(2). If there is an endomorphism g of M(f) nonidentical on L, then by Lemma 2.1(1), g(L)c_ K, thus by the definition of M(f) and Lemma 2.2, g carries G(f) onto {u, v, w}. [] P r o o f .
I_emma 2.4. / f an endomorphism g of M(f) is identity on L, then g is identity on M(f). Proof. By the definition of M(f) and by Lemma 2.2, g is identity on (u, v, w}, preserves the sets {xi, xi}, i = 1 , . . . , n , and preserves the sets Tj = {taj,...,tsj ) for j = 1 . . . . . k. Moreover, since tsj is the only point in Tj from which there is an arc to u in M(f), we have g(tsj)= tsj for j = 1 , . . . , k . The points tlj, t2j, t4j are connected by arcs to points in ( x ] , . . . , x n } (-') { X 1 , ' ' ' , ~n } while the points t3j, tsj are not, thus g preserves the set (tlj, tzj, t4j}. From the form of the full subgraph Tj of M(f) we conclude that g fixes t3j and t4j, and preserves the set (tlj, t2j} for j = 1 . . . . ,k.~ Since we have assumed that aj v~bj for all j = 1 . . . . , k in the formula f, we conclude that g cannot interchange t~j with t2j, thus g is identity on U~=] Tj. Finally, we show that g fixes both x i and X i for all i = 1 , . . . , n. Since (xi, -~) is an arc, g only can either fix or interchange x i and Xi. For every i = l . . . . . n, there is some j = l . . . . ,k such that either x~ or ~i belongs to (aj, bj, cj} as different symbols. This means that g must fix them. [] The construction of M(f) provides a polynomial reduction of 3-satisfiability to the existence of nonidentity endomorphisms in digraphs; hence, we have proved the following theorem. 94
18 January 1986
Theorem 2.5. The problem of the existence of a nonidentity endomorphism of a digraph is NP-complete. Corollary 2.6. For every k >1 1, the problem whether a given graph G has lEnd G I > k is NP-complete. Proof. By the use of the so-called ~ip constructions (cf. [5,7]) one can prove the following: There exists an integer p such that for every pair G], G 2 of graphs we can construct a graph G such that End G - End G1 x End G? and IV(G) I ~ P(IE(G1) [ + [E(G2) [). (V(G) and E(G) denote the vertices and the edges of a graph G, respectively.) Taking G 1 with lEnd G] [ = k, we have lEnd G[ > k iff G2 has a nonidentity endomorphism. It is not difficult to find G1 with exactly k endomorphisms. In fact (cf. [7]), to every monoid M there exists a graph G with End G isomorphic to M. [] Theorem 2.7. The problem of the existence of a nonidentity endomorphism for an algebra with two unary operations is NP-complete. Proof. There is a polynomial construction which turns a digraph G into an algebra A with two unary operations which has the same endomorphism monoid as G (cf. [7]). [] Similar polynomial constructions (full embeddings) exist from digraphs to - symmetric connected digraphs, - connected 3-colorable graphs, algebras with two unary idempotent operations, quasigroups, - algebras with an n-ary operation for some n>~2. -
-
Corollary 2.8. For every k >/1, the problem whether some of the above structures has more than k endomorphisms is NP-complete.
Volume 22, Number 2
INFORMATION PROCESSING LETTERS
References [1] A.V. Aho, J.E. Hopcroft and J.D. Ullman, The Design and Analysis of Computer Algorithms (Addison-Wesley, Reading, MA, 1976). [2] M.R. Garey and D.S. Johnson, Computers and Intractability, A Guide to the Theory of NP-Completeness (Freeman, San Francisco, CA, 1979). [3] P. Hell and J. Ne~etfil, Graphs and k-societies, Canad. Math. Bull. 13 (1970) 375-381. [4] R.M. Karp, Reducibility among copabinatorial problems, in: E.W. Miller and J.W. Thatcher, eds., Complexity of
[5]
[6] [7]
[8]
18 January 1986
Computer Computations (Plenum Press, New York, 1972) 85-104. E. Mendelsohn, o n a technique for representing semigroups and endomorphism semigroups of graphs with given properties, Semigroup Forum 4 (1972) 283-294. M. Novotn2~, Ober Abbildungen von Mengen, Pacif. J. Math. 13 (1963) 1359-1369. A. Puhr and V. Trnkovh, Combinatorial, Algebraic, and Topological Representations of Groups, Semigroups, and Categories (North-Holland, Amsterdam, 1980). A. SchO,nhage and V. Strassen, Schnelle Multiplikation grosser Zahlen, Computing 7 (1971) 281-292.
95