Information Processing Letters 22 (1986) 125-131 3 March 1986 North-Holland SQUARE-FREE WORDS ON PARTIALLY COMMUTATIVE FREE MONOIDS * Arturo CARPI Institute of Fundamental Mathematics, University of Rome, 00100 Rome, Italy Aldo DE LUCA Department of Applied Mathematics "'R. Caccioppoli", University of Napoli, Via Mezzocannone 8, 80134 Napoli, Italy Communicated by L. Boasson Received March 1985 Revised May 1985 We give a characterization of the partially commutative free monoids having an infinite number of square-free elements. We prove that it is decidable whether a given partially commutative free monoid contains infinitely many square-free words. Keywords: Square-free words, partially commutative free monoids 1. Introduction Since the beginning of this century, many papers have been devoted to the investigation of square- free words. This problem has several applications in various fields, such as game theory, symbolic dynamics, group theory, and formal language the- ory. The first work on this subject was due to Thue [11] who proved that the set of square-free words on an alphabet A is infinite, provided A contains at least three letters. In this article we are concerned with square-free elements of partially commutative free monoids. Roughly speaking, partially commutative free monoids are obtained by considering words in which only some pairs of letters can commute. These objects have been studied for the first time by Cartier and Foata [3] who used them in a combinatorial problem. More recently, several authors have been .interested in the study of ra- * This research was partially supported by the Italian Ministry of Education. tional subsets of partially commutative free mono- ids (cf., for instance, [2,4,5] and references therein). The main result of this article is a characteriza- tion of the partially commutative free monoids containing an infinite number of square-free ele- ments. It shows that it is effectively decidable whether a given partially commutative free monoid contains infinitely many square-free words. 2. Preliminaries Let A* be the free monoid generated by a finite alphabet A. The length of a word w ~ A* is de- noted by Iwl. A is the empty word and A += A*\ { A } the free semigroup over A. Let 0 _ A X A be a symmetric relation and - the congruence in A* generated by the set of pairs (ab, ba) such that (a, b) ~ 0. The quotient monoid M(A, 0)= A*\ - is said to be the partially com- mutatioe free monoid on A (relatively to 0). The canonical epimorphism of A* onto M(A, 0) is denoted by ¢. A word w ~ A* is square-free if it contains no 0020-0190/86/$3.50 © 1986, Elsevier Science Publishers B.V. (North-Holland) 125