A generic algorithm for the word problem in semigroups and groups

Kapovich, Myasnikov, Schupp and Shpilrain in 2003 developed generic approach to algorithmic problems, which considers an algorithmic problem on “most” of the inputs instead of the entire domain and ignores it on the rest of inputs. Myasnikov, Ushakov and Won in 2008 constructed a simple generic algorithm for the word problem in some finitely defined semigroups, including classical semigroups with undecidable word problem: Tseitin semigroup, Makanin semigroup and Matiyasevich semigroup. But this algorithm does not work for wider classes of semigroups: for example, semigroups with one relation. In this paper we present new generic algorithm for a wide class of finitely defined semigroups, including Tseitin and Makanin semigroups, semigroups with one relation. This algorithm can be viewed as advanced development of the Myasnikov-Ushakov-Won algorithm. Also we adopt our generic algorithm for the word problem in some finitely defined groups, including classical examples of groups with undecidable word problem. The work is supported by Mathematical Center in Akademgorodok, the agreement with Ministry of Science and High Education of the Russian Federation number 075-15-2019-1613.


Introduction
Kapovich, Myasnikov, Schupp and Shpilrain in [3] developed generic approach to algorithmic problems, which considers an algorithmic problem on "most" of the inputs (i.e., on a generic set) instead of the entire domain and ignores it on the rest of inputs (a negligible set). It turned out, that many famous undecidable problems are easily decidable on most inputs. For example, in [3] a polynomial generic algorithm for the word problem in a large class finitely defined groups was constructed. This class contains many famous groups with undecidable word problem: Novikov group, Boone group, Borisov group and etc. The generic algorithm uses an idea of some approximation of a "complicated" group with undecidable word problem by a "simple" group with decidable word problem. Justification of this algorithm involves the beautiful theory of random walks on Cayley graphs.
Myasnikov, Ushakov and Won in [7,10] suggested a simple generic algorithm for the word problem in finitely defined semigroups, based on the notion of balanced presentation. A semigroup is called balanced on letter a, if for every relation of the semigroup u = v, the letter a is included in u and in v the same number of times. Words representing equal elements in this semigroup have the same number of letters a. It can be shown by quite elementary MSTU 2020 Journal of Physics: Conference Series 1546 (2020) 012100 IOP Publishing doi: 10.1088/1742-6596/1546/1/012100 2 combinatorial computations that the set of all these pairs of words is negligible. So the generic algorithm just compares the numbers of occurrences of letter a in the input words, outputs "NO", if they are different and outputs "I don't know", if they are equal. Amazingly that, this generic algorithm works for classical semigroups with undecidable word problem: Tseitin semigroup [9], Makanin semigroup [4]. And its modification works for Matiyasevich semigroup [5]. But this algorithm does not work for wider classes of semigroups. For example, semigroups with one relation, because it is easy to write relation which is not balanced on any letter. The question about decidability of the word problem for semigroups with one relation is still open despite of great progress for many particular classes of such semigroups [1].
In this paper we present new generic algorithm for a wide class of finitely defined semigroups. This class includes Tseitin and Makanin semigroups, semigroups with one relation. This algorithm can be viewed as advanced development of the generic algorithm for balanced semigroups. Justification of our algorithm uses results of paper [3] about random walks in groups. Also we adopt our generic algorithm for the word problem in some finitely defined groups, including classical examples of Novikov and Borisov groups with undecidable word problem [2,8].

Preliminaries
Let I be the set of all inputs and I n be the set of all inputs of size n (sphere of radius n). For a subset S ⊆ I define the following sequence The asymptotic density of set S is the following limit (if it exists) A set S ⊆ I (decision problem) is called generically decidable if there exists a generic algorithm, computing the characteristic function of S. Otherwise it is called generically undecidable. We will deal with words and pairs of words over a finite alphabets. Let A be a finite alphabet. Denote by A * the set of all finite words in alphabet A. For every word w ∈ A * we will denote by |w| the length of word w. The size of pair (w 1 , w 2 ) ∈ A * × A * is |w 1 | + |w 2 |.

Word problem in semigroups
Let S = A | R be a finitely defined semigroup with generators A = {a 1 , . . . , a m } and relations For every letter a i in alphabet A and for all pairs (w 1 , w 2 ) ∈ A * × A * define d i (w 1 , w 2 ) as the number of letter a i in w 1 minus the number of letter a i in w 2 . Define now for all pairs (w 1 , w 2 ) ∈ A * × A * the following vector d(w 1 , w 2 ) = d 1 (w 1 , w 2 ), . . . , d m (w 1 , w 2 ) . For the semigroup S denote by V S the subspace of vector space Q m , generated by vectors d(v i , u i ), i = 1, . . . , k for all relations u i = v i , i = 1, . . . , k.
Proof. Suppose w 1 = w 2 in the semigroup S and is a sequence of transformations of word w 2 from word w 1 by relations of semigroup S. Namely, for every j = 1, . . . , s − 1 word w j+1 is obtained from word w j by replacement a subword u i by word v i from some relation u i = v i of semigroup S. Now we will use induction by j.
One can define for every word w ∈ {A ∪ A −1 } * and for every i = 1, . . . , m d i (w) as sum of powers of letter a i in word w. Then we can define the following vector It is easy to see that the set is a normal subgroup of F (A). Since V has a dimension less than m, the quotient group Note that This equality implies that the set A * V is also negligible in A * .

MSTU 2020
Journal of Physics: Conference Series 1546 (2020) 012100 IOP Publishing doi:10.1088/1742-6596/1546/1/012100 4 Theorem 1. Let S = A | R be a finitely defined semigroup such that V S has dimension less than m = |A|. Then the word problem in S is generically decidable in polynomial time.
Proof. Consider the following algorithm A. Algorithm A works on an input (w 1 , w 2 ) ∈ A * × A * in the following way.
. . , m and vector d(w 1 , w 2 ). The rank is computed by Gauss elimination method in polynomial time.
then output the answer "NO".
Lemma 1 implies that this algorithm correctly decides the word problem in the semigroup S. The genericity of this algorithm follows from Lemma 2.
We apply our generic algorithm to famous semigroups with undecidable in classical sense word problems. It is easy to see that subspace V T has dimension 3 < 5. Thus by Theorem 1, the word problem in T is generically decidable in polynomial time. It is easy to see that subspace V M has dimension 3 < 4. Thus by Theorem 1, the word problem in M is generically decidable in polynomial time. The question about decidability of the word problem for semigroups with one relation is still open despite of great progress for many particular classes of such semigroups [1].
Corollary 3. The word problem in any semigroup S = A | u = v with one relation is generically decidable in polynomial time.
Proof. If |A| = 1, then semigroup S is cyclic and obviously it has decidable word problem. If |A| > 1, then subspace V S is generated by one only vector d(u, v) and has dimension ≤ 1 < |A|. Thus by Theorem 1, the word problem in S is generically decidable in polynomial time.
Moreover, it is easy to generalize this statement. Proof. Since |A| > k, then subspace V S is generated by k vector d(u, v) and has dimension ≤ k < |A|. Thus by Theorem 1, the word problem in S is generically decidable in polynomial time.
In [6] a semigroup with generically undecidable word problem was constructed. Let S = A | R be a semigroup with the word problem undecidable in the classical sense. Suppose   Proof. Suppose w = 1 in the group G and 1 = w 1 , w 2 , . . . , w s−1 , w s = w is a sequence of transformations of empty word 1 to w by relations of group G. Namely, for every j = 1, . . . , s − 1 word w j+1 is obtained from word w j by replacement a subword u i by empty word from some relation u i = 1 of group G. Or w j+1 is obtained from word w j by adding of subword u i . Now we will use induction by j.

Word problem in groups
Word w j+1 is obtained from word w j by replacement a subword u i by empty word according to some relation Proof. Consider the free abelian group F (A) with generators A ∪ A −1 . Note that the set {A ∪ A −1 } * V is a normal subgroup of F (A). Since V has a dimension less than m, the quotient Theorem 2. Let G = A ∪ A −1 | R be a finitely defined group such that V G has dimension less than m = |A|. Then the word problem in G is generically decidable in polynomial time.
Proof. Consider the following algorithm A. Algorithm A works on an input w ∈ {A ∪ A −1 } * in the following way. where R N consists of the following relations: is generically decidable in polynomial time.
Proof. Compute vectors d for all relations of N: It is easy to see that subspace V N has dimension at most m + 2. This is less than m + 6 -the number of generators of group N. Thus by Theorem 2, the word problem in N is generically decidable in polynomial time.
is generically decidable in polynomial time. It is easy to see that subspace V B has dimension 7 < 10. Thus by Theorem 2, the word problem in B is generically decidable in polynomial time.
Corollary 7. The word problem in any group G = A | u = 1 with one relation is generically decidable in polynomial time.
Proof. If |A| = 1, then group G is cyclic and obviously it has decidable word problem. If |A| > 1, then subspace V G is generated by one only vector d(u) and has dimension ≤ 1 < |A|. Thus by Theorem 2, the word problem in G is generically decidable in polynomial time.
Moreover, it is easy to generalize this statement. Corollary 8. Let G = A | u 1 = 1, . . . , u k = 1 be a group such that number of relations k is less than number of generators |A|. The word problem in G is generically decidable in polynomial time.
Proof. Since |A| > k, then subspace V G is generated by k vectors d(u i ) and has dimension ≤ k < |A|. Thus by Theorem 2, the word problem in G is generically decidable in polynomial time.