PII. S0161171202011729 http://ijmms.hindawi.com © Hindawi Publishing Corp.
NOTE ON DECIPHERABILITY OF THREE-WORD CODES
F. BLANCHET-SADRI and T. HOWELL
Received 29 January 2001
The theory of uniquely decipherable (UD) codes has been widely developed in connection with automata theory, combinatorics on words, formal languages, and monoid theory. Recently, the concepts of multiset decipherable (MSD) and set decipherable (SD) codes were developed to handle some special problems in the transmission of information. Unique decipherability is a vital requirement in a wide range of coding applications where distinct sequences of code words carry different information. However, in several applications, it is necessary or desirable to communicate a description of a sequence of events where the information of interest is the set of possible events, including multiplicity, but where the order of occurrences is irrelevant. Suitable codes for these communication purposes need not possess the UD property, but the weaker MSD property. In other applications, the information of interest may be the presence or absence of possible events. The SD property is adequate for such codes. Lempel (1986) showed that the UD and MSD properties coincide for two-word codes and conjectured that every three-word MSD code is a UD code. Guzmán (1995) showed that the UD, MSD, and SD properties coincide for two-word codes and conjectured that these properties coincide for three-word codes. In an earlier paper (2001), Blanchet-Sadri answered both conjectures positively for all three-word codes
{c1,c2,c3}satisfying|c1| = |c2| ≤ |c3|. In this note, we answer both conjectures positively for other special three-word codes. Our procedures are based on techniques related to dominoes.
2000 Mathematics Subject Classification: 94A15, 05A99, 94B35.
1. Introduction. LetAbe a nonempty finite set or an alphabet;A∗denotes the set of all sequences of finite length (greater than or equal to 0) of elements ofA(such sequences are called words onA). The unique sequence of length 0, denoted by, is called the empty word.AcodeConAis a nonempty finite subset ofA+=A∗\ {}. The words inC are called code words. Amessage onC is a word inA∗ that is a concatenation of code words. The sequence of these code words is a decoding or factorizationof the message. The codeCis called
• uniquely decipherable, if every message onC has a unique factorization into code words;
• multiset decipherable, if any two factorizations of the same message onCyield the same multiset of code words;
• set decipherable, if any two factorizations of the same message onCyield the same set of code words.
Every UD code is MSD, and every MSD code is SD. It has been shown that these rela-tionships are proper. The codeC= {0,0111110,10101,1111}on{0,1}is an example of aproperMSD code (i.e., an MSD code that is not UD). In fact, the message
onChas two distinct factorizations into code words [3,5]. The code
C= {0,010,11011,101101} (1.2)
on{0,1}is an example of a proper SD code (i.e., an SD code that is not MSD). The message
(0)(101101)(11011)(0)(11011)(010)=(010)(11011)(101101)(101101)(0) (1.3)
on C has two distinct factorizations with distinct multisets of code words [3, 5]. Guzmán presents a complete list of proper MSD and proper SD four-word codes on
{0,1}with code words of length less than or equal to 7 [3]. It is decidable whether or not a codeCis UD [1,5,6,9] (resp., MSD [5]).
For two-word codes, the UD, MSD, and SD properties coincide [3,7]. For three-word codes, it is an open question whether or not they coincide. Lempel [7] conjectured that every three-word MSD code is a UD code, and Guzmán [3] conjectured that the UD, MSD, and SD properties coincide for three-word codes. We answered both conjectures positively for all three-word codes{c1,c2,c3}satisfying|c1| = |c2| ≤ |c3|[2]. In this
note, we give (inSection 1.1) a brief overview of Head’s and Weber’s domino technique [5], and give (inSection 2) an application of this approach by proving that Lempel’s and Guzmán’s conjectures are true for some special three-word codes.
1.1. A domino technique. LetAbe an alphabet andC a code onA. The set of all prefixes of words inCwill be denoted by Prefix(C). Thedomino graphassociated with
Cis the directed graphG=(V ,E)where
V=
open, close,
u
,
u
u∈Prefix(C)\{}
, (1.4)
andE=E1∪E2∪E3∪E4where
E1=
open,
u
,
open,
u
u∈C
,
E2=
u
,close
,
u
,close
u∈C
,
E3=
u
,
uv
,
u
,
uv
v∈C
,
E4=
u
,
v
,
u
,
v
uv∈C
.
(1.5)
Thedomino functionassociated withCis the mappingdfromEtou,u
|u∈C
defined on
• E1by
open,u u
andopen,uu
,
• E2by
u
, closeu
andu, close u
,
• E3by
u
,uv
v
andu,uv
v
,
• E4by
u
,v
uv
andu,v
uv
Thedomino associated with an edgeeofE is the dominod(e)=d1(e) d2(e)
. The func-tiondinduces mappingsd1andd2fromE toC∪ {}also called domino functions.
If p= e1···em is a path in G, the word d(e1)···d(em) (resp., d1(e1)···d1(em), d2(e1)···d2(em)) will be denoted byd(p)(resp.,d1(p),d2(p)).
A pathpinGfromopento some vertexu, respectively,u, is trying to find two factorizations of the same message onCinto code words beginning with distinct code words. The decodings obtained so far ared1(p)andd2(p). The worduinA∗denotes
the backlog of the first (resp., second) decoding as against the second (resp., first) one. Guzmán [4] suggested to look at thesimplified domino graphand thedomino func-tionofC. The simplified domino graph ofCis a subgraph of the domino graph ofC. ReplaceE1byE1=
open,u|u∈C ,E2byE2=
u
,close|u∈C ,V byV
which consists of open, close, and those verticesvinVsuch that there is a path from open to close that goes throughv, andE byEwhich consists of those edgeseinE
such that there is a path from open to close going throughe. The simplified domino graph ofCis denoted byG(C).
The UD, MSD, and SD properties of a codeCcan be characterized in terms of its simplified domino graphG(C)and functionsd1andd2,
•Cis not UD if and only if there is a path inG(C)from open to close [6].
•Cis not MSD if and only if there is a pathpinG(C)from open to close such that
d1(p)andd2(p)do not have the same multiset of code words [5].
•C is not SD if and only if there is a pathpinG(C)from open to close such that
d1(p)andd2(p)do not have the same set of code words [3].
As an example, we consider the codec= {c1,c2,c3,c4}on{0,1}discussed in [5,4]
(c1=0,c2=0111110,c3=10101,andc4=1111). The simplified domino graph and
function associated with this code are shown inFigure 1.1.
111
( c4)
open (
c1
)
0
(c4
) 01111
( c2) 10
(c3
)
1
( c1)
(c4
)
close
0111110
(c2
) 011111
(c2
) (
c1) 01
(
c4)
101
(c1
) (
c3)
1010
( c3)
Figure1.1
Each edgeeis labeled byd(e). The path
p=open,
0
,
01111
,
10
,
101
,
01
,
011111
,
0111110
,close (1.6)
is from open to close showing thatCis not UD. However, every pathpfrom open to close is such thatd1(p)and d2(p)have the same multiset of code words showing
1.2. Preliminary lemmas. We give some preliminary lemmas that are used in
Section 2to prove our main results.
Definition1.1(see Lothaire [8]). A nonempty worduon an alphabetAis called primitive, ifu=vnfor some nonempty wordvonAimplies thatn=1.
Lemma1.2(see Lothaire [8]). Letube a nonempty word on an alphabetA. There exist a unique primitive wordvand a unique positive integernsuch thatu=vn(v,
denoted by√u, is called the root ofuandn, denoted byexp(u), is called the exponent ofu). Moreover, all positive powers ofuhave the same root.
Lemma1.3(see Lothaire [8]). LetC= {u,v}be a two-word on an alphabet A. The
UD,MSD, andSDproperties are equivalent to the following properties: (1)uv≠vu.
(2)√u≠√v.
Lemma1.4(see Blanchet-Sadri [2]). Letu,xbe nonempty words on an alphabetA and letkbe a positive integer. If{ux,(ux)ku}isSD, thenux≠xu.
Lemma1.5. Letu,v,x,ybe nonempty words on an alphabetAsatisfyingu≠v.
(1)The equalitiesvyx=yxu=xuycannot hold simultaneously. (2)The equalitiesxvy=vyx=yxucannot hold simultaneously.
Proof. We prove assertion (1) (assertion (2) is proved similarly). Sinceyxu=xuy,
by Lemmas1.2 and1.3 there exist a unique primitive wordw and unique positive integerskandksuch thaty=wkandxu=wk. Putx=wzandu=zw where wis not a prefix ofzandwis not a suffix ofz. Ifz,z=, thenu=v, a contradiction. Otherwise,z,z≠and the equalityvyx=xuyimplies thatw=zz=zz. Lemmas
1.2and 1.3imply the existence of a unique primitive wordwand unique positive integersm andm satisfyingz=(w)m and z=(w)m. We getw=(w)m+m, a
contradiction with the fact thatwis primitive.
Lemma1.6. Letu,v,x,ybe nonempty words on an alphabetAsatisfyingu≠v. If the equalitiesvyx=yxv=yuxhold simultaneously, thenu=(zz)k,v=(zz)k, x=(zz)z, andy=(zz)mzfor somek >0,≥0,m≥0, and wordsz,zon A.
Proof. Sincevyx=yxv, by Lemmas1.2and1.3there exist a unique primitive
wordwand unique positive integerskandksuch thatv=wkandyx=wk. Put y=wzand x=zw wherew is not a prefix ofzand wis not a suffix ofz. If
z,z=, thenu=v, a contradiction. Otherwise,z,z≠andw=zz, and the equality
yxv=yuximplies thatu=(zz)kand the result follows.
Lemma1.7(see Blanchet-Sadri [2]). Letu,v,xbe nonempty words on an alphabet A satisfyingu≠v. The equalitiesux=xvandvx=xucannot hold simultaneously.
2. Some special three-word codes. We show that the UD, MSD, and SD properties are equivalent to the special three-word codes described in Theorems 2.1,2.2, and
2.3.
of u, c1 is not a prefix of v,u is not a prefix of v, k >0, andu,v ≠. For each
of our theorems, we need only to show thatC is UD. It is easy to see that{c1,c2}, {c1,c3},and{c2,c3}are two-word SD codes, and are therefore MSD and UD codes by Lemma 1.3. When constructingG(C), we see thatE1consists of the edges
open,c
i
andE2 consists of the edges
ci
,close. NoE3- norE4-edge leaves
c2
and noE3
-norE4-edge leaves
c3
.
Letui(resp.,vi,wi) be the prefix of lengthiofc1(resp.,c2,c3). We writec1=uixi.
When trying to build a path from open to close, a list of vertices gets generated. The vertices are amongui
,vi
,wi
,u
i
,v
i
, andw
i
where 0< i≤ |c3|. TheE3- or E4-edges leaving
u
i
,vi
,wi
,u
i
,v
i
, andw
i
are easily described.
We need to check that none of the generated vertices is of the formc1
,c2
, orc3
(otherwise there would be a path from open to close). It is obvious thatc1
is not the
end vertex of anyE3-edge and
c3
is not the end vertex of anyE4-edge. If
c1
is the
end vertex of anE4-edge of the form
ui
,c1
(resp.,v
i
,c1
,w
i
,c1
), then
c2=uic1orc3=uic1(resp.,c2=vic1orc3=vic1,c2=wic1orc3=wic1). Similarly, if
c2
is the end vertex of anE4-edge of the form
ui
,c2
, respectively,v
i
,c2
, wi
,c2
, thenc3=uic2 (resp.,c3=vic2,c3=wic2). If
c2
is the end vertex of
anE3-edge of the form
ui
,uic1
, respectively,vi
,vic1
,wi
,wic1
, then
c2=uic1(resp.,c2=vic1,c2=wic1). If
c3
is the end vertex of anE3-edge of the form
ui
,uic1
(resp.,vi
,vic1
, wi
,wic1
,ui
,uic2
, vi
,vic2
,wi
,
wic2
), thenc3=uic1(resp.,c3=vic1, c3=wic1, c3=uic2, c3=vic2, c3=wic2).
We need to consider the casesc2=vic1,c3=wic1, andc3=wic2.
For the rest of the discussion, we can assume thatuorvis a prefix ofc1(otherwise,
it is not difficult to see that there is no path inG(C)fromopentoclose). Sinceuis not a prefix of v and |u|<|v|, u and v cannot be both prefixes ofc1. In either
case,|u|<|c1|. To simplify the notation, putx|u|=x, and whenever|v|<|c1|, put x|v|=y.
First, assume thatv is a prefix ofc1. Here,y≠andvy≠yvbyLemma 1.4. To
simplify the notation, putu|u|=w. in the case wherec3=wic1, sincei= |c1k−1v|,
we havewi=c1k−1v and c3=c1k−1vc1=ck1v yieldingvy=yv, a contradiction. In
the case where c3=wic2, we have i= |v| − |u|, wi= ui, c3 =uic1ku=ck1v, and c1=uixi=vy. Putv =uitwheret≠. The equalityuick1u=ck1uitimplies that t=uanduixi=xiui. But then,c1=uixi=uiuy=uyui. We then conclude that u is a prefix ofc1, which is a contradiction. In the case where c2=vic1, we have i= |ck−1
1 u|. Ify∈Prefix(C)\{}, we getFigure 2.1.
Otherwise, putvy=yv wherev≠v (v∈Prefix(C)\ {}). Ifuis not a prefix ofv, then add the edgev,y
toFigure 2.1. Otherwise, putv=uswheres≠. We havevi=c1k−1w,c2=c1k−1wc1=c1ku, and thereforec1=wx=xu=vy. We have v=wtwheret≠, and thereforewty=tyu=yuswithu≠w. ByLemma 1.5(1), we gets≠t. Since|s| = |t|, we conclude thats∈Prefix(C)\{}. Add the edgesv,y
andck1−1v
c1k−1v
ck1−2v
c1v
v
open
c1
c21
···
ck1−1
c1k
Figure2.1
In the rest of the note, we assume thatuis a prefix ofc1. Here,x≠andux≠xuby Lemma 1.4. In the case wherec2=vic1, we havevi=c1k−1uandc2=c1k−1uc1=ck1u.
We conclude thatux=xu, a contradiction. In the cases wherec3=wic1orc3=wic2,
ifx∈Prefix(C)\{}, we getFigure 2.2.
ck1−1u
ck1−2u
c1u
u
open
c1
c21
···
ck1−1
ck1
Figure2.2
Otherwise, putux=xuwhereu≠u (u∈Prefix(C)\ {}). Ifu is not a prefix ofv, then add the edgeu,xtoFigure 2.2. Otherwise, putv=ucq1zwherec1
is not a prefix ofzandq≥0. Note that ifz=, thenc3=c1kuc q
1=c1k−1uc q+1 1 and
soc2cq+ 1
1 =c1c3, a contradiction with the fact thatC is SD. Note also that if q≥k
and z=u, thenc1c3=c2cq1−kc2c1, a contradiction with the fact thatC is SD. It is
not difficult to see thatc1iz∈Prefix(C)\{}(0≤i < k)unlesszis a prefix ofc1, and c1kz∈Prefix(C)\ {}only ifzis a prefix ofuorv. Wheneverzis a prefix ofc1, put x|z|=x1and wheneverzis a prefix ofu, putc2=ck1zc
p
1 ywherep≥0 andc1is
not a prefix ofy. In the case wherezis a prefix ofv, putc3=ck1zc q
1zwhereq≥0
andc1is not a prefix ofz.
The following points enable us to assume that|z|<|u| and z is a prefix of u
wheneverzis a prefix ofc1andc3=wic1:
• if|z| = |u|, thenz=u=u, a contradiction;
• if|z|>|u|, then putz=ut=tufore somet,t≠. Here,c1=utx1=tx1u= tux1implies thatt=t. We also havex=tx1=x1tandc1=ux1t=x1tu= tux1. These equalities cannot hold simultaneously byLemma 1.5(1).
Ifc3=wic2and|z| = |u|, we havez=uandzis not a prefix ofv. In this case, if q < k−1,u=u, a contradiction, and ifq≥k−1,Cis not SD(c1c3=c2cq1−k+1c2). The
above and the following points enable us to assume that|z|<|u|,zis a prefix ofu, andq > k−1 wheneverzis a prefix ofc1andc3=wic2:
• if|z|<|u|, then putu=zt=tzfor somet,t≠, and putu=zt. In this case, ifq < k, thenck1uc
q 1z=c
q
1zck1uandc1=ztx=txz=xztwitht=t.
These equalities cannot hold simultaneously byLemma 1.5(1).
Trying to build a path fromopentoclose, addu,xandFigure 2.3toFigure 2.2.
ck1−1u
ck1u
ck1uc1
··· c1kucq− 1 1
c1kuc1q
Figure2.3
The edgeck1−1u
,c1k−1uc2
is added in caseq > k−1, orq=k−1,uis a proper
prefix ofz, andzis not a prefix ofv. The edgeck1uci1
,ck1uci1c2
is added in case
0≤i < q−k. The edge c1kuc1q−k
,c1kuc1q−kc2
is added in case q > k−1, u is a
proper prefix ofz, andzis not a prefix ofv. The edgec1k−1u
,cq+1 1 z
is added in caseq < k−1 andzis a prefix ofu, orq=k−1 andzis a prefix ofuorv. The edge
c1kucq1−k
,ck
1z
is added in caseq > k−1 andzis a prefix ofuorv. Ifi≥0 and
q−k < i≤q, the edgeck1uci1
,cq−i
1 z
is added in casezis a prefix ofu. Note that
noE3- norE4-edge leaves
x
, and noE3- norE4-edge leaves the vertices inFigure 2.3
other than the edges discussed above.
In the rest of the discussion, wheneveruis a proper prefix ofz, we putz=urwhere
r≠andx is not a prefix ofr, and wheneveruis a prefix ofz, we putz=ur. It is not difficult to see thatr∈Prefix(C)\{}(otherwise,ur=zis a prefix ofux=c1
and thereforezis a prefix ofu, a contradiction). Note the following points:
•NoE3-edge leaves
ck1−1uc2
unlessq=kanduis a prefix ofz. NoE4-edge leaves
c1k−1uc2
other thanc1k−1uc2
,xzin caseq=kandxz∈Prefix(C)\{}.
•NoE3- norE4-edges leave
ck1uc1ic2
(0≤i < q−k−1).
•Forq > kandi=q−k−1, noE3-edge leaves
ck
1uc1ic2
unlessuis a prefix ofz, and
noE4-edge leaves
c1kuc1ic2
other thanck1uci1c2
,xz
in casexz∈Prefix(C)\{}.
•NoE3- norE4-edges leave
ck
1uc1q−kc2
. We now state and prove our main results.
Theorem2.1. LetC,u,v, andzbe defined as described above. Ifzis a prefix of bothuandv, thenCisUD.
Proof. Here|z|<|u|. Put u=ztand u=ztwheret,t≠ andt≠t. First,
assume that c3=wic1. Hereu=tz and c1=ztx= xzt=xtz=zxt =txz.
Theorem2.2. LetC,u,v, andzbe defined as described above. Ifzis a prefix ofu but not a prefix ofv, thenCisUD.
Proof. Here,|z|<|u|. Putu=ztandu=zt, wherez≠z andt,t≠. We
havexz∈Prefix(C)\{}sincec1=xztandz≠z.
First, assume thatc3=wic1. Hereu=tzandc1=ztx=zxt=txz=xzt= xtz. If t=t, thenzxt=xtz=xzt. ByLemma 1.6,z=(ss), z=(ss),t= (ss)ms,x=(ss)nsfor some >0,m≥0,n≥0, and wordss,sonA. The equality
txz=xtzimplies that ss=ss, and therefore z=z, a contradiction. Otherwise, since|t|<|u|andc1=txz, we getu=tzfor somez. We havezx=xz and zx=xz. Certainlyz≠z, and byLemma 1.7,z≠z. ByLemma 1.6, sinceztx= txz=tzx, putz=(ss),z=(ss),x=(ss)ms, andt=(ss)nsfor some >0, m≥0,n≥0, and wordss,sonA. Wheneverm >0, the equalityztx=xztimplies thatss=ssandz=z, a contradiction. Otherwise,xis a prefix ofzand we put
z=xy andz=yx, wherey=(ss)−1s. Hereycannot be a prefix ofz or the equalityxzt=zxtimplies thatz=z. Trying to build a path fromopentoclose, the edgeu,x
together withFigure 2.3are added toFigure 2.2. We now discuss the other edges added.
First, assume thatq≤k. Wheneverq < k, addck1−1u
,cq+1 1 z
to the graph and
wheneverq=k, add c1k−1u
,ck1−1uc2
. In either case, we then also addck1uci1
,
c1q−iz
(0≤i≤q),ci
1z
,ci+1 1 z
(0≤i < k),z,tx,tx,z,ci
1z
,ck1−it
(0≤i≤k),c1itx
,ci1+1tx
(0≤i < k), andci1tx
,ck−i
1 y
(0≤i≤k).
Second, assume thatq > k. Addc1k−1u
,c1k−1uc2
, c1kuc1i
,c1kuc1ic2
(0≤i <
q−k), andck1uci1
,cq−i
1 z
(q−k≤i≤q). Also add ci
1z
,ci+1 1 z
(0≤i < k),
z
,tx
, tx,z
,ci
1z
,c1k−it
(0≤i≤k),ci1tx
,c1i+1tx
(0≤i < k), and
c1itx
,ck−i
1 y
(0≤i≤k).
Now, assume thatc3=wic2. Hereu=tzandc1=ztx=tzx=zxt=xzt= txz. Ift=t, thenztx=txz =xztand these equalities cannot hold simulta-neously byLemma 1.5(1). Otherwise,t≠tand t∈Prefix(C)\ {}. trying to build a path fromopen toclose, the edgeu,x
together withFigure 2.3 are added to
Figure 2.2. We now discuss the other edges added. First, assume thatq=k. Addck1−1u
,c1k−1uc2
andc1kuc1i
,cq−i
1 z
(0≤i≤q).
Second, assume thatq > k. Addc1k−1u
,c1k−1uc2
, c1kuc1i
,c1kuc1ic2
(0≤i <
q−k), andck1uc1i
,cq−i
1 z
(q−k≤i≤q).
Theorem2.3. LetC,u,v, andzbe defined as described above. Ifzis a prefix ofv but not a prefix ofu, thenCisUD.
Proof. Herec3=ck1uc1qz=c1kzcq
1zand|cq
1z| = |cq1u|. The latter and the fact
that|u|<|c1|imply thatq≥q. Note thatuis not a prefix ofz,uis a suffix ofzin
casec3=wic1, anduis a suffix ofzin casec3=wic2. Trying to build a path from
First, assume thatq < k−1. In this case, no more edges are added. Second, assume thatq=k−1. We have|c1qz| = |ck1−1u|and add
ck−1 1 u
,ck
1z
along with
ck1z
c1kzc1
···
ck1zcq− 1 1
c1kzcq
1
Figure2.4
In case c3=wic2, we have cq
1 z=c1k−1u (q=k−1 andz=u) and also add
c1kzc1q−i
,ci1u
(0≤i < k).
Third, assume thatq=kandc3=wic2. We havecq
1z=ck1u(q=kandz=u) and |z|≠|u|here. If|z|<|u|, thenu=ztandu=tzfor somet≠. The latter together with the equalityc1kuc1kz=c1kzc1kuyield thatc1=tzx=xzt=zxtand thereforez
is a prefix ofu, a contradiction. If|z|>|u|, putz=uc1pt=tuwheret≠andc1
is not a prefix oftnort. To simplify the notation, whenever|t|<|c1|, putx|t|=x. From the equalityck
1uc1kz=ck1zc1ku, it follows thatc1kuc p 1t=c
p 1tc1ku. •Ifp > k, we contradict the fact thatc1is not a prefix ofz.
•Ifp < k, then|t|<|c1|or we contradict the fact thatc1is not a prefix oft(t
is a prefix ofc1here). If|t|<|u|, putu=tr1=r1tand u=tr1. We then have c1=tr1x=r1tx=xtr1=r1xt andr1=r1. Thent≠t and we havetr1x= r1xt=xtr1, which cannot hold simultaneously byLemma 1.5(1). If|t| = |u|, then t=uand, whenk−p=1,C is not SD(c1c3=c23). Whenk−p >1, we getu=u,
a contradiction. So we have|t|>|u|and putt=ur1=r
1u. Then c1=ur1x= r1ux=r1xu=xur1andr1=r1. Consequently,ur1x=r1xu=xur1, which
cannot hold simultaneously byLemma 1.5(1).
•Ifp=kthen from the equalityc1kuc1pt=c1ptc1kuit follows thatuc1kt=tck1u.
Here, clearly|t|≠|u|. If|t|<|u|, putu=tr
1andu=r1t=tr1where|t| = |t|.
This then yields thatc1=r1tx=tr1x=xtr1=txr1 and t=t. So we have r1≠r1andr1tx=txr1=tr1x. UsingLemma 1.6and the fact thattxr1=xtr1,
we conclude thatu=u, a contradiction. Thus|t|>|u|and putt=ucp1
1 t1=t1ufor
somet1andt1wheret1≠andc1is not a prefix oft1nort1. From the equalityuc1kt= tck1u, it follows thatc1kuc1p1t1=c1p1t1ck1uand we continue as above, comparingp1
tok. Sincec3is finite, we must reachti=ucp1i+1ti+1=ti+1uwhereti+1≠andc1
is not a prefix ofti+1norti+1, and consequently we get the equalityc1kuc pi+1 1 ti+1= cpi+1
1 ti+1c1ku. Then we havepi+1> k,pi+1< k, orpi+1=k, and|ti+1| ≤ |u|. In all cases
we reach the same types of contradictions as previously stated. Fourth, assume thatq > k and c3=wic2. Since |c1qu| =c
q
1z, it follows thatc2
is a suffix ofcq1zand we putc3=c1kuc q
1z=ck1zc q
1z=c1kzsck1uwhere|s| = |c q−k 1 |.
putz=uc1pt=tuwheret≠andc1is not a prefix oftnort. To simplify the
nota-tion, whenever|t|<|c
1|, putx|t|=x. From the equalityc1kuc q
1z=c1kzsc1ku, it
fol-lows thatc1quc p 1t=c
p
1tsc1ku. Add
c1k−1u
,c1k−1uc2
,c1kucq
−k
1
,ck
1z
,Figure 2.4,
and c1kuc1i
,ck1uci1c2
(0 ≤i < q−k) along with c1kucq
−k−1 1 c2
,c1kucq1u
and
Figure 2.5:
ck1ucq1u
c1kuc1quc1
··· ck1uc1quc1p−1
c1kuc1quc1p
Figure2.5
•Ifp > q, then we contradict the fact thatc1is not a prefix ofz.
•Ifp < q, then|t|<|c1|or we contradict the fact thatc1is not a prefix oft(tis a prefix ofc1here). If|t|>|u|, putt=ur1=r1u. Thenc1=ur1x=r1ux=r1xu= xur1 andr1=r1. Sour1x=r1xu=xur1, which cannot hold simultaneously
byLemma 1.5(1). If|t| = |u|, thent=uand it follows from the equalitycq 1uc
p 1u= c1pusc1kuthatc
q−p 1 uc
p
1 =usc1k. Here ifk−p >1, we getu=u, a contradiction. If k−p≤1 thenC is not SD(c1c3=c2c1q−kc2c1p−k+1c2). If |t|<|u|, put u=tr1= r1t and u=tr1. We then havec1=tr1x =r1tx=xtr1=txr1 =r1xt. In
casek > p, from the equalityc1quc p 1t=c
p
1tsc1ku, it follows thatc q−p
1 t=tsc k−p 1 .
Consequently, we also havec1=r1xtandr1=r1. Thent≠tandtr1x=r1xt= xtr1, which cannot hold simultaneously byLemma 1.5(1). So we havep≥k,r1≠r1,
and xz=c1p+1t∈Prefix(C)\ {}. Note that q=0 here or we haver1=r1. Also, xt∈Prefix(C)\ {}or we gett=t, which leads to a contradiction byLemma 1.6.
Add
c1kuc q 1uc
p−i 1
,
ci
1t
(0≤i≤k)along with
c1kuc q 1uc1i
,
c1kuc q 1uc1ic2
(0≤i < p−k)
(2.1)
andck1ucq−k− 1 1 c2
,c1kuc1quck1−1u
.
•Ifp=q, from the equalityc1quc p 1t=c
p
1tsck1u, it follows thatuc q
1t=tsck1u.
Clearly,|t|≠|u|, and if|t|<|u|,then putu=tr1andu=r1t=tr
1where|t| = |t|. We then haver1tx=tr
1x=xtr1=txr1andt=t. Consequently,r1≠r1
and we getr1tx=txr1=tr1x. UsingLemma 1.6and the fact thatxtr1=txr1,
we reach a contradiction with the fact thatu≠u. So we have|t|>|u| and put
t=ucp1
1 t1=t1u, wheret1≠andc1is not a prefix oft1nort1. From the equality uc1qt =tsc1ku, it follows thatc
q 1uc
p1
1 t1=c p1
1 t1sc1ku and we continue as above,
comparingp1withq. Sincec3is finite, we must reach the equalityti=uc1pi+1ti+1= ti+1uwhereti+1≠andc1is not a prefix ofti+1norti+1, and consequently we get
the equalityc1quc pi+1
1 ti+1=c pi+1
1 ti+1sc1ku. Then one of the following must occur:
(1) pi+1> q, thus yielding the same type of contradiction as above;
(3) pi+1< q,|ti+1|<|u|, andpi+1< k, thus yielding the same type of contradiction
as above;
(4) pi+1< q,|ti+1|<|u|, andpi+1≥k, in which case we add
c1ku
c1qu
i+2 cpi+1−j
1
,
c1jti+1
(0≤j≤k),
c1ku
c1qu
i+2 cj1
,
c1ku
c1qu
i+2 cj1c2
0≤j < pi+1−k
,
ck1u
cq1u
i+1
c1q−k−1c2
,
ck1u
c1qu
i+2 c1k−1u
;
(2.2)
(5) pi+1=qand|ti+1| ≤ |u|, thus yielding the same types of contradiction as above.
Last, assume that q ≥ k and c3 = wic1. In this case, add
c1k−1u
,ck1−1uc2
, ck
1ucq1−k
,ck
1z
, andFigure 2.4. Also, add the edgesc1kuc1i
,c1kuci1c2
(0≤i < q−k).
If|z|<|u|putu=zt=tzandu=ztwhere|t| = |t|,z≠z, andt,t≠. Then we havec1=xzt=xtz=ztx=txz. Here, ift=twe have the equalities ztx =txz=xzt, which cannot hold by Lemma 1.5(1). So t≠t and we add ck−1
1 uc2
,xzwheneverq=kandck1ucq−k− 1 1 c2
,xzwheneverq > k. Note that hereq=0 nor we contradict the fact thatt≠t.
If|z| = |u|thenz=uandCis not SD(c1c3=c2cq1−kc2c1).
If |z|>|u| putz=ucp1t=tu wherec1 is not a prefix of t or t, andt≠
(otherwise,c1c3=c1ck1uc q 1uc
p
1 =c2c1q−kc2cp+ 1
1 ). To simplify the notation, whenever |t|<|c
1|, putx|t|=x. Then we havec3=ck1uc q
1z=c1kzc q
1 z=c1kzsc1, where|s| = |cq−1
1 u|and it follows thatc q 1uc
p 1t=c
p
1tsc1. Here, we add
ck1−1uc2
,ck1ucq1u
if
q=k, andck1ucq
−k−1 1 c2
,c1kuc1qu
ifq > k. In either case, also addFigure 2.5.
•Ifp > q, then we contradict the fact thatc1is not a prefix ofz.
• If p < q, then |t|< |c1| or we contradict the fact that c1 is not a prefix of
t(tis a prefix ofc1here). Clearly,|t|≠|u|or we contradict the fact that u≠u.
If|t|>|u|, putt=ur1=r
1uandc1=ur1x=r1ux=r1xu=xr1u=uxr1.
Thenuxr1=xr1u=r1ux, which cannot hold simultaneously byLemma 1.5(1).
If |t|<|u|, putu=tr
1=r1t and u=r1t=tr1 where|t| = |t|. Then we
have c1= tr1x =xr1t =txr1 =r1xt= xtr1 =r1tx and r1=r1. Here, if t=t, thenr1≠r1and we havetr1x=r1xt=xtr1, which cannot hold
simultane-ously byLemma 1.5(2). So we assume thatt≠t; and ifr1=r1, then the equalities txr1=xr1t=xtr1together withLemma 1.6and the fact thatxr1t=r1xtyield
a contradiction with the fact thatu≠u. Also, ift=t thenxt=tx=xt and
t=t, a contradiction. So we havet≠t,t≠t,r1≠r1, andxz=c p+1
1 t. Here,
note thatq≤q−p−1 or we contradict the fact thatt≠t. Thus|z| = |cq−q
In the case whereq=k, we add
ck−1 1 uc2
, xz , ck 1uc
q 1uci1
,
cp1−it
(0≤i≤p). (2.3)
In the case whereq > kandp < k, addck1ucq−k− 1 1 c2
,xz
with (2.3). The edge
ck
1zc1i
,
ck
1zc1ic2
(2.4)
is added in case 0≤i < q−k, ori=q−kanduis a prefix ofz.
In the case where q > k and p ≥ k, in addition to (2.1) and ck1ucq−k− 1 1 c2
,
c1kuc1quck1−1u
, add c1kucq1ucp1−i
,ci
1t
(0≤i≤k). Also, (2.4) is added in case 0≤i < q−k, ori=q−kanduis a prefix ofz.
In all cases, also addci
1t
,ci+1 1 t
(0≤i < k)andci
1t
,c1k−ir1
(0≤i≤k)
as well as t
,r1x
, r1x
,t
, and c1ir1x
,ci1+1r1x
(0≤ i < k−1). In the case where|t|>|x|, putt=xsand t=sx=xs. It follows from the equality
txr1=xtr1 thatt=sx and consequently,s≠s. Add
ck−1 1 r1x
,c1kr1x
along
withci1r1x
,ck−i
1 s
(0≤i≤k).
•Ifp=q, then it follows fromcq1ucp1t=cp1tsc1thatuc1qt=tsc1. Here, if|t| = |u|, thent=uandCis not SD(c1c3=c2c1q−kc2cq1−kc2c1). If|t|<|u|then putu= tr1=r1tandu=tr1, where|t| = |t|. So we havec1=xtr1=xr1t=tr1x= r1xt. Ift=t, thenr1≠r1and we gettr1x=r1xt=xtr1, which cannot hold
si-multaneously byLemma 1.5(2). So we assume thatt≠t, and ifr1=r1thentr1x= r1xt=xtr1, which cannot hold byLemma 1.5(1). Thust≠t,r1≠r1, andxz= xuc1qt=c
q+1
1 t∈prefix(C)\{}. Note that hereq=0 or we contradict the fact that r1≠r1. Whenq=k, we add
ck1−1uc2
,ck1uc1kuck1−1u
as well asc1kuc1kuck1−1u
,xt
andck1uc1ku
,ck
1t
. Whenq > k, add (2.1) andc1kucq−k− 1 1 c2
,ck1uc1quc1k−1u
along
with ck1ucq1ucq−k− 1 1 c2
,xt
and ck1ucq1uc1q−k
,ck
1t
. If |t| > |u|, put t =
ucp1
1 t1=t1u, wherec1is not a prefix oft1 nort1, and t1 ≠(otherwise,c1c3= c1c1ku(c
q 1u)2c
p1
1 =(c2c1q−k)2c2cp1+ 1
1 ). From the equalityuc q
1t=tsc1, it follows that c1quc
p1
1 t1=c p1
1 t1sc1and we continue as above, comparingp1toq. Sincec3is finite,
we must reachti=uc pi+1
1 ti+1=ti+1u wherec1is not a prefix ofti+1orti+1, and ti+1≠ (otherwise,c1c3=c1ck1u(c
q 1u)i+2c
pi+1
1 =(c2cq1−k)i+2c2cpi+1+ 1
1 ), and
conse-quently we get the equality cq1uc pi+1
1 ti+1=c pi+1
1 ti+1sc1. Then one of the following
occurs:
(1) pi+1> q, in which case we reach the same type of contradiction as above;
(2) pi+1< qand|ti+1| ≥ |u|, in which case we reach the same type of contradictions
as above;
(3) pi+1 < q and |ti+1|<|u|, in which case we put u=ti+tri+2= ri+2ti+1 and u=ri+2ti+1=ti+1ri+2where|ti+1| = |ti+1|. As above, we haveti+1≠ti+1,ti+1≠ ti+1,ri+2≠ri+2, andxz=c
pi+1+1
1 ti+1∈prefix(C)\ {}. Also,q≤q−pi+1−1, |z| = |cq−q
Addc1ku(c1qu)i+2c1j
,cPi+1−j 1 ti+1
(0≤j≤pi+1)wheneverq=k, orq > k, and pi+1< k. Wheneverq > kandpi+1≥k, add
ck 1u
cq1u
i+1
c1q−k−1c2 , ck 1u
cq1u
i+2 ck−1
1 u , ck 1u
c1qu
i+2 cj1 , ck 1u
c1qu
i+2 cj1c2
, 0≤j < pi+1−k,
(2.5)
and c1ku(c1qu)i+2c
p i+1−j 1
,cj
1ti+1
(0≤ j ≤ k). In all cases, we also include
c1jti+1
,cj+1 1 ti+1
(0≤j < k),
c1jti+1
,c1k−jri+2
(0≤j≤k),t i+1
,ri+2x
,
ri+2x
,t i+1
, andc1jri+2x
,c1j+1ri+2x
(0≤j < k−1), In the case where
q > k, add
ck1zc1j
,ck
1zc1jc2
whenever 0≤j < q−k, orj=q−kand uis
a prefix ofz. In the case where|ti+1|>|x|, putti+1=xsi+1, ti+1=si+1x= xsi+1, andti+1=si+1xwheresi+1≠si+1. Add
c1k−1ri+2x
,ck1ri+2x
along with cj
1ri+2x
,ck−j
1 si+1
(0≤j≤k);
(4) pi+1=qand|ti+1| = |u|, in which case we reach the same type of contradiction
as above;
(5) pi+1=qand|ti+1|<|u|, in which case, whenq=k, we add
c1ku
i+1 ck1−1uc2
,
c1ku
i+3 ck1−1u
,
c1ku
i+3
, ck
1ti+1
, (2.6)
andck1u
i+3
c1k−1u
,xt i+1
. Wheneverq > k, we add
ck 1u
c1qu
i+1
cq1−k−1c2 , ck 1u
c1qu
i+2 ck−1
1 u
,
ck1u
cq1u
i+2 c1j
,
ck1u
c1qu
i+2 c1jc2
, 0≤j < q−k,
c1ku
c1qu
i+2 cq1−k
,
c1kti+1
,
c1ku
cq1u
i+2
c1q−k−1c2
,
xti+1
.
(2.7)
Acknowledgments. This material is based upon work supported by the National
Science Foundation (NSF) under Grant No. CCR-9700228. We thank the referees of a preliminary version of this note for their very valuable comments and suggestions.
References
[2] F. Blanchet-Sadri,On unique, multiset, and set decipherability of three-word codes, IEEE Trans. Inform. Theory47(2001), no. 5, 1745–1757.
[3] F. Guzmán,A complete list of small proper MSD and SD codes, in preparation. [4] ,Decipherability of codes, J. Pure Appl. Algebra141(1999), no. 1, 13–35.
[5] T. Head and A. Weber,Deciding multiset decipherability, IEEE Trans. Inform. Theory41 (1995), no. 1, 291–297.
[6] A. Hoffmann,A test on unique decipherability, MFCS 84, Lecture Notes in Computer Science, Springer-Verlag, Berlin, 1984, pp. 50–63.
[7] A. Lempel,On multiset decipherable codes, IEEE Trans. Inform. Theory32(1986), no. 5, 714–716.
[8] M. Lothaire,Combinatorics on Words, Encyclopedia of Mathematics and Its Applications, vol. 17, Addison-Wesley, 1983.
[9] M. Rodeh,A fast test for unique decipherability based on suffix trees, IEEE Trans. Inform. Theory28(1982), 648–651.