Cayley Linear–Time Computable Groups

This paper looks at the class of groups admitting normal forms for which the right multiplication by a group element is computed in linear time on a multi–tape Turing machine. We show that the groups Z 2 ≀ Z 2 , Z 2 ≀ F 2 and Thompson’s group F have normal forms for which the right multiplication by a group element is computed in linear time on a 2–tape Turing machine. This refines the results previously established by Elder and the authors that these groups are Cayley polynomial–time computable.


Introduction
Extensions of the notion of an automatic group introduced by Thurston and others [11] have been studied by different researchers.One of the extensions is the notion of a Cayley automatic group introduced by Kharlampovich, Khoussainov and Miasnikov [15].In their approach a normal form is defined by a bijection between a regular language and a group such that the right multiplication by a group element is recognized by a two-tape synchronous automaton.Elder and the authors looked at the further extension of Cayley automatic groups allowing the language of normal forms to be arbitrary (though it is always recursively enumerable [2, Theorem 3]) but requiring the right multiplication by a group element to be computed by an automatic function (a function that can be computed by a two-tape synchronous automaton).This extension is referred to as Cayley position-faithful (one-tape) linear-time computable groups [2, Definition 3].These groups admit quasigeodesic normal forms (see Definition 1.3) for which the right multiplication by a group element is computed in linear time (on a position-faithful one-tape Turing machine) and the normal form is computed in quadratic time [2,Theorem 2].
In this paper we look at the groups admitting normal forms for which the right multiplication by a group element is computed in linear time on a multi-tape Turing machine (we refer to such groups as Cayley linear-time computable).These normal forms are not necessarily quasigeodesic, see, e.g., the normal form of Z 2 ≀ Z 2 considered in Section 2. However, if such normal form is quasigeodesic, then it is computed in quadratic time (see Theorem 1.6), thus, fully retaining the basic algorithmic properties of normal forms for Cayley automatic groups: computability of the right multiplication by a group element in linear time and normal form in quadratic time.Cayley linear-time computable groups form a subset of Cayley polynomial-time computable groups introduced in [2, Definition 5], but clearly include all Cayley position-faithful (one-tape) linear-time computable groups.We show that the groups Z 2 ≀ Z 2 , Z 2 ≀ F 2 and Thompson's group F are Cayley linear-time computable (on a 2-tape Turing machine) which refines the previous claims that these groups are Cayley polynomial-time computable [2].To show that these three groups are Cayley linear-time computable we use the normal forms previously studied by the second author and Khoussainov for groups Z 2 ≀ Z 2 and Z 2 ≀ F 2 [3] and Elder and Taback for Thompson's group F [10].We note that [3,Theorems 5,8] and [10,Theorem 3.6] showing that Z 2 ≀ F 2 , Z 2 ≀ Z 2 and Thompson's group F are context-free, indexed and deterministic non-blind 1-counter graph automatic, respectively, do not imply that the right multiplications by a group element for the normal forms considered in these groups are computed in linear time on a 2-tape Turing machine.The latter requires careful verification that is done in this paper.
Several researchers studied extensions of automatic groups utilizing different computational models.Bridson and Gilman considered an extension of asynchronously automatic groups using indexed languages [4].Baumslag, Shapiro and Short extended the notion of an automatic group based on parallel computations by pushdown automata [1].Brittenham and Hermiller introduced autostackable groups which also extends the notion of an automatic group [5].Elder and Taback introduced C-graph automatic groups extending Cayley automatic groups and studied them for different classes of languages C [9].Jain, Khoussainov and Stephan introduced the class of a semiautomatic groups [13] which generalizes the notion of a Cayley automatic group.Jain, Moldagaliyev, Stephan and Tran studied extensions of Cayley automatic groups using transducers and tree automata [14].
The paper is organized as follows.In Section 1 we introduce the notion of a Cayley k-tape linear-time computable group.In Sections 2, 3 and 4 we show that the wreath products Z 2 ≀Z 2 , Z 2 ≀F 2 and Thompson's group F , respectively, are Cayley 2-tape linear-time computable.Section 5 concludes the paper.

Preliminaries
In this section we introduce the notion of a Cayley linear-time computable group.We start with defining a basic concept underlying this notion -a function computed on a k-tape Turing machine in linear time, where k > 1.
Definition 1.1.A (position-faithful) k-tape Turing machine is a Turing machine with k semi-infinite tapes for each of which the leftmost position contains the special symbol ⊞ which only occurs at this position and cannot be modified.We denote by ⊡ a special blank symbol, by Σ the input alphabet for which Σ ∩ {⊞, ⊡} = ∅ and by Γ the tape alphabet for which Σ ∪ {⊞, ⊡} ⊆ Γ.Initially, for the input x ∈ Σ * , the configuration of the first tape is ⊞x⊡ ∞ with the head being at the ⊞ symbol.The configurations of other k − 1 tapes are ⊞⊡ ∞ with the head pointing at the ⊞ symbol.During the computation the Turing machine operates as usual, reading and writing symbols from Γ in cells to the right of the ⊞ symbol.
Let k > 1.A function f : Σ * → Σ * is said to be computed on a k-tape Turing machine in linear time, if for the input string x ∈ Σ * of length n when started with the first tape content being ⊞x⊡ ∞ and other tapes content being ⊞⊡ ∞ , the heads pointing at ⊞, the Turing machine reaches an accepting state and halts in Cn or fewer steps with the first tape having prefix ⊞f (x)⊡, where C > 0 is a constant.There is no restriction on the output beyond the first appearance of ⊡ on the first tape, the content of other tapes and the positions of their heads.
In Definition 1.1 position-faithfulness refers to a way the output in Σ * computed on a Turing machine is defined: it is the string v ∈ Σ * for which the content of the first tape after a Turing machine halts is ⊞v ⊡ w⊡ ∞ , where w is some string in Γ * .In general the output in Σ * computed on a Turing machine can be defined as the content of the first tape after it halts with all symbols in Γ \ Σ removed: see [16] where the output of the computation on a one-tape Turing machine is defined as the string y ∈ Γ * for which the content of the tape after it halts is ⊞y⊡ ∞ , where y is either empty or the last symbol of y is not ⊡.For one-tape Turing machines the restrictions to position-faithful ones matters -there exist functions computed in linear time on a one-tape Turing machine which cannot be computed in linear time on a position-faithful one-tape Turing machine [8].The latter is due to the fact that shifting may require quadratic time.For multi-tape Turing machines (k > 1) the restriction to position-faithful ones becomes irrelevant as shifting can always be done in linear time.Recall that a function Jain, Seah and Stephan showed that f : Σ * → Σ * is computed on a position-faithful one-tape Turing machine in linear time if and only if it is automatic [8].For k > 1 the class of functions computed on k-tape Turing machines in linear time is clearly wider than the class of automatic functions.Now let G be a finitely generated group.Let S = {s 1 , . . ., s k } ⊂ G be a set of its semigroup generators.That is, every group element of G can be written as a product of elements in S. Below we define Cayley linear-time computable groups.Definition 1.2.Let k > 1.We say that G is Cayley k-tape linear-time computable if there exist a language L ⊆ Σ * , a bijective mapping ψ : L → G and functions f s : Σ * → Σ * , for s ∈ S, each of which is computed on a k-tape Turing machine in linear time, such that for every w ∈ L and s ∈ S: ψ(f s (w)) = ψ(w)s.That is, the following diagram commutes: where r s : G → G is the right multiplication by s in G: r s (g) = gs for all g ∈ G.
We refer to a bijective mapping ψ : L → G as a representation.It defines a normal form of a group G which for every group element g ∈ G assigns a unique string in w ∈ L such that ψ(w) = g.For the latter we also say that w is a normal form of a group element g.We will say that a representation ψ : L → G from Definition 1.2, as well as the corresponding normal form of G, are k-tape linear-time computable.We note that Definition 1.2 does not depend on the choice of a set of semigroup generators S -this follows directly from the observation that a composition of functions computed on k-tape Turing machines in linear time is also computed on a k-tape Turing machine in linear time.We say that a group is Cayley linear-time computable if it is Cayley k-tape linear-time computable for some k.
Cayley position-faithful (one-tape) linear-time computable groups were studied in [2].They comprise wide classes of groups (e.g., all polycyclic groups), but at the same time retain all basic properties of Cayley automatic groups.Namely, each of such groups admits a normal form for which the right multiplication by a fixed group element is computed in linear time and for a given word g 1 . . .g n , g i ∈ S, the normal form of g = g 1 . . .g n is computed in quadratic time.Furthermore, a position-faithful (one-tape) linear-time computable normal form is always quasigeodesic [2, Theorem 1] (see Definition 1.3 for the notion of a quasigeodesic normal form introduced by Elder and Taback [9,Definition 4]).Moreover, this statement can be generalized to Theorem 1.4.Definition 1.3.A representation ψ : L → G (a normal form of G) is said to be quasigeodesic if there exists a constant C > 0 such that for all g ∈ G: |w| ⩽ C(d S (g) + 1), where w is the normal form of g, |w| is its length and d S (g) is the length of a shortest word g 1 . . .g n , g i ∈ S, for which g = g 1 . . .g n in G.
Theorem 1.4.A one-tape o(n log n)-time computable normal form is quasigeodesic.
Proof.Let ψ : L → G be a bijection between a language L ⊆ Σ * and a group G defining a Cayley one-tape o(n log n)-time computable normal form of G. Let S ⊂ G be a finite set of semigroup generators.For each s ∈ S there exists a one-tape o(n log n)-time computable function f s : Σ * → Σ * such that ψ(f s (w)) = ψ(w)s for all w ∈ L. For a given s ∈ S we denote by TM s a one-tape Turing machine computing the function f s in o(n log n) time.For a given x ∈ Σ * we denote by TM s (x) the output of the computation on TM s for the input x: it is the string y over the tape alphabet of TM s for which the content of the tape after TM s halts is ⊞y⊡ ∞ , where y is either empty or the last symbol of y is not ⊡ [16].We denote by TM ′ s a Turing machine which works exactly like TM s , but writes the marked blank symbol ⊡ instead of ⊡.Let Σ s = Γ s ∪ { ⊡} \ {⊡}, where Γ s is the tape alphabet of TM s .Below we show that the language of convolutions We first recall the notion of convolutions of two strings x ∈ Σ * and z ∈ Σ * s .Let ⋄ be a padding symbol which does not belong to the alphabet Σ and Σ s .The convolution x ⊗ z is the string of length max{|x|, |z|} for which the kth symbol is σ 1 σ 2 , where σ 1 is the kth symbol of x if k ⩽ |x| and ⋄ otherwise and σ 2 is the kth symbol of z if k ⩽ |z| and ⋄ otherwise.We denote by Σ * ⊗ Σ * s the language of all convolutions Σ * ⊗ Σ Note that at most one of σ 1 and σ 2 can be equal to ⋄, but never both.Therefore, Σ * ⊗ Σ * s is a language over the alphabet Σ ′ s consisting of all symbols σ 1 σ 2 for which σ 1 ∈ Σ ∪ {⋄}, σ 2 ∈ Σ s ∪ {⋄} and σ 1 and σ 2 cannot be equal to ⋄ simultaneously.Let us describe a Turing machine TM ′′ s recognizing the language L s .For the sake of convenience we assume that TM ′′ s has two semi-infinite tapes with the heads on each of the two tapes moving only synchronously.
Algorithm 1.5.Initially, the input string over the alphabet Σ ′ s is written on the convolution of two semi-infinite tapes -the first and the second component for each symbol in Σ ′ s appears on the first and the second tape, respectively.For each of the two tapes the head is over the first cell.
(1) First TM ′′ s scans the input from left to right checking if the input is of the form x ⊗ z ∈ Σ * ⊗ Σ * s for some x ∈ Σ * and z ∈ Σ * s .If it is not, the input is rejected.Simultaneously, if on one of the tapes TM ′′ s reads ⋄, it writes ⊡.After the heads read ⊡ on both tapes detecting the end of the input, they return back to the initial position.
(2) TM ′′ s works exactly like TM ′ s on the first tape until it halts ignoring the content of the second tape.Then the heads go back to the initial position.[17] showed that a language recognized by a one-tape Turing machine in o(m log m) time is regular.Therefore, the language L s is regular.Now, by the pumping lemma, there exists a constant C s > 0 such that |z| ⩽ |x| + C s for all x ∈ Σ * , where z = TM ′ s (x).We have: Let C > 0 be some positive constant which is greater than or equal to C s for every s ∈ S and |w 0 |, where ψ(w 0 ) = e.For a given g ∈ G let g 1 . . .g k , g i ∈ S, be a shortest word for which g = g 1 . . .g k in G and w be the string for which ψ(w) = g.Clearly, we have that ) which proves the theorem.
If k > 1, a k-tape linear-time computable normal form is not necessarily quasigeodesic: in Section 2 we show that the normal form of the wreath product Z 2 ≀ Z 2 constructed in [3, Section 5] is 2-tape linear-time computable; but this normal form is not quasigeodesic [3,Remark 9].However, if a k-tape linear-time computable normal form is quasigeodesic, then it satisfies the same basic algorithmic property as a position-faithful (one-tape) linear-time computable normal form -it is computed in quadratic time [2, Theorem 2].Indeed, let ψ : L → G be a bijection between a language L ⊆ Σ * and a group G defining a quasigeodesic k-tape linear-time computable normal form of G. Let S ⊂ G be a finite set of semigroup generators.
Theorem 1.6.There is a quadratic-time algorithm which for a given word g 1 . . .g n ∈ S * , g i ∈ S, computes the normal form of the group element g = g 1 . . .g n ∈ G -the string w ∈ L for which ψ(w) = g.
Proof.Let w i ∈ L be the normal form of the group element g 1 . . .g i : ψ(w i ) = g 1 . . .g i for i = 1, . . ., n.Let w 0 be the normal form of the identity: ψ(w 0 ) = e.For each i = 0, . . ., n − 1, the string w i+1 is computed from time for all i = 0, . . ., n − 1.Now an algorithm computing w from a given input g 1 . . .g n is as follows.Starting from w 0 it consecutively computes w 1 , w 2 , . . ., w n−1 and w n .The running time for this algorithm is at most O(n 2 ).
As an immediate corollary of Theorem 1.6 we obtain that the word problem for a group G which admits a quasigeodesic k-tape linear-time computable normal form is decidable in quadratic time.

The Wreath Product
In this section we will show that the group Z 2 ≀ Z 2 is Cayley 2-tape linear-time computable.Every group element of Z 2 ≀ Z 2 can be written as a pair (f, z), where z ∈ Z 2 and f : Normal form.We will use a normal form for elements of Z 2 ≀ Z 2 described in [3].Let Γ be an infinite directed graph shown on Fig. 1 which is isomorphic to (N; S), where S : N → N is the successor function S(n) = n + 1.The vertices of Γ are identified with elements of Z 2 ; each vertex of Γ, except (0, 0), has exactly one ingoing and one outgoing edges and the vertex (0, 0) has one outgoing edge and no ingoing edges.Let t : N → Z 2 be a mapping defined as follows: t(1) = (0, 0) and, for k > 1, t(k) = (x, y) is the end vertex of a directed path in Γ of length k − 1 which starts at the vertex (0, 0).
We denote by Σ the alphabet Σ = {0, 1, C 0 , C 1 }.Let g = (f, z) be an element of the group Z 2 ≀ Z 2 .We denote by r a number for which t(r) = z.Let m = max{k | f (t(k)) = 1} and ℓ = max{m, r}.A normal form w ∈ Σ * of the group element g is defined to be a string w = σ 1 . . .σ ℓ of length ℓ for which  ⊡, which indicates that the input u has been read, it halts.The described Turing machine halts in linear time for every input u ∈ Σ * .Moreover, if the input u ∈ L, it computes the output v ∈ L for which ψ(u)c = ψ(v).
Let us describe a two-tape Turing machine computing the right multiplication by a in Z 2 ≀ Z 2 which halts in linear time on every input in u ∈ Σ * .We refer to this Turing machine as TM a .A key idea for constructing TM a is to divide For a given k ∈ N we denote by i the number of turns around the point (0, 0) a cursor makes when moving along the graph Γ from the vertex t(1) to the vertex t(k).Formally, i is defined as follows.Let If the symbol it reads is not ⊡, on the seconds tape TM a moves the head right until it reads ⊡.Finally, unless TM a halts, the content of the first tape is ⊞u⊡ ∞ with the head over C 0 or C 1 symbol and the content of the second tape is ⊞T i ⊡ ∞ with the head over the first ⊡ symbol.
The right multiplication of g = (f, z) ∈ Z 2 ≀ Z 2 by a changes a position of the lamplighter z mapping g to ga = (f, z ′ ), where z = (x, y) and z ′ = (x + 1, y).Let k and k ′ be the integers for which t(k) = z and t(k ′ ) = z ′ .Now we notice the following.
).So for the second iteration there are four cases to consider: Simultaneously, the head associated to the second tape moves first left until it reads ⊞ and then right it reads ⊡. 3. The head associated to the first tape moves left to the previous cell making the last (8i + 5)th move.If the head reads 0 or 1, it writes C 0 or C 1 , respectively.Finally TM a halts.Clearly, the runtime of Algorithm 2.1 is linear.Moreover, for each of the cases 1-4 the routine requires at most linear time.So TM a halts in linear time for every input u ∈ Σ * .If u ∈ L, TM a halts with the output v ∈ L written on the first tape for which ψ(u)a = ψ(v).In the same way one can construct two-tape Turing machines computing the right multiplication by a −1 and b ±1 which halt in linear time on every input.Thus we have the following theorem.

The Wreath Product
In this section we show that the group Z 2 ≀ F 2 is Cayley 2-tape linear-time computable.Every group element of Z 2 ≀ F 2 can be written as a pair (f, z), where z ∈ F 2 and f : F 2 → Z 2 is a function for which f (ξ) is the non-identity element of Z 2 for at most finitely many ξ ∈ F 2 .We denote by c the non-identity element of Z 2 = {e, c} and by a, b the generators of F 2 = ⟨a, b⟩.The group Z 2 is canonically embedded in Z 2 ≀ F 2 by mapping c to (f c , e), where f c : F 2 → Z 2 is a function for which f c (x) = e for all x ̸ = e and f c (e) = c.The group F 2 is canonically embedded in Z 2 ≀ F 2 by mapping x ∈ F 2 to (f e , x), where f e (y) = e for all y ∈ F 2 .Therefore, we can identify a, b and c with the corresponding group elements (f e , a), (f e , b) and (f c , e) in Z 2 ≀ F 2 , respectively.The group Z 2 ≀ F 2 is generated by a, b and c, so S = {a, a −1 , b, b −1 , c} is a set of its semigroup generators.The formulas for the right Normal form.We will use a normal form for elements of Z 2 ≀ F 2 described in [3].Each element of F 2 is identified uniquely with a reduced word over the alphabet {a, b, a −1 , b −1 }.We denote by F a and F b the sets of elements of F 2 for which the reduced words are of the form a ±1 w and b ±1 w, respectively.Clearly, 1 as D-symbols and E-symbols, respectively.A normal form of a given element g ∈ Z 2 ≀ F 2 is a string over the alphabet Σ constructed in a recursive way as follows.
In the first iteration consider a cyclic subgroup A = {a i | i ∈ Z} ⩽ F 2 which forms a horizontal line in a Cayley graph of F 2 with respect to a and b, see Fig.In the second iteration each new D-symbol σ is changed to a string of the form (u − σu + ), where the strings u − and u + are obtained as follows.Every D-symbol corresponds to a group element s ∈ F 2 .In order to construct u − scan the elements on a vertical ray B − s = {sb j | j < 0} from bottom to top checking for each t ∈ B − s whether or not H t ̸ = ∅, f (t) = c and t = z.In case H t ̸ = ∅ and t ̸ = z, write the symbols E 0 or E 1 , if f (t) = e or f (t) = c, respectively.Similarly, in case H t ̸ = ∅ and t = z, write the symbols E C 0 or E C 1 , in case H t = ∅ and t ̸ = z, write the symbols 0 or 1 and in case H t = ∅ and t = z, write the symbols C 0 or C 1 , if f (t) = e or f (t) = c, respectively.Finally, for the obtained infinite string cut the infinite prefix of 0s, so the first symbol of the remained finite string u − is not 0. In a similar way a string u + is constructed by scanning the elements on a vertical ray B + s = {sb j | j > 0} from bottom to top and cutting the infinite suffix consisting of 0s.For the element shown in Fig. 3 the resulted string is 11 where the strings v − and v + are obtained as follows.Every E-symbol corresponds to a group element t ∈ F 2 .In order to construct v − scan the elements on a horizontal ray respectively.In case V s = ∅ and s ̸ = z, write the symbols 0 or 1, if f (s) = e or f (s) = c, respectively.Similarly, in case V s = ∅ and s = z, write the symbols C 0 or C 1 , if f (s) = e or f (s) = c, respectively.Finally, for the obtained infinite string cut the infinite prefix consisting of 0s, so the first symbol of the remained finite string v − is not 0. In a similar way a string v + is constructed by scanning the elements on a horizontal ray A + t = {ta i | i > 0} from left to right and cutting the infinite suffix consisting of 0s.For the element in Fig. 3 the resulted string is 11(1 This process is then repeated recursively until no new D or E-symbols appear: for i > 1 the (2i)th and the (2i + 1)th iterations are performed exactly as the second and the third iterations described above, respectively.For the element in Fig. 3 the resulted string is 11 1 are used to mark the position of the lamplighter z ∈ F 2 and the identity e ∈ F 2 , respectively, when z ̸ = e.The symbols B 0 , B 1 , D B 0 , D B 1 are used to mark the position of the lamplighter and the identity when z = e.
For a given group element g = (f, z) ∈ Z 2 ≀ F 2 , let u ∈ Σ * be a normal form of g obtained by a recursive procedure described above.We denote by L ⊆ Σ * a language of all such normal forms.The described normal form of Construction of Turing machines computing the right multiplication in Z 2 ≀ F 2 by a ±1 , b ±1 and c.For the right multiplication in Z 2 ≀ F 2 by c, consider a one-tape Turing machine which reads the input u ∈ Σ * from left to right and when the head reads a symbol , respectively, for j = i + 1 mod 2, and then it halts.If the head reads the blank symbol ⊡, which indicates that the input u has been read, it halts.This Turing machine halts in linear time for every input u ∈ Σ * .Moreover, if the input u ∈ L, it computes the output v ∈ L for which ψ(u)c = ψ(v).
Let us describe a two-tape Turing machine computing the right multiplication by a in Z 2 ≀ F 2 which halts in linear time on every input in u ∈ Σ * .We refer to this Turing machine as TM a .We refer to the symbols C as B-symbols and (, ), [, ] as brackets symbols.
Algorithm 3.1 (First iteration).Initially for TM a a content of the first tape is ⊞u⊡ ∞ with a head over ⊞.A content of the second tape is ⊞⊡ ∞ with a head over ⊞.In the first iteration TM a moves a head associated to the first tape from left to right until it reads either C or B-symbol.The second tape is used as a stack for storing the bracket symbols simultaneously checking their configuration: • If a head on the first tape reads the symbol ( or [, on the second tape a head moves right to the next cell and writes this symbol; • If a head on the first tape reads the symbol ) or ], TM a checks if a head on the second tape reads ( or [, respectively.If not, TM a halts.Otherwise, on the second tape a head writes the blank symbol ⊡ and moves left to the previous cell.If on the first tape a head does not read a C or B-symbol, TM a halts after a head reads a blank symbol ⊡ indicating that the input has been read.
Let S be the symbol a head associated to the first tape reads at the end of the first iteration.In the second iteration TM a works depending on the symbol S.There are three cases to consider: , then on the second tape a head must read the left bracket symbol (.So if it is not the left bracket symbol (, TM a halts.If it is the left bracket symbol (, TM a continues working as described in Algorithm 3.2.
and ⊡, respectively, and then halts.If S ′ = (, TM a moves a head associated to the second tape by one position to the right.After that it continues working exactly as in the case c for the stage 2 of Algorithm 3.2. The runtime of Algorithm 3.1 is linear.Also, as shifting a portion of a tape by a fixed number of positions requires at most linear time, for each of the algorithms 3.2-3.4 the runtime is linear.Therefore, TM a halts in linear time for every input u ∈ Σ * .Moreover, if the input u ∈ L, TM a halts with the output v ∈ L for which ψ(u)a = ψ(v) written on the first tape.Two-tape Turing machines computing the right multiplication by a −1 and b ±1 which halt in linear time one every input are constructed in the same way as TM a with minor modifications.Thus we have the following theorem.
This infinite presentation provides a standard infinite normal form for elements of F with respect to generators x i , i ⩾ 0, discussed by Brown and Geoghegan [6].Namely, applying the relations x j x i = x i x j+1 for i < j, a group element g ∈ F can be written uniquely as: x e 0 i 0 x e 1 i 1 . . .x em im x −fn jn . . .x −f 1 j 1 x −f 0 j 0 , where: • 0 ⩽ i 0 < i 1 < i 2 < • • • < i m and 0 ⩽ j 0 < j 1 < j 2 < • • • < j n ; • e i , f j > 0 for all i, j; • if x i and x −1 i are both present in the expression, then so is x i+1 or x −1 i+1 .
it moves by one position to the left.This process is continued until a head on the first tape reads ⊞.
From Algorithm 4.1 it can be seen that a subroutine for computing R can be done in linear time on a two-tape Turing machine.Depending on the value of CASE we consider the following two cases.Case 2.1: Suppose CASE.That is, R > j n .Let M = max{i m , j n }.There are three subcases to consider: R > M , R = M and R < M .Each of these three subcases can be checked as follows.First note that M is just the number of # symbols in the normal form u. So we run a subroutine which reads u on the first tape and each time a head reads the # symbol, on a separate tape it moves a head by one position to the right and writes the # symbol.In the end of this subroutine the content of this separate tape is ⊞# M ⊡ ∞ .Now to check whether R > M , R = M or R < M we can synchronously read the tapes ⊞b R ⊡ ∞ and ⊞# M ⊡ ∞ with the heads initially over the ⊞ symbols.
(a) Suppose R > M .Then the infinite normal form of gx −1 1 is x e 0 i 0 x m 1 i 1 . . .x em im x −1 R x −fn jn . . .x −f 2 j 2 x −f 1 j 1 x −f 0 0 , where f 0 ̸ = 0. We write u in the form u = a r 0 b s 0 γ, where γ is either empty or starts with #, ends with a or b and contains exactly M # symbols.Then v = a r 0 b s 0 γ# R−M b.A subroutine for computing v from u appends the string # R−M b to u as follows.First a head on the first tape where u is written moves to the last non-blank symbol.Then we synchronously read the tapes ⊞b R ⊡ ∞ and ⊞# M ⊡ ∞ from the beginning until both heads are over the ⊡ symbols.If a head on the tape ⊞b R ⊡ ∞ reads the b symbol but a head on the tape ⊞# M ⊡ ∞ reads ⊡, on the first tape a head moves by one position to the right and writes the # symbol.As a result the content of a first tape will be ⊞a r 0 b r 0 γ# R−M ⊡ ∞ with a head over the last # symbol.After that a head on the first tape moves by one position to right and writes the b symbol.
A subroutine for computing u from v moves a head to the last symbol of u, which is b.Then it writes the ⊡ and moves a head by one position to the left.If a head reads # it writes ⊡ and moves a head by one position to the left.This process is continued until a head reads a symbol which is not #.As a result the content of a first tape will be ⊞a r 0 b s 0 γ⊡ ∞ .
(b) Suppose R = M .This can only occur if R = i m .Then the infinite normal form of gx −1 1 is either: x e 0 i 0 x e 1 i 1 . . .x em−1 im x −fn jn . . .x −f 2 j 2 x −f 1 j 1 x −f 0 j 0 if e m > 1, or x e 0 i 0 x e 1 i 1 . . .x e m−1 i m−1 x −fn jn . . .x −f 2 j 2 x −f 1 j 1 x −f 0 j 0 if e m = 1.The latter expression is an infinite normal form as i m = R ⩾ j n + 2 and w is an infinite normal form.Indeed, for Case 2.1 we have that 1 If we write u in the form u = γ# s a em , then v = γ# s a em−1 when e m > 1 and v = γ if e m = 1.
A subroutine for computing v from u reads u to check if e m > 1 or e m = 1.If e m > 1, it erases the last a symbol by writing ⊡.If e m = 1, it erases the last a symbol by writing ⊡ and moves a head by one position to the left.If a head reads # it writes ⊡ and moves by one position to the left.This is continued until a head reads a symbol which is not #.As a result the content of the first tape will be ⊞γ⊡ ∞ .

( 3 )
After that TM ′′ s scans the content of both tapes checking if the heads read the same symbol.If the heads do not read the same symbol, TM ′′ s halts rejecting the input.When the heads reads ⊡ on both tapes TM ′′ s halts accepting the input.Let n = |x| and m = max{|x|, |z|}.In the first stage of Algorithm 1.5 TM ′′ s makes O(m) moves.In the second stage it makes o(n log n) moves.As the length of TM ′ s (x) is at most o(n log n), in the third stage TM ′′ s makes at most o(n log n) moves.Since n ⩽ m we obtain that TM ′′ s makes at most o(m log m) moves before it either accepts or rejects the input x ⊗ z.As the heads of TM ′′ s move only synchronously, TM ′′ s works exactly like a one-tape Turing machine recognizing the language L s in time o(m log m), where m is a length of the input.Recall that Hartmanis [12, Theorem 2] and, independently, Trachtenbrot
For an illustration consider a group element h ∈ Z 2 ≀ Z 2 shown on Fig.1: a white square indicates that the value of a function f at a given point is e, a black square indicates that it is c, a black disk at the point p = (0, −2) indicates that f (p) = c and it specifies the position of the lamplighter.A normal form of the group element h is the string: 0100011000000100001000C 1 000101111000011000101100001.We denote by L ⊆ Σ * a language of all such normal forms.The described normal form of Z 2 ≀ Z 2 defines a bijection ψ : L → Z 2 ≀ Z 2 mapping w ∈ L to the corresponding group element g ∈ Z 2 ≀ Z 2 .This normal form is not quasigeodesic[3, Remark 9].Construction of Turing machines computing the right multiplication in Z 2 ≀Z 2 by a ±1 , b ±1 and c.For the right multiplication in Z 2 ≀ Z 2 by c, consider a one-tape Turing machine which reads the input u ∈ Σ * from left to right and when the head reads a symbol C 0 or C 1 it changes it to C 1 or C 0 , respectively, and then it halts.If the head reads the blank symbol
2) and t(m) ∈ ℓ 4 for m = k + (2i + 2).If t(k) ∈ ℓ 4 , then t(m) ∈ D 4 for k < m < k + (2i + 3) and t(m) ∈ ℓ 1 for m = k + (2i + 3).These observations ensure the correctness of the stage 3 of Algorithm 2.1.Algorithm 2.1 (First iteration).Initially for TM a a content of the first tape is ⊞u⊡ ∞ with a head over ⊞.A content of the second tape is ⊞⊡ ∞ with a head over ⊞.In the first iteration TM a moves a head associated to the first tape from left to right until it reads the symbols C 0 or C 1 each time identifying the set O, ℓ 1 , ℓ 2 , ℓ 3 , ℓ 4 , D 1 , D 2 , D 3 or D 4 which contains t(k) for the kth symbol of u being read.The second tape of TM a is used for counting the number of turns i when t(k) moves along a spiral formed by a graph Γ. Formally, in the first iteration TM a works as follows until the head associated to the first tape reads either C 0 , C 1 or ⊡.Let S be a variable which can take values only in the set{O, ℓ 1 , ℓ 2 , ℓ 3 , ℓ 4 , D 1 , D 2 , D 3 , D 4 }.(1) TM a reads the first 9 symbols of u setting S to O, ℓ 1 , ℓ 2 , D 2 , ℓ 3 , D 3 , ℓ 4 , and D 4 when the head reads the kth symbol of u for k = 1, 2, 3, 4, 5, 6, 7, 8, respectively.(2) TM a reads the 10th symbol of u and set S = ℓ 1 .On the second tape TM a moves the head right to the next cell and writes the symbol T used for storing the number of turns i. (3) The following steps are repeated in loop one after another.(a) TM a reads the next symbol of u, moves the head associated to the second tape left to the previous cell and set S = D 1 .Then TM a keeps reading u and, simultaneously, on the second tape it moves the head first left until it reads ⊞ and then right until it reads ⊡.Then it sets S = ℓ 2 .(b) TM a reads the next symbol of u, moves the head associated to the second tape left to the previous cell and set S = D 2 .Then TM a keeps reading u and, simultaneously, on the second tape it moves the head first left until it reads ⊞ and then right until it reads ⊡.Then it sets S = ℓ 3 .(c) TM a reads the next symbol of u, moves the head associated to the second tape left to the previous cell and set S = D 3 .Then TM a keeps reading u and, simultaneously, on the second tape it moves the head first left until it reads ⊞ and then right until it reads ⊡.Then it sets S = ℓ 4 .(d) TM a reads the next symbol of u, moves the head associated to the second tape left to the previous cell and set S = D 4 .Then TM a keeps reading u and, simultaneously, on the second tape it moves the head first left until it reads ⊞ and then right until it reads ⊡.Then TM a reads the next symbol of u, writes T on the second tape and set S = ℓ 1 .If the head associated to the first tape reads ⊡, TM a halts.If it reads C 0 or C 1 , TM a checks if the head associated to the second tape reads ⊡.

ℓ 3 }
and S = D 3 .Case 1. Suppose S ∈ {O, D 4 , ℓ 4 }.On the first tape TM a writes 0 or 1, if the head reads C 0 or C 1 , respectively.Then the head moves right to the next cell.If the head reads 0 or ⊡, it writes C 0 .If the head reads 1, it writes C 1 .Finally TM a halts.Case 2. Suppose S ∈ {ℓ 1 , D 1 , ℓ 2 }.We divide a routine for this case into three stages.1.On the first tape TM a writes 0 or 1, if the head reads C 0 or C 1 , respectively.2. The following subroutine is repeated four times:(a) The head associated to the first tape moves right to the next cell.If the head reads ⊡, it writes 0. The head associated to the second tape moves left to the previous cell.(b)The head associated to the first tape keeps moving to the right writing 0 if it reads ⊡.Simultaneously, the head associated to the second tape moves first left until it reads ⊞ and then right until it reads ⊡. 3. The head associated to the first tape moves right to the next cell making the last (8i + 9)th move.If the head reads 0 or ⊡, it writes C 0 .If the head reads 1, it writes C 1 .Finally TM a halts.Case 3. Suppose S ∈ {D 2 , ℓ 3 }.We divide a routine for this case into two stages.1.Let ERASE be a boolean variable.If the head associated to the first tape reads C 1 , TM a sets ERASE = false.If it reads C 0 , the head moves right to the next cell.If it reads ⊡, TM a sets ERASE = true; otherwise, it sets ERASE = false.Then the head moves back to the previous cell.Note that ERASE = true iff the head reads the last symbol of u which is C 0 .Now, if ERASE, the head associated to the first tape writes ⊡.If not ERASE, the head writes 0 or 1 if it reads C 0 or C 1 , respectively.2. The head associated to the first tape moves left to the previous cell.If the head reads 0 or 1, it writes C 0 or C 1 , respectively.Finally TM a halts.Case 4. Suppose S = D 3 .We divide a routine for this into three stages.1.The first stage is exactly the same as the first stage in the case 3. 2. The following subroutine is repeated four times: (a) The head associated to the second tape moves left to the previous cell.(b) The head associated to the first tape moves left.For each move, if ERASE and the head reads 0, it writes ⊡.If ERASE and the head reads 1, TM a sets ERASE = false.

Figure 3 :
Figure 3: A Cayley graph of F 2 and an element (f, z) ∈ Z 2 ≀ F 2 .Black and white squares indicate that a value of f at a given point is c and e, respectively.The black disc indicates a position of the lamplighter z and that f (z) = c.
a set of elements of F 2 for which the reduced words are of the form wa ±1 or the empty word ε, and let F ′ b be a set of elements of F 2 for which the reduced words are of the form wb ±1 .Clearly, F 2 = F ′ a ∪ F ′ b .For given s ∈ F ′ a and g = (f, z) ∈ Z 2 ≀ F 2 , we denote by V s the set V s = {p ∈ F b | f (sp) = c ∨ z = sp}.Similarly, for a given t ∈ F ′ b and g = (f, z) ∈ Z 2 ≀ F 2 , we denote by H t the set H t = {p ∈ F a | f (tp) = c ∨ z = tp}.Let Σ be the alphabet consisting of ten main symbols: 0, 1, D 0 , D 1 , E 0 , E 1 , (, ), [, ] and fourteen additional symbols:

3 .
Scan this line from left to right checking for each s ∈ A whether or not V s ̸ = ∅, f (s) = c, s = z and s = e.In case V s ̸ = ∅, s ̸ = e and s ̸ = z, write the symbols D 0 or D 1 , if f (s) = e or f (s) = c, respectively.Similarly, in case V s ̸ = ∅, s = e and z ̸ = e, write the symbols D A 0 or D A 1 , in case V s ̸ = ∅, s = e and z = e, write the symbols D B 0 or D B 1 and in case V s ̸ = ∅, s = z and s ̸ = e, write the symbols D C 0 or D C 1 , if f (s) = e or f (s) = c, respectively.In case V s = ∅, s ̸ = e and s ̸ = z, write the symbols 0 or 1, if f (s) = e or f (s) = c, respectively.Similarly, in case V s = ∅, s = e and z ̸ = e, write the symbols A 0 or A 1 , in case V s = ∅, s = e and z = e, write the symbols B 0 or B 1 and in case V s = ∅, s = z and s ̸ = e, write the symbol C 0 or C 1 , if f (s) = e or f (s) = c, respectively.Finally, for the obtained bi-infinite string cut the infinite prefix and suffix consisting of 0s, so the first and the last symbols of the remained finite string are not 0. For the element of Z 2 ≀ F 2 shown in Fig. 3 the resulted string is 11D A 0 D 0 1.

Algorithm 3 . 2 (
Second iteration for Case 1).First TM a marks the left bracket symbol ( on the second tape by changing it to (.On the first tape it changes the symbol S to D 0 , D 1 , D A 0 and D A 1 if S = D C 0 , D C 1 , D B 0 and D B 1 , respectively.Then TM a proceeds as shown below.(1) TM a keeps reading a content of the first tape while on the second tape it works exactly as in Algorithm 3.1 until on the first tape a head reads the right bracket symbol ) and, at the same time, on the second tape a head reads the marked left bracket symbol (.If such situation does not occur, TM a halts after on the first tape a head reads a blank symbol ⊡. (2) On the first tape a head moves right to the next cell and on the second tape a head writes the blank symbol ⊡.Now let S ′ be the symbol that a head associated to the first tape reads.If S ′ / ∈ {0, 1, E 0 , E 1 , A 0 , A 1 , ⊡, ], ( }, TM a halts.Otherwise, depending on S ′ , TM a proceeds as follows.(a) If S

Case 2 . 2 . 3 .
respectively, and then halts.(b) If S ′ = ⊡, TM a changes it to C 0 and then halts.(c) If S ′ = (, on the second tape a head writes the marked left bracket ( and on the first tape a head moves right to the next cell.After that TM a keeps reading a content of the first tape while on the second tape it works exactly like in Algorithm 3.1 until a head associated to the first tape reads a symbol Q = D 0 , D 1 , D A 0 or D A 1 and, at the same time, a head associated to the second tape reads the marked left bracket (.If such situation does not occur, TM a halts after on the first tape a head reads a blank symbol ⊡.Finally TM a changes the symbolQ to D C 0 , D C 1 , D B 0 or D B 1 , if Q = D 0 , D 1 , D A 0 or D A 1 ,respectively, and then it halts.(d) If S ′ = ], TM a shifts a non-blank content of the first tape starting with this right bracket symbol ] by one position to the right and writes C 0 before it.Then TM a halts.Suppose S ∈ {E C 0 , E C 1 }.TM a continues working as described in Algorithm 3.3.Algorithm 3.3 (Second iteration for Case 2).On the first tape TM a changes S to E 0 and E 1 , if S = E C 0 and S = E C 1 , respectively, and moves a head right to the next cell.Let S ′ be the symbol that a head associated to the first tape reads.If S ′ / ∈ {0, 1, (, ]}, TM a halts.Otherwise, depending on S ′ , TM a proceeds as shown below.(a) If S ′ = 0 or 1, TM a changes it to C 0 or C 1 , respectively, and then halts.(b) If S ′ = (, on the second tape a head writes the marked left bracket ( and on the first tape a head moves right to the next cell.Then TM a keeps reading a content of the first tape while on the second tape it works exactly as in Algorithm 3.1 until a head associated to the first tape reads a symbol Q = D 0 or D 1 and, at the same time, a head associated to the second tape reads the marked left bracket (.If such situation does not occur, TM a halts after on the first tape a head reads a blank symbol ⊡.Finally TM a changes the symbol Q to D C 0 or D C 1 , if Q = D 0 or D 1 , respectively, and halts.(c) If S ′ = ], TM a works exactly as in the case d for the second stage of Algorithm 3.Case Suppose S ∈ {C 0 , C 1 , B 0 , B 1 }.Let P be the symbol a head associated to the second tape reads.We notice that if the input u ∈ L and S ∈ {C 0 , C 1 }, then P ∈ {(, [, ⊞}.If u ∈ L and S ∈ {B 0 , B 1 }, then P = ⊞.So if S ∈ {C 0 , C 1 } and P / ∈ {(, [, ⊞} or S ∈ {B 0 , B 1 } and P ̸ = ⊞, TM a halts.Otherwise, it continues working as described in Algorithm 3.4.Algorithm 3.4 (Second iteration for Case 3).Depending on P and S, TM a works as shown below.(a) If P = (, then TM a changes the symbol S to the substring w that is equal to [E 0 C 0 ] and [E 1 C 0 ], if S = C 0 and S = C 1 , respectively.This can be done by shifting the non-blank content of the first tape following S by three positions to the right and then wring w before it; in particular, the symbol S will be overwritten by the left bracket symbol [.(b) If P = [ and S = C 1 , TM a changes C 1 to 1 and moves a head associated to the first tape by one position to the right.Let S ′ be the symbol a head associated to the first tape reads.If S ′ / ∈ {0, 1, E 0 , E 1 , (, ]}, then TM a halts.Otherwise, it continues working as shown below. , respectively, and then it halts.• If S ′ = (, then TM a works exactly as in the case b for Algorithm 3.3.• If S ′ = ], TM a works exactly as in the case d for the second stage of Algorithm 3.2.(c) If P = [ and S = C 0 , TM a moves a head associated to the first tape by one position to the left.Let T be the symbol the head reads.Depending on T , TM a proceeds as shown below.• If T ̸ = [, TM a moves the head by one position to the right, changes C 0 to 0 and moves the head again by one position to the right.After that, depending on the symbol S ′ the head reads, it continues working exactly as in the case b of the present algorithm.• If T = [, TM a reads the two symbols following C 0 .Let S ′ and S ′′ be the first and the seconds symbols following C 0 , respectively.If S ′ ∈ {E 0 , E 1 } and S ′′ = ], then TM a changes the substring [C 0 S ′ ] to the symbol C 0 or C 1 if S ′ = E 0 or S ′ = E 1 , respectively.This can be done by shifting the non-blank content of the first tape following the substring [C 0 S ′ ] by three positions to the left and then changing the left bracket symbol [ to C 0 or C 1 if S ′ = E 0 or S ′ = E 1 , respectively.If S ′ / ∈ {E 0 , E 1 } or S ′′ ̸ = ], TM a shifts the non-blank content of the first tape following C 0 by one position to the left.Then, if S ′ ∈ {0, 1, E 0 , E 1 , (}, TM a continues working exactly as in the case b of the present algorithm and halts otherwise.(d) If P = ⊞, TM a moves a head associated to the first tape by one position to the left.Let T be the symbol the head reads.Depending on S and T , TM a proceeds as follows.If T ̸ = ⊞ or S ∈ {C 1 , B 0 , B 1 }, TM a moves the head by one position to the right, changes S to 0, 1, A 0 or A 1 , if S = C 0 , C 1 , B 0 or B 1 , respectively, and moves the head again by one position to the right.If T = ⊞ and S = C 0 , TM a shifts the non-blank content of the first tape following C 0 by one position to the left erasing C 0 and places the head over the first symbol after ⊞.Now let S ′ be a symbol the head reads.If S