The Mathematical Theory of L Systems
Pure and Applied Mathematics A Series of Monographs and Textbooks
Editors
Samuel Eilenberg and Hymen Ease Columbia University, New York
R E C E N T TITLES
I. MARTINISAACS. Character Theory of Finite Groups R. BROWN.Ergodic Theory and Topological Dynamics C. TRUESDELL. A First Course in Rational Continuum Mechanics: Volume 1, General Concepts GEORGE GRATZER. General Lattice Theory K. D. STROYAN A N D W. A. J. LUXEMBURG. Introduction to the Theory of Infinitesimals B. M. PUTTASWAMAIAH A N D J O H N D. DIXON.Modular Representations of Finite Groups MELVYNBERGER. Nonlinearity and Functional Analysis : Lectures on Nonlinear Problems in Mathematical Analysis CAARALAMBOS D. ALIPRANTIS A N D OWENBURKINSHAW. Locally Solid Riesz Spaces J A N MIKUSINSKI. The Bochner Integral THOMAS JECH. Set Theory CARLL. DEVITO.Functional Analysis MICHIELHAZEWINKEL. Formal Groups and Applications SIGURDUR HELGASON. Differential Geometry, Lie Groups, and Symmetric Spaces ROBERTB. BURCKEL. An Iiilroductiori to Classical Complcx Analysis : Volume 1 JOSEPHJ. RoTni AN.An Introduction to Homological Algebra C. TRUESDELL A N D R. G. MUNCASTER. Fundamentals of Maxwell's Kinetic Theory of a Simple Monatomic Gas : Treated as a Branch of Rational Mechanics SIMON. Functional Integration and Quantum Physics BARRY G R Z E G ~ROZENHERG RZ A N D AHTOSALOMAA. The Mathcmatical Theory of L Systeiiis. JAMES
I N PREPARATION
LOUISHALLE ROWEN. Polynominal Identities in Ring Theory ROBERT B. BURCKEL. An Introduction T o Classical Complex Analysis : Volume 2 DRAGOS M. CVETLOVIC, MICHAEL DOOB,A N D HORST SA('f1S. Spectra of Graphs An Introduction to Variational InequalDAvm KINDERLEIIRER and GUIDOSTAMPACCHIA. ities and Their Applications. HERBERT SEIFERT A N D W. THKELFAI.~.. Seifert and Threlfall's Textbook on Topology D O N A L D w. K A I IN. Tntroduction to Global i\lialysis EDWAHI) PH~JGOVECKI. Quantum Mechanics in Hilbert Space ROBERT M. YOUNG. An Introduction to Nonharmonic Fourier Series
The Mathematical Theory of L Systems GRZEGORZ ROZENBERG Institute of A p p l i e d Mathematics and C o m p u t e r Science U n i v e r s i t y o f Leiden Leiden, T h e Netherlands
A R T 0 SALOMAA D e p a r t m e n t of Mathematics U n i v e r s i t y of Turku Turku, Finland
1980
@
ACADEMIC PRESS A S u b s i d i a r y of H a r c o u r t Brace Jovanovich, Publishers
New York
London Toronto Sydney San Francisco
COPYRIGHT @ 1980, BY ACADEMIC PRESS, INC. ALL HIGHTS RESERVEII. NO PART OF THIS PUBLICATION MAY BE REPRODUCED OR TRANSMlTTtD IN ANY FORM OR BY ANY MEANS, ELECTRONIC OR MECHANICAL, INCLUDING PHOTOCOPY, RECORDING, OR ANY INFORMATION STORAGE AND RETRIEVAL SYSTEM, WITHOUT PERMISSION IN WRITING FROM THE PUBLISHER.
ACADEMIC PRESS, INC.
1 1 1 Fifth Avenue, New York. New York 10003
Utiited K i n d o i n Edition Dublidled bv A C A D E M ~ CPRESS, INC. (LONDON) LTD. 24/28 Oval Road, London N W I
7DX
Library of Congress Cataloging in Publication Data Rozenberg, Grzegorz. The mathematical theory of L systems. (Pure and applied mathematics, a series of monographs and textbooks ; ) Includes bibliographical references and indexes. 1. L systems. 2. Formal languages. I . Salomaa, Arto,joint author. 11. Title. 111. Series. QA3.P8 [QA267.3] 5 1 0 ' . 8 ~ [511'.3J 79-25254 ISBN 0-12-597140-0
PRINTk D IN Ttll UNITLU STATtS OF AMERICA
80818283
9 8 7 6 5 4 3 2 1
To Dmiel, Kmrititr. Kai, Kirsti, Maja LItld to Aristitl \ihgu\v us the letter L
This Page Intentionally Left Blank
Contents
ix
Prefuce
...
Acknowledgments
Xlll
Lisr of Symbols
xv
INTRODUCTION
I.
1
SINGLE HOMOMORPHISMS ITERATED 1 . Basics about DOL Systems 2 . Basics about Locally Catenative Systems 3 . Basics about Growth Functions
10 20 29
11. SINGLE FINITE SUBSTITUTIONS ITERATED 1. Basics about OL and EOL Systems
2. 3. 4. 5. 6.
Nonterminals versus Codings Other Language-Defining Mechanisms Combinatorial Properties of EOL Languages Decision Problems EOL Forms vii
43 62 70 83 98 104
viii
CONTENTS
111. RETURNING TO SINGLE ITERATED
HOMOMORPHISMS 1. Equality Languages and Elementary Homomorphisms 2. The Decidability of the DOL Equivalence Problems 3. Equality Languages and Fixed Point Languages 4. Growth Functions: Characterization and Synthesis 5. DOL Forms
121 134 144 154
176
IV. SEVERAL HOMOMORPHISMS ITERATED Basics about DTOL and EDTOL Systems The Structure of Derivations in EPDTOL Systems Combinatorial Properties of EDTOL Languages Subword Complexity of DTOL Languages 5 . Growth in DTOL Systems
1. 2. 3. 4.
188
192 202 206 214
V. SEVERAL FINITE SUBSTITUTIONS ITERATED 1. Basics about TOL and ETOL Systems 2. Combinatorial Properties of ETOL Languages 3. ETOL Systems of Finite Index
23 1 245 26 1
VI. OTHER TOPICS AN OVERVIEW 1. IL Systems 2. Iteration Grammars 3. Machine Models 4. Complexity Considerations 5 . Multidimensional L Systems
280 292 300 3 10 3 16
HISTORICAL AND BIBLIOGR PHICAL REM, RKS
337
References
34 1
tndex
349
Preface
Formal language theory is by its very essence an interdisciplinary area of science: the need for a formal grammatical or machine description of specific languages arises in various scientific disciplines. Therefore, influences from outside the mathematical theory itself have often enriched the theory of formal languages. Perhaps the most prominent example of such an outside stimulation is provided by the theory of L systems. L systems were originated by Aristid Lindenmayer in connection with biological considerations in 1968. Two main novel features brought about by the theory of L systems from its very beginning are (i) parallelism in the rewriting process-due originally to the fact that languages were applied to model biological development in which parts of the developing organism change simultaneously, and (ii) the notion of a grammar conceived as a description of a dynamic process (taking place in time), rather than a static one. The latter feature initiated an intensive study of sequences (in contrast to sets) of words, as well as of grammars without nonterminal letters. The results obtained in the very vigorous initial period-up to 1974-were covered in the monograph "Developmental Systems and Languages" by G. Herman and G. Rozenberg ( North-Holland, 1975). Since this initial period, research in the area of L systems has continued to be very active. Indeed, the theory of L systems constitutes today a considerable body of mathematical knowledge. The purpose of this monograph is to present in a systematic way the essentials of the mathematical theory of L systems. The material common to the present monograph and that of Herman and Rozenberg ix
X
PREFACE
quoted above consists only of a few basic notions and results. This is an indication of the dynamic growth in this research area, as well as of the fact that the present monograph focuses attention on systems without interactions, i.e., context-independent rewriting. The organization of this book corresponds to the systematic and mathematically very natural structure behind L systems: the main part of the book (the first five chapters) deals with one or several iterated morphisms and one or several iterated finite substitutions. The last chapter, written in an overview style, gives a brief survey of the most important areas within L systems not directly falling within the basic framework discussed in detail in the first five chapters. Today, L systems constitute a theory rich in original results and novel techniques, and yet expressible within a very basic mathematical framework. It has not only enriched the theory of formal languages but has also been able to put the latter theory in a totally new perspective. This is a point we especially hope to convince the reader of. It is our firm opinion that nowadays a formal language theory course that does not present L systems misses some of the very essential points in the area. Indeed, a course in formal language theory can be based on the mathematical framework presented in this book because the traditional areas of the theory, such as context-free languages, have their natural counterparts within this framework. On the other hand, there is no way of presenting iterated rnorphisms or parallel rewriting in a natural way within the framework of sequential rewriting. No previous knowledge of the subject is required on the part of the reader, and the book is largely self-contained. However, familiarity with the basics of automata and formal language theory will be helpful. The results needed from these areas will be summarized in the introduction. Our level of presentation corresponds to that of graduate or advanced undergraduate work. Although the book is intended primarily for computer scientists and mathematicians, students and researchers in other areas applying formal language theory should find it useful. In particular, theoretical biologists should find it interesting because a number of the basic notions were originally based on ideas in developmental biology or can be interpreted in terms of developmental biology. However, more detailed discussion of the biological aspects lies outside the scope of this book. The interested reader will find some references in connection with the bibliographical remarks in this book. The discussion of the four areas within the basic framework studied in this book (single or several iterated morphisms or finite substitutions) builds up the theory starting from the simple and proceeding to more complicated objects. However, the material is organized in such a way that each of the four areas can also be studied independently of the others, with the possible exception of a few results needed in some proofs. In particular. a mathematically minded reader might find the study of single iterated morphisms (Chapters 1 and 111) a very
PREFACE
xi
interesting topic in its own right. It is an area where very intriguing and mathematically significant problems can be stated briefly ab o w . Exercises form an important part of the book. Many of them survey topics not included in the text itself. Because some exercises are rather difficult, the reader may wish to consult the reference works cited. Many open research problems are also mentioned throughout the text. Finally, the book contains references to the existing literature both at the end and scattered elsewhere. These references are intended to aid the reader rather than to credit each result to some specific author(s).
This Page Intentionally Left Blank
Acknowledgments
It is difficult to list all persons who have in some way or other contributed to this book. We have (or at least one of us has) benefited from discussions with or comments from K . Culik 11, J . Engelfriet, T. Harju, J. Karhumaki, K . P. Lee, R . Leipala, A . Lindenmayer, M . Linna, H. Maurer, M . Penttonen, K . Ruohonen, M . Soittola. A. Szilard, D. Vermeir, R. Verraedt, P. Vitanyi, and D. Wood. The difficult task of typing the manuscript was performed step by step and in an excellent fashion by Ludwig Callaerts and Leena Leppanen. T. Harju and J . Maenpaa were of great help with the proofs. We want to thank Academic Press for excellent and timely editorial work with both the manuscript and proofs. A. Salomaa wants to express his gratitude to the Academy of Finland for good working conditions during the writing of this book. G . Rozenberg wants to thank UIA in Antwerp for the same reason and, moreover, wants to express his deep gratitude to his friend and teacher Andrzej Ehrenfeucht, not only for outstanding contributions to the theory of L systems but especially for continuing guidance and encouragement in scientific research.
xiii
This Page Intentionally Left Blank
List of Symbols
CS-PD CTOL
2 85 262 71 250 148 I47 88 332 4 325 62 273 190 90 4 302 235
cfr
190
DCS-PD
DGSM
303 250 34 I45
DOL
10
dom drank
I46 279 310
alph
ALPH AN F AOL ussoc aug bal bound
BPMOL CF CGP COL conf cont COPY
cs
det
det(M)
DTAPE
DTIME DTOL EDTOL EIL EOL Eq
310 in8 191 285 54 122 52, 66 235 I66 I66 90 263 4 267 263 70 I44 I63 243 233 293 62 235 81 28 I 90 78
espec
ETOL F(BR) F(D0L) fin FIN FIN
FINF FlNU
FOL FP FmL FTOL fhace if
HOL HTOL IC IL inf'
J xv
JOL LA LCF
79 269
length
4 5 223
less
kd
14
maxr
Ill
mir mull
3 90 269 310 310 310
N LA NP NTAPE NTIME OC ODD OL one
ONE out
P PAC PAP PDOL PGOL POL PVf pres
ni 228 43 88 88 87 310 308 308 11
317 44 207 3
xvi RE REG res
RPAC RPAP SDGSM sent speed sub subk SUS
SYMB TOL
m
LIST OF SYMBOLS
4 4 45 309 308 145 54 59 206 206 207 1 I5 23 I 145
wfi)
45 304 242 54 52 28 I 28 1 3
A
1
I1
I 3 3 3
mace
UCS-PD us usent uspec
IL 2L
#
#I #i
*
I
I 3, 44 3, 44 3. 44 3, 44 44 71 71 137 137 22 1 249 105. 107, 177
Introduction
This introduction gives a summary of the background material from automata and formal language theory needed in this book. It is suggested that the introduction be consulted only when need arises and that actual reading begin with Chapter I. An alphabet is a set of abstract symbols. Unless stated otherwise, the alphabets considered in this book are always finite nonempty sets. The elements of an alphabet E are called letters or symbols. A ward over an alphabet C is a finite string consisting of zero or more letters of C, whereby the same letter may occur several times. The string consisting of zero letters is called the empty ward, written A. The set of all words (resp. all nonempty words) over an alphabet C is denoted by C* (resp. E'). Thus, algebraically, C* and C' are the free monoid and free semigroup generated by X. For words w1 and w 2 , the juxtaposition w1w2 is called the catenation (or concatenation) of w 1 and w 2 .The empty word A is an identity with respect to catenation. Catenation being associative, the notation wi, where i is a nonnegative integer, is used in the customary sense, and wo denotes the empty word. The length of a word w, in symbols I w 1, means the number of letters in w when each letter is counted as many times as it occurs. A word w is a subword of a word u if there are words w, and w2 such that u = w 1 w w 2 .If, in addition, w # 11 and w # A, then w is termed a proper subword of 11. 1
2
INTRODUCTION
Furthermore, if w I = A (resp. w 2 = A), then w is called an initial subword or prejix of u (resp. afinal subword or a sujix of u). Subsets of C* are referred to as languages over C. Thus, if L is a language over C,it is also a language over C,,provided C E C,. However, when we speak of the alphabet of a language L, in symbols alph(L), then we mean the smallest alphabet C such that L is a language over C. If L consists of a single word w, i.e., L = {w}, then we write simply alph(w) or alph w instead of alph({ w ) ) .(In general, we do not make any distinction between elements x and singleton sets {x}.) Various unary and binary operations for languages will be considered in the sequel. Regarding languages as sets, we may immediately define the Boolean operations of union, intersection, complementation (here it is essential that alph(L) is considered) and difference in the usual fashion. The catenation (or product) of two languages L1 and L2 is defined by
L,L2= ( w 1 w 2 ~ wE1L , and w 2 € L 2 ) . The notation L' is extended to apply to the catenation of languages. By definition, Lo = { A } . The cutenation closure or Kleene star (resp. A-free catenation closure, or Kleene plus or cross) of a language L, in symbols L* (resp. L ') is defined to be the union of all nonnegative (resp. positive) powers of L. We now define the operation ofsubstitution. For each letter a of an alphabet C,let a(a) be a language (possibly over a different alphabet). Define, furthermore, a(A) = { A } ,
4 ~ 1 ~= 2 4)w l ) d w z ) 3
for all w , and w 2 in C*. For a language L over C,we define a(L) = ;u I ii E a(\\*) for some \v E L ) . Such a mapping a is called a substitution. Depending on the languages, X,we obtain substitutions of more restricted types. In particular, ifeach of the languages a(a) is finite, we call a ajnite substitution. If none of the languages o(a) contains the empty word, we call a a A+ee or notierusing substitution. A substitution a such that each a(a) consists of a single word is called a homomorphism or, briefly, a morphism. If each o(u) is a word over C,we call a also an endomorphism. (Algebraically, a homomorphism of languages is a monoid morphism linearly extended to subsets of monoids.) According to the convention above (identifying elements and their singleton sets), we write .(a) = w rather than a(a) = { w } . A homomorphism a is A-free or nonerasing if a(a) # A for every a. A letter-to-letter homomorphism will often in the sequel be called a coding. Inoerse homomorphisms are inverses of homomora(a), where a ranges over
3
INTRODUCTION
phisms, regarded as mappings. They will be explicitly defined below, in connection with transductions. The mirror iniuye of a word w, in symbols mir(w), is the word obtained by writing w backward. The mirror image of a language is the collection of the mirror images of its words, that is, mir(L)
=
{mir(w)lw in L}.
The cardinality of a finite set S is denoted by # ( S ) . Similarly, # z(w) or # I: w denotes the number of occurrences of letters from Z in the word w. If C consists of one letter a,, this notation reads # a , ~ ,meaning the number of occurrences of u , in w. If the alphabet considered is {al,. . . , a n } ,we write simply #.,w = # , w . The notation pres,w means the word obtained from w by erasing all letters not in C. (Thus, only letters “present” in C are considered.) Clearly, #I:w
=
lprrsr
wI.
If w is a word and 1 I i I I w 1, then w(i)denotes the ith letter of w. The main objects of study in formal language theory are finitary specifications of infinite languages. Most such specifications are obtained as special cases from the notion of a rewriting system. By definition, a rewriting system is an ordered pair (C,P), where X is an alphabet and P a finite set of ordered pairs of words over X. The elements (w, u ) of P are referred to as rewriting rules or productions and usually denoted w -+ u. Given a rewriting system, the (binary) yield relutiorz * on the set C* is defined as follows. For any words ct and 1).ct * 1 ) holds ifand only if there are words xl, x 2 ,w, u such that ct =
x,wxz
and
p
= x,ux2.
and M I + 11 is a production in the system. The reflexive transitive (resp. transitive) closure of the relation * is denoted =.* (resp. a + )If. several rewriting systems G. H , . . . are considered simultaneously, we write to avoid confusion when dealing with G. A phrase structure grammar or, briefly, yrummur is an ordered quadruple G = (C, P , S , A), where X and A are alphabets and A 5 C (A is called the alphabet of terminuls and C\A the alphabet of nonterminals), S is in Z\A (the initiul letter), and P is a finite set of ordered pairs (w, u), where wand u are words over X and w contains at least one nonterminal letter. Again, the elements of P are referred to as rewriting rules or productions and written w -+ u. A grammar G as above defines a rewriting system (C, P). Let =. and -* be the relations determined by this rewriting system. Then the language L(G) yencrated by G is defined by L(G) = { w ~ A * l S * * w } .
4
INTRODUCTION
For i = 0,1,2,3, a grammar G = (C, P, S , A) is of type i if the restrictions ( i ) on P, as given below, are satisfied: (0) No restrictions. (1) Each producion in P is of the form w , A w 2 w 1 w w 2 ,where w 1 and w 2 are arbitrary words, A is a nonterminal letter, and w is a nonempty word (with the possible exception of the production S A whose occurrence in P implies, however, that S does not occur on the right-hand side of any production). (2) Each production in P is of the form A + w , where A is a nonterminal letter and w is an arbitrary word. (3) Each production in P is of one of the two forms A Bw or A MI,where A and B are nonterminal letters and w is an arbitrary word over the terminal alphabet A. -+
-+
-+
-+
A language is of type i if and only if it is generated by a grammar of type i. Type 0 languages are also called recursively enumerable.Type 1 grammars and languages are also called context-sensitive. Type 2 grammars and languages are also called contexr-free.Type 3 grammars and languages are also referred to as regular. The four language families thus defined are denoted by Y(RE), Y(CS),Y(CF), Y(REG). Furthermore, the family of all finite languages is denoted by Y(F1N). These families form a strictly increasing hierarchy, usually referred to as the Chomsky hierarchy:
Y(FIN) 5 L?(REG) 5 Y(CF) 5 Y(CS) 5 Y(RE). (The reader is referred to [S4] for a more-detailed discussion, as well as for all proofs of the facts listed in this introduction.) Two grammars G and G1 are termed equivalent if L ( G ) = L ( G , ) . This notion of equivalence is extended to apply to all devices defining languages; two devices are equivalent ifthey define the same language. To avoid awkward special cases we make the conuention that two languages differing by at most the empty word A are considered to be equal. We also make the convention that whenever new letters are introduced in a construction they are distinct from the letters introduced previously. For a grammar G, every word w such that S ** w is referred to as a sentenrialform of G. Hence, a sentential form need not be over the terminal alphabet A. A context-free grammar is termed lineur if the right-hand side of every production contains at most one nonterminal. A language is linear if it is generated by a linear grammar. The length set of a language L is defined by length(L)
=
I
{ Iw I w
E L).
5
INTRODUCTION
Consider the alphabet Z = { a 1 ,. . . , a,,}. The mapping $ of Z* into the set N” of ordered n-tuples of nonnegative integers defined by $(w) = ( # I(W),. .
. 7
#“(W))
is termed the Purikh mapping and its values Parikh oectors. The Parikh set of a language L over E is defined by $ ( L ) = {$(w)lw E LJ. A subset K of N “ is said to be linear if there are finitely many elements c, b , , . . . , h, of N ” such that
m, a nonnegative integer, i
=
1,. ..,r
A subset of N ” is said to be semilinear if it is a finite union of linear sets. The Parikh set of a context-free language is always semilinear. Consequently, the length set of a context-free language, ordered according to increasing length, constitutes an almost periodic sequence. We often want to exclude the “initial mess” from the language we are considering: if L is a language and r a positive integer, we denote by less,(L) the subset of L consisting of words of length less than r. The family of regular languages over an alphabet Z equals the family of languages obtained from “atomic” languages {A} and { a } ,where a E C, by a finite number of applications of regular operations: union, catenation, and catenation closure. The formula expressing how a specific regular language is obtained from atomic languages by regular operations is termed a regular expression. The families of type i languages, i = 0, 1,2, 3, defined above using generative devices can be obtained also by recognition devices or automata. A recognition device defining a language L receives arbitrary words as inputs and “accepts” exactly the words belonging to L. We now define in detail the class of automata-accepting regular languages. A rewriting system (C, P ) is called a j n i t e deterministic automaton if (i) X is divided into two disjoint alphabets Q and V (the state and the input alphabet), (ii) an element q , E Q and a subset F c Q are specified (initial state andfinal state set), and (iii) the productions in P are of the form 4;ak
+
Y j 3
Yi, qjEQ,
akE
and, for each pair (qi, ak), there is exactly one such production in P. The language accepted or recognized by a finite deterministic automaton FDA is defined by L(FDA)
= {w E
V* Jq, w ** q , for some q 1 E F } .
6
INTRODUCTION
A finite deterministic automaton is usually defined by specifying a quintuple ( V , Q, J; qo, F), where J’ is a mapping of Q x V into Q, the other items being as above. (Clearly, the values off are obtained from the right-hand sides of the productions qiu, .+ q j . ) A finite nondeterministic automaton FNA is defined as a deterministic one with the following two exceptions. In (ii) qo is replaced by a subset Qo c Q. In (iii) the second sentence (“and for each pair.. .”) is omitted. The language accepted by an FNA is defined by L(FNA) =
{WE
V*lq,w
=*q , for some q O E Q ,
and q 1 E F ) .
A language is regular if and only if it is accepted by some finite deterministic automaton if and only if it is accepted by some finite nondeterministic automaton. We omit the detailed definition of the three classes of automata (pushdown automata, linearly bounded automata, Turing machines) corresponding to the language families Y(CF), Y(CS), Y(RE). (The reader is referred to [S4].) In particular, a Turing machine is the most general type of an automaton: it is considered to be the formal counterpart of the informal intuitive notion of an “effective procedure.” (Hence, this applies also to type 0 grammars because they have the same language-accepting capability as Turing machines.) The addition of new capabilities to a Turing machine does not increase the computing power of this class of automata. In particular-as in connection with finite automata-deterministic and nondeterministic Turing machines accept the same class of languages. As regards pushdown automata, deterministic automata accept a strictly smaller class of languages than nondeterministic ones: Y(CF) is accepted by the nondeterministic ones. As regards linear bounded automata, the relation between deterministic and nondeterministic ones constitutes a very famous open problem, often referred to as the LBA problem. Acceptors have no other output facilities than being or not being in a final state after the computation, i.e., they are capable only of accepting or rejecting inputs. Sometimes devices (transducers) capable of having words as outputs, i.e., capable of translating words into words, are considered. We give next the formal definition for the transducer corresponding to a finite automaton. In particular, its simplified version (gsm) will be needed in this book quite often. A rewriting system (C, P ) is called a sequential trunsducer if each of the following conditions (i)-(iii) is satisfied :
v,,
(i) C is divided into two disjoint alphabets Q and u V,,,. (The sets Q, I(,, V,,, are called the state, input, and output alphabet, respectively. The latter two are nonempty but not necessarily disjoint.) (ii) An element q, E Q and a subset F G Q are specified (initiul stufe and ,finalstate set).
7
INTRODUCTION
(iii) The productions in P are of the form ql~'-'uq,,
%?q,EQ,
WEE*,, UEV,*,,.
If, in addition, w # A in all productions, then the rewriting system is called a generalized sequentid machine (gsm). If, in addition, always u # A, we speak of a A-free gsm. For a sequential transducer ST, words w , E v:and w 2 E v,*,,,and languages L , G V z and L2 c V&,, we define ST(\vl) =
{ W I ~ ~ -* ~ W wyl ~ for some 4 , E F ) ,
ST(L,)
{ u l u ~ S T ( w ) f o r s o mM e 'EL,},
ST-'(w2)
=
= { u l w2 E
ST(u)},
r M'EL~}. ST-'(L2) = { u l u ~ S T - ' ( w ) f o some Mappings of languages thus defined are referred to as (rational) transductions and inverse (rational) transductions. If ST is also a gsm, we speak of gsm mappings and inverse gsm mappings. In what follows, a generalized sequential machine is usually defined by specifying a sixtuple (Fn, Ku,, Q, f,qo, F ) , where f is a finite subset of the product set Q x ViL x V,*, x Q, the other items being as above. A homomorphism, an inverse homomorphism, and a mapping f(L)= L n R, where R is a fixed regular language, are all rational transductions, the first and the last being also gsm mappings. The composition of two rational transductions (resp. gsm mappings) is again a rational transduction (resp. gsm mapping). Every rational transduction f can be expressed in the form
f(L)= h,(h;'(L)
n R).
where h l and h2 are homomorphisms and R is a regular language. These results show that a language family is closed under rational transductions if and only if it is closed under homomorphisms, inverse homomorphisms, and intersections with regular languages. Such a language family is referred to as a cone. A cone closed under regular operations is termed a full AFL. (If only nonerasing homomorphisms are considered in the homomorphism closure, we speak of an AFL.) A family of languages is termed an anti-AFL if it is closed under none of the six operations involved (i.e., union, catenation, catenation closure, homomorphism, inverse homomorphism, intersection with regular languages). Each of the families Y(REG), Y(CF), 9 ( C S ) ,and Y(RE) is closed under the following operations: union, catenation, Kleene star, Kleene plus, intersection with a regular language, mirror image, A-free substitution, A-free homomorphism, A-free gsm mapping, A-free regular substitution, inverse homomorphism, inverse gsm mapping. With the exception of 9 ( C S ) , these
8
INTRODUCTION
families are also closed under substitution, homomorphism, gsm mapping, and regular substitution. (Hence, Y ( C S )is an AFL. The families Y(REG), Y(CF), and Y(RE) are full AFLs and, consequently, also cones.) With the exception of Y(CF) these families are closed under intersection. The family Y(REG) is closed under complementation, whereas neither one of the families Y(CF) and Y(RE) is closed under complementation. It is an open problem whether or not Y(CS) is closed under complementation. Decision problems play an important role in this book. The usual method of proving that a problem is undecidable is to reduce it to some problem whose undecidability is known. The most useful tool for problems in language theory is in this respect the Post correspondence problem. By definition, a Post correspondence problem is an ordered quadruple PCP = (C, n, a, p), where C is an alphabet, n 2 1, and a = ( a l , . . . ,a,,), p = (pl, . . . , p,,) are ordered ntuples of elements of C+.A solurion to the PCP is a nonempty finite sequence of indices i l , . . . , ik such that ai, . . . aik=
pi, . . pi,. 3
It is undecidable whether an arbitrary given PCP (or an arbitrary given PCP over the alphabet C = {al, a 2 } )has a solution. Also Hilbert’s tenth problem is undecidable: given a polynomial P ( x , , . . . ,xk) with integer coefficients, one has to decide whether or not there are nonnegative integers x i , i = 1 , . . ., k, satisfying the equation P(X1,.
* 9
xk) = 0.
For a general survey of decidability results concerning the language families in the Chomsky hierarchy, the reader is referred to [S4]. We mention here only a few such results. The membership problem is decidable for contextsensitive languages but undecidable for type 0 languages. (More specifically, given a context-sensitive grammar G and a word w , it is decidable whether or not w E L(G).)It is decidable whether two given regular languages are equal and also whether one of them is contained in the other. Both of these problems (the equivalence and the inclusion problem) are undecidable for context-free languages. It is also undecidable whether a given regular and a given contextfree language are equal. It is decidable whether a given context-free language is empty or infinite, whereas both of these problems are undecidable for context-sensitive languages. It is undecidable whether the intersection of two context-free languages is empty. The intersection of a context-free and a regular language is always context-free ;and, hence, its emptiness is decidable. It is undecidable whether a given context-free language is regular. Most results presented in this book are effective,although this is not usually mentioned. It is sometimes mentioned for purposes of emphasis.
INTRODUCTION
9
We make use of standard graph-theoretic terminology a few times in this book. This should present no difficulties to the reader since only very basic notions are needed. According to the standard usage in connection with power series, we denote by Z (resp. N ) the set of all (resp. all nonnegative) integers. Finally, it should be emphasized that the rewriting discussed above is sequential: at each step of the process only some part of the string is rewritten. L systems are models of purallrl rewriting: at each step of the process all letters of the word considered have to be rewritten. The presentation is divided into six chapters numbered by roman numerals. References to theorems, equations, exercises, etc. without a roman numeral mean the item in the chapter where the reference is made. References to other chapters are indicated by a roman numeral.
Single Homomorphisms Iterated
1. BASICS ABOUT DOL SYSTEMS This chapter deals with the simplest type of L systems, called DOL systems. Although mathematically most simple, DOL systems give a clear insight into the basic ideas and techniques behind L systems and parallel rewriting in general. Also, the first examples of L systems used as models in developmental biology were, in fact, DOL systems. In spite of the simplicity of the basic definitions, the theory of DOL systems is at present very rich and challenging. Apart from providing applications to formal languages and biology, this theory has also shed new light on the very basic mathematical notion of an endomorphism defined on a free monoid. Some of the most fundamental, and historically “older,” facts about DOL systems are presented in this chapter. Chapter I11 deals with more advanced topics concerning DOL systems. In particular, this section provides some examples and some indications to the most important problems. Dejinition.
A DOL system is a triple
G = (C,h, 01, where C is an alphabet, h is an endomorphism defined on C*, and Q, referred to as the axiom, is an element of C*. The (word)sequence E(G) generated by G consists of the words ho(W) = W, h(w), h 2 ( o ) , h3(w),. .. . I0
1
11
BASICS ABOUT DOL SYSTEMS
The language of G is defined by L(G) = {h'(cc,)I i 2 Exunipk 1.1.
o}.
Consider the DOL system G
= ( { a , b ) , h,
ah)
with h(u) = a, h(b) = ab. Then E ( G ) = ab, a'b, ..., anb, ... and so L(G) = {u"bln 2 l}. Exutriplc~1.2.
For the DOL system G
= ( { a ) ,h, a)
with h(a) = a', we have E ( G ) = a, a', a4,. . . ,a'", . . . and so
L(G) = {a'"ln 2 O}. Remark. In the sequel the homomorphism h will often be defined by listing "the production for each letter." Such a definition in Example 1.1 above would be a + a, b + ab, and in Example 1.2 a + a'. An application of the homomorphism h of Example 1.2 to the word a4, (1.1)
h(a4) = as,
amounts to applying the production a + a' to all occurrences of a, i.e., to parallel rewriting. Accordingly, we often use the yield relation * and write a4 3 a8 instead of (1.1). In this sense a DOL sequence E(G) can be understood as a derivation sequence, where each word directly yields the next one. In the abbreviation DOL 0 means that the rewriting is context-independent (originally, communication between the individual cells is zero-sided in the development), and D stands for deterministic: there is just one production for each letter, i.e., the totality of all productions defines an endomorphism on Z*. These distinctions will become clearer later when different types of L systems are introduced. A DOL system (E, h, o)is termed propagating or, shortly, a PDOL system if h is nonerasing. Thus, in Examples 1.1 and 1.2 we are dealing with PDOL systems. A sequence of words or a language is termed a DOL (resp. PDOL) sequence or language if it equals E ( G ) or L(G) for some DOL (resp. PDOL) system G. Since there can be no decrease in the word length in a PDOL sequence, it is easy to give examples of DOL sequences that are not PDOL sequences. The following example is a little more sophisticated.
12
I
Example 1.3. productions
SINGLE HOMOMORPHISMS ITERATED
Consider the DOL system G with the axiom ab2a and a
-,ab2a,
b + A.
(In the sequel we shall often define DOL systems in this way, the alphabet being visible from the productions.) Then
L(G) = {(ab2a)2"ln2 O}, E ( G ) being strictly increasing in length. On the other hand, there is no PDOL system G I satisfying L ( G , ) = L(G). Indeed, such a G I , because it is propagating, would have to satisfy also E(Gl) = E(G). Consequently, ab2a would have to be the axiom of G1 and ab2aab2athe second word in the sequence E(Gl). Thus, ub2a * ab2uab2a according to G1. Since the two occurrences of a in ab'a must produce the same initial and final subword in ub2aub2u,this is possible only if G I either has the productions of G or the production u -, A or else the production a -, a. The first two possibilities are ruled out because G1 is propagating, and the last possibility is ruled out because then b2 * b2aab2 according to G I , which is impossible since h2uab2 cannot be represented in the form ww. In the preceding example we were looking for a system G1 satisfying E ( G , ) = E(G) or L(Gl) = L(G),where G was a given system. Such systems are termed sequence or language equivalent. More specifically, we say that two DOL systems G and G1 are sequence equivalent (resp. language equivalent or, briefly, equivalent) if E ( G ) = E(Gl) (resp. L(G) = L ( G , ) ) . Clearly, the sequence equivalence of two DOL systems implies their language equivalence but not conversely because two systems may generate the same language in a different order. A simple example is provided by the two systems ( { a , b } , {a -+b2, b -, a } , b )
and
( { a , b}, { a -,b, b
-, a 2 } ,a),
both generating the same language but different sequences. Among the most intriguing mathematical problems about L systems is the so-called DOL equivalence problem: construct an algorithm for deciding whether or not two given DOL systems are (language or sequence) equivalent. We want to mention this problem at this early stage to emphasize the variety of difficult problems arising from the seemingly very simple notions in the theory of L systems. Indeed, the DOL equivalence problem was open for a long time and was often referred to as the most simply stated combinatorial problem with an open decidability status. A solution to the problem (both as regards sequence and language equivalence) will be given in Chapter 111. The problem is illustrated here by the following two examples.
1
13
BASICS ABOUT DOL SYSTEMS
Exunipli. 1.4. This is a slight modification of Example 1.3. Consider the two DOL systems
G = ( { u , h } ,{ t ~ - + ~ b ~ , b - + A } , u b uG) ,I = ( { a , b } ,{a-+a,b-+ba2b},aba).
(Note that G I is also a PDOL system.) It is easy to see that L(G) = L(Gl)
=
{ ( u h ~ ) ~ ”2l n0 )
and that E ( G ) = E ( G , ) consists of the words of L(G) in their increasing length order. Hence, G and G I are both language and sequence equivalent. The ad hoc argument like that in the previous example cannot be extended to the general case. As regards sequence equivalence, one can generate words from two sequences E(G) and E ( G , ) one at a time, always testing whether the ith words in the two sequences coincide for i = 1,2,. . . . This procedure constitutes a semialgorithm for nonequivalence: if G and GI are not sequence equivalent, the procedure terminates with the correct answer. But if G and G , are sequence equivalent, the procedure does not terminate. To convert this procedure into an algorithm we would have to be able to compute a number C(G, G I ) such that if the first C(G, G I ) terms in E ( G ) and E ( G , ) coincide, then E ( G ) = E(G,). However, this has turned out to be a very difficult task although, on the other hand, it might be the case that twice the size of the alphabet of G and G I is sufficient. At least no examples contradicting this are known. Indeed, the following example (cf. also Exercise 1.3) is the “nastiest” known of two systems G and G I such that E ( G ) # E ( G , ) but as many as possible (relative to the size of the alphabet) first words in the two sequences coincide. Exutnpke 1.5. Consider two DOL systems G and G I with the axiom ab. The productions for G (resp. G I ) are a --t abb and b -+ aabha (resp. a -+ abbauhb, b + a). The sequences E ( G ) and E ( G , ) coincide with respect to the first three words. This follows because (i) ab yields directly the word abbuabha according to both systems, and (ii) also ha yields directly the same word according to both systems. From the fourth word on the sequences E(G) and E ( G , ) are different. It may be interesting to know that the PDOL system in the next example has been used to describe the development of a red alga. E.ru1rip1~1.6. In the following PDOL system G, the axiom is 1, and the productions are given by the table 1
2
3
4
5
6
7
X
(
)
#
2#3
2
2#4
SO4
6
7
8(1)
X
(
)
#
O
0
I
14
SINGLE HOMOMORPHISMS ITERATED
(The letters of the alphabet are listed in the first row, and the right-hand side of each production is in the second row.) The first few words in the sequence E ( G ) are 1, w 1 = 2#3, w2 = 2#2#4, w4 = 2#2#60504, w 5 = 2#2#7060504,
O J ~=
0 6
=
(a3 = 2#2#504,
2 # 2 # 8( 1)07060504.
It can also be verified inductively that, for all n 2 0, ( 1.2)
0, +6
= 2 # 2 # 8(~,)08(0, -
,)o
’’’
08(0,)07060504.
The reader is referred to [Ll] or [S4] for information regarding how the words wi are interpreted as two-dimensional pictures, describing the development of the red alga in question. Before proceeding with our examples we give the formal definition of locally catenative sequences. Definition. A locally catenative formula (LCF in short) is an ordered k-tuple (i,, . . . , ik) of positive integers, where k 2 1. An infinite sequence of wordswO,wl,mZ,.. .satisjiesanLCF(il,. . . , ik)withacutp 2 max{il, . . . , ik} if, for all n 2 p ,
. . . U&ik.
0,= U n - i * 0 , - i 2
A sequence of words satisfying some LCF with some cut is called locally catenative. Thus, a locally catenative formula is a natural generalization to words of a linear homogeneous recurrence relation for numbers. Note that formula (1.2) does not lead to an LCF although the situation bears certain similarities to LCFs. O n the other hand, the DOL sequence of Example 1.2 satisfies the LCF (1, 1) with cut 1. We shall give below a couple of further examples. However, before that we want to mention the following fundamental problem comparable in importance to the DOL equivalence problem : construct an algorithm for deciding whether or not a given DOL sequence is locally catenative. No solution to this problem has been found so far, although the converse problem (ofconstructing an algorithm for deciding whether or not a given locally catenative sequence is a DOL sequence) is quite easy; cf. Exercise 1.4. Example 1.7. Let G be the DOL system with the axiom a and productions a + b, b + ah. Thus, the first few words in E(G) are
a, b, ah, huh, abbab, bababbuh, ....
1
15
BASICS ABOUT DOL SYSTEMS
Weclaimthat thissequencew,,w,,w,, . . . satisfiestheLCF(2, l)withcut2, i.e., for all n 2 2,
(1.3)
(U,
= w,-2w,-1.
Indeed, using the homomorphism notation, (1.3) can be written as h"(u) = h"-'(u)h"- ' ( u ) .
The validity of this equation is immediately verified using the definition of h, i.e., the productions listed above: h"(u) = h"-'(h(u)) = h"-'(h) = h"-'(h(h)) = h"-'(uh) = h"- Z(u)h"-Z(b) = h"-Z(u)h"- '(u).
The linear homogeneous recurrence relation for word lengths corresponding t o (1.3) is ( 1.4)
Ico,,I =
l(iJn-21
+ IQ.-~
1
for all n 2 2.
Since IQ,,~ = 1 ~ = ~I. (1.4) 1 tells us that the length sequence IwiJ, i = 0, I , 2, . . . is the famous Fibonacci sequence! Examp/. 1.8. Consider the DOL system G presented in Example 1.3. Observe first that E ( G ) is locally catenative with the same LCF and cut as the sequence of Example 1.2. It was shown in Example 1.3 that there is no PDOL system generating the same word sequence or language as G. Let us consider the same problem from the point of view of length sequences. Clearly, the lengths of the words OJ, in E(G) satisfy I(I);I
=
2It2
for all
i 2 0.
Thus, the very simple PDOL system G I = ( { a } , { U + a ' } , u4) generates the same word length sequence as G. One can generalize Example 1.8 to the following problem: does there exist a DOL system G with a strictly increasing word length sequence (i.e., IQ; 1 < [ m i + I for all i ) such that there is no PDOL system G , with the same word length sequence as G ? The existence of such DOL systems will be shown in Chapter I l l . The problem is much more difficult than the same problem for word sequences dealt with in Example 1.3 because two quite different word sequences may yield the same length sequence. The purpose of the present section is to make the reader familiar with some of the very basic notions about DOL systems. For this reason, we have given many examples and also hinted at some more challenging mathematical problems in the area. We conclude the section by defining a few other notions that will be frequently used in the sequel. We need first a little auxiliary result.
I
16
SINGLE HOMOMORPHISMS ITERATED
We denote by d p h ( w ) ,where 0 ) is a word, the smallest set of letters C such that (o is in C*. Note that ulph(A) =
a.
Theorem 1.1. Let O J ~ w , l , w 2 , . . . hr the word sequence yeiieruted by a DOL system G = (2, h, (/lo).Then the set^ Xi = ulph(oi),i 2 0,form U I I ulmost periodic sequeiice, i.e., there ure riumhrrs p > 0 uiid q 2 0 siich rhut Xi = holdsjor euery i 2 y. l f ' u letter (I E C occiirs in some X i , it occurs ulso in some C j with j I #(X) - 1 . ProoJ: Consider the first assertion. Since each Ci is a subset of C, there are only finitely many of them and, consequently, for some q 2 0 and p > 0,
Xq
(1 3)
=
C4+p.
Since clearly, for each i andj, X i = C j implies X i + = C j +1, the numbers p and q satisfying (1.5) satisfy the first assertion. The second assertion follows because
(J X i = isn
u Xi
implies
(J xi =
u xi
for all j .
isn+j
isn
isn+ 1
Consequently, if the letter ~i occurs at all in the sequence E(G). it has to occur among the first #(C) words. (Note that our numbering of the word sequence wi starts from 0.) 0 We term a DOL system G = (C, h, tr)O) reduced if every letter of 1 occurs in some word of E(G), i.e., (J Xi = C, where the alphabets Xi are defined as in Theorem 1.1. The redirced wrsioii of G is the DOL system defined by Gred
= ( (J Xi
7
bred mo), 7
where bred is the restriction of h 10 (J Xi. It follows from the definition that E(G,,,)
=
E(G)
and
L(Gr,d) = L(G).
By Theorem 1 . 1 G r e d can be effectively constructed from G. In what follows we shall assume that the DOL systems considered are reduced. Let G = (C, h, too) be a DOL system such that L(G) is infinite. (This happens exactly in case no word occurs twice in E(G),a property that is easily decidable; cf. Exercise 1.7.) For integers p > 0 and y 2 0, we denote by G(p, q ) the reduced DOL system G(p, q ) = (C', hP, h q ( O 1 O ) ) .
The alphabet C' is the subset of C consisting of all letters appearing in E(G(p, 4)). Thus, to get E(G(p, q)) we omit from E(G) the first q words, and after that take only every pth word. Clearly, G = G( 1,O).
1
17
BASICS ABOUT 1 X ) L . SYSTEMS
We say that the original sequence E ( G ) is tlrcompo.\ed into the sequences E(G(p, i i ) ) for 11 I ti I 4 p - 1 or, conversely, that E(G) is obtained by tneryiiig the sequences E(G(p. ti)). (Note that in this process the first q words may be lost.) Theorem 1.1 shows that every DOL sequence can be decomposed into cotiserruriw DOL sequences, i.e., sequences in which every letter of the alphabet occurs in every word. (The definitions above were given assuming L ( G )to be infinite. In the finite case E ( G ) can be analogously decomposed into sequences consisting of just one word.)
+
Exmiplc I.Y.
For the DOL system G with the axiom LI and productions (I
-+
b2,
b
--t
c,
c
-+
(i,
d
-+
h2,
the sequences E(G(3, ti)), 1 I ii I 3, are conservative. Note also that. since the length of the rith word equals 2", the latter sequences are strictly growing in word length, which is not true of the original E(G). We end this section by introducing a notion that is very important in considering many difficult problems about DOL systems, for instance, the DOL equivalence problem. Dcfinitioti. A homomorphism 11: C* --+ 1: (where possibly C, = Z) is .sinipl$ah/e if there is an alphabet Z2 with #(ZJ < #(I)and homomorphisms ( 1.6)
j ' : C*
-+
1;
and
9 : Z?
-+
C:
suchihat h = gjl Otherwise, h is called rlemetitarj,. A DOL system (Z, h, w ) is called elemetirary if h is elementary. It is an immediate consequence of the definition that (i) erasing homomorphisms, (ii) homomorphisms h : Z* -P Z: with # ( X I ) < #(Z), in particular, noninjective letter-to-letter homomorphisms, are always simplifiable. Thus, for example, no DOL system that is not a PDOL system is elementary. Hence, we get the following straightforward algorithm for testing whether a given homomorphism or a DOL system is elementary. We may assume that the given h : C* --t Ey is nonerasing. Let r be the maximum of the numbers Ih(u)l, where a E Z, and li the cardinality of C. Consider an alphabet C2 = {aI,. . . , a k - Then h is simplifiable if and only if it can be written as h = qf such that (1.6) is satisfied, and the maximum of the numbers I f ( a ) I , where a E C, and Ig(a)l, where a E C2, is less than or equal to P. Hence, the simplifiability of h can be decided by considering finitely many cases. (In particular instances this algorithm can be shortened considerably because most of the cases will be superfluous.)
18
1
SINGLE HOMOMORPHISMS ITERATED
It is also an immediate consequence of the definitions that a product of morphisms is simplifiable if one of the factors is simplifiable. The following necessary condition for a homomorphism to be elementary is sometimes very useful. For instance, it immediately implies that the homomorphisms (i) and (ii) above are simplifiable. Theorem 1.2. lf a homomorphism h : C* --* C y is elementary, then there is an injective mapping a : C -+ C, with the,following property. For each letter a of C,there are words x a and ya in Cy such that h(a) = xau(a)ya. Proof: Assume that there is no such injective mapping a. Then one can find a subalphabet C, of C with #(C2) = nz such that the cardinality of the union
C3 = IJ ulph h(a) U E Z 2
is less than i n . (The existence of such a C2 is explained in more detail in Exercise 1.12.) Define now two homomorphismsf‘and g by .f(u) = h(u)
for a E C,,
f (a)
s(a) = a
for a € C 3 ,
g(a’) = h(u)
= a‘
for U E C- C,, for u E X - C,
(Thus, we use also “primed versions” of letters belonging to C - C, .) Clearly, h = gf. The cardinality of the target alphabet of 1’is obtained by adding the cardinality of C - C, to the cardinality of C 3 . Consequently, the cardinality of the target alphabet off is smaller than the cardinality of C. This implies that h is simplifiable, a contradiction. 0
Exercises 1.1. Construct a context-sensitive grammar for the language presented in (i) Example 1.2, (ii) Example 1.7. (As regards the first, the details are given in [S4].) Observe how complicated the grammar is, when compared with the equivalent DOL system.
1.2. Study closure properties of the family of DOL languages. Prove, in particular, that the family is an anti-AFL, i.e., it is closed under none of the following operations: (i) union, (ii) catenation, (iii) catenation closure, (iv) intersection with regular languages, (v) homomorphism, (vi) inverse homomorphism. Can you find some positive closure properties for this family‘!
19
EXERCISES
1.3. Generalize Example 1.5 in the following way. Consider an alphabet X with 2n letters. Construct two DOL systems G and G I with the alphabet Z such that
E(G) f E(G,) but the sequences coincide with respect to the first 3n words. 1.4. Construct an algorithm for deciding whether or not a given locally catenative sequence is a DOL sequence.
1.5. Construct an algorithm for deciding the DOL sequence equivalence problem for two given locally catenative DOL sequences. 1.6. Study the membership problem for DOL languages. In particular, pay attention to the efficiency ofthe algorithm for solving this problem. (Cf. [VS].) 1.7. Construct an algorithm for solving the finiteness problem for DOL languages. In particular, establish the existence of an efficient bound n(G) such that, for deciding the finiteness of L(G), it suffices to examine the first n(G) words in the sequence E(G). 1.8. Use equation (1.2) to deduce a recurrence formula for the word lengths in the sequence E(G) of Example 1.6. 1.9 Give bounds, as sharp as possible, for the numbers p and q in Theorem 1.1. 1.10. We have seen that the product of two simplifiable homomorphisms is simplifiable. Prove that the product of two elementary homomorphisms is not necessarily elementary. (Hinr : consider the homomorphism h defined by the equations h(tr) = x y ,
h(h) = x z y ,
h(c) = xzzy,
h ( x ) = u,
h ( y ) = bc,
h(z) =
ba.
Prove that h is elementary, whereas h2 is simplifiable.) 1.11. What is the smallest alphabet E for which you can give two elementary homomorphisms
h,, h,:
c*-+ c*
such that the product h , h 2 is not elementary? 1.12. Establish the following combinatorial result. Assume that y is a mapping of a finite set A into the set ofsubsets of a finite set B. Then one of the following two conditions is satisfied. (i) There is an injective mapping h of A
I
20
SINGLE HOMOMORPHISMS ITERATED
into B such that, for every u in A, h(a) is in &). (ii) There is a subset A of A such that thecardinalityoftheunionofallsetsy(u,), whereu, rangesover A l , is less than the cardinality of A , .
2. BASICS ABOUT LOCALLY CATENATIVE SYSTEMS
In this section we shall investigate some of the basic properties of DOL systems that generate locally catenative sequences. These locally catenative DOL systems form one of the mathematically most natural subclasses of the class of DOL systems. Due to this fact and to the importance of locally catenative sequences in descriptions of biological development these systems were the subject of very active investigation from the very beginning of the theory of L systems. In spite of this one can conclude that a lot of very basic questions about locally catenative DOL systems remain without answers. In particular, at the time of the writing of this book it is still not known whether there exists an algorithm that will decide whether or not an arbitrary DOL sequence is locally catenative. Locally catenative formulas and sequences were defined in Section 1, so we start now by providing a formal definition of a locally catenative DOL system. DrJinition. A DOL system G is called locrilly cutenatice if E ( G ) is locally catenative. Furthermore, if E(G) satisfies an LCF u with some cut, then we say that G (or E(G)) is ti-locully cutenufive. 0
The following result expresses a basic property of locally catenative DOL systems. Since its proof is trivial, we leave it to the reader. Lemma 2.1.
Let G be a DOL system with E(G) = U J ~ .( I J ~ ., . . und let
u = (i,, . . . , ik) be u locully cutenutiue formula If'p 2 max{i,, . . . , i k } is such that w P = w p - i l. . . w p - i k r then E ( G ) is v-locully cutenutitie w i t h cut p.
Clearly, not every locally catenative sequence is a DOL (locally catenative) sequence, as shown by the following example. E.rutnpIt~2.1. Let T = w o ,a,,. . . be the infinite sequence of words defined by wo = u z , w 1 = ab, and w, = w,- , O I , - ~ for n 2 2. Thus T is a locally catenative sequence satisfying the LCF (1, 2) with cut 2 ; however, T is not a DOL sequence because in no DOL system does u2 derive ab.
2
21
BASICS ABOUT LOCALLY CATENATIVE SYSTEMS
Thus by considering DOL locally catenative sequences we consider only a subclass of the class of locally catenative sequences. The reader is also reminded of Exercise 1.4. However, we do not miss any LCF in the sense that for every LCF P , there exists a DOL system G such that E ( G ) is r-locally catenative. Theorem 2.2. For un))Iocully cutenutivej~rmulav = ( i l , . . . , ik),jbr every integer p 2 maxii,, . . . , ik},undjbr every sequence of integers I,, I , , . . . , 1,satisfying [he condition
I I I0 I I / , - I Il P - i l (2.1) there exists u PDOL sjsteni G such thut " '
+
+ . . . + l,-ik,
(i) E ( G ) = w O 7wl, . . . satisfies 1) M'ith cut p ; and (ii) / ( I ) , , = I,. . . . , ( o ) , - ~ I = l p - l . Prouf!f: Let G
=
(X,h, (11) be a PDOL system defined as follows:
c = { A y , . . . , Aj:',Ay', (I)
. . . , A!,", . . . , A?-", . . . , A 'IP, --] I ' } , = A p . . . A!:',
and h is defined by the productions
I (11,
= Alp1
=
1).
. . A'P1,-I
z, z,= ' ' '
. . .A"', I1 A;," + A ) ? ' .. . A);',
..., ...,
A;,' + A i l ) , Ail' + Ai2',
A'?' --t A\]', A']l' -+ A\2',
I)
+
'
(I)p-;l(I)p-i2
'
..
Hence, according to Lemma 2.1, E ( G ) is docally catenative with cut p . Since (2.1) assures that / I is well defined, the theorem holds. 0 The locally catenative property is a global property of a DOL system in the sense that its formulation does not depend on the set of productions of the
I
22
SINGLE HOMOMORPHISMS ITERATED
system. It turns out that this global property of a DOL sequence is equivalent to a global property of the underlying language. A DOL sjwtem G is locully cutenufive ifuiid only ifL(G)* is
Theorem 2.3. U,fillitC!/l,
gt'llt'rutt'd
Proof: Let G
=
I7lOt10id.
(1, 11, to) with E(G) = c o o , o i l , . . . .
(i) If G is locally catenative, then there exist a cut p and an LCF u = ( i l , . . . , ik) such that, for every n 2 p ? w , = O J ~ - . . . w,- i r . Hence L(G) c .(o,JO I i I p - I)* c L(G)* and so indeed L(G)* = K * where K = {mi 10 I i I p - 1 is a finite set. ( i i ) Let L(G)* = K * where K is a finite subset of Z*. We can assume that K is minimal in the sense that, for every x in K , x r$ ( K \ { x } ) * . Thus x E L(G) for every .Y in K . Let, for x in K , m ( x ) be the minimal integer such that h"l'.r'(w) = x and let p = max{m(x)lxe K ) 1. Since L ( G ) G K * , thereexist i l , . . . , ik such that f o p = wP-;, . . ' t o p - i k ,and so by Lemma 2.1 G is locally
+
catenative.
0
A natural direction in investigating locally catenative DOL systems is to look for local properties of a DOL system causing its locally catenative behavior. Here, I ~ c ~means il properties of the set of productions of a DOL system. At the time of writing of this book no local property of a DOL system equivalent to the global property of being locally catenative is known. However, we can take a step '' between and formulate for a DOL system a property that is both local and global (it is dependent both on the sequence generated and on the way it is generated), which is equivalent to the locally catenative property. Such a property, called covering, is now defined formally. "
Definition.
Let G
=
(Z, h, c u ) be a DOL system with E(G) = w,,, 2. We
(oI,. . . ; let 4 be a nonnegative integer; and let p be an integer, p 2 4 say that the striiuq ( I J ~is coiit'red by (oq if and only if there exist
+
(i) an integer k 2 2 ; (ii) strings y l , . . . , 1'k in I*such that wP = y , y 2 . . . (iii) integersq,, . . . , qkandstringsal, . . . , ! x k , / j l , . . . , f l k in Z*,such that for 1 1 j 1 k , y + 114,
wqJ=
M,(Oq/?,,
:',=
hp-4J((oq),
1'1 . . . y,-
,=
hP-qJ(C(,),
and 1
.
' '
yk =
hp-qJ(/?,).
If there exist integers y and p such that upis covered by uq,then we say that E(G) is cotwed by ~ I J and ~ , we also say that E ( G ) is coilrred. 0
2
23
BASICS ABOUT LOC'ALLY C'ATENA r l V E S Y S rhMS
I---
%
'I If
If
I/ If I/
I/ 1
I I I I I I I I I
\
-i \
\ \
\ \
\ \ \
The covering of (up by (oy can be illustrated as in Figure 1. Note that given foq, fo,,,. . . . , (olJhand we still have to know the appropriate contributions of the chosen occurrences of (oy in o J y , , . . . , ( o ~ , , , to ( o pto decide whether or not (opis covered by (fJ4 ("from (JJ,,,, . . . , (rJqk"). In this sense the covering property is both local and global: we have to know the s e q u e n c e d the way letters are rewritten i n it to formulate the covering property. We shall demonstrate now that being covered and being locally catenative are equivalent properties of DOL sequences. Theorem 2.4.
A DOL sequerice is locally catrrtaricr ifand orily if'it is
CCJVk'Vrd.
Proqf!f: Let G
=
(Lh, 01)
be a DOL system and let E(G) = coo, (o,, . . . .
(i) Let us assume that G is locally catenative. Thus there exist an LCF u = . . . mn- ih.
( i , , . . . , i k ) and a cut s such that, for every n 2 s, (on = o j n - i ,
24
1
SINGLE HOMOMORPHISMS ITERATED
Let d = max(i,, . . . , i k } and r = min{il, . . . , i k } . We shall show that if we set p = s + d and 4 = s - e , then w p is covered by w,. To see that the definition of covering is satisfied it suffices to set *rl
41 = s
=
+
IX, = c(k
=
(Os-il+d?
...
r),
. ..
(il
-
A, x 2
3
Yk
= ( f J s - i l +~ d ,
9
4k
=s
(ik
- e),
....
= i r + il. - 6'
iI+ i,, - e W , -
' '
'
('js - il% I iii --c
PI = 0,- i , + iI- <>WS- i, + i, - ',. . . (OS - i,, + i 82 =
+ ~
I
-
3
<>,
...-
A.
~ I J s - ~ , + ~ 2 - ~ , ( l J s - ; , + ~ ~ ~ , , ~ " / j~k ~= ~ ~ ~ ~ h + ~ ~ ~ ~ ~ ~
Then indeed for 1 I j I k , q y I .. .y j -
+ 1 I 4 j -= p , Q,, = ajc'~,/Ij,y j =
= hP-q~(ct~)
and
hP-4J(~l~q).
y j + . . . yk = h P - ¶ ~ ( / l j ) .
(ii) Let us assume that E(G) is covered, that is, for some p and 4, w p is covered bytu,. Usingthenotationfrom thedefinition ofcovering, we then have that =
Y1
' ' '
Yk = (")4+(p-qI)Qq+(p-q~)
' ' '
Oq+(p-qh)
-
"'p-(qi
and so by Lemma 2.1 E ( G ) is u-locally catenative where 11 4k - 4). 0 . a .
-4) '
' . (')p-(qh
= (41 -
dq)'
q, 42 - 4,
7
We shall turn now to the basic problem of deciding whether or not an arbitrary DOL system is locally catenative. As already pointed out several times, it is still not known whether this problem is decidable. However, we can show the decidability of a somewhat more restricted problem. Given an LCF u = ( i l , . . . , ik), we call d = max{i,, . . ., i k } its depth; and if a DOL system G is such that it is u-locally catenative, then we say that E ( G ) (or G itself) is locally catenatioe ofdepth d . In the rest ofthis section we shall show that, given an integer d , it is decidable whether or not an arbitrary DOL system is locally catenative of depth not larger than d . In proving this we shall demonstrate the usefulness of elementary homomorphisms, which will also be used in Sections 111.1 and 111.2 to prove the decidability of the DOL sequence equivalence problem. We start by observing that this problem has a rather easy solution in the case of injective DOL systems. A DOL system G = (X,h, w )is called injecfiue if h is an injective mapping of X*. Lemma 2.5. Let G be an injectiue DOL system with E ( G ) = w o , wl, . . . and let v = (i,, . . . , i k ) be an LCF of depth d. Then G is 11-locally cutenative if ...Wd-ih. and only i j t o r =
2
25
BASICS ABOUT LOCALLY CATENATIVE SYSTEMS
Proof: Let G = (C, h, (o). If ( f ) d = o)d-il. . . a d - i h , then by Lemma 2.1 G is v-locally catenative. If G is r-locally catenative, then there exists the minimal 11, say no, such that w,,, = ... If no > d , then we arrive at a contradiction as follows. We have w,,- I # w,,,,- - i , .. . w,,- - i h , but h(o),,-
1)
= w,,, = U J , , , - ~ ~ . . . o , , - ;= ~h(o,,,- I - i l
which implies that h is not injective.
. . . a,,,-
I -ir),
0
The above result implies a very simple solution for deciding whether or not the sequence E ( G ) = w o ,w1, . . . generated by an injective DOL system is locally catenative of depth d : simply check whether or not Wd is a catenation of strings from { Q ~ ., . . , a)& I } . We shall show now that the same holds for elementary DOL systems because an elementary homomorphism must be injective. Lemma 2.6. Let C be u $wife ulphubet with # C = m and let h be a homomorphism on X*. l f ' h i s not injective on C*,then there exist t < m and nonempt~words u 1 3. . . , u, such that,fbr every u in C, h(u) E { u l , . . . , u , } * .
Prooj: (i) If h is either erasing or 17 is not injective on C, then the result trivially holds. (ii) Let us then assume that h is nonerasing and that it is injective on C. Let CONTR be thcsct ofall countcrcxamples to the statement ofthisresult, that is, h ) where w l , w2 are distinct words CONTR is the set ofall 4-tuples ( Z i v l , over an alphabet X of 171 letters, h ( w l ) = h(w2),and there do not exist t < rn and words ul, . . . , u, such that, for every u in X, h(u)E { u l , . . . , u,}*. We shall prove, by contradiction, that CONTR is the empty set. To this end let C = [ X . . . . X,,; and let (X, N',,M ' ~ h, ) E CONTR. Also let l(C, w I , w z , / I ) = 1h(\v1)1. \ti2,
,.
(1) It must be that /(C, M ' ~ ,M ' ~ h, ) # 1. Otherwise, Ih(wl)l = Ih(w2)l = 1 and so I H . ~ I = I w 2 I = 1, which contradicts the fact that h is injective on X. (2) We shall show now that if /(I, H ' ~/I) , = 11 2 2, then CONTR must contain an element z with /(:) < I?, which, by ( l ) , yields a contradiction. X i , . ' . X ; , ~ its2 , = Xi,. . . X j r , # w z , / i ( \ v 1 ) = h(wZ), and = n 2 2. We have the following possibilities of interand \v2 (clearly k , r 2 2): relations between
So let
I/J(w,)~
=
it'1
=
~3~
I/?(M*~)~
(2.a) X I , = Xi,. Then if we set iFl = X I 2 . . . X i , , \T2 = X j L . . X i , , we have f i I # fi2and h ( K I ) = h(K2).Thus (1, \T,, Z 2 , / I ) is an element ofCONTR with
/(I, El, E2, / I ) < I l .
26
I
SINGLE HOMOMORPHISMS ITERATED
and h(Xi,) # h ( X j , ) .Then either h(X,,) is a strict (2.b) Xi, # X j , prefix of h(Xi,) or h ( X i , ) is a strict prefix of h ( X j , ) . Since these cases are symmetric, let us assume that h(Xi,) = h ( X j , ) zfor a nonempty word z. Let Y be a new symbol, = C\{ X i , u { Y } ,and let h be a nonerasing homomorphism on such that h ( Y ) = z and h(b) = h(h) forb in Z\{Xil}. Note that # E = # E = m. Let f be a nonerasing homomorphism on Z* such that f ( X i , ) = X j , Y andf’(X) = X for X # X i , . Let Wi = f(wi) for i = 1,2. Now W,and W 2have the following properties:
c*
(I) The first letters in W ,and W 2are the same. This holds because X j , is the first letter in both W ,and W2. (11) W , # W,. This holds because the second letter in W , is Y while the second letter in W, is an element of C. (111) h(wi) = h(wi) for i = 1, 2. This is proved as follows. Let X , E E. If r # i,, then , f ( X , ) = X, and h ( X , ) h(X,) = h(,f(X,)). If r = i,, then ,f(X,) = Xj, Y and
=
h ( X , ) = h(X,,)z = h(Xj,)h( Y ) = h(X,,)h( Y ) = h(Xj, Y ) = h ( . f ( X i , ) ) . Hence, for every X in C, h ( X ) = hf(X) and consequently, for i
h 1 ( W i ) = h(Wi).
=
1,2, h(wi) =
(z,
Now (I)-(111) imply that W,,W,,/ I ) is an element ofCONTR, which falls into case (2.a). Then (2.a) and (2.b) imply (2), while (1) and (2) together imply that CONTR is the empty set. Thus the lemma holds. 0
As a direct corollary of the above lemma we get the following useful result. The result will be further exploited and strengthened by a different technique in Section 111.1. Theorem 2.7.
An elementary homomorphism is injective.
Given a sequence t = m o , u,, . . . of words, ash# eft is any sequence of the form (ui, w i + . . . where i 2 0. One considers shifts of sequences when, for example, an initial portion of a sequence can be neglected, as already done in Section 1. Shifts occur also when one maps homomorphically one sequence into another, as for example by decomposing a simplifiable homomorphism of a DOL system. Then one obtains two DOL sequences that are “homomorphic shifts”ofeach other. As far as locally catenative sequences are concerned, the following is the basic property of homomorphic shifts.
,,
Lemma 2.8. Let t and T‘ be infinite sequences of nonempty words where words in t are over Z and words in are over C‘. Let h be a homomorphismfrom C* into (El)* such that h(t) is a shijt of’?‘.1j’t is v-locally catenatitre, then so is 5‘. TI
2
27
BASICS ABOUT LOCALLY CATENATIVE SYSTEMS
Proof: Let T = xo, xl,. . ., T' = y o , y , , . . . and let h(s) = y,, y u f l r . . for Someu 2 0. Let 1% = ( i l ,. . . , ik)andletpbesuch thatx, = xp-il. . . x ~ - ~ then ,.; yu + p
=
Nxp)
=
h(xp- i , ) . . . M x P - i h )
Consequently, T' is u-locally catenative.
=
y , +p -
i
, . . .y , +
-jh
.
0
Now we are ready to show that local catenativeness ofa bounded depth is a decidable property of DOL sequences. Lemma 2.9. Let G = ( C , h, o)he a DOL system with E(G) = W g , oil, . . . and Ict v = ( i l , . . . , ik) be an LCF of depth d. Then G is o-locally cutenutive if and O n l y l f W d + m = W d + , , - , , ' . ( I ) d + m - i h where m = #C. '
Proof: If q,+,, = ( C ) d + m - i l . . . o ~ + then ~ - by ~ Lemma ~ , 2.1 G is v-locally catenative. Let us assume that G is u-locally catenative. If G is elementary, then Lemma 2.5 implies that Old = O d - i , . . . W d - i k , and so Wd+m
=
Wd+m-il
"'Qd+m-ih.
If G is simplifiable, then there exists an alphabet Z 1 with # E l < #C and homomorphismsf; : C* -+ Cy,gl : C: --* C* such that h = glfl. Consider the DOL system G , = (XI, h l , cob')) with h l = f i g 1 and ob" = f l ( o ) . Note that f;(E(G))isequal to E(G,)andg,(E(G,))isashiftofE(G).Thus, by Lemma2.8 G I is docally catenative. If G I is simplifiable, then there exists an alphabet C, with # X 2 < # X and homomorphisms .f;: C: + Xy , g2 : C y + X* such that h l = g 2 . f 2 . Then we obtain the DOL system G 2 = (C,,h 2 , wb')) with h2 = .f2q2 and (ob" = ,/>(u&"). Again , / i ( E ( G , ) )equals E ( G 2 )a n d y,(E(G,)) is a shift of E ( G , ) . Consequently, 1;f i ( E ( G ) )equals E ( G 2 ) and gIg2(E(G2))is a shift of E(G). Continuing in this way, in t steps for some t < m, we get an elementary DOL system G, = (X,,h , , wg') with h, = f t g , and w $ ) = f t ( w r - ; ) where f ; . . .fI(E(G)) equals E(G,) and q 1 ...g,( E(G,))is a shift of E(G). Hence G, is o-locally catenative, and, moreover, by Theorem 2.7 and Lemma 2.5, = w d( f i)l . . . crijl! i h where E(G,)= I):', a$), . . . . Since, for every j 2 0, and so, because g l ...y,( w)") = ( u j + , ,weget that a d + , = Thus the lemma holds. 0 t < m, (ud+", = ( I ) , , + , , - ~ , . . . The above lemma yields immediately the aforementioned result. Theorem 2.10. I t is decidable f o r an arbitrury positive integer d andjor an arbitrury DOL system G whether or not G is locally catenatiue of depth no greater thun d.
Given an LCF o = ( i l , . . . , ik),we call k its width. It is very instructive to compare the above result with the result from [ R u ~ ] ,which says that it is
28
1
SINGLE HOMOMORPHISMS ITERATED
decidable for an arbitrary positive integer d and an arbitrary DOL system G whether or not G is locally catenative of width no greater than d. (See Exercise 2.8.)
Exercises 2.1. LetGbeaDOLsystemsuchthatE(G) = coo, w l , . . .satisfiesthelocally catenative formula (2.1) with a cut p . Show that if #alph w p - 2 = 1 and I w p - , J > 1,then # a l p h w , - , > 1.
2.2. Construct an example of a DOL system G such that L ( G ) is infinite, E(G) = cvo, wl, . . . is such that, for every i 2 0, wi is a prefix of m i + and wi is a suffix of wi + but G is not locally catenative.
2.3. Show that the reverse of Lemma 2.8 is not true in general (that is, it can happen that z' is locally catenative but T is not). 2.4. Let G = (C, h, w ) be a PDOL system with w E C. The dependence graph ofG, denoted O(G),is the directed graph whose vertices are elements of C and in which there is an edge leading from a to b only if a E alph h(b). We say that G is dependent if and only if every cycle in O(G) goes through (0.Assume that L(G) is infinite and that G is propagating.
(i) Prove that if G is dependent, then E ( G ) is covercd by the axiom of G. Is the converse of this statement true? (ii) Prove that if G is dependent, then G is locally catenative. (iii) What is the relationship between the property of G being dependent and the property of E(G) being covered? (iv) Are the properties stated in (i) and (ii) true if it is not required that G is both propagating and L(G) is infinite? (Cf. [RLi] and [HR].) 2.5. Let G = (C,h, o)be a DOL system.
(i) Let ~ E C . (i.1) We say that a is morral if h'(a) = A for some i 2 1 ;the set of all mortal letters in G is denoted by M(G); (i.2) w-recursive if h'(a) E C*aC* for some i 2 1; the set of all w-recursive letters in G is denoted by R(G); (i.3) monorecursiue if h ' ( a ) ~M(G)*uM(G)* for some i 2 1 ; the set of all monorecursive letters in G is denoted by MR(G), (i.4) expanding if h'(a) E C*aC*aC* for some i 2 1;the set of all expanding letters in G is denoted by EX(G).
3
BASICS ABOUT GROWTH FUNCTIONS
29
(ii) The nssociutrd graph qf G, denoted AD(G), is a directed graph obtained from the dependence graph of G (see Exercise 2.4)by reversing the direction of every edge in it. (iii) A srrorig component of AD(G) is a maximal subgraph of AD(G) such that any two vertices of it are mutually reachable (by a sequence ofedges). The condensarion of AD(G), denoted CAD(G), is a directed graph obtained from AD(G) by taking strong components as vertices and establishing an edge from a strong component X to a strong component Y only if X and Yare different strong components of AD(G), X contains a vertex b from AD(G), Y contains a vertex c from AD(G) and AD(G) contains an edge from b to c. (iv) The recursive structure of G,denoted RS(G), is a directed graph obtained from CAD(G) by taking as vertices all vertices from CAD(G) containing a w-recursive letter from G and introducing an edge from a vertex b to ii vertex conly if there is a sequence of vertices u l , . . . , v, in CAD(G) such that u1 = h, v, = c where none of the vertices v 2 , . . . , 0,contains a w-recursive letter from G.Prove that if G is locally catenative, then RS(G) is a directed tree with paths of length at most 1 such that its root is a strong component with the set of vertices equal EX(G) and the union of sets of vertices of all leaves equals MR(G). (Cf. [V4] and [V5].)
2.6. For a given locally catenative DOL system G,let Y ( G ) denote the set of all locally catenative formulas that are satisfied by E(G). What can you say about "(G) in general? Can you provide necessary (and sufficient?) conditions for two locally catenative formulas v 1 and u2 to belong to the same Y ( G ) for some DOL system G ? (Cf. [RLi] and [HR].)
2.7. Let i 2 2 be given. Prove that it is decidab'k for an arbitrary DOL system G and a regular language K (given by a finite automaton) such that (L(G))*(L(G))'= K whether or not E(G) is locally catenative. (Cf. [ R u ~ ] . ) 2.8. Prove that it is decidable for an arbitrary positive integer d and an arbitrary DOL system G whether or not G is locally catenative of width no greater than d. (Cf. [Ru~].)
3. BASICS ABOUT GROWTH FUNCTIONS
The purpose of this section is to investigate word length sequences ( w o I , I w 1 1, I w 21, . . . obtained from a DOL sequence E(G) = w o ,wl, w 2 ,. . . . Such a sequence determines in a natural way the function f such that the value f(n), n 2 0, is defined to be the number I w, I in the sequence. This function is referred to as the growthfuricriori of the DOL system G. Thus, when studying growth functions we are not interested in the words themselves but only in
30
1
SINGLE HOMOMORPHISMS ITERATED
their lengths. This section gives the basics ofthe theory; more advanced topics are dealt with in Chapter 111. The theory of growth functions is of interest, apart from many direct applications, also because a number of important problems concerning sequences and languages can be reduced to problems concerning growth functions. Definition. defined by
Given a DOL system G = (C,h, coo), the function f,: N
f A n ) = Ih"((wo)I,
(3.1)
+
N
n 2 0,
is termed the growthfunction of G, and the sequence
(3.2)
n = 0, 1, 2 , . ..,
Ih"(w,)I,
its growth sequence. Functions of the form (3.1) are termed DOL growth functions (resp. PDOL growth functions if G is a PDOL system). Number sequences of the form (3.2) are termed DOL (resp. PDOL) length sequences. Exuritplr 3.1. It was verified in Section 1 that if G is the DOL system of Example 1.1,1.2,1.3, or 1.7, respectively, thenf,(n) is equal to n + 2,2", 2"+2, or the nth Fibonacci number, respectively. Consider now the PDOL system G I with axiom a and productions
a + abc2,
b + hc2,
c + c.
Thus, the sequence E ( G , ) begins with the words
a, abc2, abc2bc2c2, abc2bc2c2bc2c2c2,. . . . It is easy to verify that, for all n 2 0, fc,(n)
=
1
+ 3 + 5 + . . . + (2n + 1)
and that fc,(n
+ 1) = fc,(n) + 2n + 3.
Either one of these facts implies that fc,(n) = ( n + 1)2. We leave it to the reader to show along similar lines that, for the PDOL system G2 with the axiom a and productions
a -P ubd6,
+
b 4 bed",
c + cd6,
d
+
d,
we havef,,(n) = ( n l)3. These examples give some indication what DOL growth functions look like: they are polynomials, exponential functions, or combinations of the two (in a sense to be made precise in Theorem 3.5). As regards nonzero polynomials
3
31
BASIC'S AHOU'I' GROWTH FUNCTIONS
P(n) with rational coefficients, the following condition is necessary for such a P ( n ) to be a DOL growth function: (i) P ( n ) has to be a positive integer for nonnegative integer values of the argument 17. (Note that if a growth function satisfies ,/;(no) = 0, then also &(n) = 0 for all 17 2 no. Thus the only polynomial assuming the value 0 that is a growth function is the zero polynomial.) It turns out that any polynomial P ( n ) satisfying (i) is a DOL growth function. Moreover, any finite number of such polynomials Pl(n), . . . , Pk(n) with the same degree can be merged into the same DOL system G in such a way that each Pi(n)is thegrowth function ofsomeofthedecomposition factors G(k, j);this result will follow by the theory developed in Chapter 111. We first deduce a matrix representation for the growth function of a DOL system. Although this representation is very simple, it forms the basis for all more advanced results. Consider a DOL system G = (C,h, w0)with C = { a l , . . . , ak}. For a word w over C,we denote by #i(w) the number of occurrences of the letter ai in w, for i = 1,. . . , k . Thus,
.fc
The growth matrix associated to G is defined by #I(h(al))
'.'
#k(h(al))
# I(h(ah))
'
..
# k(h(ak))
M = [
Den0 t ing n = ( # l((f)O), . . .
?
#k(WO))?
v
= (1,
. ..
9
where T stands for transpose, we conclude by induction on n that nM",
n 2 0,
is a k-dimensional row vector whose ith entry, i = 1, . . . , k , equals the number of occurrences of ai in (on.This yields the matrix representation (3.3)
.fb(n) = 7tM"q.
Either from this representation or directly from the system we conclude the existence of two numbers p and y such that, for all n, (3.4)
.f&) 5 PY".
We can choose p to be the length of the axiom coo and y to be the length of the longest among the words h(u),a E C. Thus, DOL growth is at most exponential. We summarize these observations in the following theorem.
32
1
SINGLE HOMOMORPHISMS ITERATED
Theorem 3.1. The growth function fG(n)of a DOL system can be written in the form (3.3). There are constants p and q such that (3.4) holds for all n.
Intuitively, the matrix representation (3.3) expresses the fact that all information needed to compute &(n) is contained in the numerical values of the entires of x and M , i.e., the order of the letters is immaterial. From the mathematical point of view this means that, instead of C*, we consider the free Abelian monoid generated by C and the endomorphism induced by h on it. This endomorphism can be defined by the matrix M . The matrix representation (3.3) for growth functions has the special properties that (i) all entries in q are equal to 1, and (ii) all entries in II, M , and q are nonnegative. We now define more general functions, obtained by omitting these restrictions. Defniriun.
A function f : N
+
N is N-rational if it can be expressed in the
form
(3.5) f ( n ) = nM"q, where II is a row vector, q a column vector, and M a square matrix, all of the samedimension and all with nonnegative integer entries. A function f :N + Z is Z-rational if it can be expressed in the form ( 3 . 9 , where II, q, and M are as above but now the entries may be arbitrary integers. The terms " N-rational" and "Z-rational" are extended to concern sequences of integers in the natural way. For reasons behind the use of this terminology, the reader is referred to [SS]. Basically, N-rational (resp. Zrational) sequences are the same as the sequences of coefficients in an N rational (resp. Z-rational) formal power series in one variable. The notions of an N-rational and Z-rational function are very useful in the study of DOL growth functions, as will be seen below. Whereas a Z-rational function has, because of the possible negative entries in the matrices, no direct interpretation in terms of growth functions, such an interpretation is immediate for N-rational functions. Indeed, an N-rational function differs from a DOL growth function only in that the entries of q can be arbitrary nonnegative integers instead of 1s. Let us discuss this difference in more detail. Assume first that theentries of q in an N-rational function (3.5) are all 0s and Is. This means that we do not get the length sequence (3.6) Iw1I9 l%lr ... of a DOL system but rather the length sequence obtained from (3.6) by disregarding certain letters in the words m i , namely, the letters corresponding to the entries 0 in q. In the general case where the entries of q are arbitrary nonnegative integers, we get similarly the length sequence obtainable from (3.6) by multiplying the number of occurrences of each particular letter a j by the 1%19
3
33
BASICS ABOUT GROWTH FUNCTIONS
corresponding entry in q. (Using the terminology defined later on, this means that N-rational functions coincide with the growth functions of HDOL systems.) But it is easy to see (cf. Exercise 3.2) that the special case considered first (i.e.,each entry of q is either 0 or 1) is sufficient to generate all N-rational sequences. The following example illustrates the difference between an N rational function and a DOL growth function. Exampkt 3.2. matrices
An N-rational function f is defined by the 4-dimensional 71 =
(1 0
1
-;; !I,
O),
M=
q
=
0 0
(1
1)T,
0 0 1 0
Then (3.7)
f'(2n)
=
1,
f(2n
+ 1) = 2 " + l
for all n.
This result is easy to verify if we consider the DOL system G with the axiom u1u3(corresponding to n) and productions u, + a 2 ,
u2 + a , ,
u3 + a ; ,
u4 + u 3
(corresponding to M). Instead of the sequence E ( G ) ,we consider the sequence obtained from E(G) by erasing (according to q ) all occurrences of u2 and u3 : 2
4
u,, a4, u1, u4,
Ul,
8
u4,
....
Denoting this sequence by oh, w',, tu;, . . . , we see that, for all n 2 O , f ( n ) =
141. The previous example shows that N-rational sequences can be decomposed into parts with quite different growth orders, such as, for example, constant versus exponential growth in (3.7). As will be seen in Theorem 3.8, such a decomposition is not possible for DOL length sequences. It will also turn out that this is the only difference between a DOL growth function and an N rational function. We now begin a closer examination of DOL growth functions. For this purpose, it is useful to speak of yetierurinyfunctions in the same sense as is often done in combinatorics. For a DOL system G, the grnrrutiny,firnc.rio,l ofJG is defined to be the formal power series
c .fdn)x". I;c'
(3.8)
N Y )
=
n=O
34
I
SINGLE HOMOMORPHISMS ITERATED
Thus, x is here merely a formal variable. However, we can regard (3.8) also as an ordinary Taylor series. Because of the bound given in Theorem 3.1, this Taylor series has a positive radius of convergence. The following theorem gives a characterization for the generating functions of DOL growth functions. The theorem is of basic importance from the point of view of many applications. Theorem 3.2. fG
Let F(x) he the generating,function of’the growth junction
o f a DOL system G. Then one can eflectively determine polynomials P ( x ) and
Q ( x ) with integer coeficients such that the identity
(3.9)
P(x) = ( 1 - Q(x))F(x)
holds true (i.e., each power xi, i 2 0, has the same coeficient on both sides of (3.9)). Moreover, the coeficient o f x o in Q ( x ) is 0, und the degrees of Q ( x ) and P ( x ) are respectively at most k and k - 1, where k is the cardinality of the alphabet of G. Proof: We first compute the characteristic polynomial C of the growth matrix M associated to G. The degree of C is at most k. Denote by I the identity matrix of dimension k , and consider the matrix I - M x . For any square matrix M ’ ,we denote by det(M’) the determinant of M’. Then it is immediately verified that
det(I - M x ) = x k C ( l / x ) . This implies that I - M x is nonsingular, i.e., ( I - M x ) - ’ exists. (More specifically, I - M x has an inverse in the quotient field of the integral domain Z ( x ) , where Z ( x ) is the set of formal polynomials with variable x and integer coefficients.) Thus, using the definition of F ( x ) and the matrix representation (3.3) for fc, we obtain det(l - M x ) F ( x ) = det(I - M x )
det(I - M x ) ( ( I - M x ) - ‘ ( I - M x ) )
=
n(det(1 - M x ) ( I - M x ) - ’ ) q .
3
35
BASICS ABOUT GROWTH FUNCTIONS
Choose now Q ( x ) = 1 - det(l
-
Mx),
P ( x ) = n(det(1 - M x ) ( l - M x ) - ’ ) q .
By this choice (3.9)will be satisfied. Furthermore, the additional requirements concerning Q ( x ) and P ( x ) will also be satisfied, the assertion concerning the degree of P ( x ) being true by the formula for the inverse of a matrix. 0 Our first application of Theorem 3.2 will concern the growth equivalence of two DOL systems. We say that two DOL systems G and G’aregrowthequivulerit if f c = f & . By Theorem 3.2 the generating function of fc (resp. f c . ) can be expressed as the quotient of two polynomials
P(x)/(l
Q(x))
-
(resp. P’(x)/(l - Q’(x))).
Thus, to decide growth equivalence, it apparently suffices to check whether or not the polynomials
P(x)(l
-
P’(x)(l - Q ( x ) )
and
Q’(x))
are identical. However, the algorithm given in the following theorem is even much more straightforward. Theorem 3.3.
Let G und G’ be DOL systems with the word sequences
E(G) = coo, w I , . . .
and
E(G’) = wb, w ; , . . . .
Let k and k’ be the cardinalities qfthe alphabets ojthese systems. Then G and G‘ rrrr yrorz‘th ~ y u i i v r l e n tif und only ij
(3.10)
for 0 2 i 2 k
((o,I = lwil
+ k’
-
1.
Proqf: Clearly, the growth equivalence of G and G’ implies the equations (3.10).Assume, then, that G and G’ are not growth equivalent. Let
(3.11)
F(x) = P(x)/(l - Q ( x ) )
(resp. F’(x) = P’(x)/(l - Q’(x)))
be the generating function of the growth function of G (resp. G’). Thus, by our assumption F ( x ) - E’(x) is not identically 0. By (3.1 1) we obtain the identity ( F ( x ) - F’(-x))(l - Q ( x ) ) ( l - Q’(x)) = P ( x ) ( l - Q’(x)) - P ( x ) ( l - Q(x)).
Theorem 3.2 implies now that the right-hand side is of degree at most k k‘ - 1. Therefore, F ( x ) - F’(x) must contain a term tlixi,
cli
# 0, i 5 k
+ k’ - 1.
But this means that (3.10) is not satisfied. 0
+
I
36 Exutnp/c3..3.
SINGLE HOMOMORPHISMS ITERATED
Consider the DOL system G I with the axiom a and
productions a
-+
ab3,
b
+
b3,
as well as the DOL system G, with the axiom a and productions a
-+
ucde,
b -+ cde,
c
+
b2d2,
d
+
d3,
e
+
bd.
The first seven numbers in the length sequences of both systems are 1, 4, 13, 40, 121, 364, 1093.
Hence, by Theorem 3.3 G I and G, are growth equivalent. The algorithm obtained from Theorem 3.3 for testing the growth equivalence of two DOL systems, i.e., computing the lengths of the first k + k‘ words in the sequences, is very simple indeed, both as regards the proof of the theorem and as regards the resulting procedure. Also cases like Example 3.3, where the word sequences are quite different in the two systems, are easily taken care of by this procedure. The bound k + k’ for solving the growth equivalence cannot be further reduced; cf. Exercise 3.3. Thus, if we have two DOL systems with the same alphabet of cardinality k, we check the lengths of the first 2k words in the sequences to decide growth equivalence. The reader is asked to contrast the algorithm for deciding growth equivalence to those for deciding sequence and language equivalence presented in Chapter 111. It will turn out that the latter algorithms are much more complicated. Also, the proof of decidability will be much more involved than the proof of Theorem 3.3. We now list some typical problems in the area of DOLgrowth functions. We already discussed and solved the growth equivalence problem. The analysis problem consists of determining the growth function of a given system. T o make the statement of this problem precise, one would have to specify what “determining” here actually means. Theorem 3.2 gives a method of computing the generating function of a growth function. This method can certainly be viewed as one solution to the analysis problem. Another solution will result from Theorem 3.4 below. The converse problem, the synthesis problem, consists of constructing, if possible, a DOL system whose growth function equals a given function. Again, to make this problem precise one has to specify how the function is given. A natural way is to consider Z-rational functions, given by their matrix representation. A general solution to the synthesis problem formulated in these terms will be obtained in Chapter 111. At the same time the following stronger versions of the synthesis problem will also be solved: (i) cell number minimizarion problem: synthesize a given function using a DOL system with
3
37
BASICS ABOUT GROWTH FUNCTIONS
the smallest possible alphabet; (ii) merging problem: given t 2 1 sequences of nonnegative integers
. . . ,.
ubo', a:'), a\'), . . . ;
ab'-l)
7
a(f-l) 1
3
ag-l)
5
*..,
construct, if possible, a DOL system G such that fc(tn
+ i) = a t )
for all n 2 0 and 0 2 i 2 t - 1.
Thus, the given functions appear as growth functions in a decomposition of G . (Cf. also Exercise 3.7.) Our next theorem gives another solution to the analysis problem. It can also be used to prove that certain functions are not DOL growth functions. Theorem 3.4. sion formula
(3.12)
fc(n
The growth function fc of a DOL system G sarisjes a recur-
+ k ) = C k - l f G ( n + k - 1) + . . . + co f'(n),
for all n 2 0, where k is the cardinality ofthe alphabet of G.
Prm$ Consider again the matrix representation (3.3). Since M satisfies its own characteristic equation, we obtain first Mk = Ck-lMk-'
+ . . . + c , M + CoMO,
whence (3.12) now follows by multiplying both sides with 7c from the left and rl from the right. 0 (3.12) is a linear homogeneous difference equation with constant coefficients, obtainable effectively from the definition of G. The method for solving such difference equations is well known in classical mathematics (cf. [MT]) and gives us another solution to the analysis problem. We illustrate this method first by the following example. Exutnple 3.4. Suppose we have to determine the growth function fc of the DOL system G with the axiom abc and productions u + a2,
b + a5b,
c --* b3c.
The growth matrix
is now in lower diagonal form. Therefore, it is very easy to determine the roots PI = P2
= 1,
P3
=2
I
38
SINGLE HOMOMORPHISMS ITERATED
of its characteristic equation. By the theory of difference equations, we obtain now fG(n) = (a1
+ ~ ~ 2 n1") .+ a, .2".
[Thus a polynomial of degree t - 1 corresponds to a root of multiplicity t . ) The values of the parameters al, a 2 ,a3 have to be determined from the initial conditions, i.e., from the first few numbers in the length sequence. This gives us a system of equations fG(0) =
3 = a1 f
fG(1) = 12 =
fG(2)
= 42 = a1
a39
+ a2 + 2a3, + 2c(2+ 4a3,
whence we obtain, finally,
-
fc(n) = 21 2" - 12n - 18.
0
The analysis procedure of the previous example is valid in general. Thus, we first solve the characteristic equation for M . (As usual, we assume that the given system is reduced.) For each root p of multiplicity r, there corresponds a term (3.13)
(ao
+ a l n + ... + a,-,n'-')p"
in the expression for fc(n), i.e., fc(n) is the sum of terms (3.13), where p runs through all the roots. The parameters a are determined by the initial conditions, i.e., by the first numbers in the length sequence. There are some caveats in this procedure. (i) The root p = 0 has to be treated separately. Essentially, its presence gives rise to a difference equation of smaller order. (Cf. Exercise 3.5.) (ii) It is by no means the case that the resulting expression for fc(n) will be as simple as in Example 3.4. The roots p may be very complicated, sometimes even not expressible in terms of radicals; cf. Exercise 3.6. We summarize the main content of this discussion in the following theorem. Theorem 3.5.
rf
.fh i s a DOL growth function, then S
fG(n) =
CPi i= 1
for
n 2 no,
where each of the terms pi is of the,form (3.13).
The following corollary of Theorem 3.4 is sometimes very useful for showing that certain functions cannot be DOL growth functions.
3
39
BASICS ABOUT GROWTH FUNCTIONS
Theorem3.6. Nofunctionf :N -+ N such that,for every natural number n, there are natural numbers m and i > n with the property
(3.14)
f(m
+ i ) # f ( m + n ) = . f ( m + n - 1) = ... = f ( m ) ,
is a DOL growth junction.
Pro?$ Assume that such an f is a DOL growth function and consider (3.12). Choose n = k. Thus, there is an m such that
.f(m + k ) = f ( m + k
- 1) =
... = f(m).
Consequently, by (3.12) f(m
+ k + 1 ) = C k - l f ( m + k ) + ... + c o . f ( m + 1) = Ck-lf'(m+ k - 1) + . * .+ c o f ( m ) = f ( m + k).
In the same way it is shown that, for ail i, f(m
+ k + i) = f ( m + k).
Hence, the inequality in (3.14) cannot be satisfied, a contradiction.
0
We say that a functionf: N + N is (ultimately) exponential if there exist a real number t > 1 and a natural number no such that f ( n ) > t"
for all n 2 no.
The function f is pol.vnomially bounded if there exists a polynomial P(n) such that f ( n ) < P(n)
for all n.
Thus, functions with growth order nlognor 2+n are neither exponential nor polynomially bounded. However, it follows from Theorem 3.5 that such functions cannot be DOL growth functions. Indeed, the order of growth of a DOL growth function fG is determined by the greatest modulus I p 1, where p ranges through the roots appearing in the sum. If this modulus is less than or equal to 1, then it is immediate thatf, is polynomially bounded. On the other hand, if this modulus is greater than 1, then fG is exponential. This follows because (cf. Exercise 3.1 1) no cancellation of the roots with greatest absolute value can take place. Thus, we obtain the following Theorem 3.1.
Every DOL growth function is either exponential or poly-
nomiallv bounded.
The discussion above gives also an algorithm for deciding whether or not a given DOL growth function ,fG is exponential, by deciding where the roots
I
40
SINGLE HOMOMORPHISMS ITERATED
of the characteristic equation for M lie (cf. Exercise 3.12). One can give also a more direct combinatorial algorithm (cf. Exercise 3.1 3). The following subclasses of polynomially bounded DOL growth functions are of special interest: (i) functions becoming ultimately zero, and (ii) functions bounded by a constant. In both cases the language of the DOL system is finite. In addition, in case (i) all letters derive the empty word in some number of steps. The interconnection to the roots of the characteristic equation is indicated in Exercise 3.10. We prove finally the following property typical of DOL growth functions. Theorem 3.8. Assume that f ( n ) is a DOL growth function not becoming ultimately zero. Then there is a constant c such that f(n
+ l)/f ( n ) 5 c
for all
n.
Proofi We may choose c to be the length of the longest right-hand side among the productions of the DOL system. 0
It is immediate by Example 3.2 that Theorem 3.8 cannot be extended to concern N-rational functions. It will be seen in Chapter 111 that this constitutes essentially the only difference between N-rational functions and DOL growih functiow.
Exercises
3.1. Modify the DOL system G presented in Example 3.4 in such a way that the axiom is aPbqcr,where p , 4, r 2 1. Determine the growth function. 3.2. Prove that every N-rational function possesses a representation where each entry in the final column vector is either 0 or 1. 3.3. Show by an example that the bound given in Theorem 3.3 is the best possible. 3.4. Assume that G and G I are DOL systems with the same alphabet 1 of cardinality k. Prove that the sequences E(G) and E ( G , ) are Parikh equivalent (i.e., determine the same sequence of Parikh vectors) if and only if they are Parikh equivalent with respect to k + 1 first words. 3.5. Discuss the analysis procedure presented in Example 3.4, paying special attention to the influence of the number 0 appearing among the roots. Observe that the multiplicity of the 0-root indicates a bound from which the equation in Theorem 3.5 is valid. As an example consider the system with the axiom uhc and productions a + be, b + A, c + A.
3
EXERCISES
41
3.6. Give an example of a case where the roots of the characteristic equation (resulting from a PDOL system) are not expressible in terms of radicals. (Cf. [Rul].) 3.7. Consider the following more general notion of merging. The given t functions must appear as growth functions in a decomposition of the constructed system G ; but, in addition, some other functions may appear as growth functions in the decomposition factors of G. (This means that the number t I of the decomposition factors may be larger than t . ) Prove that this more general notion is equivalent to the one given in the text: if the given functions are mergeable in the wider sense, they are also mergeable in the narrower sense. 3.8. It has been customary to classify DOL growth functions using the following numbering system. Exponential functions are referred to as functions of type 3. Functions becoming ultimately 0 are of type 0. Functions not oftypeoand bounded byaconstant areoftype 1. All the remaininggrowth functions are of type 2. (Thus, the class of functions of type 2 consists of polynomially bounded functions that are not bounded by a constant.) Prove that the type is always preserved in decompositions: the growth function of every decomposition factor is of the same type as the growth function of the original system.
3.9. Consider “DOL schemes,” i.e., DOL systems without the axiom. When an axiom w is added to a scheme H , we get a DOL system H(w).The growth type combination of a scheme H is the subset of (0, 1,2, 3}, consisting of all numbers i such that, for some w , the growth type of H(w) is i. Prove that in a growth type combination the number 2 never occurs without the number 1 but all other combinations are possible. (Cf. [Vl].) 3.10. Study interconnections between the roots of the characteristic equation and the function being of types 0 and 1. (As usual, the system is assumed to be reduced.) Prove that the function is of type 0 if and only if every root equals 0. Prove that if all roots are roots of unity and simple, then the function is of type 1. Note that the reverse implication is not valid by considering the system with axiom ah and productions u --* u and b -, h.
3.1 1. Assume that a l , . . . , a, are distinct nonzero complex numbers and PI, . . . , P, complex polynomials. Prove that if
for every large n, then all the P i are zero polynomials. (This result shows that no cancellation of the roots with the greatest absolute value can take place.)
I
42
SINGLE HOMOMORPHISMS ITERATED
3.12. Describe an algorithm for finding out where the roots of the characteristic equation lie (with respect to the unit circle.) 3.13. Establish the following result (cf. [S3]) which gives a direct algorithm for finding out whether or not a given DOL growth function is exponential. The growth function of a DOL system G is exponential if and only if G has a letter b deriving (in some number of steps) a word containing two occurrences of b. 3.14. A further modification of the previous exercise is the following result. The growth function of a DOL system is exponential if and only if some power M P with p 5 2k k - 1 of the growth matrix M whose dimension is k possesses a diagonal element greater than 1. Establish this result. (Cf. [K3]:)
+
3.15. Assume that a DOL growth function f not identically zero has the following property. For every positive integer m, there are integers m, 2 m and no such that rno dividesf(n) whenever n 2 n o . Prove (by an induction on the degree of the polynomial) that f cannot be polynomially bounded. 3.16. Prove that it is decidable whether a given DOL language is (i) regular, (ii) context-free. See [S7] and also [Lil]. 3.17. This final exercise deals with periodicities in DOL sequences. It turns out that the prefixes (of some fixed but arbitrary length) of the words in any DOL sequence form an ultimately periodic sequence, the same being true of the suffixes. Furthermore, the length of the period does not depend on the length of the prefix (or suffix). Let w o , wl,. . . be a DOL sequence consisting of infinitely many different words. Prove that there exists a positive integerf such that, for every positive integer k , there exists a positive integer n such that, for every i 2 n and for every nonnegative integer rn, (a)
preh - i (mi)= preh - i (mi+ mf)
and
Wi - i (oi)= ~uh- I (mi+ ms).
(This is Theorem 11.3. in [HR].) Strengthen this result by showing the existence of two positive integers C1 and f such that, for every positive integer k, there exists a positive integer n with the property n 5 Cl(k - 1) and such that, for every i 2 n and for every nonnegative integer m, the equations (M) are satisfied. (Cf. [ELR].)
Single Finite Substitutions Iterated
1. BASICS ABOUT OL AND EOL SYSTEMS
In this chapter we take a next step in the systematic investigation of L systems. In Chapter I we have considered DOL systems that were based on the idea of iterating an endomorphism on a free monoid C*. Now we move to iterating a single finite substitution on a free monoid; this leads us to OL systems. From the mathematical point of view such a generalization is very natural: rather than allowing only singletons we now allow finite sets to be images ofelements from Z. From the formal language theory point of view this corresponds to transition from deterministic to nondeterministic rewriting: in each rewriting step for each letter we now have a finite number of possible rewritings rather than only one. In this section we shall look into the most basic properties of OL systems and then we shall further extend our definition by allowing a OL system to use symbols that do not occur in the strings of the language it generates; such systems will be termed EOL systems. We start by considering OL systems. A OL system is a triple G = (C, h. Q) where C is an alphabet, DrJnition. h is a finite substitution on E (into the set of subsets of C*), and (0,referred to as the axiom, is an element of Z*. The language of G is defined by L(G) =
ui,,
hi(oJ); we also say that G generates L(G). 43
1I
44
SINGLE FINITE SUBSTITUTIONS ITERATED
Example 1.1. For the OL system G = ({a},h, a') with h(a) = {a, a'}, we have L(G) = { d i n 2 2). Example 1.2. For the OL system G = ( { a ,b } , h, ab} with h(a) = {(ab)'} and h(b) = {A}, we have L(G) = {(ab)'"ln 2 0). Example 1.3. For the OL system G = ( { a ,b } , h, a) with h(a) = h(b) = { ~ u , a h , h a , b b } , w e h a v e L ( G ) ={ a } u { ~ ~ { u , h=2"forsomen ) ~ ~ ~ x ~ 2 I}. Remark. As in the case of DOL systems, the finite substitution h will often be defined by listing the productions for each letter. Such a definition in Example 1.1 would be G = ({a}, { a + a, a a * } , a'); in Example 1.2, G = ( { a , b } , { a (ab)', b + A}, ab); and in Example 1.3 it would be -+
-+
G = ( { a , b}, { a
-+
ab, a ba, a + bb, b + aa, b -+ ab, b
aa, a
-+
-+
-+
ba, b
-+
bb}, a).
In this way we write a 2 a for a E h(a). Also for x in C* we define, for i 2 1, L'(G, x) = { y ~ C * lh'(x)} y ~ and we set Lo(G, x) = {x}; hence L(G) = L'(G, 0).We also write L'(G) for L'(G, w). Then we use language theoretic notation and terminology as follows:
ui,, x
y, x d i r e d y deriues y (in G ) if y E L'(G, x);
x
y , x derives y in n steps (in G ) if y E L"(G,x);
x x
$ y, x really derives y (in G ) if y E L"(G, x) for some n 2 1 ; and y, x derives y (in G ) if y E L"(G,x) for some n 2 0.
We also make the convention that A =-A. As usual we often write 3, %, &, and &. instead of and respectively, whenever G is understood. Also, if G = (C, h, o)and a E Z*, then we use G , to denote the OL system (C, h, a>. A OL system G = (C, h, o)is termed propagating (or, shortly, a POL system) if for no a in C,A E h(a). Thus OL systems for Examples 1.1 and 1.3 are propagating, and the OL system from Example 1.2 is not propagating. G is called determinisric if, for every a in C, # h(a) = 1.Thus the OL system from Example 1.2 is deterministic, and the OL systems from Examples 1.1 and 1.3 are not. If the above-mentioned condition is satisfied, then we consider h to be an endomorphism on C* and so we deal with a DOL system as defined in Chapter I. Thus the OL system from Example 1.2 is a DOL system (which is not propagating). A language is termed a OL (resp. POL) language if it equals L(G)for some OL (resp. POL) system G.
z,%, 3, 2,
1
45
BASICS ABOUT 01- AND EOL SYSTEMS
It is rather easy to see (cf. Exercise 1.1) that there exist OL languages that are neither DOL nor POL languages and that the classes of POL and DOL languages are incomparable but not disjoint. The following lemma is easy to prove, and so we leave its proofto the reader. However, it is very fundamental in most of the considerations concerning OL systems and will be used very often even if not'explicitly quoted. Lemma 1.1.
Ler G = (C,h, to) be a OL system.
( I ) For any nonnegative integer n andjbr any words x,, x 2 , y , , y,, and z in C*,i f x , &. y, and x 2 &. y,, then x 1 x 2&. y 1 y 2 .Conversely, i f x l x 2 z, then there exist words zl, z 2 in C*, st4c.h that z = z l z 2 , x 1 % z1 and x 2 &- z,. ( 2 ) For any nonnegative integers n and m, andfor any words x, y , and z in t C*,ifx % y and y 2 z, then x z.
It
111
A very basic notion is that of a derivation in a OL system. Intuitively, a derivation of y from x in a OL system G mkans a sequence of words beginning with x and ending with y together with the precise set of productions (rewritings) used in each step. Formally, we define it as follows. Definition. Let G = (C,h, to) be a OL system. A derivation D in G is a triple ((6, p ) where CJ is a finite set of ordered pairs of nonnegative integers (the ouwrrenc'es in D),ZJ is a function from 0 into I:( v ( i , j ) is the value o f D at occurrence(i,,j)),andpisafunctionfrom0 into UOez {a a l c c ~ h ( u ) ) ( p ( i , j ) is the production of'D at ocwrrence (i,j ) ) satisfying the following conditions. There exists a sequence of words (xo, x l r . . . , x,) in C* (called the trace o f D and denoted trace D ) such that r 2 1 and: t i ,
-+
(i) 0 = {(i,j)IO I i < r a n d 1 I j 5 lxil 1; (ii) u ( i , j ) is the jth symbol in x i ; (iii) for 0 I i < r, x i + , = a l a z . . . a l x i , , where p(i,j)
=
(v(i,j), a j ) for
1 I j II X i l .
In such a case D is said to be a derivation ofx,frorn xo,and r is called the height or the length ofthe derivation D.The string x, is called the result of the derivation D and is denoted by res D.In particular if x,, = w, then D is said to be a derivation q j x , in G. (Note that x i x i + for i E (0,. . . , r - l}.)
,
E.rutnple 1.4. Let G = ( { a } ,{ a a, a + a'}, a') be the OL system from Example 1.1. Let D = ( 0 , v , p ) , where 0 = {(O,j)ll I j I 2 ) u ((1,j)ll I j 5 3 1 , v(i,j) = a for ( i , j ) E f J , p(0, I ) = p(1, 2 ) = a + a and p(0, 2) = p(1, 1) = p(l, 3 ) = a + a'. Then D is a derivation of u s in G of height 2. -+
II
46
SINGLE FINITE SUBSTITUTIONS ITERATED
Let G = ({a, b}, { a -,(ab)2,b + A}, ab) be the DOL Example 1.5. j I 2) u system from Example 1.2. Let D = (0,O , p ) where 0 = { ( O , j ) l l I { ( l , j ) l l Ij I4},zi(i,j) = a for ( i , j ) E 0 withj odd, u ( i , j ) = b for ( i , j ) E 0 with j even, p(0, 1 ) = p(1, 1 ) = p(1, 3) = a + (ab)’ and p ( 0 , 2 ) = p(1, 2 ) = p( 1,4) = b + A. Then D is a derivation of ( ~ bin) G~of height 2. Given a OL system and a derivation D in it, there is a natural way of representing D by a graph called the derivation graph of D. It can be defined formally; however, we believe that for the purpose of this book this and other related notions are best explained by examples. Exumple 1.6.
The derivation from Example 1.4 is represented by the
derivation graph
Exantplt 1.7.
The derivation from Example 1.5 is represented by the
derivation graph
Clearly the derivations and derivation graphs are in one-to-one correspondence in the sense that, given a derivation D , we can uniquely construct the derivation graph T that represents D ; and, conversely, given a derivation graph T we can uniquely construct the derivation D that is represented by T. One easily sees that each occurrence ( i , , j ) in a derivation D with truce D = (x0, xl,. . . ,x,) determines a unique subderivation of a substring of res D = x, from ?,(i,j ) . Let D(i, j ) denote the subderivation determined by ( i , , j ) and let y be such that D(i,j ) is a derivation of y from u(i,j ) , i.e., v = res D(i,,j). We distinguish two possibilities: (i) y # A ; in this case the height of D(i, j ) is exactly r - i, and (i, j ) is said to be a productive occurrence in D ; (ii) y = A; in this case the height of D(i, j ) is less than or equal t o r - i, and (i, j) is said to be an improductiue ocwrrence in D.
I
HASICS ABOUT OL A N D EOL SYSTEMS
47
For example, in the derivation graph of Example I .7 ( I , 1) is a productive occurrence with D( I, 1) represented by the derivation graph
whereas ( I , 2) is an improductive occurrence with D(1, 2) represented by the graph b
I
Let G be a OL system, let D = (0, O , p ) , and E be derivations in G of heights rand s, respectively. Further, let E be such that the first element of trace E is a single symbol I(. For any occurrence (i, j) in D, we can replace D(i, j) by E and obtain a new derivation in G provided that (i) u(i,j ) = a ; (ii) either r - i = s, or r - i 2 s and E is a derivation of A from a. For example, let G be the OL system of Example I . 1, let D be the derivation corresponding to the derivation graph
and let E be the derivation corresponding to the derivation graph
Then we can substitute E for D(1, 3 ) and get a derivation whose graph is
In particular we can always replace an improductive subderivation by another improductive one (provided it is not too long) and obtain a derivation of the same word. This is expressed by the following result, the easy proof of which we leave to the reader.
48
11 SINGLE FINITE SUBSTITUTIONS ITERATED
Lemma 1.2. Let G be a OL system, let D = (0, v,p ) be a derivation of y from x in G of height r, let (i,j ) be an improduifive oirurreni'e in D, and let E be a derivation of A from o(i,j ) of height less than or equal to r - i. If we replace D(i, j ) by E , then the resulting derivation is also a derivation of y from x.
Exurrtple 1.8. Let G = ( { a ,b } , { a + ah, a + b, a + A, b + a, b + A}, ab) and let D be the derivation of a2b in G represented by the graph b 'b
I
I
1
b
I
a
Let E be represented by the graph a
I
b
I
A
Then, replacing D ( 2 , 2 ) by E , we get the derivation of a2b represented by the graph b
I
ala\,
I
b
I
,/"\b I b
I
a
t
a
I
b
I
I
f\, Q
I La\b
I t is clear from the foregoing that the formal definition of a derivation and related concepts is quitc tedious, whereas the underlying intuitive concept is very clear. For this reason, as usual in formal language theory, once we see that a precise definition ofa derivation is possible and can be used in formal proofs,
1
49
BASICS ABOUT OL AND EOL SYSTEMS
in most cases we shall use it in an informal way, avoiding the tedious formalism unless it is really necessary for clarity. In the same vein we shall often identify derivations with their traces. We shall investigate now the role that erasing productjons (i.e., productions of the form a + A) play in derivations in OL systems. First we shall show that if a letter can derive the empty word, then it can do so in a "short" derivation. Lemma 1.3. Let G = ( C , h, w ) be a OL system with #C = n. Ifa in C is such that, for some m, A E h"(a), then A E h"(a). Proof: For i 2 0, define Ci = { u E C I A E hi(u)}. Then obviously, for all = i 2 0, C iE X i + ,c C and if Ci = Ci+,, then Consequently, there exists a j such that C, 5 C, 5 . . . 5 C j - 5 C j = C j + = . . . . Thus such a j must be not larger than n ; and so if A E h"(a) for some m, then A E h"(a).
,
0 In general if ((0 = x,,, x l r , . . , x,) is the trace of a derivation of a nonempty word x , in a OL system G = (C,h, w), then there is no upper bound for [ x i [ , 0 I i 5 r - I , in terms of I x , 1. However, we can show that in every OL system G every nonempty word x in L(G) can be derived in such a way that no "intermediate" word is longer than C I XI, where C is a constant dependent on the system only. Theorem 1.4. Let G = (C,h, w ) he u OL system. Then there exists u positiue integer CGs w h that,f i x eoery word x in L(G)\w, there exists a derivation D (of x from to) such that t r u e D = (o= x o , x l , . . . , x, = x ) and lxil 5 C c ( l x ( I)foreveryiin{O, ..., r } .
+
Pro($ Let #C = n, s = max{ lcll E h(u) for some a in C} and let q = max{ I wI I w E L i ( G ) for some i, 0 I i 5 n } . We claim that the theorem holds true when we set CG = max{q, s"}. In order to show this consider any x in L(G). Let b be any derivation of x in G. For any symbol a in C such that A E hm((i)for some m, we let E(a) denote a fixed derivation of A from a of smallest possible height. Lemma 1.3 guarantees that the height of E(a) is not larger than n. We alter b in the following way. Choose the smallest i, if such exists, for which there is a j such that ( i , j ) is an improductive occurrence in B and the height of D ( i , j ) is greater than n. For all such j , replace B ( i , j )by E(v(i,j)).By Lemma 1.2 the resulting derivation is also a derivation of x . Repeat this process until we obtain a derivation D such that, for every improductive occurrence ( i , j ) , the height of D ( i , j ) is less than or equal to n.
50
II
SINGLE FINITE SUBSTITUTIONS ITERATED
Let trace D = ( ( 1 ) = .yo,. . . , x, = s). To show that, for 0 I i I r, \ . x i ) I C,( 1x1 + 1) we consider two cases: iI n. Since x i ~ L ’ ( G lxil ) , I q I CJlxl + 1). (i) 0 I (ii) i > n. Consider x i - ” . The number of productive occurrences (in D ) of the form (i - n, j) is at most 1x1 because every productive occurrence in xi-”contributes at least one occurrence to res D = x. On the other hand, by our construction the subderivations determined by improductive occurrences of the form (i - n, j ) are all of height less than or equal to n and so can be ignored in estimating the length of x i . Thus I x i I I S” I x I IC,( I x I 1).
+
(i) and (ii) together prove the theorem.
0
Although we have seen that OL systems can generate rather “complicated” languages (recall also the examples of DOL languages from Chapter I), in some sense their language generating power is quite limited. For example, there exist finite languages that are not OL languages. E.rumnp/t 1.9. { a , a 3 } is not a OL language. This is proved, by contradiction, as follows. If we assume that G = (C,h, w ) is such that L ( G ) = (11, a 3 } , then we have two cases to consider (clearly we can assume that X = ( ( I ) ) :
(i) (1) = a. Then a 2 a3, hence a3 (ii) Q = a3. Then u 3 a, hence a a’ E L ( C ) ;a contradiction.
- -
a9 and so a9 E L ( G ) ;a contradiction. a and a A. Thus a 3 u2 and so
Consequently, there is no OL system G that generates { a , a 3 } . Another indication of the rather limited language generating properties of OL systems are the very weak closure properties of the class of OL languages.
c
Theorem 1.5. The family of OL languages is an anti-AFL, i.e., it losed with respec t t o
ib
nor
(i) union, (ii) c on( atenution,
(iii) (iv) (v) (vi)
the ross operator, interset t ion with regular languages,
nonerasing homomorphism, inuerse homomorphism.
ProoJ:
(i) Obviously, both la} and { a 3 }are OL languages. However, ( a } u { u 3 } is not a OL language (see Example 1.9).
1
51
BASICS ABOUT 01. AND EOL SYSTEMS
(ii) Obviously, { ( I } and {A, u ' } are OL languages. But { u } . {A, a'} = {a, a 3 } is not a OL language. (iii) Let R = {az"b3"1n 2 O}. R is a OL language since it is generated by the DOL system ( { a , b}, {a -+ a2, b + b 3 } ,ab). We shall show now by contradiction that K = R' is not a OL language. To this end assume that G = (C,h, w ) is a OL system such that L(G) = K .
(1) If a E h(a) where LYE{a}', then whenever p E h(b) then p E {b}'. (This follows from the fact that, for all n, a2"b3"* aZ"P3"and so a2"p3"must be in K . ) Also, clearly, if a E h(a) with a E {a}', then for every y in h(a) it must be that y E { a } ' . Thus if a E h(a) with a E {a}' and w = arlbsl . a W ,then the only words generated in G have t "groups" of as and t "groups" of bs. Hence L(G) # K ; a contradiction. (2) Symmetrically, we can prove that if p E h(b), then p 4 {b}'. (3) Clearly (because ab E K ) if c1 E h(a), then LY4 {b}' ; and if p E h(b),then
P 4 {a}'.
(4) Thus (1). (2),and (3) together imply that if a E h(a),then either a = A or #,,a 2 1 and # b a 2 1; and if PE h(b), then either p = A or #,p 2 1 and # * P 2 1. Let w = urlbsl...arcbst, 4 = max{rl, ..., rt} 1
sisf
and
p = max{IaIlaEh(c)}. CSZ
Then, for every x in L(G), the maximal length of a subword of x consisting of as only is bounded by max{q, 2 p } , which contradicts the fact that L(G) = K . Consequently, K is not a OL language and so OL languages are not closed with respect to the cross operator. (iv) {a'"ln 2 0 ) is a OL language and {a, a4} is a regular language. But, obviously, (uz"ln 2 Of n {a, a4} = {a, a4} is not a OL language. (v) Let cp: { a } * + {a}* be the homomorphism such that cp(a) = a5.Then cp({A, a, a ' } ) = {A, a5,a"}, and whereas {A, a, a'} is a OL language, {A, a5, a ' * } is obviously not. (vi) Let G = ( { a } , { a 4 a3, a -+ a4}, a), so that L(G) = {a, a3, a4, a9, a", . . . , aI6, a'', a Z 8 , .. .}. Let cp: {a}* -+ {a}* be the homomorphism such that ~ ( a=) a 5 . Then cp-'(L(G)) is such that its first elements (in order of increasing length) are a', a3, a6, a 7 , .. . , a", al', . . . . It is easily seen that cp-'(L(G)) is not a OL language. 0 A technique that is often used in analyzing OL systems is slicing or speeding u p a OL system (which will be formalized at the end of this section). Essentially what happens is that rather than considering a OL system G = (C, h, w), one considers a OL system G I = (El, h l , wl) in which the finite substitution h l is of the form h" for some m 2 1. This corresponds to decompositions of DOL systems studied in Chapter I. The choice ofm depends on what property
52
II
SINGLE FINITE SUBSTITUTIONS ITERATED
one wants h , to satisfy. Since in this way one is really taking several steps at a time the only properties that can be used are those that are "uniform" or "almost periodically distributed" in the sequence L'(G), L*(C),. . . . As usual, the required property is specified in a form of a language (the set of all words that satisfy the property). Our next result says that if a property can be expressed through a regular language, then indeed it is almost periodically distributed in L * ( G ) ,L2(G),. . . . We start by defining formally such a distribution of a language (property) in a OL system. Dejnition.
Let G be a OL system and let K be a language. The existen-
t i d sprctrum uf G with respect to K , denoted by espec(G, K ) , is defined by espec(G, K ) = { n 2 OlL"(G) n K # The universal spectrum uf G wirh respect to K , denoted uspec(G, K ) , is defined by uspec(G, K ) = { n 2
a}.
O(L"(G)C K ) .
Theorem 1.6. Let G be a OL system and K a regular language. Then both rspec(G, K ) and uspecf G, K ) are ultimately periodic sets. Pro?/: Let G
=
(C,h, 0).
(i) Let us consider especfG, K ) first. (1) Let us assume that K = V* for a finite alphabet V. Let H = (VN, VT, R , S) be the right-linear grammar defined by
VN = {[ZllZ C C} u {S},
R
=
V, = { u } , where a # S,
{ S + a [ X ] I there exists an x in L'(G) with alph x = X } u {[XI + a[ Y] I there exist x, y in C* such that alph x = X , ulph y = Y and x y } u {[XI + AIX L V ) .
Then clearly espec(G, K ) = { n 2 1 I anE L ( H ) } u W, where W = {0
{0}
if 0 4 V*, otherwise.
Since (cf. introduction) { n ( a "E L ( H ) } is an ultimately periodic set, espec(G, K ) is an ultimately periodic set. (2) Let us assume that G is a POL system and K is a regular set generated by a finite deterministic automaton A = ( V , Q, 6, qi,,, F ) ; clearly we can assume that V G C. Let G A = h, 15)be a POL system constructed as follows:
(c,
X
=
{ [ 4 , ~ , ( 1 ] I q , q ~ Q a n d u ~ C{W) }u
1
53
BASICS AROlJT OL AND EOL SYSTEMS
where W 4 { [q, a, q] I q, ij E Q and a E C}, =
{[q,a,ql
+
q, - 1 E Q and b1 * . . bk
u {a [qin +
3
hl
9
E h(a)f
411 [41, b 2 q21 ‘ ’ . [ q k - bk qkllq1, . . . q k E Q, q k E F and b, . . . bk = W } . 1 9
7
9
3
Let V = { [q, a, 41 I ij = 6(q, a)} and let R = V*. Since, clearly, esprc(G,, K)results from “applying the successor function” to esprc(G, K ) , ( I ) implies that espec(G, K ) is ultimately periodic. ( 3 ) If G contains erasing productions and K is a regular language over an alphabet V, then let e be a new symbol and let
K , = { e n o b l e n ” h 2 . ~ ~ h r e ,..., n r ~ I hbl , E V , h l . . . b r E K a n d n o , n l, . . . , n r 2 0 } . Clearly K , is regular. Let G, Z u { e } ,and
h,
=
{ u + .x(a
= (&,
h,, w ) be the POL system defined by 2, =
x and x # A }
u (a + ela
A} u { e + e } .
Obviously, e.spec(G, K ) = espec(G,, K , ) and, because G, is a POL system, (2) implies that cspec(G, K ) is regular. Now ( 3 ) implies that espec(G, K ) is regular whenever G is a OL system and K is a regular language. (ii) To consider uspec(G, K ) let us notice that if K E V*, then uspec(G, K ) = N\espec(G, V*\K). Since regular languages are closed under complementation, (i) implies that usprc(G, K ) is a complement of an ultimately periodic set and so is ultimately periodic. 0 Until now we have taken the set ofall strings generated by a OL system from its axiom to be its language. Such an approach to language definition is called an exhaustive approach (given a device that generates words, e.g., a grammar, one takes as its language the set of all strings one can derive in it starting with the axiom). Several other approaches are studied in formal language theory, and perhaps the most classical one is to introduce auxiliary symbols. That is, one allows using in derivations symbols that are not in the alphabet A of the language we are generating. In other words, in the case of OL systems, the alphabet A of the language generated is a subalphabet of the total alphabet X of a OL system, and one includes in the language of the system only those strings that can be derived from the axiom and that are in A*. There is quite a number of reasons to study EOL systems and languages.
( I ) The extension of a family of languages 9 through considering all the languages that can be obtained by taking an element of Y and intersecting it with A*, for some alphabet A, is a standard process in formal language theory. The classical Chomsky hierarchy is defined in this way.
54
11
SINGLE FINITE SUBSTITUTIONS ITERATED
(2) The extension operation of taking an intersection with A* is very natural from the mathematical point of view. (3) There are two basic differences between OL systems and context-free grammars from the Chomsky hierarchy: OL systems d o not use auxiliary symbols, and they use parallel rather than sequential ways of rewriting. By considering EOL systems we isolate the effects of the parallel mode of rewriting. (4) Although they do not have direct biological motivation as original OL systems have, it turns out that they are equivalent in their language generating power to another class of L systems (the so-called COL systems, discussed later) which have a rather clear biological motivation. Hence EOL systems turn out to be a useful tool for investigating other classes of systems. ( 5 ) There are several results in the theory of EOL systems that allow one to see various other language generating mechanisms in a much better perspective and also allow one to use EOL systems as a mathematical tool to investigate other types of grammars. Formally, we define EOL systems as follows. Definition. An EOL system is a 4-tuple G = (C,h, w, A) where U ( G ) = (C, h, w ) is a OL system (called the underlying system of G)and A G C (A is called the terminal or target alphabet of G). The language ofG, denoted L(G),is defined by L(G) = L(U(G))n A*.
We carry over all the notation and terminology ofOL systems, appropriately modified when necessary, to EOL systems. That is, G is propagating or deterministic if U ( G ) is; we write x ? y if x y, etc. We refer to elements of X\A as nonterminuls. We use sent G to denote L ( U ( G ) ) and usent G = {x E sent Glx w for some w E L(G)}.Also, we term a language K an EOL language if there exists an EOL system G such that L(G) = K .
=
3
Example 1.10. For the EOL system G = (C,h, w, A) with X = { S , a, b } , A = {a, b}, w = S, and h defined by the set of productions { S -+ a, S -+ b, a a2, 6 -,b 2 } ,we have L(G) = {a2"ln 2 0 } u {b2"ln 2 O}. -+
Examnpke 1.lZ. For the EOL system G = (Z, h, w, A) with C = { A , a, b}, = {a, b } , w = AbA, and h defined by the set ofproductions { A -+ A , A -+ a, a -+ a2, b -,b } , we have L(G) = {u2"ba2"'ln, m 2 O}.
A
Clearly both examples above are examples of EOL languages that are not OL languages. As we have indicated (see Example 1.9), there are finite languages that are not OL languages. We shall show now that all finite languages are EOL languages.
1
55
BASICS ABOUT OL AND COL SYSTEMS
E . ~ u t i i p / c l . l 2 . Let K be a finite language over a n alphabet A. Let G = (1, h, S, A) be the EOL system such that C = A u {S}, S 4 A, and h is defined by the productions ( 1 ) if K = (2) if K #
$3,then { S
0, then
+ S } u { u + u l u E A} ; { S + w I M’ E K } u { a + u I u E A}.
Clearly L(G) = K . The following example is a very instructive one. E.i-iittip/~~ 1.13.
{S, A , B, C, A, B, ductions
Let G
=
(E,h, S, A) be the EOL system where Z
c, F , a , 6, c}, A = {a,6, c}, and h is defined S
A+AA, B-tBB,
c+cc, ( I -t
F,
6
+
A-ru, B-tb,
c-rc. F,
=
by the pro-
ABC,
2-2,
A+a,
B-tB,
B+b, c+c,
c+c,
c -+ F ,
and
F
+
F.
Then the derivation with the graph
is a derivation of a2b2c2in G. O n the other hand, the derivation
cannot be prolonged in such a way that it becomes a successful derivation in the sense that it will yield a word in L(G). The reason is that F is the only word that can be derived from a. Thus G is “synchronized” in the following sense: if one rewrites a word in a successful derivation, then either all occurrences of all letters in it must be rewritten by terminal words or all occurrences of all letters in it must be
56
1I
SINGLE FINITE SUBSTITUTIONS ITERATED
rewritten by nonterminal words. The feature that enforces this synchronized behavior of the system is the fact that no terminal symbol can be rewritten in such a way that it yields a word over the terminal alphabet. This leads us to a general definition of a synchronized EOL system. Definition. An EOL system G = (C,h, (0,A) is said to be synchronized if and only if for every symbol a in A and string /I in C*,if u % /I, then /j is not in A*. We shall show now that synchronized EOL systems (possessing also some other “elegant” properties) generate the whole class of EOL languages. Theorem 1.7. There exists an algorithm that giwn an urbitrary EOL system G produces an EOL system C = (C, h, o,A) such that L(G) = L(G)and furthermore (1) (I> E C\A; ( 2 ) there exists a symbol F in C\A su1.h that for every a in A, u F is the only production jbr a in G and F F is the only productionfbr F in G; ( 3 ) ,for every prodwtion a a in G either u E A* or a = F or a E @\(A v { F , ( I ) } ) ) ’ ;and (4) ,fbreveryu in Z\(A u { F , u}), there exists a wordx in A* strc.h that u &. x. -+
-+
-+
Moreover, ifG is propagating, then so is G. Proof: Let G
=
(z, h, 6,A).
z7
(i) Let (I) be a new symbol, t o 4 and let G I = ( X I , h,, (I), A ) be such that C, = Z u { ( I J ) and h , is extended to C, in such a way that h , ( t o ) = ( 8 ) . (ii) For any symbol u in A, let U be a symbol not in C , such that if a # b, then zi # b. Let & = ( i i l a ~ A }let , F # C , u h and let C, = C, u h u { F } . With any u in CT we associate a string ol in C: as follows. If a = A, then Cr = A. If a = a , “ ‘ a , with a,, . . . , a,€ X I , then cl = b , . . . b,, where hi = iii if u i is in A and hi = ui if ui is not in A. Let Gz = (Zz, h z , m, A) where hz consists of the productions
( ~ ~ - + r J u ~ C , \ A a n d a ~ hu , ( (ua) -) + a ~ a ~ C , \ A a n d a ~ h , ( a ) } u {ii 8 l a E A and ~1 E h l ( u ) }u {si a l a E A and a E h , ( u ) ) u { a Flue A u { F } ) . -+
-+
-+
(iii) Let G 3 = (C3, h 3 , o,A) result from G , by replacing every production oftheforma a,whereneitheraEA*nora = F n o r a ~ ( X ~ \ ( uA { F , Q}))+, by the production a F . -+
-+
1
57
BASICS ABOUT OL AND EOL SYSTEMS
(iv) Let G4 = (Z4, h4, (0, A) result from G, by deleting from h , all productions of the form a + a with u in Z,\(A u { F , Q}) such that for no x in A*, a A- x.(Note that as a result of this reduction X4 may be a strict subset of &.) It should be clear to the reader that all the consecutive transformations leading from G to G,, G, to G,, G , to G 3 , and G, to G4 are language invariant, i.e., the languages of the systems G, GI, Gz, G 3 , and G4 are the same. Also it should be clear that these transformations secured consecutively properties (l), (1) and (2). (1) and (2) and (3), (1) and (2) and (3) and (4)from the statement of the theorem. Hence, if we set G4 = C, the theorem holds (because the propagating restriction is clearly preserved by all the transformations leading from G to C).
0 One of the direct corollaries of Theorem 1.7 is that for every EOL system there exists (effectively) an equivalent synchronized EOL system. If a synchronized EOL system G contains a symbol F satisfying condition (2) from the statement of Theorem 1.7, then we call F a synchronization symbol of G. Clearly we can always assume that G has only one synchronization symbol. A consequence of Theorem 1.7 is that for every EOL system there exists an equivalent one the axiom of which is a nonterminal letter. In the rest of this book we shall assume (unless clear otherwise) that EOL systems we consider possess this property. In such a case we often use the letter S to denote the axiom of an EOL system. In the rest of this chapter we shall see various uses of the synchronization technique for EOL systems, but perhaps in its most direct form it is best illustrated in proving some closure properties of the class of EOL languages. It is indeed very instructive to see how essential the synchronization technique is in the proof of the following result. Theorem 1.8. I f K , , K 2 are EOL languages, then so are K , u K 2 , K , K 2 , K :, and K , n R , where R is u regular language.
Pro?/: Let G , , G 2beEOLsysternssuchthatL(G,) = K,andL(G,) = K , . By Theorem 1.7 we can assume that G, = (X,,h , , S , , A , ) and G2 = (Cz, / I ? , S,, A 2 ) are synchronized EOL systems. Clearly, we can assume that @ , \ A , j I , X - @ and (C2\AZ) n C, = 121. Let S, be three different symbo!!: t . 1 i w i i ,. . . in C, u C,. Then: ~
s,,s,
I.
(i) K , u K 2 = L(G), whcre G = (XI u C, u { S } , h, S, A1 u A,) where h is defined by /?(a)= h,(u)tor u E X I , h(u) = h2(u)for u E (C2\Al) and h ( S ) = {SI?S2J.
58
11
SINGLE FINITE SUBSTITUTIONS ITERATED
(ii) K,.K 2 = L(G), where G = (C,u C2 u {S, S,, S,}, h, S , A, u A2) where h is defined by h(a) = h,(a) for a E C,, h(a) = h2(a)for a E (Z2\A1), h(S) = A($,) = S , } , and h(S2) = S2}. (iii) K : = L(G), where G = (Zl u {S}, h, S, A , ) where h is defined by h(a) = hl(a) for a € Z l and h(S) = { S , S2, S,}. (iv) We assume without loss of generality that G, is propagating. Assume that the regular language R is accepted by the finite deterministic automaton
{s,s2},
{s,,
{s2,
(4 Q, .f,40, Qd (Observe that we may have A # A , . ) An EOL system G generating K 1n R is constructed as follows. The terminal alphabet of G equals A The nonterminal alphabet of G consists of S (the initial letter), F (the synchronization symbol), and all the following triples:
,.
(q,A,q')
where q , q ' E Q and
A€Z1\Al.
The production set of G equals the union
{S
( q o , S1, q1)Iql in Qrin} u {(qy A, q') (4, A17 q l ) ( q l ?A 2 3 q 2 ) " ' ( q k - l , Ak? 4') I A + A , . . . A, in G1, As nonterminals, qs in Q} u ( ( 4 , A, 4') a, ' a k l A a , 'ak in G1, as terminals and f ( q , a, . . * ak) = q'},
+
"
--$
"
added with productions a F whenever necessary (i.e., for those letters u for which no other production is listed). It is now easy to verify that -+
L(G) = K , n R . Indeed, G simulates the derivations of G , creating at the same time a sequence ofstates from the initial state to one ofthe final states. That the state transitions in this sequence are the correct ones is guaranteed by the way in which the terminating productions of G are defined. 0 The reader should compare the above positive closure properties of the class of EOL languages with the negative closure properties of the class of OL languages expressed in Theorem 1.5. The comparison of these results sheds some light on the role nonterminals play in EOL systems. We conclude this section by formalizing the aforementioned technique of speeding up (slicing) an EOL system. Let G = (C,h, S, A) be an EOL system where S does not Definirion. appear at the right-hand side of any production in !I. Let k be a positive integer.
59
EXERCISES
The k speed-up of'G,denoted speed, G,is the EOL system speed, G = (C,h(k), is defined as follows: S, A) where
s
(1) h(,)(S) = {x E C*1 (2) for every a E C\S, x
+
. . .,k j j ; and only if x E hk(a).
x for some i E (1,
E h(k)(a)if
It follows directly from the above definition that L(speedkG) = L(G) for every k 2 1. k-.vurrip/ip 1.14. Let G = ( { S , A, B, a, b } , h, S, {a, b } ) be the EOL system where h ( S ) = { B , aAb}, h(A) = {aAb, ab}, h(B) = { A , B 2 } , h(a) = { a } , and h(b) = ( 6 ) .Then speed, G = ( { S , A, B, a, b } , h,,,, S, {a, b } ) where
h(,)(S) = { B , aAb, B2, A , a2Ab2,a2b2}, h(,,(A) = {ab, a2b2,a2Ab2}, h(,,(B) = {ab, aAb, A', AB', B'A, B"}, h ( 2 , ( 4 = { a } and h(,,(b) = { b } . Clearly, L(G) = L(speed, G ) = {a"'b"'a"'b"'~. . anmbnm Irn 2 1 and ni 2 1 for i € ( 1 , . . . )m}}.
Exercises 1.1. Prove that there exist OL languages that are neither DOL nor POL languages and that the classes of POL and DOL languages are incomparable but not disjoint.
1.2. A OL system G = (C, H , o)is called unary if #C = 1, Y(U0L) is used to denote the class of languages generated by unary OL systems. Characterize z(U0L). (Cf. [HLvLR] and [HR].) 1.3. Let G = (C, h, S, {a, b } ) be the synchronized EOL system where C = { S , A, B, C, D, E, F , a, b } and h is defined as follows: h(S) = {AC}, h(A) = { B 2 ,a b } , h(B) = {BA', bab}, h(C) = {BAB, DD}, h(D) = { E 2 } , h(E) = { A , C2}. What is the minimal positive integer ko such that speed,,, G = ( C , hko,S, {a,b } ) has the property that X E alph hko(X) for X E C\{S}. Construct speedknG. 1.4. Is Theorem 1.6 still true if K is a context-free language?
K
1.5. Let G = ( { a } ,h, a) be the OL system where h(a) = { a 3 ,a"} and let = {a3"ln 2 l}. Find espec(G, K ) and uspec(G, K ) .
60
1I
SINGLE FINITE SUBSTITUTIONS ITERATED
1.6. Let G = (C, h, o)be a OL system. G is said to have surjiice ambiguity if there exist three words xl,x2,x3 in L(G) such that x3 E h ( x l ) ,x3 E h(x2),and for i, j E { 1, 2, 3 } , i # j , it is not true that both x i $ xiand xi x i . G is said to have production ambiguity if L(G) contains x and y such that there exist two different derivations of y from x in G of height 1. G is called unambiguous if it has neither surface nor production ambiguity. Prove that :
2
(i) if G is propagating and there exist three words xl,x2, x3 in L(G)whose lengths are pairwise unequal and which are such that x3 is in both h(x,) and h(x3),then G has surface ambiguity; (ii) G has production ambiguity if and only if some word in L(G) has two distinct derivations with equal traces; (iii) if G has production ambiguity, then there exists an u in C such that h(u) contains two words u1 and u2 where u 1 is a proper prefix of u,; (iv) if G is a DOL system, then G is unambiguous. (Cf. [ReS].) 1.7. Let G = (C, h, w ) be a OL system. A word x E C* is called permanent if, for each positive integer n, h"(x) contains a word different from A. A symbol a E C is called recursive if a xuy for some permanent word xy. If both x and y are permanent, then a is calledfull-rer,ursive;a is called half'rpc irrsive if it is recursive but not full-recursive. If a E C is such that it is either recursive (fullrecursive) or u wbz for some w, z E C* and a recursive (full-recursive) symbol h, then u is called pre-recursive (preTfull-rec.ursiue).A pre-recursive symbol a that is not pre-full-recursive is called a pre-half'recwsive symbol. We say that G is recursion limited if each word x in L(G) either (i) consists of stagnant symbols and at most one pre-full-recursive symbol (a symbol b is calledstagnunt ifL(G,) is finite), or(ii)consistsofstagnant symbols and at most two pre-half-recursive symbols. Prove that the class of languages generated by recursion limited OL systems is a strict subclass of the class of linear languages. (Cf. [MR].)
+
1.8. Construct an EOL system G such that L(G) = {x E {a, b}*llxl for some n 2 0).
=
2"
1.9. Show that both {akb'akl1 5 I Ik } and {akb'aklk,I 2 I } are EOL languages.
1.10. Prove that Y(EOL) is closed under gsm mappings. (Hint: consult the proof of Theorem 1.8(iv).) 1.11. Prove that, given an EOL system G , usent G is an EOL language (recall that usent G = {x E sent G J x w for some w E L ( G ) } .
3
61
EXERCISES
1.12. Let G a E h(a). Prove
= (C, h, S, A) be an EOL system such that, for every a E A, that L(G) is a context-free language.
1.13. Show that each EOL language can be generated by a synchronized EOL system in which the right-hand side ofevery production is either of length 1 or of length 2. (Cf. [MSWlJ.)
1.14. A propagating EOL system G is called chain-free if every derivation tree of a derivation of a word in L(G) is such that it contains a path from the root to a leaf such that each node on this path (with the exception of the leaf) has at least two direct descendants. Prove that each EOL language can be generated by a propagating, synchronized, chain-free EOL system. (Cf. CCM 11.) 1.15. A regular mcrcro OL system G is like a OL system except that productions are provided only for nonterminal symbols and each production is either of the form A -+ a with LY consisting only of nonterminal symbols or A -+ R where R is a regular language over the terminal alphabet of G. Hence all derivations of words in L(G) are such that their traces consist of sequences of words xl, . . . , x, x,+ with the property that all of XI,.. . , x, are words over the nonterminal alphabet of G and only x,+ is a word over the terminal alphabet of G. Prove that the class of languages generated by regular macro OL systems is the smallest full AFL containing Y(0L). (Cf. [COl J and [vL3].) 1.16. A nondeterministic generalization of locally catenative W L systems is defined as follows. A rrcurrcvwe system is a 6-tuple S = (C, Q, d ,
.d,9, (0)where C is a finite nonempty alphabet. is a finite nonempty set (theim/cuset),disa positive integer(thedepthof'S),.disafunctionassociating with each (x, y ) R~x { i t 1 I i Id } a finite set A x , y (of axioms) such that A x , y 5 C*, .9is a function associating with each x E Q a nonempty finite set F , (of rer~urrenc.eformulas)such that F , $ ((0x { i t 1 I i I d } ) u C)* and Q E R (the distinguished index). For x E 0 and a positive integer y , we define L,JS) as follows: If Y E { I , . . . , d l , then L,.,(S) = A x , " . If y > d , then
L x , y= { u o u l u l ... u,u,lco(kl, l l ) v l . . . (k,, I,)u,~F,,where,forO I j I j; u j E Z* and, for 1 5 i II;uiE L k i , y - r i ( S ) J .
u
Then L(S) = LU,JS),where the union ranges over all positive integers y, is said to be the language generated b y S. A language that is generated by some recurrence system S is said to be a recurrence language. Prove that a language is a recurrence language if and only if it is an EOL language. (Cf. [HLR] and
WRJJ
62
11
SINGLE FINITE SUBSTITUTIONS ITERATED
2. NONTERMINALS VERSUS CODINGS EOL systems are an example of the so-called selective approach to language definition. As opposed to the exhaustive approach illustrated by OL systems, in the selective approach, given a language-generating system G, one defines its language to be the set of all those strings generated in G from its axiom(s) that satisfy a particular property. In the EOL case the property required from a stringx (generated in asystem) to be included in the language generated is that x be in A* where A is a distinguished (terminal) subset of the total alphabet. There are various other examples of the selective approach to language definition within formal language theory (and within the theory of L systems in particular) and some of these will be discussed in the next section. An even moregeneral approach to language definition is the so-called transformational approach. Here the language of a system is defined as the result of a function (transformation) applied to the set of all strings that can be derived from the axiom(s) of the system. A typical example of such an approach within L system theory is the so-called COL systems. A COL system H consists of a OL system G equipped with a coding cp, and its language L ( H ) is defined to be the set of all strings of the form cp(x) with x in L(G). It is interesting to notice that this coding mechanism was introduced based on a biological consideration : it reflects the relationship between the “observed” and the “real” organism. In this section we shall study the relationship between these two languagegenerating mechanisms: nonterminals (as in EOL systems) and codings (as in COL systems) applied to OL systems. In particular, we shall show that the classes of languages generated by EOL systems and COL systems coincide, and then we shall study some ramifications of this result. Formally, COL systems are defined as follows. Definition. A COL system is a construct G = (Z, h, w, cp) where U ( G ) = (Z, h, w ) is a OL system (called the underlying system o f G ) and cp is a coding defined on I*.The language of G, denoted L(G), is defined by L(G) = cp(L(U(G))). An HOL svstem is defined similarly, the only difference being that cp is an arbitrary homomorphism.
All the notation and terminology concerning OL systems (appropriately modified if necessary) are carried over to COL systems. E.wmple2.1. For the COL system G = (C,h, w, cp) where C = {S, A, a, b } , OJ = S, h is defined by the productions {S A , S b, A -, Aa, b + b3, a -, a } , and cp is defined by cp(S) = cp(b) = b and cp(A) = cp(a) = a, we have --$
L(G) = {b3“ln 2
01 u {anin 2
1).
--$
2
NONTERMINALS VERSIJS CODINGS
63
E.rutnp/ii 2.2.
For the COL system G = (Z, h, w, cp) where C = { a , b, B } , aB, h is defined by productions {a -, a*, B + Bb, b -+ bJ, and cp is defined by p(u) = cp(b) = cp(B) = a, we have L(G) = { u ~ " + ( " +In~2) 0). The underlying OL system U ( G )is here a DOL system and so generates the DOL sequence t = aB,a2Bh, a4Bh2, . . . . Then the coding of T by cp defines the CDOL 'I ) . . . . sequence r = u2,u4, u', . . . , a2"+'"+
w =
We start by demonstrating that EPOL systems generate all EOL languages. In other words, an erasing is a useful facility provided by EOL systems but it is not necessary; one can (effectively!) replace any EOL system that uses erasing by another EOL system that generates the same language and does not use erasing productions. One should contrast this result with the result mentioned already in Section 1 (see also Exercise 1.1) that erasing is very essential in OL systems. Since EOL and OL systems differ only by the use of nonterminals in the former, this comparison sheds some light on the role nonterminals play in L systems. V ( E O L ) = Y ( E P O L ) . Furthermore, there exists an allheorem 2.1. tliut given any EOL system produces un eyuivulent EPOL system.
goritlirii
Proof. (i) Obviously Y(EP0L) c Y(EOL). (ii) To prove that Y(E0L) c Y(EPOL), we proceed as follows. Let H = (C, h, 01, A) be an EOL system. If L ( H ) is finite, then the result trivially holds (see Example 1.12). Thus we can assume that L ( H ) is infinite, and also by Theorem I .7 we can assume that (11 = S E C\A. The intuitive idea behind our construction of an equivalent EPOL system can be explained as follows. We want to construct an EPOL system G that would simulate derivations in H in such a way that in corresponding derivation trees (in C) the occurrences of symbols that do not contribute anything to the final product (word) of a tree (hence improductive occurrences) will not be introduced at all. For example, assume that the following tree T is a derivation tree (for a word bab2)in H :
64
1 I SINGLE FINITE SUBSTITUTIONS ITERATED
In simulating this tree in G we want to avoid the situation in which we would be forced to apply an erasing production and so we want to delete every subtree that does not “contribute” to the final result bab2. Hence we want to delete subtrees with circled roots. We would like then to be able to produce in G a derivation tree of the form
where S‘”, B“’, B‘2’,B‘”, C“’, a“’ through d 6 )and b“’ through b‘5’are some “representations” of symbols S, B, C, a, b. In other words, we are “killing” nonproductive occurrences as early (going from top to bottom) as possible. But, in general, there is no relation whatsoever between the level on which we delete (in G ) a subtree at its root and the level (in H ) on which this subtree really vanishes. Thus we have to carry along some information that would allow us to say (in G) at a certain moment: the considered subtree vanishes (in H ) . Fortunately, for this purpose we need to carry only a finite amount of information; it suffices to remember the minimal subalphabet alph x of a word x derived so far in the considered subtree rather than the word itself. This information will be carried as the second component in two-component letters of the form [a, Z ] where a E C and Z c C. Thus in our particular example we shall have the following tree in G : rs,
rn
2
65
NONTEKMINALS VERSUS COIIINGS
Now inspecting words on all levels of this tree we notice that only the last word [h, 03[a, 03[h, 0 3 [b, 01 should be transformed to the terminal word (huh’) because only on this level do all subtrees that we have decided to delete (in G) really vanish (in H ) . Such a transformation can be easily performed by the synchronization mechanism using a synchronization symbol F. Now the following formal construction should be easily understood. Let G = ( V , y, [ S , 0 1 , A) be the EPOL system defined by (1) V = V, u { F } u A where V, = {[a, Z ] ~ UCEand Z E C} and F is a new symbol. (2) y is defined as follows:
(2.1) If b , . . . h, E h(u) with k 2 2, b,, . . . , b, EX,then, for every Z [hi,,Z , , ][hi,, Z,,] . . . [b,,, Z i p ]E g ( [ a , Z])
and, for 2 I j Ip
-
if
c C,
1 Iil < i2 < . . . < i, Ik
1,
Zij = alph hi, + 1 bij + 2 . . . hi, , - 1, +
Z,,
=
a l p h b i l + l b i l + 2 . . . h i zurllplrb, -l
Zip = ~ l p hip h + 1 bip+ 2 . . .6, u Z‘, providing that Z’ E S sw,, Z = ( U
where
~ I CZ’ ~
c Elthere exist x, y
in Z* with dplr x = Z, ulph y = U where x
y}.
(2.2) If h E h(a) with 6 in C, then, for every Z E C, [b, Z‘] ~ g ( [ aZ]) , providing that Z’ E sucfI Z. (2.3) a E y([a, 03)for all a in A. (2.4) y(a) = { F } for all a in A and g ( F ) = { F } . Now with the comments given before it should be clear to the reader that indeed L(G) = L(H), and consequently the result holds. 0 Next we turn to the relationship between Y(E0L) and Y(C0L). We are going to prove that Y(E0L) = S(C0L). As we shall see, Theorem 2.1 and the synchronization technique allow us to prove rather easily that Y(C0L) G Y(E0L). The more difficult task is to prove that Y(E0L) c T(C0L). Perhaps the real reason behind this difficulty is the following. In “programming” a language by an EOL system one can generate in it a lot of words that are only auxiliary words and that do not directly find counterparts in the language generated. These are words generated in the system that are not over its terminal alphabet A, so when we intersect the language of the underlying OL system with A* they simply disappear. In COL systems programming a
II
66
SINGLE FINITE SUBSTITUTIONS ITERATED
language is a more “precise” (hence more difficult) task. No word generated in it is really “wasted”; every word gives through a coding an element (its counterpart) in the language. In view ofthis it is not even intuitivelyclear that indeed Y(E0L) E Y(C0L). As a matter offact before this result was known quite a lot ofeffort was spent to find a language in Y(EOL)\Y(COL). Theorem 2.2. Y(E0L) = Y(C0L). Furthermore, this result is eflectiue in the sense that there exists an ulgorithm that given an EOL system produces un equivalent COL system and there exists an algorithm that given a COL system produces an equivalent EOL system. Proof: (I) Y(C0L) E Y(E0L). Let G = (A, g, 01, cp) beaCOLsystem with -P @*. By Theorem 2.1 there exists an EPOL system G such that L(G) = L(U(G)). Then by Theorem 1.7 we can assume that there exists an EPOL system H = (C, h, S, A) such that L(G) = L ( H ) and H satisfies the conclusion of Theorem 1.7. Let R = h, S, 0)be the EPOL system such that = C u 0 and h results from h by adding productions a + F for every L I E 0 (where F is the synchronization symbol of H ) and replacing every production of the form a + c1 with a E A’ by a + cp(c1). Clearly, L(R) = cp(L(G))= L(G). (11) 2(EOL) G Y(C0L). Since, by Theorem 2.1, Y(E0L) = Y(EPOL), it suffices to show that Y(EP0L) E Y(C0L). Let G = (Z, h, S, A) be an EPOL system. For a letter a in X, the existential spectrum o f . in G, denoted as espec,, a, is defined by espec, a = { n 2 O ( u % w for some w in A*}. The (; existential spectrum of a in G tells us in how many steps u can contribute a terminal (sub)word in a derivation in G . Clearly, especc u = espec(G,, A*) (recall that G , is G with S replaced by a). Thus by Theorem 1.6 espec, a is ultimately periodic for every letter a in C.We use the notations thres and per for its threshold and period. If espec, a is infinite, then we call u uitul; we use uit G to denote the set of all vital letters from C. Next we define the uniform period of G , denoted m,. to be the smallest positive integer such that cp: A*
(c,
(i) for all k 2 m,, if a is in Z\uit
G and a
2 w, then w $ A*;
(ii) for all a in uit G, mc > thres(espec, a), and per(espec, a ) divides mc. Now we proceed as follows. We consider all the words that can be derived from S in m, steps. (In this way we shall loose all terminal words that can be derived in fewer than mG steps in G ; however, this is a finite set and will be easy to handle later on.) Then we divide all those words into (not necessarily disjoint) subsets in each of which we can view all derivations going “according to the same clock” or, in more mathematical terms, conforming to the same (ultimately periodic) spectrum. This is done by the following construction.
2
67
NONTERMINALS VERSUS CODINGS
Let 0 I k < mc and let ax(G, k ) =
Ifax(G, k ) # ( C k , w , gk,&,'
(i) &,
H,
C)'ISFwand, for all a in alph w,mc
{WE(&
+ k is in espec, a } .
0, then, for every w in ax(G, k), we define a OL system G(k w)
=
w ) as f o ~ ~ o w s : = {aE
uit GI(mc Imc
for some y such that w~ (ii) for every a E
&,,
+ k ) E espec, a and, for some I 2 0, a E alph y
y};
and every a E c;,,
cI E g k , w(a>if
and only if a
a.
Thus we have the following situation. It w E ax(G, k), then the derivation in G(k, w ) goes as follows:
-I step i n C ( k . w )
I.t'
mG
s t e p in C
1 step i n G ( k , wl
M',
mti steps i n C
> w2
=....
Now, using the fact that all symbols appearing in words in L(G(k, w ) ) contain mc k in their existential spectra, we can squeeze the language from G(k, w ) in the following way. Define M(G(k, w))by
+
M(G(k, w ) ) = {.x E A* 1 there exists y in L(G(k, w ) ) such that y
mc; f k
x}.
We shall show now that the union of the languages M ( G ( k , w)), over all k < m, and w in ux(G, k), is identical (modulo a finite set) to L(G).
(i) L(G) = I M ' E A + I S ~ for M ' Some 1 < 2mGl u U O < k < m G U w E a x ( , , k ) M(G(k, w)). This is proved as follows. Obviously the right-hand side of the above equality is included in the left-hand side. On the other hand, let us assume that x E L(G). (1) If x can be derived in less than 2m, steps, then x is in the first set of the above union. ( 2 ) If x is derived in at least 2mc steps, then let D = (S, xlr . . . , x,,, . . . , x, = x) be the trace of a derivation in G where p = rpmc k, for some r, 2 2 and 0 I k , < m c . For all r , 1 I r < r , and u in ulph x r m G we , have (3) a is vital because a X for some word X in A', where t = (r,mc k,) - rm, 2 m,; and (4) (mc + k,) is in esprc, a because ( r , - r)mc + k, is in especC a and esprc, a is an ultimately periodic set with period dividing mc and threshold smaller than m,;.
+
$
+
11
68
SINGLE FINITE SUBSTITUTIONS ITERATED
Consequently, x E M(G(k,, xmG))and so xis in the union oflanguages on the right-hand side of the equality (i). Thus (i) holds. As a matter of fact we could easily prove now that each EPOL language is a result of a finite substitution on a OL language. However, we want to replace the finite substitution mapping by a coding. To this end we shall prove now that each component language on the right-hand side of the equality (i) is a finite union of codings of OL languages. (ii) Assume that ax(G, k ) # Qr and let w E ax(G, k). Then there exist OL systems H,, . . . , H r , r 2 1, and a coding cp such that M ( G ( k , w)) = Ur= (p(L(Hi)). This is proved as follows. Let w = b, ... b, where bi€uit G for 1 I i I t . For all a in & w , let
,
V(a,k, = {x A t I a
and z k ,
=
la E &
{[a, b],
W ( W )=
mc+k
7= w
k , 1,
.. .
7
aa, k, " ( 0 , k))?
and b E A}. Let
... Cb1, c l r l l C b ~ ~, 2 1 1 * . Cb2, . ('~r21 [b,, c,,,] . . . ('jr, E U ( b j ,k ) for 1 I j I t ) .
{Cbl, ('111Cb13 ( ' 1 2 1
. . . [b,, ell] .
+
[(ajl
Let &, be defined by the productions {[a,b]
u
+
hlaECk,wand h E A }
-
3"
bl b E A,
+
('1
C h d l l l Cclld121 . . C(,1* dl"J * . . Ccsrd,,l . . . C(*sr &"JI . . .cSE gk,w ( U ) and dj, . . . dj,, E U ( L . k~), for 1 Ij I s}. *
Let, for every z in W(w),G(k, w, z ) be the OL system (Ek. w , g k , w , z ) and let cp be a coding from E k . into A such that cp([a, b]) = = b. We leave to the reader the rather obvious proof of the fact that
cp(m])
M ( W , w)) =
u cp(L(G(k,w,z))).
2 EW(w)
Thus (ii) holds. The following two observations are obvious. (iii) If K is a finite language, then there exist a OL system and a coding cp such that K = (p(L(G)). (iv) If H,, .. ., H, are OL systems, ql, .. ., cp, are codings, and K = U;=, cpi(L(Hi)), then there exist a OL system G and a coding II/ such that K = *(L(G)). Now (11) follows from (i)-(iv), and (I) and (11) imply the theorem. 0 In the rest of this section we shall investigate the role of erasing in COL systems. We have seen (Theorem 2.1) that in the case of EOL systems erasing is not a necessary feature in the sense that every EOL language can be generated
2
NONTERMINALS VERSUS CODINGS
69
by an EPOL system. We shall demonstrate now that this is not the case for COL systems: CPOL languages form a strict subclass of the class of COL languages. We begin by observing the following obvious corollary of Exercise 2.1. Lemma 2.3.
Let C,, C2 be disjoint ulphabets and let K , , K 2 be injnite languuges o w Z, and C,, respectively, such that the shortest word in K u K 2 is of length at least 2. Let G = (C, h, o)be a POL system and cp a coding such that K u K 2 = (p(L(G)).Let T = oo, oil, . . . be an infinite sequence of words over C such that oo= w and w i E h(wi- for i 2 1. Then there exist two injnite ultimately periodic sequences of nonnegutive integers Q and Q2 such that,for every i 2 0,j E { 1, 2}, ' p ( c o i ) E K j [fund only ifi E Q j .
,
The following concept will be crucial for the proof of our next theorem. Definition. (1) A COL system G = (C,h, w, cp) is called loose if there exist a E C, a positive integer k, and x,, x 2 E C* such that a occurs in infinitely many words k k of L(U(G)),a x,, u x 2 , and cp(xl) # q ( x 2 ) . Otherwise, G is called tight. (2) A COL language K is called tight if every COL system G such that L(G) = K is tight. Directly from the above definition and from Exercise 2.1 we get the following result. Lemma 2.4. Let C,, C2 be disjoint ulphubets and let K , , K 2 be languages over C, und C2, respectively. l f K , und K 2 are tight CPOL languuges and K u K , is n CPOL lunguage, then K , u K 2 is also right.
,
We are ready now to prove the aforementioned theorem. Theorem 2.5.
T(CP0L) 5 Y(E0L).
Proof: (i) Theorem 2.2 implies that Z(CP0L) !z Z(E0L). (ii) To show the strict inclusion we shall demonstrate that K
=
{a3"ln 2 1 ) u {b"c"d"In 2 11
is in Y(EOL)\Y(CPOL). Obviously, K E Y(E0L). The assumption that K E Z(CP0L) leads to a contradiction as follows. Let us assume that K E Y(CP0L). Obviously, both K , = {a3"ln 2 l} and K 2 = {b"c"d"ln 2 1) are tight CPOL languages, and so Lemma 2.4 implies that K is a tight CPOL language. Then Lemma 2.3 implies that there exist a
1I
70
SINGLE FINITE SUBSTITUTIONS ITERATED
finite language M , a positive integer m, PDOL systems G,, . . . , G , , and a coding q such that K\M = UT', q ( L ( G i ) ) ,and moreover each of the Gi, 1 5 i 5 m, is exponential. Then, however, Exercise 2.2 implies that K 2 is not (p(L(G,)),a contradiction. included in M u
uy' ,
Obviously, the fact that COL systems have only one axiom plays a very crucial role in the proof of Theorem 2.5 (see Lemma 2.3 and Lemma 2.4). In the theory of L systems one often considers systems with finite number of axioms (rather than only one.) Thus, informally speaking, a OL system with Jinite axiom set, called an FOL system, differs from a OL system by allowing a finite set of axioms to start with and then taking as the language of a system the set of all words that can be derived (in a "OL way") from any of its axioms. (Those systems are formally defined in Section 4.) Analogously to the OL case, an FPOL system is an FOL system satisfying the propagating restriction, and a CFOL (CFPOL) system results by adding a coding to an FOL (FPOL) system. A very natural question concerning the diff'erence between EOL and COL systems is then the question, Is Y(E0L) equal to the class of languages generated by CFPOL systems? It is proved in [ERl], using a method very different from that of the proof of Theorem 2.5, that the answer to the above question is negative. This result certainly sheds light on the role erasing plays in L systems and on the difference between nonterminals and codings in defining languages of L systems. Exercises 2.1. Let E l , X2 be disjoint alphabets and let K , , K 2 be languages over C, and C2, respectively. Let G = (C,h, w ) be aOL system and rp a homomorphism such that K , u K 2 = (p(L(G)).Let a, b be letters from C (not necessarily different) such that Z , U Z ~ E~ L(G) Z ~ for some z , , z2,z3E C*. Prove that for every positive integer k , for every x in Lk(G,) and every y in Lk(Gb),alph q ( x ) E C, if and only if alph rp(y) G C,.
2.2. Prove that if G is an exponential DOL system, then there exists a positive integer constant C such that, for all q 2 0, less, L(G) C log, q.
2.3. Prove that Y(CFP0L) 5 Y(E0L). (Cf. [ERl].) 3. OTHER LANGUAGE-DEFINING MECHANISMS
We have already pointed out that the original approach in the definition of the language generated by an L system was the exhaustive one: all words derivable from the axiom constitute the language. Also some selective or
restrictive approaches in language definition have been considered. The present section continues the latter considerations. Roughly speaking, definitional approaches different from the exhaustive one are of two kinds. In the first place, a definitional mechanism may consist of excluding some words from the language generated exhaustively. A typical example of this is the E-mechanism that excludes all words containing nonterminal letters. Another example is provided by the adult languages discussed below. In the second place, a definitional mechanism may apply some transformation on words of the language generated exhaustively. Most typical examples of this are the C - and H-mechanisms, where the transformation in question is a coding or an arbitrary homomorphism. Another example is the fragmentation mechanism discussed below. Undoubtedly the parallel generation process in L systems, contrasted to the sequential generation process in phrase structure grammars, has turned out to be appropriate for the comparison and characterization of different language definition mechanisms. An obvious reason for this is the control on derivations caused by the parallelism. It is to be understood that this section is not intended to give such a comparison and characterization but only to discuss some of the most typical definitional mechanisms. We begin with a discussion of “adult” languages or languages consisting of “stable” words. A word belongs to the adult language of a system if and only if it derives no other words but itself. Adult languages of many types of L systems have been investigated. We here restrict attention to OL systems and first give the formal definitions. Dcjinition.
(3.1)
L,(G)
The udult lunguuge of a OL system G
=
(C,P, w ) is defined by
* M’‘ implies M I = w’ for all words w’}.
= ( W EL ( G ) ( w
Languages of the form (3.1) are referred to as AOL lunguuges. The family of AOL languages is denoted by Y(A0L). For the sake of brevity, we usc in this section the notation .Y 3 y to mean then J’ = Similarly, .Y 3 y means that that .Y => y and, whenever s 3 x 2 y and, whenever s % yl, then J, = Thus, the definition of the adult language is in this notation ~
L,(G)
=
8
~
.
{M’EL(G)I\vSW}.
72
I1
SINGLE FINITE SUBSTITUTIONS ITERATED
We have the derivation
b * alba4 * a1a2a4a4a3=> a,a2a3u4a3a4u3; and, hence, u1u2a3a4a3a4a3 is in L(G). Because the productions for a l , u 2 , a 3 ,a4 are deterministic, it is immediately verified that a1u2 a3 a4 a3 a4a3 9 a1a2 a3 a4a3 a443.
Thus, the word u1u2a3a4a3a4a3 is in L,(G). We shall see later that
(3.2) L,(G) = { ( ~ ~ a ~ a ~ ) i ( aIi ~2a0). ~)’+~ A remarkable fact from the general formal language theory point of view is that the family of AOL languages equals the family of context-free languages. This gives an entirely new characterization of the family Y(CF), in terms of parallel rewriting systems. We now begin the proof of this result. Given a OL system G = (C, P , o),we denote by C, the subset of C consisting of all letters that appear in some word of the adult language L,(G). C, is referred to as the adult alphabet. Because the adult language may be empty or consist of the empty word alone, it is possible that C, is empty. As regards Example 3.1, we have seen that C, contains (at least) the letters a t , a 2 ,a,, a4. We shall now give a method for determining C,. For this purpose, the following lemma is needed.
Lemma 3.1. Let G = (C,P, o)be a OL system, and let m be the curdinulity of the alphabet C,. Then,for each a in C,, there is a (unique) word x, in C: s i d i that 111
(3.3)
a3Xa3Xa.
Pro05 The lemma is trivially true if CA is empty. Assume this is not the case and consider a fixed letter a in C,. It is an immediate consequence of the definition of L,(G) that there is exactly one production a -+ a for CI in P. Moreover, the number of occurrences of a in a is at most one. Otherwise, the number of as in a word increases at each derivation step and, hence, u cannot occur in any word of L,(G), which is a contradiction. Thus, the number of occurrences ofa in a is either 0 or 1. Assume first it is 0. Then we claim that
~ A Afor some
(3.4)
t Im.
Consequently, (3.3) holds with x, = A. Because a is in X A , whenever a y then necessarily CI &=y. Thus, if t% = A, we are done. Assume, that a # A. Consider a word w in L,(G) containing an occurrence of a. Since o! does not contain a, we must have
(3.5)
w
= x1ax2ax3
or
MJ = x 1 a x 2 a x 3
3
73
OTHER LANGUAGE-DEFINING MECHANISMS
forsome wordsx,,x,,x3 inC:.Considerthesequenceofwordsa,,a,,. . .such that i
for all i.
u 3cq
(Thus, a ,
= a.)
It follows by (3.5) that
JwI2
la, -+.ail for all
i.
This is possible only if, for some t , a, = A, i.e., a &=A. This implies that a cannot occur in any of the words aiand, in general, if a letter b occurs in ai,then the subword of ai+j , j 2 1, generated by this occurrence of b does not contain b any longer. These observations immediately give the upper bound m for r and, hence, (3.4) holds true. Assume, secondly, that the number of occurrences of a in a is 1. Hence a = Play, for some ,!II and y 1 not containing a. Now plyl ** A because, otherwise, a generates arbitrarily long strings, which is impossible. By the case already considered, we infer that
/It 3 A
(3.6)
and
y, %A.
and
yt S y 2 S = . . . 3 y u 2 A .
y,
. . . y v , then (3.3) is satisfied because
Assume that
/?,= 3 - / ? 2 3 . . . S / ? , , S A If we now choose x, = flu. . . of(316). 0
We can now give an algorithm for finding the set C A .Given a OL system = (C, P, to), where C is ofcardinality n, we proceed as follows. For each a in C,we check whether or not G
11
u 3x, 3 x,,
(3.7)
for some x, (which is unique if it exists). Let C, be the union of all sets alph(x,), where u ranges over all letters satisfying (3.7). By Lemma 3.1 CA
C,.
Let now C, E C,be such that, for each b in C,, there is a word in C: n L(G) containing an occurrence of b. C, is found by considering the (effectively constructable) set {ulph(x)lx in L ( G ) } . Finally, let C3 be the union of all sets alph(x), where ~
5
x
3forsome ~ a
We claim that (3.8)
x3 = X A .
in
x,.
II
74
SINGLE FlNITE SUBSTITUTIONS ITERATED
Consider a letter h in C 3 . There is a letter a in C, such that, for some y1 and y , in ZT, a %ylby2 + y l b y z .
Since a is in C,, there are words x1 and x 2 in C y such that (0
**
XIUX,.
Similarly, as in Lemma 3.1, we see that, for some z 1 and z 2 in Cl, x1$zl s z 1
Choosing w
=
and
x2 3 z 2 3
Z 2 .
zly,by2z2,we have altogether 0)
**
XlLlX, 3 w 3 w,
which shows that b is in C,. Conversely, consider a letter b in Z,. Let w be a word in L,(G) containing an occurrence of b. Thus, w 3 w and consequently also LV 5 w. This fact and Lemma 3.1 imply the existence of a letter u in a l p h ( ~ v(not ) necessarily distinct from b ) such that a s y y y ,
for some y containing an occurrence of b. Because clearly a is in Z,, we have shown that b is in C,. This shows the validity of (3.8); and, therefore, we obtain the following result. Theorem 3.2. given OL system.
There is an algorithm for finding the adult alphabet of a
Exaniplr 3.2. Consider again the OL system G of Example 3.1. Applying first the test for X l , we obtain C1
= {a13 a27 0 3 , a 4 . 4 ) .
From this it is immediately seen that C2
=
{UI,
a23 0 3 ,
u4).
Finally, the test for C3 yields C3 = C,. The following lemma is very useful in establishing our main characterization result T(AOL) = 9 ( C F ) .
3
75
OTHER LANGUAGE-DEFINING MECHANISMS
Lemma 3.3. Giveit a OL system H , a OL system G = (Z, P, S) can he con~rr~rc~rrtl sirch rhur LA(C;) = L A ( H ) md, .for each u in the udult alphabet of G, rhe only produc~ionirt P is u -+ a.
Proqj: If the adult alphabet C, of H is empty, there is nothing to prove. We assume it is of cardinality m 2 I . We also assume that the axiom of H is a letter S not belonging to the adult alphabet. (If this is not the case originally, , wH we add to H a new initial letter S with the only production S + w H where is the original axiom of H . Clearly, L , ( H ) is not affected.) Consider the homomorphism h defined on the alphabet C of the system H as follows:
I
otherwise.
(By Lemma 3.1, h is well defined.) Define now the set of productions P by
P
= {u
+
h(o!)(a+ o! is a production of H and a # C A }u {a + a l a ~ C , } .
This completes the definition of the system G = (X,P, S). Observe that Z, is the adult alphabet of H . So far we do not know that C A is also the adult alphabet of G, although this will follow by the discussion below. It is easy to verify by induction on i that, for every i 2 0 and every y E C*, (3.9)
S
2y
if and only if S
where
x,
h(x) = y .
We leave the details to the reader. We are now in the position to establish the equation (3.10)
LAG) = L A H I .
Consider first a word w = a , . . . a, in L,(H), where each ai is in C,. Let x i be such that
Because also w 5 w, we obtain x 1 . . . x, h(w)
=
x,
= U’and,
. . . x,
consequently,
= M’.
(3.9) implies now that
s -* (;
h(w)
= U’.
Because w is in X:, it follows from the definition of P that w is in L,(G). Consequently, the right-hand side of (3.10) is included in the left-hand side.
11 SINGLE FINITE SUBSTITUTIONS ITERATED
76
Conversely, consider a word w in L,(G). By (3.9) there is a word w 1 such that S$*w, and h(w,) = w. Assume that w 1 = x , B , x , . . . X ~ - ~ B where , ~ , , t 2 0, each x i is in Z:, and each Bi is a letter not in C,. By Lemma 3.1 there are words yi in CX, 0 I iI t, with the property ni
Xi
Yi.
Yi
Consequently, (3.11)
h(w1) = YOBlYl . . .Yt-lBtY, = w.
By the definition of P we have also (3.12) Because y i
w (3i w
y i ~ y i , 01
and
is t.
yi, to prove that
(3.13)
w?w
it suffices to show that
B , . . . B, 2B,
(3.14)
*.
B,
whenever B, . B, is a subword of w (cf. (3.1 1)) such that no Biappears in w immediately to its left or right. By (3.11) and (3.12) it is clear that a
(3.15)
B,
-
* *
B, 2 B, - * * B,.
Let
Bi+ui,
u l i l v ,
be a production for Bi in H . Consequently,
Bi + h(cri),
u Ii Iu,
is a production for Biin G. By (3.15), B, . . B, = h(u,. . . u,). By the definition of h this is possible only if
B,.*.B, = U;..tl,. This means that (3.14) is satisfied and, consequently, also (3.13) holds true. Thus, we have altogether
s z*w l $
w
w
and so w E L,(H). (Observe that this shows also that we must, in fact, have t = 0.) This also completes the proof of (3.10). 0
3
77
OTHER LANGUAGE-DEFINING MECHANISMS
If we apply the construction of the previous lemma to the OL system considered in Examples 3.1 and 3.2, we obtain the OL system G I with the axiom b and productions a l a,, a2 a 2 , a3 + a 3 ,
h a4a3, h -+ a , a 2 a 3 b a 4 a 3 , h -+ c l a s ,
-+
+
-+
a4
-+
a4,
c1 + (
as
-+
a5,
c2 + c 1 ,
' 2 ~ 5 ,
The verification of the equation (3.2) is now easy. We are now in the position to establish the main result concerning adult languages. Theorem 3.4. V(A0L) = Y(CF). Furthermore, there is an algorithm for cwwtrwting, given ti context-free grammar G, LI O L system H s w h that L ( G ) = L,(H), and tiice versa.
Proof: Since the second sentence implies the equation Y(A0L) = Y(CF), it suffices to prove the second sentence. Assume first that we are given a OL system H and we want to construct a context-free grammar G such that
(3.16)
L(G) = L , ( H ) .
As in the previous proof, we assume without loss of generality that H = (C, P, S), where S is a letter not belonging to the adult alphabet C,. (By Theorem 3.2 C, can be found effectively.) By Lemma 3.3 we may assume also that, for each a in C,, H contains the production a -+ a and no other production with a on the left-hand side. Let now G be the context-free grammar G = (C\C,, C,, P\{a
-,a l a EX,},
S).
It is now easy to verify that (3.16) holds true. Conversely, assume that we are given a context-free grammar G = (VN, VT, P, S) and we want to construct a OL system H such that (3.16) is satisfied. We may assume that G is reduced (i.e.,every nonterminal is reachable from S and every nonterminal, with the possible exception of S, generates a terminal word) and, furthermore, that (i) S does not appear on the right-hand side of any production, (ii) P does not contain any chain productions A B, where A and B are nonterminals, and (iii) P does not contain any production A A, with the possible exception ofthe production S -,A. H is now defined by -+
-+
H = (VN LJ
VT,
P
LJ
{ a -+ a l a E V , } ,S).
78
SINGLE FINITE SUBSTITUTIONS ITERATED
By our assumptions concerning P,H is indeed a OL system. It is also clear that L(G) G L,(H). To prove the reverse inclusion, consider an arbitrary word w in L,(H). Clearly,
sz*w.
(3.17)
We still have to show that w E V?. Assume the contrary: w = X ~ B ~ X ~ . . . X , - ~ B , Xt ,2, 1,
X ~ V E
i , B ; E VN.
By the construction of H
0 Ii 5 t ,
x i If3 x i ,
and by the assumptions concerning P it is not the case that
Bi2 Bi
or
B i z A.
Consequently, it is not the case that w w. This is a contradiction and, therefore, W E V*,. We infer now from (3.17) that w is in L(G). Thus, (3.16) holds true also in this case. 0 In the remainder of this section we discuss another quite different definitional mechanism, referred to as the J-mechanism. (We use here the notation customary in the literature.) It leads to L systems often called systems with fragmentation. The J-mechanism is similar to the C-mechanism in that it transforms words without excluding any of them. However, otherwise it is quite different from the C-mechanism. The basic idea behind the J-mechanism is the following. The right-hand sides of the productions may contain occurrences of a special symbol 4. This symbol induces a cut in the word under scan, and the derivation may continue from any of the parts obtained. Thus, if we apply the productions a + aqa, b + ba, c + qb to the word abc, we obtain the words u, aba, and b. It might be of interest to know that the J-operator is quite significant from the biological point of view because it provides us with a new formalism for blocking communication, splitting the developing filament, and cell death. We shall now give the formal definitions. We consider here only JOL systems. However, the J-operator can also be associated with other types of L systems. The reader is referred to [Ru3] and [Ru4] for details. Let Z be an alphabet and q a letter (possibly not in C). A word x E (C\{q})* is a q-guarded subword of a word y E C* if qx4 is a subword of qyq. For languages L over C,we define the operator J , by the equation
J,(L) = { x I x is a q-guarded subword of some word of L } .
3
O T H E R L . A N ~ ; l J A ~ ; I ~ - I ~ E F I NMECHANISMS lN~;
79
A language L is termed a JOL language if there is a OL system G satisfying the following conditions: (i) 4 belongs to the alphabet of G and 4 + 4 is the only production for 4 in G ; (ii) L = J,(L(G)). Such a OL system, denoted by the pair (G, 4 ) . is also called a JOL systeni or a OL system with ,fragmentation. Thus, Y(J0L) is the family of languages obtained as collections of 4guarded subwords from OL languages, with the additional assumption that the identity production y -, 4 is the only production for 4 in the OL systems considered. It is easy to see (cf. Exercise 3.3) that if this additional assumption is not made, then the resulting family of languages contains Y(J0L) as a proper subfamily. The following properties of the operator J , are immediate consequences of the definitions:
(i) J,(L) = L for any language L over an alphabet not containing 4. (ii) For any symbols 4 and 4’, the operators J , and J,. commute. (iii) J,(L) is empty if and only if L is empty. (iv) J,(L) c (C\{4))* for any language L over the alphabet X. Consequently, J , is idempotent. Exanipk 3.3. and productions
Consider the JOL system G1 = (G, 4 ) with the axiom aha a
+
h + ubaqaba.
a,
Clearly. (3.18)
L(Gl) = J,(L(G)) = { u h d ( n2 1 ) u { a ” b ~ l 2 n I}.
By definition, the family P ( J 0 L ) contains the family P(F0L). The containment is strict because, as easily verified, the language (3.18) does not belong to Y(F0L). Our next theorem gives a sufficient condition for a JOL language to be finite. ’Theorem3.5. Assirrnr that L is generated by a JOL system ( G , 4 ) such that tlir right-hirnd side of eorr). prorliu.fion either is oj’ length I 1 or c,ontirins an ocrirt-rpnw of’y. 7 ‘ k n I, i s , f i i i i r c > . /’roo$ L cannot contain words longer than twice the length of the longest 4-guarded subword appearing either in the axiom of G or on the right-hand side of some production of G. 0
Consider the regular language
E.ruttipk 3.4.
L
=
(din= 2orn
=
2m
+ 1 forsomem 2 1).
80
11
SINGLE FINITE SUBSTITUTIONS ITERATED
L is not a JOL language because;by Theorem 3.5, a JOL system generating L would have tocontain the production a + a'forsome i > 1 and,consequently, we would have a'' E L, which is a contradiction. 0 One can also combine the operators E and J in a natural way. Thus, languages of the form L n A*, where L is a JOL language and A is an alphabet, are called EJOL languages. Languages of the form J,(L), where L is generated by an EOL system in which the only production for the terminal letter q is the identity q + q, are called JEOL languages. We shall prove that Y(EJ0L) = Y(JE0L) = Y(E0L). The proof is based on the closure properties of 9(EOL), in particular, on the following lemma valid for arbitrary language families. Lemma 3.6. Zja languagefamily Y is closed under gsm mappings, then it is closed under the operator J,.
Proof: Consider a fixed language L in the family 9and a fixed operator J , . Let M be the nondeterministic generalized sequential machine defined as follows. The state set of M equals {so, sl, s2, s3}, so being the initial state and {so, s 2 , s3} the final state set. The transitions/outputs are defined by the table
In the table, a ranges over all letters in the alphabet of L different from q. It is now easy to see that M ( L ) = J,(L), which proves the lemma. 0 Theorem 3.7. 5 Y(E0L).
Y(EJ0L)
=
9(JEOL)
=
6p(EOL). Furthermore, Y(J0L)
Pro?/. The inclusions
Y(E0L)
c Y'(EJ0L)
and
9(EOL)
c Y(JE0L)
are obvious by the definitions. Lemma 3.6 and Exercise 11.1.10 imply that 9(JEOL) c Y(E0L). Consequently, Y(JE0L) = Y(E0L). This means that Y(J0L) 5 Y(EOL), the strictness of the inclusion being a consequence of Example 3.4. Because Y(E0L) is closed under intersection with regular languages, we now also obtain the inclusion LP(EJ0L) E Y(E0L). 0
3
81
OTHER LANGUAGE-DEFINING MECHANISMS
The remainder of this section is devoted to the discussion of hierarchies obtained by limiting the amount of fragmentation in the following way. Let k be a nonnegative integer. We say that a language L E Y(J0L) is obtained by k-1imited.fragmentation under inside control, in symbols L E IC(k), if L is generated by a JOL system ( G , q) such that no word in L(G) contains more than k occurrences of q. If LEY(JOL) but L # I C ( k ) , for any k = 0, 1,2, . . . , we say that L E IC(cu). For instance, all OL languages belong to IC(0). We say that a language L E Y(J0L) is obtained by k-limitedfragmentation under outside cmtrol, in symbols L E OC(k), if L is generated by a JOL system (G, q ) and, furthermore, every word in L is a q-guarded subword of a word in L(G) containing at most k occurrences of q. If L E Y(J0L) but L $ OC'(k), for any k = 0, 1 , 2 , . . . , we say that L E OC(c0). Note the analogy to context-free languages: OC(c0) corresponds to languages of infinite index, and IC(c0) to languages that are not ultralinear. Analogous notions will also be investigated in Section V.3, where OC(k) (resp. IC(k)) corresponds to the finite index (resp. uncontrolled finite index) restriction. 0 Theorem 3.8. IC(k) 5 IC(k
For all k 2 0,
+ l),
OC(k) 5 OC(k
+ l),
IC(k
+ 1) 5 OC(k + 1).
Furthermore, IC(0) = OC(0) and there is a language in OC(1) belonging to IC(C0). Pro05 We prove first the second sentence. The equation IC(0) = OC(0) is obvious by the definitions. Consider the JOL system with the axiom abc and and productions
a + ahc,
b
-+
hc,
b + q,
c + c.
The generated language is
L
=
{ahchc2hc3. . . hc' I i 2 I } u {ciI i 2 I }
{cih(,i+jbci+j+ I . . * b c i + J + " ' l2 i 1,j 2 2,m 2 0 ) . It is easy to see that L E OC(1). It is also easy to see that L$IC(k), for all = 0, 1,2, . . . . This follows because L is not generated by a JOL system where no production for b or c contains q on the right-hand side and, on the other hand, no JOL system for L where q occurs on the right-hand side of some production for b or c satisfies the requirements of k-limited fragmentation under inside control. The inclusions in the first sentence, apart from being proper, follow by the definitions. It is now a consequence of the second sentence that the last
k
82
11
SINGLE FINITE SUBSTITUTIONS ITERATED
inclusion is proper. Finally, the strictness of the first two inclusions follows because 2 1) E I C ( ~ + I) u {~1[;1.iln
{uf"ln 2 I } u {a:"ln z I } u
-
OC(~),
where pi is the ith prime. 0 Finally, we exhibit a language in the class OC(co), i.e., a JOL language that can be viewed as having an infinite index. Theorem 3.9.
The language
L
=
{ b } u {ba2"-'In 2 l } ( { A } u { b } )
is in the c h s OC(o0). Proqf tions
L is generated by the JOL system with the axiom bab and produca -+ a',
b + bqba.
It can be shown that L does not belong to any of the classes OC(k), k = 0, 1,2, . , . ,by making a case analysis concerning the possible productions in a JOL system generating L. The details are left to the reader. 0
Exercises 3.1. For a OL system (C, P, a), consider the pair S = (C,P), referred to as a OL scheme. By definition the adult language of S consists of all words w over C such that w s w . Prove that the adult language of a OL scheme is a finitely generated star language, i.e., a language of the form K * , where K is a finite language.
3.2. Show that the family of adult languages of propagating OL schemes is properly contained in the family of adult languages of OL schemes. Characterize the former family. q
3.3. Consider the OL system G with the axiom aq and productions u bq, b -+ b. Prove that J,(L(G)) is not a JOL language.
-+
a*,
--*
3.4. Prove that every JOL language is generated by a JOL system (G, q ) such that the right-hand side of every production contains at most one occurrence of q. 3.5. Prove that the family Y(J0L) is an anti-AFL.
4
83
COMBINATORIAL PROPERTIES OF EOL LANGUAGES
3.6. Establish the following inclusion relations: Y(ED0L) 5 Y(CD0L) 5 Y(HDOL), Y(CPD0L) 5 9(CDOL), Y(CF) 5 Y(CPF0L). (Cf. [NRSS] and [K2].)
3.7. Let G = (C,P,Q) be a OL system and PI E P. The language generated by G under the production-universal definition with respect to PI,in symbols LV(G,PI),is the subset of L(G) consisting of all words x possessing a derivation w*...*yzx
with Q
E
P1.
(Here the notation y * x means that only productions from Q may be v applied at this derivation step.) The language generated by G under the production-existential definition with respect to PI, in symbols L,(G, Pl), is the subset of L(G)consisting of all words x possessing a derivation w
= . . . =e- y 3 x,
where Q n PI # 0,
The family of languages of the form Lv(G, P 1 )(resp. L3(G, P,))is denoted by Y(V,OL) (resp. Y@,,OL)).The families Y ( V , DOL) and Y(3,DOL) are defined similarly, starting from a DOL system G. Prove that Y(3,OL) 5 Y(V,OL)
=
9(EOL)
and
Y(V,DOL) = Y(ED0L).
Prove also that the families Y(3,DOL) and Y(V,DOL) are incomparable. (Cf. [RS].) 3.8. Let G be a OL or a DOL system and A a subset of the alphabet C of G. The language generated by G under the letter-existential definition with respect to A equals L(G) n C*AC*. The resulting families of languages are denoted' by Y(3,OL) and Y(3,DOL). (Observe that the letter-universal definition, introduced analogously, coincides with the definition using the E-mechanism.) Prove that Y(3,DOL) 5 P(3,DOL) and that Y(3,OL) 5 Y(3,OL). (Cf. [RS].) 4. COMBINATORIAL PROPERTIES OF EOL LANGUAGES
An important research area in the theory of L systems (and in formal language theory in general) is an investigation of combinatorial properties of languages in various classes of languages. This consists of investigation of
84
11 SINGLE FINITE SUBSTITUTIONS ITERATED
consequences of the statement “ K is a type X language.” What does it mean in terms of the (combinatorial) structure of K ? Such results are very much needed for showing that certain languages are not in certain language classes, which can also be used for “constructive” proofs that some language classes are strictly included in some others. In Chapter I we have seen for growth functions of DOL sequences several results that can be used to show immediately that some languages are not DOL languages. The class of EOL languages is a much richer (larger) class than the class of DOL languages, and so it is in general more difficult to provide criteria allowing one to say that a language is not an EOL language. As a matter of fact we do not know combinatorial properties of languages that would be equivalent to the property of being an EOL language. The results that are known so far are of the form: “If K is an EOL language and it satisfies property PI, then it must also satisfy property P , .” Then it suffices to demonstrate that a language K satisfies P, but not P 2 to show that K is not an EOL language. Since the results we are going to discuss in this section are either trivial or make no sense for finite languages, we consider in this section (unless clearly otherwise) infinite EOL languages and EOL systems that generate infinite languages. For the result that we are going to prove now, property P, is defined as follows. Dejnition. Let K be a language over an alphabet X and let 0 be a nonempty subset of X. We say that K is @-determined if for every k 2 1, there exists f l k 2 1 such that for every x, y i n K the following holds: if 1x1, lyl > nk,x = x1ux2,y = xlux2 and I u I , IuI < k, then prese 14 = prese u. Examplc4.1. Let K = {ukb’ukll2 k 2 I} and let 0 = { u } . Then K is @-determined (it suffices to choose n k = 3k). Example 4.2. Let K = {ukb’uklk, 1 2 l} and let 0 = { u } . Then K is not @-determined.
Then property P 2 will be that for x in a @-determined language K, lprese X I determines a bound on the length of x. To prove that indeed if an EOL language K satisfies PI, then it also satisfies P 2 we proceed as follows. We start by defining a subclass of EOL systems that will be very “handy” for our purposes and then observing that these EOL systems generate all EOL languages. Let G = (X,h, S , A) be a synchronized EPOL system where S E X\A and S does not appear at the right-hand side of any production in h. Let W ( G ) =
4
85
COMBINATORIAL PROPERTIES OF EOL LANGUAGES
Z\(A u {S,F ] ) where F is the synchronization symbol of G. We say that G is neatly synchronized if: (1) for every u in Z\S and for every k, 12 1, ALPH(Lk(G,)) = ALPH(L'(G,)). (Let us recall that G, = (Z, h, a, A). For a set of words Z, we define ALPH(Z) = {ulph w I w E Z});
(2) for every a in W(G),there exists an x in A' such that a
$-x .
In the first part of this section we shall study (a subclass of) neatly synchronized EOL systems; this implies that we shall deal only with EPOL systems. We leave to the reader a rather easy proof of the following result. Lemma 4.1. There exists un algorithm that, given any EOL system G, produces an equivulent neatly synchronized EPOL system G.
Next we shall demonstrate a subclass of neatly synchronized EPOL systems that generates all @-determined EOL languages. Let G = (E,h, S, A) be a neatly synchronized EPOL system and let 0 be a nonempty subset of A. (1) For u in W(G),we say that a is @-determined (in G ) if #prese(Lk(G,) n A') = 1 for every k 2 1. (We use leng/h,(G, u, k ) to denote the length of the word in prese(Lk(G,) n A').) (2) We say that G is @-determined if every a in W(G)is @-determined. First, we notice that slicing of an EPOL system preserves its @-determinacy. Lemma 4.2. Let G be an EPOL system. If G is @-determined, then so is speedk G /or every k 2 1.
Now we prove that @-determined EPOL systems generate all @-determined EOL languages. Lemma 4.3. L6.t K be u @-determined EOL language. There exists a O-detennined EPOL system G such that L(G) = K .
Proot Let H = (C, h, S, A) be an EOL system such that L(H) = K . By Lemma 4.1 we may assume that H is neatly synchronized. A letter a in W ( H ) is called nurrow (in H ) if there exists a positive integer s such that if w E usent H and a E alph w, then I wI < s. ( I ) If u in W ( H ) is not @-determined, then a is narrow. This is proved as follows. Since a is not @-determined, there exist d 2 1 and xl, x2 in A + such
86
11
SINGLE FINITE SUBSTITUTIONS ITERATED
d
that a k xl, a 3 x2 and prese x1 # prese x2. Let us assume that a is not narrow. Then, for every t 2 1, there exists a word zlaz2 in went H such that lzlaz2I > t.Consequently,thereexistsapositiveintegerp(takep = max{ lxl 1, Ix21} + 1)such that,foreveryt 2 l,L(H)containswordsoftheform wlxIw, and wlx2 w2 where I w1xIw21, I wlx2 w2 I > tand Ixl 1, Ix2I < p but prese x1 # prese x2. This contradicts the fact that K is @-determined. Consequently a must be narrow. Now for w in L ( H ) let D H , denote a fixed derivation of w in H which is such that no other derivation of w in H takes fewer steps than D H ,W . (2) There exists a positive integer constant r such that for every w in L(H) if trace D H , = ( S , y , , . . . ,y , = w) and y i contains an occurrence of a letter that is not @-determined, then i < r. This follows from (1) and from the fact that in trace DH, the number of words of the same length, say I, is limited by ( # X)'.
(3) Now we complete the proof of Lemma 4.3 as follows. Let Z = {x E Z' IS x for some i E { r , . , . , 2 r - 1) and ulph x consists of O-determined letters only}, where r is a fixed constant satisfying (2). Let consist of all the letters occurring in words in Z and all the letters occurring in those words in usent(speed, H ) that are derivable from 2 in speed, H and which contain @-determined letters only. Let G = (XI, h l , S, A) where C, = A u {S, F } u (where F is the synchronization symbol of H ) and h l is defined by: (i) (ii) (iii) (iv)
h l ( S ) = { x E A + ( S x for some i E { 1, . . . , r - 1)) u 2; h,(F) = {F}; for every a E A, h,(a) = { F } ; for every a E X,
h l ( a ) = {x E Z + la
x and alph x n W ( G )consists of
@-determined letters only}. By the construction, all letters of W(G)are @-determined and, hence,so is G. By (2) L(G) = L ( H ) = K . @-determined EPOL systems turn out to be useful for studying @-determined EOL languages because the derivations in these systems possess a property allowing a particularly suitable speed-up of them. Lemma 4.4. Let G be a @-determined EOL system. There exists 1 2 1 such that speedl G satisjes the following:for everya in W(speed, G), either there exists s, 2 1 such that, for every k 2 1, length,(speed, G, a, k ) < s,, or, for every k 2 1, lengthe(speedl G, a, k ) > k .
4
87
COMRINATORIAL PROPERTIES OF EOL LANGUAGES
PrwJ
Let G
=
(C,h, S, A).
(1) Let out0 G = { U E W ( G ) l a ~ h ( afor ) some a in (A\@)+}. Since G is @-determined, if a E out0 G, then there is no /lin A*@A* such that /?E h(u); consequently, for evcry k 2 1, Ieiigtho(G, u, k ) = 0. Thus if W(G)\out, G = 0, thcn the lemma trivially holds. Otherwise we proceed as follows. (2) Let = W(G)\out, G. Let z1= { a E there exists so, such that, for every k 2 l,leny/h,(G, a, k ) < s,}. If = E l , then the lemma trivially holds. = Z\xl and let h l be the finite subOtherwise we proceed as follows. Let stitution from into z* defined by h , ( a ) = { E l a ~ h ( aand ) & = presr a } . Now let, for each a in z, nont a be a fixed word from h l ( u )and let term a be a fixed word from h(u) n A'. (Note that since G is @-determined, both hl(a) and h(u) n A t are nonempty.) Let, for every a in G, = (E u A u { F } , h, a, A) where F is the synchronization symbol of G and h is the finite substitution defined by
x
z z2
z*
z,
(i) h ( F ) = { F } ; (ii) for every a E A, h(u) = { F } ; (iii) for every u E h(u) = {term a, norit a } .
z,
Since G is @-determined, for every a in (4.1)
z, the following holds:
for every k 2 I , prese(Lk(G,) n A + ) = prese(Lk(G,) n A').
z. z2,
(3) Let, for every a in q ( a ) be the homomorphism defined by q(a) = term a and let, for every u in H, = g,, a) be the DOL system where, for every b in y,(b) = nonf b. Then by (4.1)
z,
(4.2)
(z,
for every k 2 1, prese(Lh((C,)n A')
=
prese q(gk- '(a)).
From the basic properties of DOL systems it easily follows that (4.3) if H = ( V , y, (o) is a DOL system such that L(H) is infinite, then there exists a positive integer constant p ( H ) such that, for every k 2 1, if w E Lk(sprrd, H ) , then I \v [ > k + 1.
,,,,
Let 1 = rnax(p(H,)IuEE-,}.Then (4.2), (4.3), and the fact that term a~ A*OA* for every ( I E Z imply that, for every LI E length,(speed, G, u, k ) > k . Since obviously for every 11 in W(sprrd G)\E2 there exists s, 2 1 such that, for every k 2 I , Ienythe(speedl G, a, k ) < s,, the lemma holds. 0
c2,
The above speed-up of @-determined EPOL systems allows us to prove the following combinatorial property of the languages these systems generate. (Let us recall that for a word x and an alphabet 0, #,x denotes the number of occurrences of letters from 0 in x; in other words # O x = lpresO X I .)
88
II
SINGLE FINITE SUBSTITUTIONS ITERATED
Let G be a @-determined EPOL system. There exist positive Lemma 4.5. integer constants C, D such that, for every x in L(G), if # e x > C , then 1x1 < D""". Proof: Let G = (X,h, S, A). By Lemma 4.4 we can assume that, for every a in W(G), either
(4.4) there exists s, 2 1 such that, for every k 2 1, lengthe((;, a, k ) < s,, or
for every k 2 1, lengthe((;, a, k ) > k.
(4.5)
Let bound G = {a E W(G)1(4.4) holds} and let, for every a in bound G, S, be a fixed positive integer s, satisfying (4.4). LetoneG = { x e s e n t GIS?x}andletr, = m a x { # e x I x E o n e G n L(G)}. Let ONE G = one G n (bound G)' and let rl
=
(max{ l y l l y ~ONE(G)}).(max{S,la~boundG}).
Let C = max{r,, r l } + 1 and let
D
=
(max{ J a I I ais the right-hand side of a production in h } .max{lyllyEoneG})
+ 1.
Now we prove the lemma as follows. Let us assume that x E L(G). (i) If x E one G, then # e x 5 ro < C and so the statement of the lemma trivially holds for x. (ii) If x # o n e C;, then let (S, y,, . . . , y, = x ) with 1 2 2 be the trace of a derivation of x in G. (ii.1) If y, EONE(G), then # e x Ir l < C and so the statement of the lemma trivially holds for x. (ii.2) If y, .$ ONE(G), then alph y , contains a letter a such that (4.5) holds. Thus # e x 2 1 - 1. But by the definition of D, Ix I < D'- ' and so I x I <
D # ex. Thus the lemma holds. 0 Now we are ready to prove a result about the combinatorial structure of @-determined EOL languages. Theorem 4.6. Let K be a @-determined EOL language. There exist positive integer constants C and D such that,for every x in K , if # e x > C, then 1x1 < DiYex. Proof: This follows directly from Lemmas 4.3 and 4.5. 0
4 COMBINATORIAL PROPERTIES OF EOL LANGUAGES
89
As an application of the above theorem we get the following result.
Corollary 4.7.
K
=
{akb'ak11 2 k 2 1 } is not an EOL language.
Proof: This follows from the fact that K is {a}-determined (see Example 4. l), but obviously it is not true that the number ofas in a word from K bounds
its length.
It is very instructive at this point to notice that {akb'ukl1 I l Ik } and {akb'aklk , l 2 1 ) are EOL languages (see Exercise 1.9). In the second part of this section we shall analyze L systems without nonterminals. As a matter of fact we shall analyze systems slightly more general than OL systems: we shall allow a finite number of axioms rather than a single one to start derivations in a system. These systems are defined formally as follows. Definition. A OL system with u j n i t e uxiom set, abbreviated as an FOL system, is a construct G = (Z, h, A ) where A is a finite nonempty subset of C* (called the set ofaxioms of G ) and, for every w in A, G, = (Z, h, w ) is a OL system (called a component system qf'G). The language of G, denoted L(G), is defined by L(G) = UloeA L(G,).
Since the only difference between OL and FOL systems is that in the latter one uses a finite set of axioms rather than only one, we carry all the notation and terminology concerning OL systems (appropriately modified if necessary) over to FOL systems. In particular, it should be clear what an FPOL system (language) is. As a matter of fact in the rest of this section we investigate the structure of FPOL systems. A
Examplv1.3. For the FPOL system G = (Z, h, A ) with Z = { a } , {LL u 5 ) ,and h(u) = { a ' } , we have L ( G ) = {u'"ln 2 0) u { ~ ~ ' ~2" 0). l n
=
We shall now present a theorem on the combinatorial structure of FPOL languages of the following kind: if (an infinite) FPOL language contains strings of a certain kind (structure), then it must also contain infinitely many "other" strings (where other in this case will mean strings that d o not possess this structure). The structure that we investigate is the so-called counting structure represented by the languages of the form { a ; . . . arln 2 1 ) where t is a fixed positive integer, t 2 2, and a,. . . . , a, are letters no two consecutive of which are identical. Example 1.13demonstrated that K = { anhncnln 2 1 } is an EPOL language. K was generated using the synchronization mechanism, hence sent G (the language of the underlying FPOL system) contains strings of the form F",
90
II
SINGLE FINITE SUBSTITUTIONS ITERATED
m 2 1, that do not possess the “clean structure” of K (if an arbitrary word from K is cut into three subwords of equal length, then no two consecutive subwords share an occurrence of a common letter). We shall demonstrate that there is no other way to generate K ; one always has to generate infinitely many “nonclean” strings. In our analysis of FPOL systems we shall need the following additional notation and terminology. Definition.
Let G
=
(C,h, A ) be an FPOL system.
(1) infG is a subset of X defined by: u E inf’G if and only if { a E L(G)I u E alph a } is infinite. Elements of infC are called injnite letters (in G).
( 2 ) .fin G = X\ir$G. Elements o f j n G are calledjnite letters (in G). (3) mirlt G is a subset of inf’G defined by: a E mirlt G if and only if for every positive integer n, there exists an a in L(G)such that #.a > n. Elements of mult G are called multiple letters (in G). (4) copj G = (m lam E L(G) for some u in X+}. (5) The growth relation of G, denoted f G , is a function from positive integers into finite subsets of positive integers defined byfG(n) = { Iul lo! E LE}. (5.1) If there exists a polynomial cp such that, for every positive integer I I and for every m in fc(n), m < cp(n), then f G is of polynomiul type; otherwise f c is exponential. (5.2) If there exists a constant C such that, for every positive integer II and for every m in f G ( n ) ,m C , then f G is limited. (5.3) If # f c ( n ) = 1 for all n 2 1, then fc is termed deterministic.
-=
The aforementioned “clean structure” of an EPOL system (language) is formalized as follows. Definition.
Let X be a finite alphabet.
( 1 ) Let u E C t and let r be a positive integer t 2 2. A t-disjoint decomposition of a is a vector ( a 1 ,. . . , a,) such that a ] , . . . , a, E X t, a1 . . a, = a, and, for everyiin(1, ..., t - l},alphorinalphcritl = 0. (2) Let K E X’ and let t be a positive integer, t 2 2. We say that K‘is (‘i = 1 t-balanced if there exist positive rational numbers cl, . . . , c, with and a positive integer d such that for every CI in K , there exists a t-disjoint decomposition ( a 1 ,. . . ,tl,) of a such that, for every i E (1, . . . , t } , c i ( a I - d I I cli( 5 cila I d. In such a case we also say that K is ( u , d)-balanced and that ( a 1 , .. ., a,) is a (u, d)-balunced decomposition ? f a , where u = ( c l , . . . , c,). (3) An FPOL system G is t-balunced if L(G) is t-balanced. +
+
The following three lemmas describe the basic property of growth relations of t-balanced FPOL systems.
91
4 COMBINATORIAL PROPERTIES OF EOL LANGUAGES
Lemma 4.8. If G = (C, h, A ) is a t-balanced FPOL system with t 2 3, then there exists a positive integer ko such that, for every a in C and for every positive integer n, # fc,,(n) < k o . Proof: Clearly it suffices to show that for every a in C,there exists a positive integer k , such that, for every positive integer n, # f c a ( n ) < k,. Let v = (c,, . . . , c,) and d be such that L(G) is (v, d)-balanced. Let cmi, = min{c,, . . . , c,}. If a E C,then either a E inf G o r a ~ $ 1 1 G. We shall consider these cases separately. (i) Let u E irf G. In this case we shall prove the result by contradiction. Thus let us assume that:
(4.6) there does not exist a positive integer k , such that, for every positive integer n, # fc,(n) < k,. Then we proceed as follows. (i.1) There exist a positive integer no, a positive integer r larger than #C, and words w l , . . . , w, in L$'- such that, for every i in { 1, . . . , t } and for everyj in {l, ..., r - l}, ciIwj+ll> cilwjl + 2d. This is proved as follows. Clearly it suffices to show (i.1) with ci replaced by emin.Let us take an arbitrary n and let fG,(n) = {x,, . . . ,x,} where the elements x l r . .. , x, are arranged in increasing order. Let x i l , .. . , xi, be the longest subsequence of xl,. . . , x, defined as follows: xil = xl, and for 1 I j I r - 1, i j + , is the smallest index with the property that x i , + , - xij > 2d/cmin. If r I # C, then s I # C(2d/cmin).Since n was arbitrary, if we set k, equal to the smallest positive integer larger than ( #C(2d/cmi,)) 1, then we get that, for every positive integer n, # fG,(n) < k,, with contradicts (4.6). (i.2) Let a = alaa2 be a word in L(G) that is long enough, meaning that, for every i E 11,. . . , t } ,(alei > 31w,l + 5d where w,,. . . , w, isasequence(in the order of increasing length) from (i. 1) for some fixed no and r. Let
+
/I'l =
p,
&, w,&, E L"O(G, a),
= C(,W,&~ E
L"O(G, a),
where Or,, Or2 are some fixed words such that 6 , E L""(G, a l ) and E 2 E L""(G, a2). Let, for each i E { 1, . . . , r}, ( B i [ l ] ,. . . ,Bi[t])be a (v, d)-balanced decomposition of pi. Since I pi I 2 I a I and t 2 3, the condition on the length of a assures us that either wi is contained in the word resulting from pi by cutting off its prefix (pi[l])(pref;,,l + 2d(fli[2])) or wi is contained in the word resulting from pi by cutting off its suffix (~uf;,,,,,+~~(/?~[t - l]))(Pi[t]). (Here prefj(w) and sufi(w)denote the prefix and suffixof w of lengthj. A detailed definition is given at the beginning of Section IV.4.) Because these two cases are symmetric, we assume the first one.
92
11
SINGLE FINITE SUBSTITUTIONS ITERATED
Since,foreachiE{l, ..., r - l } , l w i + l l - lwil > 2 d / ~ , , , ~ , , , I ~-~ lpil + ~ l> 2d/cmin.Consequently, I pi+ [11 I - I pi[ 11 I > 0 and so pi+ [13 results from p i [ l ] by catenating to p i [ l ] a nonempty prefix of pi[2]. Also IPr[1]1
- I P l C l l l I(C1(1g1521
+ Iwrl) + d ) - ( C l ( l ~ 1 ~ 2+l I w l l ) - d ) = C1(IwrI
- Iwll)
+ 2d II w , ~ + 2d.
Thus in constructing consecutively &[1], D3[1], . . . , p,[l] we use nonempty subwords of a prefix of p1[2] and we never reach the occurrence of wl indicated by the equality p1 = Elw,E2. However r > #C, and so at least two nonempty subwords used in the process of constructing p 2 [ 1 ] , p 3 [ 1 ] , . . . , p,[ 13 contain an occurrence of the same letter. This implies that there exists a j in {2, . , . , r - l} such that alph(Bj[1])n alph(pj[2])# @,which contradicts the fact that ( p j [ l ] ,. . . , p j [ t ] ) is a (u, d)-balanced decomposition of pj. Thus we have shown that (4.6) does not hold. (ii) Let a EJin G. Let Z be the set of all words a such that alph a G infG and there exists a word /3 in L(G) such that a E h(P) and ulph /3 nJin G # 125. Note that 2 is a finite set and so if we set s=max{la((aEZ},
r = #{pEL(G)IalphPnJinG#@}+ # Z ,
and k = max{k,lb E i n f G } ,
then #fca(n) < 1
+ r + k" for every n 2 0.
0
Lemma 4.9. Let G be a t-balanced FPOL system with t 2 3 and let a E mult G. Thenfc, is deterministic. Proof: Let G = (C, h, A). Clearly there exists in C a letter b that for any m can derive a word /?such that #,p > m. So let ko be the constant from the statement of Lemma 4.8 and let p be a word such that b derives p (in some e steps) and # ,p > ko . Now we prove the lemma by contradiction as follows. If the lemma is not true, then there exist a positive integer no and words ctl, a2 in Ln0(G,)such that la11 # la2 1. But then the number of words of different lengths that fl can derive in no steps is larger than ko and consequently #fc,(e + no) > k o , which contradicts Lemma 4.8. 0
Lemma 4.10. Let G be an FPOL system such that fc is deterministic and copy G is an infinite set. Then fc is exponential. Proof. Let G = (C, h, A), let h be a homomorphism on C* such that (1) E A. Consider the DOL system G = (C, h, 0).Since fc is
h E h, and let
4
COMBINATORIAL PROPERTIES OF EOL LANGUAGES
93
deterministic,fb = f'c. Note that there are arbitrarily large integers m dividing all numbers .fc(n) provided that n 2 n, for suitably chosen n,. The lemma follows now by Exercise 1.3.15. 0 After we have established the basic properties of growth relations of tbalanced FPOL systems we move to investigate the structure of t-balanced FPOL systems the languages of which contain counting languages. These counting languages are defined now. Dejinirion. Let t be a positive integer, t 2 2. A language M over C is calledar-couritinglanguageifM = {ala; ...a:ln 2 1 ) w h e r e f o r i ~{ l , . . . , t}, a i € C and ai # a j + forjE { l , . . . , t - I } . We also say that a j and a j + l are neighbors in M .
In the proof of our next theorem, which is the main result of the second part of this section, we shall use a technique that is a variation of the speed-up technique that we have applied several times already. Also this time we shall be slicing an FPOL system taking several steps at once; but rather than merging everything into one new system we decompose the given system into several new ones (with a desired property satisfied in each of these new systems). Formally, we define this as follows. Let G = (1, h, A ) be an FPOL system and k a positive integer. Definiriun. The k-decornposition of'G is a set 9 = {GI, . . . , G k }of FPOL systems (called components)such that, for every i E { 1, . . . , k } , Gi = (C,hk, A,) where A l = A and A , = { c ( I c I E L ~ - ~ (fGo )r }i ~ { 2..., , k}. It follows directly from the above definition that L(G) = Uf= L(G,) where 9 = {GI, . . . ,G k }is a k-decomposition of G. A particular kind of decomposition will be useful for our purposes. It is defined as follows. Let G = (X,h, A ) be an FPOL system. We say that G is well sliced if (1) for every u in C and every k , 1 2 1, ALPH(Lk(G,)) = ALPH(L'(G,)) and moreover ifx is a word such that I x I 2 2 and # alph x = 1, then x E Lk(G,) if and only if there exists a word y such that lyl 2 2, alph x = alph y and Y E L'(G,) (let us recall again that, for a set of words 2, ALPH(Z) = {alph w l w ~ Z } ) ; (2) foreveryainCifU,,, L"(G,)isfinite,then UnZl L"(G,) = { a l a * a } . Clearly, appropriately rephrased Theorem 1.6 holds also for FPOL systems. By now the reader should find it easy to use it for the proof of the following result. (By a well-sliced decomposition of'an FPOL system we understand a decomposition each component of which is well sliced.)
94 Lemma 4.11. composition.
11
SINGLE FINITE SUBSTITUTIONS ITERATED
For every FPOL system, there exists a well-sliced de-
We are ready now to prove the following result on the structure of tbalanced FPOL languages containing subsets of t-counting languages. (For a language K and a positive integer q, we use less, K to denote # { I a I I c1 E K and la1 I 91.) Theorem 4.12. Let t 2 3, M be a t-counting language, G be u t-balanced FPOL system,cind K = M n L(G). There exists LI constant C such that less, K I C log, qfor every positive integer q. Proof: Let G = (X,h, A ) and A = alph M . By Lemma 4.1 1 there exists a well-sliced decomposition of G ;and since it suffices to prove the theorem for a single component of such a decomposition, let us assume that G is well sliced. Since the result holds trivially when K is finite, let us assume that K is infinite.
( I ) For every letter b in A, there exists a multiple letter a and a word a in {b}' such that a & c1. This is obvious. (2) If aEmult G , bEA, G I E{b}', and a &. a, then (i) ,fco is either constant or exponential, (ii) fcb is either constant or exponential, and (iii) fc, is constant if and only iffCb is constant. We prove (2) as follows. By Lemma 4.9 .fGn is deterministic and, because G is well sliced, for every positive integer n, 1 E f & ( n ) if and only if b' E L"(G,). Let = bi1, bl' , . . . be such that ij = ,fca(j).If z contains infinitely many different words, then G, satisfies the assumptions of Lemma 4.10 and soft, is exponential. Otherwise, because G is well sliced, fca is a constant function. Thus (i) is proved. But ci derives strings "through" b and so a and b must have the same type of growth. Consequently (i) implies (ii) and (iii). (3) Either, for every b in A, f G bis a constant function, or, for every b in A,fGb is exponential. This is proved as follows. Let b E A. From (1) and (2) it follows that fcb is either constant or exponential. Now let a be a neighbor of b (in M ) . Then if we take a word a from K of the form -..a"b"... (or symmetrically . . . b"a". . .) and derive in G words from it in such a way that each occurrence of b in a will produce the same subtree, then if b is not of the same type as a, we obtain a word p in L(G) that is not t-balanced, a contradiction. Consequently, any two neighbors in M must have the same type of growth and (3) holds.
4
COMHlNATORlAL PROPERTIES OF EOL. LANGUAGES
95
(4) It is not true that fGe is constant for every ( I in A. We prove this by showing that if,fG, is constant for every (I in A, then the fact that K is infinite leads to a contradiction. Since K is infinite, we can choose a in K that is arbitrarily long, e.g., so long that each derivation graph for c1 in G is such that on each path in it there exists a label that appears at least twice. In a derivation graph corresponding to a derivation of c( from o in A we choose a path p = eo, el, . . . as follows : eo is an occurrence in (u such that no other occurrence in (11 contributes a longer subword to x : e l + is a direct descendant of cl such that no other direct descendant of e, contributes a longer subword to c(. Now on p we choose the first (from eo) label CJ that repeats itself on p . Then we take the first repetition of D on p (and we let /), p be the words such that the contribution of the first c o n p to the level on which the first repetition of CJ on p occurs is P8. where the indicated occurrence of o is the occurrence of 0 on p ) . The situation is illustrated by Figure 1. Now we proceed as follows. /jp # A. We prove this by contradiction. To this aim assume that A. (i.1) Then every label p on p that repeats itself must be such that p 2 6p6 implies 88 = A.
(i)
pfi
=
FIGURE 1
11 SINGLE FINITE SUBSTITUTIONS ITERATED
96
for some words c(’),[(I), [(’), [(’), . . ., p ( l ) ,ji(l),p@),ji(’), . . .where all the words p ( l ) j i ( l ) ,p(2)ji(2), . , . are nonempty if 68 is nonempty. Consequently, if S8 # A, then there exists a positive integer I, such that #fG,(l) > k,, which contradicts Lemma 4.8(where ko is the constant from the statement of Lemma 4.8).Thus (i.1) holds. But (i.1) implies that a cannot be longer than a fixed a priori constant; since ct was an arbitrary word in K, this contradicts the fact that K is infinite. Thus indeed pfl # A and (i) holds. (ii) Since G is well sliced, a =- yay for some words y, 7 such that alph yf = alph pp and a + K for some a E A + . Since we have assumed that fGa is constant for every a in A, f G , is constant. Then a* 0
0
g
71 * a‘” yCT);* y ( 1 ) a 7 ( 1 )
* a(2) =. p a(1);(2) 1 * Y ( I ) y a G i ( l ) * y ‘ 2 ’ y ( 1 ’ X /” ‘ l ’ aI ( 2 )
j
j
I 1
yo7
=s. d 3 ) j...
a .. .
y(l)ya77(1)j y(Z)y(’)ya77(’)ji(2)jy(3)y(Z)y(’)n)?(1).3(2)~(3) j ...
where all 77, y(’)7(’), . . . , K, a(’),. . . are nonempty words. Since fc, is constant, the above implies that there exists a positive integer I such that #fc,(l) > k o , which contradicts Lemma 4.8 (where ko is the constant from the statement of Lemma 4.8). Consequently, it cannot be true that fGa is constant for every a in A, and so (4)holds. (5) fGb is exponential for every b in A. This follows directly from (3) and (4). (6) There exists a positive integer constant so such that in every derivation without repetitions (in its trace) of a word from K, already after so steps an intermediate word contains an occurrence ofa multiple letter a for which there exist b in A and a in { b } +such that a & a. This is obvious. (7) Now we complete the proof of the theorem as follows: less, K I U , + V2, where U1 is the number of all the words from K of length not larger than q that are obtained by a derivation without a repetition not taking more than sosteps, and U 2 is the number of all the words from K of length not larger than
4
COMBINATORIAL PROPERTIES OF EOL LANGUAGES
97
so+ 1
F ~ W R E2
q that are obtained by a derivation without a repetition taking more than so steps. Figure 2 represents the situation, where s is the number of steps (in derivations without repetitions) required to derive a word in K and 1 is the length of a word in K (so that the point (i, j) is on the graph if in i steps one can derive a word from K of length j). From (2), (5), and (6) it follows that for i > so all the points (i, j) are above the exponential line us for some constant u > 1. But then Lemma 4.8 implies that there exists a constant ho such that (note that sq = log, q )
less, K I U ,
+ U 2 I hoso + ho log, q.
Since log, q = log, qllog, u, less, K I hoso for a suitable constant C. Thus the theorem holds.
+ ho log, qllog, u I C log, 4
0
In particular, the above theorem implies that the way we have generated {a"b"c"ln2 1 ) in Example 1.13 is "as neat as possible" (from the point of view of all sentential forms generated). Corollary 4.13. Let G be an FPOL system such that L(G) contains {anb"c"ln2 1). Then, L(G)\F is 3-balanced for nofinite language F .
Proof: Directly from Theorem 4.12.
0
11
98
SINGLE FINITE SUBSTITUTIONS ITERATED
Exercises 4.1. Prove Lemma 4.1.
4.2. Prove that each FOL language is a finite union of OL languages and that the class of finite unions ofOL languages is not included in the class of FOL languages. (Cf. [RLl].)
4.3. Establish relationships between the classes of languages generated by DOL, POL, OL, FDOL, FPOL, and FOL systems, respectively.
4.4. Prove that
{ ~ 1 ~ ” ~ ”n, ’ 1m
2 0) 4 9(EOL). (Cf. [K3].)
4.5. Let K be a language over an alphabet C and let A be a nonempty subset of X. Let lK,a = {nlthere exists x in K such that # A x = n } . We say that A is numerically dispersed in K if l K . Ais infinite and, for every positive integer k, there exists a positive integer nk such that for every u l , u 2 in I K 3 , if u 1 # u 2 , u 1 > n k , and u2 > nkrthen I u1 - u2 I > k. We say that A is clustered in K if l K + is , infinite and there exist positive integers k , , k 2 both greater than 1 suchthat,foreveryxinK if #,x 2 k,,thenxcontainsat least twooccurrences of symbols from A that are distance less than k 2 . Prove that if K is an EOL language, then if A is numerically dispersed in K , then A is clustered in K . (Cf. [ER2].) 4.6. Prove that K = {x E {u, b f + I #,x = 2“ for some n 2 0) is not an EOL language. (Hint: use the result from Exercise 4.5.) 4.7. Prove that Y(E0L) is not closed under the operation of inverse homomorphism. 4.8. Prove that Y(E0L) is strictly included in the class of regular macro OL languages. (Cf. Exercise 1.15.) 5. DECISION PROBLEMS
Decidability constitutes a very important issue in all investigations dealing with L systems, a fact apparent everywhere in this book. The purpose of the present section is to give an overview on the most important decidability properties concerning EOL languages. They include,just as in connection with any language family, the membership, emptiness, finiteness, and equivalence problems. We want to emphasize at this point that any property shown undecidable for a family Y of languages is undecidable for all families containing 9. Conversely, any property decidable for 9is decidable for all subfamilies of 9. Thus, for decidability results, we are looking for “large” families and, for
5
99
DECISION PROBLEMS
undecidability results, for “small families. For instance, after establishing an undecidability property for OL languages, we d o not explicitly mention that the same property is undecidable also for EOL languages. The decidability properties of the basic families in the Chomsky hierarchy can be stated roughly as follows. Everything concerning regular languages is decidable. Nothing concerning recursively enumerable languages is decidable. Many properties of context-free languages are decidable, whereas most properties of context-sensitive languages are undecidable. As to be expected, EOL languages resemble context-free languages with respect to decidability. We consider first the equivalence problem. It turns out that this problem is undecidable even for OL languages: it is not decidable whether two given OL systems generate the same language. This result is based on the following theorem concerning context-free languages, a theorem which, although quite fundamental in nature, was established rather late when its significance for L systems had become clear. ”
Theorem 5.1. I t is undecidable whether or not two given context-Jree grumniurs generate the same sententia1.form.s.
Proof: Consider an arbitrary instance PCP:
(El,
..
. 1
an),
(Bl,
. . . ,Pn>
of the Post correspondence problem (PCP), where the as and ps are nonempty words over the alphabet { a , b } . We introduce three languages L, L,, and L, over the alphabet { a , b, c, 1, . . . , n } . By definition, L
=
{ l , . . . , n}*c{a, b}*.
L, is the subset of L consisting of all words in L with the exception of words of the form
i l - . . . i f c a i t..ai, . (t 2 1
and
1 I i j I n).
Finally, L, is the subset of L consisting of all words in L with the exception of words of the form i , ... ifcfli;../Ji,
( t 2 1 and
1I ij I n).
Clearly,
(5.1)
L # La LJ Lo
if and only if
PCP has a solution.
We define now two context-free grammars G I and G 2 as follows. The initial letter for both grammars is So and the nonterminal (resp. terminal) alpha bet
{ S o . S , , S2,SJ, S4, A , B )
(resp. {u, b , c , 1,. . . , n}).
1I
100
SINGLE FINITE SUBSTITUTIONS ITERATED
The productions for G1 are listed below. In the list it is understood that i runs through 1,. , . , n a n d j runs through a and 6. So
-+
A,
S o - + B, A -+ S 3 j , A + iAa,, A iSlx, -+
So
+S4,
so
-+
c,
B --+ S,j, B -+ iBpi, B + Sly,
where x (resp. y) runs through all words over {a, b} shorter than ai (resp. pi), including the empty word, A
-+
iS2x,
B
--+
iSzy,
where x (resp. y) runs through all words over {a, 6) of the same length as ai (resp. pi) but different from mi (resp. from pi), S1
is1, S2 + is2, S3 S 3 j , -+
-+
S4
-+
is4,
Sl + c, S2 S3, S3 c, -+
-+
S4 -+ S4j.
The productions of G 2 are obtained from those of G I by replacing the two productions S1 c and S3 c with the production S4 + c. This concludes the definition of G1 and G 2 . Clearly, -+
-+
(5.2)
L(G2) = L.
In fact, L is derived according to G2 using only the nonterminals So and S4. We also have
L(G1) = L, u Lp.
(5.3)
The equation (5.3) is established by showing the inclusion in both directions. Consider first a word w in L(Gl). Since c is in L,, we may assume w # c. Because S4 cannot beeliminated, we conclude that the first production applied in the derivation of w is So + A or So -+ B. Since the situation is symmetric, it suffices to consider the former alternative and to show that w is in L,. The sequence of nonterminals appearing in the derivation of w from A must be one of the following sequences:
( A , Sl), ( A , SZ, S3). In each of these cases it is immediately verified that w is in L,. (In the first case the part of the word coming after the center marker c is “too long.” In the second case it is “too short.” In the third case an error has been found in the matching between the indices i and words ai.)
(5.4)
( A , S31,
5
101
DECISION PROBLEMS
Assume, secondly, that w isin La u L,. Without lossofgenerality, weassume w is in La. By analyzing the structure of w, it is easy to verify that w can be
derived according to G I by one of the three sequences (5.4). Hence, (5.3) holds true. By (5.1)-(5.3) PCP has no solutions if and only if (5.5)
L(Gi) = U G 2 ) .
But clearly G I and G2 generate the same sentential forms when terminal words are disregarded. Hence, (5.5) holds if and only if G I and G2 generate the same sentential forms. Observe that the grammars G I and G2 in the previous proof are linear and A-free. Hence, the stronger version of the theorem, dealing only with this subclass of context-free grammars, holds true. It is also clear that the set of sentential forms of a context-free grammar is generated by a OL system, and by a POL system if the grammar is A-free. Hence, the following theorem is an immediate corollary of Theorem 5.1.
Theorem 5.2.
The equivalence problem is undeciduble for POL systems.
In Theorem 111.2.4 below we shall see that the (language) equivalence problem is decidable for DOL systems. Thus, these two results exhibit the border line between decidability and undecidability. A further sharpening of this border line can be obtained by considering the following comparative decision problem, dealing with both classes of systems: given a DOL system GI and a OL system G 2 , is it decidable whether or not L ( G , ) = L(G2)?This problem turns out to be decidable; cf. Exercise 111.2.7. The following two decision problems can be considered for any pair (9, 9') of language families. (i) The equivalence problem between 9 and 9': given languages L in 9 and L' in Y',one has to decide whether or not L = L'. (In case 9 = 9' we speak of the equivalence problem for 9.) (ii) The 9'-ness problem for 9: given a language L in 9, one has to decide (If 2" is some known family such as the family of whether or not L is in 9'. regular languages, we speak rather of the regularity problem for 9.) To consider problems (i) and (ii), we must have available some effective way of representing languages in the families, such as a grammar or an L system. In the theory of L systems we are interested only in cases where at least one of the language families is an L family. Problem (i) was already discussed above; further results are contained, for instance, in Exercises 5.6 and 5.9. The decidability ofthe equivalence problem between regular languages and OL languages is open.
II
102
SINGLE FINITE SUBSTITUTIONS ITERATED
The following two theorems deal with problem (ii); further results are contained in Exercises 5.5, 5.7, and 5.9. Of the open problems of type (ii) we mention that both the regularity problem for OL languages and the OL-ness problem for regular languages are open. As seen in the next theorem, the regularity problem becomes undecidable if EOL languages instead of OL languages are considered. (Of course, the EOL-ness problem for regular languages is trivial.) The theorem is an immediate consequence of the fact that the regularity problem is undecidable for context-free languages. Theorem 5.3.
The regularity problem is undecidable for EOL languages.
Theorem 5.4.
The OL-ness problem is undecidable for EOL languages.
Pro05 Consider the language L introduced in the proof of Theorem 5.1. Clearly, L is generated by the OL system with the axiom c and productions c-ic, c+cj,
i-i j+j
f o r a l l i i n ( 1 , ..., n}, forjin{a,b}.
Consider also the languages L, and L, from the proof of Theorem 5.1. Clearly, L, u L, is an EOL language. In fact, the grammar G I can be converted to an EOL system generating L, u L, just by adding the “stable” production d --+ d for each terminal letter d. O n the other hand, it is clear (cf. Exercise 5.3) that L, u L, is not a OL language if PCP has a solution. Thus, if we could decide the OL-ness of the EOL language La u L,, we would be solving the Post correspondence problem. 0 The previous proof shows also that it is undecidable whether or not a given context-free language is a OL language. We now turn to a discussion of the membership, emptiness, and finiteness problems. Each of these problems is decidable for the family of EOL languages; and, thus, in this respect Y(EOL) resembles the family P(CF). Theorem 5.5.
The membership problem is decidable for EOL languages.
Prooj The theorem is an immediate consequence of Theorem 2.1. Given an EOL system G, we first construct an equivalent EPOL system G I . To decide whether a given word w is in L(G) we decide whether w is in L(G,).The latter decision can be accomplished because we have to consider only finitely many sequences of words and test whether or not one of them constitutes a derivation of w. 0 Theorem 5.6.
The emptiness problem is decidable for EOL languages.
103
EXERCISES
Proqf: The theorem is a direct consequence of Theorem 1.6; cf. Exercise 5.2. We prove it here by another argument. Consider an EOL system G = (Z, P, OI, A). We define a sequence X i , i = 0, 1, 2, . . . , of subsets of Z as follows: Zo = A,
= {ulfor some s in
ZT,a -+ x is in P } ,
Clearly, for any i 2 0 and any word x over C,x derives a terminal word in i steps if and only if .c' E CT.Consequently, L(G)is nonempty if and only if cu is in CT for some i 5 2", where n is the cardinality of Z. 0 Theorem 5.7.
The j k t e n e s s problem is decidable ,for EOL languages.
Proof: Given an EOL system G, we first construct by Theorem 2.2 an equivalent COL system G I . Let G2 = (C, P, (11) be its underlying OL system. Because a language is infinite if and only if its length set is infinite, we conclude that L ( G , )(and hence L(G)) is infinite if and only if L(G,) is infinite. On the other hand, the finiteness of the OL language L(G,) is easy to decide; cf. Exercise 5.4. 0
The following result will be needed in the solution of the DOL equivalence problems. Theorem 5.8. The validity of the inclusion L EOL lunyiruge L and LI regular lunguage R .
cR
is decidable, given an
Proof: Clearly, L G R holds if and only if the intersection between L and the complement of R is empty. Since the complement of R is regular, Theorem 5.8 follows by Theorems 1.8 and 5.6. 0
Exercises 5.1. Prove that there is no algorithm for deciding whether the intersection of two OL languages is (i) empty, (ii) finite, (iii) regular. 5.2. Investigate different algorithms for solving the membership problem of EOL languages. In particular, use Theorem 1.6. Make comparisons with Exercise 1.1.6. Show also that Theorem 5.6 is a consequence of Theorem 1.6. 5.3. Show in detail that the language L, u L, in the proof of Theorem 5.4 is not OL if PCP has a solution. (Analyze what productions are possible for the different terminals.) 5.4. Describe an algorithm for deciding the finiteness problem for OL languages. Can you make use of the algorithm of Exercise I.1.7?
104
11
SINGLE FINITE SUBSTITUTIONS ITERATED
5.5. Show that the context-freeness problem is undecidable for the family of EOL languages. 5.6. Show that the equivalence problem between DOL and context-free languages is decidable (i.e., given a DOL system G and a context-free grammar H,it is decidable whether or not L(G) = L(H).)
5.7. Prove the fo;lowing “converse” of Exercise 1.3.16: the DOL-ness problem for context-free languages is decidable. (Cf. [Lil].)
5.8. Theorems 5.6 and 5.7 can be established also by using the fact that 9(EOL) is contained in some language family for which emptiness and finiteness are known to be decidable. One such family is the family of indexed languages; cf. [A]. Study the algorithms obtained in this fashion. 5.9. Unary OL systems, i.e., OL systems with just one letter in the alphabet possess decidability properties not possessed by general OL systems. Prove that each of the following problems is decidable:
(i) (ii) (iii) (iv)
equivalence of two unary OL systems; equivalence between regular languages and unary OL languages; regularity problem for unary OL languages; OL-ness problem for regular languages over a one-letter alphabet.
(Cf. [HLvLR] and [S2]. Observe that in (ii)-(iv) “regular” can be replaced by “context-free.”) 6. EOL FORMS
We now turn to a discussion of classes of EOL systems similar in a sense to be made precise below, as well as families of languages generated by such classes of systems. An EOL form constitutes a “model” or “master EOL system” capable of defining a class of “similar” EOL systems through an interpretation mechanism. The study of EOL forms is analogous to the study of grammar forms for phrase structure grammars. This study has been able to shed new light on various aspects of the theory of EOL systems. We want to emphasize at this point that the theory of EOL forms, as well as the theory of L forms in general, constitutes quite an extensive and diversified research area, lying mostly outside the scope of this book. In fact, [WZ] is a book dealing exclusively with L forms and grammar forms. We try to give in this section, including the exercises, only an introduction to those aspects of this research area that we feel are most interesting from the point of view of our exposition in general. We still return to the area of L forms in Section 111.5, where DOL forms will be discussed. This discussion reveals another dimension to the challenging DOL equivalence problems.
6
105
EOL FORMS
Briefly,an EOL form is nothing more general than an EOL system. When an EOL system F is viewed as an EOL form, then a mechanism for constructing interpretations F’ of F , in symbols F’ u F, is present. Each interpretation is itself an EOL system. All interpretations F‘ of F constitute the class Y ( F ) of EOL systems generated by F , and the languages generated by these interpretations F’ constitute the family 9 ( F ) of languages generated by F . The theory of EOL forms investigates the families !q(F) and 9 ( F ) . We still have to define precisely the construction of an interpretation. To emphasize the basic idea, we do this first in a slightly more general setup. A substitution a defined on an alphabet C is termed a disjointjnite letter substitution,a dJI-substitution in short, if for each a E C,a(a) is a finite nonempty set of letters, and a(a) n o(b) = Qr whenever a # b. (The letters in each a(a) come from an alphabet possibly different from C.) Consider now a rewriting system F = (C, P), where Cis an alphabet and P is a finite set of ordered pairs (x, y) or x -, y of words over C (productions or rewriting rules). We refer to F as a rewritingform. Let p be a dfl-substitution defined on C. Define p ( P ) in the natural way to consist of all productions x‘ + y’ such that, for some production x -, y in P , x’E p ( x ) and y’ E p(y). Then a rewriting system F’ = (C’,P ) is called an interpretation of the form F modulo p, in symbols F’ u F ( p ) or shortly F‘ u F , provided (6.1)
C’E
u
p(a) = p(C)
and
P‘
G
p(P).
a€ X
The family of rewriting systems generated by the form F is defined by
w(F)
=
{ F ’ I F ’ a F ( p ) for some p } .
Two rewriting forms F 1 and F 2 are called strictlyform equivalent if %‘(Fl)= Ig(F2).
Thus, an interpretation F’ is obtained by giving to each letter a E C a number of “interpretations” by p(a) = { a l , . . ., Ukl
in such a way that the disjointness condition characterizing dfl-substitutions is satisfied, i.e., no letter can be an interpretation of two distinct letters. By substituting the interpretations of each letter in the productions in P , a new set p ( P ) of productions is obtained. A very important point to notice is that in constructing F‘ we are by (6.1) free to choose any subset of p ( P ) , i.e., we are not forced to take all of the interpreted versions of the original productions. The latter alternative would definitely be too restrictive, and the resulting families % ( F ) would be ofonly little interest. On the other hand, the free choice of P’ in (6.1) also has some disadvantages: it may be the case that some derivations according to F are lost in an interpretation F’.
106
11 SINGLE FINITE SUBSTITUTIONS ITERATED
It may be of interest to observe that the definitions given above are directly applicable to the case where F is a finite directed graph, “master graph,” with the set of vertices C and the set of edges P. Our definitions then give a family of interpretations of this master graph. In an interpretation F’ each vertex of the original F is replaced by a finite set of vertices. If in F there is no edge between two vertices x and y, then in F’ there is no edge between x i and y j , where x i (resp. y j ) is an interpretation of x (resp. y). O n the other hand, an edge between x and y does not guarantee the existence ofan edge between x i and yj. Another observation is that our definitions can be readily extended to a much more general setup: the starting point is an algebraic system F = (C,R),where C is a set and R is a set (not necessarily finite) of relations defined on C. (Note that in case of a rewriting system P defines one finite binary relation.) The definitions of an interpretation and the family 9 ( F ) can still be carried out in the same way. Also the following theorems, apart from the statements concerning decidability, would remain valid. However, we state the theorems for rewriting systems only. The proofs are obvious by the definitions and are omitted. Note in particular that each rewriting system is its own interpretation. Theorem 6.1. Assume that F , F’, F“ are rewriting systems such that F’ Q F and F” a F‘. Then also F“ a F . Thus, the relation of being an interpretation is transitive. Given two rewriting systems F and F’, it i s decidable whether or not F Q F holds. Theorem 6.2. The relation F’ u F holdsfor two rewriting systems F and F’ ifand only if!4‘(F‘) G %(F). I t is decidable whether or not two given rewriting systems are strictly form equivalent.
The definitions and results above are totally independent of whether we are dealing with sequential or with parallel rewriting. This is due to the fact that we have so far considered rewriting systems only as objects with an alphabet and productions and have not considered any mechanisms of “squeezing out” a language. Consequently, we have also not been able to define formally the language family Y ( F ) generated by a form, mentioned at the beginning of this section. It is natural to require that, as far as rewriting is concerned, the interpretations behave similarly to the original form F. Thus, if F is a context-free grammar (resp. an EOL system), then so are the interpretations. Consider now an EOL system F = (C, P, S, A), S E C - A, which is going to be viewed as an EOL form. Let p be a dfl-substitution defined on C.Then an EOL system F’ = (X’,P‘, S’, A ) is an interpretation of F modulo p if the rewriting system (C‘, P’) is an interpretation of the rewriting system (C,P ) modulo p and, in
6
107
EOLFORMS
addition, S’ E p ( S ) and A‘ c p(A), i.e., p preserves the axiom and the terminal alphabet. We are now ready to define the language family Y ( F ) , as well as the notion of form equivalence. This is included in the following formal definition which also repeats the definition of an interpretation in the case of EOL forms. Definition. An EOL form is an EOL system F = ( C , P, S, A), S E C - A. An EOL system F’ = (X’, P‘, S’, A’) is an interpretation of F modulo p, in symbols F‘ u F ( p ) or shortly F‘ u F, ifp is adfl-substitution defined on C such that the following conditions are satisfied:
(i) p ( C ) 2 X’and p(A) 3 A‘; (ii) S ’ e p ( S ) ; (iii) P’ G AP)= Ua-.xinP Au)
+
Ax).
The families of EOL systems and languages generated by F are defined by Y ( F ) = {F‘I F‘ u F ( p ) for some p}, P ( F ) = { L ( F ’ ) (F‘ -a F ( p ) for some p } .
Two EOL forms F1 and F , are called form equivalent (resp. strictlyform equivalent) if
Y ( F 1 )= 9 ( F , )
(resp. Y(Fl) = !9(F2)).
Note that condition (iii) does not give quite so much leeway as condition (6.1) for the choice of P’ because, in the case of EOL forms also the interpretation F‘ must be an EOL system, i.e., there must be at least one production in P’ for every letter of the alphabet X‘.However, the results stated in Theorems 6.1 and 6.2 remain valid for EOL forms. We summarize these results in the following theorem. The theorem also contains one additional result, due to the fact that the inclusion % ( F l ) G Y ( F 2 ) implies the inclusion Y ( F , ) G 9 ( F 2 ) .
Theorem6.3. The relation u for EOL systems is decidable and transitive. The relutiori F I a F 2 holds ifand only i f 3 ( F l ) 9 ( F 2 ) . The relation F , u F , implies the inclusion Y ( F l ) G Y ( F , ) but the converse implication is not valid in general. Strict form equivalence is decidable for EOL forms. Note that in this section we use the terms “EOL system” and “EOL form” interchangeably : the notions themselves are the same, but usage of the latter emphasizes the fact that we want to consider also interpretations. (The requirement that in an EOL form the axiom is always a nonterminal letter is made because ofcertain technical reasons; cf. Exercise 6.2. Every EOL language is generated by an EOL system with this property.) We use the term “form equivalence” to emphasize t he difference from the ordinary equivalence of two
108
1I
SINGLE FINITE SUBSTITUTIONS ITERATED
EOL systems. Thus, the form equivalence (resp. equivalence) of F , and F 2 means that Y ( F , ) = 9 ( F 2 ) (resp. L(F,) = L(F,)). Since the family Y ( F ) is invariant under renaming of the terminal alphabet of F , two EOL forms can be form equivalent without being equivalent. The following example shows that two EOL forms can also be equivalent without being form equivalent. Exatnple 6.1.
Consider the EOL forms
F , = ({S, a ) , {S Sa, S -+ a, a --* a } , S, { a ) ) , F2 = ({S, a } , {S + S, S + SS, S + a, u -+ S}, S, { a } ) . +
Clearly,
L(F,) = L(F2)= { d i n 2 1). We shall see later in Theorems 6.7 and 6.8 that Y ( F , ) = Y(REG)
Y ( F 2 ) = Y(E0L).
and
Very little can be said in general about structural properties of the family Y ( F ) ,such as closure properties, when F is an arbitrary EOL form. Example 6.1 shows that in some cases Y ( F ) possesses very strong closure properties, for instance, Y ( F , ) is an AFL. The opposite holds true for the EOL form F defined in our next example. Exampltn 6.2.
Let F be the EOL form
F = ({S, A , a, b, c ) , P , S, {a, b, c)), where
P = {S -+ a, S + CC, S + AAAA, A
+
AA, A
+
b, a + a, b + b, c + c } .
We leave to the reader the detailed verification of the fact that Y ( F ) is an anti-AFL. For instance, the languages {ul,a 2 a 2 >and { a 2 ,alal}are in Y ( F ) , but their union is not in Y ( F ) . The other nonclosure properties are consequences of the following observations regarding the length sets of languages in Y ( F ) .The number 3 is not in any length set. The length set of every infinite language in Y ( F ) contains an infinite arithmetic progression. Our next theorem gives a closure property possessed by the family Y ( F ) . provided F is an EOL form. Theorem 6.4. dJI-substitution.
If F is an EOL form, then the family Y ( F ) is closed under
Proof. Let F' = (XI,P', S', A') be an interpretation of F , and let z: A' + A" be an arbitrary dfl-substitution. We have to show that .r(L(F'))is in Y ( F ) . We
6
109
EOL FORMS
assume without loss ofgenerality that A“ (X’- A’) = 0.We extend T to X’ by defining ? ( A ) = A for every A E X’ - A‘. Clearly, this extension is also a dfl-subst itut ion. Consider now the EOL system
F“ = (~(z’), T(P’),s’,~(a’)).
(6.2)
By the definition of an interpretation, F“ is an interpretation of F’ modulo T. Hence, by Theorem 6.3 F” is an interpretation of F,which implies that L(F”)is in the family $U(F). On the other hand, it is easy to see by (6.2) that
L(F”) = T(L(F’)). 0 A result analogous to Theorem 6.4 does not hold if instead of dfl-substitutions more general types of substitutions are used. For instance, if T is a noninjective letter-to-letter homomorphism, we cannot conclude (as in the proof above) that F” is an interpretation of F’ modulo T. We now discuss some results concerning the reduction of EOL forms in the following sense. Given an EOL form F , we want to construct an EOL form F , that is form equivalent to F and satisfies certain additional requirements, for instance, is propagating. As we have seen, a number of such results are valid for EOL systems. (When dealing with the reduction of systems, we consider of course equivalence instead of form equivalence.) Some of them carry over to EOL forms. The proofs are in general more involved for forms than for systems because, when establishing form equivalence, we are dealing with infinite language families. There are also quite surprising “nonreducibility” results for forms; for instance, there are EOL forms for which no propagating form equivalent EOL form exists. Two such nonreducibility results are contained in Examples 6.3 and 6.4 below. The reader is reminded of our convention, according to which languages differing by the empty word are considered equal. Language families are considered equal if for any nonempty language L in either family there exists a language in the other family differing from L by at most the empty word. Before giving the examples we prove the following lemma which is very useful in proving negative results about EOL forms. Lemma 6.5.
Let F’ = ( Y ,P‘, S’,A’) be an interpretation of an EOL form
F . Assume that (6.3)
xg
=
s’,
XI,
.. . )
xi = y,
Xi+l,
.. .
is an infinite sequence ojwords over X’such that (i) y is the only word over A’ in the sequence, and (ii) every finite initial segment of (6.3) constitutes a derivation according to F‘. Then the language { y } belongs to L?(F).
110
11 SINGLE FINITE SUBSTITUTIONS ITERATED
Pro05 We first provide the letters in the words x,,,
,
. . , xi-
with indices
1, . . . , q, where
q = IXO’..Xi-1J.
Let xb, . . . , xi- be the resulting words. Thus, no letter occurs twice in the word xb . . . xi - I. Considering the sequence (6.4)
xb,
. . .,
XI-1,
xi = y,
Xi+l,
. . .,
it is now easy to construct an interpretation F” of F’ such that L(F”) = {y}. In fact, it suffices to isolate the productions needed to generate the sequence (6.4). By Theorem 6.3 F” is also an interpretation of F. 0 Consider the EOL form
Example 6.3.
F
=
(IS,a,b, c, d } , P,S, {a,b, c, 4 )
P
=
{S -, aba,a -,cd, b
with +
A, c -,c, d
+
d}.
We claim that no propagating EOL form is form equivalent to F. Consequently, reduction to propagating forms is not always possible. To establish our claim, we assume that F , is a propagating EOL form that is form equivalent to F. Since L(F) = {aba,cdcd}, there must be an interpretation F’, of F1 such that (6.5)
L(F;) = {aba,cdcd}.
The EOL system F; is propagating because clearly every interpretation of a propagating form is itself propagating. Observe now that every language in the family 9 ( F ) contains at least two words. Hence, by (6.5) and Lemma 6.5 the words aba and cdcd both occur in the same derivation according to F’,. Since F’, is propagating, they must occur in this derivation in the order mentioned, i.e.,
aba ** cdcd
(6.6)
is a valid derivation according to F;. The contribution of b in (6.6) to cdcd is d, dc, or c. These three alternatives imply, respectively, the existence of the derivation (6.7)
aba ** cdc,
aba ** cdcc,
or
aba ** dcd
according to F;. But each of the derivations (6.7) gives a contradiction to (6.5). Hence, we have established our claim.
6
111
EOL FORMS
Consider the following very simple EOL form
E.runip/c 6.4.
(6.8)
F
=
( { S ,a, b } , { S + a, a 4 h, b + b } , S, {a, b}).
We claim that no synchronized EOL form is form equivalent to F. Consequently, reduction to synchronized forms is not always possible. (Similarly as for EOL systems, we call an EOL form synchronized if, whenever u is a terminal letter such that a a +.Y. then the word x is not over the terminal alpha bet .) Clearly, every synchronized EOL system generating a nonempty language satisfies the assumptions concerning F‘in Lemma 6.5.Every interpretation of a synchronized EOL form is itself synchronized. As regards the form (6.Q L ( F ) = { ( I , h ) and every language in the family 9 ( F ) contains at least two words. From these observations our claim follows even more easily than in the previous example. Both of the previous examples are based on a feature typical of EOL forms, resulting from the definition of an interpretation: it is possible to define the productions for terminal letters in such a way that every language L in Y ( F ) satisfies the following condition. Whenever L contains a terminal word of a certain type, then it necessarily contains also a terminal word of a certain other type. Examples 6.3and 6.4are very simple instances of this “terminal forcing.” For more complicated nonreducibility results, one may use chains consisting of more than two terminal words and also make conclusions based on how the words appear. We shall now establish a reduction theorem for EOL forms. It will also be used in our subsequent discussions concerning completeness and vompletencss. Theorem 6.6. For every EOL form F, one can construct a form equivalent E0Lji)rni F , such that every production in F , is of one of the types
(6.9)
A -+A,
A -+a,
A
+
B,
A
+
BC,
a + A,
where A , B, Care nnnterminals and a is a terminal. Moreover, if’F is propaguting (resp. .sync~hronized),then also F is propagating (resp. synchronized). Proej Wc first reduce F to il form F 2 , where the right-hand side ofevery production is of length at most 2. This reduction is based on the following assertion. We denote by maxr(F) the length of the longest right-hand side of any production of F. A.ssertion. For every EOL form F with maxr(F) = m 2 3, a form equivalent EOL form F with maxr(F) = rn - 1 can be constructed.
112
11
SINGLE FINITE SUBSTITUTIONS ITERATED
To prove this assertion we assume that F = (X,P , S , A) and construct F = (C,P, S, A) as follows. We use labels p for the productions in P . The set P is defined by
P
x l p : a + x in P and 1x1 I 2) LJ{ci -,[PICp‘I, [PI PI [p’l YIP: a x in P and 1x1 2 3 , x = B y , p E C : , y E x * } .
= {a- + [ p ] ,
[p]
+
+
+
+
Here [ p ] and Cp‘] are new nonterminals. The alphabet is obtained from C by adding these new nonterminals. Clearly, maxr(F) = rn - 1. We leave to the reader thedetails ofthe straightforward but somewhat tedious argument showing that F and F are form equivalent. Note that, given an interpretation F’ of F, it is easy to construct an interpretation F‘ of F such that L(F’) = L(F‘): we just choose distinct nonterminals Cp] and [p’] for each production of F‘. Every derivation step according to F’ is then simulated by two steps according to F‘. Conversely, given F‘ we may find the productions of F’ by investigating which nonterminals in F‘ are interpretations of [ p ] and cp’]. In this way we detect the derivations of length 2 that should be collapsed into a production of F’. By repeated usage of the above assertion, we construct an EOL form F , = (X,, P , , S, A)formequivalent toFand with thepropertymaxr(F,) 5 2. F, may still contain productions that are of none of the types (6.9), for instance, a + A, a + BC, or A + aB. To get rid of them we define now the EOL form F , = (El, P , , S, A) as follows. The set P , is defined by PI =
I.
[PI
Cp’l b”1, Cp’l B, CP”1 Y I p : ci + Py in P , ; ci, p, y in X,} u {a -+ [PI. [PI + [p‘l, Cp‘1 + xlp: x in P2,1x1 I1 ) . +
[PI,
+
+
+
+
Here again [ p ] , [p’], [p”] are new nonterminals (distinct for each production p in P,), and the alphabet C, is obtained from X2 by adding these new nonterminals. It is now clear that the productions of F , are of the types (6.9). The form equivalence of F , and F , is established similarly as the form equivalence of F and F in the assertion above. The only difference is that one step in a derivation according to an interpretation of F, is now simulated by three steps in a derivation according to an interpretation of F , . It is easy to verify that the property of being nonpropagating or nonsynchronized is not introduced at any stage of our reduction process of constructing F,. 0 One may establish general results (“simulation lemmas”) for showing the form equivalence of two forms in situations like the ones encountered in the
6
113
EOL FORMS
previous proof where, for some number k, productions in one form are simulated by derivations of length k in the other such that the words at the intermediate steps are not over the terminal alphabet. For such results the reader is referred to [MSW 11. We call an EOL form F complete if
9 ( F ) = 9(EOL). We are now in the position to prove that the form F 2 given in Example 6.1 is complete.
F
-
The EOL form
Theorem 6.7. =
(lS, a } , {S
S, S --* SS, S --* a, a --+ S}, S, { a } )
is complete.
Proof: Let L be an arbitrary EOL language. By Theorem 2.1 L is generated by a propagating EOL system G. Apply now the transformation of Theorem 6.6 to G, yielding a form equivalent G 1 with all productions of the types A-a,
A-B,
A-BC,
a+A.
Observe that the transformation also preserves equivalence, hence,
L
=
L(G) = L(G1).
But clearly C, is an interpretation of F . Since L was arbitrary, F is complete.
0 For instance, the following EOL forms can be shown to be complete essentially by a reduction to Theorem 6.7. We list the productions of the forms only: F,: F,: F,: F,: F,:
S - a, S + S, S + a, S - S, S - + a , S - A, S + A, A + S , S-a, S-SSA,
S - Sa, S + US, S-S, A-SS, S-S,
a + S, a - S, S-SSS, A-a, a-S
S-SS,
A-a,
a+S, A, A + A. a-
Note that the form
H,:
S-+A,
A+S,
a-A
resembling F4 is not complete because L(H,) does not contain any word of length 3. (Clearly, a necessary condition for the completeness of a form F is that L(F) contains a word of every positive length.)
114
11
SINGLE FINITE SUBSTITUTIONS ITERATED
Note that every complete form F gives a “normal form theorem” for EOL systems: every EOL language is generated by an EOL system whose productions are of the types listed in defining F . A general characterization of complete forms is missing although some necessary as well as some sufficient conditions for completeness are known ; cf. [MSWl]. Such a characterization is difficult even in the special case of forms with only one nonterminal S and only one terminal a ; cf. [CMO]. It is also an open problem whether or not the completeness of a given EOL form is decidable. Instead of the family 9(EOL), one can also choose some other family 9and study the question of whether Y ( F ) = 2’holds for a given EOL form F. In the following theorem we show that the form F , given in Example 6.1 generates the family of regular languages. Theorem 6.8.
The EOLform F
=
({S, a } , {S + Sa, S + a, a
+
a } , S, { a } )
satisjes Y ( F ) = Y(REG).
Proof: That every regular language is generated by an interpretation of F follows by the fact that every regular language is generated by a grammar with productions of the types A + Ba
and
A+a.
Hence, to prove the theorem, it suffices to show that an arbitrary interpretation F’ = (E’, P‘,S’, A‘) of F generates a regular language. The only difficulty here is caused by the interpretations of the production a -, a, applied in parallel. To overcome this difficulty, we consider first the left-linear grammar G’
=
(C’, I“‘,S’, A’)
where P” is P’ with all productions for terminals removed. Since L(G’) is regular, it suffices to construct a generalized sequential machine M with the property L(F’) = M(L(G’)).
(6.10)
Suppose that A’
=
{ u l , . . ., a,}. Define
T,(ai)= { a j E A ’ l a i $ u j } , U ( n ) = (T,(ul), . . . , T,(u,)),
n 2
0, 1 I i I r,
n 2 0.
Note that there are only finitely many vectors U(n).The collection of these vectors is defined to be the state set of M , as well as both the set of initial and
6
115
EOLFORMS
final states. The input and output alphabet of M equals A'. When scanning ai in the state U(n),M goes to the state U(n + 1) and outputs a letter b E T,,(ai). The validity of the equation (6.10) now follows easily by the definition of M.
0 Theorem 6.8 is a very special case of the general result (cf. Exercise 6.5) showing that a certain type of parallel rewriting can be introduced to a context-free grammar and the generated language will still be context-free. There is no EOL form F with the property Y ( F ) = Y(CF). This is a consequence of the following more general result, established in [AM]. If the language L = {a'b'c'djli,j 2 1) is in the family Y ( F ) generated by an EOL form F , then Y ( F ) contains also a non-context-free language. The proof is based on an analysis of EOL derivations of the language L. According to Theorem 6.3, whenever F' Q F, then Y ( F ' ) E Y ( F ) . Conversely, we say that an EOL form F is good if every subfamily of 9 ( F ) , which is the language family of some EOL form, is generated by an interpretation of F. More specifically,an EOL form F is good if for each EOL form F with Y ( F ) E Y ( F ) and EOL form F' exists such that F' Q F and Y ( F ' ) = 9 ( F ) , If F is not good, it is called bad. An EOL form F is called very complete or vomplete if F is complete and good. The following example shows that the difference between good and bad occurs already at a very simple level and also that deciding whether a given form is good or bad might be a very challengingproblem even for surprisingly " innocent-looking" forms. Example 6.5.
Consider the EOL forms
F,: F2:
S + a , a + N, N + N, S + a, a + a .
We claim that F , is bad and F 2 is good. Clearly, Y ( F , ) = Y ( F 2 ) = Y(SYMB), the family of languages in which each language is a finite set of single letter words. Consider the EOL form H:
S+a,
a-b,
b+b.
Clearly, Y ( H ) c Y(SYMB) and every language in Y ( H ) contains at least two words (because of terminal forcing). Hence, by Lemma 6.5, there is no interpretation F ; of F , with the property Y ( H ) = Y ( F ; ) and, consequently, F1 is bad. Note that H is an interpretation of F 2 .
116
11
SINGLE FINITE SUBSTITUTIONS ITERATED
Denote by Y,(SYMB), m 2 1, the subfamily of V(SYMB) consisting of languages with at least m words. Clearly, V,(SYMB) = Y ( F 7 ) where
F7:
S+al,
a , + a 2 , ..., a m - l + a m , a m + a m
is an interpretation of F , . Using an argument essentially the same as the one used in the proof of Lemma 6.5, it can be shown that every subfamily of Y(SYMB)generated bysomeEOLformequalsoneofthefamiliesLZ’m(SYMB). The details are left to the reader. From these facts the goodness of F, follows.
0 Theorem 6.9.
The EOL form
( { S , a } , { S + S, S
+
SS, S
+ a,
S
+
A, a + S } , S, { a } )
is vomplete. No propagating or synchronized form can be vomplete. Proof: The first sentence is a consequence of Theorem 6.6 because the productions (6.9) are interpretations of the productions listed above. The second sentence follows by Examples 6.3 and 6.4. 0
An EOL form F1 is called good relative to an EOL form F , if, for every interpretation F ; of F , , there exists an interpretation F’, of F , such that Y(F’,) = Y ( F ; ) . Two EOL forms are called mutually good if each of them is good relative to the other. As regards the forms presented in Example 6.5, F, is good relative to F , but not vice versa. Thus, F , and F , are not mutually good. Two vomplete forms are mutually good. Clearly, mutual goodness is an equivalence relation. The mutual goodness of two forms implies their form equivalence. In fact, we are dealing here with a hierarchy of equivalence relations for EOL forms. The equivalence of two forms means that they generate the same language (regarded as EOL systems). Their form equivalence means that they generate the same language family, and their mutual goodness that they generate the same class of language families. This hierarchy can be continued in a natural way to higher levels. Example 6.6.
By Theorem 6.8 the EOL form F,:
S+Sa,
S+a,
a+a
generates the family of regular languages. In the same way we can show that the form
F,:
S-raS,
S+a,
a+a
6
117
EOLFORMS
,
generates the family of regular languages. Thus, F and F , are form equivalent. It is, however, a surprising fact that F , and F , are not mutually good. In fact, considering the interpretation
F;:
S+a,
S+bS,
a-a,
b-c,
c+a
of F , , one can show that there is no interpretation F; of F1with the property Y ( F ; ) = Y ( F > ) .The details are left to the reader. They can be found also in [MSWS]. We have discussed in this section only one type of interpretation. Another type of interpretation (deterministic) will be dealt with in Section 111.5. We conclude this section with some facts concerning interpretations called uniform. Uniform interpretations of an EOL form F constitute a subclass Yu(F) of 9 ( F ) , obtained by introducing the additional requirement that the substitution has to be uniform on terminal letters. More specifically, a uniform interpretation F‘ of an EOL form F , in symbols F , is defined as an interpretation of F except that in point (iii) of the definition it is required that P’ E p,,(P), where pu(P) is the set of productions obtained as follows. Assume that Fl-a,,
a. + a l . . . ~ , E P
and
ab + a’,
. . . a;Ep(ao + a l ... a,)
where the as are letters. Then the latter production is in p u ( P ) if, for all r and s, a, = a, E A
implies
a; = a:.
The family of uniform interpretations of an EOL form F is denoted %,,(F), and the family of languages generated by them is denoted Y , ( F ) . Example 6.7.
The EOL form F determined by the productions
F: satisfies Y J F ) instance,
=
S-SS,
S-a,
a-ra
Y(CF). However, Y(CF) is strictly included in Y ( F ) , for F:
s-+ss, S’a,
a-C,
C’C
is an interpretation of F such that L(F’)is not context-free. If the production a + A is added to F , then the resulting form generates even under uniform interpretation non-context-free languages. The notions of completeness and vompleteness are extended in a natural way to uniform interpretations; cf. Exercise 6.7. EOL forms have weaker reduction properties under the uniform interpretation than under the ordinary
118
11 SINGLE FINITE SUBSTITUTIONS ITERATED
one. On the other hand, uniform interpretations have some definite advantages as regards the characterizability of the language family generated. For instance, interpretations of a "stable" production a + a are themselves stable. This is the basic reason why in Example 6.7 9 , ( F ) = 9(CF). This is also the reason why it is fairly easy to obtain undecidability results for uniform interpretations concerning problems still open for general interpretations. We conclude this section with some such results. Theorem 6.10. The emptiness of the intersection Yu(Fl) n Y , ( F 2 ) is undecidablefor EOL forms F, and F 2 .
Proof: We establish a slightly stronger result: the undecidability for the special class of forms having only stable productions for terminals. Consider an arbitrary instance of the Post correspondence problem, where the as and P s are nonempty words over the alphabet { a l ,a 2 } . Define now a homomorphism h : { #, a , , a 2 , 1,. . . , n}* + {a, b}* by
h(#)
=
ba'b, h(al) = ba3b, h(az) = ba4b, h(i) = ba4+ib, i = 1 , . . ., n.
Let F, and F2be EOL forms with the only nonterminal Sand terminals a and b and with the following productions, where i ranges over 1,. . . , n : F, : Fz:
S S
+ +
h(i)Sh(ai), S + h(i)h( #)h(a,), a --+ a, b + b, h(i)Sh(B,), S + h(i)h( #)h(Pi), a + a, b + b.
We claim that 9,(F1) n 9,(F2) is empty exactly in case PCP has no solution. Assume first that no solution exists. By the definition of uniform interpretation it is easy to verify that any language in 9,(F1) is disjoint from any language in Y,(Fz). Assume, secondly, that PCP has a solution: ait
.
ail = /IiI . . . Bi,.
We consider the uniform interpretation F', of F1 with the productions S h(i1)S1h(aiJ9 Si S,- + h(if)Sh(aif), S,+
,
+
h(i2)S2h(ai1)9 +
h(i, #aiI),
. . ., a
+ a,
b + b.
A uniform interpretation F; of F2is defined in exactly the same way, with fls instead of as. Then L(F',) = L(F2)= {h((i,
it)'"#(aif..-ail)'")lm2 l}. 0
The previous proof also gives immediately the following theorem.
119
EXERCISES
Theorem 6.1 1. und F , :
The following problems are undecidable for EOL forms F1
(i) Is .Yu(F1)n .Y,(F2) infinite;' (ii) Does some word in some language in .Yu(F1)occur also in some language in Y , ( F 2 ) ? (iii) Hus some language in Yu(Fl)an injnite intersection with some language in Y u ( F 2 ):.'
Exercises 6.1. Verify that the family of languages generated by the EOL form F in Example 6.2 is an anti-AFL.
6.2. Prove that Theorem 6.4 does not remain valid if it is not required in the definition of an EOL form that the axiom be a nonterminal. Discuss other reasons for making this requirement in the definition. 6.3. What parts of the construction in the proof of Theorem 1.7 fail if form equivalence (rather than equivalence) of the two systems is required? 6.4. Show in detail that the form F 2 in Example 6.5 is good. 6.5. Consider an EOL system G with productions of the types
A+B,
a + b,
A+aBC,
A-aB,
A-a,
where capital (resp. small) letters are (not necessarily distinct) nonterminals (resp. terminals). Productions of the last three types are referred to as active. Consider the following restriction of the derivations according to G : an active production may be applied only to letters preceded by a terminal or to the first letter of a word. The words derived in this restricted way constitute a subset LR(G)of the language L(G). Prove that the family of such languages LR(G) equals the family of contextfree languages. (Cf. [MSW7]. This result is useful for the theory of EOL systems and forms, as well as for the theory of context-free languages.) 6.6. Show that Theorem 6.6 is not valid if uniform interpretations are considered. In particular, let n 2 2 and consider the EOL form F , determined by the productions S - , a",
a
+ a.
Prove that there is no form F such that (i) F is form equivalent to F , under uniform interpretations, and (ii) the right-hand side of every production in F is of length less than n.
120
11 SINGLE FINITE SUBSTITUTIONS ITERATED
6.7. An EOL form is uniformly complete if its family of languages, under uniform interpretations, equals the family of EOL languages. Prove that every uniformly complete form is also complete but the converse is not true. 6.8. A language L is called a generator of the language family Y if for every synchronized EOL system F , the equation L(F) = L implies the inclusion Y ( F ) 2 Y . Prove that the language a* is a generator for the family of regular languages and that the family of EOL languages has no generators. See [MSW6].
I11 Returning to Single Iterated Homomorphisms
1. EQUALITY LANGUAGES AND ELEMENTARY HOMOMORPHISMS
We now return to the discussion of DOL systems, this time considering more advanced topics. DOL systems occupy a central position in our exposition because on one hand the notion itself is simple and mathematically elegant, whereas on the other hand the basic ideas around the theory of L systems are already present here free of the burden of various definitional details appearing in other classes of L systems. The main result established in the first two sections is the decidability of the DOL sequence and languagc equivalence problems. However, these sections also contain a number of other results that shed light on decision and structure problems concerning homomorphisms. This more general line of investigation is continued in Section 3. Section 4 discusses more advanced topics on growth functions, and Section 5 deals with DOL forms. The following definition leads us to a rich problem area, containing also the DOL equivalence problem. I21
122
Definition.
111
SINGLE ITERATED HOMOMORPHISMS
Let g and h be homomorphisms ofX* into C: (where possibly
X I = Z). The equality language of g and h is defined by Ed93 h) = {wlg(w)
=
We say that g and h are equal on a language L every w in L.
h(w)}.
c X* if g(w) = h(w) holds for
Thus, g and h are equal on L if and only if L is contained in Eq(g, h). For a the homomorphism equality problem of 9 is the family of languages 9, problem of deciding for a given L E 9 and given homomorphisms g and h defined on the alphabet of L whether or not g and h are equal on L. Note that this is an entirely different problem than the problem ofdeciding whether g(L) = h(L). Note also that the DOL sequence equivalence problem is a special case of the homomorphism equality problem for the family of DOL languages. Indeed, an algorithm for the latter problem yields an algorithm for deciding the HDOL sequence equivalence problem; cf. Exercise 1.1. Remark. The homomorphisms g and h being equal on a language L represents the highest possible “agreement” of g and h on L. One can also introduce weaker notions along similar lines. We say that y and h are ultimately equal on L if g ( w ) = h(w) holds for all but finitely many words w in L. The homomorphisms g and h are compatible (resp. strongly compatible) on L if g ( w ) = h(w) holds for some (resp. infinitely many) w in L. Also, these weaker notions lead to the corresponding decision problem for each particular language family 9, especially the ultimate equality problem being of interest from the DOL systems point of view; cf. Exercise 1.2. Coming back to the homomorphism equality problem, it is a very desirable state of affairs that the set Eq(g, h ) is regular. This is not the case in general. For instance, if g and h are defined on {a, b}* by (1.1)
g(a) = h(b) = a,
g(b) = /(a)
= UU,
then Eq(g, h) consists of all words w such that the number of occurrences of a in w equals that of b in w. Hence, Eq(g, h) is not regular in this case. In fact, Eq(g, h) need not even be context-free; cf. Exercise 1.4. We now exhibit a method of approximating Eq(g, h ) by a sequence of regular languages. For this purpose, the notion of balance, defined as follows, will be very useful. Consider two homomorphisms g and h defined on Z* and a word w in X*. Then the balance of w is defined by B(w) = Ig(w)l
-
Ih(w)I.
1
EQUALITY LANGUAGES AND ELEMENTARY HOMOMORPHISMS
123
(Thus, P(w) is an integer depending, apart from w , also on g and h. We write it simply B(w) because the homomorphisms, as well as their ordering, will always be clear from the context.) It is immediate that fi is a homomorphism of C* into the additive monoid of all integers. Consequently, we can write
P(w1w2) = P ( W 1 ) + P(W219 which shows that the balance of a word w depends only on the Parikh vector of w. In what follows, the notion of balance will be applied only in situations where g(w) = h(w) and we are investigating initial subwords of w to see which of the homomorphisms “runs faster.” Also the following definition serves this purpose. For an integer k 2 0, we say that the pair ( g , h) has k-bounded balance on a given language L over X if IP(w)l 5 k holds for all initial subwords w of the words in L. We denote by Eqk(g, h) the largest subset A of Eq(g, h) such that the pair (9, h) has k-bounded balance on A. Clearly, the inclusion Eqk(g, h,
&k+
I(g, h,
holds for all k. It is also obvious that
u 00
(1 -2)
Eq(g, h, =
‘%k(g, h)*
k=O
Thus, the sets Eq&, h), k = 0, 1, 2, . . . ,form a sequence approximating the set Eq(g, h). It is a desirable situation from the point of view of decision problems concerning homomorphism equality that this sequence terminates, i.e., (1.2) is reduced to a finite union. That this is not true in general is demonstrated by homomorphisms g and h defined as in (1.1). For any k and any homomorphisms g and h, the language Eq,(g, h) is regular. Indeed, a finite automaton Ak accepting Eqk(g, h) can be constructed as follows. We give first the intuitive idea, the formal details being contained in the proofbelow. Theautomaton Akhasa“buffer”oflengthk. When reading an input word, At remembers which of the homomorphisms runs faster and also the excessive part of the image up to the length of the buffer. An input x is immediately rejected in case of an overflow of the buffer and also if, for some prefix x 1 of x, neither one of the words g ( x l ) and h ( x l ) is a prefix of the other. A , accepts an input x if and only if x E Eqk(g, h). We now give the formal details. Theorem 1.1. For each k 2 0 and each homomorphisms g and h, the language Eqk(g, h) is regular and can be constructed effectively.
124
111
SINGLE ITERATED HOMOMORPHISMS
Proof. The statement holds true for k = 0: in this case Eq,(g, h) equals of X. Assume k 2 1, and define a either { A } or XT, for some subalphabet finite deterministic automaton Ak with the input alphabet C as follows. The state set consists of s (which is both the initial and the only final state), r (the “garbage” state), and of all elements of the forlrr + a and -a, where a is a nonempty word over C with length I k. For a E Z, the values of the transition functionf are defined as follows:
r
+/?
-/?
if g(a) = h(a), if g(a) = h(a)a and if h(a) = g(a)a and
la( Ik, la1 Ik;
if h(a) = ag(a), if ag(a) = h(a)/? and if h(a) = ag(a)/? and
I/?I Ik;
if g(a) = a&), if g(a) = ah(a)/? and if g(a)/?= ah(a) and
I/?II k, I/?[ I k.
1st Ik,
All transitions not listed lead to the garbage state, i.e., f ( x , a) = r for every pair (x, a) not listed above. It is now easy to verify that Ak accepts the language Eq,(g, h). Indeed, if Ak is in the state + a (resp. -a), then the word w read so far satisfies g(w) = h(w)a (resp. h(w) = g(w)a). Consequently, Ak is in the state s if and only if the word w read so far satisfies g(w) = h(w). 0 When dealing with equivalence problems, such as some homomorphism equality problem or the DOL sequence equivalence problem, we speak of “semialgorithms” in the following sense. A “semialgorithm for nonequivalence” is an effective procedure that terminates if the two given DOL systems are not sequence equivalent but which may run forever if they are equivalent. A “semialgorithm for equivalence” is defined analogously. (These notions should be clear also for homomorphism equality problems.) As regards the DOL sequence equivalence problem, a semialgorithm for nonequivalence is obvious: we just generate words from both sequences, one by one, and check whether or not they coincide. Since membership is decidable for WL languages by Theorem 11.5.5, we get a semialgorithm for nonequivalence also in case of the WL language equivalence problem. It is also clear that, whenever we have been able to construct a semialgorithm both for equivalence and nonequivalence, we have shown the equivalence problem to be decidable. A decision procedure consists of running the two semialgorithms concurrently, taking one step from each by turns.
1
EQUALITY LANGUAGES A N D ELEMENTARY HOMOMORPHISMS
I25
The following two theorems apply these ideas. The theorems also show explicitly why Eq(,q, h) being regular is desirable, and form a background for solving problems like the DOL equivalence problem.
Theorem 1.2. Assume that R is a regular language over C, and g and h are homomorphisms dejned on C.Then (1.3)
R E Eq(g, h)
implies
R
G
Eq,(g, h) for some k.
The homomorphism equality problem is decidable for the family of regular languages. Prooj: We establish first the implication (1.3). Assume that R E Eq(g, h), i.e., g and h are equal on R . Let A be a finite deterministic automaton accepting R . Consider paths from the initial state so to one of the final states. Let w be a nonempty word causing a loop in such a path, i.e., for some words w , and w 2 , all of the words w 1 w " w 2 , n 2 0, are in R . The balance of w must satisfy P(w) = 0. Otherwise, for some n large enough, we would have P(WlW"W2) f 0,
a contradiction because g and h were assumed to be equal on R and, consequently, P(x) = 0 for all words x in R . Thus, an upper bound for the absolute value k of the balance of prefixes of the words in R can be computed by considering only such words that cause a transition from the initial state to one of the final states without loops. Indeed, if m is the number of states of the automaton and t = max{ IP(a)lla in Z},
then (1.4)
k I t(m - 1)/2.
The second assertion in our theorem is now immediate by (1.3). To decide whether two given homomorphisms g and h are equal on a regular language R , we can apply the argument of two semialgorithms. The semialgorithm for equality uses also Theorem 1.1 and the fact that the inclusion of a regular language in another regular language is decidable. However, a simpler algorithm is based on the estimate (1.4): to decide whether g and hare equal on R we compute t and m and check whether or not R 5 Eq,,m- 1),2(9, h).
0
Along similar lines, one can show (cf. Exercise 1.6) that the homomorphism equality problem is decidable for any "reasonable" family of languages satisfying the implication (1.3). The following Theorem 1.3 is also a variant of'
111 SINGLE ITERATED HOMOMORPHISMS
126
this result. However,(l.3)isnot necessary for thedecidabilityofthehomomorphism equality problem. This problem is decidable for the family of contextfree languages (cf. [CS]),whereas the context-free language
R = {a"b"ln 2 1) and homomorphisms g and h defined by (1.1) do not satisfy (1.3). Indeed, for this example, although R E Eq(g, h), each of the languages Eqk(g, h) contains only finitely many words from R.
Assume that 9 is a family of (effectively given) languages Theorem 1.3. such that the inclusion
LGR
(1.5)
is decidablefor a regular R and L in 9.Assume, further, that H i s a family o j homomorphisms such that Eq(g, h) is regular for all g and h in H . Then it is decidable whether or not two homomorphisms g and h from H are equal on a language L in 9.
Proof: The assertion is obvious if we can effectively construct the regular language Eq(g, h): we just check the validity of (1.5) for R = Eq(g, h). Otherwise, we run concurrently two semialgorithms. The one for nonequality is obvious: we consider an effective enumeration w o , w l , w2, . . . of L and check whetherg(w,) = h(wi).ForthesemialgorithmA forequality,let R o , R I , R 2 , . . be an effective enumeration of regular languages (over the alphabet of 15).In the (i 1)th step of A, we check whether g and h are equal on Ri. This can be done by Theorem 1.2. If the answer is positive, we check the validity of (1.5) for R = Ri. The correctness and termination of this algorithm are obvious by our assumptions. 0
+
The following corollary of the results above shows that Eq(g, h) is regular exactly in case the right-hand side of (1.2) can be replaced by a finite union. Theorem 1.4. ( 1.6)
The language Eq(g, h) is regular if and only if, for some k, Eq(g, h) = Eqk(g, h).
ProoJ The"if"part follows by Theorem 1.1.The"on1yif"part follows by choosing R = Eq(g, h) in Theorem 1.2. 0 The results above are of a general nature and can be applied to various decidability problems dealing with homomorphism equality. We now turn to a discussion of more specific results, crucial to the DOL sequence equivalence
1 EQUALITY LANGUAGES AND ELEMENTARY HOMOMORPHISMS
I27
problem. For this purpose, we remind the reader of the notion of an elementary homomorphism introduced in Section 1.1. The following definition introduces a closely related notion which is more convenient in some proofs. A finite language L is elementary if there is no language L1 Definition. such that # ( L , ) < # ( L ) and L E LT.
L
Thus, the language {bc, abca, bcabc} = L is not elementary because G { a , bc}*. This implies that the homomorphism h defined by
h(a) = bc,
h(b) = abca,
h(c) = bcabc
is simplifiable through an alphabet of two letters and, consequently, h is not elementary. The observation made for this example is valid also in general; hence we get the following result, the proof of which is obvious. Theorem 1.5. l f ’ a homomorphism h defined on X is elemenary, then so is the language { h(a)I a E X}.Conversely, (fthelanguage {h(a)I a E C} is elementary und consisrs of’#(C) words (i.e., h(a) = h(b) holds jor no a # b), then h is elementary.
An algorithm was outlined in Section 1.1 for finding out whether or not a given homomorphism h is elementary. In view of Theorem 1.5, a more straightforward decision procedure is obtained by considering the set {h(a)1 a E C } . (Cf. Exercise 1.7.) The following theorem is the main result in this section. It establishes an important property of elementary homomorphisms, a property which can also be interpreted in terms of the theory of codes, as we shall see. It is also the main tool in the proof of Theorem 1.9 which, in turn, constitutes a crucial step in the proof of the decidability of the DOL sequence equivalence problem. Essentially, the theorem says that, for each elementary language U , one can find a constant q with the following property. Whenever a word w E U* is a prefix of another differently beginning word in U*, then the length of w is bounded by 4. Theorem 1.6. Let U = {u,, . . . , u k } be an elementary language over the alphabet C . Assume that
Then I u i x ( I I U I ” ‘ U k I
-
k.
Proof: The proof is by induction on Iu i x I. The basis 1 u i x I = 0 is clear because always Jul . . . utl - k 2 0. (Note that an elementary language can never contain the empty word.) We make the following inductive hypothesis :
111
128
SINGLE ITERATED HOMOMORPHISMS
the assertion is true (for all U ) ,provided I uix I I p. Assume now that I u i x I = p + 1. We have two cases to consider: either uiis a proper prefix of u j , or vice versa. Case 1. Assume that u i z = uj for some z E C ' . Since U is elementary and luil < lujl, we get luil I (u1 * * * u k (- k . Consequently, our claim holds for x = A. Assuming that x # A, we define V = { u l , . . ., uk} by uj = z
(1.7)
and
u, = u, for
t # j.
Since U G V*, we conclude that whenever V E V'* then also U E V'*.Thus, V must be elementary because U is elementary. Clearly, we have (1.8)
xy = zy
and I u 1 " ' u k I = 101 ."ukI + ( u i l . (1.9) We intend to apply the inductive hypothesis to the equation (1.8) and to the elementary language V. We separate two subcases according to whether or not x begins with u j . Subcase la. x = u,xl, for some m # j and x 1 E U*. Then by ( .8) u,xly = zy and hence by (1.7) u,xly = ujy,
m # j , ~ E C * , x l , Y E V*.
But now (u,,,xlI = 1x1 < l u i x l = p hypothesis is applicable, yielding
+ 1 and, consequently, the I1111* * . u ~ I
1x1 = Iu,x11
inductive
k.
-
Consequently, by (1.9),
Iu~x= ~ I U i ( + Itr,X1(
I( u i (
+
101 . * . ~ k (-
k
= Iu1
-
k.
Subcase Ib. x = u j x l for some x 1 E U*.Thus
,
x = u . x1 = UiZXl =
UiUjXl =
uixz,
where x 2 = u j x l is in V*. Consequently, by (1.8) and (1.7) u i x 2 y = ujy,
Because luixzl = 1x1 < p We obtain by (1.9)
I u ~ x ~= luil
+
i # j,
x z , Y E V*.
+ 1, the inductive hypothesis is again applicable.
l ~ i ~I z l~
+u101 ~ . . *J u ~J k = Iu1 . . . ~ k l - k.
Thus, we have completed the inductive step in Case 1.
1
129
EQUALITY LANGUAGES AND ELEMENTARY HOMOMORPHISMS
Case 2. Assume that u j z = ui for some z E C ' . This case is easier, and we do not have to distinguish subcases. We define now V = { u l , . . . , vk} by v, = u, for
ui = z,
t # i.
As before, we conclude that I/ is elementary. Now the equation uixy = u j y gives us zxy = y . Because z differs from all of the words ut (otherwise, U is not elementary), we can write y = v,,,y,, where m # i and y , E V*. Thus, we
obtain uixy=u,,,yl,
?EX*, x , y , ~ V * .
m#i,
Since 1 uix I c I u i x 1, the inductive hypothesis is again applicable. Thus, by the inductive hypothesis and the equation (u1 ' " u k l
UkI
+
+ )U1...UkI
-
=
IV1
"'
lujl
we obtain finally IUiXl
=
IUjl
-k
IViXl
I
lUjl
which completes the inductive step in case 2.
k
= ( U 1* * . U k ( -
k,
0
Before continuing the line of results needed for the WL sequence equivalence problem, we make a small excursion into the theory of codes to point out some important interconnections between elementary languages and codes. Definition.
(1.10)
A nonempty subset U of C* is a code if, whenever ui, * .
.uim
=
Ujl
*.
*
uj,,
u i t , uj, E
u,
then uil = uj,. Clearly, if U is a code, then (1.10) implies that m = n and uit = uj, for t = 1, . . . , m. Thus, every word in U* can be "decoded" in a unique fashion as a product of words in U . It is easy to see that U is a code if and only if there is a set of symbols C, and a bijection of C,onto U that can be extended to an injective homomorphism of X: into C*. For our purposes,finite codes (i.e., U is a finite set) will be most interesting. The following theorem is now an immediate corollary of Theorem 1.6. Theorem 1.7. Every elementary language is a code. Every noninjective homomorphism is simplifiable.
Proof: The second sentence follows from the first by Theorem 1.5. To prove the first sentence, assume the contrary: an elementary language U satisfies (1.10) but uil # uj,. Consequently, for any t, (uil . . . uiJ = ( u j ,
.u j J ,
i, # j , .
111 SINGLE ITERATED HOMOMORPHISMS
130
This shows that an arbitrarily long word of U* can be a prefix of another differently beginning word of U*, contradicting Theorem 1.6. 0 Let U G C*be a finite code. (The assumption of finiteness is not necessary but makes the discussion more intuitive.) As noticed above, this implies that there is an alphabet C1and a bijection hl : Z1 + U that can be extended to an injective homomorphism h , : Cy + C*.Let then U1 c Cy be another finite code. Let C, and h 2 : C2 + U , be the corresponding alphabet and bijection. Denote by U' = U , @ U the language over C obtained from U1 by replacing every letter a E X1with hl(a).Clearly, hih,: C, 4 U' is a bijection that can be extended to an injective homomorphism h,h2: C; -,C*. Consequently, U' is a code, termed the product of U and U1. For instance, choosing
U = {a, ba, bb},
U1 = {u, uu, uu, w, w u }
C, = {u, u, w } ,
we get U' = U 1 €3 U = (a, aba, baba, bb, bbba}. It is very interesting to note that the product of two elementary sets, formed in the same way, is not necessarily elementary (although it must be a code, by Theorem 1.7). Thus, also the product of two elementary homomorphisms may be simplifiable (cf. Exercise 1.1.10). Of the special classes of codes investigated in the literature codes with a bounded delay are of interest from the point of view of elementary languages. Before giving the definition we consider as an example the code
U = {a, ab, bb}. Suppose one has to decode a word of the form ab", reading the word from left to right. Then one has to read through the whole word before one is able to d o this since the first decoded letter depends on the parity of the number of bs. Such a situation is not possible if the given code has a bounded delay from left to right: in this case always a certain fixed amount of look-ahead is sufficient. ) extreme example (Thus, these codes resemble LR(L) languages. See [MI.An is provided by codes like (1.11)
U = {aa, ab, ba)
where no look-ahead is needed for decoding. We give now the formal definition. Definition. A code U over the alphabet C has a bounded deluy p from left to right if, for all u E U*, u' E U p ,and w E C*,
uu'w E U*
implies
u'w E U*.
1
EQUALITY LANGUAGES AND ELEMENTARY HOMOMORPHISMS
131
It is immediate that the prefix condition of Theorem 1.6 gives a bounded delay. Hence, we obtain
Theorem 1.8. Every elementary language is a code with a bounded delay from left to right. One can define analogously the notion of a code with a bounded delay from right to left and prove that every elementary language is such a code (cf. Exercise 1.8). On the other hand, there are codes with a bounded delay both from left to right and from right to left that are not elementary languages. An example is provided by (1.1 l), where the delay equals 0. After this brief excursion into the theory of codes, we prove now another corollary of Theorem 1.6, one of fundamental importance for the W L sequence equivalence problem.
Theorem 1.9. I f g and h are elementary homomorphisms mapping C* into ECy, then Eq(g, h) = Eq,(g, h), for some r. Hence, Eq@, h) is regular. ProaJ: By Theorem 1.5 the languages
{s(4Ia E V
IaE
and
are elementary. Let
{g(a)laE C } = { u , , . . . , uk} = U and define (cf. Theorem 1.6) pe = (lul *..ukl- k )
Define the constant
Ph
+ max{Ig(a)IlaEE}.
in the same way with respect to h, and choose P = maxbg, P h ) .
We shall establish first the following result. Assertion.
Assume that x E X* and
YE
CCy are words such that 1 y J > p
and (1.12)
=
h(x)
or
h(X)Y =
Then there is at most one letter a e C such that, for some word z over C, h(xaz) = g(xaz). Intuitively, the assertion means the following. Whenever the absolute value of the balance B(x) of a word x exceeds a certain bound, and we still want to construct a word w such that x is a prefix of w and g and h are equal on w, then this construction is deterministic (at least up to the point where the
132
111
SINGLE ITERATED HOMOMORPHISMS
absolute value of the balance becomes small again). It is again very illustrative to notice that the assertion does not hold true for the (nonelementary) homomorphisms defined by (l.l), no matter how the constant p is chosen. To prove the assertion, we assume that the words x and y satisfy the first of the equations (1.12) and that ( y J> p. This can be assumed without loss of generality because the situation is symmetric with respect to g and h, also as regards the constant p. We argue now indirectly, supposing the existence of two different letters ai and aj satisfying, for some zi and zj, the equations (1.13)
g(xaizi) = h(xaizi)
and
g(xajzj) = h(xajzj).
Denote g(ai) = uirg(aj) = u j . Since g is elementary, ui # u j . Clearly, g(aizi) = uia, where a E U*. Let now z; be the longest prefix of zj such that Jg(ajz;)l I l y l . Write g(ajz;) in the form g(ajz;) = uja‘,
a ’ U*. ~
By (1.12) and (1.13) we now have the result: uja’ is a prefix of By the choice of we now observe that
> IYI Hence, by the choice of pe and p Iuja’I
-
ilia, i
# j.
max{Ig(a)IlaEE.).
Iuja’I > Iu, ‘..Ukl - k,
a contradiction to Theorem 1.6. Thus, the assertion has been established. It is seen from the argument above that the unique letter a does not depend on x (because it can be determined by checking which of the ui begins y). Thus if we have g(x,)y
=
hb,)
and
g(x2hJ = h(x2)
with 1 y I > p , then the letter a (which possibly exists according to the assertion) is the same in both cases. We can now show the existence of the number r in the statement of Theorem 1.9 by the following argument. Let y1 be a word over C,of length ~ pand, let b be a letter of Z. We say that (yl, b) is a threshold exceeding pair (t.e.p.) for g if each of the following conditions is satisfied: (i) g(xl)yl = h(x,) for some word x1 ; (ii) g(x,b)y = h(x,b) for some word y with J y l> p ; (iii) g(x,bz) = h(xlbz) for some word z. Thus, a threshold exceeding pair gives rise to a situation where the absolute value of the balance exceeds p when the word is changed from x1 to xlb. By the assertion the next letter, i.e., the first letter of z is unique, and the unique-
133
EXERCISES
ness continues as long as the absolute value of the balance is greater than p. By condition (iii) this state of affairs cannot continue forever. These observations lead to the following formal definition. Let (yl, b) be a t.e.p. for g. A sequence of letters a,, ..., a, is termed the (yl, b, 9)-sequence if there are words w,, . . . , w, such that g(xibai)wi
=
h(xibai),
g(xibaia,)w, = Nxibaiaz),
.. .,
g(x1bal . . a , ) ~ ,= h(xi ha, . . . a,), I w i I > p f o r i = 1,..., n - l , a n d I w , l ~ p . The (yl, b, 9)-sequence exists by the definition of a t.e.p. It is unique by the assertion. We define the (yl, b, g)-number to be the greatest of the numbers lyl,
IWII,
. . . I
IW,-ll,
where the ws are as above and y is as in (ii) above. The notions of a t.e.p. for h, an (yl, b, h)-sequence and an (y,, b, h)-number are defined in an analogous way. They correspond to the symmetric situation represented by the second equation (1.12). Let, finally, r be the greatest of all of the (finitely many) (yl, b, 9)- and (yl, b, h)-numbers. If there are no such numbers, i.e., there are t.e.p.s neither for g nor for h, then we choose r = p. This choice of r guarantees, by our constructions, that Eq(g, h) = Eq,(g, h). 0 The proof above gives no direct way of estimating the number I because we have given no bound for the length of the (yl, b, 9)- and (yl, b, h)-sequences. However, some bounds are known for the number of terms to be tested in deciding the equivalence of two DOL sequences; cf. Exercise 2.3. All known bounds are huge ones. This is to be contrasted with the DOL growth equivalence problem: Theorem 1.3.3 gives a very small bound for the number of terms in the sequences to be tested.
Exercises 1.1. Prove that the homomorphism equality problem is decidable for the family of DOL languages if and only if the HDOL sequence equivalence problem is decidable. 1.2. Discuss the interconnection between the homomorphism ultimate equality problem for the family of DOL languages and the ultimate equivalence problem for HDOL sequences. (Cf. also Exercise 4.12 below.)
134
111 SINGLE ITERATED HOMOMORPHISMS
1.3. Prove that the compatibility and strong compatibility problems are undecidable, whereas the equality and ultimate equality problems are decidable for the family of regular languages. See [CSJ for a proof that the latter two problems are decidable even for the family ofcontext-free languages.
1.4. Prove that the language Eq(g, h) is always context-sensitive. Give an example of a language Eq(g, h) that is not context-free. 1.5. Prove that it is undecidable whether or not a given language Eq(g, h) is
(i) regular, (ii) context-free. (Cf. [SlO].) 1.6. Consider a family of languages effectively closed under deterministic gsm mappings and with a decidable emptiness problem. Assume, further, that the languages R in the family satisfy the implication (1.3). Prove that the homomorphism equality problem is decidable for the family. 1.7. Construct on the basis of Theorem 1.5 an algorithm for deciding whether or not a given homomorphism is elementary.
1.8. Define the notion of a bounded delay from right to left. Prove that every elementary language is a code with a bounded delay from right to left. (Prove first a modification of Theorem 1.6 needed for this result.)
1.9. Show by an example that the estimate for k given in the proof of Theorem 1.2 is the best possible in the general case. 1.10. What is the interconnection between a homomorphism h being simplifiable and the Parikh matrix of h (i.e., the growth matrix of a DOL system (C,h, w ) ) being singular?
2. THE DECIDABILITY OF THE DOL EQUIVALENCE PROBLEMS
In this section we first construct an algorithm for deciding the DOL sequence equivalence problem. We then reduce the W L language equivalence problem to the sequence equivalence problem. By Theorem 11.5.8 it is decidable whether a given DOL language is contained in a given regular language. Thus, the following theorem is an immediate corollary of Theorems 1.3 and 1.9. Theorem 2.1. It is decidable whether or not two given elementary homomorphisms are equal on a given DOL language.
For Theorem 2.1, the sequence of regular languages R o , R,, R2,. . . considered in the proof of Theorem 1.3 is naturally chosen to be the sequence
2
135
THE DOL EQUIVALENCE PROBLEMS
h&(g, h), k = 0, 1.2,. . . . Thus, the algorithm for Theorem 2.1 works as follows. Assume that the given homomorphisms are g and h, and that
L =
{Wili
2 0)
is the given DOL language. Then the ( i + 1)th step in the algorithm consists of (i) checking whether or not g(oi) = h ( o i ) and, if the answer is positive, (ii) checking whether or not L c Eqi(g, h). We now reduce the DOL sequence equivalence problem to the problem solved in Theorem 2.1. In this reduction process the following theorem which gives a way of “dcscending” from arbitrary homomorphisms to elementary ones will be very useful.
Theorem 2.2. Assume thut h , und h2 ure arbitrary homomorphisms mapping I*into Z*. The17there exist a sequence i,, . . . , i k of eiements,from { 1,2} irnd homomorphisms f , p , , p 2 such thut (2.1)
hihi, . . . hi,
=
pif,
i
=
1, 2,
and the homontorphisnis pi and f p i , i = 1,2, ure elementary. Moreover, the sequence i,, . . . , i k und the homomorphisms ,f, p , , p 2 can be effectively construcfed,f,‘omh , and h2 . ProoJ: If h , and h , are elementary, we choose f to be the identity morphism and p i = hi, i = 1, 2, (In this case the sequence of elements from { 1, 2) will be the empty one.) Assume that at least one o f h , and h2 is not elementary. Let now hi, . . . hi, be a product, formed of h , and h 2 , giving rise to a simplification (2.2)
hi, ... hi, = 9.f‘
via an alphabet smallest possible for all such products. More s,pecifically,(2.2) holds with
and, whenever h j , . . . hj, is a product formed of h , and h2 such that
then #(C2) 2 #(C,). Define now p i = hig, i = 1,2. Then the homomorphisms f , p , , and p 2 satisfy the requirements of Theorem 2.2. Indeed, (2.2) and the definition of pi yield (2.1). The homomorphisms pi and f p i , i = 1,2, must be elementary because of the minimality of Z l . (In the sequel we need only the fact that p i is elementary.)
111 SINGLE ITERATED HOMOMORPHISMS
136
The effectiveness of the construction is seen as follows. Consider an effective enumeration of all sequences i l , . . ., ik from { 1,2}. For each such sequence, we find out whether or not there exist p l yp2 ,fsatisfying the conditions of the theorem. (This can be done because we can decide whether a given homomorphism is elementary.) If we succeed, we are through. If we do not succeed, we move on to the next sequence. The first part of this proof guarantees that we shall eventually succeed. 0 We are now in the position to establish the following fundamental result. Theorem 2.3.
The DOL sequence equivalence problem is decidable.
Proof: Consider two DOL systems Gi = (C,hi, o),i = 1,2, generating the sequences =
1,
o(i)2
,...,
i=l,2.
(We assume without loss of generality that the axioms of the systems coincide.) Let i l , . . . , i k r pl, p 2 , f satisfy Theorem 2.2 for hl and h 2 . Denote the left-hand side of (2.1) by gi, i = 1,2, and consider the DOL systems
0 I j I k, G I.J . = (X.. l J ’ gi, of)), 1 5 i I 2, where Xij is the appropriate subalphabet of C such that Gij is reduced. We now claim that (2.3)
if and only if
E(Gl) = E(G2)
E(Glj) = E ( G I j ) for all 0 I j I k.
Indeed, the “only if” part is obvious. To prove the “if” part assume that E(G,,) = E ( G 2 j ) for every j satisfying 0 5 j 5 k. Arguing indirectly, we assume that rn is the smallest integer such that og)# up).If rn Ik, then the axioms of G1, and G 2 , are different, a contradiction. If rn > k, we choose an integer t with the property 0 I rn - t(k + 1) I k . But now the ( t + 1)th elements in the sequences
are different, a contradiction. Thus, we have established (2.3). (Note that the systems Gij resemble the decompositions of DOL systems considered in Chapter I.) Thus, to complete the proof it suffices to show the decidability of the equations
E(Glj)
=
E(G2,),
0 I j I k.
2 THE DOL EQUIVALENCE PROBLEMS
137
Consider a fixed j and denote
H . = G I.J . = (x..g I. ) m(!)), J
i
lJ9
=
1, 2.
Consider also the DOL systems Hi = (Ci,fpi, f ( w y ) ) ) ,
i = 1, 2,
where C: is the alphabet through which gi is simplified. We assume that mi1) = my’and, consequently,f(w;’)) = , f ( ~ o ) ~because, )) otherwise, E ( H , ) # E ( H , ) and we are through. To complete the proof it suffices to show that (2.4)
if and only if
E(Hl) = E ( H 2 )
p1 and p 2 are equal on L(H’,).
This follows by Theorem 2.1 and the fact that p1 and p z are elementary. However, (2.4) is immediate from the definitions. It can be verified directly from the diagram 9,
,
a(i) 1
91
,
ol(i) 2
91
, ...
In the diagram we have written the sequence E ( H i ) (resp. E(Hi)) simply by = 1,2. 0
a$, ay), . . . (resp. I$), by’, . . .), for i
After establishing the decidability of the DOL sequence equivalence problem, we now turn to the discussion of the WL language equivalence problem. Here a reduction procedure is followed: our algorithm for the language equivalence makes use of the algorithm for sequence equivalence. Two DOL systems may generate the same language although their sequences are different. To be able to use the decidability of the sequence equivalence we consider decompositions Gi(p,q), where the period p is chosen in such a way that the Parikh vectors of the words are strictly increasing. This ensures a unique order among the words. When running our algorithm, we try to reduce the period at the cost of making the “initial mess”q larger. The notation x I y (resp. x < y) is used to mean that the Parikh vector of x is less than or equal to (resp. less than) that of y. Here x and y are words over the same alphabet, and the ordering of Parikh vectors is the natural componentwise one.
111
138
SINGLE ITERATED HOMOMORPHISMS
Consider a DOL system G generating the sequence (2.5)
Loo,
Wl,
0 2 ,
...
such that L ( G ) is infinite. The following obvious properties concerning Parikh vectors will be useful in the sequel: (i) There are no words wi and mi,i < j, in (2.5) such that oj (Otherwise, L(G) would be finite.) (ii) Whenever, for some i and j with i < j, Wi
then also mi+”
Wji
for all n 2 0.
We are now in the position to establish the second fundamental result in this section. Theorem 2.4.
The DOL language equivalence problem is decidable. Proof: Consider two given DOL systems
Gi= (Z, hi,o#’), i
= 1, 2,
generating the sequences E(Gi) = Lo$),
1
,
& ...,
i=l,2.
Clearly, it is no loss of generality to assume that the systems have the same alphabet. (But now we cannot assume that the axioms are the same!) Since we can decide whether a given DOL language is finite and the comparison between two finite languages or between a finite and an infinite language is trivial, we also assume without loss of generality that both L(Gl) and L(Gz) are infinite. We now give an algorithm for deciding whether or not L ( G , ) = L(Gz).The algorithm operates with the parameters t , p i ,and q i , i = 1,2. Intuitively, t gives the length of the “initial mess” excluded from both sequences, pi is the currently scanned period of G i , based on the comparison of Parikh vectors, and qi indicates the first position where such a comparison can be made. The algorithm consists of the following five steps. 1. Set t = 0. 2. Find the smallest integer q1 > t for which there exists an integer p such that (2.6) wbf:, cPwb;) and 1 I p I q1 - t .
Let p 1 be the smallest integer p satisfying (2.6).Determine integers qz and p z in the same way for the system Gz. 3. If {coj1)1t I i < q l } # {w!’))t I i < q 2 } , stop with the conclusion L ( G , ) # L(G,). Otherwise, continue to step 4.
139
2 THE DOL EQUIVALENCE PROBLEMS
+
+
4. If {4”1q1 5 i < q1 p l ) z {oj2)(q2 I i < q2 p 2 ) , (= q 2 )and return to step 2. Otherwise, continue to step 5.
5. Let
set
t = q1
be the permutation defined on
{0,1,...,p1 - 1) such that (1)
(2)
oq,+= oq, +n(j)
for all j = 0, 1, . . . ,p1 - 1.
If, for a l l j = 0, 1, . . . ,p1 - 1, E(G1(p1,q1 + j ) ) = E(G2(pl. q1 + n(.j))), stop with the conclusion L(Gl) = L(G2). Otherwise, set t = p1 + q1 (= p 2 q 2 ) and return to step 2.
(2.7)
+
Having defined the algorithm, we shall now establish its correctness and termination. We begin with some preliminary remarks and straightforward observations. By a well-known result concerning partial orders (for instance, cf. [Kr]) the set of words minimal with respect to sPis finite. Consequently, step 2 can always be accomplished, and qi and p i , i = 1,2, are well defined. Whenever step 4 is entered, we know that q1 = q 2 .This follows because the two finite languages mentioned in step 3 are equal, and no repetitions can occur in these languages. Similarly, we see that whenever step 5 is entered then both q1 = q2 and p1 = p 2 . Because of the equality of the two finite languages in step 4, the permutation n is well defined. The decision in step 5 is made according t o Theorem 2.3. Whenever we enter step 3, we know that
(2.8)
{ol”lO
Ii
=
{w12’I0 5 i < t}.
On the first entrance (t = 0), this is vacuously true. The validity of (2.8) on subsequent entrances to step 3 is easily established by an induction, based on the fact that the new value oft was defined either in the previous visit to step 4 or to step 5, and in both cases the equality of the languages to be added to the previous languages (Q) was already determined. We are now in a position to establish the correctness of our algorithm: whenever the algorithm stops, the conclusion made is the correct one. Assume first that we stop in step 5. Thus, and
P1 = P z . By (2.8) and the last visit to step 3 we know that 41
(2.9)
= q2
(wj’)lO 5 i < q l } = {oj2)105 i
< ql}.
140
111 SINGLE ITERATED HOMOMORPHISMS
Clearly, (2.9) and (2.7) imply that L ( G , ) = L(G2).This follows because both languages are divided into equal finite parts, followed by pl pairwise equivalent infinite sequences. Assume, secondly, that we stop in step 3. Thus,
(2.10)
{wi(1) It Ii 4 q l } # {o!’)lt5 i < q 2 }.
To prove that L(Gl) # L(G,), we assume the contrary. This implies by (2.8) that (2.1 1)
{ w{ ” l t I i } =
(Wj2’lt
Ii } .
Because of(2.10) there is a word belonging to exactly one of the two languages appearing in (2.10). The situation being symmetric, we assume without loss of generality the existence of a number m,t I m < ql, such that w g ) $ {wj2)lt Ii
< q2}.
By (2.1 1) we now conclude the existence of a number n with the properties
(2.12)
=
(#’
and
n 2q2.
Because of property (ii) concerning Parikh vectors (stated before Theorem 2.4) and because of the definition of q 2 , there is an integer r with the properties
(2.13)
tIr
n r
Because of (2.1 1 ) there is an integer s 2 r such that w y = 0;’’.
Furthermore, because of (2.12), (2.13), and property (i) concerning Parikh vectors, we conclude that s < m.Thus, we have found numbers s and m with the properties t 5 s < rn c q1
and
wl”
<,, w:),
contradicting the choice of q l . This proves that L(Gl) # L(G2). Having established the correctness of our algorithm, we still have to show that it always terminates (i.e., that it is indeed an algorithm). Observe first that the values of p1 and p 2 defined during the kth visit to step 2, say pik)and pik’, never exceed the values defined during the previous visit; in symbols,
(2.14)
pik) 5 pjk-’),
i = 1, 2.
This is an immediate consequence of property (ii) concerning Parikh vectors. Observe, secondly, that if L ( G , ) # L(G2),then our algorithm terminates. This is due to the facts that (2.8) holds at every entrance to step 3 and that the value oft is strictly increased at every entrance to step 2.
2
141
THE DOL EQUIVALENCE PROBLEMS
Thus, it suffices to show that the algorithm cannot loop if L(G,) = L(G,). Since by (2.14) the values of the pair (pl, p 2 ) can be changed only finitely many times, it suffices to show that the algorithm cannot loop keeping the pair (pl, p 2 ) fixed (provided L ( G , ) = L(G,)). This is a consequence of the following lemma.
+
Lemma 2.5. Denote u = #(Z) 2, and assume that the algorithm dejnes the same pair (pl, p 2 ) at u visits to srep 2. Then L(Gl) # L(G2). To prove the lemma, we assume that indeed the same pair (pl,p2) is defined at u visits to step 2. We claim first that, whenever step 2 is entered from step 4 and the value of the pair (pl, p 2 ) is not changed, then L ( G , ) # L(G,) (and, furthermore, this inequality is determined during the next visit to step 3). Indeed, the assumptions made imply that the pair (ql, q 2 ) is changed into the pair (41 + p l , q2 p 2 ) . But this means that the inequality established in step 4 can be used as such during the next visit to step 3. (Then t = q1 = q 2 . ) Thus, our claim holds true. Consequently, we may assume in the sequel that each of the u visits to step 2 we are considering, with the possible exception of the first one, originates from step 5. During this process, we define the permutation 72 u - 1 times. At each time it will be a permutation on the numbers {0, 1,. . . , p l - 1) because p1 remains unchanged. (In fact, also pl = p 2 . ) Assume that two different permutations n 1 and n2 are obtained during two consecutive visits to step 5. Choose a number j such that
+
%(A > . 2 w . Thus, for some value of 41, (1) @ql + j
(2.15)
Oj1)
(2.16)
ql+pl+j
=
(2) @ql
+nl(j)*
- w(2) - n+~l+nz(j)'
Because the left-hand sides of (2.15) and (2.16) are comparable with respect to < p r the same holds true for the right-hand sides: w$?al(j, < P @ $ ! p t + n l ( j ) .
But because 1
(41
+ pi + r c 2 ( j ) ) - (41 + ni(j))
< ply
this is a contradiction with the fact that p 2 (= p l ) is not decreased during the next visit to step 2.
142
111 SINGLE ITERATED HOMOMORPHISMS
Consequently, the defined permutation II must always be the same one: for all i = 0,.. . , u - 1 and a l l j = 0, . . . , pl - 1, (2.17)
(Here q1 refers to the value of this parameter at hand during the first among the considered visits to step 5.) The equations (2.17) tell us that, for each j = 0,.. . ,p1 - 1, the first #(C) + 1 words in the sequences (2.18)
E(Gl(pl, 41
+j ) )
and
E(Gz@I, 41
+ ~0')))
coincide pairwise. This implies (cf. Exercise 1.3.4) that the sequences (2.18) are Parikh equivalent, for eachj = 0,. . . ,p1 - 1. We know also that, for somej, the sequences (2.18) are not equivalent. (This follows because the algorithm does not stop during the first of the considered visits to step 5.) Thus, there is a word w 1 in some of the Gl-sequences such that the word w, occurring in the corresponding position in the corresponding G,-sequence is different from wl. On the other hand, w1 and w, are Parikh equivalent. If now w 1 E L(G,), the sequence E(G,) contains two words with the same Parikh vector, a contradiction to property (i) of Parikh vectors. Consequently, w 1 # L(G,), which implies that L(Gl) # L(G,). This proves Lemma 2.5 and thus also Theorem 2.4. 0
Exercises 2.1. Show by a direct argument how any decision method for solving the WL language equivalence problem can be used to solve the DOL sequence equivalence problem.
2.2. Compute an upper bound for the number k in the proofofTheorem 2.2.
2.3. Prove the existence of a number n(G1, G,), computable from the DOL systems G1and G2,such that G1 and Gz are sequence equivalent if and only if E ( G , ) and E(G,) coincide with respect to the first n(Gl, G,) words. (See [ER14] for details. All known bounds are huge.) 2.4. Investigate the decidability status of the following problems. In the statement of the problems g and h are endomorphisms defined on a free monoid C*,and x and y are words in C*. Problem I. Given h, x , and y. Does there exist an n such that h"(x) = h"(y)? (The existence of such an n implies that the sequences hi+"(x)and h'+"(y), i = 0, 1,2,. ..,coincide.)
I43
EXERCISES
Problem 2. Given h, x , and y. Do there exist m and n such that h"(x) =
h"(.v)? (Problems 1 and 2 are decidable and easier than the DOL sequence equivalence problem. Elementary homomorphisms provide a strong tool for attacking them; cf. [ER12].) Problem 3. Given g, h, x , and y. Does g"(x) = h"(y) hold for all n ? (This is the DOL sequence equivalence problem, listed here for the sake of completeness.) Problem 4. Given g , h, x , and y. Does there exist an m such that g"(x) = h"(y) holds for all n 2 m? (This is the ultimate equivalence problem for DOL sequences. It is decidable; cf. [C2].) Problem 5. Given g, h, x , and y. Do there exist m and n such that g"+'(x) = h"+'(y)
for all i 2 O?
(This is a modification of Problem 4.Problem 5 is decidable.) Problem 6. Given g , h, x, and y. Does there exist an n such that g"(x) = h"(y)? Problem 7. Given g , h, x, and y . Do there exist m and n such that g"(x) = h"(y)'? (The decidability of Problems 6 and 7 is open. Related problems are considered in [Ru6] for the case where the Parikh matrices of g and h are nonsingular. Problem 7 can be viewed as determining the emptiness of the intersection of two given DOL languages.) 2.5. A language L is said to be prejix-j% if no word in L is a proper initial subword of another word in L. Prove that it is decidable whether or not a given DOL language is prefix-free. (Cf. [Li2] for details. Observe that no DOL system generating a prefix-free language can be locally catenative. Thus, this exercise sheds some light on the open problem of deciding whether or not a given DOL sequence is locally catenative.)
2.6. Given a DOL system G = (C,h, w), compute a constant n(G) with the following property. L(G) is not prefix-free if and only if, for some m, n I n(G), hm((o)is a prefix of h"(o). (The presently known value for n(G) is huge.) 2.7. Prove that it is decidable whether or not an arbitrary given DOL language and an arbitrary given OL language coincide. Cf. [Rug].
2.8. Prove that the validity of the inclusion L , G L z is decidable for two given DOL languages L , and L z . Consult [ R u ~ ] , where interesting interconnections to solutions of equations involving languages are also pointed out.
144
111 SINGLE ITERATED HOMOMORPHISMS
3. EQUALITY LANGUAGES AND FIXED POINT LANGUAGES
In this section we continue the investigation of the most fundamental properties of homomorphisms. We start by considering equality languages of homomorphisms. As we have seen, they have played an important role in the solution of the DOL sequence equivalence problem. In particular, the fact that the equality language of two elementary homomorphisms is always regular (Theorem 1.9) was a very crucial step in our solution of this problem. We shall show now that this result (Theorem 1.9) is a corollary of a more general property concerning a broader class of mappings than the homomorphisms alone. We need the following definition first. Definition.
(1) Let g , h be (possibly partial) mappings on C*. The equality language of g, h, denoted Eq(g, h), is defined by Eq(g, h) = { x E C*Ig(x) = h(x)}. If g, h are binary relations on C*,then Eq(g, h) = { x E C* Ig(x) n h(x) # 0). (2) Let h be a (possibly partial) mapping, h: C* -+ A*. A word x in C* is a $xed point ofh if h(x) = x. Thejxed point language o f h consists of all fixed points of h and is denoted as Fp(h). If h is a relation, h E C* x A*, then the fixed point language of h is defined by Fp(h) = {x E C*Ix E h ( x ) } . It turns out that the fixed point languages of mappings form a very useful tool in investigating equality languages of mappings; they are also mathematically very interesting objects on their own. The equality language of two mappings is a measure of similarity between these two mappings; the fixed point language of a mapping measures its similarity with the identity mapping on the same domain. The basic relationship between equality languages and fixed point languages is provided by the following lemma, which is simple enough to be given without a proof. Lemma 3.1. Let ci, fl be mappings or relations on C* and let idz be the identity mapping on X*. Then Eq(ci, p) = F p ( S - ’ a ) and Fp(ci) = Eq(ci, idz).
In our study of equality languages and fixed point languages we shall turn to mappings more general than homomorphisms. A dgsm mapping generalizes a homomorphism by allowing a mapping ofan occurrence ofa letter in a word to be dependent on (occurrences of) other letters in the word. This dependence is not local because the way the given occurrence of a letter is mapped may depend on a “context” lying arbitrarily far from the given occurrence. A very characteristic feature ofa dgsm is that this context is “oriented” : a dgsm
3
EQUALITY LANGUAGES AND FIXED POINT LANGUAGES
145
reads a word from left to right, and so the mapping of an occurrence of a letter in the word depends on the information that the dgsm collected to the left of this occurrence. Obviously, one can define a “reversed” version of a dgsm, namely a machine that will collect information from the suffix (of a word being processed) beginning at the given occurrence. Thus a reversed dgsm is a right-to-left version of a dgsm. That is, a reversed dgsm reads its input from right to left and produces the output for it also from right to left. (The reader is referred to the introduction for the basic notation and terminology concerning dgsms-analogous notation is used for reversed dgsms).
We shall use X ( DGSM) to denote the class ofdgsm mappings. Analogously to the notation. M(DGSM),we shall use .X(DGSMR)to denote the class of all reversed dgsm mappings, that is mappings of reversed dgsms. In building up a systematic theory of mappings it is only natural to take not too big steps in going from one class of mappings to another. Hence, in generalizing homomorphisms we want to allow “extra memory” in the form of states, but we want to dispense with the left-to-right or right-to-left orientation. Hence, we shall consider only those dgsm mappings that can be realized by both a dgsm and a reversed dgsm. Such dgsm mappings are called symmetric, and they are formally defined as follows. I
A dgsm mapping h is called symmetric if there exists a reversed DrJinition. dgsm mapping g such that g = h. Given a dgsm A , a reversed dgsm 2 such that tr A = tr A is called a symmetric partner of A (also A is called a symmetric purtner qf A ); the pair ( A , A ) is called a symmetric pair. (Here t r A denotes the mapping defined by A ) We shall use ./K(SDGSM)to denote the class of symmetric dgsm mappings, that is, M(SDGSM) = .X(DGSM) n .X(DGSMR). I
We shall demonstrate now that investigating symmetric dgsm mappings (a very interesting topic on its own) sheds light on equality languages of elementary homomorphisms. We start by proving the following basic property of dgsms, concerning their “forward prefix balance.”
111
146
SINGLE ITERATED HOMOMORPHISMS
Lemma 3.2. For every dgsm A, there exists u positiue integer constant s every word w in F p ( A ) the,following holds: if u is a preJix of w, then
sirch thutfbr
IA(u)l
- 101 < S.
ProoJ: Let A = (C,A, Q, 6, q i n ,F ) and let w E F p ( A ) . If w is such that for every prefix u of w , I A(u)l II u ( ,then the lemma trivially holds. Thus let us assume that there is a prefix u of w such that 1 A(u) I > 1 u I. Let u1 be the shortest among them. Hence w = ululzl for some a, E Z, z,EX*, and A ( u l ) = u l a l u l for some u1 E A*. Note that if 6,(qin, 0 , ) = y,, then the pair (q,, u l u l ) determines completely (independently of w ) the shortest word C1 such that IA(v,fi,)l I I u,U, I ; since w E F p ( A ) , such a fil exists. Let us call (41, a l u l ) a predicting configuration occurring in w. We can repeat the above reasoning and consider u2 to be the shortest prefix of w such that u,Vl is a prefix of u2 and 1 A(u2)J> 1 u2 1. In the same way as above we determine a2 u2 and obtain a predicting configuration ( q 2 ,a2 u 2 ) determining the word f i 2 . If we iterate this reasoning on w, we obtain the set of all predicting configurations occurring in w. However, for every such configuration (qi, ui u,), we have I aiui I < max{ I wI Id&, a ) = w for some q E Q and a E Z}. This implies that the number of all predicting configurations for all words in F p ( A ) is finite, and so the lemma holds. 0 The notion of the (prefix) balance of homomorphisms can be generalized to symmetric dgsm mappings as follows. Definition. Let ( A , A) be a symmetric pair with A = (C, A, Q, 6, 4in,F), = (2,A, 0,8,qinrF), and let w E Z*. We say that a nonnegative integers is a prefix balance of(A, A) on w if for every u, u such that w = uu,
A
For a language K , K E C*,we say that ( A , A) is prefix balanced on K if there exists a nonnegative integers such that, for every w in K , s is a prefix balance of ( A , A) on w; we also say then that s is a prejix balance of(A, A) on K . The following lemma describes the very fundamental property of the prefix balance of a symmetric dgsm mapping.
Lemma 3.3. I f ( A , A) is a symmetric pair and K = dom A = dom 2, then ( A , A) is prefix balanced on K ; moreover, one can eflectively find a prejx balance of(A, 2) on K .
3
EQUALITY LANGUAGES AND FIXED POINT LANGUAGES
147
Pro05 Let A = (C, A, Q,6, qin,F), A = (C,A, Q,& ijin,F), and let w = a l . . . a n ,ai E C for 1 I i I n, be a nonempty word in K . Let qi be the state in which A reads ui, and let iji be the state in which A reads ai. Note that (3.1) if(qi, ai, i j i ) = ( q j , u j ,qj)fori < j,thentheworda, ...ai-lajaj+l- . - a , is in K and so the length of the output produced by A on the subword u i . . . aj - , equals the length of the output produced by A on this subword. Let w = uu with u = a, ... a k , 0 I k I n, and let bal(u, w ) = IIA(u)l (IA(w)l - IA(u)l)l. By erasing in w all subwords ai.-.aj-lsuch that (qi, ui, i j i ) = ( q j ,u j , ijj) and either j I k or i > k , we obtain a scattered subword w , = ulul of w with u1 and u1 being scattered subwords of u and u, respectively. From (3.1) it follows that bal(ul, wl) CledrlyIWl1I2.#(QxCxQ),
=
bal(u, w ) and so, because
bul(u, w ) I max{ I A ( x )1, I A ( x )1 I x E K and 1x1 5 2 -# ( Q x C x Q)} = S.
Hence the lemma holds.
0
Whereas Lemma 3.2 says that dgsm mappings have a bounded “forward prefix balance,” it can be shown (Exercise 3.3) that one cannot strengthen Lemma 3.2 so that it will be valid for prefix balance (that is, to replace in the statement ofLemma3.2 thephrase“IA(u)I-Iul < s ” b y “ ~ ~ A ( u ) ~ - ~ u ~ ~ < s ” ) . This is perhaps the basic difference between dgsm and symmetric dgsm mappings; for the latter, the “full prefix balance” on their fixed points holds. Lemma 3.4. For euery symmetric dgsm A , there exists a positiue integer r such thutjbr euery word w in Fp(A) the following holds: i f u is a prefix of w, then IIA(u)l - lull < r. Proof: Intuitively, this result holds because Lemma 3.2 implies the “forward prefix balance,” and the “backward prefix balance” holds because the “forward prefix balance” holds for A (a symmetric partner of A ) and by Lemma 3.3 ( A , A) is prefix balanced on Fp(A). Formally, the lemma is proved as follows. Let w E Fp(A), let A be a symmetric partner of A , and let s be a prefix balance of ( A , A ) on dorn A = dom A (see Lemma 3.3). Let w = uV. We have two cases to consider:
(i) IA(u)l 2 Iul.ThenLemma3.2impliesthat)A(u)~ - Iulisbounded by a certain constant r l .
148
111
SINGLE ITERATED HOMOMORPHISMS
(ii) I A(u) I < I uI. Let us consider the translation of w by A. Again we have two cases to consider. (ii.1) IA(i;)I 2 I V l . Then, by (the “reversed” version of) Lemma 3.2, IA(i;)I - 1i;lisbounded byacertainconstantr2andsoIuI - IA(u)lisbounded by r2 s. (ii.2) I &i;) 1 < I i; 1. Then 1 u I - I A(u)I is bounded by s.
+
Now if we choose r = max{r,, rz
+ s } , the lemma holds.
0
We are ready now to prove the following characterization of regular languages. Theorem 3.5. A language is regular if and only if it is the ,fixed point language of a symmetric dgsm mapping. Proof: (i) Obviously for every regular language K , there exists a symmetric dgsm mapping h such that K = Fp(h). (It suffices to take a finite automaton A accepting K and transform it into a symmetric dgsm by letting it copy each letter from its input as its output). (ii) If K = F p ( A ) for a symmetric dgsm A , then Lemma 3.4 allows us to use a buffer technique analogous to that from the proof of Theorem 1.1 to construct a finite automaton accepting K . 0
It is quite often the case that the only reason for a class X of mappings not to be a subclass of a class Y of mappings is that the mappings in Y cannot detect the end of a word. To avoid such technicalities we can assume that the mappings we shall consider now have the possibility of detecting the end of a word. A way of formalizing this idea is to introduce augmented (versions of) mappings. Definition. Let h be a (possibly partial) mapping from C* into A*. The uugmenred version o j h , denoted uug h, is the mapping from $C*$into $A*$ (where $ is an arbitrary but fixed symbol not in C u A)defined by (uug h)($w$) = $h(w)$ for every w in C*.
Providing an auxiliary end marker does not change the basic properties of the class of mappings as expressed, e.g., by the following result. Corollary 3.6.
Ifaug h E .M(SDGSM), then Fp(h) is regular.
Proof: This follows directly from Theorem 3.5 and from the obvious fact that Fp(aug h ) = $Fp(h)$ where $ is the fixed end marker of the augmenting operation. 0
3
149
EQUALITY LANGUAGES AND FIXED POINT LANGUAGES
Now we can demonstrate how our investigation of fixed point languages of symmetric dgsm mappings generalizes our investigation of equality languages of homomorphisms from the two previous sections of this chapter. Theorem 3.7. If’g, h are homomorphisms such that aug h- is a symmetric dgsrn tnupping, theri Eq(g, h ) is a regular language. Proof (i) It is easy to see that .X(DGSM) (and by the analogous argument .X(DGSMR))is closed under composition. Since obviously aug(gh) = (aug g)(uug h), this implies that
(3.2) {hlaug h E li“(SDGSM))is closed under composition. (ii) Obviously, uug g E d(SDGSM); and since aug h - I E .X(SDGSM), it follows from (i) that uug(h-’g) E .X(SDGSM). This, by Corollary 3.6, implies that Fp(h-’g) is regular and so, by Lemma 3.1, Eq(g, h ) is regular. 0 I
In particular, we get the following generalization of Theorem 1.9. Corollary3.8. l f ’ g is a homomorphism mid h is a composition of elementary homomorphisms, t heti Eq(g, h) is regular. Proof (i) If 1’ is an elementary homomorphism, then Theorem 1.8 (together with its analogous right-to-left version) implies that aug f ’ - is a symmetric dgsm mapping. (ii) Let h = h, . . . k, where h l , . . . ,h, are elementary homomorphisms. Then (3.2) together with (i) implies that uug h- is a symmetricdgsm mapping. Hence Theorem 3.7 implies the result. 0
’
The reader should notice that Corollary 3.8 generalizes Theorem 1.9 not only because it leaves one of the homomorphisms arbitrary, but also because (see Exercise 1.1.10) in general the composition of elementary homomorphisms does not have to be an elementary homomorphism. As we have seen (Theorem 3.5) the fixed point language of a symmetric dgsm mapping is a regular language. In this way a symmetric dgsm mapping forms a “natural” generalization of a homomorphism. This property also distinguishes symmetric dgsm mappings from dgsm mappings in general because the fixed point language of a dgsm mapping does not have to be regular, as shown by the following example.
Q
Exunipk 3.2. Let A = ( { a , b, c } , {a, b, c } . Q, S. qinrF ) be the dgsm with = {(/in, YI,q 2 , q 3 . q 4 , q 5 l 9F = IqsJ, and 6 defined by
6(qin, u ) = 6(q,, u ) = ( q l , A), S(qi, b) = S ( q 2 h ) = & q 3 , b) = ( q 2 a’), 9
9
&!,,
a) = &I, a) , = ( q 3 , b2),
h(q2, C) = ( q 5 , bc),
111
150
SINGLE ITERATED HOMOMORPHISMS
and for every q E Q, d E {u,b, c } if 6(q, d ) is not specified above, then 6(q, d ) = (q4, d). It is easy to see that Fp(A)
=
{a2"b2"~'a2"~'.~~b4a2bcln 2 1 and n is odd}.
As a matter of fact the class of fixed point languages of homomorphisms is a quite powerful class of languages in the sense that it represents, in a simple way, the class of recursively enumerable languages. 'Theorem 3.9. For each recursively enumerable language K over an alphabet C, there exists a dgsmrnupping h such that K = presr(Fp(h)).
Proof: The theorem is proved by demonstrating how the fixed point language of a dgsm mapping simulates the set of computations of a deterministic Turing machine. To facilitate such a proof we shall use a formalism for describing Turing machines that is particularly useful in translating computations of a Turing machine into elements of the fixed point language of a dgsm. So we assume that a Turing machine has a finite, but extendible, tape and in addition to its "normal" instructions it also has two special groups of instructions: (i) (4, a, q', erase, move left) applicable only at the right end of its tape; and (ii) (4. a, q', erase, move right) applicable only at the left end of its tape.
Instructions of type (i) and type (ii) cause the tape to contract (shrink). Moreover, we assume that a Turing machine accepts by producing the empty tape (not to be confused with the blank tape!) in its unique final state. Now given a deterministic Turing machine A accepting the language K over C, with A being the total alphabet of A , we define a computation string of A to such that be a string of the form $wl#W2#iG3 . . . #En%
n 2 2; g! and $ are two new symbols not
in the alphabet of A ;
w l , . . . , w,are configurations of A , i.e., words uqv where u, u are words over A and q is a state of A(for a word x, we use X to denote the barred version of x, that is, the word resulting from x by replacing each letter a of x by 3); w , = qinw is an initial configuration of A , where qin is the initial state of A and w is an input word over C;
w,
=
q H is the final configuration of A , where q H is the final state of A.
By a successful compufation string of A we mean a computation string $w1g!W2#W3...$W,$ such that w i + l is the successor of w i (that is, w i + l results from wi by the execution of an instruction of A ) for 1 5 i I n - I . The
3
151
EQUAL.I?’Y LANGUAGES AND FIXED POINT LANGUAGES
.suc*ce.s.sfir/comptrtutiori l~iriguugrof A , denoted as scomp A , is the set of all successflil computation strings of A . Clearly K = pre.sx(sc.ornp A ) . Thus, to prove the theorem it suffices to show that there exists a dgsm B such that F p ( B ) = .scomp A. To this aim we construct B as follows. Using its finite control B rejects all words that are not computation strings of A (note that the set of computation strings of A is regular). The translation of a computation string $wI$W, $ . . . $En$is done by B as follows:
it erases $wl, paying attention to the “local situation” in w l , that is, the state of A and the symbol read by A . and storing in its finite control the instruction I , of A corresponding to this situation in A ; on the basis of this in for mat ion i t rewrites $Fzinto thc word $w$ where w’z. is the unique predecessor of \r2 (if it exists) by the instruction I , , otherwise the string is rejected; in performing this step B stores in its finite control the intruction Z2 corresponding to configuration wl2 in A : then, for 3 I i 5 n, B rewrites $Wiinto $Wiwhere wi is the predecessor of bvi (if it exists) by the instruction I i _ otherwisc B rejects the string; in performing this step B stores the instruction Zi corresponding to the configuration wi in A ; finally, it rewrites $ into $W,$,where w, = q,,.
Thus B translates a computation string x = $w1#W2$W, ...#En$into $w;$M’; . . . $Wk$W,$.Consequently, x E F p ( B ) if and only if wi = w;+ for 1 5 i I 17 - 1. Hence F p ( B ) = scomp A and so K = presr(scornp A ) . Thus the theorem holds. 0
,
By now it should be quite clear that the study of fixed point languages and the study of equality languages of various classes of mappings complement each other. We illustrate this point even further by exploiting Theorem 3.9 in this way. We start by providing a class of languages of a rather simple form which turns out to be very useful in characterizing equality languages of various classes of mappings and (combined with Theorem 3.9) in characterizing the class of recursively cnumerable languages. (For an alphabet C, = { n l u E C} and for a word x over C, S is the word resulting from x by replacing every occurrence of every letter u in x by a).
c
Defnitiutr. Let Z be a finite alphabet. The complete twin shufle over C, denoted as Lr, is defined by Lr = { w E (C u C)* l p f j = presyw}.
111
152
SINGLE ITERATED HOMOMORPHISMS
Clearly, for every C,L Xis an equality language over (C u Z); take h, g to be homomorphisms on (Z u Z)* defined by: for every a E C u Z,
h(a) =
a A
if a E Z , if a E Z ,
and
A
g(a) = a
if U E C , if U E Z ,
then L X = Eq(h, 9). It can be shown that the class of equality languages of homomorphisms is the smallest class containing L o , and closed under inverse homomorphisms (Exercise 3.5) and the class of equality languages of dgsm mappings is the smallest class containing L(o, and closed under inverse dgsm mappings (Exercise 3.6). Also, one can use complete twin shuffles to represent fixed point languages of dgsm mappings, as shown by the following result.
,
Lemma 3.10. Let h be a dgsm mapping on C*. There exists a regular language M such that Fp(h) = presz(LX n M ) .
Pro@ Let h be the dgsm mapping induced by A B = (C,Z u 3, Q, 6', qin, F ) be the dgsm where defined by 6(q, a ) = ( p , w )
if and only if
=
(C,A, Q, 6, qin,F ) . Let { a ( aE A} and 6' is
=
6'(q, a ) = ( p , L I E )
where W results from w by replacing every letter a from A in w by 7i. Let g be the mapping induced by B. Obviously, M = g(C*) is a regular language, and Fp(h) = presX(LXn M). Hence the result holds. 0 The above result combined with Theorem 3.9 yields the following quite simple representations of recursively enumerable languages. Theorem 3.1 1.
Let K be a recursively enumerable language.
(i) There exist an alphabet C , a weak identity h, and a regular language M such that K = h ( L , n M ) . (ii) There exist a weak identity h, a homomorphism 9, and a regular language M such that K = h(g-'(L,o, n M ) . ( A weak identity is a homomorphism mapping every letter either to itselfor to the empty word.) (iii) There exists a dgsm mapping f such that K = f(L,,.
Proof: (i) This follows directly from Theorem 3.9 and Lemma 3.10. Note that from the proofs of Theorem 3.9 and Lemma 3.10 it follows immediately that one can take C such that # Z = # A 2 where K E A*.
+
153
EXERCISES
(ii) From (i) it follows that K = h(L, n M ) . Let C = {al,. . . , a,} and let g be the homomorphism from (X u {iila E C})* into {0, 1,0, I}* defined by q(tri) = 0’1 and q(iii)= 0’1 for I I i I n. Then obviously L , = g - l ( L t 0 , and so K = h ( g - ‘ ( L , , . n M ) . (iii) Let g and h be as in (ii). Clearly, h and g - are dgsm mappings. Because the latter are closed under compositions and intersections with regular languages, the claim follows. 0
Exercises 3.1. Exhibit an example of a mapping in .X(DGSM)?.X(DGSMR)and an example of a mapping in .X(DGSM R, ,,X ( DGSM).
3.2. Prove that it is decidable whether or not ( A , A) is a symmetric pair for an arbitrary dgsm A and an arbitrary reversed dgsm A. (Cf. [EnRl].) 3.3. Show that Lemma 3.2 is not valid if the phrase “IA(u)l - J u I < s” from its statement is replaced by the phrase “IIA(u)I - 1 0 1 1 < s.” (Cf. [EnRl].) 3.4. Show that if K is the fixed point language of a dgsm mapping and K is context-free, then K is regular. (Cf. [EnRl].)
3.5. Prove that the class of equality languages of homomorphisms is the smallest class containing L,o,1 ) and closed under inverse homomorphisms. (Cf. [EnR2].)
3.6. Prove that the class of fixed point languages of dgsm mappings is the smallest class containing L{,,, and closed under inverse dgsm mappings. (Cf. [EnR2].)
3.7. Prove that given arbitrary dgsms A and B it is undecidable whether or not (i) F p ( A ) = 0; (ii) F p ( A ) is finite; (iii) F p ( A ) = Fp(B). (Cf. CEnR21.)
3.8. Prove that it is undecidable whether or not: ( 9 K n L,o. 1) = is finite, (ii) K n 0
9
where K is an arbitrary language of the form L* with L being a finite language.
1 11
IS4
SINGLE ITERATED HOMOMORPHISMS
3.9. Show that, for every C, L z is not the fixed point language of a dgsm mapping. (Cf. [EnR21.) 3.10. Establish closure properties of the following classes of languages: (i) (ii) (iii) (iv)
equality languages of homomorphisms, fixed point languages of homomorphisms. equality languages of dgsm mappings, fixed point languages of dgsm mappings.
(Cf. [EnR 11.)
3.1 1. Establish the inclusion relationships between the classes of languages from Exercise 3.10. (Cf. [EnR2].) 3.12. Let 9’ be a full principal AFL. There exists a language K in 2’such that for each L in Y there exists an alphabet C and a regular language M such that L = presZ(K n M ) . (Cf. [FR] and [CM2].)
3.13. Theorem 3.1 I(i) is a special instance of a more general result: for every recursively enumerable language K , there exist homomorphisms h and y,a weak identityf,and aregular language M such that K = f ( E q ( h , g) n M). Prove that in this version: (i) h can be taken as a coding, or (ii) M can be taken in a fixed form @*A* for some alphabets C and A).
(Cf. [EnRl] and [EnR2].) 3.14. Let p be an operation on languages defined by p ( L ) = {x E L l x # A and no proper prefix ofx, except for A, is in L}.Prove that for every recursively enumerable language K , there exist a weak identity f and homomorphisms h, g such that K = f ( p ( E q ( h ,9))). (Cf. [C3].) 4.
GROWTH FUNCTIONS: CHARACTERIZATION AND SYNTHESIS
The remaining two sections of this Chapter I11 deal with two additional aspects concerning DOL systems. In the present section the study of growth functions begun in Section 1.3 is continued. The last section investigates DOL forms. We have already in Section 1.3 deduced a number of basic results concerning DOL growth functions. We obtained solutions for the analysis and growth equivalence problems, and also a characterization concerning what a DOL growth function looks like. This section contains more advanced results along the same lines. For instance, we obtain a solution to the synthesis
4
155
GROWTH FUNCTIONS
problem, as well as explicit characterizations of DOL and PDOL growth functions and length sequences within the realm of N-rational sequences. In some cases we shall refer to [ S S ] for a detailed proof of a result concerning N rational sequences. We have already in many connections discussed decompositions and merging of DOL sequences. These notions apply to length sequences as well. More specifically, let u(n), n = 0, 1,2,. . . , be a sequence of numbers belonging to one of the four types we are considering in connection with growth functions (i.e., Z-rational, N-rational, DOL length, or PDOL length sequence). We say that u(n) can be decomposed into sequences of type a if there exist integers m 2 0 and p > 0 such that each of the sequences (4.1)
ti(n) = u(np
+ m + i),
i = 0 , . ..,p
- 1,
is of type a. Conversely, we say that the sequences ti(n),i = 0, . . . , p - 1, are fl-mergeable if (4.1) holds for some sequence u(n) of type /?and some integer m. We shall be mostly concerned with DOL-mergeability. As regards decomposition, we are of course interested only in results where the type a is more restrictive than the type of the sequence u(n), for instance, the decomposition of N-rational sequences into DOL length sequences. Clearly, the decomposition relation is transitive in the following sense: if a sequence u(n) can be decomposed into sequences of type a and each of the latter can be decomposed into sequences of type 8, then u(n) can be decomposed into sequences of type fi. The following simple result is a very useful tool in several constructions involving growth functions. Theorem 4.1. Assume that an N-rational sequence of numbers has a matrix representation
(4.2)
u(n) = zM"q,
n = 0, 1,2,. . . ,
with either only positive entries in 71 or only positive entries in q. Then u(n) is u DOL length sequence. Proof: Consider first a sequence (4.2) such that all entries in q are positive. Let G = (C, h, o)be a DOL system generating the length sequence ul(n) = nM"q,
obtained from (4.2) by replacing r] with the column vector q I consisting entirely of 1s. Consider now the homomorphism h,: C* + (C u {b})* mapping the ith letter ai of C into uibqi- where 4i is the ith component of q, and the DOL system
',
GI
=
(C u { h ) ,hi, wi),
156
111
SINGLE ITERATED HOMOMORPHISMS
where b is a new letter, (0,= h2(w),and hl is defined by h,(b) = A,
h,(a) = h2h(u) for a # b.
Then it is immediately verified that (4.2) is the length sequence generated by GI. Assume next that all entries of n are positive. We write (4.2) in the form
where T denotes the transpose of a matrix. From this the assertion follows by the first part of the proof. 0 Although the class of 2-rational sequences is much larger than the class of DOL length sequences, we are able to establish several results concerning the representation of Z-rational sequences in terms of DOL length sequences. Apart from being of interest on their own, these results are also essential tools in several proofs concerning growth functions. Theorem 4.2. Every Z-rational sequence u(n) can he expressed as the diference of two DOL length sequences, i.e., in the form
44 = u l ( n ) - u2(n),
(4.3)
where u,(n) and u2(n)are DOL length sequences.
Proof. Since every Z-rational sequencecan be represented as thedifference of two N-rational sequences (cf. [SS]) and since obviously the sum of two DOL length sequences is again a DOL length sequence, it suffices to establish (4.3) for an N-rational sequence u(n). Assume, thus, that an N-rational sequence u(n) is defined by the matrix representation u(n) = nM"q. Consequently, (4.4)
u(n) = ( n
+ ( I , . . . , 1))M"q - (1,.
,
. , l)M"q,
and so (4.3) follows now by (4.4) and Theorem 4.1. 0 Our next result, Lemma 4.3, will be strengthened later on, after a complete characterization of PDOL length sequences has been obtained in Theorem 4.4.
Lemma 4.3. Euery N-rational sequence can be decomposed into DOL length sequences. Proof: Assume that u(n) = nM"q is a given N-rational sequence. Consider an arbitrary DOL system G = (X,h, w ) with growth matrix M and with n being the Parikh vector of the axiom w. By Theorem 1.1.1 the alphabets of
4
157
GROWTH FUNCTlONS
the words in E ( G ) form an almost periodic sequence, i.e., there are integers m 2 0 and p > 0 such that ulph(h'(co))= ulph(hi+P(co))
for all i 2 m.
Without loss of generality we assume that all of the sets alph(d(w)),j 2 0, are nonempty. Let now ni and M I ,0 I i I p - 1, be the Parikh vector of the axiom and the growth matrix of the DOL system Gi = (alph(h"+'(to)),hP, hm+j(o)),
and let q, be the column vector obtained from '1 by listing only the entries corresponding to the letters of ulph(h" "(uJ)). Consequently, ti(n) = u(np + m
+ i ) = niM!qi,
0I iI p - 1.
Since all entries in ni are positive, the lemma now follows by Theorem 4.1. 0 Theorem 4.4. A sequence u(n) of nonnegative integers is a PDOL length sequence not idenrical to the zero sequence ifand only ifthe sequence
t(n) = u(n
+ 1) - u(n)
is N-rutionul und u(0) is positive.
Proof: Note first that the additional statement concerning u(0)is necessary because the only PDOL length sequence for which u(0) = 0 is the identically zero sequence. Consider first the "only if" part. Assume that u(n) is defined by the PDOL system
. . ., ak), h, 0).
( { ~ i ,
Clearly, each of the sequences #,(h"(w)) = ti(n), 1 I i _< k, is N-rational. (As before, denotes the number of occurrences of the letter ai in w.) We obtain now #i(ui)
t ( n ) = u(n
=
+ I)
k
-
u(n) =
C ti(n + I ) -
i= 1
k
C ri(n) i= 1
k
k
k
i= 1
i= 1
i= 1
C I /i(ui)1 t i ( n ) - C ti(n) = C ri(n)(1 h(ai)I - 1).
Since, for all i with 1 I i I k , Ih(ai)l 2 1, we conclude that r(n) is N-rational. Consider the "if" part. According to Lemma 4.3, there are integers m and p such that the sequences ti(n) = t(np + m
+ i),
0I i I p - 1,
111
158
SINGLE ITERATED HOMOMORPHISMS
are DOL length sequences. Assume that the sequence ti(n) is generated by the DOL system
0Ii5p
Gi = ( X i , hi, mi),
-
1,
where the alphabets Ci are mutually disjoint. For each of the alphabets X i , introduce new alphabets XiJ', 0 I j I p - 1, and denote by w ( j ) the word obtained from a word w by providing every letter with the superscript (j). Define now a PDOL system G = (C,h, w ) in the following way. The alphabet C equals the union of all of the alphabets XY,0 I i, j I p - 1, augmented by a special letter b. The axiom is defined by
and the homomorphism h by the productions +
&+
1)
+ (hi(a))'b h + b.
for a € & , for
01i1p1, O < j < p 0 I i I p - 1,
1,
Disregarding the positions of the occurrences of the letter b, we note that the first few words in the sequence E(G) are
. ..O F ! ~ W 1, ~ I (ho(oo))'L'b'"o'(h~(o,))(o)b'ol'. .. w ~ 3 ! ~ O,
(ho(wo))'o'b'"o'w'p1
~ ~ ! ~ .
It is now easy to verify that the growth functionf, of G satisfies, for n 2 m + p,
- m - p) = t(m) + . . . + t(n - 1). Indeed, fG(0)= t ( m ) + . . . + t(m + p - l), the first derivation step accord-
(4.5)
f&
+
ing to G brings to this sum the additional term t(m p), the second derivation step the additional term t(m p + l), and so forth. Using the identity u(n) = u(0) t(j), we obtain by (4.5)
+
+ c?::
m- 1
(4.6)
u(n) = fc(n - m - p)
+ u(0) + 1 t (j )
for n 2 m
+ p.
j=O
+ IT=-;
Note that u(0) t ( j ) = A is a constant independent of n. We now modify G to a PDOL system G' generating the word sequence xo, xlr x 2 , . . . with the following properties:
+
(i) u(n) = Ix,I for n < m p. (Since the sequence u(n) is nondecreasing by the assumption of t(n) being N-rational, condition (i) can be fulfilled by introducing new letters to C,each of which occurs only once in the sequence E(G').)
4
159
GROWTH FlJNC''l1ONS
(ii) x , , , ~ = (uc', where c is a new letter with the production c + c in G'. (This can be accomplished because we are free to choose the productions for the letters in x " + ~ - , . ) (iii) For letters of C, the productions are as in G.
The definition of G' and the equation (4.6) now guarantee that u ( n ) equals the length sequence generated by a PDOL system. 0 We are now able to strengthen Lemma 4.3 to thc following result. Theorem 4.5. Ei~cryN-riztionirl sequencc ccin he ilrcomposrd into PDOL length scyuenccs.
Proof: By Lemma 4.3 and the transitivity of the decomposition relation it sutfices to show that every DOL length sequence u(n) can be decomposed into PDOL length sequences. Assume that the given length sequence u(n) is generated by a DOL system G with growth matrix M . We introduce a partial order to the set ofpowers of M in the natural elementwise fashion: M iI M' if and only if every entry in Mi is less than or equal to the corresponding entry in M'. There is only a finite number of minimal elements with respect to this partial order; and, consequently, M" 5 M m f Pholds for some rn and p. Consider now the decomposition of u(n) into the sequences (4.7)
ui(n) = u(np
+ m + i),
We obtain now, for the vectors (4.8)
ti(n) = Ui()7
7c and
0 I i 5 p - 1.
11 deiined by G,
+ 1) - U i ( i J ) = 7Chfnp+i(h!P+m - M")q.
Since M" 5 M p + " , the column vector (Mpf'" - M")q consists of nonnegative entries. Consequently, the sequences (4.8)are N-rational which, by Theorem 4.4, shows that the sequences (4.7) are PDOL length sequences. 0 In the proof above it is not necessary to start by decomposing the given N rational sequence into DOL length sequences: the argument is also applicable directly to the N-rational sequence. Our next theorem shows that one can always transform a Z-rational sequence into a PDOL sequence by adding an exponentially growing "dominant term."The theorem is a very useful tool in constructions where one wants to "descend" from Z-rational sequences to DOL or PDOL length sequences.
160
111
SINGLE ITERATED HOMOMORPHISMS
Theorem 4.6. For every Z-rational sequence u(n), one can$nd eflectively an integer ro such that,for all integers r 2 ro , the sequence
u(n) = r"+'
(4.9)
+ u(n)
is a PDOL length sequence.
Proof: By Theorem 4.2 we represent u(n) in the form (4.3). Let
Gi= ( X i , h i , w,),
i = 1, 2,
be two DOL systems generating u l ( n )and u,(n), respectively. Without loss of generality, we assume that the alphabets C, and C, are disjoint. Define ro
where i
=
=
max{Ihi(a)I,
lull + 2 1 ~ 2 1 )+ 1,
1,2, and a ranges over the appropriate alphabets. Define also
c; = { a ' l a E c , } . For a word w over El, we denote by w' the word over Z, obtained from w by providing each letter with a prime. Fix an integer r 2 r o . Consider now the PDOL system G
=
(C, u C; u C, u { b } ,h, Q
~ Q ; Q ~ ~ ' - ~ 1~ 9 ~ * ~ ( - ' ~ ~ ~ (
where the homomorphism h is defined by the productions b -P b', a -+ h,(a)b for U E Z ~ , u -+ (hl(a))'br-lhl(o)l-' for U E C;, a -+ h2(a)b2r-21h2(0)I for U E C , .
We leave to the reader the detailed inductive verification of the fact that (4.9) is the length sequence of G. See also [SS, proof of Lemma 111.7.21,which establishes a more general result. 0 Since the sequence r l ( n ) = rn+ is a PDOL length sequence, the following stronger version of Theorem 4.2 is now immediate. Theorem 4.1. Every Z-rational sequence can be expressed as the difiirencr of two PDOL length sequences.
We already gave in Theorem 4.4 a complete characterization of PDOL length sequences and, thus, also of PDOL growth functions. This characterization is strong enough to yield the decidability of the property of being a PDOL growth function, a point exploited in more detail below. We now turn to the characterization of DOL length sequences (as a subfamily of N-rational sequences).
4
161
GROWTH FUNCTIONS
Consider Theorem 1.3.5 and the terms (1.3.13) appearing in the sum. Clearly, the term where the absolute value of p is greatest determines the behavior of fG (for large values of n). It can be shown that for N-rational functions (and, hence, for DOL growth functions), the ps coming from such terms must be obtained by multiplying a positive number and a root of unity. Thus, for an N-rational sequence u(n), we can always get a decomposition showing the dominant term: (4.10)
ui(n) = u(np
+ m + i) = ~~(n)crl +C
~ ~ , ( n ) c l ~ ~ ,
.i
where (i) p 2 1 and m 2 0 are fixed integers, (ii) 0 I i I p - 1, (iii) Pi and P i j are nonzero polynomials, and (iv) cii 2 0, mi > maxj)clijIfor all i. Indeed, the decomposition (4.10) is obtained by choosing a p such that the roots of unity involved become 1s. For all details (also as regards the property of ps mentioned above, valid for N-rational sequences), we refer to [SS]. Theorem 1.3.8 shows that a DOL length sequence u(n) cannot be decomposed into diff‘erentlygrowing parts. More explicitly, in the decomposition (4.10) for a DOL length sequence u(n), the numbers txi, 0 I i 5 p - 1, must be the same, and also the degrees of the polynomials Pi(n),0 5 i I p - 1, must coincide. We say that u(n) has growth order ndeg(l’i(rI/p)n,
where deg(P) is the common degree of the polynomials P i , and a = cli. A decomposition of an N-rational sequence into DOL or PDOL length sequences (cf. Lemma 4.3 and Theorem 4.5) may have factors of different growth orders, as already pointed out in Section 1.3.This is the only difference between an N-rational sequence and a DOL length sequence because, conversely, if all the factors in a DOL decomposition of an N-rational sequence u(n)have the same growth order, then u(n)itself is a DOL length sequence. This follows by our next theorem which gives a complete characterization of DOL length sequences and growth functions. Theorem4.8. Assume thut ui(n),0 I i I p - 1, are DOL length sequences with the sume growth order. Then the sequences ui(n)are DOL-mergeable. The quite complicated proof of Theorem 4.8 is postponed and given together with the proof of Theorem 4.11. We refer the reader also to [SS, Theorem 111.7.73 for a proof more directly oriented toward DOL systems. Let us now consider the synthesis problem for DOL growth functions in view of Theorem 4.8. As already discussed in Section 1.3, the following statement of the synthesis problem is somewhat vague: given a functionf(n), construct (if possible) a DOL system (or a PDOL system) whose growth function
111
162
SINGLE ITERATED HOMOMOKI’IllShlS
equals f’(n). We now make the problem precise by assuming that the given function is a Z-rational one. The actual method of “giving” the function may be a matrix representation or some other equivalent en‘ective way; cf. [SS]. Then a complete solution to the synthesis problem is as outlined below. ( I f one becomes more ambitious by considering given functions more general than Z-rational, then the result, at least as regards the easily conceivable generalizations, will be that the synthesis problem is undecidable. This is due to the fact that, for such generalizations, it is not even decidable whether or not the given function is Z-rational.) In the first place we can decide whether or not a given Z-rational scquencc is an N-rational one. The property characterizing N-rational sequences within the family ofZ-rational sequences is the existence ofa decomposition (4. lo); cf. [SS]. This reduces the decision to thc application of some tncthods of elementary algebra. Since we are able to decide the N-rationality of a %rational sequence, we are also, by Theorem 4.4, able to decide whether or not a given DOL length sequence is a PDOL length scquence. Thus, there remains the decision about whether or not a given N-rational sequence is a DOL length sequence. This decision is made by first forming the DOL decomposition according to Lemma 4.3. By Theorem 4.8 the given N rational sequence is a DOL length sequence exactly in case the factors in the decomposition possess the same growth order. The decision concerning the growth orders can again be made by methods of elementary algcbra. Our solution of the synthesis problem not only decides whether a given Z rational function is a DOL or PDOL growth function but also produces (as a proper solution of the synthesis problem should) in the positive case a DOi or PDOL system having the given function as its growth function. This follows because all the proofs involved are constructive, in particular, the proof of Theorem 4.8. The solution to the synthesis problem also yields a solution to the cell number minimization problem. Indeed, assume that a given sequence u(n) has been realized as the growth sequence of a DOL (or PDOL) system G with an alphabet of k letters and with axiom Q. Then any DOL (or PDOL) system GI =
(xi, h i , w , ) ,
#(Xi)
S k,
realizing u(n) must satisfy the conditions: (i) lull = I Q I and (ii) Ihl(a)l, where a E XI,is bounded by the maximum length among the k + I first words in the sequence u(n). Thus, for alphabets with a cardinality smaller than k , there remain a finite number of tests, each of which can be carried out by Theorem 1.3.3. The solution to the merging problem (provided the given functions are Z rational) should be obvious by Theorem 4.8 and by the solution to the synthesis problem presented above.
4
163
GROWTH FUNCTIONS
We now present a detailed solution to the synthesis and merging problems of polynomially bounded functions. This discussion also gives some background for the more involved study ofgenerating functions given at the end of this section. Clearly, any function f : N + N such that f ( n ) = 0 for n 2 no, and f ( n ) > 0 for n < no, is a DOL growth function. No other functions assuming the value 0 are DOL growth functions. Since also the merging problem becomes trivial for functions assuming the value 0 (because the nonzero values can be included in the “initial mess”), the functions considered in this discussion assume positive values only. Lemma 4.9. For any nonnegative integer k, f ( n ) is a DOL growth function ifand only iff ( n k ) is a DOL growth function.
+
+
Proof The “only if” part follows by letting the ( k 1)th word in the original word sequence be the new axiom. The “if” part is established by the argument given at the end of the proof of Theorem 4.4. Note that it is essential that each of the values f(0), . . . ,j ( k - 1 ) differs from zero. 0
Any function g(n) such that, for some k 2 0, g(n + k ) = f (n) is satisfied for all n is said to be obtained from f ( n ) by shi,ft. Thus, this shift operation means that new (positive) numbersare added to the beginning ofthegrowth sequence determined by 1’.Also, any function g(n) satisfying q(n) = f (n + k ) is said to be obtained from f’(n) by shift. This shift operation means that some numbers are omitted from the beginning of the growth sequence determined by f. We now define the class FPoLof functions from N into N as follows: (i) The zero function is in FPOL. (ii) FpoLcontains all functions g from N into the set of positive integers of the form f
=
C Pi(n)ri(n), i= 1
where P I , .. . , P, are polynomials, r l r . . . , r, are periodical functions with periods p , , . . . ,p I , respectively, and the polynomials (4.1 1)
Qi(n) = g(np
+ i),
0 I i Ip
- 1,
where p is the lcast common multiple of the numbers p l , . . . , p,, are all of the same degree. (iii) FpoL contains all functions obtained from the functions in (i) and (ii) by shift operations. FpoL contains no further functions. We shall prove that FpoLcoincideswith the class of polynomially bounded DOL growth functions. Note especially the role of (iii). It gives a possibility
164
111
SINGLE ITERATED HOMOMORPHISMS
of adding an "initial mess" to the decompositions (4.11). Applied to (i), it gives all DOL growth functions becoming ultimately zero.
The class FpoL equals the class of'polynomially bounded Theorem 4.10. DOL growth.func'tions. Proqf: That every polynomially bounded DOL growth function is in FpoL follows because we must have in the decomposition (4.10) ai = 1 and aij = 0 in the polynomially bounded case. (A more direct way to prove this is to observe first that the roots p of the difference equation lie within the unit circle, and consequently by a theorem of Kronecker all nonzero roots must be roots of unity.) By Theorem 1.3.8 the polynomials (4.1I ) must be of the same degree. Conversely, we have to prove that every function in FpoLis a polynomially is polynomially bounded DOL growth function. Clearly, every function in FpoL bounded, Since the function (i) is a DOL growth function, it suffices by Lemma 4.9 to show that all functions (ii) are DOL growth functions. This is done by induction on the common degree m of the polynomials (4.11).The case m = 0 (as well as the case of zero polynomials) is obvious. We now make the followinginductive hypothesis: every function in (ii), where thecommondegreeofthe associated polynomials is less than or equal to m, is a DOL growth function. Consider an arbitrary function g(n) in (ii) such that the associated polynomials (4.11) are of degree m + 1 2 1. Clearly, one can effectively find an integer no such that all polynomials (4.11) are strictly increasing for argument values n 2 no. By Lemma 4.9 it suffices to show that gl(n) = g(n + no) is a DOL growth function. By the inductive hypothesis the function gz(n) = g l ( n
+ P) - g~(n)
is a DOL growth function. (Clearly, this function is in FPOL, and the degree of the associated polynomials is at most m.) Consider the following identity between the generating functions of g l ( n ) and gz(n):
The sum appearing on the right-hand side is the generating function of gz(n) and, hence, the generating function of a DOL growth function. By
Lemma 4.9 and an obvious argument concerning the polynomial part this
4
165
GROWTH FUNCTIONS
implies that the whole numerator on the right-hand side is the generating function of a DOL growth function. Consequently, the validity of the following assertion implies that gl(n) is a DOL growth function which, in turn, completes the proof of Theorem 4.10. 0 Assertion. Assume that p is a positive integer. Whenever F ( x ) is the generating function of a DOL growth function (not becoming ultimately zero), then so is F ( x ) / ( 1 - xp). To prove the assertion suppose that a,
F(x) =
1 a, .xn. n=O
Then
+ u l x + . . . + u p - , x p - ' + ( a p + ao)xP + ( a p + ,+ + '.. + + + ( u z P+ a p + ao)x2" + . . . .
(4.12) F(s)/(l - x p ) = a.
U,)XP+I
(azp-l
up_1)x2p-1
Let (I),,, n = 0, I , . . . , be the word sequence of a DOL system G such that )o,I= u, for all n. We now modify G to a DOL system G 1 as follows. Assume that ((Oo(O1 . . . ( l J P - , I
=
y.
Using the indices 1, . . . , 4 , we provide each occurrence of every letter occurring in the words m0,.. . , (oP- with a unique index. Let cob, . . . , (0;- be the words obtained in this fashion. cob is the axiom of G,. The productions for the letters occurring in cob, . . . ,o& are the"indexed versions"ofthecorresponding productions from G. The productions for the letters in 01;- ! are the same as the productions for the corresponding nonindexed letters in G with the exception of the first letter which introduces an additional copy of cob. For letters of G, the productions in G and G , coincide. Thus, the word sequence of G , is
,
,
and consequently its length sequence is the one appearing in (4.12). 0
In the assertion above it is also sufficient to assume that the coefficients of xo, xl,. . . , x p - in F(x) are positive. The proof of Theorem 4.10 gives another solution to the synthesis and merging problems in the polynomially bounded case.
166
111 SINGLE ITERATED HOMOMORPHISMS
The generating functions of W L growth functions were discussed already in Section 1.3. We now conclude this section by giving a characterization for the class ofgenerating functions of DOLgrowth functions. It should be pointed out that the arguments presented below provide a proof of Theorem 4.8 and also alternative methods of proving some of our earlier results on growth functions. We introduce first some notations. We denote by F(D0L) the class of generating functions of DOL growth functions. Thus, a function m
F(x) =
1 a,x" n=O
belongs to F(D0L) if and only if the sequence of numbers ao, a,, a 2 , ... constitutes the length sequence of some W L system. By F(BR) (BR from "bounded rational") we denote the class of rational functions
where the as, ps, and qs are integers such that one of the following two conditions is satisfied: (i) There exists a nonnegative integer no such that a, = 0 for all n 2 no, and a, > 0 for all n c no. (ii) For all n, a, > 0 and a,, ,/a, Ic for some constant c. Moreover, every pole xo of the minimal absolute value is of the form xo = re, where r = ( x oI and E is a root of unity. It can now be verified by our previous results that F(DOL) E F(BR). Indeed, the condition concerning poles in (ii) guarantees that if m
F(x) =
1 a,x" n=O
is in F(BR), then a decomposition result corresponding to (4.10) can be obtained for the number sequence a,,. (Note that the inverses of poles with minimal absolute value give the roots of highest absolute value of the corresponding characteristic equation.) Consequently, every function in F(BR) is the generating function of an N-rational sequence. The inclusion F(D0L) c F(BR) now follows by Theorems 1.3.2 and 1.3.8, and the fact that every DOL growth function is an N-rational function. (Clearly, functions satisfying condition (i) above coincide with DOL growth functions becoming ultimately zero.) Thus, the proof of the reverse inclusion F(BR) c F(WL), given below, implies the following theorem.
4
167
GROWTH IUNCTIONS
Theorem 4.1 1. /I rtitionul jiinction F ( x ) with integral coeficients and rc)r-ittcn in lowest terms is the generuting function of a DOL growth function not itlrnticvrl to the zero,fiinction f u n d only fi either
F(x)
=
+ U ~ +X . . . + aNxN,
where u O ,u , , . . . , (iN tire positine integers, or else F ( x ) satisfies each of the jbllowing conditions :
(i) The con.stunt tcrm qf its denominator equals 1. (ii) The coqffiicients ofthe Tuylor expansion 22
F(x) =
1
U“X”
n=O
lire positive integers und, moreover, the ratio u,,+ ,/a. is hounded by a constant. (iii) Every pole xOof’F(x)ofthe minimul absolute value is of theform xo = r&
where r
=
1 xO I and E is a root of unity.
We now begin the proof for the inclusion F(BR) G F(D0L). This proof also gives a very interesting further characterization of the class F(D0L). Moreover, it gives a method of establishing Theorem 4.8. Consider two functions F ( x ) and G(x) in F(D0L). Let t be a positive integer. Assume, furthermore, that the coefficient of x‘- in G(x) (and, consequently, the coefficient of every x iwith i I t - 1) is positive. Then the function
G(x)/(l
- F(x‘)x‘)
is called the quasiquotient of G and F (with respect to t). The shfl operations defined above for growth functions are extended in a natural way to concern the generating functions of growth functions: if g is obtained fromf by shift, then the generating function G of g is obtained from the generating function F of ,f by shift.
Lemma 4.12. The class F(D0L) is closed under the operations of addition, shift, and quasiquotient. Prouf: Closure under addition is obvious. Closure under shift follows by Lemma 4.9. Closure under quasiquotient is established similarly to the assertion in the proof of Theorem 4.10. 0 Note that the additional assumption concerning the coefficients of G(x) in the definition of quasiquotient is necessary for Lemma 4.12. Otherwise, we could form the quasiquotient (2 x)/(l - x 3 ) of two functions (namely, 2 + x and 1) belonging to F(D0L) in such a way that the quasiquotient itself is not in F(D0L).
+
111
168
SINGLE ITERATED HOMOMORPHISMS
Clearly, all polynomials in F(BR) belong to F(D0L). In what follows we consider functions in F(BR) that are not polynomials and write them in the form
where I ctl I 2 I a2 I 2 . . 2 I a, 1. It is easy to see that a1 must be a real number 2 1 (after a possible rearrangement of the as with the greatest absolute value). In fact, a1 is the inverse of the radius of convergence of the series expansion of F(x). The next lemma is a mergeability result. Assume that Fo(x), . . . ,F 1 - l ( x ) are functions in F(BR) possessing a common denominator, i.e., Lemma 4.13.
Assume, further, that k l = 1 and that a1 is suflciently large compared with la2[,. . . , Ia,I. Then 1-1
(4.13)
F(x) =
1xiFi(xl)
E F(D0L).
i=O
Proof: For a sufficiently large u, we expand Fi by separating the "initial mess" of length u 1 :
+
Hence,
+
where Pu(x)is a polynomial of degree ut t - 1 such that the coefficient of each x" with 0 < n I (u + 1)t - 1 is positive. By Lemma 4.12 it suffices to show that I- 1
(4.14)
QiU(x')xi/P(x') E F(D0L).
C(x) = i=O
Note that the "initial mess" P,(x) has to be considered separately because the effect of a1being large might be visible in the generated sequence only from a certain point on. The case s = 1 being clear, we assume in the sequel that s > 1.
4
GROWTH FIJNCTIONS
169
Denote
P ~ ( x= ) (1
-
a , ~ ) ~ ' . . .( lc(,?c)~' = 1
+ d l x + . . . + d,xm
and choose [j = [ a 1 / 2 ] ;i.e., P is the largest integer less than or equal to a1/2. We now write P ( x ) in the form
+
+
P(.x) = ( I - a , x ) ( l + d l x . ' . dmxrn) = 1 - /?x - (e1x . . . em+lXm+L),
+ +
where the es are integers defined by =
21 - dl
-
/?,
ei = a l d i - l - di
Consequently, (4.15)
G(.x) =
e,+l = aldm,
for 2 5 i I m.
xi: A Qiu(.xr)xi 1
-
I)'
pxr
(4.14) is now established using (4.15) and the closure of F(D0L) under shift and quasiquotient. Thus, we consider (4.15) in the form G(x) = G I(X)/( 1 - G2(xf)x'),
It sufficesto show that r-1
(4.16)
Gl(X) =
1QiU(xr)xi/(1 - fixr)E F(D0L)
i=O
and m+ 1
(4.17)
1eixi-'/( 1 - [jx) E F(D0L).
G2(x) =
i= 1
To prove (4.16), we first reduce by division QiU(x) to a single term as follows: (4.18) Qiu(x)/(1 - PX) = bio
+
+ . . . + bi,m
h i l ~
-I
x"-
+ bimxm/(1 - PX).
Here all of the bs are positive integers. Clearly hio > 0 and, by our assumption concerning a l , biomultiplied by the highest power of Pdominates the other bs. Consequently, we may write G,(x) in the form (4.19) where P m ( x ) is a polynomial of degree mt - 1 with all coefficients positive integers. (4.16) follows now from (4.19) by Lemma 4.12; we apply first shift
I70
111
and then quasiquotient to the functions functions are in F(D0L). To prove (4.17), we note first that
SINGLE ITERATED HOMOMORPHISMS
c!:: bi,xi and 8. Clearly, the latter
j
(4.20)
Ceipj-' > O
for all .j
=
I , . . . ,m
+ 1.
i= 1
This result is a consequence of our assumption concerning a l . (Remember that /I = [a1/2].) Since each di is a symmetric function of a 2 ,. . . , a,, we may assume that a1 is also large with respect to each Idil. This implies that c 1 is positive and that the term el/)j-l dominates the sum. But now (4.17) follows by (4.20). In fact, because of (4.20), we can write an expansion analogous to (4.18) for G2(x).It then suffices to apply shift and quasiquotient, the latter in the very simple case of two constants. (Note that (4.17) cannot be established directly by an application of quasiquotient because some of the oi may be negative.) 0 Lemma 4.14. Suppose that Fo(x),. . . , F,- l ( x )satisfy the assumpiions of the previous lemma, except that the multiplicity k l may be larger than 1. The conclusion (4.13) still holds true.
Prooj: Assume first that k l = 2, i.e.,
for i = 0,. . . , r - 1. There are polynomials P,(x), P 2 ( x ) , and R o ( x ) with integer coefficients such that for some R , ( x ) and R 2 ( x ) P(x) = Pl(x)P,(x)R,(x)? P ~ ( x= ) ( 1 - .1x)Ri(x), Ri(l/al) Z 0,
i i
1,2, = 0, 1 , 2. =
This follows because no equation irreducible over the field of rationals has multiple roots. We now choose sufficiently large numbers u 1 and u2 and write each Fi(x)in the form
where the as and bs are positive integers. Consequently, (4.22)
F ( x ) = P,(x)
+
x(Yl
+1
~
PI (x')
4
171
GROWTH FUNCTIONS
where P , ( x ) and P:(x) are polynomials with positive integer coefficients (and with degrees u l t + t - 1 and u 2 t + t - 1, respectively). By Lemma 4.13
By Lemma 4.12 the function within brackets on the right-hand side of (4.22) belongs to F(D0L). Call this function G(x). We see from (4.22) that, to establish our claim F(x) E F(WL), we can apply shift once more; and consequently it suffices to prove that
G ( x ) / P , ( x ' )E F(D0L).
(4.23)
We use now the same transformation as in Lemma 4.13. We choose
fi = [a1/2] and write P l ( x ) in the form
+
P l ( x ) = (1 =
- a,x)(l dlx 1 - fix - xH(x),
+ ... + d,xm)
where H ( x ) is a polynomial with integer coefficients. We obtain (4.24) From this the claim (4.23) follows by two applications of the operation of quasiquotient because the relation
H(x)/(1
-
fix) E F(D0L)
is established exactly as (4.17). The proof in the general case, i.e., for an arbitrary k l , is essentially the same; we have considered the case k l = 2 to simplify notation. In the general case P ( x ) is written as
p ( x ) = p1(x>p2(x)' . ' Pkl(x)RO(x). The expansion (4.21) reads now
and an analogous modification has to be made in (4.22). Using the resulting expansion, the claim (4.13) is then established by successive applications of quasiquotient and shift, starting from the innermost brackets. 0
111
I72
SINGLE ITERATED HOMOMORPHISMS
We are now in the position to establish the inclusion F(BR) c F(D0L). Given a function F(x) in F(BR), we consider “decompositions” of F ( x ) such that Lemma 4.14 becomes available. More explicitly, assume that
(Thus, we write identical factors 1 - a i x as many times as they occur.) We have either a1 > 1 or a1 = 1a21 =
. . . = Ia,I
= 1.
We consider the former case, the latter (polynomially bounded) case is left to the reader. Thus, for some p , a1 =
1azI
=
. . . = la,l > Iapfll 2 . . . 2
las/.
By the assumptions concerning F(BR) each of the numbers a 2 , . . . , a, is obtained by multiplying a1 with a root of unity, i.e., aj = e x p ( 2 7 r P k j / f i ) a , ,
2 I j 5 p,
where k j and l j are positive integers. Let now t be a sufficiently large common multiple of the numbers 1 2 , . . . , 1,. We denote m
(4.25)
F,(x) =
1 a,,+ixn,
0I i5t
-
1.
n=O
Then clearly 1-
F(x)
=
1
Cx’F,(x‘). i=O
We still have to establish the necessary results about the generating functions of Fi(x). Denote p = exp(2nfl/t) and, for any function G(x), 1- 1
D,(G(x)) =
c G(p’x)/t.
i=O
By properties of roots of unity it follows then immediately that x” D1(x”)= {O
when n is a multiple oft, otherwise.
But this means that F,(x’) = D,(x-’F(x)),
0 I i I t - 1.
4
173
GROWTH FUNCTIONS
Going back to the generating functions, we see that (4.26)
F,(x‘) = Q , ( x ) / R ( x ) ,
0I iI
t
-
1,
where 1-1
R ( . Y ) = n(l - L Y ~ P ’ X ) . . . (-~ LY,P’X) j=O
= (1 - a;.‘)...(
+
1 - six').
+
The coefficients of R ( x ) = 1 d l x ‘ + . . . dSx” are polynomials with integer coefficients in terms of the fundamental symmetric functions of a,, .. ., as, i.e., in terms of the coefficients of P ( x ) . This implies that the coefficients of R ( x ) are integers; and consequently by (4.25) and (4.26) also the coefficients of Q i ( x ) are integers. The poles of F,(x) are among the tth powers of the poles of F(x), and l/u\ is necessarily a pole. Furthermore, the multiplicity of the pole l/u{ is the same for each F,(x) because, otherwise, we have a contradiction with the boundedness of u,,+,/u,,. But this implies (provided that r was chosen sufficiently large) that all assumptions of Lemma 4.14 are satisfied and, consequently, F ( x ) E F(D0L). We have established the inclusion F(BR) c F(D0L) and, therefore, also Theorem 4.1 1. But now also Theorem 4.8 follows. We merge first the given DOL length sequences into the same N-rational sequence. Thus, their generating functions will have the same denominator. By choosing, if necessary, a finer decomposition we can again apply Lemma 4.14. Our last theorem, stated below, gives a very interesting characterization for the class F(D0L) of generating functions of DOL growth functions. The theorem is an immediate corollary of Theorem 4.11, Lemma 4.12, and the constructions in the proofs of Lemmas 4.13 and 4.14, in particular, (4.15), (4.16), (4.22), and (4.24). Theorem 4.15. The cluss ofgeneratingjunctions of DOL growth,functions r4uul.y the sniullest cluss contuining the zero ,function and closed under the operutions oj shifi untl qiicisiquotient.
Although we have presented a solution to many difficult problems concerning DOL growth functions, still a number of important problems remain open. For instance, is it decidable whether or not a DOLgrowth function is the growth function of a locally catenative system‘?Is it decidable whether or not a DOL growth function is monotonic? (Variations of this problem will be discussed in Exercises 4.1 1 and 4.1 2.)
174
111
SINGLE ITERATED HOMOMORPHISMS
The strong mathematical tools we have used for growth functions apply also in case of DTOL systems, as will be seen in Section IV.5. They are not applicable for systems with interactions.
Exercises 4.1 Merge the sequences to(n) = 0,
t,(n) = (n
t1(n) = 2",
+ 1)2
into one N-rational sequence. Interpret the matrix representation as an HDOL system. 4.2. Merge the sequences
to(n) = 2n2
+ 3,
tl(n) = (n
+ 1)2,
t2(n) = 30n2
+ 13
into one WL system. 4.3. Prove the following result, useful for synthesis. Assume that u l , . . . , a k are integers such that i xui
> 0 for every j
=
1, . . . ,k.
i= 1
Prove that there is a P W L system G such that the function F(x) = (1 - a , x -
*'.
-
akXk)-l
is the generating function of the growth function of G. (Cf. [Rul].) 4.4. There are Z-rational sequences of positive integers that are not Nrational. (Cf. [Be].) Use this fact to prove that there are strictly growing DOL length sequences that are not PDOL length sequences. 4.5. Establish by Theorem 4.8 the following result. Assume that r(n) is an N-rational sequence such that (i) r(n) # 0 for all n and (ii) there is a constant c such that
r(n
+ l)/r(n) I c
for all n.
Then r(n) is a DOL length sequence. 4.6. Prove that there is a DOL length sequence r(n) such that (i) r(n) < r(n - 1 ) holds for infinitely many values of n,and (ii) for each natural number n, there exists an rn such that
r(m) < r(m
+ 1) < ... < r(m + n).
EXEK('IS1:'S
175
(Thus, t he result corresponding to Theorem I.3.6docs not hold for incqualities. The sequencc r(H) is obtained by merging two DOL length sequences k" + s(n) and I\" + ~ ( n )where , li is large, s(n) < r(n) holds in some arbitrarily long intervals, and s(n) > [ ( n ) infinitely often. The details can be found in [K4].) 4.7. Give ;I detailed proof of Lemma 4.12.
4.8. Exprcss explicitly how large u I in the statement of Lemma 4.13 has to be in order that (4.20) be valid. 4.9. Consider Theorcm 4.15. Prove that there can be no upper bound for t1ie"quasiquotient height"without affectingthe validity ofthe theorem. More specifically, prove that if k is constant and only such functions are considered, where the number of nested applications of the operation quasiquotient does not exceed k , then the functions considered d o not include all generating functions of DOL growth functions. (We are grateful to T. Katayama for comments concerning this exercise.) 4.10. Give an algorithm for deciding whether or not the ranges of two DOL growth functions coincide. (Cf. [BeN].) 4.1 1. The following two decision problems concerning Z-rational sequences are open. P r d m I. (nonnegativeness) Consider square matrices M with integral entries. We say that M generates a nonnegative sequence if and only if all the numbers appearing in the upper right-hand corners of the matrices M", n 2 1, are nonnegative. Is it decidable whether or not a given matrix generates a nonnegative sequence'? Prohlun 2. (existence of zero) We say that M generates 0 if and only if, for some n, thc number 0 appears in the upper right-hand corner of M". Is it decidable whether or not a given matrix generates O? Prove that each of the following Problems la, lb, lc (resp. 2a, 2b, 2c) is equivalent to Problem 1 (resp. Problem 2). Prohlcm fu. Is it decidable of two given DOL length sequences r(n) and s(n) whether or not r(n) 5 s(n) holds for all n ? Problem fh. Same as Problem l a but r(n) and s(n) are PDOL length sequences. Problem Zc. Is it decidable of a given DOL length sequence r(n) whether or not r(n) is monotonic? Problem 2u. Is it decidable of two given DOL length sequences r(n) and s(n) whether or not there exists an n such that r(n) = s(n)? Problem 2h. Same as Problem 2a but r(n) and s(n) are P W L length sequences.
176
III
SINGLE ITERATED HOMOMORPHISMS
Problem 2c. Is it decidable of a given DOL length sequence r(n) whether or not there exists an n such that r(n) = r(n l)? (Note that an obvious decision method exists if r(n) is a PDOL length sequence.) The following exercise gives further significance to Problem 2. See also
+
csf31. 4.12. Assume that an algorithm is known for the solution of Problem 2 (or for one of the equivalent versions of it) given in the previous exercise. Show that this algorithm can be used to solve each ofthe following decision problems concerning word sequences. (At present, the decidability status of (ii)-(iv) is open.)
(i) Given two DOL systems, decide whether or not the generated word sequences differ from each other only in a finite number of terms (ultimate equivalence problem for DOL sequences). (ii) Given two HDOL systems, decide whether or not the generated word sequences coincide (equivalence problem for HDOL sequences). (iii) Given two HDOL systems, decide whether or not the generated word sequences differ from each other only in a finite number of terms (ultimate equivalence problem for HDOL sequences). (iv) Given two HDOL systems with nonsingular growth matrices, decide whether or not the generated word sequences have an empty (resp. finite) intersection. (Cf. [Ru5] and [Ru~].)
5. DOL FORMS
The discussion concerning DOL systems is now concluded with a topic related to the area introduced in Section 11.6: DOL forms. We have already emphasized that the main ideas and proof techniques concerning L systems are present in the study of DOL systems, free of the burden of definitional complications. However, DOL systems still constitute a most challenging area of mathematical problems. Both of these aspects also remain valid when forms are considered. The definition of a DOL form and its interpretations are very simple. In particular, there is no arbitrariness in the definition of an interpretation: we have only one natural possibility if the interpretation is required to be in some sense similar to the original system. However, as we shall see, the problems concerning DOL forms are difficult and challenging, and some of the results are very surprising. The main results are presented for PDOL forms only. It is an open problem to what extent the results can be generalized to arbitrary W L forms. We now introduce the most important notions of this section.
5
177
I ) O L FORMS
De$niriun. A DOL form is a DOL system F = (C, 11, ro). A DOL system F’ = (C’, h‘, (of) is called an interpreturion of F (modulo p), in symbols F ’ a F ( p ) or shortly F ‘ a F , if p is a substitution on C such that each of the following conditions is satisfied:
(i) For each a E C, p(a) is a nonempty subset of Z’. (ii) p ( u ) n p ( h ) = @ for each a, ~ E with C ( I # b. (iii) (0’ E ~ ( o J ) . (iv) h’(a)E p(h(L1- ‘ ( a ) ) )for each a E C’. (Note that p - ‘ ( a ) is a unique letter of C for each u E C’.) The families of DOL systems, DOL languages, and DOL sequences associated t o F are defined by
9 ( F ) = { F ’ I F ’ aF ) ,
T ( F )= {L(F’)IF’aF},
6 ( F ) = {E(F’)IF’aF}.
Two DOL forms Fl and F 2 are strictlyjbrm equivulenr if 9(Fl) = Y(F,),,form equivulent if sV(F1)= Y ( F 2 ) ,and sequence equivalent if E ( F , ) = b ( F , ) . 0
If F is a PDOL system, it is referred to as a PDOLjbrm. Clearly, all interpretations ofa PDOL form are PDOL systems. As was done in connection with DOL systems, we assume that also the DOL forms considered are reduced when regarded as DOL systems. It should be emphasized that if F above is regarded as a degenerate EOL system, then the family of interpretations 9 ( F ) defined above for F being a DOL form constitutes a proper subfamily of the family %(F)defined in Section 11.6 for F being an EOL form. However, no confusion should arise because the earlier interpretations are not considered at all in this section. Besides, the “deterministic” interpretations introduced above seem to be the only natural ones for DOL forms: it would be very unnatural if an interpretation of a DOL form were not a DOL system, and the omission of condition (ii), for instance, would imply that all similarity between two interpretations of the same form is lost. We mention the following result, the proof of which is immediate by the definition, to emphasize the fact that the notions of a DOL form and its interpretationsdeal with some very basic aspects concerning homomorphisms. Theorern5.1. A DOL system F‘ = (C’, h‘, Q’) is an interpretation ofa DOL fiwrn F = (C, h, (0)$and only ifthere i s a length-preserving homomorphism g qfC’* onto X* such that g((d) = (I) und gh’ = hg.
The terms “strict form equiva1ence”and “form equiva1ence”are analogous to those used in Section 11.6. As before, we call F , and F 2 form equivalent if I p ( F , ) = Y ( F 2 ) .The term “language equivalence” is reserved for the case where L ( F , ) = L ( F , ) , i.e., F 1 and F 2 are viewed as DOL systems and their generated languages coincide.
178
111
SINGLE ITERATED HOMOMORPHISMS
Some simple observations can be made directly from the definitions. The relation a is transitive: if F’ Q F , then S(F’)c %(F). Since the converse implication is obvious, we conclude that two DOL forms are strictly form equivalent if and only if each of them is an interpretation of the other. Since the relation Q is decidable (the situation here is even simpler than in Theorem 11.6.3), it follows that strict form equivalence is decidable for DOL forms. The relation F , a F z implies both of the inclusions 2 ( F l ) c 9 ( F z ) and Q ( F , ) c b(F,). It also implies that the cardinality of the alphabet of FI is greater than or equal to the cardinality of the alphabet of F z . Strict form equivalence of two forms implies their sequence equivalence which, in turn, implies their form equivalence. The families 9 ( F ) and 6 ( F ) are invariant under renaming the letters of the alphabet of F. Thus, if two forms are identical, i.e., have the same axiom and the same productions, or become identical after renaming the letters, then they are sequence equivalent and, consequently, form equivalent. A notion very useful in our subsequent considerations is that of an isomorphism between two word sequences. We say that two sequences of words xi and yi, i = I, 2, . . . , are isomorphic if there is a one-to-one letter-to-letter homomorphism f such that the equation
Yi = f (xi)
(5.1)
holds for all values of i. They are ultimately isomorphic if there is a number io such that (5.1) holds for all values of i 2 i,. In what follows we often identify isomorphic sequences. This happens without loss of generality because the properties we are interested in (such as form equivalence) are invariant under renaming of letters. It will be seen that whenever two PDOL forms F1 and F 2 are form equivalent, then the PDOL sequences E ( F , ) and E(F,) are isomorphic, providing one of the sequences contains a word of length greater than one. (The exceptional case is discussed below in Example 5.1.) The sequence equivalence of two DOL forms implies their form equivalence, as noted already above. The main result in this section is the rather surprising fact that, as regards PDOL forms, also the converse implication holds true, again when the trivial exceptional case presented in Example 5.1 is excluded. This result also leads to the decidability of both form and sequence equivalence of PDOL forms. The reader is reminded that, as regards EOL forms, the decidability of form equivalence, as well as of several related problems, is open. Example 5.1.
Let F1 and F z be PDOL forms with the axiom a and with
the productions F,:
a+b,
b-a;
Fz: a-rb, b-rb.
5
DOI. FORMS
179
Then 9 ( F l ) = 6P(F2)consists ofall finite languages with cardinality 2 2 and with all words of length 1. However, R ( F l ) # d(F2).In fact, neither is E ( F , ) contained in b ( F , ) nor is E ( F 2 ) contained in B ( F l ) . Observe also that the sequences E ( F , ) and E ( F , ) are not even ultimately isomorphic. A general example of the same nature consists of two forms Fl(n, k ) and F2(n, I ) ,where n 2 2 and 1 I k < 1 I n. The axiom is a l and the productions are defined by
As before, the language families of the two forms coincide, whereas the sequence families are different. It is very instructive to keep in mind the following basic fact, resulting from the definition of an interpretation. Given a DOL form F , we can always interpret two occurrences of the same letter in E ( F ) differently, whereas we cannot interpret two different letters in the same way. Thus, for any t, we can construct an interpretation F' of F such that no letter occurs twice in the word obtained by catenating the t first words of E(F'). On the other hand, if the i2 th letter of the i l th word in E ( F ) differs from thej2 th letter of thej,th word, then the same holds true for every sequence E(F') such that F' 4 F . Some of the customary terminology dealing with DOL systems will be extended in the natural way to concern forms. Thus, we speak ofJiniteW L forms F , meaning that the language L ( F ) is finite. Clearly, every language in the family 9 ( F ) is finite (resp. infinite) if F is a finite (resp. an infinite) form. We call a form F strictly growing if the word sequence E ( F ) is strictly growing in length. We now begin our investigations of conditions necessary for form equivalence. From now on we shall deal only with P W L .forms. It is an open problem whether Theorem 5.13 holds for DOL forms as well. As regards the other main result, Theorem 5.12, it is clear that Example 5.1 does not exhaust all of the exceptional cases if DOL forms are considered. It remains an open problem to list the exceptional cases and, thus, extend Theorem 5.12 to DOL forms. We shall prove first that, for infinite PDOL forms F1 and F 2 , the equation 6P(Fl) = 6P(F2) implies that the sequences E ( F , ) and E ( F 2 ) are ultimately isomorphic. We begin with two simple lemmas.
Lemma 5.2. Consider two PDOL forms Fi = ( X i , hi, mi),i = 1,2, and assume that F , is strictly growing. Z f L ( F , ) E 9 ( F 2 )and L ( F 2 )E Y ( F 1 ) ,then the sequences E ( F , ) and E(F,) are isomorphic. Consequently, i f F , and F 2 are form equivalent, then the sequences E ( F , ) and E ( F 2 ) are isomorphic.
180
111
SINGLE ITERATED HOMOMORPHISMS
Proof: Consider first the second sentence. By the assumption there is an interpretation F ; ofF, such that L ( F l ) = L(F;). Hence, # ( C l ) 2 #(Z,). In the same way we see that # (C,) 2 # (Zl). Consequently, Z1and X2 are of the same cardinality. Thus also the alphabets of F , and F ; are of the same cardinality. This means that F ; is obtained from F , simply by renaming the letters of Z,. Therefore, E(F,) and E ( F ; ) are isomorphic. The second sentence now follows because E ( F , ) is strictly growing in length. By the definition of form equivaknce, the third sentence is a consequence of the second sentence.
0 The argument concerning the cardinalities of XIand C, given in the proof above also yields the following result.
Lemma 5.3. Assume that F , and F 2 are PDOL forms (not necessarily strictly growing) such that L ( F , ) E Y ( F , ) and L(F,) E 6V(F1). Then the languages L(Fl) and L(F,) are equal u p to renaming of letters. The basic idea behind the proof of the fact that, for any infinite PDOL forms F1and F , , their form equivalence implies that the sequences E(Fl) and E ( F , ) are ultimately isomorphic, is to reduce the situation to Lemma 5.2 by considering decompositions Fi(p, q ) of the original forms for some large enough p. Clearly, if F = (C,h, w )is an infinite PDOL form and p 2 # (C), then F(p, q ) is strictly growing. The following lemma will be the most important tool in the proof.
Lemma 5.4. Assume that F i= (Xi,hi, mi),i = 1, 2, are form equivalent infinite PDOL forms and that p is a suficiently large integer. ( I t suffices to choose p > 2 max{ #(El), #(X2)}.) Then for each q = 0, . . . , p - 1, the sequences E ( F l ( p , 4 ) ) and E(F2(p, q)) are ultimately isomorphic. The proof of Lemma 5.4 will be only outlined; the technical details can be found in [CMORS]. A similar procedure will be followed in connection with two other lemmas in this section because the proof methods rely heavily on the notion of an interpretation and are not used elsewhere in this book. For the proof of Lemma 5.4, we consider some fixed F , ( p , q ) with p and q sufficiently large. (Also q must be chosen large, to exclude the irregularities of the initial mess. This can be done because the claim concerns only ultimate isomorphism.) The system Fl(p, q ) is extended to an interpretation F; of F , in such a way that
E(F;(P, 4’)) = E(Fl(p9 4”,
5
181
IIIIL FORMS
for some y‘ possibly larger than 4, and that all the alphabets needed for words in the “intermediate levels” are pairwise disjoint. Because F1and F 2 are form equivalent. there is an interpretation F ; of F 2 such that L ( F ; ) = L(F;). The basic difficulty is that we d o not know in what order F 2 generates the words in L(F’,).Clearly, E(F’,) is obtained from E ( F ; ) (and vice versa) by permuting words of equal length. More specifically, it is easy to see that E(F’,)is obtained from E ( F ; ) (and vice versa) by permuting isomorphic words, i.e., we can divide E(F’,) (resp. E(F2))into segments of isomorphic words such that each segment is obtained from an isomorphic segment of E ( F ; ) (resp. E ( F ; ) ) by a permutation of terms. Since the words in each segment of isomorphic words in E ( F ; ) (resp. E ( F ; ) ) are in disjoint alphabets (this was taken care of in the we see that each segment of isomorphic words in E(F’,) definition of f’,), (resp. E ( F ; ) ) is an isomorphic image of some segment of E ( F ; ) (resp. E(F’,)). From this we can conclude that E(F’,) and E ( F ; ) are isomorphic because the assumption that the isomorphisms between the segments ofisomorphic words are not restrictions of a single isomorphism can be shown to lead to a contradiction. The isomorphism between E(F;)and E ( F ; ) now yields Lemma 5.4 by considering Lemma 5.2 and the fact that F l ( p , 4) and F2(p, 4) are strictly growing. 0 Theorem 5.5. Let F1 = ( E l ?h l , w l ) and F 2 he,form equivulent infinite PDOL jiwms. Then the seyurricr.s E( F I ) crnd E ( F 2 ) ure irltirnately isomorphic. Proof: By Lemma 5.4 the sequences .E(Fl(p,4)) and E(F2(p, 4)) are ultimately isomorphic for all 4 = 0,. . . , p - 1, provided p is fixed to be sufficiently large. Let the isomorphisms in question be c p i , i = 0, . . . ,p - 1. If they are restrictions of a single isomorphism, we are through. Otherwise, we derive a contradiction by considering a different decomposition as follows. Assume that the isomorphisms are not coherently defined, i.e., there are numbers t and u, t # u, and a letter h such that
z cpu(h),
(5.2)
and, furthermore, that h appears in infinitely many words h y p + f ( m l ) , h ~ p + ‘ ( o J l ) ,. . .
as well as in infinitely many words h{lPtU((oI), hpP+U(o)l)r . . . .
We choose now a sufficiently large number p1 = j k p
+ u - i,p - t
111
182
SINGLE ITERATED HOMOMORPHISMS
and conclude that the sequences E(Fl(pl, q)) and E(F2(plrq)) are ultimately isomorphic for q = 0, . . . ,p1 - 1 by Lemma 5.4. Finally, by choosing q in such a way that i,p
+t =q
we end up in a contradiction with (5.2).
(mod pl)
17
We now turn to a discussion of techniques for strengthening Theorem 5.5. Our next two lemmas serve this purpose. Lemma 5.6 provides a method for going from ultimate isomorphism to (full) isomorphism. It is also applicable for finite forms. (Remember that Theorem 5.5 was established only for infinite PDOL forms.) Lemma 5.7 analyzes further the mutual structure of the two homomorphisms of two form equivalent P W L forms. It turns out that, after some “initial mess,” which now cannot be removed, the two homomorphisms become identical. Thus, there may be some “bad” letters appearing in the initial part of the sequences; but, for all letters appearing later on, the two homomorphisms are identical. Lemma 5.6. conditions :
Assume that F1 and F 2 are PDOL forms satisfying each of the
(i) L ( F l ) = L(F,), and this language contains words of at least two dijirent lengths. (ii) E ( F l ) and E ( F 2 ) are not isomorphic. (iii) The sequences obtained from E ( F l ) and E ( F 2 )by removing all words of the shortest length are isomorphic. Then F1 and F 2 are not form equivalent.
We give an outline of the proof of Lemma 5.6; all missing technical details can be found in [CMORS]. We divide E ( F , ) and E ( F 2 ) into segments in such a way that each segment consists of all words of a particular length. Thus, the segment of the shortest words comes first, then the segment of the words of the next length, etc. Because L(F,) = L(F2), each segment of E(Fl) is a permutation of the corresponding segment of E(F,). If F1 and F 2 are finite, the last segments contain repetitions. If at least one of them is strictly growing, then each segment consists of only one word. In what follows we speak of the “first segment” (of either E ( F l ) or E(F2)) and of the “remaining segments.” We know that the sequences formed by the remaining segments of E(Fl) and E(F2) are isomorphic, but the whole sequences E ( F l ) and E(F2) are not isomorphic. The isomorphism breaks down in the first segments for one of two possible reasons : (1) A letter b not occurring in the remaining segments occurs in two positions in the first segment of E(Fl), and the letters in the corresponding two positions in E(F2) are different.
5
183
DOL FORMS
(2) There is an occurrence ofa letter b in the first segment of E ( F , ) and also in the remaining segments of E(F,). However, the letters occurring in the corresponding positions of E ( F 2 ) are different. Note that by the assumption L ( F , ) = L ( F 2 ) the first segments in both E ( F , ) and E ( F 2 )are also of the same length and consist of words of the same length. Thus, we may speak of “corresponding positions.” We can show that alternative ( 1 ) actually never occurs by considering the columns of letters obtained from the words in the first segment and taking into account that the descendents of b in each column obtained from E ( F , ) must coincide because we are dealing with a PDOL system. As regards alternative (2), we can show that it leads to the conclusion 9(F1)# Y ( F 2 ) , as desired. This is done by renaming the letters of F 2 appearing in the remaining segments in such a way that E ( F , ) and E ( F 2 ) become identical, apart from the first segments. (After this renaming we may no longer assume that L ( F , ) = L(F2).)Consider now the situation occurring on the borderline between two segments shown in Figure 1. Here a and b are F,
F2
b
a
letters in the corresponding positions, possibly a = b. After the borderline, E ( F , ) = E ( F 2 ) . An occurrence of the letter c in the next word is generated by b according to F 2 but not by a according to F,. Furthermore, it is assumed that a (resp. b) occurs also later on in E ( F , ) (resp. E(F2)).This situation leads to the conclusion .Y(F1)# 6p(F2). In fact, we construct an interpretation F; of F , such that all letters in the column determined by c have a special marker, whereas this marker occurs nowhere else in E(F‘,). Then L ( F ; ) # 9 ( F 2 ) because the (interpretation of the) second occurrence of b would have to generate marked letters in a wrong position. It can also be shown that alternative (2) leads to the situation we have been considering and, hence, Lemma 5.6 follows. 0 Before stating the next lemma we need some definitions. Consider two PDOL forms F
=
(C, h, o)
and
F’ = (C, h’, o)
184
111
SINGLE ITERATED HOMOMORPHISMS
such that E ( F ) = E(F’). We divide the letters of C into “good” and “bad” as follows. Consider an arbitrary word (ui in the sequence E ( F ) = E(F‘). We know that h ( q ) = h’(tui).Decompose mi into subwords
(5.3)
0; = XlXz “ ‘ X k ,
lXjl
2 1 for 1 I j 5 k ,
such that h and h’ are equal on each xi,whereas they are not equal on any proper prefix of x j . A letter b is bad (with respect to the pair ( F , F ’ ) ) if it occurs in some cui in some xj with l x j l 2 2. Otherwise (i.e., if there is no word (rIi in the sequence such that b occurs in some xi as in (5.3) with [ x i [ 2 2), h is good. Thus, the condition h(b) # h’(b)immediately implies that b is bad. However, b can be bad although h(b) = h’(b)if there is a proper shift in the balance. This happens, for instance, if mi = abc and h and h’ are defined by
- -
h: h’:
a-d’, a d,
b-d, c+d, d-d’. b d, c + d2, d + d 2 .
Briefly, one can say that b is good if and only if, whenever it occurs in the sequence E ( F ) = E(F’), it generates the same subword (including position) of the next word according to both F and F‘. Lemma5.7. Assume that F and F’ are PDOLjorms with E ( F ) = E(F‘). 11‘ some bad letter occurs twice in the sequence E ( F ) , then F and F‘ are not,form equivalent. Proof: As before, we speak of segments of E(F). We consider an occurrence ofa bad letter b in E(F). Assume that it occurs in the word mi. By thedefinition of a bad letter, the next word m i + in the sequence E ( F ) must be longer than mi.Thus, wi is the last word of some segment S1 and wi+ is the first word of the next segment S 2 . Assume that b occurs in w iin the subword x (according to the definition ofa bad letter). Without loss ofgenerality we assume that h is not the first letter of x. (The case of b being the first letter is treated symmetrically, by reading words from right to left.) Thus, we have
utb, * . * b k b k +. ,. * b k + , U 2 , b = b k + l , k 2 1, 1 2 1, M u , ) = h’(u1), = h’(u2), Wi
= U1XU2 =
and one of the words
h(b1 . . . bk)
and
h’(b1 . . . bk),
say the second, is a proper initial subword of the other. Assume now that b occurs also somewhere else in E(F), say, in the word ( u j . (Note that this second occurrence need not be one “exhibiting badness”; the
5
185
DOL FORMS
second occurrence may generate exactly the same subword in the next word according to both systems. Thiscan happen only ifh(b) = h'(b).)Then weclaim that F and F' are not form equivalent. The proof of this claim is slightly different in the casesj > i , j = i, and j < i. We give the proof in the first case. The proof in the other two cases is left to the reader. (It can be also found in [C MORS].) Thus, assume that b occurs in w j withj > i. Assume first that b does not occur in the subword of m i + generated by (the occurrence we are considering of) b , . . . hk in coi according to F . Then we consider the following interpretation F , ofF. After the word mi+ the sequence E(F,)coincides with E(F). The (i + 1)th word, say c l i + 1, is obtained from the (i + 1)th word in E ( F ) by providing the subword h(b, . . . b k ) with bars. The ith word mi in E(Fl) is obtained from m i by providing bl . . . b, with primes. The words in E ( F l ) preceding aihave their alphabets disjoint from the alphabets of the remaining words in E ( F , ) . Thus, the two occurrences of b we are considering remain unaltered also in E ( F , ) . Now the assumption of the existence of an F', satisfying F;
-a
F'
and
L(F',) = L(F,)
leads to a contradiction as follows. The word ai(resp. c l i + 1 ) occurs in E ( F ; ) in the segment corresponding to S1 (resp. S,). This implies that the letter b generates according to F; (possibly in several steps) a word with some barred letters. Considering the second occurrence of b, we infer that L(F',) contains two words with barred letters, which is not possible. (A slight modification is needed for this argument in case S , is the last segment.) Assume, secondly, that b occurs in the subword h(bl . . . bk)of mi+ We may then assume also that this occurrence of b is not generated by the occurrence of hk+ = h according to F'. (Otherwise, h occurs also later on, and so we are back in the case already treated.) We now proceed as before, except that in ai+ we let the occurrence of b stand as it is and provide only the other letters of h(bl . . . h k ) with bars. In the same way as above, we infer that F and F' cannot be form equivalent. 0
,.
,
We need one further lemma to take care of the case of finite forms. We want to emphasize that the problem of deciding the form equivalence of two finite
forms Fl and F , is far from being trivial because the language families 9 ( F , ) and 9 ( F 2 ) are infinite. In fact, even for very simple finite forms F it is sometimes very difficult to decide whether a particular language is in Y ( F ) . To see this the reader might try to characterize the family 9 ( F ) for the form F with the axiom ub and productions
a+b,
b+c,
c+a.
186
111 SINGLE ITERATED HOMOMORPHISMS
Lemma 5.8. Assume that F, and F 2 are two .form equivalent PDOL forms such that every word in the languages L ( F , ) and L ( F 2 )is ojlength k,jor some k 2 2. Then the sequences E(F,) and E(F2) are isomorphic. We again only outline the proof of Lemma 5.8. It is easy to see that the case k > 2 can be reduced to the case k = 2. In fact, if k > 2 we can establish the isomorphism of E(F,) and E(F,) from the isomorphism of the sequences of each pair of “subsystems” obtained from F , and F2 by considering only two columns of letters. The proof for the case k = 2 is more involved. It is carried out by a case analysis concerning the positions of letters common for the two columns. 0 We are now in the position to establish the main results of this section.
Theorem 5.9. Assume that F , and F 2 are form equivalent PDOL.forms and that some word in the language L(F,) v L(F2) is oj’length greuter than one. Then the sequences E ( F , ) and E(F2) are isomorphic. Proof. Observe first that if F,(k)and F2(k),k 2 1, are forms obtained from F, and F, by removing the first k segments in the sequences, then also F,(k) and F,(k) are form equivalent. From this observation, Theorem 5.5, and Lemma 5.8 our theorem now follows by a downward induction based on Lemma 5.6. 0 The notions of good and bad letters can in an obvious way be extended to concern the case where the two PDOL sequences are isomorphic instead of being equal. This modification is needed for the following result.
Theorem5.10. Assume that F1 and F2 are as in the previous theorem and that the cardinality of their alphabet equals n. Then, with the exception of the n - 2Jirst words, the sequences E(F,) and E(F2)contain only words with good letters. Each of the bad letters occurs only once in each sequence. Proof: We use Lemma 5.7. The bound n - 2 is obtained by noticing that there must be at least one good letter and that the last word containing bad letters must contain at least two of them. 0 The bound n - 2 is the best possible in the general case; cf. Exercise 5.4. The next theorem shows that our conditions necessary for form equivalence are also sufficient, even for sequence equivalence.
Theorem5.11. Assume that F 1 and F 2are PDOL forms such that E ( F , ) = E(F2)and each bad letter occurs in the sequence E ( F l ) only once. Then F , and F2 are sequence equivalent.
187
EXERCISES
Proof: Given an interpretation F‘, of F , , an interpretation F’, of F , with the property E(F;) = E ( F ; )
can easily be constructed inductively, “level by level.” The situation being symmetric, the theorem follows. 0 Theorem 5.12. All of she following conditions (i)-(iii) are equivalent for two PDOL forms F , and F , , differentfrom the exceptional forms Fl(n, k ) and F,(n, 1) given in Exumple 5.1 :
(i) (ii) occurs (iii)
F , und F 2 arejbrm equivalent. The sequences E ( F , ) and E ( F , ) are isomorphic, and each bud letter only once. F , und F , are sequence equiualenf.
ProoJ: (i) implies (ii) by Theorems 5.9 and 5.10. (ii) implies (iii) by Theorem 5.1 1. That (iii) implies (i) is obvious from the definitions. 0
Our last theorem is an immediate consequence of Theorem 5.12 and the fact that the decision method is obvious if we are dealing with the exceptional forms. Notealso that the algorithm resultingfrom condition (ii) is very simple: if suffices to consider the n - 1 first words in the sequences, where 11 is the cardinality of the alphabet. Both theform equivalence and the sequence equivalence are Theorem 5.13. decidable ,for PDOL forms. Exercises 5.1. Compare the definitions of a DOL form and an EOL form. Restate the definition of a DOL form in terms of a dfl substitution. 5.2. Complete the proof of Lemma 5.7 in the cases j = i and j c i. 5.3. Carry out the proof of Lemma 5.8 for k letters appearing in the two columns are disjoint.
=
2, provided the sets of
5.4. Prove that the bound n - 2 given in Theorem 5.10 is the best possible.
5.5. List all pairs of nonidentical, form equivalent PDOL forms over an alphabet with cardinality 14. 5.6. Consider the possible extension of Theorem 5.12 to DOL systems. Give examples of exceptional cases other than the exceptional case for PDOL forms.
IV Several Homomorphisms Iterated
1. BASICS ABOUT DTOL AND EDTOL SYSTEMS
One way to generalize DOL systems is to consider OL systems, that is, to consider iterationsofa finitesubstitution rather than iterations ofa homomorphism. Another very natural generalization of a DOL system is a system that consists of a finite number of homomorphisms. Then the transformations defined by such a system are all homomorphisms in the semigroup of homomorphisms generated by (compositions of) a finite number of initially given homomorphisms. Such systems are called DTOL systems and are formally defined now. Definition. A DTOL system is a triple G = (X,H , w ) where H is a finite nonempty set of homomorphisms (called tables) and, for every h E H, (Z, h, (0)is a DOL system (called a component sysrem gfG). The language ofG, denoted L(G), is defined by
L(G) = {x E C*Ix = w or x
=
hi
+
hk(w)where h i , . . . , h, E H } .
All notation and terminology of DOL systems, appropriately modified if necessary, are carried over to DTOL systems. We consider a DOL system to be a special case of a DTOL system (where # H = 1). lux
1
BASICS ABOUT DTOL AND EDTOL SYSTEMS
189
I./. For the DTOL system G = (C, H , w ) with Z = {a, b, c, d } , and H = { h , , h,} where h , is defined by h,(a) = c3, h,(b) = b, hl(c) = c, h , ( d ) = d and h2 is defined by h2(u) = d4, h,(b) = b, h2(c)= c, h2(d) = d, we have Exunipkt
w = babuh
L(G) = {babab, bc3bc3b,bd4bd4b}. It is interesting to notice that L ( G ) above is a finite language that is neither a DOL nor a OL language. On the other hand, we can almhave finite OL languages that are not DTOL languages as illustrated by the following example. Exurtip/c 1.2. K = { a 2 ,b4, b5, b6} is not a DTOL language. To see this if suffices to notice that in any DTOL system G = (C,H , w ) such that L(G) = K it must be that w = a'. Then however for every x in L(G) it must be that 1x1 is even, which contradicts the fact that K = L(G).
For the DTOL system G = (X,H , w ) with Z = {a, b } , ub, and H = { h , , h , } , where h l is defined by h,(a) = a', h , ( b ) = b, and h2 is defined by h2(a)= a, h,(b) = b2, we have L(G) = {a2"bz"'Im, n 2 0). E.::ranip/c1.3.
(1) =
As in the cases ofOL and DOL systems the following result underlies most of the considerations concerning DTOL systems and will be used very often even if not explicitly quoted. Its easy proof is left to the reader.
Lemma 1.1.
Let G
=
(X,H , (0) be a D7'OL system.
(1) For any nonnegative integer n und for any words x l , x 2 , and z in C*. if
x , x z % 2 , then there exist words z1 and 2 , in C* such that z = z1z2, x 1 &. z1 and x 2 2. z 2 . ( 2 ) For any nonnegative integers n and m undfor any words x, y , and z in C* ij x
G y und J 2 i,then x
n+m
z.
Informally speaking, a derivation in a DTOL system G is a sequence ofsingle derivation steps each of which consists of a choice of a table and then rewriting a current word according to this table. Since each table is a homomorphism, the choice of a table uniquely determines the next word. Formally, the derivation in a DTOL system can be defined along the lines of the definition ofa derivation in a OL system. This will be done in Chapter V. However, for the purpose of this chapter it is more convenient to define the notion of a derivation as follows.
Iv
190
SEVERAL HOMOMORPHISMS ITERATED
Definition. Let G = (C,H, o)be a DTOL system. A derivation D in G is a sequence D = ( ( x o , ho), ( x l , hl), . . . , ( x k - 1 , h k - l ) , x k ) where k 2 1, x o , . . . , x k - 1 E C+, x k E x*,ho, . . . , h k - 1 E H , and x i + 1 = h i ( X i ) for i E (0, . . . , k - 1). D is said to be a derivation of x k from x o , and k is called the height (or the length) of D. The word xk is called the result of D and is denoted by res D. In particular if x o = o,then D is referred to as a derivation of x k in G . The word = h , . . . hk- is called the control word of D (denoted by cont D) and the sequence x o , . . ., x k is called the trace of D (denoted trace D). We also write X O A x k or x k = ~ ( X O ) .
Given an occurrence of a letter in a word x i from trace D one can uniquely determine its “contribution” to res D; such a contribution is a subword of res D. Clearly, all occurrences of the same letter a in xi contribute equal subwords to res D,which we will denote by ctrD,x,a (or simply ctr, a whenever x i is understood). It is very often convenient to consider “subderivations” of a given derivation D; thisisdoneasfollows. Let D = ( ( x o ,ho), ( x l , hl), . . . ,( x k - h k - 1), x k ) . Then a subderivation of D is a sequence -
D
= ((xi09
giJ7
(Xi13
gill,
* * *
9
(xiq- gi,- 11, 19
xi,)
where q 2 1, 0 Iio < i l < < i, I k, and, for each j~ (0,. . ., q - l}, g . = h.I, h. Although a subderivation of a derivation in G does * . hi,+I not have to be a derivation in G, we shall use for subderivations the same terminology as for derivations; this should not however lead to confusion. Clearly, to determine a subderivation B of a given derivation D it suffices to indicate which words from trace D form the trace of D.In this way we shall also talk about subderivations of subderivations (which are also subderivations of the original derivation). Example 1.4. Then
D
=
Let G = (C, H,o)be the DTOL system from Example 1.3.
((ab, hi), (a2b,hi), (a4b,h2)r (a4b2,h2), (a4b4,hi), a8b4)
is a derivation of a8b4 in G of length 5, cont D = h:h:hl and trace D = ab, a2b,a4b, a4b2,a4b4,a8b4.
D
=
((ab, h:), (a4b,h;), (a4b4,hl), a8b4)
is a subderivation of D and = ((ab, hfh:), (a4b4,hl), a8b4)is a subderivation of D and hence a subderivation of D.
1
BASICS ABOUT DTOL AND EDTOL SYSTEMS
b
a a
I I
b
a
A /\ I I I I
a
a
a
a
a
a
a
a
b
b
I\ b I bI bI bI b
I aI aI aI /I /I /I /I a a a a a a a a
I\ b
b
a
b
FIWREI
In much the same way as in the case of OL systems we represent D by the derivation graph (where the tables used are also indicated) shown in Figure 1. Now we can augment Lemma 1.1 by the following statement.
Lemma 1.2.
Let G
=
(C,H , w ) be a DTOL system and Jet z E H*. For any
words xlr x2,y , , y2 in C*, f x l
yl, x2 A. y2, then ~ 1 x 2
~
1
~
2
.
Again, as in the case of OL systems, a very natural (and “traditional”) generalization of a DTOL system is adding to it the facility of nonterminal symbols, or in more algebraic terms adding to it the facility of intersection with A* for some finite alphabet A. Formally, such a system is defined as follows. Definition. An EDTOL system is a 4-tuple G = (Z, H,w, A) where U ( G ) = (X,H , o)is a DTOL system (called the underlying system of G ) and A E Z (A is called the terminal or target alphabet of G). The language of G, denoted L(G), is defined by L(G) = L(U(G))n A*.
We carry over to EDTOL systems all the notation and terminology of DTOL systems. Exxrrttipli~1.5. For the EDTOL system G = (C,H , w, A) with C = {S, A, B,$,u, b } , A = {#,a, b}, w = SSS, and H = { h , , h 2 } where h , is defined by h , ( S ) = A, h , ( A ) = Sa, h,(B) = #, h,(a) = a, h,(b) = b, hl(#) = # and h2 is defined by h2(S) = B, h2(A) = #, h2(B) = Sb, h2(a) = a, h2(b) = b, h2(#) = 6, we have L(G) = {$w#w#w I w E {a, b}*}.
Iv
192
SEVERAL HOMOMORPHISMS ITERATED
Exercises 1.1. Show that the language from Example 1.5 is a DTOL language; however, it cannot be generated by a DTOL system with only two tables.
1.2. Show that the language from Example 1.5 is not an EOL language. 1.3. Let Y(DTOL,) denote the class of all DTOL languages that can be generated by DTOL systems with no more than 17 tables. Show that, for every n 2 0, Y(DTOL,) 5 Y(DTOL,+ 1.4. Given an n-tuple of words w = ( w l , . . . , wn),let f w be the mapping from n-tuples of nonnegative integers into w: . w: . . . w,* defined byf,(il, . . . , in) = w ; ‘ . . . wk. The mapping fw is called an f-mapping. Prove that the range of an f-mapping of a semilinear set is an EDTOL language. (Cf. [BC].) 1.5. An Indian parallel grammar is a context-free grammar in which a single derivation step consists of rewriting all occurrences of one nonterminal in a string by the same production. Prove that the class of languages generated by Indian parallel grammars, denoted as Y(IP), is included in Y(EDT0L). Compare Y(1P) and Y(E0L). (Cf. [Sl].) 1.6. Prove that Y(EDT0L) the proof of Theorem 11.2.1.)
=
Y(EPDT0L). (You may wish to consult
2. THE STRUCTURE OF DERIVATIONS IN EPDTOL SYSTEMS
In this section we shall study the structure of derivations in EPDTOL systems. We study EPDTOL systems rather than EDTOL systems in general for two reasons: (1) EPDTOL systems generate all EDTOL languages (see Exercise 1.6); (2) the structure of derivations in EPDTOL systems is already complicated enough; and although in our framework (with minor modifications) we can also take care of erasing productions, the technical details in this case can obscure the picture. The study of the structure of derivations in EPDTOL systems is interesting on its own since perhaps this is the “ultimate” way to understand EPDTOL systems (rather than EPDTOL languages). However, it is also very crucial in our study of EDTOL languages, as will be demonstrated in the next section. Before we start our study we need several notions useful for describing derivations in EPDTOL systems. Definition. Let G = (X,H,w, A) be an EPDTOL system and let f be a function from positive reals into positive reals. Let D be a derivation in G of a
2
DERIVATIONS IN EPDTOL SYSTEMS
193
word of length n and let 6 = ( ( x o , ho), ( x l , hl), . . . , (xk- h k - I ) , xk) be a subderivation of D. Let a be an occurrence (of A from C) in x, for some t E { O , . . . , k - 1). (1) a is called ( j ; 0)-big (in x,) if Ictr, a / > .f(n>; (2) a is called (,f, D)-small (in x,) if (ctr, a1 5 f(n); (3) u is called unique (in x , ) if a is the only occurrence of A in x,; (4)a is called mulriple (in x,) if a is not unique (in x,); (5) a is called D-recursive (in x,) if A E ulph h,(A); ( 6 ) a is called 6-nonrecursiur (in x , ) if (I is not h e c u r s i v e (in x,).
Note that in an EDTOL system each occurrence of the same letter in a word is rewritten in the same way during a derivation process. Hence we can talk about (,f,0)-big (in x,), (f,D)-small (in x,), unique (in x,), multiple (in x,), 6-recursive (in x,), and 6-nonrecursive (in x,) letters. Also whenever f or D or b is fixed in a given consideration, we shall simplify our terminology in the obvious way; for example, we can talk about big letters (in x,) or about recursive letters (in x t ) . Given a derivation in an EPDTOL system, all occurrences of the sameletter on a given level are rewritten in the same way. However, the behavior of the same letter on different levels can be very different; this is due to possible use of different tables on different levels of the derivation. For example, the same letter can be big on one level and small on another level of the derivation. For this reason it is difficult to analyze an arbitrary derivation, and so we try to determine a subderivation such that the behavior of a letter does not depend on the level on which it occurs. We call such subderivations neat. Definition. Let G = (C, H , o,A) be an EPDTOL system and let f be a function from positive reals into positive reals. Let D be a derivation in G and let = ((.K~, ho), . . . ,(xk- I , hk- xk) be a subderivation of D . We say that 6 is neat (wirh respect to 0 and f ) if the following hold: ( 1 ) alph xg = alph x ] = ' ' ' = alph xk- 1. (2) For i , j E (0, , . . , k - l}, if a E alph x i = alph x j , then a is big (small, unique, multiple, recursive, nonrecursive, respectively) in x i if and only if a is big (small, unique, multiple, recursive, nonrecursive, respectively) in x j . (3) For every j in {0, . . . , k - l}, alph x j contains a big recursive letter. (4) For everyj in (0, . . . , k - 1) and every a in alph x j , ifa is big, then a is
unique. ( 5 ) For every j in {O, . . . ,k - I } ,
(5.1) h j a ) = a for some big letter a and a containing small letters, and (5.2) if b is a small recursive letter, then hj(b) = b ; and if b is a nonrecursive letter, then hj(b) consists of small recursive letters only.
194
Iv
SEVERAL HOMOMORPHISMS ITERATED
-1
F I G ~ J2 R ~
(6) For every i,j in (0, . . . , k - l } and every a small in alph x i = alplr x j , IctrD,xia1 = IctrD,xjal. (7) For every i, j in (0, . . . , k - I } and every big recursive letter Q in alph x i = alph x j , alph hi(a) and alph hj(a) have the same set of big letters (and in fact none of them except a is recursive).
There is a particular way of looking at derivation graphs in an EPDTOL system, a way that turns out to be very convenient for analyzingderivations in EPDTOL systems. We simply consider a derivation graph as an arrangement of trees within a matrix. For instance, the derivation graph from Example 1.4 is packed into a 6 x 12 matrix as in Figure 2. This leads us to the notion of a matrix of trees as follows. Definition.
(1) An n x k matrix oftrees (abbreviated as an n x k t-matrix) is a directed graph whose nodes form an n x k matrix that satisfies two conditions: (i) each node in the graph has at most one ancestor; (ii) if there is an edge leading from node (i,j) to node I E { ~ ..., , n } , j , j ~ { l ,..., k } , t h e n i = i + 1.
(i,j),for some
i,
2
195
DERIVATIONS IN EPDTOL SYSTEMS
(2) Let G, be an n x k t-matrix and let G2 be an rn x k t-matrix for some m I n. We say that G 2 is a sub-r-matrix of G I if the m x k matrix of nodes of G2 is obtained by omitting some (maybe none) rows from the matrix ofnodes of G I and there is an edge between two nodes in G 2 if and only if this edge is in the transitive closure of G I . E.rutiip/L) 2.1. The graph in Figure 3 is a 5 x 4 t-matrix, and by omitting its second and fifth row we get the sub-t-matrix in Figure 4. Clearly, if G , is a sub-r-matrix ofa r-matrix G and G2 is a sub-r-matrix of G I then G2 is a sub-t-matrix of G. The following subfamily of the family of r-matrices will play a special role in our investigation of the structure of derivations in EPDTOL systems.
FIGURE 4
Definition. An n x k t-matrix G is said to be wellformed if it satisfies the following two conditions:
+
1,j) is one of them. (1) If a node (i, j) has descendants, then ( i ( 2 ) If there is an edge leading from (i, j) to (i 1, I), then, for every p in { 1, . . . , n - 1}, there is an edge leading from ( p ,j) to ( p 1, I).
+
+
Our main result concerning r-matrices says that each t-matrix has a “relatively large” well-formed sub-t-matrix.
1%
Iv
SEVERAL HOMOMORPHISMS ITERATED
Theorem 2.1. For every positive integer k, there exist positive reds rk and that for every positive integer n and for every n x k t-matrix G, there exists a well-formed m x k t-matrix H that is a sub-t-matrix of G and for which m 2 rknsk.
sk such
Proof: Let a be a column of G . (1) We say that a is of type 1 if from each node of a (except for the last one) there is an edge leading to the next node in a. (2) We say that a is of type 2 if no node in a has a descendant and either no node in a has an ancestor or every node except for the first one has an ancestor and all of those ancestors belong to the same column of type 1. (3) We say that a is arranged if it is either of type 1 or of type 2. (Clearly an arranged column of G stays arranged in all sub-/-matrices of G.)
Claim. Let G have I arranged columns for some 0 I 1 I k - 1. There exists a sub-t-matrix G1of G such that G, has at least 1 1 arranged columns and G, is of order n , x k for some nl 2 ,,&/6k.
+
Proofofthe claim. Let 9,be the collection of all paths in G the nodes of which do not belong to any of the arranged columns in G. Let y be a path in 9, such that no other path in 8,is longer than y.
&.
(i) Assume that the length of y is larger than or equal to Then let C, be the set of all columns that have at least one node that belongs to y . Let c be a column from C, such that no other column in C, has more nodes in y than c has. Clearly c has at least &/k nodes in y. Let us choose G I to be the sub-tmatrix of G consisting of all the rows of G having a node of y in c. Clearly, c becomes acolumn oftype 1in G1,and so G has at least 1 1arranged columns. Since &/k > &/6k, the claim holds in this case. Then let us choose all (ii) Assume that the length of y is smaller than the rows numbered 1, r&l, 2r&1,. . . and obtain in this way a sub-tmatrix G,. Let a be an arbitrary nonarranged column in G , and let x be a node in tl. Since we were taking steps of length rJ.1, x has no descendants in a nonarranged column and obviously x cannot have descendants in a column of type 1 or in a column of type 2. Thus x has no descendants. Clearly, if x has an ancestor, then it must be a node from columns of type 1. So let us divide nodes from tl into the following classes (which are disjoint): class,,,,(a)consists of all nodes in a that do not have ancestors; and for every type 1column /? in G classs(a) consists of all nodes in tl that have ancestors in /?. Now let A be a class of this partition containing no fewer elements than any other class. Then by choosing all rows from G I in which elements of A occur we get a sub-t-matrix G2of G1. Note that in this way we have added at least
+
&.
2
197
DERIVATIONS IN EPDTOL SYSTEMS
one column of type 2 to the number of columns of type 2 in G I .Let us now estimate the number of rows in G,. Since 1 I k - 1 and the number of classes in the above partition does not exceed I + 1, it does not exceed k. But G I has at least Ln/T&lJ rows. and so G, has at least l/k)Ln/r&1J rows. Thus to conclude the proof of the claim it suffices to show that
r(
r(
Since l/k)Ln/[&1J1 2 (l/k)L,I/[&l Jn/6, and this is done as follows. ( 1 ) If n 5 6 , then &/6 Ln/T,hlJ 2 &/6.
< 1. Since Ln/r&lJ
(2) Thus let n > 6. Since n/r&1 Ln/r&iJ
But for n > 6,
2
J, it suffices to show that
2 n/(&
~ -f i~i = ~
& - 2 2 &/6,
f
Ln/r&l
J 2
2 1 we get indeed that
+ 1) 2 Jn - 1, i j 1 2 f i - 2.
and so the claim holds.
w
Now we iterate the claim until we obtain a sub-t-matrix all columns of which are arranged. Since the number of iterations is bounded by k, the claim implies that H is of order rn x k for some rn 2 n1’2k/(6k)Z-(1r2k). Thus it suffices to choose rk = 1/(6k)2-‘1/2k’and s k = 1/2k,and the theorem holds. 0 The following two concepts are very crucial in our analysis of derivations in EPDTOL systems. De$nirion. Let C be a finite alphabet and let f be a function from positive reals to positive reals. Let w E E*.We say that w is anf-random word (over C) if every two disjoint subwords of w that are longer than f (1 w l ) are different.
De$nirion. Let j’ be a function from positive reals to positive reals. We say that j ’ is sloiv if, for every positive real a, there exists a positive real n, such that, for every positive real x greater than n,, f ( x ) < xu.
In the rest of this section we shall often use phrases like “(sufficiently) long word .‘Y with property P” or a “(sufficiently) long (sub)derivation with property P.” These will have the following meanings. (1) For a constant C, we say that a word x is C-long if I x I > C . In a case such that x is C-long and x satisfies property P, where C is a constant, the
198
Iv
SEVERAL HOMOMORPHISMS ITERATED
estimation of which is clear from the context, we say that x is a “(sufficiently) long word with the property P.” (2) For constants C,F, we say that a (sub)derivation D of a word x is (C, F)-long if the length of D is at least F I x. ‘1 In a case such that D satisfies P and D is ( C , F)-long where C,Fare constants, the estimation of which is clear from the context, we say that D is a “(sufficiently) long sub(derivation) with property P.” The following lemma is very useful in constructing long subderivations of long derivations. Lemma 2.2.
Let G be an EPDTOL system and let f be a slowfunction. Let
B be a suficiently long subderivation of a derivation D of u su&ciently long word x in G. Let us divide words in IJ into classes in such a way that the number of classes is not larger than f (I x I). Then there exists a long subderivation of D consisting of all the words that belong to one class of the above division. Proof: Since B is a sufficiently long subderivation, it is longer than I x ‘1 for some constant C independent of D and x. Thus in the division into classes there must be a class (2 say) consisting of at least I x I“/ f ( I x I) elements. But
for every u. For a sufficiently long x , we have
Thus if we choose a subderivation in such a way that it consists of all words in 2, then it is a long subderivation. Hence the lemma holds. 0 We are ready now to state and prove our result on the structure of derivations in EPDTOL systems. Theorem 2.3. For every EPDTOL system G and every slow function f, there exist a positive real r and a positive integer s such that,for every w in L(G), if I w I > s and w is f-random, then every derivation of w in G contains a neat subderivation longer than I w Ir. ProoJ Let G = (C,H , o,A) be an EPDTOL system and let f be a slow function. Let # C = mo and let m , = max{ (a1( u = h(a) for a E C and h E H } . Our proof will have a form of a construction that takes several steps. First, the reader should notice that if D is an arbitrary derivation of an frandom word, then in each word of the trace of D each big letter has a unique occurrence.
2
199
DERIVATIONS IN EPDTOL SYSTEMS
Step 1. Let x be a sufficiently long 1-random word in L(G) and let D be a derivation of x in G. If w contains only small letters, then 1 0 ) f ( 1x1) 2 I x 1, hencef( 1x1) 2 ( l / l a ~ l ) l x l Since . wetookxsufficientlylarge, thiscontradicts the fact that f is a slow function. Thus o must contain at least one big letter. Now we choose a subderivation Dl
= ((x1.03 hl,O),(xl.l~h l . l ~ ~ ~ ~ ~ ~ ~ ~ l . k ~ - l ~ ~ l . ~ ~ - l ~
in the following fashion: (1) let xl,o = (11; (2) for a given x , i , we choose xl, + to be the nearest word in trace D such that it contains an occurrence of a big letter and it contains some occurrences of small letters contributed from an occurrence of a big letter in x ~ . ~ ; ( 3 ) we continue to choose next elements as long as possible.
,
That D , is sufficiently long is shown as follows. Let, for i E { 1,. . . , kl}, Mi denote the total number of occurrences contributed to x in D from all those small occurrences in .Y that are contributed from big occurrences in xl, - l. Let M o denote the total number of occurrences contributed to x in D from all small occurrences in o.Let R,, denote the total number of occurrences contributed to x in D from all big occurrences in xl,kl. Obviously
a,,I moml.f(lxl),
M o < lwlf(lxl),
and for every i~ {I, ..., k l } , kfiI momlJ(IxI). CfL 1 M i , 1x1 < f(Ixl>(mom1
Since 1x1 = R k ,
+ Mo +
+ I w I + momlkl)
and so
’( l x l / f ( l x l ) ) morn1(mom1 + I w l ) -
kl
Since f is slow, for every positive real a, we can choose x long enough so that .f(1x1) < Ixl‘. Consequently, (because m, m,, and 101 are constants) for every positive real b, we can choose x so that k , > Jxl’-’’. Step 2. Let us consider the subderivation D1 obtained in step 1. Let us divide words in truce D1into classes in such a way that two words belong to the same class if and only if they contain the same set of letters. As the number of such classes is clearly bounded by a constant, we can apply Lemma 2.2 and obtain a sufficiently long subderivation D1 of D. Then let us divide words in truce D1 into classes in such way that two words belong to the same class if and only if they contain the same set of big letters. Again applying Lemma 2.2 we obtain a sufficiently long subderivation D12 of D.
200
Iv
SEVERAL HOMOMORPHISMS ITERATED
Then let us divide words in trace D12into classes in such a way that two words belong to the same class if and only if they contain the same set of unique letters. Applying Lemma 2.2, we get in this way a sufficiently long subderivation D z of D. Step 3. Let us consider the subderivation
obtained in step 2. Let M(D,) be a t-matrix constructed as follows: (1) Every column in M ( D z ) corresponds to exactly one big letter in D z (their order is fixed but arbitrary). (2) For every word in trace D 2 . we have exactly one row in M(D,), where for consecutive words in trace D 2 , we have consecutive rows in M(D,). (3) There is an edge leading from (i, j) to (i + 1, t ) in M(D,) if and only if the occurrence in x z , i corresponding to column j derives the occurrence in xz,i + corresponding to column t.
Now applying Theorem 2.1 we obtain a sufficiently long subderivation 0, of D that corresponds to a well-formed sub-r-matrix of M(D,). From the construction of D , it follows that (i) in each word of trace 0 , there is a big recursive letter; and (ii) a letter is big recursive (big nonrecursive) in a word of trace 0 , if and only if it is big recursive (big nonrecursive) in every word of trace D , . Step 4. Let us consider the subderivation 0 , obtained in step 3. Let us divide words in trace 0 , into classes in such a way that two words belong to the same class if and only if each small occurrence of the same letter in those words contributes the same number of occurrences to x in D. Clearly, the total number of different classes obtained in this way does not exceed m o f ( 1x1). Since f ( n ) is a slow function, so is mo f(n). Hence, applying Lemma 2.2, we get a sufficiently long subderivation D4 of D. Step 5. Let us consider the subderivation D4 = ((x4,o, h4, . . . ,( X 4 , k 4 h 4 , k 4 - 1 ) , X4,ks) obtained in step 4. Let us divide all small letters into classes in such a way that two small letters belong to the same class if and only if they contribute the same number of occurrences to x in D . Each such class can be identified by the number of occurrences contributed to D by an element of this class. Starting with the class corresponding to the largest of those numbers and then going on through all “smaller” classes perform (one by one) the following.
2
20 1
DERIVATIONS IN EPDTOL SYSTEMS
For the highest number following way.
(Imax, construct
a t-matrix M(D4, q,,,,,) in the
(1) Each column in M(D4, qmax)corresponds to exactly one small letter from the class corresponding to qmaxin D, (their order is fixed, but arbitrary). (2) For every word in trace D,, we have exactly one row in M(D4, q,,,,,), where, for consecutive words in trace D,, we have consecutive rows in M(D4?4max).
(3) There is an edge leading from ( i + 1,j ) to (i, t) if and only if the letter corresponding to the tth column in x4,i derives in 0, an occurrence of the letter corresponding to the jth column in x4, (4)Turn the resulting graph “upside down” to obtain a “normal” t-matrix. i+
Then applying Theorem 2.1 we obtain a sufficiently long subderivation of D. Then from this subderivation we obtain a sufficiently long subderivation by exactly the same method but using the next to the largest (q,,,,,) class. And we proceed in this way until we exhaust all classes. Let D, be the resulting sufficiently long subderivation. Then let D , be a subderivation resulting from D 5 by taking from trace D, (starting with its first word) each moth word. By Lemma 2.2 D , is sufficiently long. Since D, corresponds to consecutive well-formed sub-t-matrices, the following hold: (1) if b is a small letter in D, and it belongs to the class q, then in a direct derivation step (in D,)it either derives itself only (“b * b”) or it derives a letter that derives itself only or it derives a string of small letters each one from a class lower than q ; thus in particular, (2) each small letter b from the lowest class derives in a single derivation step in D, itself only ( “ b * b”). Now it follows from theconstruction that D , is indeed a neat subderivation. As a matter of fact, the conditions that a neat subderivation must satisfy were secured during our construction as follows: condition (1) was satisfied in D 2 ; condition (2) was satisfied in B,; condition (3) was satisfied in D,; condition (4) was secured in D ; condition (5.1) was satisfied in D ,; condition (5.2) was satisfied in 11,; condition ( 6 ) was satisfied in D,; and condition (7) was satisfied in D 3 . 0
Iv
202
SEVERAL HOMOMORPHISMS ITERATED
3. COMBINATORIAL PROPERTIES OF EDTOL LANGUAGES In this section we shall demonstrate how to use Theorem 2.3 to derive combinatorial properties of EDTOL languages. We start by proving the socalled “pumping theorem” for EDTOL languages. Traditionally, a pumping theorem for a class of languages 9 states that for every language K in 9 if x is a word in K long enough, then in a fixed number of places in x one can insert simultaneously fixed words (for each fixed place, one fixed word) or their nth powers (again in each fixed place the same nth power of the fixed word for this place) and remain in the language. A consequence of a pumping property in Y is that the length set of each infinite language in 9contains an infinite arithmetic progression. This certainly cannot be true for the class of EDTOL languages (already the DOL language {a2”ln 2 0) does not posses this property). This is where f-random words for a slow function f come into the picture. We shall demonstrate now that in an EDTOL language long enough f-random words, where f is a slow function, can be pumped. Remark. In the proof of our next result we analyze in great detail the control words of (sub)derivations in EPDTOL systems. Since words are written from left to right, it turns out that it is much more convenient to use a left-to-right functional notation (otherwise, the formalism becomes very complicated). That is, the composition of functions fi, . . . ,f k in this order (hence first fl, then f2, etc.) is written as f i f i . . . &, and the argument is written on the left side, which yields ( x ) f l f 2 . . . f k .
Theorem3.1. Let K be an EDTOL language over an alphabet C with # Z = t and let ,f be a slow function. There exists a positive integer constant p such that for everyf-random word x in K longer than p , there exist words x o , .. .,x Z f , y , , ...,yZt with y , . . . y z r # A and xo . . . x~~ = x such that x o y l x l y ; x 2
y;,x2, is in K f o r every positive integer n.
Proof: (1) First, we notice that the proof of Theorem 11.2.1 carries easily to EDTOL systems (see Exercise 1.6), meaning that, for every EDTOL language,thereexistsanEPDTOLsystemgeneratingit.Solet G = (C, H,o,A) be an EPDTOL system such that L(G) = K . (2) Theorem 2.3 implies that there exists a constant p such that if x is an f-random word in K longer than p , then every derivation of x in G contains a neat subderivation the trace of which contains at least three words.
Thus let x be an f-random word in K such that 1x1 > p (we assume that K contains infinitely many f-random words because otherwise the theorem
3
203
COMBINATORIAL PROPERTIES OF EDTOL LANGUAGES
trivially holds). Let D = ((zo, ho), (zl, hl), . . . , (z,- 1 , h,- z,) beaderivation of x in G and let D = ((zio, hie), . . . , (ziq- ,, hiq-, ) , ziq)be a neat subderivation o f D whereq 2 2 a n d O I io < i l < ... < i, Ir. For j in (0,. . . ,q - l}, we call a big recursive letter a in zij expansive if (a)hij= aap where UP # A. Note that by the definition of a neat subderivation (see points (3), (9,and (7) of the definition) zio contains an expansive letter. We can write zioas zio = u o b l u l . . . b k U k where b l , . . . , bk are big recursive letters and none of the words u o , u l , . . . , uk contains a big recursive letter. Since every big letter is unique, we have k E { 1, . . . , t } . Let hi, = g and let T = h i , h i , + l h i , + 2 ~ . . h , _Let, l . for i g (1,..., k } , ( b , ) g = aibiPi.Thus zil=
( ~ O ~ ~ a l b l ~ 1 ( ~ 1 ) ~ a 2 b 2 ~akbkPk(uk)g 2 ( ~ 2 ~ ~ ' "
and x = zr = ((uO)g)r(al b(b1>r(P1)T((u1)g)7
' * '
(ak)T(bk)T(Pk)r((uk)g)T.
However, for every positive integer n, we can change D in such a way that we apply g" to zil and then we apply T ; let x(,,) be the word obtained in this way. Since D is neat, x(,,) E L(G). In this way we get (Zi1)g = (uo)g2(al)galblB1(P1)g ' ' ' (ak)gakbkPk(Pk)g(uk)g2, (Zi1)g" = (uo)g"+ '(al)g"(aI)g"-' . . . ( a l ) g a , b l P , ' . ' akbkPk(Pk)g ' * (Pk)gn- '(fik)g"(uk)g"+
'-
Since D is neat, ( u o ) g , . . . , (uk)g, ( a l ) g , . . ., (a&, ( P I ) ~. ,. ., ( h ) g consist of small recursive letters only and moreover, for every m 2 1, (uo)grn= (u0)g. =
* * *
1
(uk)gm = (uk)g, (al)g" = ( @ l ) g ,
* *
9
(ak)gm
(ak)g,
(Pl>S" = (Pl>S,
..
.?
(Pkk"
= (Pk)g.
Consequently x(n) =
((uolg)r(((a1)g)t)"(a,)r(b,)~(PI)r(((Pl)g)7)"((ul)g)~ ' ' *
(((ak)g)r)"(ak)7(bk)7(Pk)T(((Pk)g)z)"((uk)g)T.
Since one of the big letters b , , . . . ,bk is expansive, one of the words ( ( a l ) g ) r , ((P1)g)7,. . . , ((olk)g)z, . . . , ((Pk)g)7 is nonempty, and so the theorem holds.
0 To put Theorem 3.1 in a proper perspective we shall now demonstrate that if we consider a function f that is not too slow, then "most" of the words are f-random.
Iv
204
SEVERAL HOMOMORPHISMS ITERATED
Lemma 3.2. Let C he a jinite alphabet with #C = m 2 2. Let f be a function from positive reals to positive reals such that, for every x, f(x) 2 4 log, x. Then,for every positive integer n, 1 # { w ~ X * ( I w= l nandwisf-random} >I--. m" n
Proqf First, we shall find an upper bound on the number of words in X* of length n that are notjkandom. (1) Ifa word w of length n is not f-random, then it can be written in the form w1zw2zw3where IzI > f ( n ) . ( 2 ) Thus if we fix the value of IzI and the beginning positions of both occurrences ofz, then the number of such ws that are n0t.f-random is bounded by m l Z t m n - 2 b l = ,n- kt. Since I z I > j ' ( n ) ,m"-I'I < mn-J'n'. (3) However, the number of possible choices for the triple ( I w1 I, 1 w2 I, I z I ) is not larger than n3, and so the number of words of length n that are not f-random is smaller than n3mn-l(").
Thus
I
# { w E C* I wI = n and w is not f-random}
m"
<
n3m"-f'") m"
n3
--
ml(n)
*
Sincef(n) 2 4 log, n,
n3 <-= n3 m/" -
m410g2fl
n3 n3 1 -2(1ogzrn)(41og2n) - n4~og2rn 5 -n*
Consequently,
# { w E C * I I W I = n and w is f-random} 1 21-m" n and the lemma holds.
0
The above observation then yields the following very useful result.
Theorem 3.3.
Let K be an EDTOL language over an alphabet C,where
# C = m 2 2. I f length K does not contain an infinite arithmetic progression,
then lim n-m
# ( w ~ K I l w l= n } = 0. m"
Proofi Let f be a slow function from positive reals to positive reals such that, for every x, f ( x ) 2 4 log, x. Since length K does not contain an infinite
205
EXERCISES
arithmetic progression, Theorem 3.1 implies that K contains only a finite number of f-random words. Hence, Lemma 3.2 implies that # { w E K I J w=~n } I 1 m" n
for n large enough and so the theorem holds. 0 As a direct application of the above theorem we can provide nontrivial examples of non-EDTOL languages.
Corollary 3.4. Let C be ujnite alphabet with # C 2 ' 2 . Let k be a positive integer lurger t h m 1. Then neither {w E Z*ll wI = k" for some n 2 0) nor { w E Z* I I w 1 = nk for some n 2 0) are EDTOL Iunguages.
Exercises 3.1. Let G = ( ( u , b, c, d } , h, a ) be the OL system where h(a) = { a b } , h(b) = {bc, h d } , h(c) = {c}, and h(d) = { d } . Show that L(G) is not an EDTOL language. 3.2. Prove that the class of EDTOL languages is closed with respect to all AFL operations with the exception of inverse homomorphism. (You may wish to consult the proof of Theorem V.1.7.)
3.3. Prove that there exist context-free languages that are not EDTOL languages. (Cf. [ER3].) 3.4. A context-free grammar G is said to be o f j n i t e index if there exists a positive integer constant rn such that each word from L(G)has a derivation all sentential forms of which contain no more than m occurrences of nonterminal symbols. Prove that the class of languages generated by context-free grammars of finite index is a strict subclass of Y(EDT0L). 3.5. A language K over C is called bounded if there exist words w l , . . . , w, over Z such that K E wT . . . w,*. Prove that if L,, . . . , L, are context-free languages one of which is bounded, then L1 n . . . n L, is an EDTOL language. (Cf. [BC]; compare this result with Exercise V.2.4.)
3.6. Strengthen the result of Exercise 3.3 in the following way: no generator for the family ofcontext-free languages is an EDTOL language. (A language L is a grneraror for the family of context-free languages if every context-free language is obtained from L by a rational transduction.) Consult [La4].
Iv
206
SEVERAL HOMOMORPHISMS ITERATED
3.7. The following “differentiation function” [Da] can be introduced for DTOL systems. For a DTOL system G, d,(n) equals the number of words derivable in exactly n steps. Prove that it is undecidable whether or not two given DTOL systems have the same differentiation function. (A characterization of the class of functions dG is to date an open problem.) 3.8. Given a DTOL system G and a regular language of the form R = uu*, where u and u are words over the alphabet of tables of G, the pair (C, R ) constitutes, by definition,a DDTOL system. The language generated by (G, R) is the subset of L(G) consisting of all words possessing a derivation with control word in R. Prove that the family of DDTOL languages is strictly contained in the family of CDOL languages and incomparable with the family of DTOL languages. A DDTOL system generates a sequence of words, obtained by using the control words uui,i = 0, 1,2, . . . . Prove that growth equivalence as well as sequence equivalence are decidable for two given DDTOL systems. Consult [CW].
4. SUBWORD COMPLEXITY OF DTOL LANGUAGES
In this section we study the effect of the use of nonterminals in EDTOL systems. In Section 3 we have seen a number of resultsdescribing thegenerating power of EDTOL systems. Although EDTOL languages are the subject of various combinatorial restrictions (see, e.g., Theorem 3.3), they still form a “powerful” class of languages. Clearly, a lot of this “power” comes from the use of nonterminals in EDTOL systems.To study this effect ofnonterminals we strip EDTOL systems off them and consider only DTOL systems.Then we show that DTOL languages are the subject of quite serious restrictions of a combinatorial nature. It turns out that from the point of view of the number of different subwords occurring in the words of a language DTOL languages are not really “rich” (this notion will be made precise in the statement ofTheorem 4.2). We shall need the following notation specific to an investigation of the set of subwords of a language. For a word x, sub x = { y l x = xlyx2for some words xl, x2} and for a positive integer k, sub, x = { y E sub x ( I y I = k } (sub x is referred to as the set ofsubwords ofx and sub, x is referred to as the set ofsubwords o f x of length k). For a language K, sub K
=
u sub xeK
x
and
sub, K
=
u sub,
xeK
x.
4
SUBWORD COMPLEXITY OF DTOL LANGUAGES
207
I f x E C + , x = u , ~ ~ ~ r ~ , w i t h a ~ ~ICi fIorn,thentheprejxoflengthkof rl x, denoted as preji x,is defined as
Similarly, the sufJix of length k of x, denoted as suh x,is defined as
We start with the following auxiliary result. Lemma 4.1.
Let C be a,/inite alphabet such that # C = n 2 2 and let {w,, . . . , wn}be aJinite nonempty subset ofC* such that I wil > 1 for at least one i, 1 I i 5 n. Then Z
=
lim k+m
#sub, Z*
=
0.
nk
Proof: (i) First, we show that there exists a positive integer ko such that # subkoZ* < nko.For a in C,let W ( Z ,a) = { w E Z I a E alph w}. We consider
two cases. (i.1) For every a in C, there exists a word w in "(2, a) such that w = a' for some r > 0. Since # Z = #C, for every a in C,there exists exactly one w in Z such that w = a' for some r > 0. Consequently, there exists a letter b in C such that b'EZ for some I > 1 and b does not occur in any word in Z\{b'}. Thus if c E C\{b}, then cbc # sub Z*. Hence #sub3 Z* < n3. (i.2) There exists a letter a in C such that no word in W ( Z ,a) is of the form ar for some r > 0. Again we consider two subcases of this case. (i.2.1) There exists a letter a in C such that W ( Z ,a) = 0. Then a # sub Z* and so #sub, Z* < n. (i.2.2) For every a in C, W ( Z ,a) # 0. Let a be a letter such that no word in W ( Z ,a) is of the form ar for some r > 0 and let s = max{ I w I I w E W ( Z ,u ) } . Then obviously aZs# sub Z* and consequently #subZs Z* < n Z S . Since (i.1) and (i.2) exhaust all possibilities, (i) holds. (ii) Let ko be an integer satisfying (i) above and let k be a positive integer where k = k o s k l for some k l E (0,. . .,ko - 1).
+
Iv
208
SEVERAL HOMOMORPHISMS ITERATED
Then #sub, Z* I( #subko Z*)snkland consequently #subk Z* ( # subkoZ*)snk' #SUbko z* nk I ,,kos+ki = nko
(
)
'
(iii) From (i) and (ii) it follows that lim
#Sub, nk
k-m
Thus lemma holds.
z* 5
lim
(
)
#SUbko z* nko
= 0.
S+W
0
The following result describes the basic restriction on the subword generating power of DTOL systems. It says that if K is a DTOL language over an alphabet containing at least two letters, then the ratio of the number of different subwords of a given length k occurring in the words of K to the number of all possible words of length k over the given alphabet tends to zero as k increases. Let C be a Jinite alphabet such that # C = n 2 2. If K is
Theorem 4.2.
u DTOL language, K C C*, then
lim
#Sub, K
= 0.
nk
k-tm
Proof. Let C satisfy the assumptions of the theorem and let K be generated by a DTOL system G = (Z, H, w). Let
H , = {h E Hlfor some a E C,Ih(a)l 2 2}, H , = {hEHIforallaEC,Ih(a)I= l}, flC = {h E H lfor all a E C, I h(a) I I1 and for some a E C,h(a) = A}. Clearly, H = H a v H, v R,. Also let, for each h in H,
K h = {x E Z* Ithere exists y E C* such that o 2 y % x},
&, = {x E Z* I there exists y E K h and ti E H , such that x = h ( y ) } . It is easy to see (Exercise 4.1) that we may assume that
K = L(G)= F U
u
K h V
heH,
u
hsH,
where F is a finite language. (i) Obviously lim k-'m
#Sub, F nk
= 0.
R h U
u
heRc
Kh,
4
209
SUBWORD COMPLEXITY OF DTOL LANGUAGES
(ii) If h E H,,, then (since K h G it follows that lim
k+w
#Sub, KJ, =0 nk
and so
lim
#Sub,
kh
ilk
=
0
andso
#SUbk(UhEH,
nk
k-a,
(iii) Let h E H, . If # H, = m, then #sub, it follows that lim
and a E C}*) from Lemma 4.1
{ C Ih(a) ~ = CI
Kh)
= 0.
kh I m #sub, K h .Thus from (ii)
lim
#SUbk(Uh~Hg
nk
k-a,
Kh) = 0.
(iv) Let h E FlC.There exists a letter in C that does not occur in the righthand side of any production in h. Thus
#subk K h I ( n
and
-
#sub, Kh (n I nk nk
’
hence lim #Sub, Kh = 0 k-w
and consequently
lirn
nk
k-w
#SUbk(UhER,.
Kh)
nk
=
0.
Thus from (1)-(iv) and from the expression for L(G) it follows that lirn k + a
and so the theorem holds.
#Sub, K
=o
nk
0
Theorem4.2 provides aquiteelegant method ofprovingthat some languages are not DTOL languages. For example, we have the following.
Let C be aJinite alphabet such that # Z 2 2 and let K be a Corollary 4.3. finite language over Z. Then C*\ K is not a DTOL language. However, one has to be careful in interpreting Theorem 4.2, as can be seen from the following example. E.runtp/c A/. Let X = { a , , . . . , a,,} and let S$Z. Let G = (Cu { S } , { h , , . . . , h,}, S ) be a DTOL system where, for 1 Ii 5 n, hi is defined by h,(S) = Sq, hi(al) = u,, . . . , hi(a,) = a,. Then #sub, L(G) 2 nk for every k 2 1.
Thus the number of subwords of length k in a DTOL language K can grow exponentially with the growth of k. It turns out that this is no longer possible
Iv
210
SEVERAL HOMOMORPHISMS ITERATED
if we restrict ourselves to DOL systems. Indeed, in DOL languages the number of subwords is quite restricted. Theorem 4.4. Let K be a DOL language. There exists a constant C such that #sub, K I Ck'for every positive integer k . ProoJ Let K be a DOL language and G be a DOL system such that L(G) K . Let the alphabet of G consist ofp letters. Since the result is obvious if K is finite, we shall assume in the sequel that K is infinite. Let us decompose G into p DOL systems G(p, 0), G(p, l), . . . , G(p, p - I). (Let us recall from Section 1.1 that, for i > 0,j 2 0, G ( i , j ) results from G by taking as its axiom the (j 1)th word of E(G), the homomorphism of C ( i , j ) is the i-folded composition of the homomorphism of G with itself and the alphabet of G(i, j ) consists of all letters occurring in the subsequence of E(G) resulting by starting with the ( j 1)th word of E ( G ) and then taking every ith word.) Clearly, it suffices to prove the theorem for a component system G(p, t), O s t s p - 1 . S o l e t G ( p , t ) = H = ( C , h , w ) a n d l e t E ( H ) = w , , w ,,.... Clearly, since L(G) is finite, so is L(H). By adding an extra letter if necessary, we may assume without the loss ofgenerality that o E 1.Let us call a letter b in a DOL system M growing if for every positive integer n there exists a word x such that 1x1 2 n and h $- x. Clearly, a letter from H is growing only if it is growing in G. Since H results from G by taking " p steps at a time," if b is a growing letter in H, then I h"(b)I 2 n 1 for every nonnegative integer n. For the same reason, Lemma 11.1.3 implies that if h is a nonpropagating letter (that is, h A), then b 2 A. It is easily seen that there exists a positive integer constant q such that if u E sub L ( H ) and I u I 2 q, then u contains an occurrence of a nonerasing letter from H (that is, a letter that never derives A). Let k be a positive integer such that =
+
+
+
k > max{q, max{ l a l l a + a is a production in h } } Let u E sub, L ( H ) ;say u is a subword ofw, for some r 2 1. We define now a sequence of subwords in consecutive words of E ( H ) as follows. (Given a subword x of (IJ~ and a subword y of w j , , j > i, we say that x coi:u.s J, if y is a subword of the contribution of .Y to oj.) (i) uo = #;and (ii) for i < r, uiis the minimal subword of w , - ~that covers ui-1, by which we mean that u iovers ui- and no other subword of u icovers u i ~
The situation is represented in Figure 5.
4
21 1
SUBWORD COMPLEXITY OF DTIIL LANGUAGES
/
/
\
\
I
\
/
\
/
\
"r
Let j be the smallest integer such that u j E C. From our choice of k it follows that j 2 2. It is clear that the above procedure is well defined; that is, for every u E subk L(H), it yields uniquely such a u j . Let B denote the set of all words E C* such that I f i I > 1 and fi E sub h(c) for some c E C. Then, for each fi in B, we define the set L;.H as follows: u E L$.Hif and only if u E sub, L ( H ) and the above-described procedure for u j yields u j - , = 8. The reader should note that such a u may belong to several L;, H . Now we estimate the size of L;, H . Let u E L;, H . We have to consider four cases (exhausting all possibilities).
a
ui
(1) [j contains n o growing letter. Then obviously sub hi@) where i ranges over all nonnegative integers is finite and its cardinality is independent
Iv
212
SEVERAL HOMOMORPHISMS ITERATED
of k . Consequently, the cardinality of Li, cannot exceed a constant that is independent of k. (2) p = L Y ~ U Lwhere Y~ a is a growing letter and a , , a2 E X’. In this case, since /? is the minimal subword in w , - ~ +covering u and both L Y , and ct2 are nonempty, h j - ’ ( a ) is a subword of u. Thus k = I u I > I hj- ‘ ( a ) [ _> j . Hence all the elements of Lk,,Hmust be derived from /? in at most k - 1 steps. But, for 0 < i I k, there are at most k elements in sub, h’(P) that have h’(a) as a subword (this follows by considering the position of h’(a) in such a subword). Hence Lk,, does not have more than k2 elements. (3) /? = ua, where a is a growing letter and LY E C’. Since P is the minimal covering u and I fl I 2 2, LY contains at least one propagating subword in w,letter. Let LY = a’bu’’ where b is the leftmost propagating letter in a.Let E(H,) = qb’), qi’l, .. . and E(H,) = qg’, qi”, .. . (recall that H , = (C,h, a ) and H h = (C,h, b)).It follows (Exercise 1.3.17)that there exist constants C , andf, independent of k , such that there exists a positive integer n such that
,
,
n I Cl(k - 1); for every i 2 n and every nonnegative integer rn,
Since u must contain a descendant of a and a descendant of b, for every positive integer i, there are at most k subwords of hi(/?)that can be in La, (this follows by considering the position of, say, the rightmost letter of h’(a)in such a subword). This together with the fact that after n I Cl(k - 1) steps, the suffixes and prefixes of length k - 1 of E(H,) and E(H,), respectively, become periodic, shows that there is a constant C2 such that # Lk,, I C2k 2 . (4)fl = cra, where a is a growing letter and L Y EX+.In this case, reasoning analogously to case (3) above, we conclude that # L;,H I C3k 2 for some constant C3. From cases (1)-(4) it follows that indeed, for each /? E Z* such that I /? 1 > 1 and /? E sub h(a) for some a E C,there exists a positive integer constant C , such that # Lk,, I C , k2. Since the number of such /?sis finite, it easily follows that there exists a positive integer constant C H such that #sub, L ( H ) I CHk2. Since the number of DOL systems in the considered p-decomposition of G is finite, this implies that #sub, K ICk2for some positive integer constant C. Thus the theorem holds. 0
The following result demonstrates that the bound from the conclusion of Theorem 4.4 is the best possible.
4
213
SUBWORD COMPLEXITY OF DTOL LANGUAGES
Theorem 4.5. Let G be the PDOL system ( { a , b, c } , h, bab) with h defined by h(a) = uc, h(h) = bZ,and h(c) = c. Thenfor sufficientlylarge k, #sub, L ( G ) 2 3kZ. Proof: Let E ( G ) = w o , ol, . . . . It is easily seen that wI = b2'ac1b2'.Let us consider the subset Bk ofsub, L ( G )consisting ofall subwords of length k of the form b'ac'bS for some r, s 2 0 and t 2 1. It is easily seen that if 1 is such that (log, k ) - 1 I 15 k - 1, then o1contains at least k - 1 subwords of the required form, and furthermore they are all distinct members of Bk. Consequent 1y,
c
k- 1
#Sub, L(G) 2 #Bk 2
(k
-
I)
1 = l l o g i kl- 1 Ilogz kl- 2
k- 1
=
C ( k - 1) 1=1
>--k(k 2- 1)
-
1
(k
-
I)
I=1
k log, k 2 f k 2
for sufficiently large k. Thus the theorem holds. 0 The above result also demonstrates that the restriction to propagating W L systems does not affect the subword generating capacity of W L systems (in the sense of the estimation of #Sub,). However, it turns out that other structural restrictions on W L systems affect quite strongly their subword generating power. For example, it is proved in [ELR] that (1) If G = (C, h, o)is an everywhere growing DOL system (i.e., for every a E E, I h(a) I 2 2), then, for every positive integer k , #sub, L(G) I Ck log, k for some positive integer constant C. (2) If G = (C, h, o)is a uniformly growing DOL system(i.e., for every a, b E C , Ih(a)l = (h(b)l 2 2), then, for every positive integer k, #sub, L(G) I Ck for some positive integer constant C. We would like to conclude this section with the following remark. Since, for every alphabet C,C* is an EDTOL language, the subword restrictions on DTOL languages given in this section describe an aspect of the role nonterminals play in EDTOL systems. However, C* is also a OL language and a TOL language (these will be studied in Chapter V, they result from extending OL systems by allowing a finite number of finite substitutions, an extension much the same as the one done in going from DOL to DTOL systems). In this way the subword complexity results from this section can be regarded as describing the role of the deterministic restriction in L systems.
Iv
2 14
SEVERAL HOMOMORPHISMS ITERATED
Exercises 4.1. Prove that if G = (X,H,w), then there exists a finite language F such that L(G) = F U Kh U kh V Kh,
u
hen,
u
hsH,
hERc
where the notation from the proof of Theorem 4.2 is used. 4.2. Prove that given any constant I , there exists a PDOL language K such that #sub, K 2 I&’ for infinitely many k. (Cf. [ELR].) 4.3. A DOL system G = (C, h, o)is called everywhere growing if, for every a E Z, I h(a)l 2 2. (i) Prove that if G is an everywhere growing DOL system, then, for every positive integer k , #sub, L(G) I Ck log, k for some positive integer constant C. (ii) Prove that given any constant I, there exists an everywhere growing W L system G such that # sub, L(G) 2 lk log, k for infinitely many k . (Cf. [ELR].) 4.4. A DOL system G = (Z, h, w ) is called uniformly growing if, for every a, 6 in C ,I h(a)I = I h(b)I 2 2. (i) Prove that if G is a uniformly growing DOL system then, for every positive integer k , #Sub, L(G) s Ck for some positive integer constant C .(ii) Prove that given any constant I, there exists a uniformly growing DOL system G such that #sub, L(G) 2 I& for all k 2 1. (Cf. [ELR].) 4.5. Let K be an EOL language over Z. Prove that if K is Z-determined, then there exists a constant C such that, for every nonnegative integer k, #Sub, K I Ck3. (Hint: study the proof of Lemma 11.4.4 and use Theorem IV.4.4.) 4.6. Prove that {wf?w#wI w E {a, 6}+ $ Y(E0L). (Hint: use Exercise 4.5.)
5. GROWTH
IN DTOL SYSTEMS
The present section has a threefold purpose. In the first place, we want to generalize to DTOL systems some of the results concerning DOL growth established in Sections 1.3 and 111.4. From the mathematical point of view this means that we have to deal with several growth matrices (one for each table) instead of only one growth matrix. Secondly, we are able to shed some light on the families of DTOL and EDTOL languages from the point ofview of growth. Thirdly, we shall establish some facts dealing only with lengths and showing the rich possibilities resulting from the use of tables. One remarkable instance is the following fact. We shall define the notion of a length density of a language, and prove that a DOL language always has a rational length density, whereas a DTOL language may have even a transcendental length density or no length density at all.
5
215
GROWTH IN DTOL SYSTEMS
The notions of a DOL growth function, an N-rational function, and a Z-rational function were defined in Section 1.3. The domain of all of these functions is the set N of nonnegative integers. From the point of view of the following definition, it is useful to represent a nonnegative integer n in the domain o f a function as the word unover the one-letter alphabet { a } .Thus, for instance, an N-rational function is a mapping of { a } * into N . The growth function of a DOL system (C,h, 60) is a mapping of {A}* into N . Considering this representation for the argument values of a function, it is seen that the following definition is a generalization to arbitrary alphabets of the definitions given in Section 1.3. Definition.
A function
,/': z*
z=
z,
{ a l , .. . , ak},
is termed Z-rutioizul (resp. N-rurionul) if there is a row vector II, a column vector q, and square matrices M . . , M , , all of the same dimension m and with integral (resp. nonnegative integral) entries, such that for any word x = L l i , . . ui,, '
(5.1)
f(x) =
IIMi,
'
.. Mi,q.
(For .Y = A, (5.1) reads f(A) = nq.) An N-rational function is called a DTOLjirnction if all entries in q equal 1. Finally, a DTOL function is called a PDTOL,function if every row in each of the matrices M I , . . . , M k contains at least one element greater than zero. From the point of view of DTOL systems, the previous definition can be interpretedasfollows.ConsideraDT0Lsystemwithk tables(calledu,, . . . , uk) and 171 letters in the alphabet. (It is very important to notice that the alphabet X in the definition above will be the "alphabet of the tables," whereas the dimension of the matrices gives the cardinality of the alphabet of the system itself. Since we are dealing only with word length, it is immaterial how the letters of the system are called.) The matrix M i is the growth matrix associated to the table ui in the natural way, i.e., M i equals the growth matrix of the DOL system whose productions are determined by the table ai. The vector II gives the distribution of the letters in the axiom. The function value f ( a i , . . . ai,) equals the length of the word obtained by applying the sequence of tables uil . . . ui, to the axiom. This is established in exactly the same way as the first sentence of Theorem 1.3.1. Also the existence of a bound analogous to the second sentence of Theorem 1.3.1 is immediate: given a DTOL functionf, one can find constants p and q such that .f(x>
holds for all words x .
P41x1
Iv
216
SEVERAL HOMOMORPHISMS ITERATED
As already indicated, in the case k = 1 the definition above is reduced to the definitions given in Section 1.3. Similarly, it is also seen that N-rational functions are growth functions associated to HDTOL systems. In connection with a DTOL system all components of v] are equal to 1 because we just sum up the numbers of occurrences of the individual letters to get the word length. In connection with an HDTOL system the components of q indicate the length effect of the homomorphism applied to the words generated by the underlying DTOL system. The values of an N-rational (resp. a Z-rational) function give the coefficients in an N-rational (resp. a Z-rational) formal power series; and, conversely, such a series determines an N-rational (resp. a Z-rational) function. For further details the reader is referred to [SS]. E.rrrrrip/i)5.1.
The DTOL system G has the axiom b and two tables 1 : b - bb,
2: b - + bbb.
Then the DTOL function f defined by G satisfies, for every x E {1,2}*, f (x) = 2‘3’ where i (resp. j ) equals the number of occurrences of 1 (resp. 2) in x. Thus, f (x) depends only on the Parikh vector of x. We now give a method of deciding whether or not two Z-rational functions f and f‘, defined over the same alphabet C, coincide, i.e., whether
f(x) = f’(x)
(5.2)
holds for all words x. In the special case of DTOL functions this decision problem amounts to deciding the growth equivalence of two DTOL systems with the same number oftables. More specifically,consider two DTOL systems G and G’ with tables TI, . . . , &and T i , . . . , T i . For each one-to-one mapping a between these two sets of tables, we denote the tables ?;. and a(7;) by a i , for i = 1, . . . , k. The systems G and G‘ are growth equivalent if there is a mapping such that (5.2) holds for all words x E { a l , . . . , ak}*,where f and f ’ are the DTOL functions determined by G and G’. Thus, an algorithm for deciding the growth equivalence of two DTOL systems with a common alphabet of tables immediately yields an algorithm for the general case. Our first theorem is a generalization of Theorem 1.3.3. It can also be established by a similar method. However, we give here a different proof, due to [El. Theorem 5.1. Consider two Z-rational functions f and f ‘dejined over the same alphabet 1 such that m (resp. m‘)is the dimension of the matrices used in the definition o f f (resp. f’). If (5.3)
f ( x ) = f’(x)
for all x with 1x1 < m
+ m‘
5
217
GROWTH IN DTOL SYSTEMS
then f (x) = f '(x) jor all x. Consequently, the growth equivdence problem is decidable .for D TOL systems. Prooj: That the last sentence is a consequence of the previous one is obvious: DTOL functions are a special case of Z-rational functions, and (5.3) is a decidable condition. To prove that (5.3) implies that f = J ' , we assume that f is defined by (5.1) and that the matrices used in the definition off' are, accordingly, M',,. . . , M ; , 4'. Let g: X* + Z be the Z-rational function defined by the matrices if, R,,. . . , M,, ij, where XI,
5 = (n, -n'),
ij =
Mi 0 M i = [ o M:].
[;,I,
i = 1, . . . , k.
Thus, these matrices are of dimension m
+ m'. Clearly,
- f'(x)
for all x.
y(x) = f ( x )
Thus, we have to show that if (5.4)
y(x) = 0
for all x with 1x1 < m
+ m',
then y(x) = 0 for all x. This is true if il = 0 or i j = 0. From now on we assume that (5.4) is satisfied and that 5 # 0 and i j # 0. We denote by V the subspace of Q"'"' consisting of all vectors v such that
vll = 0. For a word x
=
ui, . . . ui,, we define
R(x)= M i , . . . Mi*,
v ( x ) = ?rR(x).
For i = 0, 1,2,. . . , let U i be the subspace of Q"'"' spanned by the vectors v ( x ) with I x I I i. Then, by (5.4),
u, G u1 c . . ' E U r n + " ' - *G
(5.5)
v.
Considering the dimensions of the spaces U i , we infer from (5.5) that (5.6)
u . = u.
,+1
forsome i, 0 I i <m
(Note that dim(U,) = 1 and dim(V) spanned by all vectors o
and
vMj,
=
m
+ m'-
+ m' - 1.)
1.
But now U i t 2 is
v € U i + , , 1 I j s k,
Iv
218
SEVERAL HOMOMORPHISMS ITERATED
and, consequently by (5.6), U i + 2is spanned by all vectors u
and
vMj,
v e U i , 1 < j < k,
which implies that U i + = U i +2 . By induction we infer that U i = U i + holds for all j. But this means that
U is
I/
for all i,
which implies that g(x) = 0 for all x. The bound m + m' obtained in Theorem 5.1 cannot be improved in the general case. This was established already in Exercise 1.3.3. Also the results established in Section 111.4 concerning interconnections between Z-rational and DOL functions can be extended to the case of several letters, i.e., to DTOL functions. Thus, Theorem 111.4.7 can be generalized to the form: every Z-rational function can be represented as the difference of two PDTOL functions. Similarly, for every Z-rational function g(x), one can find an integer r,, such that for all r 2 ro the function
f ( x )= 1 + Ax) is a PDTOL function. This latter result is a generalization of Theorem 111.4.6. We omit here the detailed discussion of these generalizations because we are going to establish similar and in some sense stronger results by a different technique. The reader is also referred to Exercises 5.4 and 5.5. A number of undecidability results concerning growth according to DTOL systems with two tables (and, consequently, according to DTOL systems in general) are based on the following fact. It is undecidable whether a given 2-rational function1 : {a, b}* + Z assumes the value0 (cf. Exercise 5.5). Using this fact one can show, for instance, that it is undecidable whether a function g defined by a DTOL system with two tables is monotonically growing, i.e., whether g ( x ) 5 g(xy) holds for all words x and y. Assuming that the monotonicity of such a function g is known, it is still undecidable whether g(x) = g ( x y ) holds for some words x and y # A. The reader is referred to Exercise 5.6. We do not discuss these problems in detail here because we are going to establish slightly different and somewhat stronger results. A notion basic in our subsequent discussions is that of a cornmurarive DTOL function, due to [K7]. A DTOL function f ( x ) is called commutative if f ( x ) = f ( y ) holds for all words x and y with a common Parikh vector. Thus, a sufficient condition for commutativity is that the matrices M i and M j commute for every i andj. (Here M i and M , are matrices given in the definition of a DTOL function.) The DTOL function f defined in Example 5.1 is commutative. The following example is more sophisticated and serves also as an illustration of an important construction, as will be seen later on. (5.7)
+
5
219
GROWTH IN DTOL SYSTEMS
Exarrtp/c>5.2. The alphabet of a DTOL system G is {b,,, bZ1,b,,, b,,}, and the axiom is b, Ib,zb2,b,, . The system has two tables, denoted by a, and (1,
:
-
Ul =
PI,
bllb219 b,,
a2 =
Cbll
bllb127 b21
+
+
b,,, b12
+
h,lb,,>
+
b12b22, b2z
h12
+
b,,, b2,
b,,l,
-+
+
bzzl.
Consequently, the associated matrices are
d:d:l
p 1 0 0 0 1 0 0
M,=l0 0 1 1 , L o o 0 1
M,=
0 0 1 0 ' 0 0 0 1
It is immediately verified that
MIMz = M2M1= 0 0 0 1 and, thus, the DTOL functionf(x) determined by G iscommutative. Moreover, we can give the following very simple expression for the valuef(x), denoting as usual by # i ( x )the number of occurrences of ui in x (i = 1,2):
'
0 1O 0 0 0 0 =
#2(x) 0
#:(x)][; 0
1
1 0
1
1
+ 1, 1, #,(x) + l)(#,(X) + 1, #,(x) + 1, 1, l)T + 2)(#,(x) + 2).
(1, #1(x)
= (#l(X)
E.rutnp/e 5.3.
Consider the DTOL system G = ({bi?
b 2 1 9
{ ~ 1 ,
b1h
where the two tables are defined by u1 =
[b,
-+
b,, b2
-+
b,],
a, =
[bl
-+
b:, bz
-+
b,].
Iv
220
SEVERAL HOMOMORPHISMS ITERATED
The DTOL function f ( x ) determined by G satisfies, for instance, the following equations for an arbitrary i 2 0:
2'. Thus, f ( x ) is an example of a DTOL function that is not commutative. f(UIUl;Ul>
=
1,
f(a;ulal)
= f(a,a,al;) =
The function f ( x ) given above is a very simple example of a noncommutative DTOL function. More general examples can be constructed because of the following easily verifiable facts. Assume that G is a DTOL system with the axiom w determining a commutative DTOL function f ( x ) . Denote A, = { I x l l w s x } ,
n 2 0.
Then # ( A , ) is bounded by a polynomial in n whose degree equals k - 1 if k is the number of tables in G. More specifically,
Thus, # ( A , ) In + 1 if G has two tables only. On the other hand, for an arbitrary DTOL system, # ( A , ) may grow exponentially in n. Even a much stronger result can be obtained: there are DTOL languages whose length set is not generated by any DTOL system defining a commutative function; cf. Example 5.4 and Exercise 5.7. However, it is interesting to observe that commutativity is a decidable property. Theorem 5.2. I t is decidable whether a given DTOL system generates a commutative function f (x). Proof: Compute the matrices II, M , , . . . , M , , and q from the given DTOL system. For each r and s in { 1,. . . , k } , we define the N-rational functionsf,, and L r by fis(ai, . . . ai,) = nMi, . . . MitM , M , q , Lr(Ui,
. . . Uit)
= IIM',
.. . M i , M , M J .
Clearly, f ( x ) is commutative if and only if (5.8)
fi, = f , ,
for all r and s.
The validity of (5.8) is decidable by Theorem 5.1.
0
We now turn to a discussion concerning the interconnection between commutative DTOL functions and DOL (growth) functions. Using this interconnection, quite strong characterization and decidability results can be established.
5 GROWTH IN
22 1
DTOL SYSTEMS
Theorem 5.3. For any DOL growth functions f,, . . . , fk, a DTOL system G with k tables a , , , . . , ( l k can be constructed such that G defines the commutative function (5.9)
J'(x)=
.11(?# 1(x)) . . . X ( 7f k(X)).
Proof: Assume that Gi = (Xi, h i , q),
1 I i Ik ,
is a DOL system with the growth function 1;.Denote by Hi and xi the growth matrix of G iand the Parikh vector of the axiom mi, respectively. We now define a DTOL system G such that (5.9) is satisfied. Since we are interested only in word length, the order of letters in the axiom and productions of G will be immaterial. The alphabet of G is the Cartesian product
X
=
c, x . . . x c,.
The Parikh vector of the axiom equals 71 = 7 1 ,
O . . . 0x k .
(Here 0 denotes the Kronecker product of matrices; cf. [SS].) The growth matrices associated to the tables a,. . . . , ak of G are
M,
=
1 0. . . 0H k .
Here I is an identity matrix of the appropriate size, i.e., such that in every Mi thejth Kronecker factor will be of the same dimension as Hi. We now use the identity ( A 0B)(C 0D) = AC
(5.10)
0BD
(which is always valid provided the products involved are defined). Let rand s be integers satisfying I I r < s I k . We obtain
M,M,
( I O . . . 0H , 0 . . . 0 I ) ( I 0...0 H , O . . . 0I ) 1 0 . . . 0H, 0. . . 0 H, 0... 0I = ( I 0.. . 0H , 0.. . 0 I ) ( ] 0.. . 0H , 0.. . 01) =
-
=
M,M,.
Iv
222
SEVERAL HOMOMORPHISMS ITERATED
It is very illustrative to visualize the productions of the DTOL system G constructed in the proof above. In the first place, the alphabet C may be identified with the collection of letters {b(il,..., i k ) l i j = 1, ..., # ( C j ) , 1 < j
< k}.
The table aj corresponding to the matrix M j simulates the homomorphism hj in the following way. Denote the letters of C j by integers:
cj = { I , . . , # ( C j ) } . *
Assume that, for an arbitrary letter t, the production is defined by hj(t) = u1 * * * Us(,). Then the table aj consists of the productions a(il,
..
a
9
t,
*
ik)
* a(i1, . . *
1
for all possible values of il, . . . , ijFinally, the axiom of G consists of
Ulr 1,
...
7
ik)
i j + l,.
' ' '
a(i1, * * *
9
us(!),
.
7
ik),
. . , ik in their respective ranges.
k
FI
j= 1
occurrences of the letter a(il, . .., i k ) , provided oj contains uj occurrences of i j , for 1 Ij Ik. Observe that in Example 5.2 the DTOL system G is obtained in exactly this fashion from the W L systems G1 = Gz = ( { b i ,bz}, {bi
+
b,bz, bz
+
bz}, blbz).
Since the sum of two commutative DTOL functions is again a commutative DTOL function, we obtain the following result as an immediate corollary of Theorem 5.3.
5
223
GROWTH IN DTOL SYSTEMS
Theorem 5.4.
For any DOL growth functions
Lj,
i = l , . . . , k, j = 1 , ..., u,
one may construct a DTOL system G defining the commutativefunction U
(5.1 1 )
f(x) =
1
fi j(
# I(,\-))
j= 1
' '
'
hj(# k ( X ) ) ,
The converse of Theorem 5.4 is not valid: there are commutative DTOL functions not expressible in the form (5.1 1) where the fij are DOL growth functions. One such DTOL function is explicitly given in Exercise 5.8. However, the following weaker result can be obtained. Theorem 5.5.
Any commutative DTOL function f : { a l , .. . ,ak}* 4 N
is of the jbrm (5.1 l ) , where all of the functions J j are N-rational and, furthermore, the junctions . f k j are DOL growth functions. Proof: Consider the identity U
(5.12)
AB =
1A q j n j B , j= 1
where A and B are square matrices of dimension u, and nj (resp. q j ) is thejth coordinate vector written as a row vector (resp. as a column vector). The theorem now follows by applying (5.12) to the defining equation f (x) =
nMF I ( x ) . . . Mk#*(X) vl
of an arbitrary commutative DTOL function f(x).
0
We shall now define a notion which shows, among other things, that DTOL systems are surprisingly much more general than DOL systems just from the point of view of generated word lengths. This notion, the length densi/j. of a language L, indicates the ratio between the lengths of words in L and all possible word lengths. The length density should not be confused with the density of a language L; cf. [SS] and Exercise 5.9. The density of L indicates the ratio between the number of words in L and all possible words. Dejinition. defined by
The length density of a language L, in symbols lgd(L), is lgd(L)
=
lim # { l x l l x ~ L and 1x1 In}/n, n-m
provided the limit exists.
Iv
224
SEVERAL HOMOMORPHISMS ITERATED
Thus, the length density is a number satisfying 0 I Igd(L) I1.
It will be seen below that there are DTOL languages having no length density. The following theorem shows that, as regards DOL languages, the situation is very simple. Every DOL language has a rational length density that can be computed efectively. Every rational number between 0 and 1 equals the length density of some DOL language. Theorem 5.6.
Proof. To prove the first sentence, we observe that every finite DOL language as well as every DOL language with at least quadratic growth order possesses length density 0. Thus, there remains the case where the given WL system G generates a linear growth order. This means that the growth function fG(n) has been obtained by merging the functions (5.13)
ain
+ bi,
i = 1,. . . , r,
where t 2 1, the ai are positive integers, and the bi are integers. (In the merging process some “initial mess” might have to be excluded from the value sequence of fc(n). However, this is immaterial from the point of view of length density.) Let A be the least common multiple of the numbers ai, i = 1, . . . , r. We now investigate how many residue classes modulo A are represented by numbers of the form (5.13), where n runs through nonnegative integers. If B is the number of these residue classes, then clearly lgd(L( G)) = B/A. To prove the second sentence, we note first that every finite DOL language has length density 0 and every DOL system with growth function n + 1 generates a language with length density 1. Let p / q be a rational number in lowest terms such that 0 < p/q < 1. We merge according to Theorem 111.4.8 the WL length sequences ui(n) = qn
+ i,
1 I i 5 p.
Then the resulting DOL system generates a language with length density
P/4. 0 Consider the DTOL system G obtained by constructing all Exumplr 5.4. deterministic tables from the productions a.
+
bo, si
-+
bo + a0a3,aoa2ii,aoaa2,aoa3,
b6, c,
b
+ aa,
6 + sisi,
a
+
c + a4
bb,
5
225
GROWTH IN DTOL SYSTEMS
and with axiom a , . All words derived in an even number 2n of steps are of length 4", as immediately verified by investigating the productions. On the other hand, a word derived in 2n + 1 steps is of length j satisfying 4" I j I 4" + 4" - 1 ;and, in fact, every such lengthj is obtained. This follows because all words derived in 2n steps belong to ao{a,Z}* and the number of as may assume any value between 0 and 4" - 1, as is seen by an induction on n. This implies that the length set of L ( G ) equals (5.14)
(4" + j l n 2 0,O I j I 4" - 1).
If we now examine the ratio defining the length density for values of n of the form 22" and 2 2 m + 1we , infer that L ( G ) has no length density. One can also show (cf. Exercise 5.7) that the length set (5.14) is not generated by any DTOL system defining a commutative function. 0 We now present a result concerning the synthesis of polynomials as commutative DTOL functions. The result is a starting point for a number of interesting applications. A stronger result of this nature is given in Exercise 5.10. Theorem 5.7. For any polynomial P(y,, . . . ,yk) with nonnegative integer coefficients, a DTOL system G with k tables a l , . . . , ak defining the commutative function f ( x ) = P( # 1(x)
+ 1,
*.
9
#k(X)
+ 1)
can be constructed.
Proof. Let u be the number of monomials in P . The assertion follows from Theorem 5.4 because functions of the form g(n) = t(n l)j, where t a n d j are natural numbers, as well as positive integer constants are all DOL growth functions. 0
+
The following corollary of Theorem 5.7 gives a method of constructing some rather interesting EDTOL languages. Theorem 5.8. For any polynomial P ( y l , . . . ,yk) with nonnegative integer coefficients,the set { P ( n l l . . , nk)ln,,. . ., nk 2 0 ) is a DTOL length set. Consequently, the language {bp'"I...."k'lnl,. . . ,nk 2 0 ) is an EDTOL language.
Iv
226
SEVERAL HOMOMORPHISMS ITERATED
Proof. The second sentence is a consequence of the first because, by Exercise 3.2,the family of EDTOL languages is closed under homomorphism. We prove the first sentence by induction on k using the fact that the union of two DTOL length sets is again a DTOL length set. The basis of induction, k = 1, is clear because
{P(nl)lnl 2 01 = {P(nl)lnl 2 11 u {P(O)J and the first term in the union is a DTOL length set by Theorem 5.7. The inductive step is accomplished using the identity
{p(nl,...,nk)lnl,...,nk 2 0 ) = {p(nl,...,n~)lnl,.,.,nk 2 1) k
u
1 {~(n,,. . . , nk)lni = 0, nj 2 O for j # i}. i= I
On the right-hand side the first term is a DTOL length set by Theorem 5.7, and the remaining terms by the inductive hypothesis. 0 We are now able to present some interesting examples both as regards languages and length sets. Exutnpli. 5.5.
By Theorem 5.8 theset ofcomposite numbers representable
in the form
((4 + 2)h2
+ 2)ln,, n 2 2 01
is a DTOL length set. Consequently, the language L = {din is composite)
is an EDTOL language. It can be shown that the complement of L is not even an ETOL language; cf. Exercise VI.2.6. 1:‘xiitnplr~5.6.
The set
K = {nrn*ln 2 1, rn 2 2) = {(nl
+ l)(n2 + 2)21n1,n2 2 0)
consisting of all numbers that are not sequare-free is a DTOL length set by Theorem 5.8. Moreover, it follows by Theorems 5.7 and 5.8 that a DTOL system G generating K “commutatively (i.e., the DTOL function defined by G is commutative) can be constructed. It is known from number theory (cf. [HW]) that the length density of L(G) equals 1 - 6/lc2. 0 ”
Thus, the following theorem has been established in Examples 5.4and 5.6. The theorem should be compared with Theorem 5.6.
5
227
GROWTH IN DTOL SYSTEMS
Theorem 5.9. There are DTOL languages with a transcendental length density, as well as DTOL languages with no length density at all. We conclude this section with some undecidability results already referred to in the discussion following Theorem 5.1. We first need a tool concerning representations with a dominant term, resembling (5.7). Theorem 5.10. For any polynomial P(y,, . . . , yk) with integer coeficients, one can find a constant r,, such that, for any integer r 2 ro, the function f : { a l , .. . , ak}* + N dejned by (5.15)
f(x)=(Ixl+k+
l)1+
P(#l(X),...,
#k(X))
is a commutative DTOL function.
Proof: Let P’(yl. . . . , yk) be the polynomial satisfying the identity
P(yl,..’?Yk)=P’(yl + 1 ? * . . , y k + l ) . We now apply Theorem 5.7 to the function ( I X l + k + 1 ) ’ + P ’ ( # , ( X ) + 1, ..., # k ( X ) + l ) for large enough numbers r.
0
We are now in a position to establish undecidability results for the comparison of two DTOL functions. Two such results are contained in the next theorem, further results are given in Exercise 5.11. We call a DTOL function f ( x ) polynomially bounded if there exists a polynomial P(n) such that f ( x ) I P(lx1) holds for all words x. It is obvious that any problem established undecidable for a restricted class of functions remains undecidable for more general classes. I t is undecidable whether two polynomially bounded Theorem 5.11. commutative D TOL ,functions
f, 9 : {
. . ,ak}* + N
~ i , .
(i) assume the same value for some word x ; (ii) satisjy the inequality f ( x ) 2 g(x)for all words x. Pro05 We apply reduction to Hilbert’s tenth problem. By Theorem 5.10, (5.15) is a commutative (and clearly also polynomially bounded) DTOL function, and so is obviously also (1x1 + k + l y . Thus, a decision method to (i) would solve Hilbert’s tenth problem, a contradiction.
Iv
228
SEVERAL HOMOMORPHISMS ITERATED
To prove the undecidability of (ii), we just use the functions ( I x I + k + 1)’ #k(X)))’ and (1x1 k 1)’ + 1 instead of the ones used above. 0
+ ( P ( # l(x),.. . ,
+ +
+
+ +
Since the functions (I x I + k 1)’and ( Ix I k 1)’ + 1 used in the proof above are, in fact, PDOL growth functions, Theorem 5.1 1 can be somewhat strengthened as indicated in Exercise 5.1 1. To obtain undecidability results involving just one DTOL function, we need the following lemma concerning mergeability. In the statement of the lemma $(x) denotes the Parikh vector associated to a word x, and the operator O D D ( x ) picks out every second letter of x, i.e., ODD(b1b2* * * 6 2 “ -
1)
=
ODD(b1b2. . . 6 2 , , ) = 6163 . . . b z n - 1.
(By definition, O D D ( A ) = A) The proof of the lemma, based on Theorem 5.10 and standard merging techniques, is left to the reader. Lemma 5.12. For all polynomials P ( y l , . . .,yk) and Q(yl, . . . ,Y k ) with integer coefjlcients, one canjind a constant ro such that,for all integers r 2 r o , the function , f : { a l ,. . . ,ak}* -+ N defined by f(x)=
{
+ + 1>’ + P($(ODD(x))) + + 1)’ + Q($(ODD(x)))
(IODD(x)( k (IODD(x)l k
for for
1x1 euen, 1x1 odd
is u DTOL function. Theorem 5.13. I t is undeciduble whether a given polynomially bounded DTOL function f ( x )
(i) remains somewhere constant, i.e., whether or not there exist a word x and a letter b such that f ( x ) = f ( x b ) ; (ii) is monotonic. Proof. Analogous to that of Theorem 5.11. Now we use Lemma 5.12 instead of Theorem 5.10. 0 The problems corresponding to the ones given in Theorems 5.1 1 and 5.13 are decidable for polynomially bounded DOL growth functions, whereas their decidability is open for general DOL growth functions. (Cf. Exercise 111.4.11.) It is an open problem whether or not Theorem 5.13 remains true for commutative polynomially bounded DTOL functions. (The standard proof of Lemma 5.12 destroys commutativity.) Theorems 5.13 and 5.11, without the assumption of commutativity, remain valid for DTOL functions defined by systems with only two tables, i.e., k = 2. This is related to Exercise 5.6.
229
EXERCISES
Exercises 5.1. Generalize Theorem 1.3.4 to DTOL functions. 5.2. Prove that every Z-rational function can be represented as the difference of two PDTOL functions. 5.3. Prove that, for every Z-rational function g(x), one can find an integer ro such that for all r 2 ro the function
f(x)
=
+ g(x)
is a PDTOL function. 5.4. Prove that, for every Z-rational function .q(.u), one can find an integer ro such that, for all r 2 yo, the function 1' defined in the following way is a DTOL function: rll
=
+1
r""
+ g(ODD(x))
for 1x1 = 2n, for 1x1 = 2n + 1.
5.5. Prove that it is undecidable whether or not a given Z-rational function, defined over an alphabet with two letters, assumes the value 0. (Cf. [SS]. Contrast this result with Problem 2 in Exercise 111.4.11.) 5.6. Using the previous exercises, show that it is undecidable whether a function g defined by a DTOL system with two tables is monotonically growing, i.e., whether d x ) 5 g(xy)
holds for all words x and y. Assuming that the monotonicity of such a function g is known, show that it is still undecidable whether g(x) = g(xy) holds for some (resp. infinitely many) pairs (x, y) with y different from the empty word. (Cf. [SS], where related results are also presented. Compare these results to Exercise 111.4.11.) 5.7. Prove that the length set (5.14) is not generated by any DTOL system defining a commutative function. (Cf. [K7].) 5.8. Prove that the function f(x) over the alphabet { u l ,u z } defined by
.f'(x) = ( # I(.\-)
+ 1)( # z(x) + I ) + (1 + ( -
l)#l'X'+l)
is a commutative DTOL function not representable in the form (5.11).
Iv
230
SEVERAL HOMOMORPHISMS ITERATED
5.9. Consider a language L over the alphabet C. Denote by C(L, n ) the number of words in L of length In, and by D(n) the number of all words over C of length ~ n If . the limit of the sequence C(L, n)/D(n), n = 0, 1,2,. . . , exists, it is referred to as the density of L. Prove that the density of every DOL language, as well as of every DTOL language, equals 0. Investigate densities of languages in other L families. (Very little is presently known about this topic.) 5.10. We say that a monomial An;‘ . . . n;I in t variables n , , . . . , n, covers a monomial Bn;’ . . . ii: if ri 2 si for all i and ri > si for some i. Consider polynomials P ( n , , . . . , n,), f 2 1, with rational coefficients and nonnegative integer values and such that any monomial in P with a negative coefficient is covered by another one with a positive coefficient. Prove that, for any such polynomial, there exists a constant k and a DTOL system with t tables defining the commutative function
f(x) = P( # Ax), . . #,(x)) whenever #i(x) 2 k , for i = 1,. .. , t. (Cf. [K6] and [K7].) . 1
5.11. State and prove a stronger version of Theorem 5.11 comparing PDOL and PDTOL growth. 5.12. Establish Lemma 5.12. 5.13. Investigate closure properties of commutative DTOL functions. 5.14. The decidability status of the following “DTOL sequence equivalence problem” is still open. Consider two n-tuples of homomorphisms (S,?. . *
Sn), (h,.. ., h”), defined on C*, as well as a word w in C*. Decide whether or not 9
hi,* * ’ h,,(w)
= gi, . . . gi,(w)
holds for all sequences i l , . . . , ik of numbers from { 1, . . . , n } . Prove that this problem is decidable if and only if it is decidable for n = 2. (The case n = 1 is, of course, the DOL sequence equivalence problem.) Prove that the decidability of this problem implies the decidability of the HDOL sequence equivalence problem.
V Several Finite Substitutions Iterated
1. BASICS ABOUT TOL
AND ETOL SYSTEMS
As expected, our next step in the systematic investigation of L systems is to generalize DTOL systems (or EDTOL systems) in such a way that one iterates several finite substitutions rather than several homomorphisms. (This generalization corresponds to the step done when going from DOL to OL systems.) In this way we obtain TOL and ETOL systems. The class of ETOL systems plays a very central role in the theory of L systems. It is the largest class of L systems still referred to as “without interactions,” and it forms the framework for the classes of L systems and languages discussed in this book. Definition. A TOL system is a triple G = (C,H , w ) where H is a nonempty finite set of finite substitutions (called rubles) and, for every h E H , (Z, h, (o) is a OL system (called a component system of G ) . The lunquuye of G, denoted L(G), is defined by L ( G ) = { x E C* I x
= (o
or x E h l . . . hk(co) where h l , . . . , hk E H } .
Again all the notation and terminology of OL and DTOL systems, appropriately modified if necessary, is carried over to TOL systems. Also, we shall consider a OL system to be a special case of a TOL system (where # H = 1). 231
v
232 Example 1.1. and H
w = a$d
{a
=
SEVERAL FINITE SUBSTITUTIONS ITERATED
For the TOL system G = (C,H , w ) with C = { a ,b, c, d , $}, {h,, h 2 } where h , is defined by the set of productions
aa, a + ab, a ba,a b + bb, $ $, c c,d
-+
-+
-+
-+
-+
bb, b aa, b -, ab, b + ba, d,d -, c } -+
-+
and h2 is defined by the set of productions
{a
-+
a, a b, b b,$ + $, c -, cc, c -+ cd, c d -+ cc, d cd, d + dc, d + dd}, -+
-+
-+
dc, c
-+
dd,
-+
we have L(G) = K\{a$c, b$d, b$c} where
K
=
{ x $ y I x {a, ~ b}', 1x1 = 2" for some n 2 0, Y E {c, d}' and lyl = 2" for some m 2 O}.
Examplo 1.2. For the TOL system G = (C, H , w )with C = {a, b } ,w = a, and H = { h l ,h 2 }whereh, isdefined bytheset ofproductions {a + a, a -+ a 2,
b -+ b } and h2 is defined by the set of productions {a
-+
b, b
-+
b}, we have
L(G) = {a"ln 2 1) u {b"ln 2 l}. Analogously to the cases of OL and DTOL systems, the following result underlies most of the considerations concerning TOL systems and will be used very often, even if not explicitly quoted. Its easy proof is left to the reader. Lemma 1.1.
Let G
=
(C,H , w ) be a TOL system.
(1) For any nonnegative integer n and.for any words xlr x 2 and z in C*,if x l x 2 2. z, then there exist words z1 and z 2 in C* such diut z = zlz2,x 1 9z , and x 2 2 z2, ( 2 ) For any nonnegative integers n and m, and,for any words x, y, and z in C*. iJx 7 y and y 3 z,then x z.
-
A derivation in a TOL system differs from a derivation in a OL system by the fact that at each derivation step we first choose a table and then we choose the productions from that table. A derivation in a TOL system differs from a derivation in a DTOL system by the fact that in a DTOL system once we have chosen a table for a derivation step the productions rewriting all occurrences of letters in the given string are automatically fixed (a table in a DTOL system contains precisely one production for each letter). Formally, we define a derivation in a TOL system as follows. Let G = (C, H , w ) be a TOL system. A derivation D in G is a Definition. triple (0, V , p ) where 0 is a finite set of ordered pairs of nonnegative integers
1
233
BASICS ABOUT TOL AND ETOL SYSTEMS
(the occurrences in D), t i is a function from 0 into X ( v ( i , j ) is the value of D at the occurrence (i,.j)), and p is a function from 0 into
u
H x ( a c Z,h c H
{a
-+
alaEh(u))
1
(p(i, j ) is the table-production value of D at occurrence (i,j)), satisfying the following conditions. There exists a sequence of words (xo, x l r . . . , x,) in X* (called the trace of D and denoted by trace D ) such that r 2 1 and (i) G = { ( i , j ) I O I i < r a n d 1 5.j _< lxil); is thefth symbol in x i ; (ii) (iii) for 0 I i < r, there exists an h in H , such that for 1 I j I Ixil, / j ( i , , j )
p(i,,j) = (h, v(i,j )
+
aj)
where c i j E h(v(i,j ) ) and
a l a 2 . . . CI~,..~
-
xi+
In such a case D is said to be a derivation ofx,from xo and r is called the D.The string x, is called the result of D and is denoted res D.In particular, if xo = w , then D is said to be a derivation qfx, in G. The word T = k,,h, . . . h,- over H such that h o , h , , . . . , A,-, are the first components of p(0, I), p( 1, l), . . . ,p ( r - 1, l), respectively, is called the control word uf'D (denoted by cont 0 )and the sequence ((xo, ho), (xl, hl), . . . , (x, - h,- I), x,) is falled the.full trace o f D (denoted byftrace D). We also write x, E t(x0) or x,)3 x,. 0 heiyhr (or the length) of the derivation
234
v
SEVERAL FINITE SUBSTITUTIONS ITERATED
FIGIJRE I
D is a derivation of a3b$cd from a$d (hence a derivation of a3b$cd in G) of height 3. Its control word is h l h l h l , trace D = (a$d, a2$d,a3b$d, u3b$cd),and ftrace D = ((agd, hl), (a2$d,A,), (a3b$d,h2), a3b$cd). As usual, we represent D by a derivation graph as in Figure 1. Again, in the sequel we shall use the notion of a derivation in a rather informal way avoiding the tedious formalism, unless it is really necessary for clarity. We can now also add the following to our fundamental Lemma 1.1.
Lemma 1.2. Let G = (X,H , o)be a TOL system and let t E H*. For any words xl, x 2 ,y,, and y 2 in X*,i f y l E z ( x l ) and y 2 E t(x2), rhen y,y2 E ~ ( x ~ x ~ ) . Obviously, TOL systems generate more languages than OL systems. It is easy to prove that neither the language from Example 1.1 nor the language from Example 1.2 is a OL language. As a matter of fact one can have finite TOL, languages that are not OL languages. Example 1.4. Let G = (X,H , o)be the TOL system such that X = {a, b}, hub, and H = { h , , h,} where hl(a) = { b } , h1(b) = ( a } ,h2(a) = ( a } and Iz,(b) = { a } .Then L(G) = {bab,a h , a 3 ,b 3 } ,which is easily seen not to be a UJ
=
OL language. However, TOL systems are not strong enough to generate all finitelanguages. For example. ( a , a 3 } is not a TOL language; the reason is the same as in OL systems (see Example 11.1.9): if G is a TOL system with L(G) E { a } * and a, a3 E L(G) but a 2 4 L(G), then L(G) must be infinite. A difference between OL and TOL systems is well illustrated by the role erasing plays in these systems. We have shown in Section I of Chapter I1 (see Lemma 11.1.3) that if a letter in a OL system G = (C,h, w ) can derive the empty word, then this letter can derive the empty word in no more than # C steps. An analogous result holds for TOL systems: if a letter in a TOL system G = (C,H , o)can derive the empty word, then it can derive the empty word in no more than D steps where D is a constant dependent on G only (however, in
1
235
BASICS ABOUT TOL AND ETOL SYSTEMS
general it is not true that one can take D = # C). Based on this property ofOL systems, we could prove in Section 1 of Chapter I1 (see Theorem 11.1.4) that, for every word x in a OL system G , we can find a derivation of x in G with trace (xo, xl, . . . , x, = x) where the length of every x i , 0 I i I r - 1, is not greater than CG(1 x I + 1) where CGis a constant dependent only on G . Such a "linear erasing property" does not hold for every TOL system as is shown by the following example. Example 1.5. Let G = (C, H,o) be the TOL system such that C = { A , B, a}, o = AB, and H = {hl, h 2 } where hl(A) = {A'}, h l ( B ) = { B 3 } , hl(a) = {a}, h 2 ( A ) = {a}, h2(B) = {A}, and h2(a) = {a}. Then G is deterministic; L(G) n {a}' = {a2"ln2 0); and, for every derivation D of a word a2"such that no two words in its trace are the same, its trace is (xO
=
AB, XI = A 2 B 3 , .. . ,X, = A2"B3",x , + ~= a2").
-=
Thus for no constant C do we have l x i l C(2" + 1) for 0 I i I n and n arbitrary. Consequently, G is an example of a TOL system for which the linear erasing property does not hold. ETOL systems are defined from TOL systems by adding the facility of nonterminal symbols to the latter. Definition. An ETOL system is a 4-tuple G = (C,H , w, A) where U ( G ) = (C,H , o)is a TOL system (called the underlying system o f G ) and A s C (A is
called the terminal or target alphabet of G).The language ofG, denoted L(G),is defined by L(G) = L(U(G))n A*. We carry over all the notation and terminology of TOL and EOL systems, appropriately modified when necessary, to ETOL systems. Also we term a language K an ETOL language if there exists an ETOL system G such that L(G) = K . CTOL and HTOL systems and languages are defined analogously as in connection with OL.
For the ETOL system G = (C,H,o,A) with
ExumplLI 1.6.
C = { S , A, B, C , D, F , a, b, C, d } , A = {a, b, C, d } , w = S, and H = { h l , h2, h 3 , h4}
where h l is defined by the set of productions IS
--f
AC, A
u {x
-+
-+
uAb, A
+
aBb, C + Cc, B
X I X E {a, b, c, 41,
+
F, D
+
F, F
+
F)
v
236
SEVERAL FINITE SUBSTITUTIONS ITERATED
h, is defined by the set of productions ( S + F , B + A, B + Bb, C + A, A v { x x l x {a, ~ b, c, d } } , h3 is defined by the set of productions
+
F, D
+
F, F
+F}
+
{ S + DC, D .+ aD, D + aDd, C + Cc, A u { x + X ~ X E(u, b, c, d } } ,
+
F, B
+
F, F
+
F}
and h, is defined by the set of productions { S + F , C + A , D + A, A + F , B + F , F + F } u { x + x l x ~ { a , b , c , d } } ,
we have L(G) = {a"b"c"lm 2 n 2 l} v {a"d"c"ln 2 m 2 0). A OL system is a TOL system that has only one table. We have seen (Example 1.4) that TOL systems with only two tables can generate languages that are not OL languages. As a matter of fact one can prove that adding a number of
tables yields an infinite hierarchy of subclasses of the class of TOL languages (see Exercise 1.2). It is not difficult to see (Exercise IV.1.2) that there exists an ETOL system (even a deterministic one) with only two tables that generates a language that is not an EOL language. However, as opposed to the TOL case, addingmore(than two) tables to ETOL systemsdoes not increase the language generating power of the resulting class of systems. We shall show now that every ETOL language can be generated by an ETOL system with only two tables. This result when contrasted with the above-mentioned result on the infinite hierarchy of subclasses of Y(T0L) sheds light on the role nonterminals play in ETOL systems. Theorem 1.3. There exists an algorithm that, given an ETOL system C. produces an equivalent ETOL system G = (Z, H , ( I ) , A) such that # H = 2.
Prohfi Let G = (Z, R, W,A) be an ETOL system with 17 = {hl,. . . , h,,}. Let C = { [ a , i ] l a ~ €and 1 I i I r } u Z, and let H = { h l , h 2 } where hl is the finite substitution on Z* defined by hl(a) = { [ a , l]} for a E Z , h l ( [ a ,il) = { [ a , i l]} for a E C , h l ( [ a ,r l ) = { [ a , 1 3 ) for a E C,
+
1 I i I r - 1,
and h , is the finite substitution on Z* defined by h,(a) = { a } for U E Z and h2([a,i ] ) = h,(a) for 1 I i Ir and Let G = (Z, H,W,A).
UEC.
1
237
BASICS ABOUT TOI. AND ETOL SYSTEMS
c’
Thus the table h , rewrites a string x over into the string x(,) resulting from x by replacing every letter a in it by [a, 13; then x(,) is rewritten by h , as the string x ( , )resulting from x by replacing every letter a in it by [a, 23, etc. In this way we get x
- hi
hi = x(2) ’ . . hi
X(,)
Then at any moment of time table h, can be applied, and it rewrites .x(,.) as y if and only if hi rewrites x as y . By repeating the above cycle we can simulate any derivation in G. Also, it is obvious that L(G) E L(G) and so the result holds. 0 , Although ETOL systems with only two tables suffice to generate any ETOL language, one often uses more tables because that allows one to “organize” computations in a given ETOL system in a “useful” way, where useful can mean transparent or useful for proving various properties of the system. Manipulating tables in ETOL systems allows one to obtain for ETOL systems various normal form results that are then used to prove properties of the class of ETOL languages. The following result demonstrates a particularily useful normal form for the class of ETOL systems. Theorem 1.4. There exists an algorithm that given any ETOL system produces an equivalent EPTOL system G = (Z, H , w, A) such that w is in Z\A and there exists a symbol R in Z\(A v (0))(called the rejection symbol) and tables hl and hT in H (called the initial table and the terminal table, respectively) that satisfy the.following conditions:
(i) Ifcr E h,(w), then ct E (Z\(A v {w})).I f a # w, then h,(a) = { a } . (ii) I ~ u E Z \ ( Au {w, R})andcrEhT(a),theno!EAu( R } . I ~ U E A U {w,R}, then hT(a) = { a } . (iii) Let h E H\{h,, h T } . I f u E Z\(A v (0, R } ) and C I Eh(a), then a € (Z\(A v {w, R } ) ) + .I f a E A u {w, R } , then h(a) = { a } . Proof: Let Go = (Zo, H o , wo, A) be an ETOL system. (Assume L(Go) # result trivially holds.) First, using a method completely analogous to that from the proof of Theorem 11.2.1 (perform the construction presented there for any table of Go), we obtain an EPTOL system G I = (Z,, H,,Q , , A) equivalent to Go. Let A = { L I J u E A } and let cp: C: + (@,\A) u A)* be the homomorphism defined by cp(a) = a for u E Z \ A and cp(a) = a for a E A. Let w 2 , R be two new symbols different from each other, w 2 , R $ Z1 v A, and let Z, = C, u A u { m 2 ,R } . Let h, be the finite substitution on Z: defined by h l ( 0 2 )= { o J ~ } and h,(u) = { u } for every a in I;, u A u { R } . Let hT be the finite substitution on Z: defined by hT((I) = { a } for U E A , hT(U) = { R } for a e Z 2 \ (A v A u {(u2,R } ) , and hT(a) = { a } for U E A u {w,, R } .
0; otherwise the
,
238
v
SEVERAL FINITE SUBSTITUTIONS ITERATED
Let for each h from H,,6 be the finite substitution on X; defined by h(a) = { c p ( a ) I a ~ h ( a )for ) a E C , \ A , h(G) = { c p ( c r ) I ~ t ~ h ( afor ) } a E A , and h(a) = { a } for a E A u { R , w2}. Finally, let G = (C,H , w, A) be the EPTOL system defined by C = X 2 , H = {h,, h T } u { h l h E H , } , and w = w 2 . It is easy to see that L(Go) = L ( H ) and H satisfies conditions (i)-(iii) of the statement of the theorem. 0 Clearly we may assume that an ETOL system satisfying the statement of the above theorem has only one rejection symbol. Also, if we consider an ETOL system (X,H , a), A) where o E X\A, then we often use the letter S to denote the axiom of the system. The usefulness of the above theorem stems from the following result, which although not always explicitly mentioned is used very often whenever ETOL systems satisfying the statement of Theorem 1.4 are considered. Since this result is very easy to prove, we leave its proof to the reader.
Lemma 1.5. Let G = (C,H , o,A) be an EPTOL system satisfying the conclusion of Theorem 1.4. (i) If x E L(G), then in each derivation of x in G, the,frrst tuble used is the initial table and the last table used is the terminal table. Furthermore, there exists a derivation of x in G such that both the initial and the terminal tubles are used in this derivation exactly once. (ii) Let x E E ' and (o= x o , x , , . . . , x, = x ) be the trace oj'a derivation of x in G. Let io be the minimal element from (0, . . . , n } ( i f i t exists) such that xio contains an occurrence of a symbol from A u { R } , where R is the rejection symbol. Then xioE (A u {R})' and x j = xiofor io 5 j 5 n. Thus, when an ETOL system G = (C, H , o,A) satisfies the conclusion of Theorem 1.4, it has a property that a synchronized EOL system also has: if x E L(G), ( x o ,x , , . . . , x , = x ) is the trace of a derivation of x in G, and io is the minimal element from (0,. . . , n } such that xi,, contains an occurrence of a symbol from A, then xioE A*. However, the difference with a synchronized EOL system is that once a string x in L(G) is derived in an ETOL system G satisfying the conclusion of Theorem 1.4, then in whatever way we continue this derivation in G, x will be rewritten only as x. That this is possible is due solely to the fact that, as opposed to EOL systems, we can use several tables. As a matter of fact one can prove that if G is an EOL system (C, h, S , A) such that, for every a in A, a E h(a), then L(G) is context-free; thus such systems generate only a subclass of the class of EOL languages (see Exercise 11.1.12). The notion of a synchronized ETOL system is completely analogous to the notion of a synchronized EOL system.
1
BASICS ABOUT T(I1. AND ETOL SYSTEMS
239
If G = (Z, H , (0,A) is an ETOL system, then it is called Dejnirion. .s)nchronix~rlif and only if for every symbol u in A and every string x in C* if u
A- .Y, then .Y 4 A*.
Now, based on Theorem 1.4,we can easily prove that every ETOL language can be generated by a synchronized ETOL system. Indeed, our next result is even a more general one. Theorem 1.6. There exists an ulyorithm thut, given any ETOL system, produces un equivrilent EPTOL system G = (C,H , w, A) such that
(I) w~z\A; ( 2 ) there exists a symbol F in Z\(A u { w } )such that, for every a in A und every h in H , h(u) = { F } and h(F) = { F } ; (3) ,for every u in C and every h in H , zfci E h(a), then either ci E A i or ci = F or ci E (I\( A u { F, tr) 1)) '. Proof: Let Go be an ETOL system. (Assume L(Go) # @; otherwise the result trivially holds). By Theorem 1.4we know that there exists an EPTOL system G I = (El, H 1 ,wlr A) satisfying the conclusion of Theorem 1.4 such that L ( G , ) = L(G,). Let us now change each table h in H 1 in such a way that we replace each production a -+ a in h where a E A u { w } by the production a 4 R where R is the rejection symbol of G1.Let G be the EPTOL system we obtain in this way. Obviously, L(G) = L(G,) = L(Go);and if we set R = F, then the result holds. 0
Again we call F a synchronization symbol of G . Clearly we can always assume that G has only one synchronization symbol. The class ofOL languages is not closed with respect to most of the operations considered in formal language theory. In particular, it is not closed with respect to AFL operations, which was shown by Theorem 11.1.5.If we now extend OL systems by allowing several (rather than one) finite substitutions, then we get the class of TOL systems. Although, as we have seen, they generate more languages than OL systems, the class of TOL languages is also not closed with respect to any of the AFL operations. If we extend OL systems by allowing nonterminal symbols, then we get the class of EOL systems. They generatc inorc languages than OL systems and the class of EOL languages is closcd with icsptxt to a11 AFL operations with the exception of inverse homomorphism (see Theorems I I. 1.8 and 11.4.7). Now we shall show that the class of ETOL languages is closed under all AFL operations. This result nicely illustrates the role nonterminals and tables play together. Moreover, the proof of our next result illustrates the usefulness of the norrrd form for ETOL systems expressed by Theorem 1.4.
v
240 Theorem 1.7.
(i) (ii) (iii) (iv) (v) (vi)
SEVERAL FINITE SUBSTITUTIONS ITERATED
The class of ETOL languages is closed with respect to
union, concatenation, the cross operator, intersection with regular languages, homomorphism, and inverse homomorphism ;
hence it is an AFL. Prooc Let K , , K , be two ETOL languages. Let G, = (C,, H , , S , , A , ) and G, = (C,,H , , S , , A,) be ETOL systems such that K , = L(G,) and K , = L(G,). By Theorem 1.4 we may assume that both G1 and G 2 satisfy the conclusion of Theorem 1.4. We may also assume without loss of generality that @ , \ A , ) n C, = 0 and C, n @,\A2) = 0. Let S be a new symbol, S + C , UC,.
(i) Let C = C, u C, u { S } and let ho be the finite substitution on C* defined by h,(a) = {a} for a E C, u C, and h,(S) = { S , , S , } . For h in H , , let h be the finite substitution on C*defined by h(a) = h(a) for a E C, and h(a) = {a) for a E C\C,;and for h in H 2 ,let h be the finite substitution on C*defined by &(a) = h(a) for a E C, and h(a) = {a} for a E C\C2. Then let G = (C, H , S , A, u A,) be the ETOL system where H = {h,} u { h l h ~ ~u {, }& ( h ~ ~ , } . C l e a r l y=~L(G,)uL(G,). (~) (ii) Let C = C,u C, u { S } ,let h, be the finite substitution on C*defined by ho(a) = {a}for a E C1 u C, and h,(S) = {S1S2},and let h (for h in H , ) and & (for h in H , ) be defined as in (i). Then let G = (C, H , S , A, u A,) be the ETOL system defined as in (i). Clearly, L(G) = L ( G , ) . L(G2). (iii) Let C = C, u { S } and let ho be the finite substitution on C* defined by ho(a) = { a } for a E C,and h,(S) = { S , S2, S , } . For h in H , , let h be the finite substitution on C* defined by h(a) = h(a) for a E C, and h(S) = { S } . Then let G = (C,H , S , A,) be the ETOL system where H = {h,} u { h l h H~ , } . Clearly, L(G) = ( L ( G , ) ) + . (iv) Let M = ( V , Q , 6 , 4inrF ) be a finite automaton. Let 0 = { [q, a, 41 14, ~ E and Q U E C , } , let R be a new symbol, R + @ u C 1 u { S } , and let C = 0 u A, u { R , S}. For h in H1,let h be the finite substitution on C* defined by J;([43a, GI) = {Cq,al,qill[Iqil,a2,qi,I...Cqi ,_l,~n,GIIa,~,...~n~h(a) and 4i1, . . * qi,- I E Q} 9
for [4, a, q] in 0, h(S) = { C L ~ ~ , S, ., , 4 3 1 2 j ~F } ,
and
h(a) = { a ) for U E A , u { R ) .
1
241
BASICS ABOUT 'I OL AND ETOL SYSTEMS
Let hfi, be the finite substitution on C* defined by hfin(Cq,
a, 41) =
if U E I/ n A, otherwise
{a}
{R}
and
6(q, a) = q,
for [q, a, 41 in 0, and
hfi,(u)
=
for a in C \ 0 .
{R)
Then let G = (C,H , S, A1 n V ) be the ETOL system where H = {hfln}u { h I h ~ H ~ } . C l e a r l y , L (= G )L ( G , ) n L ( M ) . (v) Let cp: AT -+ 0* be a homomorphism and let C = ( C l \ A l ) u 0. For the terminal table hT, let hTbe the finite substitution on Z* defined by hT(a) = { c p ( u ) l u ~ h ~ and ( a ) ~ E A u~ { R } }for a € C 1 \ A l and hT(a) = { a } for U E ~ where R is the rejection symbol of G,. For a table h from H I different from h T , let h be the finite substitution on C* defined by @a) = h(u) for u E Cl\Al and h(a) = { a } for a E 0. Then let G = (C,R, S , , 0) be the ETOL system where R = {hlh E H , } . Clearly L(G) = (p(L(G,)). (vi) Let A be an alphabet and let cp: A* -+ AT be a homomorphism (we may Let K G (A u A,)* be defined by assume that A n C1 = 0). K =
{aE (A U A l ) * 14' = 20x1ZlX 2 Z 2 .XI, . . . , xk E
A1 and
20,
* * *
Zk where xlxz . . X k E L(Gl), A*}.
Xk
Zl,. . . , Zk E
Let C = C 1 u A and let h, be the finite substitution on C* defined by h,(a) = { x a y l x , y ~ A u{A}}foraEA,andh,(a) = {a}foraE(C1\A1)uA.Let,for each h in H , , h be the finite substitution on C* defined by h(a) = /?(a)for L I EE l and h(u) = { a } for a E A. = Then let G = (C, R, S1, A , u A) be the ETOL system where {h,) u { h l h ~ H , }It. is easy to see that L(G) = K , and so K is an ETOL language. Let M G (A u A,)* be the language defined by M
=
{cp(yI)y1cp(y2)y2 . . . cp(y,,)y,,In 2 1 and ~ , E for A 1 I i I n}.
Obviously, M is a regular language. Clearly, K nM
=
{ ' P ( . Y ~ ) Y I ( P ( Y ~ ) Y"~' d Y n ) Y n I Y i e A
for I I i I n and cp(y,). . . cp(yn) E L(Gl)}. Consequently, $ ( K n M ) = cp-'(L(G,)) where homomorphism defined by a A
tj:
if U E A , ifaEA,.
(A u A,)*
-, A
is the
,
v
242
SEVERAL FINITE SUBSTITUTIONS ITERATED
Since K is an ETOL language and M is regular, (iv) implies that K n M is an ETOL language, which by (v) yields that q - ’ ( L ( G , ) )= $ ( K n M ) is an ETOL language. 0 Remark. Following the proof of the above theorem the reader can easily prove that the class of EDTOL languages is closed with respect to all AFL operations except for inverse homomorphism (see Exercise IV.3.2).
Analogously to the case ofOL systems, we shall now show that the mechanism of nonterminals and the coding mechanism are equivalent when applied to TOL systems. Theorem 1.8.
Y(ET0L)
=
Y(CT0L).
Prooj:
(i) U(CT0L) c Y(ET0L) follows from Theorem 1.7(v). (ii) To prove that Y(ET0L) c Y(CT0L) we proceed in two steps. First, we prove that every ETOL language is a homomorphic image of a TOL language; then to reduce “homomorphic image” to “the image under a coding” we refer the reader to the final part of the proof of Theorem 11.2.2;the proof for ETOL case can be done completely analogously. To show that every ETOL language is a homomorphic image of a TOL language we proceed as follows. Let G = (C, H , S , A) be an ETOL system generating a nonempty language and let us assume that it satisfies the conclusion of Theorem 1.4. If 0 E C is such that there exist words x,y with Y E L(G) for which S x y and alph x = 0,then we call 0 a useful alphabet ( i n G ) . Note that by our assumptions on G if 0 is a useful alphabet, then either 0 n A = 0or 0 c A. We let us G to denote the set of useful alphabets of G. For O,, 0, in us G and h in H , we say that 0 , h-precedes O,, written as 0 , % 0, if, for every a in 0 h(a) n 0: # 0. Let E = {[a, 01 I 0 E us G and a E 0 )and let, for each 0 in us G, ‘po be the homomorphism on 0* defined by cp,(a) = [ a , 01 for every a in 0.Then, for every a,, 0, in u s G and for every I? in H such that 0 , % 02, we define hB1.B2to be the finite substitution on E defined by
,,
and
243
EXERCISES
Let G = (E, B, [ S , { S ] ] ) be the TOL system where H = ( h , , . , , , ( h E H , 0 , ,0, E u s G and 0 , G2}.Furthermore, let, for each 0 in u s G such that 0 is not a subset of A, m,.,be a fixed integer such that x $ L y for some y E L(G) and .Y such that irlph Y = 0.Then let, for each a in 0,rep,, a be a fixed word over A' such that a rep, a. Finally, let $ be the homomorphism on Z'' defined by $([a, 0 1 ) = repe a for a E 0 where 0 is not a subset of A and $([a, 01) = a for a E 0, 0 E A. It should be clear that indeed L(G) = $(L(G)),and so the theorem holds.
0
Exercises 1.1. Given a TOL system G estimate a constant C such that if a letter from G can derive the empty word, then it can do so in no more than C steps. 1.2. Let G = (C, H , w ) be a TOL system. The degree ofsynchronization ofG, denoted syn G, is defined by syn G = # H . The degree of nondeterminism of G, denoted ndet G, is defined by ndet G = max{ #h(a)I h E H and a E C}.Prove that for every pair of positive integers k and 1 there exists a finite TOL language K such that if G is a TOL system and L(G) = K , then syn G 2 k and ndet G 2 1. (Cf. [Rl].) 1.3. An FTOL system differsfrom a TOL system only in that a finite number of axioms (rather than only one) is allowed. Prove that the family of languages generated by FTOL systems (called FTOL languages) is an anti-AFL. (Cf. CRLlI.1 1.4. Prove that every FTOL language is a finite union ofTOL languages and that there exist finite unions of OL languages that are not FTOL languages. (Cf. [RLl].) 1.5. Show that it is decidable whether or not an arbitrary ETOL system generates a finite language. 1.6. Show that, given an arbitrary ETOL system G and an arbitrary positive integer k , it is decidable whether or not L(G) contains a word longer than k.
1.7. Let G = (C, H , S, A) be an ETOL system such that, for every a in C and every h in H , u E h(u). Prove that L(G) is a context-free'language. (Cf. [R2].) 1.8. Prove that Y(EDT0L)
5 Y(ET0L).
244
v
SEVERAL FINITE SUBSTITUTIONS ITERATED
1.9. A TOL scheme is an ordered pair T = (C, H ) where C is a finite alphabet and H is a finite set of finite substitutions on C*. Given K , G C*and K 2 G C*, the ( T , K , , K,)-control language is the set
cont(T, K , , K , ) = {TEH*IT(K,)n K 2 #
a}.
A language K is called a control language with a regular target if K = cont(T, K 1 , K 2 ) for a TOL scheme T , a language K 1 , and a regular language K 2 , Prove the following result. A language K is the image under a bijective homomorphism of a control language with a regular target if and only if K is a regular language. Moreover, this result is effective in the sense that (i) there exists an algorithm that, given a TOL scheme T , a nondeterministic finite automaton M , a language K , for which it is decidable whether or not the intersection of K , with an arbitrary regular language is empty, and a bijective homomorphism cp constructs a nondeterministic finite automaton R such that L ( M ) = cp(cont(T,K , , L ( M ) ) ;and (ii) there exists an algorithm that, given a nondeterministic finite automaton M , constructs a TOL scheme T , words x,y , and a bijective homomorphism cp such that L ( M ) = cp(cont(T,{x}, { y } ) ) .(Cf. [GR]; observe how this result generalizes Theorem 11.1.6.) 1.10. For each finite alphabet C let HOM(C) be the set of all homomorphisms from C* into C* and let FSUB(C) be the set of all substitutions from C* into finite nonempty subsets of C*. Prove that, given a finite alphabet C, there is no TOL scheme T = (C,H ) such that HOM(C) E H* (FSUB(C) G H*). (Cf. [GR].) 1.11. (analogous to Exercise 11.59) A unary TOL system, in short a TUL system, is a TOL system with just one letter in the alphabet. Prove that the TUL-ness problem is decidable for regular languages, and so are the regularity and OL-nessproblems for TUL languages. Prove that the equivalence problem between TUL and OL languages, as well as the equivalence problem between TUL languages and regular languages, are decidable. Consult [La I] and [La21. 1.12. Generalize the result mentioned in Exercise 111.1.3 by showing that the homomorphism equality problem is decidable for ETOL languages over { a , b}.Consult [CR]. For arbitrary ETOL languages, the decidability status of this problem is open. 1.13. Define the notion of an ETOL form, as well as the corresponding notion of completeness. Prove that the ETOL form determined by the two tables [ S + a, s + s, s + ss, a + S], [ S + s, a + S ]
is complete. For general results about completeness and vompleteness, consult [MSW3] and [Sk2].
2
COMBINATORIAL PROPERTIES OF ETOL LANGUAGES
245
2. COMBINATORIAL PROPERTIES OF ETOL
LANGUAGES In this section we are going to investigate combinatorial properties of ETOL languages. Hence, symmetrically to the cases of EOL and EDTOL languages, we are looking for a property P such that if a language K is an ETOL language, then K must satisfy P . Results of such a form allow one to construct languages that are not ETOL languages. First, we shall show an example of a result providing for ETOL languages a combinatorial property which we prove “directly” by investigating the structure of derivations in (synchronized) ETOL systems. Then we shall present a result that is an example of“ bridging”(non) EDTOL languages with (non) ETOL languages: given any language that is not an EDTOL language, one can “construct” languages that are not ETOL languages. Then, the rest of this section will be concerned with the relationship between EDTOL and ETOL languages. We start with a condition necessary for a language to be an ETOL language. Theorem 2.1. Let K be an ETOLlanguage over an alphabet A. Then for every A, G A, A, # 521, there exists u positive integer k such that, for every x in K , either (i) # A , ~ I1, or (ii) x contains a subword w such that 1 w I 5 k and # A1x 2 2, (iii) there exists an in$nire subset M of K such that, for every y in M , or # Aly = # A l x . Proof. Since the above theorem trivially holds whenever K is finite, let us assume that K is infinite. Let G = (Z, H, S, A) be an ETOL system generating K ; we assume that G satisfies the conclusion of Theorem 1.6, and F is the synchronization symbol of G . Let = A u { F , S} u { [ a , t] la E Z\(A u { F } ) and t E {O, 1, 2}} where S is a new symbol. Let, for every h in H, h be the finite substitution on Z*defined by h(S) = { [ S , 01, [ S , 11, [ S , 2]}, h(a) = { F } for every a in A u { F } ; and for a E Z\(A u { F } ) :
c
I;([u,01) = { F } u { a E A’ 1 ~ E1 h(a) and # Ala= 0) u { [ b , ,01 . . . [ b , , 01 I b , , . . . ,b, E X\(A u { F } ) and b l . . . b, E h(a)},
h([a, I])
{ F } u { c c ~ A + l a ~ h ( a ) a#nAd l a = 1) ’ [b,, t,] Ib,, . . . , b, E Z\(A u { F } ) , b , . . . h, E h(a) u { [ h i ,~ 1 [ b 1 , , 123 and for some j E { 1, . . . ,r } , t j = 1 and t , = 0 for 1 # j } , =
h(Ca.21) = { F } u { a ~ A ’ ~ a ~ h ( c r ) a# n& d, a > 1) u{[bi,t,][b~,t~]~..[b,,t,]Ib,,...,b,E~\(A~{F}),bl~.~b,Eh(a) and either for some j E { 1,. . . , r } , t j = 2, orforsomej,,j2E{1,..., r } , j l # j z , t j , = t j , = l}.
v
246
SEVERAL FINITE SUBSTITUTIONS ITERATED
Finally, let G = (Z, H , S, A) be the ETOL system where 17 = { h l h E H } . Note that G results from G by attaching to each letter a from X\(A u { F } ) an index 0, 1, or 2 (resulting in the letter [a, 01, [a, 11, or [a, 21, respectively). If [a, i] occurs in a successful derivation in G, then the corresponding (occurrence of a) letter in the corresponding derivation in G will contribute to the result of this derivation (in C) no occurrence of a letter from A 1 if i = 0, one occurrence of a letter from A, if i = 1, and at least two occurrences of letters from A1 if i = 2. Then it is easy to see that L(C) = L(G). Let us analyze derivations in C.Ifaderivation in G starts with the production S + [ S , 01 or with the production S + [ S , 13, then the result of this derivation will satisfy condition (i) of the statement of the theorem. Thus let us assume that the first step of a derivation D in C uses production S [ S , 21. Letfirace D = ( ( ~ 0go), , (XI,gl), . . . , (Xm- 1, g m - I), xm = X) and let i be the largest integer such that xi contains an occurrence of a type 2 letter (it is a letter of the form [a, 23). We have two cases to consider. +
+
(1) Thereexist r,sin {i 1, . . . , m - 1) such that alph x, = alph x,, s > r, and an occurrence of a letter (say c ) in x, contributes to x, a word of the form acp with ap # A. Then, for every n 2 1, we change the derivation D to the derivation D(,) constructed as follows. First, we use the sequence of tables go . . 9,- in precisely the same way as in D; thus we get x,. Then to x, we apply the sequence of tables (9,. . . 9,- 1>" in such a way that each occurrence of a letter, except for the given occurrence of c, contributes on each iteration of g r . . . gs- a maximal in length word that an occurrence of this letter contributes from x, to x, in D ;and the given occurrence of c is rewritten in such a way that in each iteration of g, . . . g,- it contributes acp. In this way after applying (gr . . . g, I)n we obtain a word z,,. Finally, we apply g,.. . g m - to z, in such a way that each occurrence of a letter in z, is rewritten in such a way that it contributes a word of maximal length that was obtained from the corresponding letter in x, when x, is rewritten by g,. . . g m - in D. Thus, the control word of D(,,, is go . . . g,- l(g,. . . 9,- Jg,. . .g m - and I = lpreshl x I. From our assumption on r, s it follows clearly I presA,(resD,,,) that, for n > 1, 1x1 < Ires D(,,)l < Ires D("+,)l. Consequently, if (1) holds, then condition (iii) of the statement of the theorem holds. (2) There do not exist r, s in {i 1 , . . . ,rn - l } such that alph x, = alph x,, s > r, and x,contains an occurrence o f a letter (say c) that contributes to x, a word of the form acp with a/? # A. Let us consider an occurrence of a letter of type 2 ([a, 21 say) in xi. We shall show that its contribution to xm = x is not longer than a certain constant dependent only on G. Let E be a subderivation tree rooted at the given occurrence of [u, 21 in xi. +
,
,
~
,,
+
2
COMBINATORIAL PROPERTIES OF ETOL LANGUAGES
241
Let us relabel it in such a way that each node in it with a label d gets relabeled by ((1, alph xj) where the node corresponds to the occurrence of d in the j Im - 1). In this way we get the tree E with the root word .xj from D ( i I labeled by ( [ a , 21, alph x i ) which satisfies the following condition: (2.1) if e , , e 2 , .. . , c , , r 2 2, is a path in the tree with el closer to the root than r , such that labels of e l and e, are equal, then each of the nodes el, r 2 , .. . , e , _ has out-degree equal 1. Now we shall prove a property oftrees satisfying (2.1); this property will allow us to conclude the proof of the theorem. Cluim. Let T be a tree satisfying property (2.1). Let T be such that it uses q labels and the out-degree of every node in T is bounded by p . Then the number of leaves of T is bounded by pq. Proqfoj'the claim. By induction on q. q = 1. The result is obvious. Let us assume that the claim holds for all trees satisfying (2.1) and using no more than k labels. q = k + 1. Let c bc the label of the root of T . If c does not label any other node of T , then by the inductive assumption the number of leaves in T is bounded by ppk = p k ' = P . If c also labels another node in T , then let e,, el, . . . , e, be the longest path in T such that e , is the root and e,, e, have the same label c. Then, because of (2.1), T must be of the form shown in Figure 2, where the tree Trooted at e, is such that no node of it except e, is labeled by c. But then again (by the inductive assumption) p q bounds the number of leaves in T and hence in T. Thus the claim holds.
I I
I I I
eo el
FIGIJRI 2
248
v
SEVERAL FINITE SUBSTITUTIONS ITERATED
However, our construction of E from E implies that E does not use more than q = # Y . 2 # ' labels and the out-degree of every node in E is bounded by p = max{ I c1 I I there exist h in R and a in Z such that c1 E &a)}. Consequently, the claim implies that if we set k = p4 with p , q as above, then condition (ii) of the statement of the theorem holds. This completes the proof of the theorem. 0 As a direct application of Theorem 2.1 we can demonstrate the following example of a language that is not an ETOL language. Corollary 2.2. language.
Let K = {(ab")"Im 2 n 2 l}. Then K is not an ETOL
Proofi Let A = {a, b } and Al = {a}.Consider conditions (i)-(iii) from the statement of Theorem 2.1 and let us check them for words of the form (ab")", m 2 n 2 1 with rn 2 2. Then (i) obviously does not hold. Moreover, for every positive integer k words of the form ( a b k + ' ) k +do l not satisfy (ii). Finally, for every word x in K , the set of words y in K such that # A l =~ # .,y is finite, so (iii) does not hold. Consequently, Theorem 2.1 implies that K is not an ETOL language. 0 To show another application of Theorem 2.1 we need the following definition. Definition. Let K be a nonempty language over an alphabet A and let 0 be a nonempty subset of A. We say that 0 is clustered in K if there exist positive integer constants n, m 2 2 such that, for every word x in K such that # @ x 2 n, there exists a subword y of x such that #,y 2 2 and lyl Im.
Example 2./. Let K = {(aba2)2rlr2 0 ) . Then both { a } and { b } are clustered in K (take n = m = 2 and n = 2, m = 5, respectively). Exarnple 2.2. Let K = {x E {a, b}' neither { a }nor { b } are clustered in K .
I #,
x = 2' for some r 2 O}. Then
Theorem 2.3. Let K be an ETOL language over an alphabet A and let A1, A2 be a partition of A. If there exists afunction cp from nonnegative integers into nonnegative integers such that, for every x in K , # A 2 <~ cp( # A I ~ ) ,then A1 is clustered in K .
Proof The existence of such a function cp implies that, for every x in K , the set of all words y such that # Aly= # A l is~ finite. Then K must satisfy either condition (i) or condition (ii) of the statement of Theorem 2.1, which implies that A1 is clustered in K . 0
2
249
COMBINATORIAL PROPERTIES OF ETOL LANGUAGES
In particular, the above result yields the following example of a language that is not an ETOL language. Corollary 2.4.
K
=
WE{^, ! ~ } * l # ~=w2~ax}isnotanETOLlunguage.
Prooj: If we take A = {a, h } , A , = { a } , A, = { b } , and cp defined by q ( n ) = 2" 1, then if K were an ETOL language, then { a } must be clustered in K. However, { a } is not clustered in K, and so K is not an ETOL language.
+
0 For our next application of Theorem 2.1, we first need a definition. Definition. Let K be a nonempty language over an alphabet A and let Al, A, be a partition of A. We say that A , , A, ure K-equivalent iffor every x, y in K, the following holds:
if and only if
# A,x = # AJ
#A
2
=~ # A
2 ~ .
Exutnple 2.3. Let K = {XE {a, b}+I # , x = 2" and # b x = 3" for some n 2 0). Then { u } , { h } are K-equivalent. As a direct corollary of Theorem 2.1 we get the following result.
Theorem 2.5. Let K be an ETOL language over an alphabet A and let A,, A, be u partition of A. I j A l , A, are K-equivalent, then both A, and A, are clustered in K. Thus, in particular, we get the following language which is not an ETOL language. Let K be the languagefrom Example 2.3. Obviously neither Corollary 2.6. { a }nor { b }are clustered in K, but { a } ,{ b }are K-equivalent. Thus Theorem 2.5 implies that K is not an ETOL lunguage. One of the operations considered in formal language theory is the shuffle operation defined as follows. Definition. Let K , , K, be languages over alphabets A , and A,, respectively. The shufle of K and K,, denoted as K, IK , , is defined by
,
K1 IK2
=
~ x 1 y 1 x 2 y 2 ~ ~ ~ x2 r . v1,rx, l, ,J..., r x,EAT, y l , . . . ,y , A~T , x l x , "'x, E K , and y , . . . y, E K,}.
v
250
Let K ,
Exumple2.4.
K 1 IK 2 =
{XE
=
SEVERAL FINITE SUBSTITUTIONS ITERATED
{az"lii 2 0) and K 2
{a, b}*l #,x
=
=
{h3"ln 2 0). Then
2" and # b . x = 3" for some n, m 2 0).
Although we have seen that the class of ETOL languages is closed under all AFL operations, it is not closed under the shuffle operation, as shown next. Theorem 2.7. shufle operation.
The class of E TOL languages is not closed with respect to
Proof: As a matter of fact, we shall demonstrate even a stronger result: there exist DOL languages K , , K , such that K , IK 2 is not an ETOL language. Take K , = {a2"b3"In2 0) and K , = {b3"a2"ln2 O}, and let K = K , I K , . Obviously, { a } ,{ b }are K-equivalent; but since { a }is not clustered in K , Theorem 2.5 implies that K is not an ETOL language. 0 Beside proving directly results that characterize the structure of languages from a given class of languages one can provide a sort of " bridge" result. These results will be of the form: if K is not in class X, then cp(K) is not in class Y where cp is some function from languages to languages. Provided one has a method for proving that some languages are not in X , such a result is indeed useful for proving that some languages are not in Y. An example of such a "bridging result" is given next. This result will allow us to use examples of languages that are not EDTOL languages to construct examples of languages that are not ETOL languages. We shall need two lemmas first. With each ETOL system there is a "naturally" associated EDTOL system which is defined as follows. Definition. Let G = (C,H , S, A) be an ETOL system. The EDTOL system G = (X,H , S, A) with
H
=
{ hI h is a homomorphism on C* and there exists h in H such that h G h }
is called the combinatorially complete version ofG and is denoted by ussoc G . For each h in H , we use det h to denote the set { hI h is a homomorphism on C* such that h G h}. The following result follows directly from the above definition. Lemma 2.8. I f G is the combinarorially complete version of G, then L(G) E L(G). Also, L(G) is infinite if and only if L(G) is injnite.
2
251
COMBINATORIAL PROPERTIES OF ETOL LANGUAGES
Let G = (C, H , ( c ) ) be a TOL system, cp a homomorphism from Z*into A*, and h E Z.We say that b is (G, q)-nondeterminisric if (i) there exist words x l , x 2 , x3 in Z*such that x l b x 2 b x 3E L(G) and (ii) there exist T in H* and y l , y , in s(b) such that cp(yl) # cp(y2).
We say that G is cp-deterministic if Zdoes not contain (G, cp)-nondeterministic letters. Lemma 2.9. Let G be a TOL system over nn alphabet Z and let cp be a homomorphism on C*. I f G is cp-deterministic, then there exists a DTOL system G such thut cp(L(G))= cp(L(G)).
Proof: Take G to be the combinatorially complete version of G. From Lemma 2.8 it follows that (p(L(G))G q(L(G)).On the other hand, since G is Thus cp(L(G))= (p(L(G)). cp-deterministic,it is clear that cp(L(G)) c cp(L(c)).
0 Now wecan prove our result bridging together (non) EDTOL languages with (non) ETOL languages. Theorem 2.10. Let A l , A, be two disjoint alphabets. Let K , G AT, K 2 L A; und let j ' be a surjective function from K , onto K 2 . Let K = {wf(w)l w E K 1 ).
(i) 1 f K is un ETOL language, then K 2 is an EDTOL language. (ii) 1f.K is un E7OL lanyuuge cuidf'is bijectiae, then K is also an EDTOL languuge.
,
Proof: Let us assume that K is an ETOL language. Let A = A l u A 2 . By Theorem 1.8 there exist a TOL system G = (Z, H , w ) and a coding cp: Z*-, A* such that K = cp(L(G)).Let cp, be the homomorphism from C* into A* defined by q 2 ( a )= cp(a) if cp(a)E A2 and cp2(a)= A if cp(a) E A l . (1) First, we show that G is cp2-deterministic. To show this we have to demonstrate that for every b in Z whenever x l b x 2 b x 3E L(G) (for some x l , x 2 , x 3 in C*) and T E H*, then, for every y,, y 2 E z(b),we have cp2(yl) = cp2(y2). Since q ( y l ) cannot be in ATA;, we have three cases to consider. (a) c p ( y , ) ~ A T For . every X 1 in ~ ( x , )2, , in T ( x , ) , and X3 in 5(x3),q(X,) c p ( Y 2 ) c p ( X 2 ) c p ( Y l > c p ( ~ ~ ~E) K and so d Y 2 ) E A?. Thus (P2(4'1) = c p 2 ( Y 2 ) = A. (b) cp(yl) E A:. For every X l in T ( x l ) ,X, in r ( x 2 ) ,and F3 in z(x3) and for every i, j in { 1, 2), ~ p ( X ~ ) ~ ( ~ ~ ) ~ p ( ? c ~ ) ~ ( yEi )Kc pwith ( . u 3cp(.Wl) > = z1z2 for some z1 in AT and z2 in A; where f(zl) = z 2 q(~'i)q(R,)~p(y,,)q(~3). Thus q ( y l ) = (Po12) and so c p Z ( l ' 1 ) = (P2(Y2).
v
252
SEVERAL FINITE SUBSTITUTIONS ITERATED
(c) cp(yl) = A. If we assume that cp(y2)E A ; , then, almost repeating the reasoning from (b), we get that cp(y2)= cp(yl), a contradiction. Also, it is clear that cp(y,) cannot be in A:A:. Thus cp(y2)E AT, and consequently cpz(y2) = /I = cp2(Yl).
Together, (a)-(c) imply that G is cp,-deterministic. (2) Now we show that K 2 is an EDTOL language as follows. The function f is an onto function, and so q,(L(G)) = { f ( w ) l wE K , } = K 2 . Thus Lemma 2.9 and (1) imply that there exists a DTOL system G such that q , ( L ( C ) ) = cp2(L(G))= K 2 .Since EDTOLlanguagesareclosed with respect to homomorphisms (see the remark following Theorem 1.7 and Exercise IV.3.2), K 2 is an EDTOL language, which completes the proof of part (i) of the theorem. (3) To prove that K is an EDTOL language (iff is bijective) we proceed as follows. Let fmir be the function from mir K 1into mir K 2 defined byfmir(x)= y if and only iff (mir x ) = mir y. It is clear that fmir is a bijection from rnir K onto rnir K 2 . But
,
,
m i r K = { m i r ( f ( w ) ) m i r w l w E K 1= } {~f;~f(x)Ix~mirK,}.
From (i) it follows that mir K is an EDTOL language. Since obviously the mirror image of an EDTOL language is an EDTOL language, K is an EDTOL language. Thus (ii) holds. 0 Now, using Theorem 2.10, we ciin provide an example of a non ETOL language. Corollary 2.11. Let A 1 = (0, l}, A2 = { a , b } , and let cp be the homomorphism from AT into A; deJned by cp(0) = a and cp(1) = b. Then
K = {xcp(x)lx~AT and 1x1 = 2” for some n 2 0 ) is not an ETOL language.
Proof. If K is an ETOL language, then by Theorem 2.10 the language K 2 = { x E {a, b } * 11x1 = 2“ for some n 2 0} is an EDTOL language, which contradicts Corollary IV.3.4. Thus K is not an ETOL language. 0
In Section IV.3 we have proved that the language K = { x E { a , b}* 11x1 = 2” for some n 2 0) is not an EDTOL language. If we take cp to be the homomorphism from {a, b}* into {a}* defined by cp(a) = q(b) = a, then K = cp- ‘(K1) where K l = {a2”ln2 0). Since K 1 is an EDTOL language (even a DOL language), the class of EDTOL languages is not closed with respect to inverse homomorphism. However, Theorem 1.7(vi) implies that the class of inverse homomorphic mappings of EDTOL languages (denoted 9(H - EDTOL)) is included in the class of ETOL languages. What we are going to d o next is to show some “better” examples of non EDTOL languages than the ones we have
2
COMBINATORIAL PROPERTIES OF ETOL LANGUAGES
253
seen so far. “Better”means here that they are not only outside of Y(EDT0L) but even outside of Y ( H - ‘EDTOL), and still in 2(ETOL). As a matter of fact we provide a method for constructing such examples by “bridging” (non) EDTOL languages with langul-ges that are not in P(H-’EDTOL). Since we shall also show that Y ( H - ‘EDTOL) 5 Y(ET0L) and by the above-mentioned method we shall provide languages in Y(ETOL)\Y(H- ‘EDTOL), this will yield a result essentially different from Theorem 2.10. We start by introducing for homomorphisms a classification that will turn out to be useful for proving our next theorem. Dejinition.
Let cp be a homomorphism from (0, 1}* into (0, 1}*.
(1) cp is a type 1 homomorphism if cp(0) # cp(1); (2) cp is a type 2 homomorphism if I q(0)I = I cp( 1) I ; (3) cp is a type 3 homomorphism if #,,cp(O) = #,cp(l); (4)if cp is a type i and typej homomorphism (and type k homomorphism), then we also say that cp is a type i j ( i j k ) homomorphism. Exunipke 2.5. Let cp(0) = 01 1 and cp(1) = 100. Then 40 is a type 12 homomorphism, but cp is not a type 3 homomorphism.
Exuinpko2.6. Let cp(0) homomorphism.
=
011 and cp(1) = 101. Then cp is a type 123
The following result is obvious. Lemma 2.12. Let cp he u type 12 homomorphism, w E {0, 1)’ and K E {O, l}*. Tliert cp(w) E cp(K) f u n d only i f w ~K .
The following notion of “nontriviality” of a language over (0, l} will be useful in our further considerations. Let K G (0, 1 }*. We say that K is nonexhaustiue if there exist Dejinition. two words w and u over (0, 1 ) such that J W = IuI, w E K , and u # K . Otherwise. K is called exhaustiue. K = {x E (0, 1 } * 1 I x I = 2” for some n 2 0} is an exExumpkt~2.7. haustive language, whereas the language K 2 = { X E {0, 1}*I #,x = 2” for some ti 2 0) is nonexhaustive.
The following sequence of lemmas will lead us to our next theorem. Lemma 2.13. Let cp he a type 123 homomorphism and let K he a nonexhaustitw lunguage over (0, 1 ) . I f cp(K) E Y ( H - ‘EDTOL), then there exists a type 12 homomorphism $ und an EDTOL lunguaye R such that K = $-‘(K).
v
254
SEVERAL FINITE SUBSTITUTIONS ITERATED
Proof: Let M be an EDTOL language and y be a homomorphism such that cp(K) = y - ‘ ( M ) . Let $ = ycp and R = M. (1) K = $-‘(K). IfwEK,thencp(w)Ecp(K) = y-’(R)andsoycp(w)~K. If w E I + - ‘(R),then ycp(w) E R, and so cp(w) E y - ‘ ( R )= Hence K E I + - ‘(K). cp(K). But then by Lemma 2.12 we have that W E K .Hence $ - ‘ ( R )c K . Consequently, K = $-‘(R). (2) $ is a type 12 homomorphism. Since cp is a type 23 homomorphism, #ocp(0) = #ocp(t) and #,cp(O) = # ,cp(l). Thus $ is a type 2 homomorphism (independently of the type of 11). If we assume that $(O) = $( l), then, for every x in (0, 1 }*, the value $(x) depends only on the length ofx. Hence for any two words w and u in (0, I}* such that I w I = I u I either both are in $- ‘ ( R ) or both are not in $- ‘(R).Since K = $ - ‘ ( R )(see (l)), this contradicts the fact that K is nonexhaustive. Consequently, $(O) # $(1) and $ is a type 1 homomorphism. Thus $ is a type 12 homomorphism which proves (2). The lemma follows from (1) and (2). 0
Now we shall present a construction which with every language K and a positive integer I associates the language K(I). Intuitively speaking, the strings in K ( / )are just the strings from K that carry the following additional information: (i) each occurrenceofa letter in a string“knows”its I - 1 right neighbors; and (ii) each occurrence of a letter in a string “knows” its position (“modulo l ” ) from the leftmost element of the string. (To make our notation not too complicated, our counting modulo I is 1,. . . , I rather than 0, . . . , 1 - 1.) Construction.
Let K be a language over A and 1 be a positive integer. Let
g! # A. Let A(/) = { [ a , i, x] 11 I i I I, a E A, x E (A u {$})’- ’}. For a word X = U l . . . ak with k 2 1, a,, . . . , U k E A, let % = b , . . . bk+,- 1 where, for 1 I i I k, hi = ai;and,fork < i I k I - l,bi = g!.Letcp,bethehomomorphism from A(/) into A defined by cpl([a, i, x]) = a. Let cp2 be the homomorphism from A(/) into { 1,. . . , I } defined by cp2([u,i, XI) = i. Let (p3 be the homomorphism from A(/) into (A u {$})* defined by cp3([a, i, XI) := x.
+
Now let trans be the mapping from A* into (A(/))* defined by: (i) trans(A) = A; (ii) if X = a1 “ ’ U k with k 2 1, U 1 , . . . , a k E A, x = bl bk+l-l with b , ,..., b k + , - ’ i n A u {#)andy = cl...c,withcl ,..., c,inA(I),thentrans(x) = 41 if and only if n = k, cp,(y) = x, cp2(y) is a prefix of the infinite word 12. 112.. ./12 .. .and,foreveryjin (1,. . . , k},cp3(cj) = bj+I b j + z.. . b j + , Finally, let K(I) = {trans(x)IxE K } . a
.
+
*
*
’.
2
255
COMBINATORIAL PROPERTIES OF ETOL LANGUAGES
The usefulness of the above construction for us stems from the following result. Lemma 2.14. If'K is an EDTOL kanguugr, tlien,forevery positive integer I , K(1) is u1.w an EDTOL language.
Proqf: By Exercise IV.1.6 we may assume that there exists an EPDTOL system G = (1, H , S, A)such that L(G) = K.Ourconstruction ofan EPDTOL system generating K(/) will be presented in two steps. (1) We shall construct an EPDTOL system G I that will generate the language that ditfers from K only in that each symbol knows what its l - 1 right neighbors are. (We use the symbol $ not in C as an end marker; and we assume that, for each h in H , h(Z) = 6.) Let C , = { [ A , x ] 1 , 4 ~ Cand x ~ ( C u { $ ) ) ' - ' }and A, = { [ u , x ] I u ~ A and x E (A u ($1)'- ). For each h in H , let fi be the homomorphism defined as follows: ifB, . . . BkE h ( A )for A , B , , . . . , B, in C. then, forevery x in(C u { $ } ) I - ',
[ B , , prejl- I ( B 2 B 3 '.'Bkh(x))][B2, Prclfi-l(B3 " ' B k h ( x ) ) l "'[Bk, / m $ - I h ( x ) ] € & [ A , X I ) . Let H I = { h l h H~ } and G I = (C,, H , , [S, $'-I], A,). (2) Now we shall construct an EPDTOL system G, that will generate the language that differs from L(G,) only in that in each string of L(G,) each letter gets an index that tells its position, "modulo I," from the leftmost letter in the string. /} u (S, R } , where Let C, = A, u { [ A , t r,] I A E C , and I I r,, t , I A, = ( [ a , t , x ] I [u, .Y] E A, and 1 I t I I } . Let ho be the finite substitution defined by the productions
,,
{x - x l x E C , \ { s ) } u {S
,.
-
[ [ s , $ ' - ' ] , 1,tlll 5 t I l l .
For each h in H let fi be the finite substitution defined as follows: if B , . . . B, E r,. f , , m , , . . . , m k - ,in ( 1 , . . . , I } ,
& A ) with A , B,, . . . , B k E C l , then, for all
[ B , , f 1, E
1?11] [B2
QrA,
r,,
3
ml,
n12]
' ' '
[Bk-
1.
n?k- 2
9
mk- 1 1 C R k 3 nlk- I , r 2 1
[,I).
Also. for every A in X , ' \ , { [ A , t , , t , ] [ A E X I and 1 I t , , t , I I ) , A h , be the homomorphism defined by the set of productions
+
{S + S) u { [ [ a , x], t , t 1 (mod /)I [a, t , x ] I [ u , x ] E A , } u { X + R 1 X # S a n d X is not of the form [ [ a ,x ] , t , t
Now let H , S, A,).
=
E R(A). Let
+
{der h o } u { h s } u Uhef, dct
+ 1 (mod /)I}.
fi and then let G,
=
(C,, H , ,
256
v
SEVERAL FINITE SUBSTITUTIONS ITERATED
We leave to the reader a rather obvious proof of the fact that L(G,) Hence Lemma 2.14 holds. 0
=
K(I).
Lemma 2.15. I f K is an EDTOL language and cp is a type 12 homomorphism such that K is in the range of cp, then cp-'(K) is an EDTOL language.
Proof. Let 1 = Icp(O)( = Iq(1)l. Since cp is a type 2 homomorphism, I is well defined. Let $ be a homomorphism from alph(K(l))into (0, 1}* defined as follows: (1) for every [a, 1, x ] in alph(K(I)), $([la, 1, XI) =
0 1
if ax = cp(O), if ax = cp(l),
(2) for every [a, i, x ] in alph(K(1))with i # 1, $([a, i, x ] ) = A. Note that, because K is in the range of cp which is a type 1 homomorphism, t,b is well defined. Also clearly $ ( K ( l ) ) = cp-'(K). By Lemma 2.14 K ( I ) is an EDTOL language; and because EDTOL languages are closed under homomorphic mappings (see Exercise IV.3.2), cp- ' ( K ) is an EDTOL language. 0 Now we can prove our next bridging result. Theorem 2.16. Let cp be a type 123 homomorphism and let K be a nonexhaustive language over {O, 1). If ~ ( K ) E Y ( H - ' E D T O L ) ,then K i s an EDTOL language. Proof: Directly from Lemmas 2.13 and 2.15.
0
Theorem 2.16 allows us to use any example of a non EDTOL language to generate languages outside the (bigger) class Y ( H - 'EDTOL). It requires using nonexhaustive languages; however, if we get a language K that is exhaustive, it suffices to consider the language K\{w} where w is an arbitrary word of length k 2 2 where K contains a word of length k. Then K\{w} is nonexhaustive, and it is not an EDTOL language if K is not. Moreover, if the language K we start with is in Y(ETOL)\Y(EDTOL) and we consider a type 123 homomorphism rp, then cp(K) will be in Y(ET0L) because by Theorem 1.7(vi)the class of ETOL languages is closed with respect to homomorphisms. Altogether we get the following result. Theorem 2.17.
g(EDT0L) 5. Y(H-'EDTOL) 5 Y(ET0L).
Proof: Weak inclusion Y(EDT0L) G Y ( H - 'EDTOL) is obvious and weak inclusion Y ( H - 'EDTOL) E Y(ET0L) follows from Theorem 1.7(vi).
2
257
COMHINATORIAL PROPERTIES OF ETOL LANGUAGES
Then. by Corollary IV.3.4, K , = {x E {a, b}*11x1 = 2" for some n 2 0) = cp-'(K,),where K 2 = {a2"ln2 0)andthehomomorphismcp: {a, b}* -+ { a } * is defined by cp(a) = cp(b) = a, is in Y(H-'EDTOL)\Y(EDTOL). If we define the homomorphism $: {a, b}* -+ {a, b}* by $(a) = ab and $(b) = ba, then $ is a type 123 homomorphism. Thus, by Theorem 2.16 $(Kl\{ab}) is in Lf(ETOL)\U(H- 'EDTOL). 0 Our reasoning above implies that Y ( H - 'EDTOL) is not closed under homomorphisms. Thus neither using inverse homomorphisms nor using inverse homomorphisms and then homomorphisms allows us to fill in the class of ETOL languages by (starting with) EDTOL languages. This brings us to the more general problem of the relationship between 9(EDTOL) and Y(ET0L). The deterministic restriction on an ETOL system is ofgrammatical nature: an ETOL system is called determinsitic if each table of it contains precisely one production for each letter. These systems generate the class of languages, namely U(EDT0L). A result that one would like to have to explain the role the deterministic restriction plays in ETOL systems is to find a "nontrivial" language operator 0 such that for every language K in Y(ETOL), one can find a language R in Y(EDT0L) for which 0 ( R )= K . In this way we would "fill in "Y(ET0L) by Y(EDT0L)applying 0.The naturalness of such an operator @ stems from the fact that it would close the diagram in Figure 3 to commute. So far no result ofthis nature is known. As a matter of fact, we shall present now a result that supports a (pessimistic) conjecture that such an operator (4)) is impossible. We shall show that, if we choose @ to be a substitution into a family of languages Y that is such that each infinite language in Y contains an infinite
z
b
5E
E a E O 0
deterministic restriction
0 -
W-)
pE
g
-pJ 3
258
v
SEVERAL FINITE SUBSTITUTIONS ITERATED
arithmetic progression, then there are ETOL languages that cannot be obtained in this way from EDTOL languages. First, we define formally languages with the above properties. Definition. An infinite language K is called arithmetic if length K contains an infinite arithmetic progression ; otherwise, K is called antiarithmetic. A family Y of languages is called urirhmetic if every infinite language in Y is arithmetic; otherwise Y is called antiarithmetic. A substitution into an arithmetic family is called an arithmetic substitution.
Antiarithmetic languages admit only certain substitutions into them, as shown by the following result. Lemma 2.18.
Let K be an antiarithmetic language. If K
cp is an arithmetic substitution, then cp is,finite on alph
=
cp(K) where
R.
Proof: Let us assume to the contrary that R contains a word w = w l a w 2 such that for the letter a, cp(a) is infinite. Since cp is arithmetic, cp(a)contains an infinite sequence of words z,, z2,. . . such that Izl 1, 1z21, . . . form an arithmetic progression. But if F,, W, are fixed elements of cp(wl) and cp(w,), respectively, then~,z,W,,~,z,W,,. . . isan infinite sequence ofwords in K such that I Wlz,W2 1, I Wlz2 W 21, . . . form an infinite arithmetic progression, which contradicts the fact that K is antiarithmetic. Consequently, cp must be finite on alph K. 0
To prove that arithmetic substitutions on EDTOL languages do not get us all ETOL languages we shall use the technique off-random words developed in Chapter IV. First, we need the following technical result. Lemma 2.19. Let f be the function from positive r e d s into positive r e d s defined b y f ( x ) = 6 log, x and let A = (0, 1}. Then,for every positive integer n, there exists a word z over A such that IzI = 2" and z is f-rundom. Proof: Let V = (0, 1, $}. Let n be a positive integer and let y , , y,, . . . , y,, be an arbitrary, but fixed, ordering of all words of A of length n. Let a, = y , $ y 2 $ . . . $y,.$. Clearly, no two disjoint subwords of a, that are of length at least 2n are identical. Let $ be the homomorphism from V into A* defined by $(O) = 03,$(1) = 13, and $(%)= 101. Let p, = $(a,,). Clearly, no two disjoint subwords of 8, that are of length at least 6n are identical. Finally, let z be the prefix of p, of length 2". Obviously, z does not contain two disjoint subwords of length at least 6n that are identical, and so z is f-random. 0
2
COMRINATORIAL PROPERTIES OF ETOL LANGUAGES
259
Theorem 2.20. There exists an ETOL language K such that there do not exist an arithmetic substitution cp and an EDTOL language M with the property that K = cp(M). Proof: Let G = (C, H , S , A) be the ETOL system where C = {S,F, 0, l), A = (0, l } , and H = { h l , h 2 , h,} where hi(W = {Sz), hi(F) = = hi(1) = { F ) , h2(S) = 11, h2(F) = = hz( 1) = { F } , h3(0) = 0 3 . I t 3 ( S ) = h3(F) = { F } , h , ( l ) = 1,.
Let K = L(G).To prove that for no EDTOL language M , K is an arithmetic substitution of M we proceed as follows.
(i) K is antiarithmetic. Obviously length K = {2"3mln,m 2 0).Recall that for 4 2 1, less, K = # { k E length K I k < 4). But if 2"3" < 4, then n < log, y and ti1 < log, 4 and consequently lim 4-02
less, K < lim (log, 4)(1og3 4) = 4 44
~
and so length K does not contain an infinite arithmetic progression. (ii) For every positive integer m, there exists a positive integer n, such that for all positive integers k , 1 larger than n,, for every word w in K such that I w I = 2k3' and for all nonempty words a, p over C such that I a I < m and IpI < in, the following holds: if w = w 1 a w 2and w l p w 2E K , then a = p. This is proved as follows. Take n, = rn. (ii.1) We show first that if W = w l P w 2E K , then (a1 = [ P I . If W E K , then IWl = 2r3s for some positive integers r, s. Let us assume that IWl > I w1 and let t = IWl - IwI = 2r3s - 2k3'. Clearly either r > k or s > I, and so t is divisible either by 2k or by 3'. But 2k > m and 3' > m, while obviously IWl I w I < m, a contradiction. Similarly, if we assume that I w I > I W I, we get a contradiction. Consequently, if W E K , then IWl = I i t . I and so la1 = /PI. (ii.2) Now we shall show that if W E K and I ct I = I PI, then a = p. Note that w = M', . . . M'Zk where each word w iis of length 3' and either wi consists of Is only or it consists of 0s only. Thus if we replace any subword a of w by a word /l of the same length and obtain in this way a word in K , then it must be that a = /i (iii) K is not the result of an arithmetic substitution on an EDTOL language. To prove this let us assume to the contrary that there exist an EDTOL language M and an arithmetic substitution cp such that K = cp(M). Lemma 2.18 and (i) imply that cp is a finite substitution on ulph M . Let r be the maximal length of a word that cp can substitute for a single letter from alph M . Let k > r, l > r, and let MIbe a word in K such that 1 w I = 2k3'.Let z be a word in M
v
260
SEVERAL FINITE SUBSTITUTIONS ITERATED
such that q ( z ) = w. Then (ii) implies that for every letter a in alph z, q ( a ) is a singleton. Let singl, M denote the set of all letters a from alph M such that q ( a ) is a singleton. From the above argument we know that sirzgl, M # 0. Let Z = M n (singl, M ) * ; again Z # 0. Since the intersection of an EDTOL language with a regular language is an EDTOL language and sincea homomorphic image of an EDTOL language is an EDTOL language (see the remark following Theorem 1.7 and Exercise IV.3.2), q ( Z ) is an EDTOL language. Moreover, as noted above,
K,
=
{w E K 1 I wI
=
2k3' where
/i
> r and I > r} c q ( Z ) .
Now let us consider the function j' on positive integers defined by !(!I) = 6 . 3*+ log, n. Clearly, .f is a slow function. On the other hand, K , contains infinitely many.1-random words, which is seen as follows. Let k > rand let us generate in G a word xk of length 2k using k times table h , and then the table / I ? . Then using table h3 r 1 times we substitute 03'' ' for each 0 in xk and 1.3a ' for each 1 in xk, obtaining in this way the word yk,,+ Obviously, J ) k , * + , is 1-random if xk is (6 log, n)-random. However, by Lemma 2.19, for every k 2 1, there exists a (6 log, n)-random word over {O, 1} of length 2k.Since every word over {o, 1) of length zk can be generated in G (in the way xk was generated), K , contains infinitely many f-random words. Then however Theorem IV.3.1 implies that q ( Z ) is arithmetic (remember that K , G q ( Z ) ) .Since 2 G M , q ( Z ) c q ( M ) = K ; and this implies that K is arithmetic, which contradicts (i). Thus K cannot be equal to an arithmetic substitution on an EDTOL language and (iii) holds. This completes the proof of the theorem. 0
+
,.
Exercises 2.1. Establish inclusion relationships between all pairs of the following classes of languages : Y(EDOL), Y(EOL), Y(EDTOL), Z(ETOL), Y(REG). Y(CF), and Y(CS).
2.2. Let K be a language over an alphabet C and let A be a nonempty subset of Z. We say that A is rior~jrequentin K if there exists a positive integer constant m such that for every x in K . # &.Y < t n . We say that A is rare iri K if for every positive integer k , there exists a positive integer f l k such that for every n larger than nk if a word x in K contains n occurrences of letters from A, then each two such occurrences are distant not less than k. Prove that if K is an ETOL language and A is rare in K , then A is nonfrequent in K . (Cf. [ER43.)
2.3. Prove that the language {(ab")"I m 2 ( H i n t : use Exercise 2.2.)
11
2 1 ) is not an ETOL language.
3
ETOL SYSTEMS OF FINITE INDEX
26 1
2.4. Show that the class of intersections of context-free languages is incomparable with Y(ET0L).
2.5. Let ‘6 be a family of languages. A %-controlled ETOL sysrern is a construct G = (C,H , w, A, C) where H = (C,H , w, A) is an ETOL system and C G H* is a language in %. The language q f G consists of all words in L ( H ) that have a derivation in H the trace of which is an element of C . (1) Prove that if ‘G is the class of regular languages, then the class of languages generated by ‘%-controlled ETOL systems equals Y(ET0L). (Cf. [GR].) (2) Prove that if % is the class of context-free languages, then Y(ET0L) is a strict subclass of the class of languages generated by %-controlled ETOL systems. ( H i n t : to prove (2) use Exercise 2.3.)
2.6. A n N-grumniur. G is like a context-free grammar except that each production is equipped with a forbidding condition which is a subset of the set of nonterminal symbols. In a word x a nonterminal A can be rewritten by a word M’ only if G contains a production n = ( A + w ) with the property that none of the nonterminals in the forbidding condition of n occurs in x. Show that Y(ET0L) is strictly included in the class of languages generated by Ngrammars. What condition must be imposed on productions ofan N-grammar so that the class of languages generated by N-grammars satisfying the condition equals U(ETOL)? (Cf. [P2].)
3. ETOL SYSTEMS OF FINITE INDEX
An ETOL system and a context-free grammar are extreme examples of parallel and sequential rewriting, respectively. Formal language theory is full of examples of rewriting systems that lie somewhere between these two extremes; in those systems one may rewrite (in a single derivation step) several (but, in general, not all) occurrences in a string. Investigating rewriting systems of this kind forms a natural step in research aiming at understanding the difference between sequential and parallel rewriting. A reasonable point to start with is, for example, admitting ETOL systems but considering only those with limited “rewriting activities.” In this section we shall consider only ETOL systems such that each word in the language of a system can be derived in such a way that in each intermediate word no more than an a priori bounded number of symbols can be rewritten. These systems are referred to as ETOL systems of finite index. If we want to measure the amount of rewriting activities in an ETOL system, we have to establish the unit of counting. The most natural one seems to be an active symbol, that is, a symbol that can he rewritten into something other than itself. Formally. it is defined as follows.
v
262 Definition.
SEVERAL FINITE SUBSTITUTIONS ITERATED
Let G = (I:,H , S , A) be an ETOL system.
(1) A symbol a in I: is called active (in C ) if there exists a table h in H and a word x in I:* different from a such that o!E h(a). Otherwise, a is called nonuctiw (in G). A ( G ) denotes the set of all active symbols in G and N A ( G ) denotes the set of all nonactive symbols in G . (2) Gissaid to beinacrioenorrnalform,abbreviatedasANF,ifA(G)= I:\A.
Examnpki~.?.I. Let G = (X,H,S, A) be an ETOL system where Z { S , A, B,a, h } , A = {a, b } , and H = {h,, h 2 } with
h l ( S ) = {ASB’, A’SB},
h , ( A ) = { a 2 A ,Aa’}, h I ( a ) = {a}, hl(h) = { b 2 } ,
=
h,(B) = {Bb},
hz(S) = { S } . hZ(A) = {a2}, h,(B) = { b } , hz(a) = { a } , and h,(h) = {h, h’}. Then A(G) = { S , A, B, b ) and N A ( G ) = { a } . G is not in active normal form. As illustrated above the division of symbols in an ETOL system into nonterminal and terminal symbols and the division into active and nonactive symbols do not have to coincide. Since nonterminal symbols do not occur in the words of the language of an ETOL system, it is quite often useful to have a situation where those “auxiliary” symbols are used only to generate the language and so are “active,” whereas the symbols occurring in words of the language (terminal symbols) play only the “representation role” and are not active. It turns out that each ETOL language can be generated by an ETOL system with these properties.
Theorem 3.1. There exists an algorithm that given un arbitrury ETOL system G produces an equivalent ETOL system that is in A N F .
Prooj: By Theorem 1.4 we can assume that G = (Z, H,S , A) satisfies the conclusion ofTheorem 1.4. Thus, for every u in A and every h in H , h(a) = { a } . To take care of nonterminals in G it suffices to replace all productions for every nonactive nonterminal a in G in every table of G by the production a -, R R where R is the rejection symbol of G. Then we obtain an equivalent ETOL system that is in ANF. 0 Now we shall use active symbols to determine the amount of activity (the index) of an ETOL system. As a matter of fact, one immediately notices two ways of doing this. The first (an “existential” method) indicates that if, for every word, there exists a derivation with a bounded prior amount of rewriting taking place at each step, then the system is of finite index. The second
3
263
ETOL SYSTEMS OF FINITE INDEX
(a "universal" way) indicates that only systems in which every successful derivation has a bounded prior amount of rewriting taking place are called systems of (uncontrolled) finite index. Formally, this is done as follows. Dcjinition. Let G positive integer.
=
(C,H , S, A) be an ETOL system and let k be a
(1) We say that G is of index li if, for every word w in L(G), there exists a derivation D of w with fruce D = (xo, .. . , x,) such that, for 0 I i I n, # A ( G ) ~I i k. We say that G i s ofjinite index if G is of index k for some k 2 1. (2) We say that G is of irricontroIled index k if for every word w in L(G) whenever D is a derivation of w in L(G) with trace D = (xo.. . . , x,), then #A ( C ) ~I i k for 0 I i 5 n. We say that G is qfuizcorttrolledJirrite index if G is of uncontrolled index k for some k 2 1.
If X is a class of ETOL systems or any of its subclasses, then we use 9(X)FIN and Y(X)FINU to denotethe class of languages generated by systems from X under the finite index and uncontrolled finite index restriction, respectively. If we want to fix a particular index k , then we use y(X)FIN(k)or y(X)FINU(k). Thus, for example, Y(ETOL)FIN(R)denotes the class of all ETOL languages of index k ; it consists of ETOL languages generated by ETOL systems of index k. Exumnpk 3.2. Let G = (C,h, S, A) be the EOL system defined by C = {S,a, h}, A = { l i , h } , h(S) = {S2,Su, Sb, a, b ] , h(a) = { a } , and h(b) = (6). Then G is of index 1 but it is not of uncontrolled finite index.
C
Exurnpk 3.3. Let G = (C, H , S , A) be the EDTOL system defined by {S, A , B,11, h } , A = { a , b } , and H = {Al, h , , h 3 } where
=
Il,(S) = { A B ) ,
h,(A) = {Au},
h,(a)= { a } , h,(S)
=
{AB),
h,(h) =
h,(B) = { B b } , {h},
h,(A) = { A h } , h,(B) = { B u } , {a), /I&) = {b},
IIZ(LI) =
h3(S) = h3(A) = h J B )
=
{A},
h,(u)
=
{u},
and
h,(b)
=
{h}.
Then G is of uncontrolled index 2. Exuttiplt 3.3.
IS, ( I ) , A
Let G
= { I / ; , h(S) =
=
(1,h, S, A) be the EOL system defined by C
{d} = h ( ~ i ) Then . G is not of finite index.
=
v
264
SEVERAL FINITE SUBSTITUTIONS ITERATED
The first natural question that arises is how effective are the above definitions. An ETOL system G is of (uncontrolled) finite index if a particular property of the set ofderivations in G holds. Whether the definition is effective depends on the decidability of this property. We shall show now that the uncontrolled finite index property is decidable, but the finite index property is not decidable. Theorem 3.2.
( 1 ) I t is decidable whether or not G is of uncontrolled index k for un urbitrury ETOL system G and an arbitrary positive integer k. ( 2 ) I t is decidable whether or not an urbitrary ETOL system G is of’uncontrolled Jinite index. Proof: Let G = (C,H , S, A) be an ETOL system and let us assume that S E A(G); otherwise, the theorem trivially holds. Let, for each h in H , h be the finite substitution on (A(G))* defined by &a) = {pres,(,,ala E h(a)}
for every a
in A ( G ) .
Let A = { h l h E H } . Now let, for every useful alphabet 0, Go be the ETOL system Gm = (A(G), A, S, 0 n A(G)). (Let us recall that an alphabet 0 E E is useful if there exist words x , y with y E L(G) for which S &. x &. y and alph s = 0.Also, us G denotes the set of useful alphabets of G . )
(i) Let k be a positive integer. Clearly, G is of uncontrolled index k if and only if IwI I k for every word w in UOEIISC L(Ge). It is easily seen that it is decidable whether an arbitrary ETOL system generates a word in its language longer than a fixed constant. Thus (1) of the statement of the theorem holds. L(G,) is (ii) Clearly G is of uncontrolled finite index if and only if finite. It is easily seen that it is decidable whether or not an arbitrary ETOL system generates a finite language (see Exercise 1.5).Thus (2) of the statement of the theorem holds. 0
UOEI,S(i
Theorem 3.3.
( 1 ) I t is undecidable whether or nor G is of index k for an arbitrury ETOL system G and an arbilrary positive integer k. ( 2 ) I t is undecidable whether or not an arbitrary ETOL system G is offinite index. ProoJ We prove the theorem by showing a suitable encoding of the Post correspondence problem.
(i) Let k be a positive integer and let Z = ( a l , . . . , an),W = (pl, . . . , p,) be an instance of the Post correspondence problem over an alphabet A. Let
3
265
ETOL SYSTEMS OF FINITE INDEX
s,
G k , z . Wbe the ETOL system (C,{ h } , A v {$, $}) where Z = A v (1,$, S, S , A , B, C, D, E, F , M J and ;I is defined by the following productions:
s 3
-+
-+
(S$)k,
E($E)k-'F,
s s, +
S
-+
for every for every for every for every for every for every for every for every
uAa
S
.+
uBh
A
. +
UHU
A A A
-+
uBh
-+
ac'
Da B LIB B -+ Ba B 1, c+uc -+
-+
a in A, a, h in A such that a # b, u in A, a, h in A such that a # b, N in A, a in A, a in A, a in A,
--$
c
-+
for every a in A,
1,
D -+ Da D 4 1, E + E, E + aiM niir M tli M rnir M -+ 1, F $, a-+a -+
for every a in A,
pi /ji
for every for every
1 I i I n, 1 I i In,
-+
for every a
in A u {#,
S}.
It is rather obvious that every word in L(Gk,z,w ) can be derived in such a way that the first production used is S + (S$)kif and only if the given instance Z , W of the Post correspondence problem has no solution. But if the first production used in a derivation is S -+ E($E)k- F , then already the first word derived contains k + 1 occurrences of active symbols; and if the first production used is S ( S $ ) k ,then no word in the trace of the derivation contains more than /ioccurrences of active symbols. Consequently, G k ,z. is of index k if and only if the given instance Z , W of the Post correspondence problem has no solution. Since the Post correspondence problem is undecidable, (1) holds. (ii) Let Z , W be as in (i). Let G,,,, be the ETOL system (X,{ h o ,h , } , S, A u {$, $}) where -+
C
=
A U { $ , S , S , U , S , A , B , C , D, E, M , E } ;
v
266
SEVERAL FINITE SUBSTITUTIONS ITERATED
h,, is defined by the productions
s + u, S + E$,
u u
-+
US$,
-+
A,
E -+ E$E,
x+x
for every
x
in C\{S,
U,E},
and h l is defined by the productions
s + s, S S A
in A, in A such that a # b, a in A, a, b in A such that a # b, a in A, a in A, a in A, a in A,
aAa aBb + aAa A + aBb A + aC A + Da B + aB B + Ba B+$
for every for every for every for every for every for every for every for every
C+aC
for every a in A,
C-15 D + Da
for every a in A,
D
4
+
+
a
a, b
$,
E - E, E M M
+ -+
+
cciM mir pi criM mir pi
for every for every
1 I i I 11, 1 I i I n,
$,
x-+x
for every X
in A u {$, $, S, U } .
It is rather obvious that G Z , , , is of finite index if and only if the given instance 2, W of the Post correspondence problem has no solution. Thus (2) holds. 0 As we have seen several times already, it is very useful to have a normal form result for a class of language generating systems. It usually facilitates proofs of various properties of the class of languages generated and gives extra insight into “programming possibilities” of systems in the class. A very useful normal form for ETOL systems of finite index is to be defined next. Its
3
267
ETOL SYSTEMS OF FINITE INDEX
most remarkable feature is that it requires a deterministic ETOL system; and still, as demonstrpted by Theorem 3.5, every ETOL language of finite index can be generated by an ETOL system in this normal form, hence deterministically. It is very instructive to compare this fact with the fact that deterministic ETOL systems generate a strict subclass of the class of ETOL languages (see Exercise 1.8). Definition. A n ETOL system G is said to be infinite index normal form, abbreviated FINF, if G is an EPDTOL system of uncontrolled finite index that is in active normal form. Lemma 3.4. system of
There exists an algorithm thut given an urbitrury ETOL i d e s k produces uti equivalent EPDTOL system of index k that is in
ANF. Proof: Let G
=
(C, H , S, A) be an ETOL system of index k .
(i) First, we notice that the construction from the proof of Theorem 1.4 (hence really the construction presented in the proof of Theorem 11.2.1) for obtaining an equivalent EPTOL system preserves the index of the system. That is, if the original system is of index k , then the resulting system will also be of index k . Then we notice that the construction from the proof of Theorem 3.1 for producing an equivalent ETOL system in ANF preserves both the index of a system and the propagating property. Thus we may assume that G is an EPTOL system in ANF. (ii) Let E l = C u { [ a ,i] ( aE A(G). 1 I i 5 k } . Let cp be the finite substitution on C* defined by q(a) = { u } for a E A and q ( u ) = { [ a ,i] 11 < i < k } for U E A ( G ) .Let, for every ~ E Hh , be defined by the set of productions { b + Plb E q ( a ) , /) E cp(h(a)) and a E C}, and let A = {hlh E H } . Finally, let G I = (Cl, H , , [S, I ] , A) where H 1 = det 4. (For a finite substitution g, det g denotes the set of all homomorphisms included in g.) Obviously, G1is an EPDTOL system of index k that is in ANF, and it is easily seen that L ( G l ) = L(G).
UiE~
Theorem 3.5. Thrre exists an algorithm thut giuen an arbitrary ETOL system of' index I{ produces an equivalent ETOL system of index k tlzat is in FINF.
Proof: Let G = (C, H , S, A) be an ETOL system of index k. By Lemma 3.4 we may assume that G is an EPDTOL system of index k that is in ANF. Let F be a new symbol and let Z = { [ a ,u ] )II E ( A ( G ) ) ' and a E alph u } , where for an alphabet c', V ' denotes the set of all nonempty words over V that are not
v
268
SEVERAL FINITE SUBSTITUTIONS ITERATED
longer than k. Let, for each h in H , h be a homomorphism on ( Z u A u { S , F } ) defined by
(i) h(a) = { a } for every a in A u { S , F } ; (ii) if [b, u ] in Z is such that I p s , , , , h(u)l
s k , then
where ii ii]/ll . . . [c,. U]/I, Po , . . . ? P , E ( N A ( G ) ) * , , . . . , c , E A ( G ) , and
&[be ill)
= /jo[cl,
(iii) h([b, u])
=
=
presAIG,h(ir), h(b) = / j o ~ l / j l . . . ~ * , / j , ,
{ F } for every [b, u ] in Z such that Ipres,,,, h(u)l > k .
L e t R = { h I h ~ H } , E = Z u A u { S , F } , a n d l e t S =[S,S]ifS€A(G)and
S = S otherwise. Finally, let G = (E, R, S, A). Obviously, G is an EPDTOL system in ANF. G “admits” from C only those derivations that d o not introduce more than k occurrences of active symbols. This is easily done because G is deterministic: and so, for every string that is derived in G , G can keep track of the total number of occurrences of active symbols in the string (to d o this G uses elements of (A(G))‘k as “second components” of its active symbols). If a rewriting of x in G leads to a string with more than k occurrences of active symbols, G will replace all occurrences of active symbols in the string simulating x by the “dead symbol” F. Consequently, one can easily prove that G is of uncontrolled finite index k and that L(G) = L(G). Thus the theorem holds. 0 In particular, the above normal form theorem implies the following equalities for the classes of languages involved. Theorem 3.6. (1) For every positive integer k ,
9(EToL)FIN(k)
= =
(2) Y(ETOL),,N
9(EPDToL)FlN(k) = y(EToL)FINU(k) 9P(EPDToL)FlNU(k).
= Y(EPDTOL)F,N =
Y(ETOL)F,Nu = Y(EPDTOL)F~NU.
A remarkable property of the finite index normal form is that i t requires a system to be of uncontrolled finite index. These systems are clearly more convenient to deal with, as indicated already by Theorem 3.2 (the reader should contrast it with Theorem 3.3) and as will be rather obvious from the rest of this section. We are now going to look at ETOL systems of uncontrolled finite index (which by Theorem 3.5 suffice to generate the whole class of ETOL languages of finite index) from the structural point of view. We shall show that these
3
269
ETOL SYSTEMS OF FINITE INDEX
systems are completely characterized by a particular kind of recursion of symbols in a system (or rather by forbidding this kind of recursion!). The recursion we need is defined as follows. Dejinition.
Let (3 = (C, H , S, A) be an ETOL system.
( 1 ) A symbol LI from C is called Iustin~gc r c r i w l j Srecursitle ( i n G), abbreviated as LA-recursive, if there exist sI,.x2 in C*, in L(G), and p in H " such that
(i) s 4 . Y ~ U . Y Z ~ it'; (ii) 11 ru/j, x l % . T I and s2% .T2, where CI, /j, X I , .Y2 are such that ulph .U ru/iY, 5 d p h .Y I U.Y, ; and (iii) there exists an active symbol h such that h E ulph c$ and h byz, where ulph y l y z G u l p h . x 1 u x z . ;ql
(2) G is called nonlusrinq u c t i w l j ~rrcursiw. abbreviated as NLA-recursive, if it does not contain LA-recursive letters.
Let G = (1, H , S, A) be the ETOL system with C = Excrrrrplc~3.5. ( S , A , B. C', /I 11,, h, c, d ) , A = { ( I , h, c, d } , H = { h l , h , ) whereh, isdefined by the set of productions {S
--+
AB. A
-+
CAc, B
--+
h, C
-+
c,
D
--+
(1, u
--+
11,
h
--+
h, c
--+
c, d
--+
11)
and h , is dctined by the set of productions IS
A B , A -+ ( I , B + DBu, C -+ c, D L) uDu, ( I ( I , h b. c c, d
-+
-+
-+
-+
-+
-+ --+
LI,
(1).
Then B is LA-recursive and no other letter is LA-recursive. First, we shall show that the above definition of recursion is an effective one. Theorem 3.7.
( 1 ) I t i.\ ilrciiltrhle whether or not LI is LA-recursive i n G, where G i s un rrrhirrtrrj, ETOL sj*strrn und ( I is u n rrrbitrar~~ sj,mbol,frornG. ( 2 ) I t is ilrcitluble whether or not un urhitrary ETOL system G is N L A rrcursircJ.
ProCJJ Let G = (Z, H , S, A) be an ETOL system, T = (X,H ) , and let u be a symbol in A. Clearly, a is LA-recursive if and only if there exists a useful alphabet 0 = { u l , . . . , u,} with N in 0 and an active symbol b such that, using notation from Exercise 1.9, c~irit(T.u , . . . ( I , , , @*) n conr(T, u,
n cwit(T, b, @ * h e * ) #
0
270
v
SEVERAL FINITE SUBSTITUTIONS ITERATED
where M,3b.0 = { N U / ? [ # b a P > 0 and crag E @*}. Since @*, and @*be* are obviously regular and (automata for them) can be effectively constructed, Exercise 1.9implies that cont( T, a l . . . a,, @*), cant( T, a, M u , @), and con[( T, b, @ * b e * ) can be effectively constructed. Since regular languages are (effectively) closed under intersection and the emptiness problem for finite automata is decidable, point (1) of the theorem follows. Since (2) is a direct consequence of (1) the theorem holds. 0 Next we are going to show that the class of NLA-recursive ETOL systems coincides with the class of ETOL systems of uncontrolled finite index. This characterization certainly sheds light on the ‘‘local’’ properties of an ETOL system of uncontrolled finite index. Lemma 3.8. l f a n E TOL system contains an LA-recursive symbol, then it is not ?funcontrolled jinite index.
Proof: Let G = (C,H , S, A) be an ETOL system and let a from C be LA, in C*, a control word recursive in G. This implies that there exist words X ~ x2 p in H*, and an active symbol b such that, for every n 2 0, there exists a derivation D,such that its trace contains a (sparse) subsequence y o , y,, . . . , y, where y o = x l a x 2 ,y , ~ A * , y4 , and # b y , + 1 > #byifor0 I i 5 n - 1 (and # ( 1 ~ 2 ~1,for 0 I i I n). Thus G is not of uncontrolled finite index and the lemma holds. 0 Remark. In the proof of the following result and in the proof of Theorem 3.13 we consider quite extensively control words of a derivation in an ETOL system. That is, given an ETOL system G = (C,H,S, A), we often consider words in H* as functions transforming C* into C*. For this reason, to avoid a very cumbersome notation, we have decided to use quite a number of times the “left-to-right” functional notation: given an argument x and a functionf, (x).f denotes the value of ,f at x. Also, given functions f,, . . . , f k r their cornposition in this order (first f,, then f 2 , . . .) is written as fif2 . . . and the value of,fl . . . .fk at x is written as ( x ) f i . . . fk. Since each case that we use this notation is made clear by the way an argument is attached to a function, this should not lead to confusion. Lemma3.9. jinite index.
l f a n ETOL system i s NLA-recursive,then it is ofuncontrolled
Proof: Let G = (C, H , S , A). We shall prove this lemma by contradiction. To this end let us assume that G is NLA-recursive but is not an ETOL system of uncontrolled finite index. We also assume that S is active; otherwise the lemma is trivial. Consider the fo1lowing”skeleton ofG”T0L system G,,, = (C(,,, If(,),S,l,)
3
271
ETOL SYSTEMS OF FINITE INDEX
where C,l, = A(G), S,l, = S, and H(l, = {h,,,lh E H } where, for h in H , h,,, is the finite substitution on Z,,, defined by h,,,(a) = {pres,(,, a l a E h(a)} for every a in Z,,,. Since G is not of uncontrolled finite index, there exists 0 in us G such that L ( G ( , , )n O* is infinite. Let us choose such a 0. Let G,z, = &,, H ( z , ,S(,,, 0 )be the ETOL system where C,,, = C(,,, H , z , = H , , , , and S,,, = S , , , . Lemma 2.8 implies that ussoc Go, generates an infinite language. Let assoc Go,= G,,)= (C,,,, H , , , , S,,,, O), hence C,,, = C(,, and S(,, = S,,,. Let us now construct the EPTOL system Go,= (C,,,, H,,,, S,,,, 0) equivalent to G,,,using the construction pointed out in the proof of Theorem 1.4 (hence the construction from the proof of Theorem 11.2.1). Thus
q4)=
u { [ a , ri IU E
c,,, = AG), r E q3,} u {FJ
where F is a new (synchronization) symbol and S,,, = [ S , 01. Clearly, G,,, remains deterministic. Let us now analyze Go,.There exists a derivation D in G,,, of a word w in O* such that in trace D there are two different words x and y such that alph x = alph y = 8 for some 8 c X,4) and I J) I > I x 1. Thus, for some control words p . p, and v in Ho,, we have s,,,&. x &-J' &- w. Consequently, (i) for all i > j 2 0, I(x)p'I > I(x)p'l and alph((x)p') = alph((x)pJ)= 8, and (ii) (x)p'v is in O* for every i 2 0. Thus there exists a symbol c in 8 such that I (c)p I > 1. Let # @ = m and let us consider the derivation in G,,, obtained from D as follows: first one applies p to S,,, to obtain x,then one applies p ni I times and then to the resulting word one applies v. Let zo = x, zi= (zi-,)pifor 1 5 i 5 m + I and iT = ( z , + l)v. Let X be an occurrence ofc in zn,+1. If we consider the derivation tree of b, then we can talk about ancestors of X in different zi.In particular, let a m x : {O, . . . , m } -, be the function such that, for 0 Ii I m, ancX i is the label of the ancestor of X in zi. Since # B = m, there must exist integers 0 I s < r 5 I T I such that nnc,(r.) = ancx(s) = E for some E in 8. Hence E ctEP and E ycb where-n/YySE 8*,p = r - s, and q = m + 1 - r. Let k = 2py. Then, because 2pq 2 y + 1 and G,,, is deterministic, E nlE7c, for some 7 c I , n2 such that n , n 2 €8'. However, E = [LI, r] for some a E A(G),r c A ( G ) , and so from the construction of G,,, it easily follows that a must be LA-recursive in G, a contradiction. Thus G must be of uncontrolled finite index and the lemma follows. 0
+
a
Theorem 3.10. An ETOL system is oj'uncontrollerl,finite index ifand only if'it is NLA-recursioe.
272
v
SEVERAL FINITE SUBSTITUTIONS ITERATED
Proof: This follows directly from Lemmas 3.8 and 3.9. 0
Now that we have got some "structural" information of what ETOL systems of (uncontrolled) finite index are, we move to investigate combinatorial properties of languages in -4P(ETOL)FIN. Our first result along this line shows a basic difference between ETOL systems of finite index and ETOL systems in general (at the same time it is a basic similarity between ETOL systems of finite index and context-free grammars). It allows us to construct easily ETOL languages that are not of finite index. 'Theorem 3.11. I f ' K E - ~ P ( E T O L ) ~then , ~ , the set qf Ptrrikh vectors K is LI semilineur set.
associcrteci Lvith
Proof: Let K be an ETOL language of index I<. By Theorem 3.5 we can assume that there exists an ETOL system G = (X,H , S, A) in F I N F such that L ( G ) = K . L e t x = {[u,~.~u,]ll ~r < k a n d u , , . . . , u , ~ ~ \ A } , a n d l e t P b e the following set of productions:
( I ) [ u , . . . a,] -, a is in P if C ( EA t and h(u, . . . u,) = a for some h in H ; (2) [ u , . . . u,] + a[h, . . . b,] is in P ifh(a, . . . u,) = p for some h in H where a = pres, p and b , . . h, = pres,,,, p.
(c,
Consider the right-linear grammar G = A? P , [ S ] ) . Clearly, the sct of Parikh vectors generated by G equals the set of Parikh vectors of G. But the set of Parikh vectors of G is a semilinear set and the theorem holds. 0 Corollary 3.12.
{u2"In 2 0) is un ETOL languuyrthut is not of:finite index.
Proof: This follows directly from Theorem 3.1 1 and from the fact that 0) is a DOL language. 0
{u2"ln2
Our next result on the structure of languages in Y(ET0L)FIN is from the series of"pumping" results for languages. It says that if certain strings are in a n ETOL language of finite index, then also (infinitely many) other strings, resulting from them by synchronously pumping (catenating with itself) certain subwords. must be also in the language. Remark. Before reading the proof of the next result the reader is reminded again about a n occassional use of left-to-right functional notation (see the remark preceding Lemma 3.9). Theorem 3.13. Let K c A* he an ETOL knguage of' index k . There exist positive inreyers r and L' such thut,,for curry word u' in K thut is longer than c,
3
273
ETOL SYSTEMS OF FINITE INDEX
there exists u positiix) integer t I 21i such thut M' can be written in the jorm u,v, with Iuil < ?fiw 1 I iI t, a 1 . . . a, # A and,jiw every positive integer rn, the w r d j'n a y y , a'; . . . 0l7.v~i s in K . Proof: The proof goes by induction on k . The case k = 1 is obvious. Assume that the theorem holds for index k - 1 and let K = L ( G ) where G = (E,H , S, A) is an ETOL system of index k . By Theorem 3.5 we can assume t h a t G i s i n F I N F . Letd = ( # Z ) k + 1 a n d 4 = dmax{)uIIrEh(a)forsome a E C and h E H } . We define now a quite useful technical notion. Let ti E C + with pres,,,-, 11 = ( i I . . . a p for some p I k , a , , . . . ,u pE A(G), and let p be a word in H +.The p-configuration qf' u, denoted conf'(u, p ) is defined by conf(z., p )
= (u,,
1 , ) . . ( u p ,l p ) '
where, for I I i 5 p, li is defined by min{lI(ai)pr<J 1) E A*} l i = { IPI
if (a& E A*, otherwise.
t a p-configuration ( u I , l I ) . . ( u p .l p ) of u is maximal if p = I< and = I p 1. A derivation D of a word w in L(G) such that trace D = , x,) and cont D = h, . . . I t , with h l , . . . , h, E H is called maximal if the following conditions are satisfied: +
I,
(i) ti > d ; (ii) if i # j , then xi # xj for 0 I i . j I n; and (iii) conf'(xi,h i + . . . h i + a ) is maximal for some i in (0, . . . , n - d - I } Let K be the set of all words in K that can be derived using a maximal derivation. First we shall show that the lemma holds for K Let w E K , and let D be a maximal derivation of w where firace D = ((xo, p(l)), . . . , (x,- 1, p(n)), x, = w ) for some p in H* with IpI = n. Thus there exists an integer io, , d)...(a,, d ) where pz = 0 I in < n - d, such that e ~ r ~ f (px2 )~=~ (al, p(i, 1). . . p(i0 d). Let p 1 and p3 be such that p = p 1 p 2 p 3 .Let pres,,,, xio+,, = h , . . . b, for some h , , . . . , b, in A(G). From the definition of maximal configuration and the choice of d it follows that there exist integers io i, < i 2 io + d such that
+
+
pres,,,, xi, = presAo, xia = c, " . c k
for some e l , . . . ,ck
in A(G).
Let p = p ( i l + 1 ) . . . p ( i z ) and let p and 11 be such that p2 = p p v . Then, for I I i I k , (ci)/s = r z i -1ciu2iwhere u j E A* and lujl < q for every 1 I j I 2k. Since x i , # xi2,we also have that a1 . . . a Z k# A.
v
274
SEVERAL FINITE SUBSTITUTIONS ITERATED
FIGURE 4
The situation is best represented by Figure 4. Let xi, = yocly2c3y4 = y,i- 1 for 1 I i I k . Thus W = y,cl,y, . . . a2ky,k, and, obviously,
. * . cky2k and k t (Ci)Vp,
(s)plklP"VP3 = YOor;"YlclyY2
"'
Y2k-2@?k-
lY2k-
lcl?ky2k
is in K for every m 2 0. Hence the statement of the theorem holds for words in K,. Next we shall show that K , = K\KI is an ETOL language of index k - 1. Thus the statement of the theorem holds (by the inductive hypothesis) also for K,,and because K = K , u K , the theorem holds. By the definition of K 2 it follows that for every derivation D of a word w in K , the following holds: if trace D = (xo,x l , . . . , x,) with n > d and x, # x, for r # s, 0 I r, s In, then if #acoxi = k for some i E {O, . . . , n - d - 1 }, then at least one active letter from xi generates in this derivation a terminal word in fewer than d steps.
3
275
ETOL SYSTEMS OF FINITE INDEX
This property allows us to construct a new ETOL system G of index k - 1 that will simulate all derivations from G with the above property. Intuitively speaking, G will work as follows. Every intermediate word in a derivation in G will "know" the next d tables that will be applied to it. Ifa step in the derivation (in G) that is being simulated results in a word containing k occurrences of active symbols, then we know that at least one of those active symbols, X say, will produce a terminal word, x say, in fewer than d steps. Thus, in the corresponding derivation in G such a step will be simulated by immediately replacing X by x, which allows us to keep the index below k. Formally, we define G as follows. Let = A u (3, F } u {[i, c1, p ] Ip E H d , c1 = c'orzf'(u,p ) for some u E A(G)' and i I I u I } where 3, F are new symbols. For every h, g in H and t in H d - I , we define a finite substitution hlT,glon C as follows:
c
( 1 ) a E hlT,s,(u) for every a E A.
(2) Let rx = ( a , , r , ) . . . ( a p ,r p ) where p < k , a,, . . . , upE A(G) and 1 I ti I 11. For every 1 I i Ip , let h(ui) = lfli, . . . bi,r,fli,riwhere bi, . . . bi.r8E A(G) and pi, E A* for every i E { 1, . . . , p } , j E {O, . . . , T i } . Let, for each bi,j , ,f(bi,j ) = (bi,j)rg ifconf(b,, j , rg) = (bi.j , I ) for some 1 < d, and otherwise f ( b i ,j ) = [ti.j, 6, tg] where 6 is the word resulting from the word y = conf(b,, . . . b l , r ,. . . bP, . . . hp,,,>,tg) by erasing all symbols ( b r , s , where lr,s < d, and ri, is the position of (hi.j , /i, j ) in 6. Then
,
,
Pi. 0
,
.f(hi, 1 ) P i .
1
'
'
.f(hi.r , ) / j i , r , E 111r.
gI(Ci7
a, h t l )
for every
1I iI P
x:
if Pi, 0 f ( b i , 1 ) ' .f(bi,r i ) p i . r z E (3) F E hlr,gl(u)for every a E C. Also, for every p. t in H such that I p I I tl and I r I = d, we define a (starting) table I l p , r l as follows: (4) a E I,,,. ,)(a) for every a E A. ( 5 ) Let (S)p = u = a o ~ ~ l. a. -lu p c t pfor some p I k where c t 0 , . . . , ~ , E A * and u , , . . . ,up E A ( @ . Let conj'(al . . . u p , t) = (al, ( a p ,I,) = y be such that it is not maximal and let 6 be the word obtained from y by erasing all symbols ( u r ,1,) with I , < d. Let, for each i e { 1 , . . . , p } . f ( a i ) = (ai)t if ( U J T E A* and otherwisef(ai) = [ti, 6, t] where f i is the position of (ui, li) in 6. Then '
+
.
a0 f ( ~ l l ) a l . f ( 4 ) ~ .f(u,)u, . E I[p,r)(Q
if a o . f ( a , b ,
'
'
. .f(a,)u,
E
z*.
(6) F E I,p.,l(a)for every a E C. Let R = {hlr.alh9 ~ E and H t € H d - l }u {It,,,Tl[p, r E H + , IpI I d , and 1 5 1 = d } and let G = (T, H , S, A). From the construction of it follows that
w
v
276
SEVERAL FINITE SUBSTITUTIONS ITERATED
GisanETOLsystemofindexk - 1,andit iseasilyseenthat L ( c ) = K2.Thus, by the induction hypothesis the theorem holds for K 2 . This completes the induction and the theorem holds. 0 Theorem 3.13 allows one to locate easily languages in Y(ETOL)\Y(ETOL)FIN
9
as illustrated by the following result. Corollary 3.14. The lanytruge, K = { ( ~ " b " )2~ ~1 nand m 2 I} is un ETOL lungirage that is not o f j n i t r index.
Prooc To see that K is an ETOL language take G { A l , h 2 . h d , 2, {a, b } )where h , ( Z ) = { Z S , S} h2(Z)= { F } ,
h3(Z)= { F } ,
and
h 2 ( S ) = {uSb}, h,(S) = {ah},
h , ( x ) = { x } for and and
X E
=
( { Z , S , u, b, F } ,
{S,a, b, F } ,
h 2 ( x ) = { x } for h3(x) = { x } for
X E X E
{a,b, F ) , {a, h, F } .
Obviously, L(G) = K . Next we prove by a contradiction that K is not an ETOL language of finite index. To this end assume that K is an ETOL language of index k . Then let d and q be constants satisfying the statement of Theorem 3.13. Let w = (u4b4)"+ whtre r = max{6k, d}, and let w = y , c r 1 y , a 2 a,y, ~~~ where 1 I t I 2 k , lait < q for 1 I i I t and a1 . . . a , # A. Thus, for some I in ( 0 , .. . , t } , y , = Ctba4bquB for some ap in {a, b}*. This implies that, for every positive integer m, the word y 0 a ; ' y , c r ~ayy, ~ ~ ~is not in K , which contradicts Theorem 3.13. 0 As another application of Theorem 3.1 3 we can demonstrate an infinite hierarchy of languages, imposed by (increasing) finite index restriction, which lie strictly within the class of ETOL languages.
Proof: Let for a positive integer k, Z 2 k + be a finite alphabet x 2 k + = { ~ ~ , . . . , a and ~ ~ +let ~ }Lk+l , = { ~ ; . . . a ; ~ + ,2l n1). It is easily seen that L,+ is an ETOL language of index k 1. On the other hand, Theorem 3.13 implies that & + is not an ETOL language of index k. Also, Corollary 3.14 implies that Y(ETOL)F,N 5 Y(ET0L). Thus the theorem holds. 0
+
277
EXERCISES
Exercises 3.1. Let C be a finite alphabet and let b $ C. Let (Pb be a regular substitution on C* defined by cpb(a) = b*ab* for every a in C.Prove that if K is a language over C and ( P b ( K ) E Y(EDTOL), then K E Y(ET0L)FIN. (Cf. [La31 and [ERSI.)
3.2. Let G = (C, H , S, A) be an ETOL system. = (u + a ) be a production from G . We say that n is linear if I 1. (ii) Let k be a positive integer. We say that G is k-metalinear if the following hold : (ii. 1 ) S does not appear at the right-hand side ofany production; moreover if S 2 a, then # A ( G ) aI k; (ii.2) If n = ( u + a ) is a production from G and a # S , then n is linear.
(i) Let n
#A(G)M
L?(ETOL),-,, denotes the class of k-metalinear ETOL languages, that is, languages generated by k-metalinear ETOL systems.
(iii) We say that G is rnetulineur if it is k-metalinear for some positive integer k. Y(ETOL),I denotes the class of metalinear ETOL languages, that is, languages generated by metalinear ETOL systems. Prove the following pumping theorem for metalinear ETOL languages. Let K be a k-metalinear ETOL language. There exist nonnegative integer constants d , q such that every word w in K that is longer than d can be written in the form w = a1 . . . aP, 0 I p I2k, where for every i E { 1 , . . . ,p } such that ( a i (2 q and every subword 6, of ai that is not shorter than q, a, = ,uidiJii, 6, = y i p i y i with 0 < [ p i < [ q, and, for every positive integer n, there exist words (P, and q~,, such that ( ~ , , p , y , ~ ~ ~E ,KJ .i (Cf. ~ ~ ,[RVl].) ,
3.3. Prove that {a"b"I n 2 1 } E Y(ETOL)FIN\Y(ETOL),I. (Cf. [RVl].) 3.4. Prove that Y(ETOL),-,, 5 Y(ETOL),-,, Y(ET0L)FIN. (Cf. [RVl].) 3.5. Let G
= (C,
5 . . . 5 Y(ETOL),I 5 '
H , S, A) be an ETOL system.
(i) Let EX. We say that a is actively recirrsive (in G ) , abbreviated as A-recursiac, if there exist x,, x 2 in C*,11' in L(G), and p in H + such that (i.1) S % x l u x z A- w; and (i.2) u &. aa/L x 1 &- X,, and x2 X 2 , where a, fi, X,,X2 are such that
alph 2,aap2, $ alph xIax2.
278
v
SEVERAL FINITE SUBSTITUTIONS ITERATED
(ii) G is called nonacrioely recursiue, abbreviated NA-recursiue, if it does not contain A-recursive letters. Prove that a language K is a metalinear ETOL language if and only if it can be generated by a NA-recursive ETOL system. (Cf. [RV2].) 3.6. Let G = (C,H , S , A) be an ETOL system.
(i) Let 0 c C. A symbol a from C is called @-packing (in G) if there exists a positive integer constant C such that whenever a % .xobxlcx2 for some xo, xl, x 2 € C * and b, CEO, then Ixl 1 < C. (ii) We say that G is clusrered if there exists a nonnegative integer k such that whenever S x, then every symbol from alph x is A(G)-packing. Prove that an ETOL language is metalinear if and only if it can be generated by a clustered ETOL system. (Cf. [RVl].) 3.7. Let G = (C, H , S , A) be an ETOL system.
(i) Analogously to the case of EOL systems, let sent G = L(U(G)),where U ( G ) is the TOL system (C,H , S), and let succ G = {x E senr G Ix 2 w for some w E L(G)}.Then let, for u E C* and 0 G Z,SUCC,,~ u = prese(L(Gk) n succ G). (ii) We define rank, to be a (partial) function from C into the set of nonnegative integers as follows. (ii.1) Let Z o = X.Then for a E C,rank, a = 0 if and only if s u c ~ ~ ,a~is, a, finite set. (ii.2) Let Z , , = C\{a E C I rank, a Ii}. Then, for a E Zi+ rank, a = i + 1 if and only if succC3z, +,a is a finite set. (iii) We say that G is an ETOL system wirh rank if rank, is a total function on C.Moreover, we say that G is ojrank m, denoted rank(G) = m, ifevery letter in C is of rank not larger than m and at least one letter from C is of rank m. We use Y(ETOL)RAN(i)and Y(ET0L)RAN to denote the class of all ETOL systems of rank not larger than i and the class of all ETOL systems with rank, respectively. Prove that Y(ETOL)RAN(1, = Y(ETOL)FIN. (Cf. [ERV].) 3.8. Prove that {a2"ln2 0) 4 Y(ETOL)RAN. (Cf. [ERV].) 3.9. Prove that Y(ETOL),,N,o, 5 S"(ETOL)RAN(1)5 . . . 5 LZ(ETOL),AN
5 Y(ET0L). (Cf. [ERV].) 3.10. Prove that Y(ETOL),,N is a full AFL. (Cf. [ERV].) 3.11. From Exercises 3.7 and 3.9 it follows that ETOL systems with rank form a proper extension of ETOL systems of finite index. However, there are some essential differences between the behavior of ETOL systems of finite index and ETOL systems with rank. To see an aspect of this difference prove
279
EXERCISES
that it is not true that Y(EDTOL),,AN = Y(E:TOL)RAN. (Hint:using Theorem IV.3.1 prove that there exists a OL language in $P(ETOL)RAN(~) that is not an EDTOL language; cf. [ERV].) 3.12. An ETOL system G = (C, H , S,A) is called expansive ifu x o a x l a x 2 for somea E C and x o x , x 2 E C * ;otherwise G is called nonexpansive. Prove that an ETOL language is in Y(ETOL)R,N if and only if it can be generated by a nonexpansive ETOL system. (Cf. [ERV].) P 3.13.
(i) Informally speaking, given a tree T , its rank is computed in a bottomup fashion as follows. (i.1) Every leaf has rank 0. (i.2) Let c be an inner node and let i be the maximal rank among direct descendants of c. If c has at least two direct descendants of rank i, then the rank of c is i + 1; otherwise the rank of c equals i. (i.3) The rank of T equals the rank of its root. (ii) Let G = (Z, H , S , A) be an ETOL system. (ii.1) We say that G is oftree runk k for some k 2 0, denoted drunk G = k, if, for every derivation tree Tof a derivation of a word in L(G),the rank of s(T)is not greater than k, where s(T) results from T by stripping T of labels; and moreover, for at least one derivation tree T of a derivation of a word in L(G), the rank of s( T ) equals k. (ii.2) We say that G is offinite tree rank if drank G = k for some k 2 0. We use Y(ETOL),,o, and Y(ET0L)DR to denote the class of languages generated by ETOL systems of tree rank not exceeding k and the class of ETOL systems of finite tree rank, respectively. Prove that Y(ETOL),,R(o)5 2'(ETOL),~,(,, 5 . . . 5 Y(ETOL),,R 5 Y(ET0L). (Cf. [RV3].) 3.14. Prove that LF(ETOL)RAN = Y(ETOL)DR.(Cf. [RV3].) 3.15. Prove that, for every k 2 0, there are languages in LF(ETOL)FINthat
are not in L?(ETOL),,(k,.
(cf.[RV3].)
3.16. Prove that, for every k 2 0, y(ETOL),R(k, 5 T(ETOL)RAN(k,.(cf. ~ 3 1 . )
VI Other Topics: An Overview
1.
IL SYSTEMS
In the previous chapters of this book we have discussed topics representable within the framework of one or several iterated homomorphisms or finite substitutions. There are, however, a number of topics falling outside this framework but still belonging to the mathematical theory of L systems. The purpose of this chapter is to give an overview of some such topics. The overview is by no means intended to be exhaustive: some topics have been omitted entirely, and the material within the five topics presented has been chosen to give only a general idea of most representative notions and results. The style of presentation is different from that used in the previous chapters. Most of the proofs are either omitted or only outlined. Sometimes notions are introduced in a not entirely rigorous manner, and results are presented in a descriptive way rather than in the form of precise mathematical statements. In all of the models discussed so far rewriting is context-independent : the way a letter is rewritten depends on the letter only; the adjacent letters have no influence on it. This section discusses L systems with interactions, in short IL systems. In an IL system the rewriting of a letter depends on m of its left and n of its right neighbors, where (m, 11) is a fixed pair of integers. In this sense IL systems resemble context-sensitive grammars. However, as in all L systems, the rewriting according to an IL system is parallel in nature: every symbol has LXO
1
28 1
ILSYSTEMS
to be rewritten in each derivation step. I t may be of interest to know that IL systems were introduced to model the development of filamentous organisms in which cells can communicate and interact with each other. We now define formally the basic notion of an (m, n)L system, where m and 17 are nonnegative integers. An
Dclftiitioti.
(HI,
n)L sysrem is a triple G
=
(Z, P , 0).
where X is an alphabet, w E Z* (the uxiom), and P is a mapping of the set
u Zi m
I1
xi
x Z x
i=O
i=O
into the set ofall nonempty finite subsets of Z*. The fact that a word w belongs to P(c1, u, b) is written ( r ,( I ,
( 1.2)
p) -+
M'
and referred to as a producfion. A word IV yields direcrly another word symbols M' M" or shortly w 3 \L" if G is understood, if \\'
=
u1
' '
. u/(,
U' =
w1
'
. . lt'k,
k 2 1,
OiEZ,
MI', in
WiEZ*
and, for all i = 1, . . . , k, (1.3)
( u i - m u i - " , +., . . ui-
1, L / i , ( / i t
,
'
*
.Uj+J
+
wi
isaproductionofG.In(1.3)wedefinerrj = Awheneverj I Oorj 2 k + 1.As usual. -* denotes the reflexive transitive closure of the relation 3,and the languuge generated by G is defined by L(G) =
(\VICfJ
**
w}.
A n (m, n)L system is also called an I L system. (m,0 ) L (resp. (0, n)L) systems are called Ieji sided (resp. right sided). A system is one sided if it is left sided or right sided. (1.0) and (0, 1) systems are also called 1 L systems, in contrast to 2 L system, which is a name used for (1, l ) L systems. Two IL systems are called equiucrlenr if they generate the same language.
Thus, the left side of a production (1.2) consists of a triple whose first (resp. last) element can be viewed as a word of lengt h Im (resp. 5 n ) over Z, and the middle element is a letter of E.The intuitive meaning ofthe production (1.2) is that an occurrence of u between an occurrence of c1 and an occurrence of p can be rewritten as M'. If = 07,
< n1,
VI
282
OTHER TOPICS: AN OVERVIEW
then the occurrence ofa we are rewriting must be the ( m ,+ I)th letter in the word we are considering. An analogous remark applies if I /lI < t i . Thus, the domain of P is chosen to be the set (1.1) rather than
C" x C x Cn to provide productions for letters close to the beginning or to the end of a word, where there is not enough context. If we are dealing with long words, then in most situations la1 = m and I/jI = n. Shorter contexts are used only at the beginning and at the end of a word. For instance, if we are dealing with a (2,2)L system, the production (b, a, bb) -, aa is applicable to the word babb but not to the word bbabb. (It should be added that quite often in the literature dealing with IL systems the missing context at the beginning and at the end of a word is provided by a dummy letter g, i.e., instead of a word w the word fwg" is considered.) If we are dealing with left sided (resp. right sided) systems, then productions (1.2) are written (a, a) -, w
(resp. (a, /?) -, w).
Exuiiip/i) 1.1. Consider the following (1,O)L system G. The alphabet of G is { a , h, c, d } and the axiom uci. The system G is rirrerminisric, i.e., P is a mapping of the set X i x Z into Z* (rather than into the set of all nonempty finite subsets of X*). We define P by the following table, where the row indicates the left context and the column the symbol to be rewritten:
u!=o
>I
/I
[I
i(
ti
11
h
LI
h h
t/
tl tl
1'
/I
1'
11
1111
i/
ti
h
(I
(1
I/
Thus, for instance, an occurrence ofu without a left neighbor (it., ( I is the first letter in a word) must be rewritten as c, whereas an occurrence of a with the left neighbor c must be rewritten as h. Since G is deterministic, L ( G ) is generated as a unique sequence. The first few words in the sequence are cd, nud, cud, itbtl, chd, tiid, caad, abarl, chad, rrcrirl, cribd, irbhti. cbbd, ucbri, cucd, uhuud, . . . . rid,
1
IL SYSTEMS
283
Note that an occurrence of d with left neighbor c is the only configuration giving rise to growth in word length. This means that the sequence, viewed as a length sequence, grows very slowly. In fact, the lengths of the intervals in which the growth function stays constant grow exponentially. This point will be discussed below in connection with IL growth functions. 0 We already indicated in connection with the previous example what it means for an IL system G to be deterministic: P is a mapping of the set (1.1) into C*,i.e., for each configuration there is exactly one production. As usual, we abbreviate determinism with the letter D. We also use the letters P, E, and T in connection with IL systems with the same meanings as in previous chapters. Thus, P refers to propccyuting systems, i.e., the right side of every production differs from the empty word. E indicates that a subset A of C is specified such that only words over A are considered to be in the language of the system. (Equivalently, the original L(G) is intersected with A*.) T refers to systems with tables in the same sense as before: at one derivation step only productions belonging to the same table can be applied. Also combinations of these letters are used exactly as before. In particular, a system with tables being deterministic means that every table is deterministic. With these facts in mind, the reader should be able to understand, for instance, the meaning of a PDT( 1,O)L system. As usual, for any type XL of systems, we speak of X L languages, meaning languages generated by X L systems. It is clear that (0,O)L languages are the same as OL languages. Quite a large and thoroughly investigated problem area deals with interrelations (such as inclusion relations) among the various classes of IL languages, as well as interrelations between families of IL languages and other language families. Results concerning trade-off between various types of contexts and, in general, hierarchy results for IL language families belong to this area. We now discuss briefly some typical examples among such results. As regards IL systems, it turns out that within a given amount of context it is its character (one sided or two sided) rather than its distribution that is important.
As regards the proof of Theorem I . I , we mention the following idea used in the proof of (IS), which is very typical in constructions with IL systems. (1.5)
284
VI
OTHER TOPICS : AN OVERVIEW
is established by showing how to simulate an (m,n)L system G by an ( m - 1. n + l)L system G , , provided m 2 1. (Other transfers of the contcxt from one side to the other are accomplished analogously.) If a word a , . . . ak (where each ai is a letter) derives according to G a word a1 . . . ak,then in G , a,simulates a, by deriving a,, (while a,, derives A), u,- simulates a,- 1 , and so on. Finally, a l simulates in G , the effect of rewriting both u2 and u 1 according to G. Typically, a production (ah, a, p) + M’
in G is changed to the production (a, h, U P )
+
w
in G I . Also the inclusion in (1.4) is established by this construction. The strictness of the inclusion, as well as the “only if” part in (1.5) is shown by suitable examples. 0 Theorem 1.1 can be extended to yield the diagram in Figure 1. In the diagram the fami!y 9 ( ( m , n)L) is denoted simply by (m. ti). A line leading from one family to another stands for strict inclusion. (The lower family is the smaller one.) Two families not connected by an ascending line (such as (1 . I ) and ( 3 , O ) ) are incomparable.
1
285
IL SYSTIiMS
Thc previous diagram shows that in case of “pure” systems, i.e., without the E-mechanism, most of the language families obtained by different types of context are different. This is due to the fact that in pure systems all intermediate words in a derivation are in the language; consequently, it is not possible to reduce the amount of context by simulating one derivation step with several steps each of which uses less context. The situation is entirely different if nonterminals are available. Then one can simulate a derivation step ( 1.6)
11102
‘ ‘
’
c/k
* h’1wl
’ ‘ ’
W k
bytwostepsasfollows. In the first stepeveryletteruigoestotheletter(a,, ui+ i.e., to the pair whose second component equals the right neighbor of the original LI, : The new letters (pairs) are viewed as nonterminals. In the second step one goes back again to the original alphabet: Assume that the system of the original derivation is an E(m, n)L one with 2 2. In (1.8) the context needed is only (m.n - I ) because the information about the adjacent letter is contained in the new letter itself. For instance, a (1, 2)-production (a,h, c d ) + M’ iz
in (1.6) becomes the (1, I)-production ((a,b), (h, c), (c,
4 )-, w
in ( 1 3).Since only (0, I)-context is needed for productions in (1.7), we have been able to reduce ( m , n)-context to ( m , n - 1)-context, provided n 2 2. Operating with left neighbors, we can similarly accomplish the reduction from (m,n)-context to (m - I , n)-context, provided m 2 2. Neither nondeterminism nor erasing productions are introduced in this reduction process. Thus, if the original system is deterministic or propagating, so is the new one. By repeated applications of this reduction process any two-sided context can be reduced to ( I , I)-context, and any one-sided context to ( I , 0)- or (0, 1)context. These results are summarized in the following theorem. Theorem 1.2.
Assunir
thirr
X E {A, D, P, PD}. Theri
Y(EX1L)
=
Y(EX2L),
urid Y(EX 1 L) ryuuls t h r funiily (flirnyuuyes griierared systems.
hjl
ow sidcd E X I L
VI
286
OTHER TOPICS : A N OVERVIEW
The next theorem is based on the following two observations. In the first place, it is easy to simulate a Turing machine or a type 0 grammar by an EIL system. Consequently, LZ(EIL) = 2 ( R E ) . Similarly one sees that Y(EPIL) = Y(CS).Secondly, the simulation technique applied in (1.7) and (1.8) can also be used to reduce( 1, 1)-context to (0, 1)-context.(And the same technique operating with left neighbors can be used to reduce (1, 1)-context to (1,O)context.) Theorem 1.3.
Y(EIL) = Y(RE) = Y(E(0, l)L) = Y(E(1,O)L). .Y(EPIL) = V ( C S ) = Y(EP(0, 1)L) = Y(EP(1,O)L). As regards the proof of Theorem 1.3, let us discuss in more detail how one can simulate an EP( 1, l)L system G by an EP(0, l)L system G,. This simulation is considerably more difficult than the same simulation for nonpropagating systems. To get the system G I , we just mark the first letter of the axiom of G with a bar. One derivation step ula2 . . . ak
* bl b2 . . . hi
according to G is simulated by the following sequence of steps according to G I: i , a 2 . . . ak
-
(al, u 2 ) ( a 2 u, 3 ) .. . ( a k ,A )
* ( i l , U z U 3 ) ( a 2 ? U 3 U 4 ) ” ’ ( U k , A’) * [ b;h’;]b’;...b;B = ( h i , h;)(b;,h;)...(b;,B) * 61b2 * * . hi. Here the first two steps associate with each letter information about its two right neighbors, using (0, 1)-context. The third step carries out the actual simulation in such a way that (i) (al, ~ 2 ~ simulates 3 ) the rewriting of both a l and a ? , packing the first two letters in the result into one letter [byb’;];(ii) ( a z ,u3a4)simulates the rewriting of u 3 , and so on ;and (‘iii)( a k ,A) is rewritten as a boundary marker B. In the fourth step each letter guesses its left neighbor except the bracketed letter whose rewriting is deterministic as indicated. (Note that no context is needed in the third and fourth step.) In the fifth step we return to the original alphabet preserving the bar in the first letter and at the same time checking that the guesses made at the fourth step were correct. If an error is found, then a garbage letter, which can never be eliminated, is introduced. All letters above are considered to be nonterminals. There is an option to terminate at the fifth derivation step of the simulation cycle above. Then each
1
287
IL SYSTEMS
letter introduces a corresponding terminal letter, and, thus, the bar is removed. Terminal letters produce only garbage, and this guarantees that termination happens everywhere simultaneously. Thus, this is another application of the synchronization technique. 0 In the simulation process used in Theorem 1.3determinism is lost in general. This is basically due to the fact that the position of application of each production is switched one step to the left. Thus, we have to guess whether the letter we are dealing with is the first one. For instance, the ( I , I)-production for u2 in (1.6) becomes a (0, 1)-production for the first letter in (1.8). The phenomenon does not occur if the amount of context on one side is reduced from ni to ni - 1 > 0. This argument can be formalized to show that Theorem 1.3 cannot be extended to the deterministic case: there are ED2L languages that are not E D l L languages. It is fairly easy to obtain results about the interconnection between 1L and 2L languages. We mention the following as a typical result showing the effects of the simulation occurring in (1.7) and (1.8). Theorem 1.4. For uny D2L lcrnyuciye L, u D(0, 1)L language L' and a letter-to-letter homoniorphism h cun he effrctively constructed such thut h(L') = hL, where h is ci new letter.
Considering the simulation of Turing machines by ED1 L systems, the following result can be obtained. Theorem 1.5.
There are nonrecursiue D1 L lunyuuges.
Theorem 1.5 should be contrasted with the facts contained in the following theorem. For details, the reader is referred to [VS]. Theorem 1.6. There ure regular lunyuuges thut ure not contained in Y(ED1L),jbr instance, the kunguaye
L
=
{u, aa}
U
{hc'hli 2 0 ) .
Howecer, the,family Y(ED2L), us well as the closure ofthefamily Y(ED1 L) under lrttcr-to-letter homomorphi.sn7.s is eqiiul to Y(RE). Adult 1un~quuyc.sof IL systems are defined analogously, as in Section 11.3.The following theorem is the basic characterization result; cf. [HWa3]. Theorem 1.7.
Y(A1L) = Y(A1L) = Y(E1L) = Y(RE). Y(AP1L) = Y(AP1L) = Y(EP1L) = Y(CS).
288
VI
OTHER TOPICS : AN OVERVIEW
Also, the celebrated LBA problem can be expressed in terms of IL systems. We have already indicated the representation Y(EP1L) = Y(CS). It is shown in [VS] that the family of context-sensitive languages also equals Y(EPDT21L), where T, refers to table systems with only two tables, and that the family of deterministic context-sensitive languages equals Y(EPD2L). Therefore, the LBA problem amounts to solving the problem of whether or not a trade-off is possible between one-sided context with two tables and twosided context with one table for EPDIL systems. Because results like Theorem 1.5 hold even for simple subclasses of IL languages, it is to be expected that most problems dealing with IL languages are undecidable. Some examples of undecidability results are given in Exercise 1.6. As regards closure properries, IL language families behave analogously to OL language families: the “pure” families have very weak closure properties, mostly an anti-AFL structure; whereas families defined using the E-operator have in general quite strong closure properties. Examples of the latter fact can be given using the previously given equations Y(E1L) = Y(ED2L)
=
Y(RE),
9(EPIL)
=
Y(CS).
The following theorem, due to [RL2], serves as an illustration of closure results for pure families. Theorem 1.8. Y(IL) is an anti-AFL. However, Yp!IL) is closed under mirror image und marked slur.
A special class of IL languages are the unary languages, i.e., languages over a one-letter alphabet {b}.In derivations according to unary IL systems, the context can be used at the ends of a word only: a letter “knows” when it is close to the end of a word. In the middle of a long word (when the length is compared to ni + I J ifwe are dealing with (m,n)-context), the rewriting can be viewed as context-free because the context is always the same:just a sequence of hs. In spite of these limited possibilities for the use of context, a coherent mat hematical characterization (analogous to the one known for unary OL languages; cf. Exercise 11.5.9) is still missing for the family of unary IL languages. E.runiplt 1.2.
The unary language
( h “ l n = 3 ~ 2 ” +1 o r n = 5 . 2 ” - l f o r s o m e m 2 0 )
is IL. However, its complement is not even a TIL language. (Cf. [Klo].) The next example deals with the effect of the propagating restriction.
1 IL SYSTEMS Emrtiph 1 ..b
289
The language
{ ~ i " h u Z " ~ ~ ~ i Z>n h0)a nu~ {d'+mhu4n+2mhun+m n In, m > 01
is an OL language that is not in Y(PIL), as shown in [Ru2]. The notion ofan EILfbrnz can be derived from the notion ofan EIL system, analogously to what was done in the case of EOL systems in Section 11.6. Some of the results obtained for EIL forms are quite unexpected and cannot be viewed as generalizations ofresults concerning EOL forms or EIL systems. For instance, as regards reducibility in the amount of context, EIL forms lie "between" IL and EIL systems. (Reduction for EIL forms means, of course, the construction of aform rquiuulent EIL form F' which uses less context than the originally given EIL form F . ) Their behavior resembles in this respect deterministic EIL systems: reduction is always possible up to ( I , 1)-context but not in general further to ( I , 0)-context. It was pointed out in Section 11.6 that there is no EOL form F satisfying
Y(F) = Y(CF).
(1.9)
However, there are EIL forms satisfying (1.9). (The essential tool used to prove this fact is the result given in Exercise 11.6.5.)There are also EIL forms generating the family Y(ET0L). For all details, the reader is referred to [MSW7]. This section is concluded with a few remarks concerning D I L growth functions. Any deterministic (m, n)L system G generates a unique sequence of words E(G):
(1)
= (o0,w , , w 2 , . . .
.
(Thus, L ( G ) consists of all words appearing in E(G).) As in the case of DOL systems, the yrowthfuiictioii of G is defined by .fC(n)
= ((IJ,~
for all n 2 0.
Depending on special properties possessed by G, we may speak, for instance, of D2L or PDI L growth functions. No mathematical characterization, corresponding to the matrix representation of DOL growth functions, is known for DIL growth functions. In fact, the context-sensitivity of the IL rewriting makes such a characterization very difficult because the generating functions of DIL growth functions are not, in general. even algebraic functions. Consequently, DIL growth functions are much more general than the "exponential polynomials" representing DOL growth functions. Another consequence is that the problems solved for DOL growth functions in Sections 1.3 and 111.4 (such as growth equivalence,
v1
290
OTHER TOPICS : AN OVERVIEW
analysis, and synthesis) turn out to be undecidable for DIL growth functions even in the simple case of PDlL growth functions. A property of DOL growth functions also possessed by DIL growth functions is that growth can be at most exponential: for any DIL growth function j ; there are constants p and q such that f(n) I py”
for all n.
This is seen exactly as in connection with DOL growth functions: p is the length of the axiom and q the length of the longest right-hand side among the productions. On the other hand, unbounded DOL growth is at least linear, and the length of the intervals in which an unbounded DOL growth function stays constant is bounded; cf. Theorem 1.3.6. Neither of these properties is shared by PDlL growth functions: the growth order of a PDlL growth function can be logarithmic, and the length of the intervals in which an unbounded PDlL growth function stays constant can grow exponentially. The growth function of the PDlL system G given in Example 1.1 has both of these properties. Growth order smaller than logarithmic (such as log log n ) is not possible for unbounded DIL growth functions. This follows easily from the observation that the most any DIL system with an unbounded growth function can do is to generate all words over its alphabet without repetitions. In [K 11 an example is given of a PD2L system whose growth function f’ satisfies (1.10)
2%’’I f ( n ) I (2.J)?
Thus j ’ ( j 7 ) is neither exponential nor polynomially bounded, a property never possessed by a DOL growth function. On the other hand, the following interconnection between D2L and DlL (resp. PD2L and PDlL) growth functions follows by the first sentence of Theorem 1.4. Theorem 1.9.
I f f ( n ) is D2L (resp. PD2L) growth,finction, thenf([n/2])
+ 1 (resp.,f([n/2]) + [n/2] + 1) is u D l L (resp. P D I L ) growthfincrion.
Thus, there are even PDlL growth functions that are neither exponential nor polynomially bounded. There is also a rich hierarchy of growth functions of “subpolynomial” type. Examples are given in [VZ] of PD2L growth functions with growth order n‘, where r is any rational number satisfying 0I rI 1. Corresponding to (l.lO), there are also PDlL growth functions lying between logarithmic functions and fractional powers. All of these growth orders are impossible for DOL growth functions. The results also show that there are PDlL length sets that are not generated by any EOL system (cf. [K3] for details), and, consequently, there are PDlL languages that are not EOL languages.
291
EXERCISES
The undecidability results concerning P D l L growth functions are due to the capability of P D l L systems to simulate arbitrary effective procedures. For instance, the following method is useful for establishing undecidability properties. I t is undecidable whether a Turing machine ever prints a preassigned letter, say, h. (This is referred to as the printing problem.) One uses such a b to create the effect under consideration, for instance, exponential growth. Then deciding whether exponential growth is generated amounts to solving the printing problem of Turing machines. The following theorem, due to [VS], serves as an example of typical undecidability results. Theorem 1.10. The growth rqiriuulrrtce problem is utideciduble fbr PD1 L sj.strrn.\. I i is undecidable whether or not the growthfunction of a gitlen PD1 L sjwctn is hounded.
By Theorem 1.10 one can also prove that the language and sequence equivalence problems are undecidable for P D l L systems. The second sentence of Theorem 1.10 shows also that any reasonable formulation of the analysis problem for PDl L systems is undecidable because one would surely expect an analysis method to solve the problem of boundedness.
Exercises 1.1. Construct suitable examples to show the strictness of the inclusions in Theorem 1 . 1 . 1.2. Give an example of an EDZL language that is not EDlL. (Cf. [VS].)
1.3. Prove that there are ED1 L languages, as well as languages that are not ED1 L, in all "areas" of the Chomsky hierarchy (i.e., belonging to each of the differences of two families in thc hierarchy). 1.4. I t was shown in connection with Theorem 1.3 how one can simulate an EPZL system by an EPlL system. Compare this with the corresponding result for context-sensitive grammars : an arbitrary context-sensitive grammar can be simulated by a left context-sensitive one [PI]. Make it clear to yourself why the former simulation is much easier.
1.5. Prove Theorem 1.10. 1.6. Prove that the language and sequence equivalence problems are undecidable for PDI L systems.
VI
292
OTHER TOPICS: AN OVERVIEW
1.7. Give an example of a P D l L system whose growth function is asymptotically equal to (i) n ’ ” , (ii) ((i) can be accomplished by making sure that the lengths ofthe constant intervals grow in a linear fashion, (ii) that they grow in a quadratic fashion.) 1.8. Generalize the previous exercise by giving examples of the following types of P D l L growth: (i) an arbitrary fractional power, (ii) logarithmic, (iii) between logarithmic and all fractional powers. (Cf. [V2] and [K8].)
1.9. Define the notion of an EIL form. Investigate possibilities of (i) reducing the amount of context, and (ii) generating some known language families. (Cf. [MSW7].) 1.10. A propagating 2L system is essentially growing if every length-preserving production in it is interactionless (context-free). Prove that, as regards language generating capacity, essentially growing D2L systems lie strictly between PDOL and CPDOL systems. Prove also that the sequence equivalence problem is decidable for essentially growing D2L systems. Consult [CK]. Essentially growing D2L systems constitute the most complicated type of L systems known for which the sequence equivalence problem is decidable. Observe that it is undecidable for P D l L systems.
2.
ITERATION GRAMMARS
Various models have been introduced to provide a general framework for discussing diverse phenomena arising from different types of L systems. Some of these models are general enough to provide a framework both for parallel and sequential rewriting; cf. [R7]. The model discussed in this section, an ilercition grcrmmrrr, seems to capture some of the essential features of parallel rewriting. Although it is quite general, it is still detailed enough so that interesting specific results (such as Theorems 2.9 and 2.10 below) concerning the model can be obtained. The previous chapters of this book have presented L systems in terms of iterated finite substitutions (of which iterated homomorphisms are a special case). The notion of an iteration grammar generalizes the idea of an iterated substitution. Each table of an ETOL system G defines a finite substitution, and conversely a finite number of finite substitutions together with the axiom define an ETOL system. In the case of an iteration grammar we just allow the substitutions to be more general than finite. We now give the formal details. Consider a language family 6 p that is closed under alphabetical variance (i.e., renaming of the letters) and contains a language containing a nonempty
2
293
ITERATION GRAMMARS
word. (All language families discussed in this section are assumed to have these properties.) By an Y-suh.stirutiori over an alphabet C we mean a substitution 6 defined on X such that, for each ( I E C, & ( I ) is a language over C belonging to the family Y .Thus, Y’-substitutions iis defined here must satisfy an additional requirement concerning the alphabet. Dcjitiitioti. A n Y‘-iterutioii grurnnitrr is a quadruple G = (C,P, UJ, A), where Z and A are alphabets, A G C (referred to as the t n m i n u l ulphubrt), OJ E Z*(the uxiom),and
P
=
{Csl, . . . , (j,,;
is a finite set of Y-substitutions over C. We write .Y aGy or briefly x =.y, for and J in Z*, if J) E &(x) for some 6,in P. The reflexive transitive closure of the relation * is denoted by **. The luriguuge piirrtrtrtl by G is defined by .Y
(2.1)
L(G) =
{wEA*I(IJ-**\L’}.
The grammar G is termed srritrritiul or pirre if Z = A, propuguririy if each of the substitutions is A-free, and morphic if each of the substitutions is a homomorphism. ( I n the latter case the family V can be assumed to consist of all languages with only one word.) For an integer m 2 1, G is termed rnrc,srrictrd if the number I I of substitutions is less than or equal to m. f:’surtip/c~ 2.1. Assume that Y’ = V(FIN), the family of finite languages. Denote by X ( Y )the family oflanguages generated by Y-iteration grammars. Then it is easy to verify that
X(Y(F1N)) = Y(ET0L). Esrrrtip/i, 2.2. We still consider the family Y(F1N). Denote by . P ( Y ) the family 01’ languages generated by rn-restricted Y-iteration grammars. As in Example 2. I we see that
X’(Y(F1N))= Y(E0L). We use the lower indices S, P, or D (for “deterministic”) to indicate that we are dealing with sentential, propagating, or morphic iteration grammars. Then. for instance, the following equations itre immediately verified: Y/ \( Y’( FIN)) .HD( Y’( FIN))
= =
.Y(TOL), ,Y(EDTOL),
P ( p ( 2 ( F I N ) ) = Y(POL), FIN)) = ,Y(PDOL).
H&D(Y’(
In general, assume that X E {A, P, D, PD}. l h e n .X\X(Y(FIN)) = diP(XTOL), XX(Y(FIN)) = Y(EXTOL),
.X;’,(Y(FIN)) Xi(Y(F1N))
Y(XOL), = Y(EX0L). =
VI
294
OTHER TOPICS: AN OVERVIEW
(Here the index A is simply omitted.) Thus, the basic L families studied in the previous chapters of this book possess a simple representation in terms of Y(F1N)-iteration grammars. The notation introduced in the previous examples concerning the families of languages generated by U(FIN)-iteration grammars is used also in connection with arbitrary Y-iteration grammars. Moreover, languages in X ( U )are called hyperalgebraic over the family 9, and the language family Z ( U ) itself is called the hyperalgebraic extension of the family 2.(For algebraic extensions of language families, the reader is referred to Exercise 2.1, which also gives some motivation behind this terminology.) As regards the interrelation between the familiesX"(Y),rn 2 1, and X ( Y ) , it turns out that the transition from X"(Y)to X 2 ( 9 is ) the essential one. Theorem 2.1. Then
Assume that Y contains a language { b } , where h is a letter.
Z(2) = W " ' ( 9 )= X 2 ( 9 ) for each n7
2
2.
Proof: Since Y is closed under alphabetical variance, it contains all languages consisting of a word of length 1. Clearly, it suffices to prove the inclusion
(2.2)
Z"(9)c JP(Y)
for an arbitrary m > 2. (This implies that X ( Y ) E X 2 ( U )and , the reverse inclusions are obvious.) Finally, the inclusion (2.2) is established as Theorem v.1.3. 0
I t is not possible to include the value m = 1 in the statement ofTheorem 2. I , as seen by considering the families Y(E0L) and Y(ET0L). We have noticed that the pure L families have very weak closure properties, most of them being anti-AFLs. This phenomenon is due to the lack of a specified terminal alphabet rather than to parallelism, which is the essential feature of L systems. Recall that families obtained using the E-operator, such as Y(E0L) or Y(ETOL), have strong closure properties. We shall see that iteration grammars can be used to convert language families with weak closure properties into full AFLs in a rather natural way. Because of our subsequent considerations, we want to exclude some trivial language families Y . Therefore, we introduce some terminology. We say that a language family 2 ' is a pre-quasoid if 2 is closed under finite substitution and under intersection with regular languages. A qirasoid is a prequasoid containing at least one infinite language.
2
295
ITERATION GRAMMARS
It is easy to see that every pre-quasoid contains all finite languages. (Recall that by our convention every language family contains a language L with a nonempty word M'. Using the two closure operations, we get from MI the language { b ) ,where b is a letter, and hence all finite languages.) Similarly, every quasoid contains all regular languages. The family of finite languages is the only pre-quasoid that is not a quasoid. Every cone is a quasoid, but not necessarily vice versa, a cone always being closed under regular substitution. Theorem 2.2.
lj' 9' is u pre-quusoid (rrsp. quusoid), then the families
X(W)
.X'"(9')
und
where m 2 2 (resp. m 2 I ) arefirfl AFLs.
Theorem 2.2 shows that by iterating substitutions in the "L way" families with weak closure properties can be converted into families with strong closure properties. We shall see below that the resulting structures possess even stronger closure properties than those of a full AFL. The proof of Theorem 2.2 uses standard techniques. The following lemma, which is established in the same way as the corresponding results for EOL and ETOL systems, is needed. Lemma 2.3. I f .Y is prr-yuusoid, thrn,for every 9-iterution grunimur, there is UII rquiivilrnt propugutirig Y-irerut ion grammar.
I t depends on the family 9whether or not the construction in Lemma 2.3 is effective. The same remark applies to the results in this section in general.
Excrrrrpk~2..?. So far in our examples the family Y has been the family of finite languages. Consider now Y(REG)-iteration grammars. It will be seen below that
.#(-!?(REG))
=
Y(ET0L).
Also now # '(-Y(REG)) is a smaller family: Y(EOL) 5 .P*(Y(REG))$ #(9'(REG)). It can be shown that X ' ( Y ( R E G ) ) equals the family of languages accepted by preset pushdown automata, a machine model discussed in the next section. This family includes properly the smallest full AFL containing the family Y(EOL), which in turn includes properly the family 9(EOL).
We now consider a special class of AFLs, namely those equal to their own hyperalgebraic extension.
VI
296
OTHER TOPICS: A N OVERVIEW
Dejnition. A language family Y is called a yirll) hyper-AFL if it is a (full) AFL such that X ( Y )= Y . A language family V is called a (fiirll) hyper (1)-AFL if it is a (full) AFL such that X ' ( Y )= Y . By showing that the hyper-algebraic extension of the family Y(ET0L) equals the family itself, we obtain the following result. Theorem 2.4
The family Y(ET0L) is a jull hyper-AFL.
Because the operator .Fclearly is monotonic in the sense that (2.3)
Yl
G
Y2
implies
.F(V,)E -w'(Y2),
we obtain by Example 2.1 the following corollary of Theorem 2.4. Theorem 2.5. The family Y(ET0L) is the smallest hyper-AFL und the smallest full hyper- AFL. Consequently,
X(Y(F1N)) = X(Y(REG)) = .H'(Y(CF)) = A(Y(E0L)) = X(Y(ET0L)) = Y(ET0L). One can show that the operator .JT is idempotent, i.e.,N ( X ( Y ) )= .F(Y), provided the family 2 ' is a pre-quasoid. This fact together with the previous theorem yield the following results. Theorem 2.6. Assume that thefamily Y is a pre-quasoid. Then .X(Y)i s a full hyper-AFL and contuins the family Y(ET0L).
Theorems 2.5 and 2.6 exhibit the central role of the family Y(ET0L) in the theory of hyper-AFLs and, thus, give additional evidence of the importance of the family V(ET0L) in the general theory of language families. Theorem 2.6 shows (in a stronger form than Theorem 2.2) that X ( Y ) always has nice closure properties (provided Y is a pre-quasoid) although Y itself might not behave so nicely. Consequently, one might tend to believe that arbitrary hyperalgebraically closed families, i.e., families satisfying the condition X ( Y )= Y have nice closure properties. The following theorem shows that this need not be the case. Theorem 2.7. hyper-AFL.
There exists a hyperalgehraically closed family that is not a
In particular, the family Y consisting of unconditional transfer contextfree programmed languages under leftmost interpretation (cf. [S4]) satisfies Y ( Y )= Y but is not closed under intersection with regular languages.
2
297
ITERATION GRAMMARS
Various hierarchy results concerning hyper-AFLs are known. The following serves as an example. Theorem 2.8. There exists an injnite ascending chain of hyper-AFLs strictly contained in thefumily of conrext-sensitive languages:
Y(ET0L) = 9
0
59 15
9 2
5 ... 5 9 j5
* * *
5 L?(CS).
We outline the proof of Theorem 2.8. Consider ETOL systems with a control language on the use of tables. The family of languages generated by ETOL systems with control languages belonging to the family 2’ is denoted simply by (9)ETOL. Define now Y o= Y(ETOL),
Y j = (X’j-l)ETOL ( i > 0).
One can show that each (2’,)ETOL is hyperalgebraically closed, whence it follows that each Y jis indeed a hyper-AFL. The inclusion pipi E Zi+ clearly holds for all i. The strictness of the inclusion is seen by considering functions j o ( x ) = 2”,
f ; ( x ) = 2’4
I ‘ ~ )
( i > 0)
and languages
L j = {bJi‘”’lx2 0)
( i 2 0).
By induction on i it is immediately seen that LiE Yi.That Li 4 2’- follows because the growth rate of J ( x ) exceeds the rate possible for languages in Y j - This again is seen inductively by noting first that the growth rate in Y(ET0L) is at most exponential. In the inductive step it is useful to note that attention may be restricted to propagating ETOL systems. 0 We now present some generalizations to iteration grammars of results known for EOL and ETOL systems. These generalizations also show that the notion of an iteration grammar is still specific enough to yield counterparts of fairly strong theorems at a more general level. For an iteration grammar G, the spectrum of G consists of all nonnegative integers i such that a derivation of length i, starting from the axiom and ending with a word over the terminal alphabet, is possible according to G. Theorem 2.9. For every iterution grammar G , the spectrum of G is an ultimately periodic set.
Theorem 2.9 shows that the fact that the spectrum is ultimately periodic depends only on themethod ofiterated substitution in defininga language,and not on the finiteness of substitutions.
298
VI
OTHER TOPICS : AN OVERVIEW
Languages in the family X s( 2')are called hypersentential over the family 9, and the family .X,(U) itself is called the hypersentential extension of the family 2'.This terminology reflects the fact that, because of the lack of a special terminal alphabet in sentential iteration grammars, the languages generated by these grammars resemble languages consisting of sentential forms of phrase structure grammars. The following theorem gives a general result concerning the interrelation between the E-operator and the homomorphic images as language-defining mechanisms. The theorem is weaker than, for instance, the special result Y(E0L) = Y(C0L) because the homomorphism may be erasing. Theorem 2.10. Assume that 9is a language family containing a language ( b } and closed under intersection with regular languages. A lanyuuge L is hyperalgebraic over Y i f and only i f there exist a language L' hypersentential over 2' and a length-decreasing homomorphism h such that L = h(C). We have discussed properties of the operator Y and the resulting facts concerning hyper-AFLs. In particular, we have seen in Theorem 2.6 that the operator S is idempotent, provided it is applied to pre-quasoids. The situation is essentially different if we are dealing with the operator .Y( and hyper (1)-AFLs. This means that we are iterating just a single iterated substitution. Basically, the difference between Sand #'-operators is analogous to the difference between ETOL and EOL systems. We denote
'
(S')y2')= 9,
( X l ) i +' ( 9 = ) #'((X')i(9)),
for i 2 0. Furthermore, we denote by ( X ' ) * ( U the ) union ofall of the families (S')'(9), where i 2 0. The following result is easily obtained from the definitions. Theorem 2.11. If Y is a pre-quasoid, then (3?')*(2is')the smallest full hyper (1)-AFL containing 9.Thefamily (2.4)
(XI)*( 2'(FIN)) = (A?')*(Y (EOL))
is the smallestfull hyper (1)-AFL.
By Theorem 2.5 it is clear that the family (2.4) is included in the family 9(ETOL). It is a more difficult task to show that the inclusion is strict. The basic idea behind the argument is the following. We say that a language L can be 3-copied in a family Y if {w# w # w I w E L } E 9.
299
EXERCISES
(Here # is a marker not belonging to the alphabet of L.) For instance, all EDTOL languages can be 3-copied in V(ETOL). However, if L has too many strings, then L cannot be 3-copied using iterative single iterated substitutions. For instance, the language {u, b}* cannot be 3-copied in the family (2.4). This shows that the family (2.4) is strictly included in Y(ET0L). Theorem 2.12. The .smulle.srf u l l hyper (I)-AFL, i.e., the furnily (2.4) is strictly iticluded in the smullrst Jirll hyper-A FL, i.e., in the family Y(ET0L). Furthertnore,fi7r each i 2 0,
(,Y1)i(Y(FIN))$ ( X I ) ' + l(Y(F1N)). We mention finally that various modifications and generalizations of iteration grammars have been introduced. For instance, a generalization to context-dependent rewriting is discussed in [W 11. Especially interesting is the notion of a deterministic 9-iteration grammar. This means that the substitutions involved are viewed as deterministic substitutions: the same word has to be substituted for each occurrence of the same letter. Otherwise, our previous definitions remain unaltered. The following example should clarify the difference. E.t-urrip/t~2.4.
Consider the P(FIN)-iteration grammar G
where the only substitution
(5
(la}, (61, 0,{ a ) ) , is defined by
=
6(u) = {A, a', u ' } .
Then L ( G ) = (I* if G is viewed as an ordinary iteration grammar, whereas L(G) = ( ~ ' " ~ " ' l nm, 2 0 ) u { A }
if G is viewed as a deterministic iteration grammar. One of the basic facts concerning deterministic iteration grammars is that the family of languages generated by deterministic Y(F1N)-iteration grammars equals Y(EDT0L). The theory of deterministic iteration grammars is similar to that of ordinary iteration grammars. However. the proofs in the detcrrninistic case are often more complicated than in the nondeterministic case. Exercises 2.1. Consider the following modification of an 9-iteration grammar. There is just one substitution (5 and rewriting is sequential: at each step of the
300
VI
OTHER TOPICS : AN OVERVIEW
rewriting process, some occurrence of a letter h is rewitten as some word in b(b).A language is termed ulgebruic over dip if it is generated by such an Y iteration grammar. The family of languages algebraic over 9 is termed the ulgebruic extension of dip. Prove that the algebraic extension of the family of regular languages is the family of context-free languages. Prove that if the Parikh sets of languages in Y a r e semilinear, the same holds true for languages in the algebraic extension of 9. (Cf. [vLS].) Observe how the definitions of an algebraic extension and an algebraic power series are interrelated. (Cf. [SS].) 2.2. Explain why in the previous exercise we have just one substitution. Contrast the following three possibilitiesfor iteration grammars: (i)sequential rewriting, (ii) parallel rewriting with one substitution, and (iii) parallel rewriting with several substitutions. What condition on the substitutions assures that there is no difference between the sequential and parallel case? Cf. Exercise V.1.7.
2.3. Prove Theorem 2.2 and Lemma 2.3. 2.4. Prove that the hyperalgebraic extension of the family of ETOL languages equals the family itself. (Cf. [Ch].)
2.5. Prove Theorem 2.9. Observe why the ultimate periodicity depends on the parallelism and not on the type of substitutions.
2.6. Prove that the language { a P l pis prime} is not an ETOL language.
2.7. Iteration grammars generalize the idea of iterating finite substitutions to arbitrary substitutions. Another possibility of generalization is to consider iterated gsm mappings. Study the generative capacity of rewriting systems obtained in this fashion. (Cf. [W 11.)
3. MACHINE MODELS In this scction we shall consider machine models for various classes of L languages. Characterizing classes of languages by machine models is a traditional topic in formal language theory. Quite often a machine model is a very convenient tool for intuitive reasoning about various properties of languages in a given class, whereas usually grammar models form a stronger tool in providing formal proofs. Also (as will be indicated, e g , in Section 4),
3
M A C H I N E MODELS
/
/
301
/'
I I
I
\
'\ external memory
machine models play a very essential role in considerations concerning complexity of recognition and parsing of different language classes. We consider here two different machine models characterizing the class of ETOL languages. The tirst of those (cf. [vL2]), perhaps the most elegant model for Y(ETOL), is a top-down model, meaning that, when properly viewed, it recognizes a word in its language by constructing for the word a derivation tree in the "corresponding" ETOL system in the top-down fashion. In a sense it is a variation of the classical pushdown automaton model and can be described as follows. A checking stuck pirshdown u i i t o n i ~ t o i(abbreviated i as a cs-pd automaton) is a machine model with the structure shown In Figure 2. Its external memory consists of an ordinary pushdown stack augmented by a so-called checking stack (cf. [Gl]). Before a computation on an input (x) begins, the checking stack of an automaton ( M ) is filled in with an arbitrary word ( y ) over the alphabet ( 0 )of the checking stack (where y is enclosed between the left-end marker # and the right-end marker $)and the pushdown stack contains only a bottom-marker (Zo).The read-write head of the pushdown store and the read-only head of the checking stack are coupled in such a way that any push, pop, or"stay at the same place" move ofthe pushdown store induces the same kind of move on the checking stack (that is, move to the right, move to the left, and stay at the same place, respectively). Thus, in particular, it implies that the length of the pushdown stack during a computation on x is equal to the distance between the checking stack head and q!. At the beginning of a computation the pushdown head reads Z,, the checking stack head reads 6, the input head reads the leftmost symbol of x,and the machine is in the starting state. In a single move M reads the current pushdown symbol, the current checking stack symbol, and (possibly) tbe current input symbol; based on this information and its current state, M chooses its new state; on the push-down
302
VI
OTHER TOPICS : AN OVERVIEW
stack it either pops the current symbol or overwrites it with a new symbol or pushes a new symbol on top of it (the checking stack reading head makes the corresponding move), and it moves the input head one symbol to the right if the input was read in this move. Therefore, the transition function 6 of M is a function from Q x (Z u { A } ) x r x (0 u {$, $}) into the set of subsets of Q x I , where Q is the (finite) set of states of M , X its input, r its pushdown alphabet, and 1 is the (finite) set of instructions of M where each instruction is either of the form pop or ourrwrite(y)for 7 E or push(y) for y E I-‘. This transition function (5 determines a single move of M in the fashion explained above. The larigirage o f M consists of all words x over E such that there is a finite sequence of moves of M (beginning in a starting configuration as described above with some filling of the checking stack) leading to a configuration in which the rightmost symbol of x was read and the pushdown stack is empty. (As usual one can define the acceptance of a word by a final state: this leads to the same class of languages defined.) We shall use Y(CS-PD) to denote the class of languages defined by cs-pd automata. One can view a cs-pd automaton as a transducer as follows (cf. [ESvL] and [ERS]). The checking stack contents is to be considered as an input (we fill it in an arbitrary way before a computation starts anyhow!). The pushdown store becomes the external memory and the input tape becomes the output tape. Hence, we get the picture shown in Figure 3. in this way a cs-pd automaton can be viewed as a restricted version of the 2-way pushdown transducer. Now reading an input letter G in a cs-pd automaton becomes outputing of in the transducer (if the automaton does not read 0 in a given move, then the transducer outputs A in this move). Hence, now the transition function is becomes a function from Q x r x (0u {q!, $1) into the set of finite subsets of Q x 1 x (X u {A}); we refer to 0 as the input alphabet and to 1 as the output alphabet. We talk in this case about a cs-pd rrunsducrr M, and its (output) language consists of all words over X produced
1
h OUTPUT
3
303
M A C H I N E MODELS
as output words during finite sequences of moves of M (beginning in the starting configuration with the empty output word and some input word) leading to a configuration in which the pushdown stack is empty. It is easily seen that the class of (output) languages of cs-pd transducers equals the class Y(CS-PD). The cs-pd automata (or transducers) characterize the class of ETOL languages in the following sense ([vL~]). Theorem 3.1.
Y(CS-PD) = Y(ET0L).
Intuitively speaking an ETOL system G is simulated by a cs-pd automaton M in such a way that the checking stack of M contains a sequence T of (names of) tables from G, and the pushdown stack is used to construct (in a leftmost topdown fashion) the derivation tree of a derivation with its control sequence equal t.The simulation of a cs-pd automaton by an ETOL system is a (rather involved) variant of the classical construction of a simulation of a pushdown automaton by a context-free grammar. A nice feature of cs-pd transducers (automata) is that they admit quite natural “structural” restrictions which yield characterizations of various subclasses of YP(ET0L). We shall discuss some of these now. A cs-pd transducer is called deterministic if (as usual), for every (4, Z , 7 ~ in ) Q x x (0 u $}), # 6 ( q , Z , 7c) = 1. (The reader should note that this kind of determinism is inherent in the transducer point of view for cs-pd machines, and it does not really make sense when M is viewed as an automaton; this is one of the reasons why the transducer point of view for cs-pds is often more useful.) We use Y(DC‘S-PD) to denote the class of languages defined by deterministiccs-pd transducers. I t is very instructive to see that this deterministic restriction in cs-pd transducers corresponds to the generative determinism of ETOL systems, as stated in the following result from [ESvL]. {$?
Theorem 3.2.
Y(DCS-PD) = Y(ED1’OL).
If we forbid a cs-pd transducer using its external storage (its pushdown store), then we get the well-known 2-way generalized sequential machine (or from the automaton point of view the well-known checking stack automaton). And if we additionally require that such a machine be deterministic (as defined above), then we get the well-known 2-way dgsm model. Let us denote the class of (output) languages of these machines by Y(2DGSM). This way o f restricting cs-pd transducers yields a characterization of the class of ETOL languages of finite index (see [Ra] and [ERS]). Theorem 3.3.
Y(2DGSM)
=
Y(ETOL),,, .
304
VI
OTHER TOPICS AN OVERVIEW
The intuitive idea behind the proof of the inclusion L?(ETOL)F,Ns Y(2DGSM) is that in a finite index ETOL system G that is in finite index normal form each derivation tree (of a word in L(G)) is such that if we discontinue it on nodes with terminal labels, then the width of the tree is bounded by a constant dependent on G only. Hence, the input tape of a 2DGSM simulating G can contain, appropriately coded, a derivation tree from G. We can also restrict the use of the checking stack by a cs-pd transducer M . Since now the checking stack is the input of M , we do not want to abandon it totally (this would yield the usual pushdown automaton); but we can restrict it to using only one checking stack symbol (except for 6 and $). If M satisfies this restriction, then we say that M is unury. Clearly, in a unary cs-pd transducer the only role that the checking stack plays is to “preset” the maximal height of a pushdown stack for a computation before the computation begins. For this reason, unary cs-pd acceptors are referred to as preset pushdown automutn ([vL~].) Let us denote by Y(UCS-PD) the class of languages defined by unary cs-pd machines. It turns out [vL3] that unary cs-pd machines characterize the class %‘(L?(REG)) discussed in Section 2. (Let us recall that a language is in X’(Y(REG)) if it can be generated by an iteration grammar that differs from an EOL system only in that the set of productions for a single symbol is regular rather than finite.) Theorem 3.4.
Y(UCS-PD) = R 1 ( 9 ( R E G ) ) .
Thus, although “unary restriction” corresponds to the use of only one table, it is still too weak to characterize the class of EOL languages. We note here that the proof of Theorem 3.1 from [vL2] actually consists of showing that Y(CS-PD) = X(Y(REG)). To achieve a characterization of Y(E0L) we have to consider an additional restriction of a structural nature, defined in [VL~].
We say that a cs-dp transducer M has the Ifr property if there exists a positive integers such that ifduring a successful computation M visits a cell c of the pushdown store, then the number of times that M will visit the cell c again before it pops c out for the first time is bounded by s. (Actually, in [vL3] this property was defined as the conjuction of two other properties.) Let Y(LFR-UCS-PD) denote the class of languages defined by unary cs-pd transducers satisfying the lfr property. Then we get the following machine characterization of the class of EOL languages (cf. [vL3]). Theorem 3.5.
Y(LFR-UCS-PD) = Y(E0L).
The cs-pd machine model admits also various extensions in which the checking stack is replaced by more powerful memory structures. I t is demon-
3
MACHINE MODELS
305
strated in [ESvL] how, replacing the checking stack by an ordinary stack, one can define various subclasses of the class of macrolanguages introduced in [F]. Replacing the checkingstack by a“checking tree”givesrise toa restricted pushdown tree transducer that can be used to characterize several classes of tree transducer languages ([ERSI). O u r second machine model for IU(ET0L) is essentially a bottom-up model, meaning that, when properly viewed, it recognizes a word in its language by constructing for the word a derivation tree in the “corresponding” ETOL system in the bottom-up fashion. Again, it is a variation of the classical pushdown model for Y ( C F )and can be described as follows (cf. [RW]). A pushdown urray of pushdowns urilomtrton (abbreviated as a pup urrtomuton) is a machine model with the structure shown in Figure 4. Its external memory consists of a pushdown store (array) each element of which is a pushdown itself (called a component pushdown). The finite control has access to the top component pushdown only; it processes really the bottom symbol of this component pushdown; however, it has to “pay the price” for each processing, which is (a symbol or the empty word) deposited at the top of this component pushdown (we may assume that the alphabet of bottom symbols of component pushdowns and the alphabet of symbols occurring elsewhere on those pushdowns are disjoint). Hence we can view each component pushdown as consisting of the bottom symbol and its “price tag” formed by the rest of the stack. Such a price tag becomes important when (based on the bottom symbol of the top pushdown and on its state) the automaton decides to pop up the whole component stack (the top one). If there is another component pushdown under it, then such a pop-up is allowed only if the price tags of the
306
VI
OTHER TOPICS : AN OVERVIEW
pushdown to be popped and of the pushdown immediately under it are equal. The automaton can also decide to create a new pushdown on the top of the array; in particular the reading of the current input symbol CJ consists of creating a new component pushdown whose bottom (and the only one) symbol equals CJ. Among the finite number of states of a pap automaton M there is a distinguished one called the central state q,; it plays a special role because some instructions can be executed only if M is in q, and the execution of some instructions always leads to q c . Moreover, q, is the starting state of M , where in the startingconfiguration the array is empty and the input head is positioned over the leftmost symbol of the input word. The lunguaye of M consists of all the input words for which there exists a finite computation beginning in the starting configuration and leading to the empty array and a final state (with the whole input being read off.) Because of the special role that the central state plays in a pap machine there is quite a number of details (special cases) that one has to describe carefully in defining the operation of a pap machine. For this reason, we have decided to give a formal definition of a pap automaton and its language. Dejnition.
(i) A pup automatoti is a construct M = (C, V, T, Q, F , q,, I , 6) where C is a nonempty finite set (of input symbols), V is a nonempty finite set (of bottom symbols), C G V, T is a nonempty finite set (of ray syntbols), Q is a nonempty finite set (of srares), F G Q (elements of F are called,final states), qc E Q (the central srate), I is a nonempty finite set (of ittsrrucriom), and 6 is a function (called the basic transitionfunction) from Q x (I/ u { A } ) into the finite subsets of Q x I . Each instruction from I is in one of the following forms : read, ouerwrite(z, r ) for Z E V and C E T u {A}, clear, pop, and push(z, t ) for Z E V and r E T u {A}. (ii) A single move of M is defined as follows. A conjyurarion of M is a triple (x,y, q ) where x EX*,y E ( V x T*)*, and q E Q. We say that M is in configuration (x, y , q ) if M is in stateq, x is the remainingpart of the input to be read, and the sequence of pairs ( z , u) forming y describes the sequence of component pushdowns (from bottom to top) with z being the bottom symbol and u the tag of the corresponding component pushdown. If a,, . . . , u, E C and s , , s2 are configurations with s, = ( a , . . . a,, (z1, u I ) . . . (z,,, u,,), q), then we say that s1 direcrly derives s2 in M , denoted as s, s2 if one of the following holds: (1) [READ INPUT]
m 2 1,
q = qc,
3
307
MACHINE MODELS
and ~2 = ((12
a,,,
' '
( ~ 1 ,111).
. ( z , , u , ) ( u ~ ,A), 4,),
where ( q c , r e d ) E 6(yc, z,); (2) [OVERWRITE] )I
2
I,
s2
=
(N1
. . . a,,,
1'1).
(:I,
'
. (2,-
I?
u,-
1)(z,
P,t),
4,)
where (q,, overwritr(:, t ) ) E 44,z,); (3) [CLEAR] II =
s 2 = (al . . . (I,,, A,
and
1
q)
where (I # 4, and ((I, clear) E ( 4 . 2,); (4)[POP-UP] I1
2 2,
I',- 1 =
c,,
and s 2 = (111
. . . a,,,
(z1, c 1 ) .
.
'
(2,- I,
r,-
I),
4)
where q # y, and (4, p o p ) E 6(q, z n ) ; ( 5 ) [PUSHDOWN] y
=
(1,
and
s2 = ( u I . . . (I,,,, (zl.
. . (q,, u,)(z,
P ) , 4,)
where c E T* and (4,,push(z,I ) ) E &qc, A) with either v = t = A or u # A and r equal to the rightmost symbol of I'.
+
(iii) As usual the relations and $ ( t l c r i r ~ sin M ) are defined as the transitive and as the transitive and reflexive closure of G.respectively. (iv) Thc larigirage of M , denoted L(M), is defined by L ( M ) = (sE C* l(x, A, y,)
6(A, A, y) where y E F ) .
(Thus M accepts by empty store tiritl final state.)
( 1 ) Note that wc allow in a single pushdown move creating a Remark. new component pushdown of the form ( z , where u is an arbitrary tag (an Clearly, such an instruction could be replaced by a sequence element of T*). of instructions beginning with creating a stack of the form (u, t ) where f is an element of T u ( A ) followed by a sequence of overwrite instructions. (2) Note that it is required that to execute a pop-up instruction the tags of the top component pushdown and of the component pushdown directly under it must be equal. Among other things, this implies that at any moment during an arbitrary successful computation of a pap machine M the sequence 11)
VI
308
OTHER TOPIC'S AN OVERVIEW
of heights of the component pushdowns (starting with the bottom component pushdown) is a nonincreasing sequence. (More precisely, it implies that if during a successful computation the external memory is of the form ( ~ ~ , ~ ~ ) ( z ~ , ~ ~ ) ~ ~ ~ ( z , , ~ ,isaprefixofuiforalliE{I ),thenu~+, ,...,n - I}.) The reason for this is that if a component pushdown is processed, then its height can never be decreased. The pap automaton model yields the following characterization of the class of ETOL languages (we use Y(PAP) to denote the class of languages accepted by pap automata). Theorem 3.6.
Y(PAP) = Y(ET0L).
Intuitively speaking an ETOL system G is simulated by a pap automaton M in such a way that M uses its bottom symbols to construct a derivation tree in G (in a leftmost bottom-up fashion), whereas the tags represent the sequences of tables used in the already constructed part of a derivation. Also, the pap machine model admits various structural restrictions that yield characterizations of various subclasses of the class of ETOL languages. Perhaps the most natural restriction consists of requiring that a pap automaton has only one tag symbol available (which corresponds to the use of only one table). In this case every component pushdown really becomes a counter, and for this reason we refer to such a pap machine as a pirshdown arruy of' counters automaton (abbreviated as a pac automuton). The class of languagesdefined by pac automata is denoted by Y (PAC) and is characterized by the following result (cf. [RV4]). Theorem3.7.
Y(PAC) = X'(L?(REG)).
Clearly the central state plays a very essential role in the operation of a pap acceptor. One can even strengthen its role by requiring that there eltists a positive integer constant k such that a pap automaton within each sequence of k consecutive steps of any of its computations must visit its central state at least once (which implies that the number of consecutive pop-up actions is bounded). A pap automaton satisfying this restriction is called restricted (or more precisely k-restricted) and the class of languages defined by all restricted pap automata is denoted by Y(RPAP). It turns out that this restriction is not strong enough to yield a strict subclass of Y(ET0L). The following result was proved in [RW]. Theorem 3.8.
Y(RPAP) = Y(ET0L).
3
MA(‘HIN1. MODELS
309
However, if we impose this restriction on pac automata ( Y ( R P A C ) denotes the class of languages so obtained). then we get a machine characterization of the class of EOL languages ([R3]). Theorem 3.9.
Y.’(RPAC) = Y(E0L).
A nice feature of the pap machine model is that it not only does admit various structural restrictions yielding characterizations of various subclasses of Y’(ETOL), but it idso admits quite natural extensions, allowing one to characterize various classes of languages larger than Y(ETOL). A pop-up instruction in a pap automaton M can be performed only if tags of the top component pushdown and of the pushdown immediately under it are equal. In general, one can consider allowing a pop-up operation only if a specific relation holds between the tags of the top pushdown and of the pushdown directly under it. It is shown in [RV4] how a specific relation yields, e.g., the class of EIL languages (and hence the class of recursively enumerable languages). Another observation is that one can view the structure of state transitions in a pap automaton M as shown in Figure 5, where q, is the central state of A4 and M , , . . . , M , are finite automata. Hence, i t is natural to extend the control structure of a pap machine to allow M , . . . . , M, to be acceptors of various kinds, not necessarily finite automata. It is demonstrated in [RV4] how in this way one obtains naturally acceptors for various classes of languages generated by iteration grammars. As we have remarked already, cs-pd machines and pap machines are “dual” models for Y(ET0L) in the sense that the Iormer recognize words in a topdown fashion and the latter in a bottom-up fashion. Actually, the memory structures of both machine models are very closely related. If the memory of a papautomatoncontains(z,, L > ~ ) ( :u~2, ) . . . ( ; , , o,),thenthetagsu,, u 2 , . . . , I % , (and in particular r,)correspond to thechecking stack ofthecs-pd automaton,
310
VI
OTHER TOPICS : AN OVERVIEW
whereas the sequence zl, z2,. . . , z, corresponds to the pushdown of the cs-pd automaton (more precisely, zi is the contents of the pushdown square opposite to the checking square which contains the top symbol of vi). It is very instructive to notice that both models can be obtained as special cases of the model studied in [G2] in which the external memory also consists of a pushdown, elements of which are also pushdowns; however. it operates in a different fashion than does the pap model. 4. COMPLEXITY CONSIDERATIONS We have investigated in this book a number ofdecidability properties. Once a problem has been shown decidable, one can study the complexity of the decision method, for instance, in terms of time or memory space required. Thus, we might consider the time (i.e., the number of steps required) or space (i.e., the number of squares used in a computation) needed by a Turing machine. Conversely, we might require that when processing an input of length n , a Turing machine may use S ( n ) squares or computation steps only. where S is a previously given function. This gives rise to a cornplrxiry class consisting of problems that can be solved in such a way that this requirement is satisfied. According to the customary usage in complexity theory, we denote by DTIME(S(n)) (resp. NTIME(S(n))) the class of problems solvable by deterministic (resp. nondeterministic) Turing machines in time S(n). The notations DTAPE(S(n)) and NTAPE(S(n)) are defined analogously. Following again the customary usage, we denote briefly by P (resp. NP) the class of problems solvable by deterministic (resp. nondeterministic) Turing machines in polynomial time. A problem is NP-complere if it is in N P and, moreover, its being in P implies that P = NP. For more detailed definitions and discussion on the various Turing machine models, as well as motivation and background material, the reader should consult some exposition on complexity theory. Most of the work done on the complexity of L systems deals with the complexity of the membership problem for some class of L languages. In many cases there is a direct connection to some results on the complexity of parsing algorithms for context-free grammars. We begin with some general remarks concerning L families. Theoperator E has no significance as regards thecomplexity of the membership problem. More specifically, we have for any function S ( n ) and any language classes Y(XL) and Y(EXL): Y(XL) c DTIME(S(n))
if and only if
Y(EXL) G DTlME(S(n))
if and only if
YV(EXL) E NTIME(S(n)),
and yI(XL) z NTIME(S(r2))
4
31 1
COMPI.EXITY CONSIDERATIONS
analogous equivalences being valid for the classes DTAPE and NTAPE. (Here a language family being contained in a complexity class means that the membership problem for languages in the family is in the complexity class.) Because by Theorem 1.3 Y(E1L) = X’(RE), there are 1L systems of arbitrary complexities. Theorem 4.1. For each recursiile S(n). tlicre is u 1L systenz G suclz thut L(G) i s rieitlier i r i NTlME(S(n)) r ~ o rin NTAPE(S(r1)).
Erasing is essential in the previous theorem (because propagating IL systems generate only context-sensitive languages). The situation is different for OL systems: because Y(EOL) = Y’(EP0L) (cf. Theorem II.2.1), these two families have the same complexities with respect to time and space. Results have been obtained for the time complexity of EOL parsing similar to the results known for the corresponding sequential grammars, i.e., contextfree grammars. The following theorem, due to [OC], was obtained as an application of the Younger algorithm for parsing context-free languages in time 1 1 ~ . Theorem 4.2.
Y(EOL)
G
DTIME(rr4).
Using Strassen’s fast matrix multiplication algorithm, it was shown in [vL7] that the EOL languages can be accepted in time proportional to I I 1 t log2 7 by deterministic (random access) Turing machines. This result is analogous to Valiant’s method for recognizing context-free languages in less than cubic time. It was established in [Su] that EOL languages are in DTAPE(log2 n). The same tape bound has been established also for context-free languages. Moreover, the following theorem reveals a remarkable interconnection between the EOL and context-free tape complexities. Theorem 4.3.
Y(EOL)
G
For u n j ~r e d riunzber k 2 1,
DTAPE(logkn )
$atid nnljt
if’
Y(CF) G DTAPE(logk 1 2 )
arid
Y(E0L)
c NTAPE(logk H)
ij’crnd oiilj~I f ’
olp(CF) E NTAPE(logk t i ) .
The proof of Theorem 4.3 makes use of the concept of an auxiliary pushdown automaton. Thus, tape complexity classes d o not separate EOL languages from contextfree languages. We want to emphasize that no analogous result is known for time complexity.
VI
312
OTHER TOPICS : AN OVERVIEW
The following stronger result can be obtained for the smaller family Y(ED0L) by considering a simple algorithm.
Theorem 4.4.
Y(ED0L)
c DTAPE(1og n).
Many of the most interesting results and open problems in the complexity theory of L systems deal with ETOL languages. To get a better perspective, we mention first some more general results from the area of iteration grammars. We first introduce some terminology and notations. A function is called semihomogeneous if, for every k , > 0, there exists a k 2 > 0 such that f ( k , x ) Ik,f’(x)
for all x 2 0.
The notations N’TAPE(S(n)) and D’TAPE(S(n)) refer to the subfamilies of NTAPE(S(n)) and DTAPE(S(n)) consisting of A-free languages.
Theorem 4.5. If’S(n) 2 n log n, then DTAPE(S(n)) is hyperalgebraically closed. If in addirion S(n) is semihomogeneous, then DTAPE(S(n)) is a hyperAF L. Theorem4.6. If S(n) 2 n, then NTAPE(S(n)) is an AFL und N’TAPE(S(n)) is a hyper-AFL. I f S(n) 2 n log n and, furthermore, S(n) is semihomogeneous, then D’TAPE(S(n)) is a hyper-A F L . We have seen in Section 2 that Y(ET0L) is the smallest hyper-AFL, and, hence, it is contained in all complexity classes which are hyper-AFLs. An immediate consequence of this result is that Y(ET0L) G NP. (This inclusion is easy to establish also directly.) The following theorem gives a stronger result.
Theorem 4.7.
The membership problem of 9(ETOL) is NP-complefe.
We outline the proof of Theorem 4.7. It suffices to prove that Y(ET0L) contains an NP-complete language. One such language (and perhaps the best known) is the language SAT,, consisting of satisfiable formulas of propositional calculus in 3-conjunctive normal form and with the unary notation for variables.
4
313
COMPLEXITY CONSIDERATIONS
Consider the following ETOL system G. The nonterminal alphabet of G consists of the following letters (we also give the intuitive meaning of the letters) : S (initial),
R
(rejection),
T
(true),
F
(false).
The terminal alphabet consists of the letters A
(disjunction),
N
(negation), ( ,)
I
(unary notation for variables),
(parentheses).
The system G has three tables.. We define the tables by listing the productions. The first table consists of the productions
s
--+
(aA/L4)I)S.
S
--f
(uA/My).
x
+
x
for x # S,
whcre ( x , /j, y) ranges over all combinations of ( T , N T , F , N F ) which d o not consist entirely of N T s and Fs. (Thus, there are 112 productions for S in this table.) The second table consists of the productions S+R,
T+lT,
F+lF,
T+l,
x+x,
for s # S, T, F . The third table is obtained from the second by replacing T + 1 with F + 1. I t is now easy to verify that L ( G ) = SA?‘,. The first table generates products (i.e., conjunctions) of disjunctions with three terms in a form already indicating the truth-value assignments. The terminating productions in the other two tables guarantee that the truth-value assignment is consistent. 0 ETOL systems constitute perhaps the simplest grammatical device for generating the language SAT,. The above proof shows also that the membership problem for TOL languages is NP-complete. As regards DTOL and EDTOL systems, the situation is essentially simpler, as seen from the following theorem. Theorem 4.8.
Y(EDT0L) E P
The idea in the proof of Theorem 4.8 is to parse EDTOL languages in a top-down manner. The sequence of tables need not be remembered. One may also forget “most” letters in the intermediate words because rewriting is deterministic: if we know how one occurrence of a letter is rewritten, the other occurrences must be rewritten in the same way. Another line of argument shows that Y(ET0L) is included in the family of deterministic context-sensitive languages. Theorem 4.9.
Y(ET0L)
G
DTAPE(n).
VI
314
OTHER TOPICS : AN OVERVIEW
The inclusion in Theorem 4.9 is proper. An interesting example showing this is the language L = {x E X* I I x I is a prime number}.
The language L is not in Y(ET0L); but, in fact, L is in DTAPE(1og n). In spite of Theorem 4.8 no polynomial time bound is known for the (deterministic) recognition of EDTOL languages. The polynomial bound resulting from the proof of Theorem 4.8 depends on the system. Similarly to Theorem 4.8, one can show that Y(EDT0L) c NTAPE(1og n). This result is further strengthened in the following theorem. Theorem 4.10.
For any k 2 1,
Y(EDT0L) c DTAPE(logk n ) if arid only if
NTAPE(1og n ) c DTAPE(logAn). Deterministic and nondeterministic space and time complexities for the basic L families are summarized in the following table. D'I'APE
NTAPE
DTlME
NTIME
log I I log2 I I
log I1 log2 I I
112
112
IfJ
I?
log2
log I 1
P
llZ
NP-complete
)IL
V (EDOL) Y'(E0L) U(EDTOL) Y'(ET0L)
II
II
I1
The results discussed above deal with upper bounds for complexity. Nontrivial lower bounds are in general difficult to obtain-this is a phenomenon true for the whole of complexity theory. As an example of a result dealing with lower bounds, we mention the following theorem. The theorem shows that the bound log n on tape is strict for EDOL languages. Theorem4.11.
There is an EDOL language L such that,f o r each S(n), zj'L
is in DTAPE(S(n)), then
sup S(n)/log n > 0. n+m
An example of such u language i s
L= {a"bc"ln 2 0). ( I nfact, L is a PDOL language.)
315
EXERCISES
In addition to the membership problem, the complexity of some other problems dealing with L systems has been investigated. Among such problems are the emptiness, infinity, and general membership problems. (The general membership problem means that one has to determine whether or not x E L(G),when given both x and G as data.) The following two theorems give some sample results from this area. Theorem 4.12. The emptiness und i n j n i t j ’ problems.for EDOL languages, us ~ ~ us1 ,/br 1 EOL luriguuges, m e NP-complete. The qenerul membership problem j n r EOL languuges, us well us,fOr EDOL lur~guuges,is NP-complete. Theorem 4.13. The yrnerul membership problem for ETOL lunguages is in DTAPE(n log n). The gerieral membership problem for DOL lunguuges is in D T A P E ( I OH). ~~
We conclude this section by mentioning some ofthe most significant (in our estimation) open problems concerning the complexity of L systems. (i) Is thefamilyY(EDT0L)in DTIME(tik)forsomefixedvalueofk?(The polynomial bound resulting from Theorem 4.8depends on the number of nonterminals in the individual EDTOL system.) (ii) Is the family Y(ET0L) in DTAPE(nk), for some k < 1 ? (iii) Is the family Y(ET0L) in NTIME(ri)? (iv) Further improvement of the upper bound of the time complexity for EOL languages. (v) Are there hardest languages for L systems (in the sense of the “hardest context-free language ”)? (vi) Call an EOL or ETOL system growing if the right-hand side of every production is of length at least 2. Are the families of languages generated by growing EOL and ETOL systems included in DTAPE(1og n)? Are these two families of the “same tape complexity,” i.e., are both included at the same time in DTAPE(logk ti), for all k ?
Exercises 4.1. Prove that EPTIL languages can be accepted nondeterministically in exponential time. 4.2. Prove that growing ETlL languages are in NTIME(n), as well as in DTA PE(r i ) .
316
VI
OTHER TOPICS : AN OVERVIEW
4.3. Assume that g(n) 2 log n. Call an ETIL language L(G) g-rupid if, whenever x is in L(G),then x has a derivation of length at most g( I x I). Prove that L(G) is in
NTIM E(2C9(")) for some constant c, provided L(G) is g-rapid. 4.4. Prove that the family of growing EOL languages is included in NTAPE (log n). (Familiarity with auxiliary pushdown automata is required in this exercise.) 4.5. Let G be a growing EOL system such that, for some k 2 2, the length of the right-hand side of every production in G is of length k . Prove that L(G) belongs to DTAPE(1og n). 4.6. Prove that the family of EDOL languages is contained in DTIME(nZ), and that the family of EOL languages is contained in NTIME(n2). 4.7. Prove that the family of ETOL languages is contained in DTAPE(logk11) if and only if the family of one-way stack languages is contained in DTAPE (logkn). (Familiarity with one-way stack languages is required.)
4.8. Prove that the family of growing ETOL languages is contained in NTAPE(1og n). 4.9. Prove that the family of ETOL languages is contained in NTIME(n2) and that the family of growing ETOL languages is contained in NTIME(n). 4.10. Prove that there are EDTOL languages that cannot be recognized by any one-way auxiliary pushdown automata with a space bound less than 17. (Familiarity with auxiliary pushdown automata is required in this exercise.)
5.
MULTIDIMENSIONAL L SYSTEMS
The initial motivation behind the theory of L systems was to model various features of biological development. For this purpose it is certainly desirable to have models for the generation of multidimensional structures. This naturally leads to extending L system models not only to generate sets of strings (essentially one-dimensional objects) but also to generate structures like graphs or maps (representing multidimensional objects). Several approaches in this direction are known, and in this section we shall present three of them. The first deals with the generation of (directed, node and edge labeled) graphs, and the remaining two deal with the generation of (connected, planar, finite) maps. However, all three of these grew out of an effortto generate maps
5
MUL.TII)IMENSIONAI. L SYSTEMS
317
with each of them approaching the matter quite differently. In the first approach one generates sets of graphs and regards each map as the dual graph of the map considered: in the second we process maps directly: and in the third we generate sets of maps by processing their graphs (not their dual graphs). I t is also clear from the mathematical point of view that the extension of L systems to systems generating multidimensional structures is an obvious step to be done. At present the theory of multidimensional L systems is mathematically much poorer than the theory of L systems generating sets of strings. For this reason we have decided in this section merely to describe three different approaches to the grammatical definitions of sets of multidimensional structures rather than to survey mathematical results obtained in this area. (It should be stressed however that in itself the problem of finite grammatical description of sets of graphs or sets of maps is nontrivial and definitely much more complicated than defining sets of strings by grammatical means.) The reader interested in mathematical results obtained so far can consult the references given. We would also like to point out that in our description of these constructs we concentrate only on their essential features, omitting various technical details. A common feature ofall three models is that they do not admit “disappearance of cells”-that is, no component of the structure (graph or map) being processed may be erased. Allowing disappearance of cells would complicate these models quite considerably. It should be remarked that there is one important common feature of systems we discuss in this section and propagating L systems as considered in the rest of the book: two newly introduced elements of the structure generated can be adjacent only if the elements that gave rise to them were also adjacent. We start by describing a model generating a set of directed graphs in which both nodes and edges are labeled. It was introduced in [CL] (based on the ideas from [MI)where it is called a propuguririg gruph OL system, abbreviated as a PGOL system. A PGOL system G consists of a finite nonempty set of node labels X, a finite nonempty set of edge labels A, a finite nonempty set of productions for each element of 1,a finite set of graphs (called stencils) for each element of A, and the starting graph (axiom)S . (We use P to denote the set of all productions of G and C to denote the set of all stencils of C;; C must satisfy a certain “completeness” condition, described later on.) The generation process of a new graph from an already generated graph M proceeds in two stages as follows:
(1) In the first stage every (mother) node of M is replaced by a (daughter) graph. A node e can be replaced by a graph (isomorphic to) H only if P contains a production of the form a -+ H where a is the label of e. Since it is
VI
318
OTHER TOPICS : AN OVERVIEW
required that G contains a production for each node label from Z,this stage can be completed. (2) After the first stage has been completed the interconnections between daughter graphs are established in the following way. Suppose that a node e from M was replaced by M,, ,a node u from M was replaced by M , , and there is an edge in M leading from e to u labeled by b. Then one chooses from C a stencil D assigned to b in which the source part is isomorphic to M,, and the target part is isomorphic to M , . (Each stencil is nothing but a graph built up from two disjoint subgraphs, called the source and target, and connecrion edges, where each connection edge has one end in the source and another in the target part of the stencil.) Edges between nodes of M,. and nodes of M , ,are established in the way indicated by connection edges of D. Interconnections are performed in this way between each pair of daughter graphs on the basis of the label of each edge between their mother nodes. It is required that G contains a stencil for each such pair M , , , M u ;hence the second stage can also be always completed. The languuge of’G consists of all the graphs (isomorphic to those) generated by G in a finite number of steps beginning with the axiom S . The way a PGOL system generates a set of graphs is illustrated by the following example. Exurnpkl~S.1.
Let G be a PGOL system with the set of node labels
{u, h, c, d ) ; the set of edge labels { A , B, C , L, R, N } ; the axiom a
the productions d
R C
d
L b
(I--,
c - - ,
d d - a
5
MULTIDIMENSIONAL L SYSTEMS
319
the stencils (to distinguish between the source subgraph and the target subgraph of a stencil we attach the subscript s to labels of all the nodes in the former and we attach the subscript t to labels of all the nodes in the latter): for A :
for B :
for C :
320 for L :
and
for R :
and
for N :
VI
OTHER TOPICS : AN OVERVIEW
5
32I
MULTIDIMENSIONAL L SYSTEMS
and
ds
N
dt
.
-
0
Then the first three derivation steps look as follows:
Step 1. Stage 1 :
d
Stage 2 :
/ d
d
N
a
N
d
322
VI
OTHER TOPICS : AN OVERIVEW
Step 2.
Stage 1 :
d-a
/ cj
do
d
Stage 2 : d
5
323
MULTIDIMENSIONAL L SYSTEMS
Step 3. Stage 1 d 0
d
c. J a
7
0
d
-
d
VI
324
OTHER TOPICS AN OVERVIEW
Stage 2: d
The next two approaches deal with parallel generating systems transforming maps (rather than graphs). From the point of view of biological applications map systems are certainly more desirable. They allow one to provide rather precise information about the “geometry” of the structure and provide the visual similarity of the generated pattern to the multicellular organism. This is in contrast to processing planar graphs as duals of maps where only topological representations of the structures considered can be given. The first of these approaches, proposed in [CGP], deals with the generation of (connected, planar, finite) maps with their cells labeled by elements of a finite alphabet (the environment, that is, the rest of the plane outside of the map, is labeled with 03). The cells of a map generated are assumed to include no islands or enclaves, and so the boundary (the sequence of walls) of every cell is a single connected curve and every cell is a simply connected region. The points where walls meet are called corners.
5
MlJLTIDIMENSIONAL L SYSTEMS
325
The most characteristic features of the generation process in those systems, referred to as CGP systems, are that (i) only binary cell divisions are allowed; (ii) every map generated is such that no cell has a number of neighbors greater than a certain constant associated with the system; (iii) there is a fixed “interface rule” that controls the relative positions of the end points of newly created walls in the case that one of the old walls contains end points of more than one new division wall; and (iv) the generation process is context-dependent in the sense that what a cell does depends not only on its label but also on the labels of its neighbors and their configuration with respect to the given cell. The generation process of a new map from an already generated map M proceeds in two stages as follows.
( I ) In the first stage every cell in M “counts” the number of its neighbors (if the boundary between two cells consists of several disconnected segments, then each segment is counted separately). If that number is greater than or equal to a given threshold that the system assigns to the label ofthe given cell, then the label of the cell changes into its “activated” version: otherwise, no change occurs. (We use the convention that if x is a cell label, then x’ stands for its activated version.) (2) After the first stage has been completed, productions of the grammar are applied to all cells in the map obtained in stage 1. Exch production is either the form shown in Figure 6 ( n 2 I ) o r of the form shown in Figure 7 ( n 2 I ) where t i , , u2 are two different corners (they may be corners of M ) . The application of a production of the first type is obvious: ifa cell (labeled) u
VI
326
dividing Wall
OTHER TOPICS : AN OVERVIEW
1 W
is surrounded by neighbors (labeled) b,, b,, . . . ,b,, (in the configuration as shown), then its label is changed to c. The application of a production of the second type is more involved. It results in dividing a cell CI with neighbors b,, b 2 , . . . , b,, (in the configuration as shown) into two daughter cells labeled b and c with the dividing wall positioned as shown. In general the dividing wall can either connect two existing corners or connect an existing corner and a newly created corner or connect two newly created corners. The production applied specifies which case takes place. The actual shape of the dividing wall is not specified, but it must be an open simply connected curve so that it creates no islands. If a wall w belongs to the boundary of two cells A and B, and both A and B divide introducing dividing walls with end points u,, u2 and u , , u 2 , respectively, then the interface rule controls the relative position of u,, u,, u,, u2 as follows. (1) If only one of the us and one of the us is positioned on w, then they coincide yielding the situation shown in Figure 8. (2) If three of u,, u 2 , u,, u2 are positioned on w, then three new corners will be created on w yielding the situation in Figure 9.
5
327
MULTIDIMENSIONAL L SYSTEMS a new
1 di:2
( 3 ) If all four ul, u 2 , u l , u2 are positioned on w, then only two new corners are created on w (so that the number of neighbors is minimized) yielding the situation in Figure 10.
The productions of the system are so designed that no cell ever gets more neighbors than a constant D G dependent only on the maximal threshold associated with a label. (It can be shown that ifthis maximal threshold equals k , then D G can be taken as 3(k - I).) This is where activated cells introduced in stage 1 play a crucial role. In particular, (1) a newly introduced dividing wall in a nonactivated cell cannot touch (that is, create a new corner on) the wall that belongs also to an activated cell, and (2) a newly introduced dividing wall in an activated cell cannot have both of its ends on the same wall, cannot have one of its ends on a wall and another on a neighboring wall, cannot have one of its ends on a wall and another on a corner of this wall. It is also assumed that the system is complete in the sense that it contains a production for every cell configuration occurring in any map generated. The laiiyuage generated by the system is the set of all maps (isomorphic to those) obtained in a finite number of steps from a distinguished starting map (the ctsiom of the system). E.runrp/r 5.2. 13 rules: 1.
Let a CGP system G contain among others the following
328
VI
OTHER TOPICS : AN OVERVIEW
2.
b
3.
+-+' (I'
00
4.
D-D-, U'
b'
5.
6.
+-+ b'
00
7.
a'
p-Y&. b
'
5
MULTII>IMENSIONAL L SYSTEMS
8.
329
D-B* b
b'
9.
b'
10.
11.
++, m
12.
13.
--o--d
m
330
VI
OTHER TOPICS : AN OVERVIEW
Let the thresholds associated with labelsa,b, c,d be 2,4,6, and 6, respectively, and let the axiom be as below. Then the first four derivation steps appear as follows: Axiom. W
Step 1 (rules used: 1). Stage 1 : W
0 Stage 2:
Step 2 (rules used : 2 and 3). Stage 1: W
Stage 2:
5
331
Mll1.TIDIMENSIONAL L SYSTEMS
Srrp 3 (rules used: 2,4, 5, and 6).
Stage 1 :
Stage 2 : m
S t e p 4 (rules used: 2, 7, 8,9, 10, 1 1 , 12, and 13).
Stagc I :
332
v1
OTHER TOPICS : AN OVERVIEW
Stage 2:
m
The second map generating model we discuss in this section was proposed in [LR]. It is referred to as a binary propagating map OL system and abbreviated as a BPMOL system. Such a system generates maps each of which has both cell and wall labels, and moreover each wall has a direction (orientation) associated with it. A direct derivation step in such a system again consists of two stages. In the first stage each wall of the map is subject to rewriting, and in the second stage new walls are spanned on the structure of walls and corners obtained in the first stage (inducing in this way cell divisions). Thus in these systems one processes maps by directly processing their own (directed) “graphs,” not their dual graphs. This independent processing of the graph of a map is an important difference between BPMOL systems and CGP systems. Other important differences between these two models are that a BPMOL system is less context-dependent, does not require an a priori fixed bound on the number of walls of a cell, and does not require a fixed “interface rule.” A BPMOL system G consists of a finite cell alphabet C,a finite wall alphabet A, a finite set of wall productions P, a finite set of cell productions R, and the starting map (or axiom) w. It is assumed that C and A are disjoint; moreover, in addition to the label of the environment GCI, we use two special wall orientation signs + and -. Then,A,=A x { + , - } andifD=(A,x)EAo,thenwerefertoAasthe label of D (denoted by I@)) and to x as the sign of D (denoted by s(D)); for convenience D is usually written in the form A”. Wall productions are of the form A -+ a, where A E A and a E A.: It is required that, for every wall label, there is at least one production. Cell productions are of two kinds: the first kind is of the form a productions), and
+ 6, with a, b E C (they are
referred to as chain
5
MULT1I)IMENSIONAL L SYSTEMS
333
the second kind is of the form u 4 ( K l , h, K , , c, D) where a, h, C E 2, D E A,. and K I , K c A$ (we refer to these as diilision productions). I t is assumed that K , and K , are finitely specified languages over A n . A direct derizlution step in a BPMOL system is performed in two stages as follows:
(1) In the first stage every wall is rewritten as a sequence of walls. This rewriting is governed by a wall production A + x = D , . . . D,where A is the label of the wall to be rewritten. Since every wall in the map is directed (has an associated arrow), the spanning of the initial and terminal corners of the wall labeled A is unambiguous. After rewriting, these two corners are connected by the sequence of walls corresponding to D,, . . . , D,in the proper order (i.e., D , leaves the initial corner and D,arrives at the terminal corner). The arrow associated with the newly introduced wall Di points in the direction of the original wall (labeled A ) if s(Di) = + and is opposite to the direction of the original wall if s ( D i ) = -. (2) After in the first stage each wall of the map has been rewritten one applies the cell productions.
(2.1) If the set of cell productions R contains a chain production a -+ h, then a cell labeled u can change its label to h. (2.2) If R contains a division production u + ( K h, K 2 , c, D), then a cell labeled u can acquire a division wall between its two corners u 1 and u2 only if the sequence {j of directed walls leading from u 1 to u2 in the clockwise direction is an element of K and the sequence y ofdirected walls leading clockwise from u 2 to id, is an element of K , . The sequences p and y are constructed in such a way that each of their elements is of the form B" where B is the label of the wall considered and x is + if the direction of this wall is clockwise and x is - otherwise. The division wall will be labeled by l(D) and its associated arrow points form u , to u 2 ifs(D) is + , o r itsdirection is from u2 to u 1 ifs(D) is -. The labels of the two new cells are assigned according to the rule: the cell to whose boundary the sequence of walls leading from u , to u2 belongs gets the label h and the other cell gets the label c. (2.3) If R contains neither a chain production nor a division production for a given cell, then the label ofthe cell remains unchanged in this derivation step. (However, the new boundary of this cell may be ditrerent from its previous one because wall rewriting was already performed as the first stage of this derivation step.)
The lunguuge qfG consists of all the maps (isomorphic to those) derived by G from the axiom (I) in a finite number of steps.
334
VI
OTHER TOPICS: AN OVERVIEW
Exampke 5.3. Let G be the BPMOL system with the cell alphabet {u, b } , the wall alphabet {0, 1,2}, wall productions 0 -,0+, 1 -+ 1-0+, 2 -, O+O+, cell productions a --+ ( K l , a, K Z ,b, 2+), b -, b, where K I = {O'l-, O W - , 1+0-} and K 2 = {O"OyO'~x,y , Z E { +, - } } and the axiom
Then the first three derivation steps appear as follows: Axiom :
Step I . Stage 1:
Stage 2:
5
MULTIDIMENSIONAL. L SYSTEMS
Step 2. Stage I :
Stage 2 :
Step 3. Stage 1
335
VI
336
OTHER TOPICS : AN OVERVIEW
Stage 2:
: 0
" 0
Historical and Bibliographical Remarks
As pointed out already in the preface, wedo not try to credit each individual result to some specific author(s). The purpose of the subsequent remarks is to point out some general lines of development, as well as give hints in some specific details to the interested reader. The theory of L systems originates from [Ll]. DOL systems form the mathematically simplest subcase. One can distinguish two lines in the study of DOL systems: “pure” language theory and growth functions. Early papers on the former line were [Do], [H Wall, [R4], and [R5]. A continuation ofthis line is the study of locally catenative systems begun in [RLi] and carried on in [ R u ~ ] , [VS], and [ER 121, where also the notion of an elementary homomorphism is introduced. The theory ofgrowth functions was initiated in [PSI and [Sz], although many of the results are special cases of those on formal power series ([Schl] and [SchZ]) or homogeneous difference equations with constant coefficients [MT]. OL systems were first discussed in [Ll]. [L2], [RD], and [H3] are other basic papers in this area. The equality ofthe families Y(E0L) and Y(C0L) was established in [ER5]-partial results had been obtained before in [CO2] and related work. The material in Section 11.3 is based on [HWa2] and [RRS]. Basic papers discussing combinatorial properties of EOL languages are [ER7], [ER9], and [Skl]. Our proof of the basic undecidability results, 337
338
HISTORICAL A N D BIBLIOGRAPHICAL REMARKS
Theorems 11.5.1 and 11.5.2, follows [SS]; other proofs are given in [B] and [HR]. The general approach to decision problems involving language families was initiated in [S7]. Many of the decidability results concerning EOL (as well as ETOL) languages were originally based on the observation due to [COl] that these languages are indexed languages in the sense of [A]. EOL forms were introduced in [MSWl]. Section 11.6 contains also material from [MSW2],[MSW4],and [MSWS]. The DOL sequence equivalence problem (which had become quite well known) was solved in [Cl] and [CF]; the case of polynomially bounded sequences had been settled before in [KS]. The solution given in [ERl3], based on elementary homomorphisms, was able to avoid most of the complications present in the earlier solution. In our presentation Theorems 111.1.6, 111.1.9, and 111.2.2 are based on results in [ER13], and the parts of the argument dealing with the notion of balance are modified from [Cl]. The interconnection between elementary homomorphisms and codes with a bounded delay was pointed out in [Li2]; the most comprehensive exposition on the basics of the theory of codes is [Oj]. [N] gives a first reduction of the DOL language equivalence problem to the DOL sequence equivalence problem; our presentation of the language equivalence problem is based on a somewhat simpler argument. The material in Section 111.3 is from [EnRI] and [EnR2]; [CS], [CM2], and [SlO] deal with the same topic. The characterization results of growth functions, Theorems 111.4.4and 111.4.8, are due to [Sol]-the polynomially bounded case had been settled before in [Rul]. Our proof of Theorem 111.4.10 is also from [Rul]. The corresponding characterization of N-rational sequences is due to [Be] and SO^]. The important notion of a quasiquotient, as well as Theorem 111.4.15, are from [KOE]. Thus, also our proof of Theorem 111.4.8 is based on ideas from [KOE]. The study of DOL forms was initiated in CMOS]; the material in Section 111.5 is from [CMORS]. The notion of a TOL system was introduced in [Rl] and that of an ETOL system in [R2]. Historically, TOL and ETOL systems were considered before the corresponding deterministic versions. The basic papers on EDTOL languages are [ER3], [ER6], and [ERll]. The material in Section IV.4 is from [ELR] and [ER8]. The whole area of subword complexity is covered in [Lee]. The notions of a commutative DTOL function and of length density were introduced and studied in [K6] and [K7], some of the undecidability results in the area being due to [SS]. The results on combinatorial properties of ETOL languages are due to [ER4], [ERlO], and [ERSk]. [Ve] is a general reference to ETOL systems of finite index, [RVl] and [RV2] being more specific ones. The considerations of Section V.3 have been further extended to concern rank and tree rank-this was to some extent surveyed in exercises with appropriate references. Because of the special character of Chapter VI, quite a few references were
HISTORIC'AL A N D BIBLIOGRAPHICAL REMARKS
339
already given in the chapter itself. The following remarks might be added. L systems were originally (as introduced in [Ll]) IL systems. [Hl] and [H2] were the very early follow-up papers. Our definition of an IL system follows [V3]. The first papers discussing the effect of the amount and type of context were [D] and [R6]. [V3] added the role ofthe E-mechanism to thisdiscussion. Iteration grammars were introduced in [vL4] and [S6], deterministic ones in [AE]. The hierarchy result, Theorem V1.2.8, is from [AvL], and also material from [vLW], [vLS], and [ES] has been used in Section VI.2. Theorems VI.4.5 and V1.4.6 are from [VLS], Theorem VI.4.7 from [vL6] and Theorem VI.4.8 from [Ha]. Furthermore, material from [JSl] and [JS2] has been used at the end of Section V1.4, the open problems and exercises in this section being due to T. Harju. A few additional remarks concerning the subsequent list of references are in order. The list contains only works actually referred to in this book. Hence, it is not intended as a bibliography of L systems. The reader is referred to the most recent bibilography ofthe area, [PRS]. (As an indication ofthe vigorousness of the research in this area, the reader will notice that the list of references given below contains very many papers not listed in [PRS].) To assist the reader in the usage of [PRS], we indicate below the interconnection between the annotations of [PRS] and the various chapters or sections in the present book. The annotation is given first, and after the colon the corresponding items of this book. Such annotations of [PRS] are omitted whose areas are not dealt with at all or are discussed only in a couple of exercises in this book. DOL: OL: EOL: ETOL: IL: C: D:
F: G: H: I: M: S:
I, 111; 11; 11; IV,V; VI.1; VI.4; 11.5, 111.2 11.6, 111.5 1.3, 111.4, v.5: VI.5; VI.2; VI.3; 11.2, 11.3.
A reader interested in biological aspects is referred to [L3] and to the contribution of A. Lindenmayer contained in [HR]. Also the bibliography [PRS] contains some further biological references.
This Page Intentionally Left Blank
References
A. Aho. Indexed grammars -an extension of context-free grammars, J . Assoc. Compitt. Much. 15 (1968). 647-671.
J. Albert and H. Maurer, The class of context-free languages is not an EOL family, ln/brtn. Proi,e.ss.L r f f .6 (1978). 190-195. P. Asveld and J . Engelfriet, Iterated deterministic substitution, Actu h l o r m . 8 (1977). 285 302. P. Asveld and J. van Leeuwen. Infinite Chains of Hyper-AFL's. Tech. Rep., Dep. Appl. Math.. l'wente Untv. olTechnology, 1975. J. Berstel, Sur les pBles et le quotient de Hadamard de series N-rationnelles, C. R. Acud. ScL, S h . A 272 (1971), 1079-1081.
J. Berstel and M. Nielsen, The growth range equivalence problem for DOL systems is decidable, in "Automata, Languages, Development" (A. Lindenmayer and G . Rozenberg, eds.), North-Holland Publ., Amsterdam, 1976, pp. 161-178. M. Blattner, The unsolvability of the equality problem for the sentential forms of context-free grammars, J . Compuf. System Sci. 7 (1973). 463-468. M. Blattner and A. Cremers, Observations about bounded languages and developmental systems, Muth. Systems Theory 10 (1978). 253-258. J. W. Carlyle, S. Greibach, and A. Paz, A two-dimensional generating system modelling growth and binary cell division, Proc. 15th Annual Symp. Swirchin,q Automutu Theory (1974). 1-12. P. Christensen, Hyper AFL's and ETOL systems, Lecture Notes Cornput. Sri. 15 (1974). 254-257. K. Culik, 11. On the decidability of the sequence equivalence problem for DOLsystems, Theoret. Cornput. Sci. 3 (1976). 75-84. K. Culik, 11, The ultimate equivalence problem for DOL systems, Aria Inform. 10 (1978). 79-84. 34 I
342
REFERENCES
cc31
K. Culik. 11. A purely homomorphic characterization of recursively enumerable languages, J . Assoc. Comput. Mach. (to appear). K. Culik, 11 and I. Fris, The decidability of the equivalence problem for DOLsystems, Inform. and Control 35 (1977), 20-39. K. Culik, I1 and J. Karhumaki, Interactive L systems with almost interactionless behaviour, Inform. and Control (to appear). K. Culik. I1 and A. Lindenmayer, Parallel graph generating and graph recurrence systems for multicellular development. Internat. J . Gen. Systems 3 (1976), 53-66. K. Culik, II and H. Maurer, Propagating chain-free normal forms for EOL systems, Inform. and Control. 36 (1978). 309-319. K. Culik, I1 and H. Maurer, On simple representations of language families, R w . Fr. Automat., Inform. Rech. OpPr., SPr. Rouge (to appear). K. Culik, 11, H. Maurer, and T. Ottmann, Two-symbol complete EOL forms, Theoret. Comput. Sci.6 (1978). 69-92. K. Culik, 11, H. Maurer, T. Ottmann, K. Ruohonen, and A. Salomaa, Isomorphism, form equivalence and sequence equivalence of PDOL forms, Theoret. Comput. Sci.6 (1978), 143-174. K. Culik, I1 and J. Opatrny. Macro OL systems, Internat. J . Comput. Math. 4 (1975). 327-342. K. Culik, I I and J. Opatrny, Literal homomorphisms of OL languages, Internat. J . Comput. Math. 4 (1974). 247-267. K. Culik. I I and J. Richier, Homomorphism equivalence on ETOL languages, Internut. J . Comput. Math. 7 (1979). 43- 51. K. Culik, I1 and A. Salomaa, On the decidability of homomorphism equivalence for languages, J. Comput. System Sri.17 (1978), 163-175. K. Culik, I1 and D. Wood, Doubly deterministic tabled OL systems, Internat. J . Comput. Inform. Sci. (to appear). D. van Dalen, A note on some systems of Lindenmayer- Math. Svstems Theory 5 (1971), 128-140. J. Dassow, Eine neue Funktion fur Lindenmayer-Systeme, Elektron. Injorrnationswrarb. Kybernet. 12 (1976). 515-521. P. Doucet, On the membership question in some Lindenmayer systems, Indag. Math. 34 (1972), 45-52. A. Ehrenfeucht, K.P.Lee, and G. Rozenberg, Subword complexities of various classes of deterministic developmental languages without interactions, Theoret. Comput. Sci. 1 (1975), 59-76. A. Ehrenfeucht and G. Rozenberg, EOL languages are not codings of FPOL languages, Theoret. Comput. Sri. 6 (1978). 327-342. A. Ehrenfeucht and G. Rozenberg, The number of occurrences of letters versus their distribution in EOL languages, Inform. and Control 26 (1979, 256-271. A. Ehrenfeucht and G. Rozenberg, On some context-free languages that are not deterministic ETOL languages, Reo. Fr. Automat., Inform. Rech. OpBr., SPr. Rouge I 1 (1977), 273-291. A. Ehrenfeucht and G. Rozenberg, On proving that certain languages are not ETOL. Acta Inform. 6 (1976), 407415. A. Ehrenfeucht and G. Rozenberg, The equality of EOL languages and codings of OL languages, Internat. J . Comput. Math. 4 (1974), 95-104. A. Ehrenfeucht and G. Rozenberg, A pumping theorem for deterministic ETOL languages, Rev. Fr. Automat. Inform. Rech. OpPr., Sir. Rouge 9 (1975). 13-23. A. Ehrenfeucht and G. Rozenberg, The number of occurrences of letters versus their distribution in some EOL languages. Inform. and Control26 (1975). 256-271.
CCFl CCKI CCLI [CMI] [CMZ] [CMO] [CMORS]
REFERENCES LEK81 ~
9
[ERIO]
[EKI I] [ER12] [ER 131
[ER14] [ERSk] CERVl [El [EnRI] [EnR2]
CERSI
[ESvL] CESI
[FI [FRI
CGRI
[GI1 IG21
CHWI [Hal
343
A. Ehrcnfeucht and G. Rozenberg. A limit for sets olsubwords in deterministic TOL systems. Inform. Process. Lett. 2 (1973), 70-73. 1 A. Ehrenfeucht and G. Rozenberg, On &determined EOL languages, in “Automata. Languages. Development ’’ (A. Lindenmayer and G . Rozenberg, eds.), North-Holland Publ.. Amsterdam, 1976, pp. 191-202. A. Ehrcnfeucht and G . Rozenberg, On inverse homomorphic images of deterministic ETOL languages. in “Automata, Languages, Development ’’ (A. Lindenmayer and G. Rozenberg, eds.). North-Holland Publ., Amsterdam, 1976, pp. 179 189. A. Ehrcnfeucht and G . Rozenberg. On the structure of derivations in deterSci, 17 (1978), 331-347. ministic ETOL systems, J . Comput. S j ~ e m A. Ehrenfeucht and G. Rozenberg, Simplifications of homomorphisms, Inform. and Control 38 (1 978). 298-309. A. Ehrenfeucht and G. Rozenberg, Elementary homomorphisms and a solution of the DOL sequence equivalence problem. Theoret. Comput. Sci. 7 (1978). 169183. A. Ehrenfeucht and G . Rozenberg, On a bound for the DOL sequence equivalence problem. Theoret. Compur. Sci. (to appear). A. Ehrcnfeucht. G . Rozenberg, and S. Skyum, A relationship between ETOL languages and EDTOL languages, Theor~t.Comput. Sci. 1 (1976), 325-330. A. Ehrenfeucht, G. Rozenberg, and D. Vermeir, ETOL systems with rank, J . Comput. System Sci. (to appear). S. Eilenbcrg. “Automata, Languages and Machines,” Vol. A. Academic Press, New York, 1974. J . Engelfriet and G . Rozenberg, Equality languages and fixed point languages, Inform. and Control (to appear). J . Engelrriet and G. Rozenberg. Equality Languages, Fixed Point Languages and Representations of Recursively Enumerable Languages, Tech. Rep., Univ. of Antwerp, U.I.A.. 1978. J . Engelfriet. G. Rozenbcrg, and G . Slutzki, Trce transducers. L systems and two-way machines. Proi.. lOrh Annual Symp. Theory Comput., Sun Diego (l978), 66 74. J. Engelfriet, E. M. Schmidt, and J . van Leeuwen, Stack machines and classes of nonnested macro languages, J . Assoc. Comput. Mach. (to appear). J . Engelfriet and S. Skyum, Copying theorems, Inform. Process. Lett. 4 (1976), 157 I h l . M . J . Fischer, Grammars with Macro-like Productions, Ph.D. thesis, Harvard Univ.. 1968. G. A. Fisher and G . N. Raney. On the representation of formal languages using automata on networks, Proc. 10th Annual Symp. Switching Automata Theory (1969). 157-165. S. Ginsburg and G. Rozenberg. TOL schemes and control sets, Inform. and Control 27 (1974). 109-125. S. Greibach, Checking automata and one-way stack languages, J . Comput. Sysrem S C ~3. (1969), 196-217. S. Greibach. Full AFL’s and nested iterated substitution, In/orm. mil Control 16 (1970). 7- 35. G . H. Hardy and E. M. Wright, “An Introduction to the Theory of Numbers.” Oxford Univ. Press, London and New York, 1954. T. Har,ju. A polynomial recognition algorithm for the EDTOL languages, Elektron. lrr/or~irririoir.si.emrh.K j ~ h w n e t .13 ( 1977). 169 177.
344 [H 11 CH21 [H3] [HLvLR] CHLRI CHRI [HWal] [HWa2]
REFERENCES
G. T. Herman, The computing ability of a developmental model for filamentous organisms, J. Theoret. Biol.25 (1969), 421-435. G. T. Herman, Models for cellular interactions in development without polarity of individual cells, Internat. J. System Sci. 2 (1971). 271-289; 3 (1972), 149-175. G. T. Herman, Closure properties of some families of languages associated with biological systems, Inform. and Control 24 (1974). 101-121. G. T. Herman, K. P. Lee. J. van Leeuwen, and G. Rozenberg, Characterization of unary developmental languages, Discrete Math. 6 (l973), 235-247. G. T. Herman, A. Lindenmayer, and G. Rozenberg, Description of developmental languages using recurrence systems, Math. Systems Theory 8 (l975), 316-341. G. T. Herman and G. Rozenberg, “Developmental Systems and Languages.” North-Holland Publ., Amsterdam, 1975. G. T. Herman and A. Walker, The syntactic inference problem as applied to biological systems, Mach. Infell. 7 (1972), 347-356. G. T. Herman and A. Walker, Context-free languages in biological systems, Internat. J. Comput. Math. 4 (1975), 369-391. G. T. Herman and A. Walker, On the stability of some biological schemes with cellular interactions, Theoret. Comput. Sci. 2 (1976), 115-130. N. Jones and S. Skyum, Complexity of some problems concerning L systems, Lecture Notes Comput. Sci. 52 (1977), 301-308. N. Jones and S. Skyum, A Note on the Complexity of General DOL-Membership, Tech. Rep., Comput. Sci. Dep.. Aarhus Univ.. 1979. J. Karhumaki, An example of a PD2L system with the growth type 2;. Inform. Process. Lett. 2 (1974), 131-134. J. Karhumaki, The family of PDOL growth-sets is properly included in the family of DOL growth-sets, Ann. Acad. Sci. Fenn. Ser. A I Math. 590 (1974). J. Karhumaki, On Length Sets of L Systems, Licentiate thesis, Univ. of Turku, 1974. J. Karhumaki, Two theorems concerning recognizable N-subsets of o*,Theoret. Comput. Sci. 1 (1976), 317-323. J. Karhumaki, The decidability of the equivalence problem for polynomially bounded DOL sequences, Reti. Fr. Automat., Inform. Rech. Ophr., Sir. Rouge 11 ( 1977), 17-28. J. Karhumaki, Remarks on commutative N-rational series, Theoret. Comput. Sci. 5 (1977), 211-217. J.’Karhumaki, On commutative DTOL systems, Theoret. Comput. Sci.(to appear). J. Karhumaki, Some growth functions of context dependent L systems, Lecture Notes Comput. Sci. 15 (1974), 127-135. T. Katayama, M. Okamoto, and H. Enomoto, Characterization of the structuregenerating functions of regular sets and the DOL growth functions, Inform. and Control 36 ( 1978), 85- 10 I . T. Klove, On complements of unary L languages, J . Cornput. System Sci. 16 (1978). 56-66. J. B. Kruskal, The theory of well-quasi-ordering: a frequently discovered concept, J. Combin. Theory 13 (1972), 297-305. M. Latteux, Sur les TOL systkmes unaires, Reo. Fr. Automat., Inform. Rech. OpPr., Sir. Rouge 9 (1975). 51-62. M. Latteux, Deux problemes decidables concernant les TUL langages. Discrete Ma/h. 17 (1977). 165-172. M. Latteux, EDTOL-Systcmes Ultraliniaires et Opkrateurs Associks, Publ. No. 100, Lab. Calcul de Lille, 1977.
REFERENCES
345
M. Latteux. Grnirateurs Algcbriques el Langages EDTOL. Publ. No. 109, Lab. Calcul de Lille, 1978. K . P. Lee. Subwords of Deve1opment;il Languages, Ph.D. thesis, State Univ. of New York at Buffalo. 1975. J. van Leeuwen. The tape complexity of context independent developmental languages, J. Comput. S.vstc,m Sci. 1I ( I 975). 203-21 I . J . van 1.eeuwen. Variations of a new machine model. Proc. 17th Annual S j w p . bh/nd. c'fJn7/Jl4/.%i., Houston. Texas ( 1976). 228-235. J . van Leeuwen, Notes o n pre-set pushdown automata, Lecture Notes Comput. Sci. 15 (1974), 177-188. J. van Leeuwen. F-iteration Grammars, Tech. Rep., Dep. Comput. Sci., Univ. of California, Berkeley, 1973. J. van Leeuwen, A generalization of Parikh's theorem in formal language theory, Li,ctrtre Notes Comput. Sci. 14 (1974). 17-26. J. van Leeuwen. The membership question for ETOL languages is polynomially complete. Inform. P r o w s . Lett. 3 (1979, 138-143. J. van Leeuwen, Deterministically Recognizing EOL Languages in Time O(n3,8'), Tech. Rep., Mathematisch Centrum, Amsterdam, 1975. J. van Leeuwen, A study of complexity in hyper algebraic families, in "Automata. Languages. Development" ( A . Lindenmayer and G . Rozenberg, eds.). NorthHolland Publ., Amsterdam, 1976, pp. 323-333. J. van Leeuwen and D. Wood, A decomposition theorem for hyper algebraic extensions of language families. Theorel. Cumput. Sci. I (l976), 199-214. A. Lindenmayer, Mathematical models for cellular interaction in development, I and II, J. Theoret. B i d . 18 (1968). 280-31 5. A. Lindenmayer, Developmental systems without cellular interactions, their languages and grammars. J. Theoret. R i d . 30 (1971), 455-484. A. Lindenmayer, Developmental algorithms for multicellular organisms: a survey of L systems, J. Theor. B i d . 54 (1975). 3-22. A. Lindenmayer and G . Rozenberg, Parallel generation of maps : developmental systems for cell layers, in "Graph Grammars" (V. Claus, H. Ehrig, and G . Rozenberg. eds.). Springer-Verlag. Berlin and New York (to appear). M. Linna, The DOL-ness for context-free languages is decidable, Inform. Process. Lett. 5 (1976), 149- 151. M. Linna, The decidability of the DOL prefix problem, Intern. J. Comput. Math. 6 (1977), 127-142. H. Maurer, T. Ottmann, and A. Salomaa. On the form equivalence of L-forms, Theorrt. Cumput. Sci. 4 (1977), 199-225. H. Maurer and G. Rozenberg, Subcontext-free L Forms, Tech. Rep., Inst. fur Informationsverarbeitung, T U Graz. 1979. H. Maurer. A. Salomaa, and D. Wood, EOL forms, Acra Inform. 8 (1977). 75-96. H. Maurer. A. Salomaa, and D. Wood, Uniform interpretations of L forms, In/brrn. (mil Control 36 (1 978). 157- 173. H. Maurer, A. Salomaa. and D. Wood, ETOL forms, J. Cornput. System Sci. 16 (1978). 345-361. H. Maurer. A. Salomaa. and D. Wood, On good EOL forms, SIAM J. Comput. 7 (1978). 158-166. H. Maurer, A. Salomaa, and D. Wood, Relative goodness of EOL forms, Rei). Fr. Automrrt., Infbrm. Rech. Opkr., Sir. Rou,qe 12 (1978), 291-304. H. Maurer. A. Salomaa, and D. Wood, On generators and generative capacity of EOL forms. Aria InJbrm. (to appear).
346 [MSW7] [MI [MTI
“1 [N RSS]
REFERENCES H. Maurer, A. Salomaa, and D. Wood, Context-dependent L forms, Inform. und Control (to appear). B. Mayoh, Multidimensional Lindenmayer organisms, Leciure Notes Comput. Sci. 15 (1974). 302-326. L. M. Milne-Thompson, “The Calculus of Finite Differences.” Macmillan, New York, 1951. M. Nielsen, On the decidability of some equivalence problems for DOL systems. Inform. and Conirol25 (1974). 166-193. M. Nielsen, G. Rozenberg. A. Salomaa, and S. Skyum, Nonterminals, homomorphisms and codings in different variations of OL systems, 1 and I I , Aria Inform. 3 (1974), 357-364; 4 (1974), 87-106. T. Ojala. Algebrallisen Kooditeorian Perusteita, Thesis, Dep. Appl. Math., Univ. of Turku, 1973. J. Opatrny and K.Culik, 11, Time complexity of recognition and parsing of EOL languages, in “Automata, Languages, Development” (A. Lindenmayer and G . Rozenberg, eds.), North-Holland Publ., Amsterdam, 1976, pp. 243-250. A. Paz and A. Salomaa, Integral sequential word functions and growth equivalence of Lindenmayer systems, Inform. and Conirol23 (1973), 313-343. M. Penttonen, One-sided and two-sided context in formal grammars, Inform. and Control25 (1974). 371-392. M. Penttonen, ETOL-grammars and N-grammars, In$wm. Process. Leri. 4 (1975). 11-13. M. Penttonen, G . Rozenberg, and A. Salomaa. Bibliography of L systems, Theorei. Cornput. Sci. 5 (1977), 339-354. V. Rajlich, Absolutely parallel grammars and two-way finite state transducers, J. Comput. Sysiem Sci. 13 (1976), 324-342. A. Reedy and W. Savitch, Ambiguity in the developmental systems of Lindenmeyer, J . Cornput. Sysiem Sci. 1 1 (1975), 262-283. G. Rozenberg, TOL systems and languages, Inform. und C‘onrrol 23 (1973). 357-381. G . Rozenberg, Extension of tabled OL systems and languages, Intrmai. J. Compui. Inform. Sci. 2 (1973). 311-334. G . Rozenberg, On a family of acceptors for some classes of developmental languages, Internat. J. Compui. Maih. 4 (1974), 199-228. G. Rozenberg, DOL sequences, Discrete Math. 7 (1974). 323-347. G. Rozenberg. Circularities in DOL sequences. Rec. Roumuine Math. Purrs Appl. 9(1974), 1131-1152. G . Rozenberg. L Systems with Interactions: The Hierarchy, Tech. Rep., Dep. Comput. Sci., State Univ. of New York at BufTalo, 1972. G . Rozenberg, Selective substitution grammars, Part I, Elrkiron. Informaiionsilerarh. Kvhernei. 13 (1977), 455-463. G. Rozenberg and P. Doucet, On OL languages, Inform. and Control 19 (1971). 302-3 18. G. Rozenberg and K. P. Lee, Developmental systems with finite axiom sets, Part I. Systems without interactions, Iniernat. J. Compur. Marh. 4 (l974), 43-68. G. Rozenberg and K.P. Lee, Some properties of the class of L languages with Compui. . System Sci. 11 (1975). 129-147. interactions, .I G. Rozenberg and A. Lindenmayer, Developmental systems with locally catenative formulas, Ac/a Inform. 2 (1973). 214-248. G . Rozenberg, K. Ruohonen, and A. Salomaa, Developmental systems with fragmentation, Internat. J. Compui. Maih. 5 (1976), 177-191.
347
REFERENCES
G . Rorcnberg and A. Salomaa. New squeezing mechanisms for L systems. Infhrni. ,%i. I2 ( 1977). 187-201. G . Rozenberg and D. Vermeir. Mctalmear ETOL languages. Fund, ln/urm, (to appear). G . Rozeiiherg and D. Vermeir. On recursion in ETOL systems. J . C‘onipur. S~srmm Si.(to appear). G . Kozenberg and D. Vermeir, ETOL Systems with Finite Tree Rank. Tech. Rep., Univ. of Antwerp. U.I.A.. 1978. G . Rozenberg and D. Vermeir, On acceptors of iteration languages, Inrcwicrr. J . C‘ompur. Mtr/h. 7 (1979). 3 - 19. G . Rozenherg and D. Vermeir. On ETOL systems of finite index, Inliwrn. und cf))irr(l/ 38 ( I 978). I 03 I 33. G . Rozenberg and D. Wood. A note on a family of acceptors for some families of developmental languages. hitcvntrr. J . (‘ompur. Mnrh. 5 (1976). 261 -266. K . Ruohonen, On the synthesis of DOL growth. Ann. Acad. Sri. Fc.,iri. Sijr. A I ,Af(rt/t. I (1975). 143-154. K . Ruohonen. Three results ofcomparison between L languages with and without interaction. Inform. Prawss. Lett. 4 (1975), 7-10. K . Ruohonen, Developmental systems with interaction and fragmentation, /rlform. ~ r Con/ro/ ~ d 28 ( I 975), 9 I I I 2. K . Ruohonen. JL systems with non-fragmented axioms: the hierarchy. Internor. J . C’ompur. M ~ r h5. (1975). 143 - 156. K . Ruohonen, Zeros of Z-rational functions and DOL equivalence, Tlleorrr. C’ompur. Sci. 3 ( 1976). 2x3 292. K . Ruohonen, On some decidability problems for HDOL systems with nonsingular Parikh matrices. Tech. Rep., Math. Dept., Univ. Turku, 1976. K . Ruohonen, Kcmarks on locally catenativc developmental sequences, Elekrron. /n/brmtrrion.sr~Pr.arh.Kj>heriic,/.14 ( I978), I7 1 180. K . Ruohonen, The decidability of thc FOL-DOL equivalence problem, Inform. P r w i w /.cvr. (to appear). K . Ruolionen, The inclusion problem for 1)OL Iiinguages. Tech. Rep.. Math. Dept.. Univ. Turku. 1978. A. Salomaa. Parallelism in rewriting systems, Lecture Notes Conipur. Sci, 14 (1974). S23 533. A. Salomaa, Solution of a decision problem concerning unary Lindenmayer systems, Di.vcre/c, Murk. Y (1974), 71 77. A. Salomaa. On exponential growth in Lindenmayer systems, Indug. Mnrh. 35 (1973). 23 30. A. Salomaa, “Formal Languages.” Academic Press, New York, 1973. A. Salomaa. On sentential forms of context-free grammars. Acru h j k r m . 2 (1973). -
40-49.
A. Salomaa. Macros. Iterated Substitution and Lindenmayer AFL’s, Comput. Sci. Tech. Rep., Univ. of Aarhus. 1973. A. Salomaa, Comparative decision problems between sequential and parallel rewriting. Proc. Sjmp ~ l n i / b r m / j ,Srructured Auromara Logic. Tokvo (1975), 62 66.
A. Salomaa. Growth functions of Lindenmayer systems: some new approaches, in “Automata. Languages. Development” (A. Lindenmayer and G . Rozenberg, eds.). North-Holland Publ.. Amsterdam, 1976, pp. 271 282. A. Salomaa, Undecidable prohlems concerning growth in informationless K j h w ~ e r12 . (1976). 33 1-335. Lindenmayer systems, E/i,krroii. h?fornrurionsi~rrarb.
REFERENCES
[Schl] [Sch2]
A. Salomaa, Equality sets for homomorphisms of free monoids. Acra Cvhcvtrr/. 4(197R). 127 139. A. Salomaa and M. Soittola, “Automata-Theoretic Aspects of Formal Power Series.” Springer-Verlag, Berlin and New York, 1978. M. Schutzenberger, On a definition of a family of automata, Inform. and Control 4 (1961). 245-270. M. Schiitzenberger, On a theorem of R. Jungen, Proc. Amer. Muth. Soc. 13(1962). 885-890. S. Skyum, Decomposition theorems for various kinds of languages parallel in nature, SIAM J . C a m p / . 5 (1976). 284-296. S. Skyum. On good ETOL forms, Theore/. Camput. Sci. 7 (1978). 263-272. M. Soittola. Remarks on DOL growth sequences, Rrr. Fr. Automat.. Iflfbrm. Rech. 0pr;r.. S i r . Rouge 10 (1976), 23-34. M. Soittola. Positive rational sequences. Thearc,/. Comprt. S c i . 2 ( 1976). 31 7-322. I. H. Sudborough, The lime and lapc complexity of devclopmcnral languages. Lrcrure N o i c . ~Comput. Sci. 52 (1977). 509-523. A. Szilard, Growth Functions of Lindenmayer Systems, Tech. Rep., Comput. Sci. Dep.. Univ. of Western Ontario. 1971. D. Vermeir. On Structural Restrictions of ETOL Systems, Ph.D. thesis, Univ. of Antwerp. U.I.A.. 1978. P. Vitanyi, Structure of growth in Lindenmayer systems, Indag. Math. 35 (l973), 247-253. P. Vitanyi, Growth of strings in context-dependent Lindenmayer systems, Lcv/r,w No/c,.s c‘ompu/. Sci. 15 ( 1 974), 104- 123. P. Vitanyi. Deterministic Lindenmayer languages, nonterminals and homomorphisms. Throw/. Campur. Sci. 2 (1976). 49-71. P. Vitanyi. Digraphs associated with DOL systems, in “Automata, Languages, Development (A. Lindenmayer and G . Rozenberg. eds.). North-Holland Publ.. Amsterdam, 1976, pp. 325-346. P. Vitanyi. Lindenmayer Systems: Structure, Languages and Growth Functions. Ph.D. thesis. Mathematisch Centrum, Amsterdam, 1978. D. Wood, Iterated a-NGSM maps and r-systems. Inform. and Control32 (19761, I 26. D. Wood, “Grammar and L Forms.” Springer-Verlag. Berlin and New York (to appear). ”
Index
A
C
Active normal form. 262 Adult alphabet, 72 Adult language, 71 AFL, 7 full. 7 Alphabet. I Ambiguity, 60 Anti-AFL. 7 Antiarithmetic family o f languages, 258 Automaton, 5 auxiliary pushdown, 3 I I cs-pd, 301 deterministic cs-pd. 303 finite deterministic. 5 finite nondeterministic, 6 pac, 308 pap, 30.5
Catenation, 2 Catenation closure, 2 C G P system, 325 Chomsky hierarchy, 4 Clustered, 98, 248 Code, 129 with bounded delay, 130 Coding, 2 COL system, 62 Compatible homomorphisms, 122 Complete EOL form, 1 13 Complete twin shuflle, 151 Complexiry. 3 10 Cone, 7 Control word, 190 Covered, 22 Cross, 2 Cut, 14
B D
Balanced decomposition, 90 Balance of homomorphisms, I22 bounded, 123 Binary propagating map OL system, 332
Decomposition of FPOL system, 93 well-sliced, 93 Decomposition of sequences, 17, 155
349
350
INDEX
Density, 223 Dependence graph, 28 Derivation, 45, 190, 233 dfl-substitution, 105 dgsm mapping, 145 reverse, 145 symmetric, 145 DOL equivalence problem, 12 DOL form, 177 form equivalence, 177 sequence equivalence, 177 DOL system, 10 conservative, 17 everywhere growing. 213 injective. 24 reduced, 16 uniformly growing, 213 DTOL function, 215 communative, 218 DTOL system, 188
E EDTOL system, 191 EIL form, 289 Elementary homomorphism, 17 Empty word, 1 Endomorphism, 2 EOL form, 107 bad, 115 complete, I13 good, I15 good relative to, I16 mutually good, 116 synchroni7.d. I I I vomplete, 1 I5 EOL system, 54 Equal homomorphisms, 122 ultimately equal, 122 Equality language, 122, 144 Equivalence, 4 ETOL system, 235 of finite index, 263 of finite tree rank, 279 of uncontrolled finite index, 263 with rank, 278 synchronized, 239 Exhaustive language, 253 Existential spectrum, 52, 66
F Finite index normal form. 267 Fixed point language, 144 Form equivalence, 107, 289 strict. 107 Fragmentation, 78
G Generalized sequential machine, 7 Generating function. 33 Grammar. 3 context-free, 4 context-sensitive, 4 finite index, 205 Indian parallel, 192 iteration, 293 linear, 4 regular, 4 type i. 4 Growth equivalence, 35, 216 Growth function, 30, 289 Growth order, 161 Growth relation, 90 deterministic, 90 exponential. 90 limited. 90 polynomial type, 90 gsm mapping, 7
H Height of derivation, 45, 190 Hilben's tenth problem, 8 Homomorphism, 2 elementary. I7 inverse, 2 A-free. 2 nonerasing, 2 simplifiable, 17 type of, 253 Hyper-AFL, 296 full, 296 Hyperalgebraic extension, 294 Hypersentential extension, 298
I IL system, 281
INDEX
351
lmproductive occurrence, 46 Interpretation, 107. 177 uniform, 117 Isomorphic sequences, I78 ultimately isomorphic, 178 Iteration grammar, 293 deterministic, 299 morphic, 293 rn-restricted, 293 propagating, 293 sentential. 293
K K-equivalent, 249 Kleene plus, 2 Kleene star. 2
Language, 2 arithmetic, 258 bounded, 205 context-free, 4 context-sensitive, 4 DOL. I I DTOL, 188 EDTOL, 191 EIL, 285 elementary, 127 EOL, 54 ETOL, 235 IL, 281 linear, 4 OL, 44 PDOL, 11 prefix-free, 143 recursively enumerable, 4 regular, 4 TOL, 231 LBA problem, 6 Length, of derivation, 45, 190 of word, I Length density, 223 Length set, 4 Letter, 1 bad, 184 good, 184 Linear set, 5
Locally catenative, 14 DOL system, 14 of some depth, 24 of some width, 27 Loose COL system, 69
M Macro system, 61 Matrix of trees, 194 well-formed, 195 Merging of sequences, 17, I55 Mirror image, 3 Morphism, see homomorphism
N Neatly synchronized, 85 Neat subderivation, 193 Nonterminal, 3, 54 NP-complete, 310 N-rational, 32, 215
0 Occurrence of letter, big, 193 expansive, 203 multiple, 193 nonrecursive, 193 recursive, 193 small, 193 unique, 193 OL system, 43 with finite axiom set, 70
P Parikh mapping, 5 Parikh set, 5 Parikh vector, 5 PDOL form, 177 PDOL system, 1 1 Polynomially bounded, 39, 227 Post correspondence problem, 8 Prefix. 2, 207 Prefix balance, 146 Pre-quasoid, 294 Production, 3 Productive occurrence. 46
352
INDEX
Propagating, I 1, 44 Propagating graph OL system, 317
Q
Suffix, 2, 207 Symmetric pair. 145 Synchronization symbol, 57, 239 Synchronized, 56, 11 1, 239
Quasiquotient. 167 Quasoid, 294
T R
Rational transduction, 7 Recurrence system, 61 Regular expression, 5 Regular operation, 5 Rewriting form, 105 Rewriting system, 3
Table, 188, 231 @determined language, 84 t-counting language, 93 t-disjoint decomposition, 90 Terminal, 3 Tight COL system, 69 TOL system, 231 Trace of derivation, 45, 190, 233 Turing machine, 6
S Semihomogeneous, 3 12 Semilinear set, 5 Sentential form, 4 Sequential transducer, 6 Shift of functions, 163, 167 Shift of sequence, 26 Shuffle, 249 Slicing, 5 1 Slow function, 197 Speed-up of EOL system, 59 Strictly growing PDOL form, 179 Subderivation, 190 neat, 193 Substitution, 2 arithmetic, 258 dfl, 105 finite, 2 A-free, 2 Subword, 1 final, 2 initial, 2
U Ultimately exponential, 39 Unary OL system, 59 Universal spectrum, 52 V Vomplete EOL form, I I5
W word, I f-random, 197
Y Yield relation, 3 Z
Z-rational, 32, 215