Theoretical Computer Science 635 (2016) 85–93
Contents lists available at ScienceDirect
Theoretical Computer Science www.elsevier.com/locate/tcs
Conjugacy relations of prefix codes Yong He ∗ , Zhenhe Cui, Zihan Yuan School of Computer Science and Engineering, Hunan University of Science and Technology, Xiangtan 411201, Hunan, China
a r t i c l e
i n f o
Article history: Received 27 October 2014 Received in revised form 27 April 2016 Accepted 16 May 2016 Available online 18 May 2016 Communicated by J. Karhumäki Keywords: Conjugacy equation Conjugacy relation Initial part Prefix code Conjugacy problem
a b s t r a c t It is shown that, if X and Y are prefix codes and Z is a non-empty language satisfying the condition X Z = Z Y , then Z is the union of a non-empty family { P n }i ∈ I of pairwise disjoint prefix sets such that X P i = P i Y for all i ∈ I. Consequently, the conjugacy relations of prefix codes are explored and, under the restriction that both of X and Y are prefix codes, the solutions of the conjugacy equation X Z = Z Y for languages are determined. Also, the decidability of the conjugacy problem for finite prefix codes is confirmed. © 2016 Elsevier B.V. All rights reserved.
1. Introduction In the investigation of algebraic structures, equation is usually an interesting topic. On an algebraic structure G equipped with a binary operation, the commutativity equation xy = yx is always a basic equation. For any x, y ∈ G, let
C (x, y ) = { z ∈ G |xz = zy }. Then C (x, x) is exactly the centralizer of x. Therefore, the so called conjugacy equation xz = zy is an expansion of the commutativity equation. The conjugacy relation on a group induced by the conjugacy equation has played a fundamental role in the development of group theory. This motivates the consideration on the following analogous relations on an arbitrary monoid M: r
the right conjugacy relation:
∼ = {(x, y )|(∃ z ∈ M ) xz = zy , z = 0},
the left conjugacy relation:
∼ = {(x, y )|(∃ z ∈ M ) zx = yz, z = 0},
l
c
r
l
the two-sided conjugacy relation: ∼ = ∼ ∩ ∼, the transposition relation: the group conjugacy relation:
*
t
∼ = {(x, y )|(∃ w , u ∈ M ) x = wu , y = u w }, g
∼ = {(x, y )|(∃ g ∈ U ) xg = g y },
Corresponding author. E-mail addresses:
[email protected] (Y. He),
[email protected] (Z. Cui),
[email protected] (Z. Yuan).
http://dx.doi.org/10.1016/j.tcs.2016.05.021 0304-3975/© 2016 Elsevier B.V. All rights reserved.
86
Y. He et al. / Theoretical Computer Science 635 (2016) 85–93 t∗
where 0 is the possible zero element of M, and U the group of units of M. Together with the transitive closure ∼ of the t
transposition relation ∼, the relations on the monoid M defined as above are uniformly called the conjugacy relations. It is r
l
t
pointed out in [5] that the relations ∼ and ∼ are reflexive, transitive and mutually inverse, the relation ∼ is reflexive and t∗
g
c
symmetric, the relations ∼, ∼, ∼ are equivalences and, in general, g
t∗
t
c
r
l
∼ ⊆ ∼ ⊆ ∼ ⊆ ∼ ⊆ ∼, ∼ .
(1)
The conjugacy relations on free monoids and free inverse monoids have been considered in [12] and [4], respectively, while the applications of conjugacy relations in the decomposition and representation of monoids are explored in [1]. Observe that the set L( A ) of languages on an alphabet A forms a monoid with respect to concatenation. The investigation t
of the conjugacy equation and conjugacy relations on L( A ) is initiated by Perrin who considered the ∼-relation of codes t
c
r
l
[14]. It is observed that the relations ∼, ∼, ∼ and ∼ on L( A ) are pairwise distinct when A contains at least two letters [2]. The solutions of the conjugacy equation X Z = Z Y on L( A ) satisfying the following additional conditions are determined or partially determined in [2,3,7,10]: (i) (ii) (iii) (iv) (v)
| Z | = 1; Z is a biprefix code; X , Y , Z are prefix codes; | X | + |Y | ≤ 5; X , Y are finite biprefix codes (esp., uniform codes).
The aim of the present paper is to characterize the conjugacy relations of prefix codes, determine the solutions of the conjugacy equation X Z = Z Y under the restriction that X and Y are prefix codes, and then consider the conjugacy problem for finite prefix codes. The technique used in this paper is hungered by the authors of [3] when they investigated the conjugacy of finite biprefix codes. For the terminologies and notations without explanation, the reader is referred to [1,17]. 2. Preliminaries In what follows, all words and languages considered are on a given alphabet A. The free monoid, the free semigroup and the set of languages on A are denoted by A ∗ , A + and L( A ), respectively. The empty word is written as . The length of a g
word w is denoted by lg( w ). Then lg( w ) = 0 precisely when w = . The group conjugacy relations ∼ on A ∗ and L( A ) are to be out of considerations since they are trivial. The following achievement of Lentin and Schützenberger is interesting. t
t∗
c
r
l
Lemma 2.1. ([12]) On the monoid A ∗ , ∼ = ∼ = ∼ = ∼ = ∼. A non-empty word is said to be primitive if it is not a power of another word. Observe that√each non-empty word w is the power of a unique primitive word which is called the primitive root of w and denoted by w. A description for the r
relation ∼ (and hence for the other conjugacy relations) on A ∗ is given as below: r
√
r
√
√
√
Lemma 2.2. ([13]) Let x and y be two non-empty words. Then x ∼ y if and only if x ∼√ y and x = ( x)k , y = ( y )k for some √ k ∈ N+ . Moreover, if this is the case, there exists a unique pair ( p , q) ∈ A ∗ × A + such that x = pq, y = qp and C (x, y ) = ( pq)∗ p. Let L be an arbitrary language. The cardinality of L is denoted by | L |. If L is the union of a family { L i }i ∈ I of pairwise disjoint languages, then we use the notation
L=
Li .
i∈I
For each n ∈ N, denote the set of all words of length n in L by L [n] . It is clear that
L=
L [n] ,
n∈N
and hence a language K coincides with L if and only if L [n] = K [n] for all n ∈ N. For any subset I of N, put
LI =
Li .
i∈I
Then L N
= L ∗ where
L = L − L A+
∗ is the Kleene star operation on languages. The language
Y. He et al. / Theoretical Computer Science 635 (2016) 85–93
87
is called the initial part of L. Of course, L = ∅ only when L = ∅. If L is a non-empty language, then denote the length of the shortest words in L by L . It is evident that
L = L , and that the non-empty sets of the shortest words in L [L ] and L [L ] coincide, i.e.,
L [L ] = L [L ] = ∅. If u = w v in A ∗ , then w is called a prefix of u, in notation w ≤ p u. A non-empty language is called a prefix set if in which none of the words is a prefix of another one. Note that { } is the only prefix set containing the empty word . The prefix sets distinct to { } are well-known as prefix codes. A prefix code is indecomposable if it is not the concatenation of two prefix codes, and primitive if √it is not a power of another prefix code. According to the following lemma, we are reasonable to define the primitive root P of a prefix code P in the way similar to that of non-empty words. Lemma 2.3. ([14]) Every prefix code is the power of a unique primitive prefix code. Furthermore, it is observed by Karhumäki et al. [9] that the following property of rational prefix codes is an immediate consequence of Proposition 3 in Restivo [16]. Lemma 2.4. The primitive root of a rational prefix code is also rational. Denote the set of prefix sets on the alphabet A by P( A ). The properties of P( A ) given as below are to be used frequently. Lemma 2.5. ([1,17]) The set P( A ) forms a free monoid on the alphabet consisting of all indecomposable prefix codes. Moreover, the following items are true: (i) If L ∈ L( A ), then L ∈ P( A ). In particular, L ∈ P( A ) if and only if L = L. (ii) If X ∈ P( A ), then x1 z1 = x2 z2 for x1 , x2 ∈ X implies that x1 = x2 and z1 = z2 . (iii) If X , Y ∈ L( A ) such that X Y ∈ P( A ), then Y ∈ P( A ). By Lemma 2.5 and Lemma 2.1, we immediately have t
t∗
c
r
l
Corollary 2.6. On the monoid P( A ), ∼ = ∼ = ∼ = ∼ = ∼. Again by Lemma 2.5, each prefix code X may be uniquely decomposed into the concatenation of a finite number of indecomposable prefix codes. Such a decomposition of X is called the prime decomposition. By using minimal deterministic automata, Czyzowicz et al. established the following result: Lemma 2.7. ([6]) There is a linear time algorithm for finding the prime decomposition of rational (esp., finite) prefix codes. 3. Some combinatorial properties of conjugate prefix codes r
In some literatures such as [8], two non-empty languages X , Y are said to be conjugate if X ∼ Y . In this section, to explore the combinatorial properties of conjugate prefix codes, we always assume that X , Y are prefix codes and Z is a non-empty language satisfying the conjugacy equation X Z = Z Y for languages. Lemma 3.1. Z Y = X Z = X Z . Proof. It is certain that Z Y = X Z . For any x1 , x2 ∈ X and z1 , z2 ∈ Z , since X is a prefix code, it is routine to show that x1 z1 ≤ p x2 z2 if and only if x1 = x2 and z1 ≤ p z2 . Hence X Z = X Z . Lemma 3.2. There exists n ∈ N+ such that | X [i ] | = |Y [i ] | for all 0 ≤ i ≤ n. Proof. It is certain that X , Y > 0 since both of X and Y are prefix codes. Since Z [ Z ] = ∅ and
X [ X ] Z [ Z ] = ( X Z )[ X Z ] = ( Z Y )[ Z Y ] = Z [ Z ] Y [Y ] , we claim that X = Y and | X [ X ] | = |Y [Y ] |. Hence n = X satisfies the requirements.
88
Y. He et al. / Theoretical Computer Science 635 (2016) 85–93
Lemma 3.3. Let n ∈ N+ such that | X [i ] | = |Y [i ] | for all 0 ≤ i ≤ n, and let k ≤ n in N. For any x1 , x2 ∈ X , y 1 , y 2 ∈ Y and z1 , z2 ∈ Z , the following items are true: (i) If x1 z1 = x2 z2 ∈ ( X Z )[k+ Z ] , then x1 = x2 and z1 = z2 . (ii) If z1 y 1 = z2 y 2 ∈ ( Z Y )[k+ Z ] , then z1 = z2 and y 1 = y 2 . Proof. In fact, the item (i) is a specialization of Lemma 2.5 (ii). Since Z [i ] = ∅ for all 0 ≤ i < Z , it is certain that
( X Z )[k+ Z ] =
k + Z
X [i ] Z [k+ Z −i ] =
i =0
( Z Y )[k+ Z ] =
k + Z
k
X [i ] Z [k+ Z −i ] ,
(2)
Z [k+ Z −i ] Y [i ] .
(3)
i =0
Z [k+ Z −i ] Y [i ] =
i =0
k i =0
As a consequence of Equality (2) and the item (i), we can see that
|( X Z )[k+ Z ] | =
k
| X [i ] || Z [k+ Z −i ] |.
(4)
i =0
If the item (ii) is false, then there are distinct pairs ( z1 , y 1 ) and ( z2 , y 2 ) in Z × Y such that z1 y 1 = z2 y 2 ∈ ( Z Y )[k+ Z ] . Thus, following Equality (3), we have
|( Z Y )[k+ Z ] | <
k
| Z [k+ Z −i ] ||Y [i ] |.
(5)
i =0
Since X Z = Z Y and | X [i ] | = |Y [i ] | for all 0 ≤ i ≤ n, Equality (4) and Inequality (5) may lead to a paradoxical inequality:
k
i =0 | X
[i ] || Z [k+ Z −i ] |
= |( X Z )[k+ Z ] | = |( Z Y )[k+ Z ] | < ki=0 | Z [k+ Z −i ] ||Y [i ] | = ki=0 | X [i ] || Z [k+ Z −i ] |.
Therefore, the item (ii) is also true. Lemma 3.4. Let n ∈ N+ such that | X [i ] | = |Y [i ] | for all 0 ≤ i ≤ n, and let k ≤ n in N. Then the following items are equivalent: (i) ( Z Y )[k+ Z ] ⊆ ( Z Y )[k+ Z ] . (ii) ( Z Y )[k+ Z ] = ( Z Y )[k+ Z ] . (iii) ( Z Y )[k+ Z ] (( Z − Z )Y )[k+ Z ] = ∅. Proof. Since Z [i ] = ∅ for all 0 ≤ i < Z , it is certain that
( X Z )[k+ Z ] =
k + Z
X [i ] Z [k+ Z −i ] =
i =0
( Z Y )[k+ Z ] =
k + Z
k
X [i ] Z [k+ Z −i ] ,
i =0
Z [k+ Z −i ] Y [i ] =
i =0
k
Z [k+ Z −i ] Y [i ] .
i =0
By virtue of Lemma 3.3, this implies that
|( X Z )[k+ Z ] | =
k
| X [i ] || Z [k+ Z −i ] |,
|( Z Y )[k+ Z ] | =
i =0
Since | X [i ] | = |Y [i ] | for all 0 ≤ i
k
| Z [k+ Z −i ] ||Y [i ] |.
i =0
≤ n, by Lemma 3.1 and the above equalities, one may obtain the equality
|( Z Y )[k+ Z ] | = |( X Z )[k+ Z ] | = |( Z Y )[k+ Z ] |. On the other hand, the fact that Z Y ⊆ Z Y and Z = Z
Z − Z leads to the equality
(6)
Y. He et al. / Theoretical Computer Science 635 (2016) 85–93
ZY = ZY
= ZY
ZY
Z
Z−Z
89
Y
= ZY ZY Z−Z Y ZY ZY Z−Z Y , = ZY and hence
Z Y [k+ Z ] = Z Y [k+ Z ]
[k+ Z ]
ZY
Z Y [k+ Z ]
[k+ Z ]
Z−Z Y
.
Moreover, by Lemma 3.3 (ii), the above equality may be strengthened as below:
Z Y [k+ Z ] = Z Y [k+ Z ]
[k+ Z ]
ZY
Z Y [k+ Z ]
[k+ Z ]
Z−Z Y
.
(7)
Since all sets involved are finite, Equality (6) and Equality (7) are enough to illustrate that the above items (i), (ii) and (iii) are equivalent. Lemma 3.5. Let n ∈ N+ such that | X [i ] | = |Y [i ] | for all 0 ≤ i ≤ n, and let k ≤ n in N. Then ( X Z )[k+ Z ] = ( Z Y )[k+ Z ] . Proof. Otherwise, put
k0 = min k ≤ n|( X Z )[k+ Z ] = ( Z Y )[k+ Z ] . Then it follows from Lemma 3.1 that
( Z Y )[k0 + Z ] = ( X Z )[k0 + Z ] = ( Z Y )[k0 + Z ] and hence, by Lemma 3.4,
( Z Y )[k0 + Z ] ( Z Y )[k0 + Z ] . Therefore, there exists a pair ( z0 , y 0 ) ∈ ( Z , Y ) such that
z0 y 0 ∈ ( Z Y )[k0 + Z ] − ( Z Y )[k0 + Z ] . Furthermore, since X Z = Z Y , there has to exist a pair (x1 , z1 ) ∈ X × Z such that x1 z1 = z0 y 0 . And then, it is certain that
x1 z1 ∈ ( Z Y )[k0 + Z ] − ( Z Y )[k0 + Z ] = ( X Z )[k0 + Z ] − ( X Z )[k0 + Z ] . This means that z1 ∈ / Z , so that z1 = z2 p for some z2 ∈ Z and p ∈ A + . Take (z3 , y 3 ) from Z × Y such that x1 z2 = z3 y 3 and put k1 + Z = lg( z3 y 3 ). Then
z0 y 0 = x1 z1 = x1 z2 p = z3 y 3 p , and thus
k1 + Z = lg( z3 y 3 ) < lg( z0 y 0 ) = k0 + Z . Together with the fact that Z ≤ lg( z3 ), this implies that 0 ≤ k1 < k0 . Since z0 ∈ Z , the equality z0 y 0 = z3 y 3 p leads to that either z3 = z0 or z3 = z0 q for some q ∈ A + . If z3 = z0 , then y 0 = y 3 p which is contradict to the hypothesis that Y is a prefix code. If z3 = z0 q for some q ∈ A + , then z3 ∈ / Z and hence
z3 y 3 = x1 z2 ∈ ( X Z )[k1 + Z ]
(( Z − Z )Y )[k1 + Z ] .
This implies by Lemma 3.1 that
( Z Y )[k1 + Z ]
(( Z − Z )Y )[k1 + Z ] = ( X Z )[k1 + Z ]
(( Z − Z )Y )[k1 + Z ] = ∅,
and then, by Lemma 3.4,
( X Z )[k1 + Z ] = ( Z Y )[k1 + Z ] = ( Z Y )[k1 + Z ] . This is contradict to the choice of k0 . Hence ( X Z )[k+ Z ] = ( Z Y )[k+ Z ] for all k ≤ n. Lemma 3.6. | X [n] | = |Y [n] | for all n ∈ N.
90
Y. He et al. / Theoretical Computer Science 635 (2016) 85–93
Proof. Otherwise, | X [n] | = |Y [n] | for some n ∈ N. Let
N = min n ∈ N|| X [n] | = |Y [n] |
and, without loss of generality, suppose that
X [N ] < Y [N ] . Since Z [i ] = ∅ for all 0 ≤ i < Z , it is certain that
( X Z )[ N + Z ] =
N + Z
X [i ] Z [ N + Z −i ] =
i =0
( Z Y )[ N + Z ] =
N + Z
Z [ N + Z −i ] Y [i ] =
i =0
N
X [i ] Z [ N + Z −i ] ,
i =0 N
Z [ N + Z −i ] Y [i ] .
i =0
Furthermore, since | X [i ] | = |Y [i ] | for all i
|( X Z )[ N + Z ] | =
N
< N and both of X and Z are prefix sets, this implies by Lemma 2.5 (ii) that
| X [i ] || Z [ N + Z −i ] | <
i =0
N
| Z [ N + Z −i ] ||Y [i ] | = |( Z Y )[ N + Z ] |,
i =0
so that
( Z Y )[ N + Z ] ( X Z )[ N + Z ] . Since X Z = Z Y , this means that there exist ( z0 , y 0 ) ∈ Z × Y and (x1 , z1 ) ∈ X × ( Z − Z ) such that
x1 z1 = z0 y 0 ∈ ( Z Y )[ N + Z ] . Of course, z1 = z2 p for some z2 ∈ Z and p ∈ A + . Observe that x1 z2 ∈ ( X Z )[lg(x1 z2 )] and
lg(x1 z2 ) < lg(x1 z1 ) = lg( y 0 z0 ) = N + Z . As a consequence of Lemma 3.5, we claim that
( X Z )[lg(x1 z2 )] = ( Z Y )[lg(x1 z2 )] , and thus x1 z2 = z3 y 3 for some y 3 ∈ Y and z3 ∈ Z . It follows that z0 = z3 since both of z0 and z3 are elements of the prefix set Z and
z0 y 0 = x1 z1 = x1 z2 p = z3 y 3 p . This leads to the equality y 0 = y 3 p which is contradict to the hypothesis that Y is a prefix code. Consequently, | X [n] | = |Y [n] | for all n ∈ N. Let us look back upon Lemma 3.3 and Lemma 3.5. In the both lemmas, by Lemma 3.6, the n’s may be an arbitrary positive integer, and hence the k’s may be an arbitrary non-negative integer. This leads to some global properties of the pair ( X , Y ) given as below: Corollary 3.7. The following items are true: (i) For any x1 , x2 ∈ X and z1 , z2 ∈ Z , if x1 z1 = x2 z2 , then x1 = x2 and z1 = z2 . (ii) For any y 1 , y 2 ∈ Y and z1 , z2 ∈ Z , if z1 y 1 = z2 y 2 , then z1 = z2 and y 1 = y 2 . (iii) ( X Z )[n] = ( Z Y )[n] for all n ∈ N. Corollary 3.8. X Z = Z Y and X ( Z − Z ) = ( Z − Z )Y . Proof. The first equality follows from Corollary 3.7 (iii) directly. By virtue of Corollary 3.7 (i) and (ii), the second equality is a consequence of the equalities X Z = Z Y , X Z = Z Y and Z = Z ( Z − Z ).
Y. He et al. / Theoretical Computer Science 635 (2016) 85–93
91
4. Characterizations of conjugate prefix codes To achieve our aims, the following lemma is crucial. Lemma 4.1. If X and Y are prefix codes and Z is a non-empty language such that X Z = Z Y , then Z is the union of a non-empty family
{ P n }i ∈ I of pairwise disjoint prefix sets such that X P i = P i Y for all i ∈ I .
Proof. Put Z 0 = Z and P 0 = Z . For each n ∈ N+ , define the languages Z n and P n by induction as below:
Z n = Z n −1 − P n −1 ,
P n = Zn .
Then it is certain that
Z = Z0 = P0
Z1 = P0
P1
Z2 = . . . =
n
Pi
Z n +1 .
(8)
k =0
Let
I = {n ∈ N| P n = ∅}. Since Z 0 = Z = ∅, we claim that P 0 = ∅. If P n = ∅ for some n ∈ N+ , then it is evident that Z n = P n = ∅ for all m ≥ n. Thus there exists a non-negative integer n0 such that
I=
{0, 1, . . . , n0 }, if P n = ∅ for some n ∈ N+ , otherwise. N,
However, the family { P n }i ∈ I is non-empty. Moreover, by Lemma 2.5 (i) and Equality (8), the members of the family { P n }i ∈ I are pairwise disjoint prefix sets. Applying Corollary 3.8 again and again, we can see that X P i = P i Y for each i ∈ I . In the case that I = {0, 1, . . . , n0 }, it is certain that Z n0 +1 = ∅, and then Z = i ∈ I P i follows from Equality (8). Under the assumption that I = N, for any z ∈ Z , we claim that z ∈ / Z lg(z)+2 since it is evident that Z n < Z n+1 for all n ∈ N. This yields from Equality (8) that z ∈
lg(z)+1 i =0
P i . Consequently, Z ⊆
i∈ I
P n and hence Z =
i∈ I
P i also. This completes the proof.
Till now, we are able to breezily display the main theorems as below. r
Theorem 4.2. The restrictions of the conjugacy relations on L( A ) to its subset P( A ) coincide with the right conjugacy relation ∼ (and hence the other conjugacy relations) on the monoid P( A ). Proof. For any prefix codes X and Y , it follows from Lemma 4.1 that X Z = Z Y for some non-empty language Z if and only if X P = P Y for some prefix set P . Therefore, the required conclusion follows from Formula (1) and Corollary 2.6 directly. r
√
r
√
√
√
Theorem 4.3. Let X and Y be two prefix codes. Then X ∼ Y in L( A ) if and only if X ∼ Y in L( A ) and X = ( X )k , Y = ( Y )k for some k ∈ N+ . Moreover, if this is the case, there exists a unique pair ( P , Q ) consisting of a prefix set P and a prefix code Q such that
√
√
X = PQ,
Y = Q P,
C ( X , Y ) = ( P Q ) I P | ∅ = I ⊆ N .
(9)
Proof. Clearly, the first part is a consequence of Theorem 4.2, Lemma 2.5 and Lemma 2.2. To establish the second part, r
assume that X ∼ Y in L( A ) and hence in P( A ). To avoid confusion, put
C P ( X , Y ) = { P ∈ P( A )| X P = P Y } . Then it follows from Lemma 2.5 and Lemma 2.2 that there exists a unique pair ( P , Q ) consisting of a prefix set P and a prefix code Q such that
√
√
X = PQ,
Y = Q P,
C P ( X , Y ) = ( P Q )n P |n ∈ N .
Hence ( P Q ) I P ∈ C ( X , Y ) for any non-empty subset I of N since
X ( P Q )I P =
i∈I
X ( P Q )i P =
( P Q )i P Y = ( P Q ) I P Y . i∈I
Conversely, for an arbitrary language Z in C ( X , Y ), it follows from Lemma 4.1 that Z is the union of some non-empty subset { P k }k∈ K of C P ( X , Y ). Observe that, for each k ∈ K , there is ik ∈ N such that P k = ( P Q )ik P . Thereby Z = ( P Q ) I P for I = {ik |k ∈ K }. This completes the proof.
92
Y. He et al. / Theoretical Computer Science 635 (2016) 85–93
Corollary 4.4. Let X , Y be prefix codes and Z a non-empty language. Then X Z = Z Y if and only if there exist prefix sets P , Q with P Q = { }, a positive integer k and a non-empty subset I of N such that
( X , Y , Z ) = ( P Q )k , ( Q P )k , ( P Q ) I P .
(10)
Proof. If Equality (10) holds, then
X Z = ( P Q )k ( P Q ) I P = ( P Q )k+ I P = ( P Q ) I ( P Q )k P = ( P Q ) I P ( Q P )k = Z Y . r
Conversely, if X Z = Z Y , then X ∼ Y and Z ∈ C ( X , Y ). This yields from Theorem 4.3 that the triple ( X , Y , Z ) is of the type required as in Equality (10). If X and Y are conjugate non-empty languages, then it is clear that the language
C( X , Y ) =
C (X, Y )
is the maximum one in C ( X , Y ). In the literatures such as [3], the language C( X , Y ) is called the conjugator of X and Y . By Theorem 4.3, the following conclusion is immediate. Corollary 4.5. If X and Y are conjugate prefix codes, then C( X , Y ) = ( P Q )∗ P , where ( P , Q ) is the unique pair consisting of a prefix set P and a prefix code Q such that P Q and Q P are respectively the primitive roots of X and Y . Consequently, C( X , Y ) is rational if both of X and Y are finite. Let X be an arbitrary language. A language Z is said to commute with X if X Z = Z X . The maximum language commuting with X is called the centralizer of X . In fact, the centralizer of X is exactly the conjugator C( X , X ) of X and itself. In 1971, Conway raised the problem that whether the centralizer of a rational language is rational. Some authors had ever considered Conway’s problem and a negative answer was given in recent [11]. In 1989, Ratoandromanana [15] raised a related problem on commutation with codes. She proved that, if L is a non-empty language commuting with a prefix code X , then there exist a code Y , an integer j and a subset I of N such that X = Y j and L = Y I . For a completely review concerning the considerations on Conway’s problem and Ratoandromanana’s problem, the reader is referred to [9]. As a consequence of Theorem 4.3, Corollary 4.5 and Lemma 2.4, we can obtain the following extension of Ratoandromanana’s result originally given in [9]. Corollary 4.6. ([9,15]) Let X be a√prefix code. A language Z commutes with X if and only if Z = ( particular, the centralizer of X is ( X )∗ , and hence it is rational when X is rational.
√
X ) I for some subset I of N. In
Karhumäki [8] raised the so-called conjugacy problem: Are given finite languages X and Y conjugate ? At the end of the whole paper, we give a glance at such a problem. Theorem 4.7. The conjugacy problem for finite prefix codes is decidable. Proof. Let X and Y be two arbitrary finite prefix codes, and let σ be the cyclic permutation σ (i ) = i − 1 (mod n) on the sequence 1, 2, . . . , n. It follows from Lemma 2.7 that the prime decompositions of X and Y can be found in linear time. Suppose that the prime decompositions of X and Y are given as below:
X = X 1 X 2 . . . Xn ,
Y = Y 1 Y 2 . . . Ym.
If n = m and there exists some i with 0 ≤ k < n − 1 such that
Y = X σ k (1) X σ k (2) . . . X σ k (n) ,
(11)
then X = W U and Y = U W where
U = X k +1 X k +2 . . . X n , t
W = r
{ }, X 1 X 2 . . . Xk ,
if k = 0, if k = 0.
(12) r
This yields that X ∼ Y and then X ∼ Y follows from Theorem 4.2. Conversely, if X ∼ Y in L( A ), then it follows from t
Theorem 4.2 again that X ∼ Y in P( A ). That is to say, there exist prefix sets W and U such that X = W U and Y = U W . This implies by Lemma 2.5 that n = m and there exists some k with 0 ≤ k < n − 1 such that W and U are of the type (12) and hence Y is of the type (11). Summarizing the above statements, we claim that X and Y are conjugate if and only if n = m and there exists some k with 0 ≤ k < n − 1 such that Equality (11) holds. Clearly, the corresponding test can be finished in finite steps. Therefore the conjugacy problem for finite prefix codes is decidable.
Y. He et al. / Theoretical Computer Science 635 (2016) 85–93
93
Acknowledgements This work was supported by Natural Science Foundation of China (Nos. 61572013, 61272196) and Project of Science and Technology Program of Hunan Province (No. 2013FJ4047). References [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17]
Jean Berstel, Dominique Perrin, Theory of Codes, Academic Press, New York, 1985. ˇ Julien Cassaigue, Juhani Karhumäki, Ján Manuch, On conjugacy of languages, Theor. Inform. Appl. 35 (2001) 535–550. Julien Cassaigue, Juhani Karhumäki, Petri Salmela, Conjugacy of finite biprefix codes, Theoret. Comput. Sci. 410 (2009) 2345–2351. Christian Choffrut, Conjugacy in free inverse monoids, Internat. J. Algebra Comput. 03 (2) (1993) 169–188. Fabienne Chouraqui, The Knuth–Bendix algorithm and the conjugacy problem in monoids, Semigroup Forum 82 (1) (2011) 181–196. Jurek Czyzowicz, Wojciech Fraczak, Andrzej Pelc, Wojciech Rytter, Linear-time prime decomposition of regular prefix codes, Internat. J. Found. Comput. Sci. 14 (6) (2003) 1019–1031. C.C. Huang, Shyr-Shen Yu, Solutions to the language equation L B = AL, Soochow J. Math. 29 (2) (2003) 201–213. Juhani Karhumäki, Combinatorial and computational problems on finite sets of words, Lecture Notes in Comput. Sci. 2055 (2001) 69–81. Juhani Karhumäki, Michel Latteux, Ion Peter, The commutation with codes, Theoret. Comput. Sci. 340 (2005) 322–333. Benny G. Kenkireth, Samrith Ram, Towards decidability of conjugacy of pairs and triples, Lecture Notes in Artificial Intelligence 5378 (2009) 224–231. Michal Kunc, The power of commuting with finite sets of words, Theory Comput. Syst. 40 (2007) 521–551. André Lentin, Marcel-Paul Schützenberger, A combinatorial problem in the theory of free monoids, in: Combinatorial Mathematics and Its Applications, Univ. North Carolina Press, Chapel Hill, N.C, 1969, pp. 128–144. M. Lothaire, Combinatorics on Words, Cambridge University Press, Cambridge, 1983. Dominique Perrin, Codes conjugues, Inf. Control 20 (1972) 222–231. Bodonirina Ratoandromanana, Codes et motifs, RAIRO Inform. Theor. 23 (4) (1989) 425–444. A. Restivo, Some decision results for recognizable sets in arbitrary monoids, Lecture Notes in Comput. Sci. 62 (1978) 363–371. Shyr-Shen Yu, Languages and Codes, Tsang Hai Book Pub. Co., Taichung, 2005.