on the structure of anagrammatic encodings

8
INFORMATION AND CONTROL 14, 1-8 (1969) On the Structure of Anagrammatic Encodings ~ LARRY E. STANFEL Department of Industrial and Systems Engineering, University of Florida Gainesville, Florida 32601 The anagrammatic, (never-synchronizing) property is investi- gated in terms of some structural aspects of exhaustive prefix encod- ings. In the case of alphabets having even numbers of characters, a condition necessary for the anagrammatic property is derived in terms of the number of second-longest words. Structure functions are used to derive a necessary condition for the property in terms of the sets of proper prefixes of an encoding and its reversal. Anagrammatic encodings, shown to be the only class of never-syn- chronizing eneodings (Gilbert and Moore, 1959), are of interest owing to this fact itself, as well as their apparent scarcity (Schutzenberger, 1956) relative to the set of all exhaustive, prefix codes. Not a great deal is known about their more specific structural properties, and this paper serves to identify several of these. E ~ will denote the set of all strings of m characters which may be formed from an alphabet E. Juxtaposition will denote the operation of concatenation, and if A = (al, --. , an), B = (bl, .-. , b~), then, AB = (albl, ..- , alb~, a2bl, ".. , a2b~, ... , amb~), the a~, bj being arbitrary strings over an alphabet E. The superscript R will be used to indicate the operation of reversal; for example, if s = abe, s ~ = cba, for a, b, c symbols in an alphabet. Further, if an encoding W has code words, wl, w2, ... , w~ , then W R R . . R has code words w~R, w2 , • , w~ . LEM~A 1. Let W be an anagrammatic encoding over an alphabet E. 1 Research supported in part by Project THEMIS Contract AROD-DAH-CO4- 68C-0002 1 Copyright © 1969 by Academic Press, Inc.

Upload: larry-e-stanfel

Post on 14-Sep-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: On the structure of anagrammatic encodings

I N F O R M A T I O N A N D C O N T R O L 14, 1-8 (1969)

On the Structure of Anagrammatic Encodings ~

LARRY E. STANFEL

Department of Industr ial and Systems Engineering, University of Florida Gainesville, Florida 32601

The anagrammatic, (never-synchronizing) property is investi- gated in terms of some structural aspects of exhaustive prefix encod- ings. In the case of alphabets having even numbers of characters, a condition necessary for the anagrammatic property is derived in terms of the number of second-longest words. Structure functions are used to derive a necessary condition for the property in terms of the sets of proper prefixes of an encoding and its reversal.

A n a g r a m m a t i c encodings, shown to be the only class of neve r - syn- chroniz ing eneodings ( G i l b e r t and Moore , 1959), are of in te res t owing to th is fac t itself, as well as the i r a p p a r e n t sca rc i ty (Schu tzenberge r , 1956) r e l a t ive to the set of al l exhaus t ive , prefix codes. N o t a g rea t dea l is k n o w n a b o u t the i r more specific s t r uc tu r a l p roper t ies , and th is p a p e r serves to i den t i fy severa l of these.

E ~ will deno t e t h e set of al l s t r ings of m cha rac te r s which m a y be fo rmed f rom an a l p h a b e t E .

J u x t a p o s i t i o n will deno te t he ope ra t ion of conca tena t ion , and if A = ( a l , - - . , a n ) , B = ( b l , . - . , b~), then,

A B = ( a l b l , . . - , a lb~ , a2bl , " . . , a2b~, . . . , amb~),

the a~, bj being a r b i t r a r y s t r ings over an a l p h a b e t E . T h e supe r sc r ip t R will be used to ind ica t e t he ope ra t ion of reversa l ;

for example , if s = abe, s ~ = cba, for a, b, c symbo l s in an a lphabe t . F u r t h e r , if an encoding W has code words, w l , w2, . . . , w~ , t hen W R

R . . R has code words w~ R, w2 , • , w~ .

LEM~A 1. L e t W be a n a n a g r a m m a t i c encod ing over a n a lphabe t E .

1 Research suppor ted in part by Project THEMIS Contract AROD-DAH-CO4- 68C-0002

1 C o p y r i g h t © 1969 b y A c a d e m i c P re s s , I n c .

Page 2: On the structure of anagrammatic encodings

2 S T A N F E L

Suppose it has a set C~ of code words of length kl for i = 1, 2, • • • , m. As sume k, < k2 < • • • < k~ . Then there exists a set S of strings such that

L = S E k~-~'*-I and

L ' = Ek'~-~m-lS

where L is the union of Cm_, and the set of k.~_~--length strings eliminated f rom W by the anagrammatic assumption and L ' is the union of Cm-, and the set of lore_,.--length strings eliminated by the prefix property.

Proof. The set of kin--length strings eliminated from W by the prefix property is

F, = C,E ~'-kl O C2E k--k~ O ... O C,~_,E ~--k--*.

Similarly, the set of strings eliminated by the suffix (anagrammatic) property is

F2 = E~-*~C, U E~-~2C2 O . . . U E~'~-~'~-IC,,_I.

We must have F~ = F2, or

C1E km-~l U C2E k'~-k~ U''" U Cm_IE k~-~- I (1)

= Ek~-k~Cz U Ek~-~C2 U . . . U E~'~-km-ICm_l.

Equation ( 1 ) may be rewritten

( C~E ~ - ~-~ U . . . U C,~_~ ) E ~'-~'~ -~ (2 )

= Ek'~-k'-~(Ek'~-l-~C1 U "." U C,~-,)

where the parenthesized sets are sets of strings of length k~_,, and neither set consists of all possible strings of that length.

(Equation (2)implies ]c~_, > ]~ - k~_,, for equality could not hold fo r /~_ , =< /~ - - ] ~ m - 1 • Of course, we know that if k~ < /c~ -- ]c~-1 for any i, 1 < i =< m -- 1, the encoding cannot be anagrammatie.)

At any rate (2) may be rewritten

Ek"-k~- ~ L = L ' E km-k~- ~ . (3)

The following observations are then possible. For each element of the set L' there must exist a set of D k~-k~-* strings in L, each suffixed by a distinct (k~ -- k~_,)--length string and each having its first

Page 3: On the structure of anagrammatic encodings

A N A G R A M M A T I C E N C O D I N G S

characters equal to the last 2k~_1 - k m characters of the L' eleme~t selected, where D is the cardinality of E.

In similar fashion, for each element of L there must exist D ~''-~'-~

elements of L' , each prefixed by a distinct (k,, - l~_ t ) - - l eng th string and each having its last 2/c~_~ - k~ characters equal to the first 2k~,_~ -- /c~ characters of the selected L element.

Thus, it must be possible to factor

L" = E~m-k~'-~ St , (4)

where Sx is a set of strings of length 2k~_t - /c~. Also, there must exist a set S~ having the same length strings as $1 a~ld

containing a number of strings equal to tha t of $2, and such that

L = S2E ~'~-k'~-I. ( 5 )

Substituting (4) and (5) into (3), we find

E ~-k'~-~ S2E ~ - ~ - ~ = E k~-~m-~ S t E k~-~m-~. (6 )

Equat ion (6), in turn, implies tha t St = $2 • Therefore, letting S = S~ = $2, the lemma is proved.

With the help of Lemma 1, we may prove the following.

THEOREM 1. I f W is an anagrammatic encoding over an alphabet with an even number of characters with word lengths t~t < ]c2 < • • • < ]~,~-1 k,~ , then there is an even number of words of length k ~ - i •

Proof. Let W be anagrammatic. Since E has an even number of characters E~]-k~(k~ > k l ) is always

~ k m - i--k i l'~ even. Consequently, sets of the form CtE k~-~-k~ and ~ ~ in (2) have even numbers of elements. If then C~_~ has an odd number of elements, L and L ' have an odd number of elements.

But then the set S, in Lemma 1, cannot exist, for if it did, we would have the product of an even integer and another integer being equal to an odd integer, from (4) and (5). Since this is impossible, Theorem 1 is proved.

Consider next the structure functions as used in (Karp, 1961 ). Let the alphabet E = (ct , e2, --- , ok).

Page 4: On the structure of anagrammatic encodings

4 S T A N F E L

Let ni.k = the number of occurrences of ct in code word w~, and let

t

f ( w i ) = H s~ ni'~ i = 1, . . . , n

with W = (Wa, w2, - . . , w,~.) Define F ( W ) = ~-~:=1 f (wm) . F is called the mul t iva r ia te s t ruc ture funct ion of W in the variables S l , " " " , S t •

K a r p proved, then, the following theorems.

THEORES~[ A1. P ( s l , "'" , s t) is the multivariate structure function of an exhaustive prefix code i f and only i f

( a ) F ( 0 , . . . , 0 ) = 0 (b ) Every coe~cient in the polynomial is nonnegative. (c) P ( s l , . . . , s t ) -- 1 = ( s~ - s s2 -5 . . . - s s t - - 1 ) Q (s l , . . . , s t ) .

THEOgE~ A2. I f P = F ( W ) with W an exhaustive prefix encoding having distinct proper prefixes pl , p2, • • • pn then

Q = ~ f(p~),

Q being the polynomial of Theorem A1 .

Let W be an anagrammat i c encoding. We have F ( W ) = F ( W R ) , by definition of F.

F r o m Theo rem A1, (e)

F ( W ) = P ( s ~ , . . . , s t)

= @1 -5 " ' " -5 sk -- 1) Q @1, " ' " , st) -5 1 (7)

= ( s ~ - 5 . . . - 5 sk - - 1 ) • ~f(p~) -5 1,

where p~, • • • , p~ are the dist inct proper prefixes of W. Now, since F ( W ) = F ( W R ) , it mus t be t h a t

n

F ( W R) = (Sl -5 . . . -5 s~ - 1) • ~ f ( p ~ ) + 1; i = 1

bu t also

n l

F ( W ' ) = @1 -5 . . . -5 s k - - 1) -~-~f (p i ' ) -5 1 i = 1

Page 5: On the structure of anagrammatic encodings

ANAGRAMMATIC ENCODINGS 5

by T h e o r e m 2, where pl" , • • • , p ' ~ are the dist inct proper prefixes of W R. I t is clear, then, t h a t no t only do W, W " have an identical number of

dist inct proper prefixes, bu t also t h a t those of W R, (pl ' , p , ' , " ' " , p~ ' ) m a y be obta ined f rom (p l , " ' " , p~) by pe rmut ing the symbols of each of the la t ter set in some fashion or other. S ta ted in another manner , there exists a 1 :1 correspondence between ( p l , " " , p~) and ( p l ' , " ' " , p ~ ' )

such t h a t if

pi corresponds to p j

then one is just a pe rm u ta t i on of the other. T h u s we have proved.

THEOREM 2. If W i s a n a n a g r a m m a t i c e n c o d i n g w i t h d i s t i n c t p r o p e r

p r e f i x e s ( p l , p 2 , " ' , p ~ ) , t h e n the d i s t i n c t p r o p e r p r e f i x e s (p~ ' , p 2 ,

• . . , p ~ ' ) : o f W R a r e i n 1 : 1 c o r r e s p o n d e n c e w i t h (p l , " ' " , p ~ ) , a n d i f p ~

c o r r e s p o n d s to P s ' , t h e n one i s a p e r m u t a t i o n o f the o ther .

As a referee has pointed out, s t ronger s ta tements regarding the above relationship m a y be made.

First , consider a proper prefix clc2, • • • , c~ in an anag rammat i c code W, where the cj are symbols f rom the par t icular alphabet . T h e n there are words beginning c~e2 • • • c~c~ . I f c~c2 • • • c~c~ is a word, then c2 • • • c~c~

is a proper suffix of W. Otherwise, there are words beginning c~c2 • • • c~c~c2. I f t h a t is a word then ca • • • c~c~c2 is a proper suffix of W. Cont inuing in this fashion, one finds t h a t if c~c2 • • • c~ is a proper prefix of W, then one of

Cl C2 " " " Cn

C2C3 """ Cnel

C3 " " " CnClC2

Cn--lCnC1 """ Cn--2

CnClC2 "'" Cn--1

is a proper suffix of W; t h a t is, for some i, we have clc~ • • • c~ c~+1 • • • c~ a proper prefix of W and c~+1 • • • c~ cl • • • c~ a proper suffix of W. Since W is anagrammat ic , the same result m a y be obta ined between proper prefixes of W R and proper suffixes of W R, and, therefore, this relation- ship is one to one f rom proper prefixes of W onto proper suffixes of W.

Page 6: On the structure of anagrammatic encodings

6 STANFEIJ

Finally, let us show that this same correspondence exists between proper prefixes of W and proper prefixes of W R. Suppose c1~ " " r~ is a proper prefix in W and that none of

c 1 ~ • . . c n

• . . c n c l

c3 . . . C n C l ~

: = V

C n _ l C n C 1 • . . C n _ 2

CnClC2 " ' " C ~ - 1

are proper prefixes of W R. Then each must be prefixed by a word of W R. If no string of the form c~+1 • • • c , c ~ . . . c~ is a proper prefix of W R, then none of

e l -b1 " " " CnC1 " ' " e l

Ci-~2 " " " C n C l " ' " C i C i - b l

C n C l " " " C i C i + l " " " On--1

t iC ,T1 " ' " CnGI " ' " Ci--I

can be proper suffixes of W R, as previously shown, which implies that n O l l e o f

c i • . . C lCn " " " C i + l

C i -b lC i " " " ClCn " " " C i •2

: : U

c ~ _ ~ " " c~c , , " " c~+~c~

are proper prefixes of W, so that each string of U is prefixed by a word of W. But since U = V ~, each element of V must be prefixed a n d

suffixed by a word of W e, and the only way in which such a set may be constructed, preserving both the prefix and suffix properties within that set is to select a set of words of constant length. We will denote such a

Page 7: On the structure of anagrammatic encodings

A N A G R A M M A T I C E N C O D I N G S 7

set by

ClC2 " ' " Cj

C2C 3 . . . C i+1

= Z

¢nClC2 " ' " C j - 1

Now it is also the case tha t (i) there is no element w of W ~ such that w = a z f ~ w i t h a ~ ¢ , f l ~ ¢, and z C Z; for if s ayw = a l a 2 " " a k • ClC2 • • • c~ fl~32 " " f i r , there must also be words of W R beginning ala2 • • •

C~k C l C 2 • • • C i 6 j + 1 .

This last string cannot be a word, since then c2 . . . cj+l, a word, would suffix it. But then, there must be words beginning a l ' " a k

• c ic2 • • • c j + i c ~ + 2 , ere, and the suffix property cannot be preserved, since the string must eventuMly terminate, ending with an element of Z.

I t is clear, in addition, that ( i i ) no element z of Z may be of the form z = a w ~ , ~ ~ ¢ , [3 ~ 4), w C W ~. Otherwise, the prefix property is miss- ing.

One way to observe that such an encoding cannot be anagrammatic is to a t t empt to construct it. First, there are no words of length less than j -- 1, by (i), since W R is assumed anagrammatie.

Construct, then, an exhaustive, prefix encoding Wo over the given alphabet E such that every possible ( j -- 1) length string is a code word except the ( j - 1 ) length proper prefixes of Z, which are proper prefixes of j length words in W0 ; tha t is, W0 also has words clc~ • • • c i E ,

c~ . . . c ~ c ~ E , . . . , c~c~ . . . c j _ ~ E .

Beginning with W0, then, construct W1, W2, . . - , where W~+I is obtained from W~ by selecting one word w~* C W~ and replacing this in W~+I by a set of words w ~ * E .

By selecting the appropriate word w~* at each iteration, for some finite/c E {0, 1, 2, . . • }, we realize Wk = W~; but the elements of Z must be present in each of W0, W~, • • • , Wk-~, Wk, and because of this, and the fact tha t if a word of Z suffixes another word in W~ there will be a word of Z suffixing another in e v e r y subsequent encoding, every en- coding in the sequence {W~} has at least one word suffixing another, regardless of the choice of the w~*, unless W R is a uniform code in which case the prefix correspondence is clearly present. The only other excep- tion is the case where the elements of Z are identical, in which case the

Page 8: On the structure of anagrammatic encodings

8 STANFEL

given prefix has the form cc . . . c for some c C E, and for which the desired correspondence is also apparent .

The contradiction is thus established. Summarizing, we have

THEOREM 3. I f W is an anagrammatic encoding, then there is a 1:1

correspondence f rom proper prefixes of W onto proper su:ff~xes of W , such

that i f clc2 • . . c~ is a proper prefix of W , then for some i, ci+l • • • c, cl • • • c~ is a proper sui~x of W . Further, the same correspondence holds f rom proper

prefixes of W onto proper prefixes of W R.

RECEIVED: March 10, 1967; revised: December 12~ 1968

REFERENCES

GILBEaT, E. N. AND E. F. MOORE (1959), Variable-length binary encodings. Bell System Technical Journal. 38,933-967.

KAaP, R. M. (January, 1961), Minimum redundancy coding for the discrete noise- less channel. IRE Transactions on Information Theory, pp. 27-37.

SCHUTZENBERGER, M. P. (1956), On an application of semi-group methods to some problems in coding. IRE Trans. IT-2, 47-60.