AUTOMATA, LANGUAGES, A N D MACHINES VOLUME A
Pure and Applied Mathematics A Series of Monographs and Textbooks
Editors Paul A. Smith and Samuel Eilenberg Columbia University, N e w York
R E C E N T TITLES
ERNST AUIXSTBEHRENS. Ring Theory hioRRIs N E W M A NIntegral . Matrices Introduction . to Compact Transformation Groups GLENE. B I ~ E M N WERNER GIIEUB,STEPHI:N IIArmi
W. Vrcrc. Homology Theory : Ail Introduction to Algebraic Topology JAMES E. R. KOLCHIN. Differential Algebra and Algebraic Groups GERALD J . J A N U S ZAlgebraic . Number Fields A . S. B. Hior.i.ANu. Introcluction to the Theory of Entire Functions A N U DALEVARUKIIG. Convex Functions W A Y N EROBERTS A. h4. O s ~ r a o w s ~Solution r. of Equations i n Euclidean and Banach Spaces, Third Edition of Solution of Equations and Systems of Equations SAMUEL EILENBERG. Automata, Languages, and Machines : Volume A H. M. EDWARDS. Riemann's Zeta Function I I I freparatiorr WILHELMMAGNUS. Non-Euclidean Tesselations and Their Groups J . D I E L T D O Nl rNe a~t.i s e on Analysis, Volume IV bfcmws HIIISCH A X I I S n i r J i i r i N SMALE. Differential Equations, Dynamical Systems, and Linear Alg-ebra
AUTOMATA, LANGUAGES, A N D MACHINES VOLUME A
Samuel Eilenberg COLl~MI3I.A IINIVEI<SI'I'Y
NEW Y O R K
ACADEMIC PRESS New York and London A Sirbsidinry of Hnrcoitrf Brnce J o z m w v i c l i , Piiblisliers
1974
COPYRIGHT 0 1974, BY ACADEMIC PRESS. INC. ALL RIGHTS RESERVED. NO PART O F THIS PUBLICATION MAY BE REPRODUCED OR TRANSMIlTED IN ANY FORM OR BY ANY MEANS, ELECTRONIC OR MECHANICAL, INCLUDING PHOTOCOPY, RECORDING, OR ANY INFOR hlATlON STORAGE AND RETRIEVAL SYSTEM, WITHOUT PERMISSION IN WRITING FROM THE PUBLISHER.
ACADEMIC PRESS, INC.
I 1 1 Fifth Avenue, New York, New
York
10003
United Kingdom Edition published b y ACADEMIC PRESS INC. (LONDON) LTD. 24/28 Oval Road, Londo; N W I
LJBRARY OF CONGRESS CATALOG CARDNUMBER:72-88333 AMS (MOS) 1970 Subject Classifications: 94A25 94A30, O2Fl0 PRINTED IN THE UNITED STATES OF AMERICA
This P a ge Intentionally Left Blank
Contents
PREFACE
...
. . . . .
Xlll
. . .
. . . . . . . . .
1
. . . . . . . . . . . . . . .. . .
. . . . . . . . .
2 3 6
. . . . . . . . . . . . . . . . . .
CHAPTER I Preliminaries
. 1. 1;unctions . . . . . . . Relations and Partial Functions 3 . Monoids . . . . . . . . . . 4. Categories . . . . . . . . . 5 . Equivalences and Congruences 6 . Miscellaneous Conventions . . References . . . . . . . . . 2.
. .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
12 15 17 21 24 26 29
1. Basic Definitions . . . . . . . . . . . . . . . . . . . . . . . . . 2 . T h e Subset Construction . . . . . . . . . . . . . . . . . . . . . 3 . T h e Division Calculus . . . . . . . . . . . . . . . . . . . . . . .
30 32 34
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . . .
. . . . . . . . .
. . .
. . . . .
. . . . .
8 10 11
CHAPTER I1 Automata and Recognizable Sets 1 . Basic Definitions . . . 2 . Examples . . . . . . . 3 . Operations o n Automata 4. Accessibility . . . . . 5 . Finiteness and Iteration 6. L o c a l S e t s . . . . . . References . . . . . .
. . . . . . . . . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
CHAPTER I11 Deterministic Automata
vii
Contents
viii 4. State-Mappings . . . . . . . . . . . . . . . . 5 . Minimal Automata . . . . . . . . . . . . . . 6 . A Decision Problem . . . . . . . . . . . . . . 7 . Examples . . . . . . . . . . . . . . . . . . . 8 . T h e Quotient Criterion . . . . . . . . . . . . 9 . Right Congruences . . . . . . . . . . . . . . 10. T h e Syntactic Monoid . . . . . . . . . . . . . 11. Examples of Syntactic Monoids . . . . . . . . 12. Generalization to Arbitrary Monoids . . . . . 13. Automata of Type ( p , v) . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38 43 49 51 55 59 61 65 68 72 74
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
76 78 80 83 88 91 92 97 99
CHAPTER I V Structure of Recognizable Sets 1. 2. 3. 4. 5.
Unitary Sets . . . . . . . . . . . . . . . . Prefixes . . . . . . . . . . . . . . . . . . Unitary Monoids . . . . . . . . . . . . . . T h e Decomposition Algorithm . . . . . . . Bases of Unitary Monoids . . . . . . . . . . 6 . Iterated Up-Decomposition . . . . . . . . . . 7 . Maximal Prefixes . . . . . . . . . . . . . . 8 . Recurrent States . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
CHAPTER V The Integers 1. T h e M o n o i d N . . . 2 . Integers at Base k . 3 . &Recognizable Sets . 4 . Iteration . . . . . . 5 . Gap Theorems . . . 6 . Other Interpretations 7. Coding . . . . . . . References . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
100 103 106 110 111 115 117 118
1 Multiplicity in Automata . . . . . . . . . . . . . . . . . . . . . . 2. Semirings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 . K-Subsets . . . . . . . . . . . . . . . . . . . . . . . . . . . .
120 122 126
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . .
. . . . . . . .
CHAPTER V I Multiplicity
.
Contents
ix
4. Relations and Functions . . . . . . . . . . . . . . . . . . . . . . 5. Monoids and Matrices . . . . . . . . . . . . . . . . . . . . . . . 6. 7. 8. 9. 10. 11. 12.
K-C-Automata . . . . . Recognizable K-Subsets . T h e Equality Theorem . T h e Case K = N . . . . T h e Division Theorem . T h e Subtraction Theorem Undecidable Propositions . References . . . . . . .
. . . . . .
129 133 135 139 143 147 150 153 155 158
. . . . . . . . . . . . . . . . .
159
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
CHAPTER V I I Rational Sets 1. 2. 3. 4. S. 6. 7. 8. 9. 10.
. 1 -Algebras . . . . . . . . . . . Rational K-Subsets . . . . . . . Rational Expressions and Identities Locally Finite Monoids . . . . . Kleene's Theorem . . . . . . . . I, inear Equations . . . . . . . . Examples . . . . . . . . . . . . Unambiguous Rational Sets . . . T h e Semirings N and .I" . . . . Generalized Automata . . . . . . References . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . 163 . . . . 166 . . . 170 . . . 17.5 . . . 179 . . . 182 . . . 186 . . . 188
. . . . . . . . . . . . . . . . .
191 194
. . . . . . . . . . . . . . . . .
CHAPTER V I I I An Excursion into Analysis 1. 2. 3. 4.
Generating Functions . . . . K-Recognizable Power Series . T h e Case When k' Is a Ring T h e Case h'= Z . . . . . . 5. Positive Analytic Functions . . 6 . R+-Recognizable Functions . . 7 . Behavior of Coefficients . . . 8. Bernouilli Distributions . . . 9 . Prefixes and Bases . . . . . References . . . . . . . . .
. . . . . . . . . . . . . . . . . . . 195 . . . . . . . . . . . . . . . . . . . 199 . . . . . . . . . . . . . . . . . . . 204 . . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
207 208 215 219 223 227 235
CHAPTER IX Rational Relations 1. Definitions and Examples . . . . . . . . . . . . . . . . . . . . . 2 . First Factorization Theorem . . . . . . . . . . . . . . . . . . . .
236 240
Contents
X
3. 4. 5. 6. 7 8. 9.
.
Evaluation Theorem . . . . . . . . . . . . . . . . . . . . . . . . Composition Theorem . . . . . . . . . . . . . . . . . . . . . . . Second Factorization Theorem . . . . . . . . . . . . . . . . . . . I.ength.I’reser\. inF Relations . . . . . . . . . . . . . . . . . . . . A Cross-Section Theorem . . . . . . . . . . . . . . . . . . . . . Rational Partial Functions . . . . . . . . . . . . . . . . . . . . . Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . .
242 245 248 252 256 258 261 265
CHAPTER X Machines 1. Basic Definitions . . . . . . . . . . . . . . . 2 . Automata as Machines . . . . . . . . . . . . . 3 . Transducers and Rational Relations . . . . . . 4. Accelerated Transducers . . . . . . . . . . . . 5 . Positive Rational Relations and Transducers . . 6 . Two-way Automata . . . . . . . . . . . . . . 7 . Other Machines . . . . . . . . . . . . . . . . 8 . Deterministic Machines . . . . . . . . . . . . 9 . A Conversion Theorem . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . 266 . . . . . . 271 . . . . . . . 272 . . . . . . 276 . . . . . . . 279 . . . . . . 282 . . . . . . 286
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
288 292 295
CHAPTER XI Sequential Machines 1.
2. 3. 4. 5. 6. 7. 8. 9.
Basic Definitions . . . . . . . . . . . . . . Notation and Interpretation . . . . . . . . . Properties of Sequential Functions . . . . . Digital Computation . . . . . . . . . . . . . State-Dependent Sequential Machines . . . . Recognition of gsp-Functions . . . . . . . . . Sequential Bimachines . . . . . . . . . . . . Examples of Uimachines . . . . . . . . . . . Proof of l’heoreni 7.1 . . . . . . . . . . . .
. . . . . . .
. . . . . . .
. . . . . . . . . . . . .
. . . . . . . . .
. . . . . . . 296 . . . . . . . 300 . . . . . . . . 306 . . . . . . . 309 . . . . . . . . 312 . . . . . . . 314 . . . . . . . 320 . . . . . . . 322 . . . . . . . 325
CHAPTER XI1 Operations on Sequential Machines 1. 2. 3. 4.
State-Mappings . . . . . . . . . . . . . . . . . . . . . . . . . . Accessibility . . . . . . . . . . . . . . . . . . . . . . . . . . . Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . Minimal gs-Machines . . . . . . . . . . . . . . . . . . . . . . .
330 333 335 338
Contents 5. 6. 7. 8. 9. 10.
xi
Decision Problems . . . . . . . . . . . . T h e Strong Minimization Problem . . . . T h e Synthesis Problenl . . . . . . . . . . Composition of Sequential Llachines . . . 2-Categories . . . . . . . . . . . . . . . Parallel Products . . . . . . . . . . . . . References . . . . . . . . . . . . . . . .
. . . . . . . . . . . .
341
. . . . . . . . . . . . . 343 . . . . . . . . . . . .
348
. . . . . . . . . . . . . 349 . . . . . . . . . . . . 352
. . . . . . . . . . . . . . . . . . . . . . . .
354 356
CHAPTER XI11 Infinite Words 1. 2. 3. 4. 5. 6.
TheSetY1 . . . . . . . . Ultimately Periodic Sequences Expansion of Real Numbers . Infinite Digital Computation . T h e Peano Curve . . . . . . T h e Hilbert Curve . . . . . References . . . . . . . . .
. . . . . . . . . . . . . . . . . . . 358 . . . . . . . . . . . . . . . . . . . 362 . . . . . . . . . . . . . . . . . . . 363 . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
368 371 376 378
CHAPTER XIV Infinite Behavior of Finite Automata 1. 2. 3. 4.
Main Definitions and Results . . . . . . . . . . . . . . . . . . . . An Auxiliary Proposition . . . . . . . . . . . . . . . . . . . . . . Proof of Theorem 1.4 . . . . . . . . . . . . . . . . . . . . . . . Examples and Exercises . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . .
379 383 386 390 393
CHAPTER XV k-Recognizabl e Sequences 1. 2. 3. 4.
k-Recognizable Sequences . . . . . . . . . . . . . &Generic Sequences . . . . . . . . . . . . . . . Examples and Exercises . . . . . . . . . . . . . . k-Recognizable Sequences and Sequential Functions References . . . . . . . . . . . . . . . . . . . .
. . . . .
. . . . .
. . . . .
. . . . . 394 . . . . . 396 . . . . . 399 . . . . . . 401 . . . . . 404
CHAPTER XVI Linear Sequential Machines 1. Algebraic Preliminaries . . . . . . . . . . . . . . . . . . . . . . . 2 . Linear Sequential Machines . . . . . . . . . . . . . . . . . . . .
405 408
xii
Contents
3. 4 5. 6. 7. 8. 9. 10. 11. 12.
T h e Free Case; Comparison with Automata . . . . . . . . . . . . . Quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Minimization . . . . . . . . . . . . . . . . . . . . . . . . . . . Parallel Composition . . . . . . . . . . . . . . . . . . . . . . . . Series Composition . . . . . . . . . . . . . . . . . . . . . . . . T h e Case When K Is a Field . . . . . . . . . . . . . . . . . . . Rationality and Recurrence . . . . . . . . . . . . . . . . . . . . . Sequential Functions and Rationality . . . . . . . . . . . . . . . . Integral Closure and Entire Rings . . . . . . . . . . . . . . . . . T h e Main Rationality Theorems . . . . . . . . . . . . . . . . . .
13
Proof of Theorems 12.1 and 12.2 . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . 440
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
447
.
.
413 415 416 422 424
427 431 433 437 439 444
Preface
T h e last twenty years have brought forth a body of research known under the names of the theory of a~ctomntnand the theory of formal languages. Both topics are closely related and form a distinct part of what is rather nebulously described as “computer science.” They are made up of a body of mathematical objects, theorems, and methods of proof that are essentially algebraic, bordering on logic. Many of the published results show motivations specific to the interests of their authors and these were frequently very varied-to mention a few: logic, linguistics, theory of communicatjon, programming, electronic circuits, and even models for neurophysiology. It appearcd to me that the time is ripe to try and give the subject a coherent mathematical presentation that will bring out its intrinsic aesthetic qualities and bring to the surface many deep results which merit becoming part of mathematics, regardless of any external motivation. This work, planned in four volumes, of which this is the first, proposes to cover a major part of the field. A serious effort has been made to include most of the interesting results. However, restraint had to be used since many of the ramifications, if pursued too far, would lead to many highly specialized researches, far away from what can be discerned as the principal objectives. Although these principal objectives have not been specifically named, I hope that the reader will acquire the perspective that I tried to impart to this work. One very characteristic feature of the subject should be mentioned here. All the arguments and proofs are constructive. A statement asserting that something exists is of no interest unless it is accompanied by an algorithm (i.e., an explicit or efl‘ective procedure) for producing this “something.” Thus, each proof is also an algorithm. Usually, but not always, the simplest proof also gives the most efficient algorithm. xiii
xiv
Preface
I n some parts of the work, minimizing the length of the algorithm is, in itself, a legitimate objective. Contrary to what might be expected of an abstract mathematician, I have refrained from carrying the various developments to their ultimate generality. Quite to the contrary, I have intentionally refrained from generalizing the various developments beyond their original motivations, except when such generalizations actually helped to streamline the structure. I have placed the proofs in the center of my concern. T h e various arguments and constructions that occur in the field were carefully analyzed and digested. Propositions that have multiple use have been identified, and the definitions, notations, and terminology were chosen so as to achieve efficient proofs. T h e resulting economy of space has permitted me to give in most cases complete proofs rather than proof outlines, which are frequently a fashion in this field. T h i s restructuring of the material along lines normally practiced in algebra has not only retained the original motivations, but has frequently had the effect of reinforcing them. Some results were considerably strengthened and new ones have been found. This work is addressed both to pure mathematicians and to computer scientists. T o the pure mathematician, I tried to reveal a body of new algebra, which, despite its external motivation (or perhaps because of it) contains methods and results that are deep and elegant. I believe that eventually some of them will be regarded as a standard part of algebra. To the computer scientist I tried to show a correct conceptual setting for many of the facts known to him (and some new ones). ‘This should help him to obtain a better and sharper mathematical perspective on the theoretical aspects of his researches. T h e volume at hand (Volume A) consists of the study of mathematical structures (sets, functions, and relations) that can be described (or recognized) by finite state devices (i.e., automata deterministic or not, with or without outputs) without auxiliary memory or storage capacity. We use the term “rational” for these structures. T h u s rational sets, rational functions, and rational relations will be investigated. T h e use of the term rational is in my opinion amply justified by the connections with rational numbers, rational functions, and solutions of systems of linear equations, that will be demonstrated in the text. These rational notions form the cornertone of the entire structure. Kleene’s Theorem of Chapter VII occupies a place of honor in this volume. T w o novel features of Volume A should be mentioned. One is the
Preface
xv
general notion of a ninchine defined in Chapter X. This seems to be a very efficient tool that will be used extensively in Volumes C and D. T h e second novel feature worth mentioning here is the way multiplicity is handled. When one has a set A defined by some explicit device (e.g., automaton, machine, grammar, or system of equations), the verification that an element n is in A involves a procedure which may be called a “computation.” When for a given a two (or more) such essentially different computations exist, it is natural to assign to a a “multiplicity” which is the number of ways by which the given algorithm leads to the conclusion ‘ ‘ a E A.” I n Chapter VI is developed a method that permits us to study sets equipped with a multiplicity function alongside ordinary sets, in a manner which is effortless and efficient. Volunie B will delve rather deeply into the various subclasses and hierarchies that occur within the rational domain. T h e main feature here is the Krohn-Rhodes theory and other similar developments. This volume is heavily algebraic. T h e subsequent Volumes C and D move from the rational upward. T h u s they depend on Volume A but are totally independent of Volume B. Volume C starts out with a hierarchy (called the rational hierarchy) of the nonrational phenomena ; this is achieved by using rational relations as a tool for comparison. Rational sets are at the bottom of this hierarchy. Moving upward one encounters “algebraic phenomena,” which differ from the rational in that algebraic equations rather than linear equations are solved. This leads to the context-frce grammars and contest-free languages of Chomsky, and to several related topics. Volume D moves u p higher in the hierarchy and reaches the level that we call “computable.” This level can equivalently be described by general grammars, ‘I’uring, Post, and other machines, by Markov algorithms as well as by recursiveness. At this stage, the hierarchy established using rational relations loses its grip and a new hierarchy based on recursive relations takes over. This leads straight into some of the topics in mathematical logic and is outside the purviem of this work. This book presupposes no prior knowledge of the theory of automata or of algebra or for that matter of anything else. What is presupposed is the general mathematical culture on the level of a mathematics major. T h e chapters carry roman numerals and Theorem 2.3 of Chapter I1 will be referred to in later chapters as Theorem II,2.3. At the end of most chapters the reader will find a section called References. This will be a melange of terminological remarks, credits for specific items in the chapters, occasional suggestions for further reading,
xv i
Preface
and a short annotated bibliography. References to earlier work are skimpy. T h e main reason for this is my ignorance of the proper sources; many of the items were reconstructed from scratch or from hearsay. There is an index at the end of the volume, but no general bibliography. Calvin C. Elgot of the IBM Corporation is responsible for attracting me to this new field. I am deeply grateful. T h e reader will find that the name of M. 1’. Schutzcnberger is often mentioned as author (or coauthor with me) of many of the new results or proofs that appear in this volume; most have not been previously published. However, his contributions went much beyond that; virtually every phase of the development presented here was endlessly discussed with him. I am, however, the only one to blame for any shortcomings. I a m also pleased to acknowledge the help furnished in various degrees by Bret Tilson, Rudolf E. Iialman, Eduardo Sontag, Walter S. Brainerd, Martin Golumbic, and Viera Krnanova. Many thanks are due to the Mathematics Branch of the Office of Naval Research and to Dr. Leila D. Bram who for a number of years have very patiently supported my research. I am certain that despite all the care given to the preparation of this volume, the attentive reader will find many (small, I hope) slip-ups that should be corrected and local improvements that can be made. I shall be most grateful to all those that will take the trouble to communicate them to me.
CHAPTER
I Preliminaries
1. Functions
Given sets S and 1’ we shall use the notation
f: X +
1’
or
A- f Y
to denote a function defined for all K E S and with values in 1’. If g: Y + Z is another function, we denote by fg: X Z the cornposition ---f
.fg:
T h u s for each M
E
f s+ Y 5z
A‘ we have
(fg)(.)
=g(f(*y))
With this notation, the parentheses around x may be omitted, but the other pair must be kept. An alternative notation would write the function symbol after the variable. In this notation, . fg may be written unambiguously without parentheses. ‘The last notation has the following added advantage: l’hc element’ v E X may be interpreted as a function x: I + X, where I is some set containing a single element and the value of the function is s. Then &Yfgis the composition of functions
I”-
- 1 f- 41’”.
z
In the sequel we shall use the second notation and write xf for the value of the function f at x. 1
I. Preliminaries
2 2. Relations and Partial Functions
For any set “i we denote by -? the power set of S,i.e., the set of all subsets of A‘ (including the empty subset (;J). Each element x of X will be regarded as a subset consisting of a single element. With this convention we have X c A relutiorz f from &Yto J’, written f : S I’, is a function
‘v.
.f:
(2.1)
-?
+
P
which is completely additive, i.e., which satisfies
where { , 4 , I i E I } is a family of subsets of -Yindexed by some set I , and U stands for the union. Note that \-;f<$. I n view of this additivity, f is completely determincd by its values on single element subsets, so that f niay be viewed as a function
Coinposition of relations is defined in the obvious way using the original dcfinition (2.1). ‘I’he graph #f of a relation f : -Y - + I’ is defined as a subset of - Y x I’ as follows: #f = {(s,v ) I y E .yf 1 Clearly, every subset of S,.I’ is the graph of some relation from &Yto 1‘; thus # is a bijection (i.e., a 1-1 correspondence) between the relations f : S I’ and the subsets of .Y/ 1’. This leads many authors to define a relation *Y+ I’ as a subset of zI-\17. We prefer to separate the notion of a relation from that of its graph for the following reason: A subset of the product S r Y Y Z (treated associatively) will be the graph of a relation S + I’ ’Z and also of a relation S / I’ + Z . These two relations may have quite different properties. For any relation!: S + I‘, the i w e r s e relation f - I : J’ S is defined by -f
4
yf
{YIY€,Yf}
‘l’hus the graph # f c J’x A‘ is obtained from the graph # f c S:.: Y by an interchange of coordinates.
3. Monoids
3
T h e domain of a relation f : X
4
1' is defined as
PI relation f: A' 4 IT is called a partial fiinction if for each x E X the set xf has at most one element. If xf has cxactly one element, then f is a function. T h u s a partial function f is a function iff Dom f = S. A function f : S- J 7 is said to be injective if x, f x p implies x, f f x2f. l'he function f is said to be surjectiue if -Yf = Y, i.e., if every 31E T', = .yf holds for at least one $2' E .Ti'. I f f is both injective and surjective, then f is said to be bijective. T h e inverse f-' is then also a bijective function and the composites # - I : S + X, f -tf: I' 4 I' are identity functions. T h e term surjecticye will also be used for partial functions f : X Y provided A f = 1.. Given g, f: S + 1' we write g c f if xg c xf for all x E S. This is equivalent with the inclusion of graphs #g c # f . I f f is a partial function, this implies that g is a partial function and that xg = xf whenever xg f 13. However, we may have xg = ~3and xf f If both g and f are functions, then g c f implies g = f. --f
a.
EXERCISE 2.1. Given relations f :
S
,'T g : I.'+ Z, verifr
4
3. Monoids
A monoid consists of a set M and a function
The function is not given any name and the image of the pair ( m , , m,) under this function is denoted by m , m 2 . T h e following axioms are postulated :
(3.1) Associativity: For any m , , m , , m3 E M (m,m2)m, = ml(mpm3)
I. Preliminaries
4
(3.2)
U ~ i t :There exists an eIenient 1 E ic3 such that lnz for all m
E
=
nz
=
ml
M.
It is easy to see that the unit element 1 is unique. Indeed if 1' is another unit element for M , then 1' = 11' = 1. We shall use the same letter 111 to designate the monoid as well as its underlying set. If M , hi" are monoids, a niorpkisrri T: Ad -+ M ' is a function satisfying the following conditions.
(3.3)
(m,m,)p
=
(m,p)(m27i)
(3.4)
ly
for
all m , , nip E M
1
More precisely the last formula should be written l.,{y~= l.,,, . However, we shall follow the general habit of using the letter 1 to denote the unit element in any monoid, unless this symbol has another meaning in the same context. T h e composition of two morphisms
M L M I L 111'1 is again a morphism
M%
MI1
Given two subsets S,E.' of a tnonoid M , the set 'Yl' is defined by
x I'
= {xy
It is easy to see that this definition converts the set !Tiof all subsets of M into a monoid. T h e unit element in A'?? is the set 1 consisting of the unit element of M alone (in general wc shall not distinguish between an element and the subset consisting of this element alone). A subset T of a monoid Ad is called a szibmonoid if
where 7'" = T T . I t is important to observc that we require the submonoid T to contain the unit element of M . For example, the set of all non-empty subsets of M is a submonoid of A?!.
3. Monoids
5
For any subset -4 of a monoid
A"
=
IM, the set
1 u A v .42 u . . . v A'' v
where A"+l A " J , is a submonoid of IM and is the least submonoid of M containing '4. :
We shall now list a number of monoids that we shall encounter most frequently. For any set S,the set of all relations f : .Y + S with the composition of relations as defined in Section 2 is a monoid R X . T h e unit element of this monoid is the identity function 1, : S -+ S.Partial functions and functions form submonoids PF-Y and F S of R X . Further submonoids of FLYare obtained by considering injections, surjections, and bijections. is finite, T h e submonoid of all bijections of ,Y is a group. Usually if this group is called the permutation group of X. Given any set V, the free nzonoid V" with base V is defined as follows. T h e elements of 1"are n-tuples
of elements of 1.T h e integer n is called the length of s and is denoted by I s 1 . If t = ( T I , . . . , T , , ~ )is another element of I",the product st is defined by concatenation, i.e.,
This clearly produces a monoid with 1 = ( ) (the only 0-tuple) as unit element. Clearly I st 1 = I s I I t I and I 1 I = 0. We shall agree to write CT instead of the 1-tuple ( 0 ) . In this way ( 3 . 5 ) may be written as s = cr, . . . g,,
+
if n .\0. Because of this, the element s is called a zuord of length TG, while cr E .Y is called a letter, and V itself is called an alplmbet. T h e convention CT = ( 0 ) permits 11s to trcat S as a subset of I". This justifies the notation L*, as indced L* is the only submonoid of S* containing S. T h e basic property of the free monoicl I*is that any function .? M, where M is a monoid, admits a unique extension to a morphism --f
I"+ M . Let s E I".An element t
E
I"is a sepnent of s if s
=
zctv for some
I. Preliminaries
6
u, v E P. If u = 1, then t is an initial segment; if v = 1, then t is a terminal segment. Observe that t = 1 or t = s are not excluded. I'" be a morphism of free monoids with bases C and I', Let f : ,Z* respectively. Such a niorphism is completely determined by the elements af E P for a E I.If of E 1 u I' for all a E 2, then f is called a fine morphism; a fine morphism then maps letters of C into letters of f or into 1. If of E I' for all (T E Z, then f is said to be very Jine. Occasionally we shall also consider semigroups. A semigroup differs from a monoid only by the omission of axiom (3.2). Thus every monoid is a semigroup but not vice versa. T he notion of a morphism of semigroup is defined as for monoids but (3.4) is omitted. If A is a subset of a semigroup S , then --f
A + = A u A ' u . . . uA'&u . . . is the least subsemigroup of S containing A. I n particular
i.e., L'+ consists of all words of strictly positive length.
Show that $ A is any subset of L'" such that A" = Z", then Z c A. Thus Z is the smallest subset of C" generating Z*, Show that the covresponding statement for free groups is false. EXERCISE 3.1.
EXERCISE 3.2. Let s = u,v, = u,v, be two factorizations of s E 2". Show that there exists a unique factorization s = x y z such that either u1 = x , v1 = y z , u2 = x y , v2 = z or u1 = x y , vl = z , uo = x , vp = y z . 4. Categories
Although this book will not use category theory as a systematic mathematical tool, many of the notions that we shall consider lead to categories and it will be convenient and useful to identify them as such and use an appropriate terminology. Thus even though category theory will not be used, the language of category theory will be adopted whenever applicable. We therefore give here the relevant definitions. A category A consists of the following data.
(4.1)
Objects: a class Obj A, the elements of which are called objects of A .
7
4. Categories
(4.2) Morphisms: a function which to every ordered pair ( A , B ) of objects of A assigns a set A ( A , B ) ; the elements f E A ( A , B ) are called nzorpkisnis from A to B. We frequently write f : A -+ B or A B instead off E A ( A , B ) . (4.3) Conzposition: an operation of composition which to each consecutive pair of morphisms
. 4 -/ B L C assigns a morphism fg: A - C
These primitive terms are subject to the following axioms.
(4.4) Associativity : Given morphisms /
A-BLC-D
h
we have
( fgV
= f ( g h)
(4.5) Identity: For each object A , there exists a morphism 1,1: iz + A such that l Afl = f for every morphism f : A for every morphism g: C 4 A .
+
B and glAL =g
,
We note that 1 is unique. Indeed, if 1:4: A + A were another such identity, then 1 = 1.,11, = 114 . A subcategory A' of a category A is a category such that
,
(4.6) Obj A' is a subclass of Obj A . (4.7) For iZ, B in A', the set A ' ( A , B ) is a subset of A ( A , B ) .
(4.8) T h e composition of morphisms in A', is that of A. (4.9) For A in A', 1 , is in A'(A, '4). -4 subcategory A' of A is said to be a fulI subcategory if A'('4, B ) A ( A , B ) for A , B in A'. Thus, a full subcategory is obtained by restricting the class of objects. An example of a category is the category R of relations. T h e objects are sets and the morphisms in R(X, 1') are all the relations f : X Y, with composition being composition of relations. Partial functions yield =
--f
I. Preliminaries
8
a subcategory P of R, the functions yield a subcategory F of P. These are not full subcategories. Another example of a category is the category Sgp of semigroups. T h e objects are semigroups and the morphisms are as defined in Section 3 . Monoids form a subcategory Mon of Sgp. This is not a full subcategory since for a morphism Q': M + M ' of monoids we require 1p = 1, while a morphism of semigroups need not have this property. T h e category of groups is a full subcategory Gp of Mon. This results from the observation that if cp: M 4 M ' is a morphism of monoids, and M and M ' are groups, then cp automatically satisfies m-lp = ( m p ) - l and thus p also is a morphism of groups. All these are examples of large categories in which the objects form a class which is not a set (in the sense of Bernays-Godel-von Neumann set theory). Categories in which the objects form a set are called small. I n the sequel we shall encounter mostly small categories. There is a close connection between categories and monoids. Indeed, let A be a category with a single object A . Then all the morphisms of A are of the form p: A 4A and A(A, A ) is a monoid which may be identified with the category A . T h u s a category appears as a generalization of the notion of a monoid. A morphism f: A + B in a category A is called an isomorphism if there exists a morphism g : B -+ A such that both compositions f A-B -A
0
and
U B-A -B
f
are identity morphisms. The morphism g is easily seen to be unique and is usually denoted by f-'. EXERCISE 4.1. Let f: A + B and g : B C Be isomorphisms (in a category A ) . Show that fg: A -,C is an isomorphism and that ( f g ) - ' = g-tf-1. 4
5. Equivalences and Congruences
A relation Y : X + X is called an equivalence relation if it satisfies the following conditions
l s c r ,
-
Y - ~ C Y ,
wcr
-
Instead of writing x p E x , r we write x1 -r x2 (or x1 x p mod r , or just x2 if no confusion is caused). Conditions above then take the more
x,
5. Equivalences and Congruences
9
familiar form .z'
x1 - x 2
x
implies
and
x, - x ,
-
x2
-
x,
imply
x., -xg
x, -x3
I t follows from these conditions that for any two elements x,, x2 of X the subsets s , r and s , r are either equal or disjoint. These are the equivalence classes of S mod r . T h e set of all these equivalence classes is denoted by X / r and is called the quotient of X mod r . T h e function n: X 4 X / Y which sends x into xr is called the natural factorization mapping. It should be observed that any covering of S b y disjoint and non-empty sets determines a unique equivalence relation in S for which the given sets are exactly the equivalence classes. Let f : X I' be a function. T h e non-empty subsets of 2Yof the form yj-1 determine an equivalence relation in S called the kernel o f f (notation: Kerf). T h u s x, x2 mod K e r f holds iff x,f == x 2 f . T h e function f then admits a unique factorization --f
-
x -L s / K e r f L
Y
where g is a function. Further the function g is injective. T h e function f itself is injective iff Iier f is the identity relation l.y in which case Xjls = Let r be an equivalence relation in a monoid M . \Ye say that 1' is a congruence in III if ( m l r ) ( m 2 r )c (m,7n2)r
x.
for all m l , m.,E M . An equivalent formulation is m,
-
nil'
and
-
m.,
m,'
imply
m,m,
-
Still another equivalent forniulation is
m,
- m2
implies
mnil
-
mm.2 and
m,m
m,'m2'
-
mzni
T h e fact that the product (m,r)(m.,r) of two equivalence classes is containcd in a single equivalence class ( ~ 1 ~ n ican ~ ) rbe used to define a multiplication in X j r . With this multiplication the quotient set X / Y becomes a monoid and x : S X / r is a morphisni of monoids.
I. Preliminaries
10
I f f : il/r + h1‘ is a morphism of monoids, then K e r f is a congruence in M and in the factorization
M
L M / I i e r f 5 M’
g is a n injective morphism. Observe that if Ad is a group, then a congruence Y in M is completely determined by thc equivalence class Ir containing the unit element of M . ‘I’his subset IY is then an invariant subgroup I I of A4 and each invariant subgroup gives rise to a congruence. ‘I’he quotient inonoid Af/r then coincides with the quotient group M / l l in the usual sense of group theory. 6. Miscellaneous Conventions
‘I’he Cartesian product ,Y., 1’ of two sets \ d l as usual dcnote t h e set made u p of all pairs (x, y ) with .Y E *\, 41 E l r ;similarly for the Cartesian product Sx/YxZ. Further we shall regard t h e sets (SU
Y)xZ,
aY .: (Y.42)
as identical. ‘I’his involves an identification of the elements
I n general, \vc do not hesitate to identify two sets whcnc\er an unanibiguous 1-1 correspondence bct\veen them has been established, provided such an identification is safe. ‘I’he \torcI “safe” is not given any precise meaning and thus may be taken quite subjectively. In the same spirit we shall identify -Y . with I’ whenever card -Y = 1, i.e., *Y has a single element. We shall systcmatically confuse an eleincnt ,x of a set S with the subset [x} of S consisting of .v alone. A much more subtle question is the disjointness of sets. W e regard the operation of intersection of sets as an algebraic operation defined on t h e set .t of all subsets of a set S.‘I’hus given two sets ’4 and B , the qucstion whether .4 and B are disjoint, i.c., whether ‘-1 n B = g , can be asked only after a set S has been exhibited of which both A and B are subsets. Indirectly this also denies the formation of t h e union .4 u R (unless A and R are given as subsets of sonic set S). Given two sets ’4 and I], we do assume that a set il u B, called the disjoint iinioir of 13 and B (or the coprodiirt of A and B ) , may be formed in
References
11
which .J and B appear as disjoint subsets. In the process of forming this A u B, elements of rl and B may have to be renamed to avoid artificial coalescense. These conventions may sound unorthodox but are actually in common use. For instance, in group theory the unit clement of any group is denoted by 1, but this does not mean that any two groups intersect. I n the rare event when the disjoint union of two groups G a n d H has to be formed, the unit elcments (and possibly other elements) will be renamed, to avoid confusion. T h e above conventions do not (as yet) fit into any of the established frameworks of foundations of mathematics, but they are very convenient and “safe.” References
Our usc of catcgories w i l l be very superficial. We have not even introduced the notions of functor, natural transformation, adjointness, or product. ‘1’0 the reader familiar with category theory, it will become clear while reading the text that a more substantial use of categorical terminology and techniques could have been made. T o the readers wishing to familiarize thcniselves with category theory we recommend the following tests: H. Herrlich a n d G. 1.; Strecker, “Category Theory,” Allyn and Uecon, Boston, 1973. S. h l a c l m i e , “Categories for the Working Mathematician,” Springer-Verlag, Berlin and New York, 1971. 13. I’areigis, “Categories and Functors,” Xcademic Press, New I’ork, 1970. €3. Mitchell, “Theory of Categories,” Academic Press, New I’ork, 1965.
CHAPTER
11 Automata and Recognizable Sets
This chapter introduces the notions of an automaton and of a set recognized by an automaton. l ' h e sets in question are subsets of a free monoid S* where S is a finite alphabet. T h u s we shall be dealing with sets of words in a finite alphabet. 'I'he approach is finitistic and explicit and all the arguments are effective and constructible. T o some extent this will be compensated for in Chapter 111 where the approach will be somewhat more algebraic. 1. Basic Definitions
Let S be a finite alphabet. An automaton' A over 2 (or a Z-automaton) consists of the following four data:
States:
a finite set Q of elements called states.
Initial states: a subset I of Q ; the states in I are called initial. Ternzinal states: a subset T of Q ; the states in I' are called terminal. Edges: a subset E of Q X S X0. A triple ( p , u, q ) in E is called an edge of the automaton. T h e edge ( p , u, q ) begins at p , ends at q, and carries the label u. We frequently use the notation u: p + q or p 5 q to indicate the edge. Except for the finiteness of Q, the above data arc subject to no restrictions whatsoever. 12
1. Basic Definitions
13
I n pictorial representations of automata, states will be indicated by small circles, by letters, or by numbers, depending upon the convenience of the moment. T h e initial states will be marked by a small arrow pointing toward the state. T h e terminal states will be equipped with a short arrow pointing aL\ay froin the state. States that are both initial and terminal will be equipped with a double-headed arrow. An edge ( p , (T, q ) will be indicated by an arrow pointing froin p to q with label (T. If there are several such edges with the same p and q, the several arrows may be replaced by a single arrou carrying several labels. An example is given to illustrate all these possibilities. +
0
01
:./,I.
-0-0
0
~ ? . ~ J
01
,;I: t+
m1,tra
0-
0
There are six states of which two are initial and two are terminal; one state is both initial and terminal. There are nine edges, but only seven are traced since two of them carry double labels. A p a t h c in &' is a finite sequence c =
(90
7
GI
, YI)(Ql
7
c, 9 q 2 ) . ' . ( Q r - 1 9
Ok
9
Qk)
of consecutive edges. T h e integer k ' . 0 is called the length of the path, q,, is called its beginning, and qr is its end. An abbreviated notation for a path is C -
We shall also write or or
I he element s = o,,.. ( T ~E L* is called the label of c and is denoted I c 1. Since 1s I is used to denote the length of s, we have k = I s 1 = jl c 11. 'Thus I/ c 11 is the length of c. For each state q ~ \ introduce e also the null path or the trivial puth I,] beginning at q and ending at q. By definition the null path has the label 1. 0. T h u s I 1,{I = 1 and 1) I,, 1 r ,
by
II. Automata and Recognizable Sets
14
A path c: i + t with i E I , t E T is called successfill. T h e labels carried by the successful paths in d form a subset I d I of Z*called the beAavior of d. A useful device is the composition of paths. Given paths d: q - r
c:p+q, the path cd:
p +r
is defined by concatenation. We have
I d =
I C I
Id1
and
IIcdII
= IIcIlf
IIdll
If we regard the states as objects and the paths as morphisms, we arc in the presence of a very simple example of a category (see 1,4). We shall frequently use the notation d’ = (Q, I , T ) for an automaton; the set E of edges is left out of the notation. With each automaton d = (Q, I , T ) a matrix E, called the transition matrix of d, may be associated as follows: T h e matrix E is a square matrix with both rows and columns indexed by Q. T h e entries are subsets of 2. Explicitly
Epp= {c I a: p
+q
is an edge in d}
Obviously, knowing the matrix E, the edges of d may be reconstructed. Later in this work we shall frequently use the transition matrix, particularly in situations which will permit us to algebraicize arguments of a counting and combinatorial nature. I n fact, the pictorial representation of automata described above uses the transition matrix; the elements of E,, appear as labels of the arrow the arrow is omitted. pointing from p to q. If E,, = A subset A of Z” is said to be recognizable if there exists a Z-automaton &’ such that I &’ I = A . When we say that a recognizable subset A of L’* is given, we shall understand that a 2-automaton d’such that 1 d’ I = A is effectively supplied. If a set A is supplied by other means, then to prove that it is recognizable will require the construction of &’ with 1 &’ 1 = A. Since we are concerned here with effective mathematics, we shall require that the construction of d be effective from the data describing A. We leave the word “effective” undefined as a mathematical notion. T h e class of recognizable subsets of 2” is denoted by KecZ. This is one of the important classes of subsets of 2’” that we shall study.
a,
2. Examples
15
2. Examples EXAMPLE 2.1.
T h e empty automaton &', without any states. Clearly
\g.
I,W'(=
..
EXAMPLE 2.2. Let s = al. a1
E
D.Consider the automaton on
02
-+O+O-...- 0-
+
with n 1 states. There is only one successful path and its label is s. Th u s I JP' I = S. If n = 0, the automaton has only one state and no edges. T h e trivial path is the only path and it is successful. Thus I &' 1 = 1 in this case. EXAMPLE 2.3. Let A c 2. Consider the automaton
with a single state which is both initial and terminal, and one edge for each 0 E A . All paths are successful. T h u s 1 ,31 = A". EXAMPLE 2.4. Let 2 = {a, T } . Consider o,r
EiA t3 q
2
o,r
Every successful path admits a decomposition r
c o i+i+q-t-+
d
t
Since 1 c I and 1 d I can be arbitrary elements of L'*= {a, T } " we have I 1 = ,r+,TZ". EXAMPLE 2.5. Let Z = {u,T}. Consider a
7
0,I
ou,--)*o q-t'
-2-
Every successful path admits a decomposition e
o
d
i-i-q-q-tLt with 1 c
1
E T*,
1d1
E ax,
1e1
E
Z*.
r
II. Automata and Recognizable Sets
16
I = t*ao*t2*. This set may also be rewritten as z * a * a t P . Thus I This set coincides with the set of Example 2.4; indeed both sets consist of all words in z’* which contain OT as a segment. EXAMPLE 2.6.
Let L‘= {a,T } . Consider r
a
T h e behavior is the set
A
= (T
u o+T’)*
u T*O+ u T*LT+T
and consists of all words s E {a, T}” which do not contain ment. EXAMPLE 2.7.
(TTU
as a seg-
Let S = {a, T ) . Consider
o(-+03T T h e behavior is the set a* EXAMPLE 2.8.
u a%*
=
a*t*.
Let S = {a, T } . T h e set
A
I >_ 0}
= { ( T ” T ~ TZ
is not recognizable. Indeed let A? be an automaton such that A = 1 &’ 1. For each n 2 0 we then have a successful path
.
tn
dn
en --*
qn
--*
tn
such that I c, I = a n , I d , I = T,. We claim that the states q,! must be distinct. Indeed if q,t = qm with m # 12, then
is a successful path with I c,,d,,, 1 niteness of the set of states of LP’.
=
a”t”L 4 A. This contradicts the fi-
3. Operations on Automata EXERCISE 2.1.
17
Show that any automaton recognizing the set {dk” 1 0
must contain at least 2N actly 2N 1 states.
+
5n 5N}
+ 1 states. Construct such an automaton with ex-
3. Operations on Automata
When we consider two automata and A it will be silently assumed that their sets of states Q,, and 0, do not overlap. This can always be achieved by relabeling the states in one of them. We shall now pass in review a number of basic operations on automata and analyze their behaviors.
Union: Given Z-automata d , .2,define the Z-automaton
8=dU 9 as the (disjoint) union of d and 3’.Thus Q(; = QA,u Q B , iff it is either in d Ic = I-4 u In, T c f= T., u T u . An edge is in or in .d.It follows readily that every path in ‘8 is either a path in &‘ or in .3. This yields
~ d u . a ~ = / d ~ u ~ L 2 ? ~ . Product: Given 2-automata d, .2? , define the Zautomaton L d X
I&=
29
by setting
Q~~= Q . x~ Q ~ ~ rc, = r, x I ~ , T~ = T . x~ T ~ . An edge
(f, P o ) 2 (9’9 9”) is in %‘ iff p’ A q’ is an edge in &‘ and at the same time p” q” is an edge in 25‘.I t is clear how each path c: (p’, p”) + (q’, q”) in 6 may be viewed as a pair c = (c’, c”) of paths cr: c”:
p’ P”
-
4
q1
in
,3
9“
in
8
II. Automata and Recognizable Sets
18
such that I c I I c' 1 = I c" c' and c" are. Therefore 7-
I.
Further, c is a successful path iff both
Given a 1-automaton %.d:(0, I , T ) , the reversed au-
Reorrsul: tomaton is
dQ = (Q, 7', I ) with an edge p A q for each edge q 1 , p in d. T h u s a path c in -3 with I c I = a].. .akyields a path CQ in with Q'&
where p : 1"
--f
1" is the reversalfunction defined by 1g
=
1,
ag = 0,
(st)g = (tp)(sp)
'l'hesc three constructions yield : PROPOSITION 3.1. tersection, arid reeiersal
The class Kec 1 is closed under finite
iinioii,
in-
!
T h e reader will notice that the operation of complementation was not mentioned. l'he fact is that the class Kec 1: is closed under complementation (this will be shown in I I1,2). However, the appropriate construction is more involved. Next we give some constructions on automata, related to a morphism
where 1' and 1 are two alphabets. Iiizwse inznge: Assume that the morphism f is fine (i.e., that c 1 u 1). Let Ld (Q, I , I') bc a 2-automaton. We define a rautomaton Ldf-'with Q, I , T unchanged and with edges of the following two types
ly
P-1-s
3. Operations on A u t o m a t a
if yf
=
(T
and
19
p A q is an edge in -d, and Y
9-q
1.
ifyf=
A path c': p q in -df may easily be seen to be completely givcn by a pair (c, g ) where c : p + q is a path in ,d and g E f" is such that I c' I = g , gf = 1 c I. It follows that
I d f - '1
=
I ,d
I.f-1
PROPOSITION 3.2. If f : 1'" 1"is a fine morphism and A c 2" is vecognizable, then so is Af-I c P I --f
Direct image: Assume that the morphism f statisfies yf f 1 for all I' (or equivalently that If = 1 o r still equivalently that I g 1 5 I g f I for all g E P). Given a r-automaton &' = (Q, I, T ) we define a Lautomaton ,d' = (Q', I , T ) with 0 c Q' as follows. Let
y E
be an edge in ,d and let yf we have the edge
= o 1 . . .crJL (n
2 1). If n
=
1, then in d r
WI
P+9 If
12
1, then in ,d'we have edges
> '
where the intermediate n - 1 states are new distinct states adjoined to Q. W e repeat this for every edge in d'.W e thus obtain AY". I t is then manifest that ~ G d ' ~ : f ~ ~ d ~ PROPOSITION 3.3.
If A
c
Let f:1'"
~
+ S"
be a morphism such that 1 = If-'.
r" is recognizable, then so is Af c S" I
The shufle product: Given subsets A c X", B c 1'" with L n r ;d,the shufle product A LL B c (S u 1')" consists of all words of the form slg,. . .Srlg,!E (Lu 1')" =
II. Automata and Recognizable Sets
20
A more algebraic description is obtained as follows. Let
be the morphism given by
Now assume that A and B are recognizable and let d and 8' be automata such that I ,d 1 = A , IM'I = B. W e define the automaton
'6 =d = (Q.1
Lu
9
x QD
9
IAX I I I T.Ix Tn) 9
T h e edges of '8 are
(P,P') 2 for each edge a: p
+q
P')
in d , and
(P,PO 2 ( P , q ' ) for each edge y :
p'
4
q' in 9. I t is clear from the construction that
1 gI = 1 d 1
w 1 9I
PROPOSITION 3.4. If X and I' are disjoint alphabets, A is a recognizable subset of 2 7 , and B is a recognizable subset of P,then A LU B is a recognizable subset of (C u r)" I
There is a variant of the shuffle product A u B (called the internal sJ2ufle product) defined for subsets A and B of the same free monoid 2". T o describe it, consider a copy 2' of L' disjoint with 2 and let B' be the subset of 2'" corresponding to B under the isomorphism S* 5 2"". Consider the morphism
v : (2 u S')* + X",
av = d v
=G
4. Accessibility
21
Then
Since l r l
=
1, Propositions 3.3 and 3.4 imply:
PROPOSITION 3.5. If A and B are recognizable subsets .f S*, then soisAuB I
Let &' Define a new automaton EXERCISE 3.1.
=
(Q, I , T ) be a S-automaton and let a
E
2.
d' = (Q u t', I, t ' ) where t' is a new state with new edges t +"t for each t
E
I
T. Show that
1 d '1 = 1 ,d 1 CT Thus if A is recognizable, so is Aa. EXERCISE 3.2. Show that the internal shufle product converts the set of all subsets of I*into a commutative monoid with a zero, and that the recognizable subsets form a submonoid. EXERCISE 3.3. Describe the internal shufle product A u B directly (using essentially the same description as f o r A LU B ) . Define d u '8f o r Zautomata d and -8 and prove that I d u 9 I = 1 d'I u 155'I . 4. Accessibility
Let &' = (0,I , T ) be a L-automaton. For any subset X of Q and any s E S" we define a subset Xs of Q, by the following properties:
(4.1) S ( s t ) = ( X s ) t , (4.2) zYl
=
X,
(4.3) (XI u S , ) S (4.4) qa
=
= XIS
{ p I cr: q - p
u SzS,
@s
=
0,
is an edge in d } .
22
II. Automata and Recognizable Sets
That these formulas define X s in a unique tnanner is clear. Indeed
(4.1) and (4.2) show that it suffices to define X a for G E L'. Then (4.3) shows that it suffices to define 40. This is done in (4.4). From (4.1)-(4.4) we derive (4.5) 'Ys
z
{ q I there exists a path c : p
q with p
-+
E
X and I c I
=
s}.
For any subset A of L'* we may define
XA
(JXS
=
st.1
and verify the obvious analogs of (4.1)-(4.3). From (4.5) follows
(4.6) I
&'
1
= {s
I Is n 'I' f 8)
For any s E L'*, the set Is can be effectively calculated (essentially in I s 1 steps). T h u s we can decide whether Is n 'I' f (3 and thus decide whether s E I 1. 'The automaton a' is said to be nccessible if for every state q there exists a path c : i + q with i E I . I t is easy to see that A?' is accessible if€
IS*
=
0 h
From formula (4.6) it is clear that the behavior of &' remains unchanged if the inaccessible states, i.e., the states in Q IL'* are removed. By doing so we obtain an accessible automaton ~
= I F , T;l = 7' n p, such that I &' I &:I' I. We shall call the accessible part of A?. T o find @ effectively in a finite number of steps the following formal procedure is recommended. Define the sequence of subsets Qo, Q, ,. . . , Q,?,. . . of Q by induction as follows.
with
=I
QO
If
Qk
f
=I,
0 and
Qi+I =
Qk+l =
QLZ
0, then
- (Qi
Qk+, =
u QL-I
U. . . u
for all
p >1
80)
and
~=Q,,u...uQ~
If n
=
card Q, then since the sets Qi arc disjoint we must have Qn =
0.
23
4. Accessibility
Thus k n, and we have an a priori bound on the length of the proced u re. There is a set of notions dual to the above. These are best obtained by applying the definitions above to the reversed automaton d~ as defined in Section 3. For A c 9and A' c 0 the set X A in JY'Q will be denoted by -Y24 Thus we have
-YA
=
- + p with p
{ q 1 there exists a path c: q
E
.Y and I c I
E
A}
We let the rrader record the analogs of (4.1)-(4.4) for this new operation. We further have
T h e automaton &' is said to be coaccessible if deis accessible, i.e.,
if
T;"
-0
I -
Removing all the states in Q ~- TL" yields a s before a coaccessible automaton d bwith 1 d "I = 1 w ,' 1 . T h e automaton d is said to be trim if it is both accessible and coaccessible. T h e proof of the following proposition is left to the reader:
For any automaton d the following properties
PROPOSITION 4.1.
are egiiizialent : (i)
d is trim.
(ii) Every state is a vertex in some successjid path, (iii) Every path in d is a segment of some successful path. [Hint:
Prozw the implications (i) * (iii) 3 (ii) * (i).]
It is clear that for any automaton d ' a trim automaton d tis obtained by removing all states for which (ii) fails. Further the resulting trim automaton satisfies I ,Cy" I = 1 cd1. T h e reader will also notice that d t may be obtained by first passing from d to its accessible part and thcn taking the coaccessible part of T h e two steps may be reversed, i.e., one can first pass to the coaccessible part &'I' of d and then take T h u s in formulas we have the accessible part of d
'
j
.
(d")" =d t
Y
(,d'1)h.
II. Automata and Recognizable Sets
24
T h e notion of a trim automaton provides a simple proccdurc for deciding whethcr 1 1 == @. Indeed if this is the case, then the trim automaton d tassociated with ,iy' must be cmpty (i.e., Q = 0) and vice versa. EXERCISE 4.1. Let ,d = (0,I , 7') be a coarcessil,le O-automaton. Show that the behavior .f the nutonraton (0,I , Q ) is the set of all initial segments of the elements of the set I -d 1. Dually show that i f ,d is accessible, then the behavior of ( Q , 0, 7')is the set of all terminnl segnierits of the elements of 1 ,d I. Conrlude from the above that f o r any rerognizable subset A of S*, the sets I n A , 'rcr A , Seg 14 of all initial segments, terminal segments, and segments of elements of A , are rerogniznhle. 5. Finiteness and Iteration
Given a 2-automaton &' = (Q, I , T ) , we shall now test the set A = 1 d I for finiteness. Without loss of generality we may assume that M is trim. Let n = card Q. We assert that A is finite 18d has no closed paths of length .,-0. Indeed, assume C
4-4
is a closed path with 1 c path
1
=s f
1. By assumption there is a successful
. d
c
z - q 4 t Let
I d I = u, 1 e 1
=
v. Then us*zj c
A
so that A is infinite.
Conversely, assume A is infinite. T h e n A contains a word s with
1 s 1 2 n. T h e successful path c in d such that I c 1 = s will then involve a repeated state and thus cdwill have a closed path. A refinement of the argument above leads to the following very useful
PROPOSITION 5.1. If A is a recognizable subset of P, there exists an integer n such that i f s E A and 1 s I 2 n , then s admits a factorization uwv with w # 1 such that uw*v c A
5. Finiteness and Iteration
25
Furthermore, w can be chosen as u subsegment of n. I n particular, I zu I 5 n.
m7-y
segment of s of length
Proof. 1,ct -4 = 1 Ld1 where d is a Y-automaton with n states. s and let c' be a segment of c of L e t c be a successful path with I c 1 length exactly n. Since c' must contain a repeated vertex, there results a factorization of c ~
11
iLp-p-t
b
with d a subsegment of c' and with 1 d I f 1. Setting u I b 1, and zu = 1 d 1, it follows that uw*v c A I
=
I a I,
2' =
COROLLARY 5.2, If A is an infinite recognizable subset of S", then c A f o r some 14, w,z1 E 2*,with w 7 1 I
UW*F
T h e corollary just stated permits us to show that various sets are not recognizable. EXAMPLE 5.1.
Let
X=
( 0 , T}.
l ' h e set
is not rccognizable. Indeed, were .-1 to be recognizable, it would have to contain I I W * Z ~for some u , zu, 21 E I*, w z 1. Clearly w cannot contain T as a letter since all words of A have only a single T . T h u s zu - 0" for some n 0. Either u o r v (but not both!) must contain T . T h u s assume 71 = ap, ZJ = CT~TU".'I'hen
'I'o be in .-1 we must have p 4-kn + Y = s for all k z 0. T h i s is impossible since n -t 0. Similarly the possibility u = U'TC', ZJ = 01' is excluded. EXAMPLE 5.2.
Let .Y
= ( 0 , T}.
'l'he set
*4 = {.W' I p 1O} is not recognizable. ?'he argument is very similar to the above and is left to t h e reader. Note that this example duplicates Example 2.8.
II. Automata and Recognizable Sets
26
EXAMPLE 5.3.
Let E =
(0,T } .
A
= (
T h e set 0
I p ~5 q }
is not recognizable. Indeed if A is recognizable, then so is the set
B
= {gW
I 5p}
obtained from A by reversal and interchanging the roles of c and z. Therefore A n B is recognizable. However, A n B is the set of Example 5.2. EXAMPLE 5.4. Let E = (0,T } . For every word s E E" let I s lo denote the number of 0's in s. Similarly let I s IT = I s I - I s I n . T h e set C=
($1
Islo=
ISl?)
is not recognizable. Indeed, intersecting C with the recognizable set O*T* (Example 2.7) we obtain the set A of Example 5.2. Similarly the set defined by the condition I s ,I 5 I s Ir is not recognizable.
1 , d = ( Q , I , T ) , and n = card Q. EXERCISE 5.1. Let A = I Show that A is finite iff I s I < n for all S E A. Show that A is infinite z f f n 5 I s I i 211 f o r some s E A . EXERCISE 5.2. Let JV' = ( Q , I , T ) be a E-automaton such that = ( E p ) * where p 2 0 is an integer. Show that card Q 2 p .
I ,d I
EXERCISE 5.3. Rework Examples 5.1, 5 . 3 , and 5.4 by the method of Example 2.8. 6. Local Sets
Let d = (0,I , T ) be a 2'-automaton and let Q set of edges in JV'. We define the set
#dc Q* called the graph of the automaton d as follows:
#d= AQ* n f.*B - Q"CQ"
=
{ ( p , 0,q ) } be the
6. Local
27
Sets
where the sets
A c Q,
B c Q,
C c Qe
are defined as
We also consider the very fine morphism
f: sz*
+
z*,
(p, G, q ) f
=G
Let c E #-d. From (6.3) we deduce that c is a path in .-d. From (6.1) and (6.2) we deduce that c is a successful path in &' and that 1 c 1 # 1. Further cf = 1 c 1 . Conversely, every non-trivial successful path c in Ld is an element of #d. This implies
#df=1&'1nS+
(6.4) and if I n T
=
0, then #-df= I -d 1
Subsets L of Z* of the form (6.5 1
L
=
AZ* n Z"B
- S"CZ"
with (6.6)
A , B c 1,
C c Z2
will be called local sets. T h e term "local" derives from the observation that local scanning of the word s E Z* suffices to determine whether or not s E L. is an example of a local subset T h e graph #&' of an automaton of a". Thus the fact established above yields: THEOREM 6.1. Let S be a finite alphabet and A a recognizable subset of S+. There exists then a finite alphabet Q, a very fine morphism f: sZ* + Yr", and a local subset B of Q* such that Bf = A I
Local sets play a considerable role in the subsequent development. We shall therefore establish some of their properties here.
II. Automata and Recognizable Sets
28 PROPOSITION 6.2.
The intersection of two local subsets of 2" is a
local set.
Observe that the union of two local sets need not be local ; for instance, aJ" n P a , and a 2 P n P a , are local sets while their union is not if a1 f (T, , al, a2 E 2. PROPOSITION 6.3. If f: 1'" +.P is a very fine morphism and L is a local subset of S", then L f - I is a local subset of rx. Proof. If L is defined by the sets A , B , C as in (6.5) and (6.6), then L f -l is defined by Af-', B f - I , and Cf - l I
Note that the conclusion of the proposition fails i f f is only assumed to be fine. Indeed let Z = {a}, r = { t ,y } , t f = a,yf = 1. T h e subset a of .P is then local (take A = B = a,C = a2).Howcver, of-' = y * t y " is not local. Indeed, assume y%y" is local and is given by A , B c r, C c T".Since t , y t y and y 2 t y 2 are in y % y X it follows that A = B = 1', and that y ~ , t yand y 2 are not in C. T h u s C = @ or C = t2.This gives a contradiction since y%yM f rfand y%y* f r+- r"t2r". PROPOSITION 6.4. Let Z c T.If L is a local subset of Z*, then L is also a local subset of l'" Proof. Let L be given by the subsets A , B c 2, C c Z2. T h e n L as a subset of rx is given by the sets A , B, C' where C' = C u (r2 - 2 2 )
r 2
I
PROPOSITION 6.5.
Every local set is yecognixable.
Let L be a local subset of 2" given by (6.5) and (6.6). Consider the S-automaton ,d= (2 u 1, 1, B ) Proof.
with edges t 4 , a
if
1 L a
if
ta$C U E A
29
References
If s = 01. . .@,> E L , then c1 E A , o,?E B, u i o i t l4 C for all 1 5 i < n. This means exactly that
is a successful path in A ? ' with label s. T h u s 1 JY'
1
=
L
I
EXERCISE 6.1. Let &' = (Q, I , T )be a S-automaton with I n T = 0, let #d be its graph, and let d'be the automaton constructed in the proof of Proposition 6.5 for L = #d.Show that if d i s accessible, then so is G d Show t . that if ,d is trim, so is d t . EXERCISE 6.2. Prove the conclusion of Proposition 6.3 under the assumption that f: r" 4Z" is a morphism such that 1 = If - l . References
See the References list at the end of Chapter 111.
111
CHAPTER
Deterministic Automata
‘The notions of a deterministic and of a complete automaton bring the subject of automata closer to abstract algebra. T h e notion linking the two subjects is that of a “module.” Thus, gradually, algebraic concepts, methods, and techniques are introduced and brought to bear upon the theory of automata.
1. Basic Definitions
A Z-automaton &‘ = (Q, I , T ) is said to be deterministic if it satisfies the following two conditions: (1.1)
Ldhas at most one initial state
(1.2)
For q
E
Q and
CT
E
L‘ there is at most one edge
CT:
y
+
p in d.
‘rhe deterministic automaton &‘is said to be complete if in (1.1) and (1.2) we can replace “at most one” by “exactly one.” T h e adjective “complete” will be used so as to include “deterministic.” Thus we shall say “complete automaton” rather than “complete deterministic automaton.” EXAMPLE 1.1 T h e automaton constructed in the proof of Proposition II,6.5 is deterministic, and is complete iff L = Q*B, i.e., A = 2,
c = a.
30
1. Basic Definitions
31
Following the notation introduced in II,4 we shall write go = p whenever an edge (r: q 4 p exists in &'. If no edge starting at q and carrying the label a exists, then we write pa = We thus obtain a partial function
a.
(1.3)
QXxr-Q
which determines the edges in d. If &'is complete, then (1.3) is a function. Purely algebraically we may extend (1.3) to a partial function
satisfying the following conditions 1)e = 4
(4, 0)0
=
qa
( ( 9 , s ) k t)o
=
(9,
(1.5)
Usually 0 is not named and qs is written instead of ( q , s)B. T h u s the conditions above become (1.6)
ql
=
9,
(QS)t = q(st)
Whenever a partial function (1.3) or equivalently a partial function (1.4) satisfying (1.6) is given, we say that Q is a right X-module with (1.4) or (1.6) as action. If (1.3) is a function or equivalently if (1.4) is a function, then the module is said to be complete. If Q is the set of states of a deterministic automaton d, then qs is the end of the unique path starting at q and having label s, if such a path exists. If not, then qs = (3.In particular,
Id1
=
{s 1 is
E
T}
'l'he distinction between deterministic automata and complete automata is very slight. Given a deterministic automaton &'= ((3, i, T ) , a coniplete automaton & = (p, i', 7') called the completion of d is defined as follows. If JY' is complete, then & = d. If d i s not complete, then either i = 3 or qa = 3 for some pair q E Q, a E 2, or both. We adjoin to Q a new state denoted by T h u s 0. = Q u 0. If i = g , then 'i = 0, otherwise 'i : i. T h e action of X on ,O. is given by
n.
qa
if
qo F v3 in Q
q.a=n
if
q(r=(3 i n Q
q .a
=
.a=o
I l l . Deterministic Automata
32
We use the "dot" to differentiate between the action of 2 on Q and that on Q". The resulting automaton ,dUis complete. Since 0 is not terminal it will not lie on any successful path in ,dC and therefore
1
,dC
I
=
1 ,d I
If ,d is a deterministic automaton, then so are the accessible part ,da, the coaccessible part ,@", and the trim part ,dt of d. If ,d is complete, then dii also is complete, however, LdcO and d tneed not be complete. If &'is accessible, then so is its completion ,dr.
Let A be a complete and accessible automaton. Show is not coaccessible, then the coaccessible part of ,dis not complete. that if Give examples. EXERCISE 1.1.
EXERCISE 1.2. Show that if ,dis a trim deterministic automaton which is not complete, then ,dCis accessible but not coaccessible. EXERCISE 1.3. Show that a recognizable subset '4 of 2" is the behavior of a complete coaccessible automaton $f each word s in C* is an initial segment of some word in A. 2. The Subset Construction
Let ,d= (0,I , T ) be a 2-automaton (not necessarily deterministic). In I I , 4 we defined for X c 0, s E C"
Xs
=
{q I there exists a path c: p
3
q with p
E
X and I c I = s}
and we have verified the rules
X1
=
x,
X(s2) = ( X S ) t
Thus, de facto, we have converted the set Q of all subsets of Q into a complete right 2-module. We have also shown [formula 11,(4.6)] that
I ,QI I = {s I Is n T # 0} If we therefore define
2. The Subset Construction
33
and consider the complete Z-automaton
*-d= (Q, I , T ) then
I dl
= {S
I IS
T I = {S
11s
n T f U} = 1 ,d
I
T h e complete automaton .d is said to be obtained from ,dby the subset construction. This construction implies : THEOREM 2.1. Each recognizable strbset of complete E-automaton I
X* is the behavior
of a
As an application we prove: PROPOSITION 2.2. The complement .Y* A of L* is recognizable. Proof.
A
=
-
A of a recognizable subset
Let ,d=(Q, i, 7’) be a complete :-automaton such that Consider the automaton d‘ = (0,i , Q T ) . Then
I ,d 1.
~
We shall use the above to answer the following decision question: PROPOSITION 2.3. Ciuen two recognizable sets A , B in Z*, it is decidable whether B c A . It is important to understand properly the phrase “given two recognizable sets A , B in Z*.” This means that automata L d a n d 2 are given such that 1 ,d I = A , 1 -3’ I = B. ‘l‘he question must then be answered in terms of effective and explicit constructions on ,dand 2.I n view of the subset construction we may assume that d is complete. Using the proof of Proposition 2.2 we construct an automaton d ’such that IA ! ‘ ‘ 1 = L*- A. Now the product construction of I I , 3 yields an aux 3? with behavior tomaton d = d ’
the trimming procedure of II,4we can find out whether Applying to ‘6 or not 1 ’ 8 1 = g. T h u s we can decide whether or not B c A I
Ill. Deterministic Automata
34
I n practice, the subset construction is quite inefficient. Indeed, if the automaton &’= ( Q ,I , T ) has n states, then the automaton d” has 2’b states. Many of these will be inaccessible. A more efficient construction would aim directly at the accessible part d* of d: T h e procedure given in II,4 for the construction of the accessible part of &can also be used to give a direct construction of dAa. This will be illustrated in Section 5. This modified procedure will be called the accessible subset construction. Note that the empty set (3 may or may not be a state of d”*. If it is, then it is not a terminal state. Omitting B as a state, we obtain a deterministic automaton (which is no longer complete) with unchanged behavior. I n practice (as we shall see in Section 7) we shall always use the accessible subset construction with omitted. EXERCISE 2.1. Let &’ and 8 be deterministic 1-automata witlz m and n states, respectively, and with d complete. Show that if
sE
I A I
-
sE
I ,dI
whenever
I s I < mn
EXERCISE 2.2. Let d a n d 3’be (non-deterministic) S-automata with m and n states, respectively. Show that if I
sE
I R I
3
sE
I ,dI
whenever
I s I < 2”n
EXERCISE 2.3. Show that the following question is decidable for given recognizable subsets A , B of .F:
( A - B ) u ( B - A ) is finite 3. The Division Calculus Let M be a monoid. For each a
E
M the function
L,: M + M called left multiplication by a is defined by
bL,
=
ab
3. The Division Calculus
35
Similarly, right multiplication by n
R ~i ~w + : '12 is defined by
bR,
=
ba
If A is a subset of M , we define the relations
I t follows that for any B c M
BL,
=
AB,
BRA,= B A
where
AB
=
{ab I u
E
A, b E B )
We shall also be interested in the inverse relations
L;', Lj', R;', R j ' : A!l
+
M
We have
I s E hi', U S = b } bR,' = {,x 1 x E M , X U b} BLjl = {x I x E M, A x n B f BR,' = {x I x E M , x,4 n B f bL;'
= {X
:
@}
@}
Observe that if M is a group, then BL;' = a-'b and bR;' Because of this we adopt the notation
BL,'
=
k ' B,
BR,'=
=
ba-'.
BA-'
even in the case when M is not a group. Observe that if Ad is a free monoid, then L;' is a partial function; indeed, for any b E J!l there is at most one x E M such that ax = b. T h u s a-'b = bL;' is at most one element. If M is a group, L;' = is a function. In an arbitrary monoid M , the equation ax = b may have any number of solutions and L;' is a relation.
36
Ill. Deterministic Automata
The associativity formula
(AB)C= A(BC) for A , B , C c icI is equivalent with each of the following three identities
Taking inverses we obtain the identities
RzIRjj'
=
Rz'L,'
R&,
=
L-'A B
LA'RE',
-
LA'LS'
which may be rewritten as follows:
(3.1)
(AC-')B-'
=
A (BC)-l
(Ap'B)Cp'
=
A-'(BC-')
(AB)-'C = B-'(A-'C) T h e formalism described above may be extended to modules, and in this form is extremely useful. Let Q be a right 2-module. For each a E L'* we then have the partial function
R,: Q + Q defined by qR,
=
qa. For each q E Q we have the partial function
L,]: I* + Q given by
a L , = qa As before we obtain relations
LAY:2" + Q ,
Q
R AQ ~-
defined for X c Q , A c S* by setting
Thus
AL,
=
XA
=
A7R21
where
XA
=
{qa I q E X , a
E
A)
3. The Division Calculus
37
As before we are interested in the inverse relations. W e denote
X-'Y
=
YLJi?= {a I a
E
{q I q
E
XA-' = XR;'
=
L'", X a n Y f a} Q, qA n S f a)
for X , I' c Q, A c L'". T h e associativity formula ( X B ) C = X ( B C )for X c Q and B, C c L'+ yields RfjRcY == RNp, LsR, RpLs, L s n = LnLs I n the middle formula the R,. on the left is a relation Q + Q while on the right it is a relation Z" 4S". Similarly L,] on the right-hand side of the third formula is a relation L,: Z" + 1". T h e three identities above are best expressed by the commutative diagrams
Q R B \
5 / c
Q
Q
1%
I
A0
Rcl
1"
Lx
A
~JX\
L'+
/x
Q
L'"-Q 1.X
T h e inverses of the three identities above yield the identities
(34
(XC-')R-'
=
X(BC)-'
(X-*r')c
=
*U-'(I-c-')
=
B-l(LY-llr)
(XB)-ll'
for X, Y c Q and B, C c Z*. Observe that with this notation the behavior of a deterministic automaton ,d= (Q, i, 7')is
(3.3)
1dI
=
i-'T
As an application of this formula we prove: PROPOSITION 3.1. If A is a recognizable subset of L'", then f o r any subset B of S" the sets B-lA and AB-I are recognizable.
i, T ) be a deterministic automaton recognizing Proof. Let ,d=(0, A. Then by (3.3) the behavior of the automaton (0, i, TB-I) is i-1(
TB-1)
38
Ill. Deterministic Automata
it follows that AB-' is recognizable. I f s E Z* and q = is E Q, then the behavior of the automaton 4, = (Q, q, T ) is
1 dq1 = q-1T
=
( i s ) - ' T = s-'(i-'T)
= s-'A
Thus
and B-'A is recognizable
I
Given subsets A, B of Z* show that
EXERCISE 3.1. {S
{S
I AS c B } = S* - &'(P - B1 I sA c B } = Z* - (I* B),4-' ~
Verifr the following inclusions
EXERCISE 3.2.
for X , Y c Q, y E Q, A c
C*,a
E
Z*.
4. State-Mappings
Consider deterministic Z-automata
a'=(Q, i, T ) ,
d'= (Q',i ' , T ' ) .
A morphism (or a state-mapping)
M'
$9: .-ti?-+
4. State-Mappings
39
is a partial function
p?:
Q + Q' satisfying,
i'
(4.1)
c ip
From condition (4.2) we derive (4.4)
for all s E Z*
(qp)s c (qs)F
Indeed (4.4) holds for s = 1 trivially, and for s = a by (4.2). Assuming (4.4) for s, we prove it for sa as follows: (QPb
= (P)rPO = ( W ) P
This proves (4.4) by induction with respect to 1 s 1. Conversely (4.4) implies (4.2) by taking s = a. Observe that (4.1), (4.2), and (4.4) may be reformulated as follows
0, then i' = ip. (4.2') If (qcr)a f d,then (qp?)O = (qa)p?. (4.4') If (qp?)s f 3, then (qy)s = (qs)y.
(4.1')
If i'
T h e composition of two state-mappings
dz
d
l
d
l
l
is again a state-mapping
&"": d " This follows directly froin the definitions. If $': d"+ d'" is another state-mapping, then the associativity (Q'Y')?~''= p(p'p?'')is obvious. Also the identity mapping of C, into Q is a state-mapping 1 , J : d4d. T h u s deterministic 5-automata and their state-mappings form a category that we shall denote by A ( 2 ) . T h e state-mapping 7' is said to be proper if the following conditions hold : (4.1~)i #
implies i'
f
(3.
' imply 44" (4.211) qu f @ and qp f 43 ( 4 . 3 ~ ) Tcp c T ' .
z ,7i.
Ill. Deterministic Automata
40
Condition ( 4 . 2 ~implies ) (and is implied by)
(4.413) qs # 0 and qv f 65 imply qys f 3. Note that conditions (4.3) and ( 4 . 3 ~jointly ) assert that
(4.3') T'ypl = T n Dom y. If &'' is complete, then conditions ( 4 . 1 ~and ) ( 4 . 2 ~ [and ) (4.4p)l hold automatically. T h e composition of two proper state-mappings is again proper. Since the identity state-mapping 1,d : d d is proper, it follows that proper state-mappings define a subcategory AD(L') of A(Z'). Another subcategory CA(2) of A(X) is obtained by restricting the automata to be complete. Another subcategory is --f
CAp(S) = CA(S) n AI'(Z') obtained by considering complete automata and proper state-mappings. Let d =(Q, i , 7') be a deterministic Z-automaton and let Q' be any subset of Q. T h e automaton EXAMPLE 4.1.
d I Q'
=
(Q', i ' , T ' )
called the restriction of d to Q' is defined as follows:
i'
=
i n Q',
7"
=
T n Q'
and Q' is regarded as a right L-module by defining the action
q'
-
(T
= ($0) n Q'
T h e surjective partial function E:
Q 4 Q',
q E = q n Q'
is then a state-mapping E:
d 4 d I Q'
called the restriction niupping. T h e state-mapping E is proper iff the following conditions hold
(4.5)
i c Q',
Q'Z c Q'
4. State-Mappings
41
a,
These conditions signify that if i f then i E Q' and if q qa f then qu E Q'. T h e inverse of E is the inclusion function
a,
E
Q' and
This is a state-mapping 1 : d I Q' +diff E is proper, i.e., iff conditions (4.5) hold. If this is the case, then i is a proper state-mapping, called the inclusion. EXAMPLE 4.2.
Let 2 =
(0,T )
and consider the X-automata
-
which are deterministic and trim. T h e function p: Q Q' given by iy
=
i',
q,y = q2p = q',
t y = t'
is then a proper state-mapping p: d+d', PROPOSITION 4.1. If I d' I c I d 1. If, further,
' = Proof, Let a T h e n i's E T ' . Since
d+d'is a state-mapping, then y 2s proper, then I d' I = 1 S' I.
yi:
(0,i, T ) , d' (Q', i', T ' ) , and ~
c j ~z
let s E 1 d" I.
i's c i g s c ( i s ) y
it follows that is E T'p I . l'hus by (4.3) is E T and s E I JP' 1. Now assume that p is proper and let s E 1 ,d I. T h e n is E T . Since i f it folloMs from ( 4 . 1 ~ )and (4.1) that i' f @ and thus i' = ip. Since is f @ and ip f 3 we have, by ( 4 . 2 ~ and ) (4.2), iys = isg, f @. T h u s i's = ( i s ) v f @ and therefore, by (4.3p), i's E T ' . Consequently S E l d ' I
I
Ill. Deterministic Automata
42
PROPOSITION 4.2.
1 LY' 1
=
I Lw" I. Let
parts of ,u/ and JW' that the diagram
I .
Let y: ,d- d" be a state-mapping and assume dt= 1 Qt and SY''~ = ,3' 1 Q't be the trim There is then a state-mapping yt : Ld such --f
It
d'
commutes, where F and F' are the restriction state-mappings of Example 4.1. The state-mapping pt is unique (i.e., independent of y), piPoper, and is n surjectiue function.
i, T ) and d ' = (Q', i', T ' ) . T h e proof rests Proof, Let d = ((2, on the following two statements: (4.6) If is E Qt, then (is)p = i's E (4.7) If i's E Q't, then is E Qt.
Qlt.
Indeed if is E Qt, then isv E T for some PI E P". T h u s sa E I ,3 I and therefore also sel E I 1. 'Thus i'sv E T' and therefore i's E Q". Since
i's c iys c (is)p it follows that i's = (is)y. This proves (4.6). Next assume i's E Q't. T h c n i'sv E T ' for some a E S" and thus sv E I Ld'I = I ,dI. T h u s isv E T and is E Qt. This proves (4.7). Statements (4.6) and (4.7) imply that y: Q + 0' defines a surjective function pt : Qt + such that T F ' : ~y~and that this function is defined in a unique manner by (4.6) and is independent of y. I t remains to prove that yt is a proper state-mapping p t : d t+ dft. From (4.6) and (4.5) with s = 1 we deduce that 1' E Qt iff i' E Q" and if this is the case, then ip?' = i'. This proves (4.1) and ( 4 . 1 ~ )Next . let is, iso E 0'. T h c n by (4.6), i's, i'so E Qt and (is)p i's, (iso)y = i'sa. Thus (iscy)a = (1'sa)cy. This proves (4.2) and ( 4 . 2 ~ )Finally . note that is E Qt n T if€ s E I LdI = I ,d' I iff i's E Q ' I n T' iff ( i s ) p E Q't n T ' . This proves (4.3) and ( 4 . 3 ~for ) yt Qlt
Let d and d ' be trim deterministic S-automata 1 d ' 1, There is then at most one state-mapping q ~ :
COROLLARY 4.3.
such that
1 ,d 1
:
L d 4d ' .This statemapping is proper and is a surjective function
I
5. Minimal Automata
43
EXERCISE 4.1. In Example 4.1 choose Q' = i2* = pa to be the accessible part of Q. Thus in this case both e : d + and i : d~ ,J are proper state-mappings. Show by e.raniples that the corresponding statements are false. for the coaccessible or trim part of , J c 1
---f
EXERCISE 4.2. Let Q : M" be CI state-mapping where ,u/ = ( Q , i, T ) and d = = (Q', i', T ' ) are deterministic E-automata. Let D and I be
Show that the domain and the image of the partial function Q : 0 + 0'. the inclusion 1 : d ' I I + d ' is a state-mopping. Show that y admits a factoriratioiz
~ ' ,d 12 D".
d'11'.
d'
where F and 1 m e restriction and inclusion while i/1 is a uniquely dejined state-mapping. Show that y : I1 + I is a surjective function. Show that y is proper iff both e and y are proper. EXERCISE 4.3. Show that a state-mapping is an isomorphism in the category A ( S ) iff it is proper and is a bijective function.
5. Minimal Automata
Let A be a recognizable subset of X* and let At(A) be the subcategory of A(Z) obtained by considering all the trim deterministic automata d s u c h that I Ldl = A. Corollary4.3 implies that all morphisms in A ' ( A ) are proper and are surjective functions. Further if &'and d' are objects in At(A), there exists at most one state-mapping qr: ,d---f d'. If we write JY" 5 whenever such a state-mapping exists, we obtain a preorder on the set of all trim deterministic automata with behavior A. We show that if d 5 d'and SY" 5 -d, then d and d' are isomorphic. Indeed, if y : d+d' and y :''A d a r e state-mappings, then so is yyi: d-+ d. T h u s by Corollary 4.3, py = l., . Similarly y y = 1 ,. T h u s qr is an isomorphism with y~as inverse. T h e isomorphism classes of trim deterministic automata with behavior -4 thus form a partially ordered set. 'The natural question to be asked is whether this ordered set has a minimal element. An equivalent question is to ask about the existence of a trim deterministic automaton do with behavior A such that for any other such automaton jY' a state-mapping ,d+ do exists. T h e automaton #', with such a property is then determined uniquely up to an isomorphism, and it will be appropriate to call it minimal. --f
,,
I l l . Deterministic Automata
44
T h e existence of such a minimal automaton for any given recognizable subset A of Z* can be established in two different ways. T h e first method consists of considering an arbitrary trim deterministic automaton &' with behavior A , defining an appropriate equivalence relation E on its set of states and constructing a quotient automaton ,d/E for this equivalence relation. One then proves that up to an isomorphism this quotient &'/E is independent of the choice ofdna& ' thus is a minimal automaton for the set A. T h e second method, more elegant and algebraic, consists of a direct construction of an automaton d., for the given set A , and of showing its minimality. This method will bc followed here, and incidentally, as a by-product of the proof, the main facts of the first method will also be obtained. It is useful at this stage to consider deterministic automata which are not finite. Observe that nowhere in Section 4 did the finiteness of the set of states of automaton intervene. Thus an (possibly infinite) automaton is a triple ,d= (Q, i, T ) with T c Q, i c Q, card i 5 1 together with a partial function Q x S + Q which converts Q into a right Z-module. The behavior is the set I Q , ' I = i-ll' = { s I is E 7').T h e set I , d I need not be recognizable unless Q is finite. In the construction of the minimal automaton for a set A , the subsets of X* of the form s-lA with s E Z* intervene. This is justified by the following:
Let d'=( Q , i, T ) be a deterministic (possibly infinite) Z-automaton with behavior A. If is = q E Q , then PROPOSITION 5.1.
q-'T
=
I (Q, 4, T ) I
=
s-~A
Further q is coaccessible i j and only ;f s-'A f sZ* n A # Proof.
8, i.e., i j and only if
(2
We have
q-1T
z
(is)-'T =
('2 1 T ) = s-'A
Further the state q is coaccessible iff q-lT f @3
I
I,et Q" be the set of all subsets of 1*. We convert Qo into a (infinite) right 1-module by setting
x
*
s = s-'X
5. Minimal Automata
45
for X c Z", s E S". Since
X . 1 = l-'X
=
x,
X .
( s t ) = (st)-'S =
t-1 (s-'X)
=
( X * s) . t
it follows that Qo is indeed a Z-module. I n Qo we consider the subset
TO = { X I X
E
QO,
1E X )
We note that in the S-module Q O we have
-Y-lTO
(5.1)
=
1- for all X
E
Qu
Indeed
1 X s E TO} = {S I SK'XE T " } = {s 1 1 E s-'*Y}
P'TO
= {S
=
*
{sIs€X}=-Y
For any subset ,4 of Z* we may consider the (infinite) complete 2automaton d . 4 "
=
( Q O , A , TO)
Then by (5.1)
I LdAdo I =A Let = (Q, i, T) be any deterministic 2-automaton with behavior A. Consider the function
Q+QO q'p = q-'T p:
We assert that
(5.2)
p':
d-+ Ld2,0 is a state-mapping.
This follows from the following three calculations :
ic~,= i - ' T = I ,d I (qs)cC, = (4s)-'T q E
=
=
A
s-1 (q-'T) = s-'(qp) = (qp)
.s
T u l E q - ' T u l E q p u q p E TO
Indeed, since d', is"complete, the last line shows that the state-mapping rp is proper; however, this fact will not be used.
Ill. Deterministic A u t o m a t a
46
Let Ld-l = dltbe the trim part of d ' , O . Applying Proposition 4.2 we find that y defines a proper state-mapping 9':
, J t
+
Ld.l
Thus, in particular, if &'= d'is trim, we have a state-mapping d + dl. This proves that d I is a minimal automaton for the set A. In the automaton Ldd,O a state S is accessible iff X = A . s = s ' A for some s E 2. T h e state -1-is coaccessible iff X . ZL E T o for some u E L'*. This is equivalent with 1 E -1- zi, i.e., with 1 E u - * X , i.e., with u E X . T h u s X is coacccssible iff S f m. We thus obtain the following description of d ~ ,
-
T h e last line stems frorn the fact that 1 E srlA if-f s E A . Note that is empty if A = Summarizing we obtain:
a.
is minimal. THEOREM 5.2. For any subset A of Ir*, the automaton LdA4 I f &'= ( Q , i, T ) is any trim deterministic Ir-automaton with behavior A , then the unique state-mapping c p : A + d4
is given by qp
=
q-'T
for q E Q. Further, cp is proper and is a surjective function
I
We shall refer to d', as the minimal automaton of A ; any automaton will be called "a" minimal automaton for A. isomorphic with ,dA, T h e kernel of thc function cp: Q + Q,, defined in Theorem 5.2 is the equivalence relation
q1 - q 2
iff
q;lT
=
q;'T
If this equivalence relation is the identity, we say that the automaton A ! ' is reduced. T h u s d is reduced if q;'T
=
qilT
implies
q1 = q 2
5. Minimal Automata
47
T h u s d i s reduced iff Q is injective. Since 'I is proper and is a surjective function we obtain (see Exercise 4.3): COROLLARY 5.3. A deterministic automaton ,d with behavior A is minimal $ and oiily $ ,ij/ is trim and reduced PROPOSITION 5.4.
For aiiy subset .-I of 2'" the following conditions
aye equiz>alent: Ez7er.y s E S* is the initial segment of some element of A . sC* n A 12for all s E 2. (iii) s ' A f !3for all s E S*. (iv) AS*-'= 5'". Every deterministic accessible automaton &' such that 1 ,dI (v) is complete. (vi) The minimal automaton Ld-,is complete. (vii) A is the behazior of a complete coacessible automaton d. (i) (ii)
=
A
Proof, Conditions (i)-(iv) are just algebraic reformulations of each other. (i) => (v). Let d =(0,i, T ) , q E 0 and t E Z*. Since XV' is accessible we have is = q for some s E 1". Since there exists u E L'* such that stir E A , we have istu E T and thus qt = ist f Since A f @ it also follows that i f ~2and thus LY' is complete. (v) = (vi). Obvious. (vi) (vii). Obvious. is complete (vii) 3 (i). Let ,d=(Q, i, 2') and s E P. Since we have is f Q.Since is is coaccessible, we have iszt E T for some u E C".T h u s su E A I
a.
T h e subset A of L* will be called complete if the conditions (i)-(vii) of Proposition 5.4 hold. If Ld-, is not complete, then s-*A = for some s E 2". T h e completion d,Lc of is then obtained by adjoining a sink state 0. If we take of S* to bc this sink state, we obtain the subset
a
&', iz
LJ.1"
Q.('
=
(Q IC, i.4 T.1)
=
(s-',4
7
1 s E I")
'The only difference with Ld.l is that the condition s-'A # (3is no longer imposed. We shall call L ~ . , c the complete minimal automaton of A.
I l l . Deterministic Automata
48
We let the reader verify the following analogs of Theorem 5.2 and Corollary 5 . 3 . THEOREM 5.5.
For any complete accessible Z-automaton ' A
=
(Q,
i, T ) with behavior A , there exists a unique state-mapping p: Ld+- d . , c
This state-mapping is proper and is a surjective firnetion. If q qp = 9-11'
E
Q, then
COROLLARY 5.6. A complete automaton ,w' with behaaior A is cornplete minimal $ and only ;f it is accessible and reduced !
As an application we prove: PROPOSITION 5.7.
If ,d= ((2, i, T ) is a complete minimal automaton (0,i, (2 - 1') is a complete minimal autom-
of a set A c I", then d' = aton of the set L'* - A .
Proof. Clearly I sd' I = L'* - I a 'I Since the condition sible, so is d'.
is equivalent to
-'(-0
41
-
=
T) = q-'@
it also follows that ,d' is reduced
S"
-
-
A. Since ,u/ is acces-
T)
1
EXERCISE 5.1. Show that for any subset A of erties are equivalent:
P the following prop-
If st E A , then s E A . (i) all states are terminal. (ii) I n the niininzal automaton .d, A is the belzavior of a deterministic automaton in which all states are (iii) t er in ina 1. Show that this class of sets i s closed under intersection. EXERCISE 5.2. For each (non-deterministic) 2-automaton let d ' denote the result I$ the accessible (zero-free) subset construction, let d " be the completion of d', and let be the reversal of d. Show that ;f
6. A Decision Problem
49
is deterministic and accessible, then ,\.J = d', mid ,JQ' is minimal. Show that if ,li/ is complete and accessible, then ,J= d"and Liy'~"is complete minimal. Deduce that for any automaton d,the aiitomaton d ' e ' is minimal and L d " ~ is 'its ' completioti. Dediice that d ' e ' e ' is minimal with the same behavior as d and that L l i / " ~ " e " is its completion. 6. A Decision Problem
I n practice the construction of the minimal automaton Ld.l will proceed in a manner quite different from that given in Section 5. W e shall assume that a trim deterministic automaton ,M'= (Q, i, T ) with behavior A is given. T h e n we define the equivalence relation
between states of d ' t o hold whenever
Equivalent states are merged and the resulting quotient automaton is both trim and reduced. T h u s c\.J, is obtained. I t is therefore important to be able to decide for any t\vo states q , , q2 of Q whether or not q 1 E 4.. T o do this we first observe that q , E q. holds iff 4,s E T -3q2s E T for all s E L" W e now define approximating equivalence relations E,l ( p 2 0) by setting ql Ep qz whenever q l s E T .aq2s E
7'
for all
s E
V",
1 s1 5p
We have the inclusions
with E
=
n E,.
We first s h o ~
(6.1) qI El,, q2 iff q1 E, q, and qln Ell q2c for all
E
1.
Indeed q1 E, q2 signifies that qls E 7' o q2s E T for all s E Sx such that 1 s 1 5 p 1. It thus suffices to consider separately t h e cases s = 1 and s = nt with I t I s p .
+
111. Deterministic Automata
50
F r o m (6.1 ) we deduce :
(6.2)
If E,,,
=
E , , then E,,,
=
E,,,
.
Therefore:
(6.3) If El,+,= E , , then E
=
E,.
Now let e p denote the number of equivalence classes of t h e equivalence relation E , . T h e n eo<el 5 ... <en<
... S c a r d Q
Further if we exclude t h e trivial cases T = D and T = Q, then E, has exactly two equivalence classes, namely T and 0 - T . T h u s e, = 2 . Consequently we must have el, = e p f l for some p 5 (card Q) - 2. T h i s implies El, = E,J+,and thus E , = E. We have thus proved: PROPOSITION 6.1. In a deterministic automaton d =(Q, i, T ) two states y1 and q2 are equivalent if and only
qls E T for all s
E
q2s E T
c,
S* such that
I s I -(card : Q) - 1 I 'This readily implies: COROLLARY 6.2.
The equivalence of two states in a deterministic
automuton is decidable T h e argument used to prove Proposition 6.1 is entirely independent of t h e choice of the initial state. Given two deterministic 'automata A",= (Q, , i, , T I ) and Ld,= (Q,, i,, T 2 ) we can form their disjoint union and test t h c states i, and i , for equivalence. T h e r e results: PROPOSITION 6.3 Let -d, (i = I , 2 ) be deterministic 1-outonzata -3, I = I -w', 1 whenever with set of states Q L . Then sE(LdljeSEId21
f o r all s E L* such that
I :i 1 < card Q1 -\ card Q,
-
1
I
51
7. Examples 7. Examples
We give a number of examples in which the subset construction and reduction will be carried out and a minimal automaton will be obtained. Some of the theoretical aspects of the procedure will be explained in the first example. These explanations will not be repeated in the subsequent ones. EXAMPLE 7.1.
Consider the automaton
of Example 11, 2.4. Its behavior has been computed to be the set
(7.1)
'7"~~S"with
I
S=
(0, T }
T h e automaton is not deterministic: two edges with label CT issue from i. We apply the accessible subset construction. T h u s starting with the subset consisting of i alone we build a table of the sets is with s E 2'". For simplicity we shall write iq for the subset {i,q } , etc. We obtain the table
i ia
=
iq,
(iq)o = iq,
(it)a = iqt, (iqt)a = iqt,
1T =
t
(iq)r = it ( i t ) t = it (iqt)r = it
Observe that while the second, third, and fourth rows produced new sets, the fifth one did not. T h u s the table stops as the next row would simply repeat formulas already written. A total of four states i, iq, it, iqt are obtained of which the first one is initial while the last two are terminal since they contain t. Note that the empty set has not been obtained and thus the resulting accessible automaton is complete. Renaming the states 1, 2, 3, 4 we obtain
Ill. Deterministic Automata
52
We now repeat the same procedure but with the dual automaton. This will not only check the above automaton for coaccessibility but, as we shall see, it will also tell us which pairs of states are equivalent. T h u s we start with the terminal set 34 and build the table of sets (34)s-1with s E 3.We obtain
34 (34)a-1= 34, (234)a-' = 1234, = 1234, (1234)~~'
= 234 (34)~~' (234)~-1 = 234 = 1234 (1234)~~'
We observe that both non-terminal states 1, 2 appear on the right-hand side of some equation. This proves that the automaton above is coaccessible. We also observe that the states 3 and 4 never get separated; whenever one appears on the right-hand side of an equation then so does the other one. This means that
3 E (34)s-10 4 E (34)s-1 or equivalently
3s E 34 0 4s E 34 Since 34 is the terminal set T , it follows that the states 3 and 4 are equivvalent and should be merged. An inspection of the table shows that this is the only such pair. Performing this merger gives the minimal automaton
c
0
+1"-2".3-
0,r
I t is complete. If we compute the behavior from this automaton, we obtain the set 5 *a0
*a*
or equivalently
(74
t*a*orS*
This expression formally differs from (7.1) but both describe the same subset of P, namely the set of all words which contain GT as a segment. T h c form (7.2)emphasizes the first (i.e., the leftmost) appearance of this segment.
53
7. Examples EXAMPLE 7.2. u,r
Consider the automaton
3
E 1 ~ 2 3 u , 7+ 3 ~ 4 -
a,r
which is trim but not dctcrministic. It calculates the set L ' * T P u 02". Of course this is the set 2+(as indeed every word in L'+ either begins with (T or contains T ) . T h e table of sets 13s is
13 140= 14,
130 = 14,
132 = 12
1 4 t = 124,
1 2 0 = 12,
1240 = 124,
1247 = 124
1 2= ~ 12
T h u s there are four states 13, 12, 14, 124 of which 13 is initial and the others are terminal. Renaming these as 1, 2, 3, 4 we obtain the accessible deterministic (even complete) automaton
We now build the table for 234s-I
234 2340.'
=
1234 = 2 3 4 ~ - '
12340-'
=
1234 = 1234~-'
T h e states 2, 3, 4 are inseparable and therefore are equivalent. Merging them we obtain the minimal automaton +,'YS
EXAMPLE 7.3.
Consider the automaton
Y
54
Ill. Deterministic Automata
This automaton is deterministic and accessible and calculates the set to*. We thus proceed directly with the table for ts-'
t to-1
= t,
i0-1
=
tt-1
0,
=
i
it-' = @
There are no equivalent states and q does not appear because it is not coaccessible. Th us NU* is
+02+&-Jo Similarly do*, is
U++o+ EXAMPLE 7.4.
Consider the automaton
computing the set S*tS*. T h e table for 1s is
1 l o = 1,
010 = 01.
It =
Olt
=
01
01
There results the automaton
which upon inspection is already minimal. EXAMPLE 7.5.
Consider the automaton
1A 0 +
U,T
computing the set
Pt.
The table for 1s is
1 lo
Ola
= =
1, 1,
It =
Olt
=
01 01
8. The Quotient Criterion
55
T h e resulting automaton
is already minimal. Observe that the reversal of the original automaton is
computing tZ".This automaton already is minimal.
8. The Quotient Criterion
THEOREM 8.1. (The Quotient Criterion) For any subset A of Z" the following conditions aye equivalent:
A is recognizable. (ii) The family of sets {$-'AI s (iii) The family of sets { A - ' I s (i)
E
S"} is finite.
E
S " } is finite.
Proof, (i) c1. (ii). T h e family in (ii) is the set Q2.1c of the (a priori infinite) complete minimal automaton Lda4c of A. T h u s if QAlc is finite, -dAlC is a finite automaton and thus A is recognizable. Conversely, if A is recognizable, then A = 1 jY' 1 where .dis a finite, deterministic, and trim automaton. T h e surjective state-mapping ,d+ ,ull implies that the minimal automaton LdA, of A is finite. T h u s Q.l is finite and so is the family in (ii). = se-lAe, where e is the reversal opera(ii) 3 (iii). Since (As-')@ tion, the finiteness of the family in (iii) is equivalent with the finiteness of the family {s-lAe I s E S"}, i.e., with the recognizability of
[email protected], Ae is recognizable iff A is (Proposition 11,3.1) [ It is important to observe that while the definition of automata was biased in the sense that right modules were used throughout, the resulting notion of recognizability is two-sided, as is seen from conditions (ii) and (iii). T h u s automata based on left modules would yield the same notion of recognizability.
Ill. Deterministic Automata
56
T h e cardinality of the family in (ii) is denoted by uCA.This is the number of states of the automaton We also introduce the number aA which is the cardinality of the set in (ii) with 0 deleted. Clearly uCA = uA or uCA= 1 cxA.
+
PROPOSITION 8.2. Let A be a recognizable subset of Z", and let &'= (Q, i, T ) be a deterministic (resp. complete) Z-automaton such that I ,d1= A. Then
card Q
with equality holding
2 (LA
(resp. card Q 2 acA)
if and only if ,dis minimal
(resp. complete minimal).
Without prejudice we may assume that JY' is trim (resp. accessible). Then q ~ :,d+ ,d.(resp. , p: d+Ld.,c) is surjective and the inequality follows. If equality holds, then 9 is bijective and is an isomorphism I Proof,
EXAMPLE 8.1. A palindrome is an element s of Z* such that s = SQ where s@ is the reversed word. We show that the set P of all palindromes in L'* (card Z= k > 1) is not recognizable. Indeed let sl, s2 E S with I s1 I = I s2 I = n, s1 # s 2 . Then slsl@E P,
slspe cf
P
and therefore
s,'P # s,'P It follows that the k" sets
I
{SKIP s E Z",I s I
=
n)
are distinct. Since k > 1 and n can be chosen arbitrarily large, it follows that {s-lP} is infinite. When trying to use the quotient criterion in a positive way to prove recognizability, some questions of effectiveness and decidability arise. Indeed, suppose that a subset A of 2" is given and that the set
is finite. We then know that the complete minimal automaton of A is finite and thus A is recognizable. However, can we effectively construct
57
8. The Quotient Criterion
this automaton ? Certainly we cannot on the basis of the data as given. From the point of view of effective computation, the information that a set is finite is useless unless an upper bound is explicitly given. T h u s we shall assume that an integer n is given so that
Secondly, in constructing .dIr we shall have to perform some operations on elements of A. T h u s it is important to know how the set A is given. We shall assume:
(8.3) T h e set A is given together with an effective procedure that will permit us to decide for each element s E S" whether or not s E A. THEOREM 8.3. tinder conditions (8.2) and (8.3), the complete minimal automaton LdA,c can effectively be constructed.
For the purpose of this theorem it is not necessary to describe too closely what is meant in (8.3) by "effective procedure." T h e question is relative: the construction of Ld,,c will be as effective as the procedure given in (8.3). We first list some easy consequences of (8.2): there exists t (8.4) For each s E I*, s-'A = r ' d .
(8.5) If s, t
E
E
1" such that 1 t 1 i n and
.F are such that
su
E
'4
0
tu
E
'4
whenever
I u I -< n
-
1
Both statements follow from the consideration of the complctc minimal automaton d =(0,i, T ) and the assumption that card Q 5 n. Indeed, if s - ' A is the state q, then is = q. T h u s there is a path c : i + q in 3y' with label s. If we choose a path c ' : i + q without repeated vertices, then it = q where t = 1 c' I and I t I I.n. T h e equation it q signifies that s ' A = q = t - ' A . Statement (8.5) is a rephrasing of Proposition 6.1, in the language of the automaton -M',~.
Ill. Deterministic Automata
58
may now be given. We first T h e procedure for constructing Ld.,c consider the sets s-'A for all s E Z*, I s I < n. These sets are pairwise tested for equality using (8.5) and (8.3) and repetitions are eliminated. We thus arrive at a list
where by (8.4) each set s-'A appears exactly once. Those are the states of We may further assume that s, = 1 and thus s7'A is the initial state. 'The terminal states are those sr1A for which 1 E s;'A, i.e., s, E '4. These can be determined by (8.3). Finally to determine the edges, we consider the set ( ~ ~ ' 1 .4 a) = a-'s;'A = (s~o)-'A This set must appear in our list and using (8.5) we can effectively determine its place. If (s,o)-'A = sylA, then we have the edge a: s;'A s;'A. T h e construction of ,dALC is now complete I --f
S* + T* is a inorphism and B is a recognizable subset of T*,then iz = Bf-' is a recognizable subset of L* and PROPOSITION 8.4. I f f :
rrA 5 aB. Proof.
T h e following identity is used
Indeed, u E s-'A iff su E A , i.e., ( s u ) f ~B. Since ( s u ) f = ( s f ) ( u f ) , it follows that zi E s-IA if€ uf E (sf )-lB. T h e identity above implies that card{s-'A} 5 card{(sf)-'B} Also note that membership s E A is decidable since the membership is decidable and f is assumed to be effectively given I
sf E R
EXERCISE 8.1.
Show that the following subsets of {a, r}* aye not
recognizable
I
A
= (oVit" n E
B
=
{aVttait 1n
where X is any infinite subset of N .
X}
E
X}
9. Right Congruences
59
EXERCISE 8.2. Use the method of Propositions 8.2 and 5.4 to show that q.4 and B are recognizable subsets of 7*, then so are '4 v B, A n B, and S" - '4. Derive bounds for u ( A u B ) , (*(A n B ) , and u(S* - A ) . EXERCISE 8.3. Show that for any subset B of S +one has
B
Use this device to show that so is A B .
=
U a(u-'B).
if A , B
are recognizable subsets of S", then
This is part of Kleene's Theorem that will be established in Chapter VII in a broader setting. EXERCISE 8.4. Show that a subset A of exist integers 0 5 q < Y such that for all s, t s-1A n Jq
=
X* is recognizable if there E S* the condition
t-1A n 21
implies
$-'A n z Show that
r
t - ' A n 21
if this is the case, then
implies
SP'A= t-l-4 and therefore
where k
=
card 2.
EXERCISE 8.5.
Show that f A is a recognizable subset of u(AB-l) 5 cxA,
for any B c E* and any s
E
Ir", then
a(s-'A) 5 r*A
2".
9. Right Congruences
Let &'= ( Q , i, T ) be a deterministic (not necessarily finite) Z-automaton with behavior A . T h e development presented in Sections 5-8 was based on the study of the sets q-'T for the various states q E 0.
Ill. Deterministic Automata
60
There is a "dual" treatment which concentrates on the sets i-'q
I s E Z+, is = q }
= {s
These sets are mutually disjoint. This approach is particularly effective if we assume that si& ' complete and accessible. In this case the sets i-'q are not only mutually disjoint, but are non-empty and their union is all of Z+. Thus the sets ik'q are the equivalence classes of an equivalence relation in L'* that we shall denote by -,d. Explicitly (9.1)
iff
s1 - , d s ,
is,
=
is,
'The following properties are clear: (94 (9.3)
implics
s1 -ds, s1 - , d ~ , and
s, E A
slg -ds,o
implies
s, E
A
We express condition (9.2) by saying that wLdis a right congruence in Ex, while condition (9.3) is expressed by saying that A is closed with respect to w d . We can also proceed in the opposite direction and start out with a right congruence in Z+ with respect to which A is closed. For each s E 2*,let [s] denote the equivalence class under containing s. Consider the complete Z-automaton d = (Q, i, 2") given by
-
-
Q
[S]O =
i
T
I s E Z"}
= {[s]
=
=
Pi-
[so]
[l]
= {[s]
I S E A}
Then d is complete, accessible, and -& = -. In the special case when d i s the complete minimal automaton -u/.,c of A the right congruence -~dis denoted by Thus definition (9.1) becomes in this case -A,.
(9.4)
s,
-.,
s,
iff
s;'A
=
s;'A
PROPOSITION 9.1. Let il be a subset of L'+ and in Z* with respect to which A is closed. Then
-
a right congruence
61
10. The Syntactic Monoid
or equivalently s1
-
s,
iniplies
s1
s2
-
s, we have s,t -s2t. Proof, Let t E s;lA, i.e., s,t E A. Since s1 Consequently s,t E .4 and t E s;'A. T hus s;'A c s;'A and by symmetry s;'A = s;'A. Hence s, s2 I
--,
PROPOSITION 9.2. For any subset '4 of L'* the following conditions
are equivalent: (i) (ii) (iii)
A is recognizable. The right congruence -., is jinite. There exists a j n i t e right congruence in 2 * with respect to which A is closed.
(i) = (ii). Since A is recognizable the family of sets {s-'A} is finite. Th u s the finiteness of follows from (9.4). (ii) = (iii). Obvious. is (iii) * (i). T h e automaton ,dconstructed above starting with then finite I Proof.
-.,
-
Note also that the implication (iii)
(ii) follows from Proposition 9.1.
10. The Syntactic Monoid
Let Q be a right 2-module. For each word s E L'*, the partial function 4 Q which maps q into qs will be denoted by su. There results a morphism (1: L'* 4P F ( Q )
Q
where P F ( Q ) is the monoid of all partial functions Q + Q. T h e image M of the morphism cz is called the action monoid of the right '-module Q. Clearly M is the submonoid of P F ( Q ) generated by the partial functions q + qo for the various letters o E 1.T h e surjective morphism (1:Z* M --f
accompanies the action monoid. If ,3= (9,i, T ) is a deterministic Z-automaton, then Q is a right 2-module and the action monoid of Q is denoted by Mc,. This is the action monoid of the automaton d. replaced We assert that the action monoid remains unchanged if by its completion d r .If ,3is complete, then , x' = and there is
Ill. Deterministic Automata
62
nothing to prove. If d i s not complete, then Q' = 0 u 17,where 0 is the sink state. T h e nionoid P F ( Q ) is then isomorphic with the monoid of all functions + Q" which map 0 into 0. T h u s the action monoid remains unchanged (except that instead of being a submonoid of P F ( Q ) it becomes a submonoid of the monoid F ( P ) of all functions + 9). Let -dAI ( Q A 1i ,A lT, A l )be the minimal automaton of a subset A of Z". T h e action monoid of ,dA, is denoted by M,, and is called the syntactic monoid of A. T h e accompanying surjective morphism :
pa(: ,r*+ M.1
is called the syntactic morphism of A. Observe that if dAl is replaced by its completion Ld.lc, the syntactic monoid remains unchanged. PROPOSITION 10.1.
For any subset A of Z* the following properties
are equivalent : (i) A is recogniznble. (ii) The syntactic monoid M.I is jinite. (iii) There exists a .finite monoid M , a morphism y : 1" B of M s ~ that h A = Bp-'.
--f
M , and a subset
(i) => (ii). If (i) holds, then the minimal automaton dAl is finite and thus M A ,is finite. (ii) => (iii). This is clear since M , , the syntactic morphism p.,: L'* + M A , , and the subset AeAlof MA,satisfy the conditions of (iii), (iii) (i). Consider the Z-automaton Proof.
-
d =( M , 1, B ) with M converted into a complete right L-module by setting for m wE m w = nt(wp).
z*
E
M,
Then
I &' 1
= {W
[ 1* w
I
= {W ~ p E?
EB) B } = By-'
=
A
and thus '4 is recognizable PROPOSITION 10.2. Let A be a subset of Z* and Q , , : L'* 4MAiits syntactic morphism. Then for any s, t E P the following conditions are equivalent :
10. The Syntactic Monoid
63
(i) SQ.1 = k.4. (ii) ( Z L S ) - ' ~ ~= (ut)-'A for all u E s". (iii) usv E A o utv E A for all 11, v E 2%. Proof. (i) u (ii). From the definition of MA4as a monoid of functions ,O.lc 4 Q.,c it follows that
(u-lA)(sp.1) = ( K I A ) . s = s-'u-'A
=
(us)-'A
T h u s (i) and (ii) are equivalent. (ii) o (iii). This follows directly from the definition of (us)-'A
I
We define an equivalence relation in S" by setting
whenever (iii) holds. I t follows from (iii) that =., is a congruence in P (see 1,5 for a definition). We call =., the syntactic congruence of A. T h e equivalence of (i) and (iii) shows that this congruence is the kernel of the morphism PA,. Since e.., is surjective it follows that M-, may be identified with the quotient monoid P/=, and pAi may be identified . -+ Z/ with the natural factorization morphism 2% We observe that (iii) implies:
(10.1) If s =-.,t and s E A , then t to Ma,.
E
A , that is, A is closed with respect
This can be restated as
(10.1')
AQ~~Q =; A '
and also as
(10.1")
A
=
for some B c M ,
Bp-l
A consequence of the discussion above is the identity
(10.2)
M.4
= MZ*-d
Indeed, A and 2* - A have the same syntactic congruence. If we compare the equivalence relation =A4 with M - ~ Q , we find s
t o Se
=-.,e tQ
Ill. Deterministic Automata
64
This implies that the syntactic monoids MAland M.,e are anti-isomorphic, i.e., there exists a bijection p: ML1 + M.,e such that ( x y ) p = ( y p ) ( x p ) for all x , y E M A , . I n other words, M ~ , emay be obtained from M., by reversing the multiplication in M . 4 . T h u s we may write MAlc = (M.,)Q. T h e definition (iii) of the syntactic congruence can be extended to subsets A of an arbitrary monoid M . Consequently we may define the syntactic monoid Madas M/=.l and the syntactic morphism PA,: M +M A , as the natural factorization morphism. EXERCISE 10.1. Let QJ: M + Ad' be a morphism of monoids and let A be a subset of M such that A = Aqy-'. Show that cp admits a unique factorization
Med-M,,LM' where q' is a morphism of monoids. Show that the above properly characterizes Ad., (up to an isomorphism). EXERCISE 10.2. Show that if q : M + Ad' is a surjective morphism of monoids and if A c M ,A' c M ' are such that A' = AT, A = Alp-', then M.l M A I t .
-
Let A be a subset of a monoid ICI, and let B = iZpAt be the image of A in the syntactic monoid M.d.Show that the syntactic congruence of B (in M,,l)is the identity, i.e., M A is , the s-yntactic monoid of B. EXERCISE 10.3.
EXERCISE 10.4.
Using Exercise 10.3 show that the monoid U , with
elements 1,
211
, u2,
u3
and ni u ltiplica t ion u 1u1. = uj is not a syntactic monoid. EXERCISE 10.5. Show that the syntactic monoid M d of a subset A of a monoid M has a zero (i.e., an element 0 such that ML10= 0 = Oa1M)zff there exists an element n2 E M such that either M m M c A or MmM nA =
a.
11. Examples of Syntactic Monoids
65
11. Examples of Syntactic Monoids
In calculating the syntactic monoid SA1 of a subset A of Z* we usually first compute the minimal automaton -3,and then tabulate the relations that the partial functions Q.l + Q.l given by the elements u E Z satisfy. Thus, de facto, M , has S as a set of generators and a number of relations between these generators is given. EXAMPLE 11.1.
Let A
=
B" with B
c
L'. T h e automaton d,lis
Then if B = 2, SA4 = 1. If B f 2, then M A {has two transformations; the element 1 E Exand each element of B yield the identity transformation, while each element of X - B yields the empty transformation. T h u s M A ,has two elements 1, 0 with 00 = 0. This monoid is called U , . If B = S, the automaton above is complete. If B # 2, then d I is c
and the same monoid is obtained. EXAMPLE 11.2. Consider the set A = S"otE* (with 2 = {o, r } ) studied in Example 7.1, I n the notation of this example Q&4 = { 1, 2, 3). T h e actions of CT and T may be described as follows
123 2 2 2 3 , meaning that lo = 2, 20 relations are computed 0 2
= 0,
=
72
123
133
2, 30 = 3 , etc. From this the following
= 7,
U7U
= 0-7= ZUZ
T h e monoid M,, has thus five elements
1,
U,
7, U T ,
70
T h e multiplication table is completely given by the above relations.
Ill. Deterministic Automata
66
EXAMPLE 11.3. T h e syntactic monoid MAlof the set A sed in Example 7.2 has the relations
= Z+ discus-
a=t=g,
and thus the monoid has only two elements
1,
(7
with the idempotency relation u2 = (T. This is the monoid U , . T h e syntactic monoid MA,of the set A Example 7.3 has the relations EXAMPLE 11.4.
=
to* of
t3 is
a zero
Thus the elements of M , , are
1,
T2.
5,
(T,
Note that t2:QA,+ Q., is the empty partial function. T h u s for the monoid M., , i.e., tZM,, = t9 = M.,?. For the set A = 0% the relations are 0'
EXAMPLE 11.5.
=
If A
T = (Tt,
(T,
=
T'
=
to.
as in Example 7.4, the relations in
L'*T.!,'*
lMA1are
1,
=
(7
t2 = t.
T h u s the monoid has elements
1, with r2 = t. Thus M., EXAMPLE 11.6.
U,.
:
If A
=
2%
as in Example 7.5, the relations in MaI
are (T2
=
(T
=
z2 = 7
5(T.
= gt.
T h u s M A ,has threc elements
1,
0,
2.
This monoid has the name U,. T h e set AQ= tX* is obtained from the above by reversal. T h u s M,,o = U p . This monoid has the name I,,.
11. Examples of Syntactic Monoids EXAMPLE 1I.7.
67
Consider the non-recognizable subset
.il
1 n 2 0)
= {dJ7”
of Sx with S = {a, 7}. T h e n
At”
3
if s = a!?, n 2 0 if s = aJ17~, 0 < p 5 n in all other cases
Consequently the infinite minimal automaton A’, is
with p i = A t i , qi and that
= T ~ It .
follows that the syntactic monoid has a zero
These are the defining relations for M.l. T h e elements of and atJ,t”,a117azlifor n > 0.
MA, are 1,0,
EXERCISE 11.I. Compute the syntactic monoid M A 4of A that M , has six elements (one of which is a zero).
(or)+.Show
EXERCISE 11.2.
Show that
if A
=
=
(SP)*, then
where Z , is the cyclic group of order p . Here p 2 1 is any integer and the alphabet S # @ is arbitrary. EXERCISE 11.3. Let A consist of a single element s of 2”.Show that the syntactic monoid Mad consists of all segments of s and a zero. The product of 11 and v in MAIis lit! if uzj is a segment of s and is 0 otherwise. EXERCISE 11.4. Let 0 be any Jinite set with a chosen element i. Consider the monoid PF@) of all partial functions, and let S be an alphabet equipped with a surjective function (1: S + P F ( 0 ) . Extend (2 to a morphism
Ill. Deterministic Automata
68
a : C"
+
PF(Q), and define A
= (s
J i = i(scx)}
Show that P F ( Q ) is the syntactic monoid M A ,of the set A. 12. Generalization to Arbitrary Monoids PROPOSITION 12.1. For any nionoid ICI and any subset A of M the following properties aye equivalent :
(i)
The family of sets
{nz-'A 1 nz
E
M>
is finite. (ii) The syntactic monoid M., is fiiiite. (iii) There exists a finite nionoid M ' , a niorphism p: M + M ' , and a subset B of M ' such that A = Bp". (iv) There exists a finite Tight congruence in M with respect to which A is closed. m2 i f m;'A = m;'A is (v) The right congruence -., defined by m , finite.
-.,
Proof, T h e easy proof is left as an exercise for the reader
I
We shall say that the subset A of M is recognizable if conditions (i)-(v) above hold. One could engage in the exercise of generalizing the notion of an automaton (non-deterministic, deterministic, and complete) by suitably replacing 2'* by an arbitrary monoid M . This is not very productive since all the known properties of recognizable sets already follow from the definition adopted above. In particular, the definition easily implies that the class of recognizable sets is closed under Boolean operations and the operation p-' where Q': M + M ' is a morphism of monoids. Also, if A is a recognizable subset of M , then A also is recognizable when viewed as a subset of the reversed monoid Me. This implies that the family of sets {Am-' I m E M } also is finite. PROPOSITION 12.2. Let M , and M , be monoids and let A be a subset of the direct product M , x M 2 . Then A is recognizable i f and only $ A is the
12. Generalization t o A r b i t r a r y Monoids
69
Jinite union of sets of the f o r m B x C where B is a recognizable subset of M I and C is a recognizable subset of M,. Proof. Then
Let
7ci:
A,!
Y h12+ M i ( i =
1, 2) be the natural projections.
B x C = ( B x M , ) n ( M , x C ) = Bn;’ n Cn;l T h u s if B and C are recognizable, so is B X C. This proves the implication in one direction. Conversely, assume that A is recognizable. There exist then a finite monoid M , a morphism p: ill, ,< M 2 + M , and a subset D of M such that A = D9-l. Consider the morphisms y h :M ( + M defined by
I n M x M consider the set
E
= {(sl
, sg) I sIs2E D}
it follows that ( m , , ma)E rZ iff ( m ,, m , ) y E E. We have thus proved that A = Eyr-I. I t follows that
Since the sets sly;’ are recognizable subsets of A l l (i = 1, 2), the required decomposition of A is obtained I
A subset ,4 of a monoid M is recognizable if and only i f subsets B , , . . . , B,, , C , , . . . , C,, of M exist such that PROPOSITION 12.3.
and such that whenever st
E
A then s E B i, t E C , f o r some 1 5 i 5 71.
70
Ill. Deterministic Automata
Proof. Assume that '4 is given as above. T h e n for each s E M we have $-'A = ci
u
the union extending over all indices i for which s E B , . T h u s the family of sets {s-',4} is finite and A is recognizable. Conversely assume that ,4 is recognizable. There exist then a finite monoid M', a morphism 7 : M 4 M ' , and a subset D of M' such that A = L ) p . - l . Let ( B , , c l ) , . . . , ( b , t ,c , ~ )be all the pairs of elements in S such that b,c, E D. Setting B , = b,ry-l, C , = the required conclusion is easily verified I EXERCISE 12.1. Let M be a monoid satisfying x y = y i f y f 1. Show
that er)ery subset of 44 is recognizable. EXERCISE 12.2. Given a monoid M , let MI be the monoid obtained from M by adjoining a new unit element. Show that n subset A of M r is recognizable if A n M is a recognizable subset of M. State and prove a similar result for the monoid Mnobtained from M by adjoining a zero. EXERCISE 12.3. Show that in the free commutatiz~emonoid 11.1 with generators o, t all finite sets are recognizable. Show that o+, tf, ax, T* are recognizable but the sets (or)+ and (or)* are not recognizable. Use this to construct an example that a movphism f : M + M' of monoids need not carry recognizable sets into recognizable sets.
Let f : 111 + M ' be a relation satisfying
EXERCISE 12.4.
Establish the identity m-l(Alf-l) = ( ( m f ) - ' A ' ) f - l for A' c M' and in Alf-1.
E
M. Deduce that if A ' is recognizable, then so is
EXERCISE 12.5. Show that if A is a recognizable subset of a monoid M , then so is the set
B
=
{ ( x , Y ) I XY
E
A} c MxM
12. Generalization t o Arbitrary Monoids
71
Show that if B is recogni:able, then ,4 is a finite union of sets of the f o r m C D with C, D c 11.1 recognizable. EXERCISE 12.6.
Given an element
ni E
A4 define the conjugate of m
to be the set mc
=
{uu I v u = ni}
Show that f o r an-v recognizable subset A of M the set Ac is a j n i t e union (J C , D , with C, and D , recognizable. (Hint: Use Exercise 12.5.) EXERCISE 12.7.
Show that if A f i s an infinite monoid, then the diagonal J =
{(ni, m )
I m EM}
is not a recognizable subset of A f x M . EXERCISE 12.8. Let A be a subset of a group G. Show that A is recognizable i f f there exists an invariant subgroup H of G of finite index such that d is the finite union of cosets of H . Dpduce that if G is injnite and A f 3 is jinite, then A is not recognizable. EXERCISE 12.9. Let Z be the cyclic infinite group written multiplicatively. Adjoin to Z three elements e, a, b and define a commutative monoid structure on ill = Z v {e, a , b } 0-v extending the niultiplication table in Z as follows:
a z = - - - bz, ex
aa
=
a,
bb = b,
for all
=x
ab
=
1
xEM
Show that a subset A of 114 i s recognizable iff A n Z is a recognizable subset of Z. Use this to show that the set .-I = ( a , 6 ) is recognizable, while the sets A A , A', and .4" are not. EXERCISE 12.10.
'4 monoid A l is said to haee the subdivision property
if wheneaer m1m2= nln2
for
m, , ni, ,n, ,n,
then there exists 1 E M such that either m,l
n,l
n, ,
In?
=
niz
m, ,
Im,
=
n,
=
E
h i '
Ill. Deterministic Automata
72
Establish the following properties of subdivision monoids: (i)
Given sequences m,, . . . , m k ,
n,,
. . . , nl
in M such that m, . . . mk = n,
. . . nl
there exists an integer r 2 k , 1 and a sequence
in AT such that m , , . . . , ink are products of consecutive blocks of p , , . . . , p , and similarly for n , , . . . , n L . Thus p , , . . . , p , is a common subdivision of the sequences m, , . . . , m k and n, , . . . , n l . (ii)
For any two subsets A and B of M and for any m
m-'(AB)
=
E
M
(m-'A)B u (A-'m)-'B
m-'(A+) = [(AX-'m)-'A]AX (iii) If A and B are recognizable subsets of 44, then so are A B and A+.
Let Z be a possibly infinite alphabet. Show that a subset A of X" is recognizable zJf there exists a jinite alphabet T,a recognizable subset B of P , and a very fine niorphism f : Z X r Xsuch that A = Bf-'. EXERCISE 12.11.
--f
13. Automata of Type
(p,r)
A natural generalization of the notion of a deterministic 2-automaton will now be considered. Given a pair ( p , r ) of integers p 2 0, r 2 0 , a deterministic 2'-automaton d =((2, i, T ) of type ( p , r ) is given by a right Z-module 0,a vector i = (i,, . . . , i p )of subsets of Q each of cardinality 5 1, and a vector T = ( T , , . . . , T,) of subsets of Q. For p = r = 1 this reduces to the case considered in the body of this chapter. T h e behavior I &' I of LY' is a p x r matrix of subsets of S"
I
Lf
Ilk =
I
(0, i, , Tk) I = V
T k
A state of q E Q is said to be accessible if ijs = q for some 1 5 j 5 p and some s E .Y* ; q is said to be coaccessible if qs E Tk for some 1 2 k 5 r and some s E 1".We let the reader carry out the generalization of the
13. Automata of Type ( p , Y )
73
contents of Section 4 and we proceed directly with the description of the "minimal" automaton diof type ( p , Y ) for a prescribed behavior matrix A . T h e construction is a direct generalization of that carried out in Section 5. We denote by Po the set of all vectors
of subsets of P.T h e set by setting
0" is converted into a (infinite) right 2-module
(XI, . . . ,S r ) s
=
(sr'X,, . . . , s-LX,)
T h e vector
T" = (T,O, . . . , T,O) of terminal sets is defined by
Tk0 = {(X, , . . . , S,) 1 1 E S,} 'The vector io = (ilO, . . . , i,O)of initial states is given by the rows of the matrix A. T h u s i,o = (A], , . . . , A , r ) There results a complete (infinite) Z-automaton
of type
(p,Y).
Since
1
d A , 0 Ij,.
=
{s I ( A j , , . . . , Ajr)sE
=
{s I 1 E s-'Ajn}
=
{s I s E
Aj,.}
=
TkO}
dj,.
we have 1 , d , O 1 = A. T h e accessible states of -dAlo have the form
(13.1)
(S+Ajl,
. . . , s-'Ajr)
for some s E 9, 1 < j 5 p . T h e only non-coaccessible state is
T h u s the trim part of -./';In consists of all states (13.1) which are not (3.
I l l . Deterministic Automata
74
This yields the minimal automaton
C d I
=
( Q l , i l , TA)
We leave it to the reader to show that this automaton is indeed minimal in the sense analogous to that of Section 5. T h e j t h component of the vector iAl is empty whenever the j t h row of the matrix A is zero. T h e form (13.1) of the states of Q , implies that Q , is finite iff the family { S - ~ AI s~E ~L’*, 1 5 j 5 p , 1 5 k 5 r } is finite, i.e., iff all the sets .4,1 are recognizable. We thus see that the matrix A is recognizable [i.e., is thc behavior of a finite L’-automaton of type ( p , r ) ] iff all its entries AJnare recognizable. We thus see that thc notion of an automaton of type ( p , Y ) does not yield any new notion of recognizability. All this notion supplies is a convenient method for simultaneously recognizing all the sets {A,n}by means of a single automaton. We shall see in XI,5 that the notion of an automaton of type (1, r ) will be convenient for the study of sequential machines and sequential functions. EXERCISE 13.1. Give necesscwy and sirficierit conditions f o r the azrtornaton Q,, to be rornplete. Show thnt ;f Q.4 is not complete, then its completion 0 , c is obtnined by taking the accessible pavt of Q.ro,i.e., b-v adjoining the state to Q.I. h
.
EXERCISE 13.2. Establish the equivcrlence of the pairs of statements:
References M . 0. Rabin and D . Scott, Finite automata and their decision problems, I B h l J . Res. mid Dezielop. 3 (1959), 114-125. Reprinted in “Sequential hlachines” (E. F. Moore, ed.), pp. 63-91, Addison-Wesley, Reading, Massachussetts, 1964.
This papcr is the first systematic presentation of the theory of automata, and contains virtually everything known up to 1959. Most of the contents of Chapters I1 and I11 are a modcrnized version of this paper. We refcr the reader to this paper for all references prior to 1959.
References
75
F. S. Ikckman, Categorical notions and duality in automata theory, I B b l Research Report RC2977 (1970).
This paper contains an elegant discussion of minimization of automata based on a categorical approach. I t also is the source of Exercise 5.2. R. hlcNaufihton and S. Papert, T h e syntactic monoid of a regular event, in “Algebraic Theory of Machines, Languages and Semigroups” (M. A. Arbib, ed.), pp. 297312, Academic Press, New York, 1068.
This paper contains the first clear-cut and systematic exposition of the syntactic monoid. S. Ginshurg and G. F. Rose, A characterization of machine mappings, Cattad. J . Moth. 16 (1966), 381-383.
This is the source of Proposition 12.3. T h e following papers deal with the “subdivision property” defined in Exercise 12.10: F. Lrvi, On semigroups, Bull. Culcrrtta Math. SOC.36 (1944), 111-146 and 38 (1946), 123-1 24. J. D. McKnight Jr. and A . J. Storey, Equidivisible semigroups, J . Algebra 12 (1969), 2448.
Proposition 12.2 is by G. Mezei (unpublished). Exercise 12.9 is by S. Winograd (unpublished). Exercises 11, 6.3-6.5 are by M. P. Schutzenberger (unpublished).
CHAPTER
Iv Structure of RecognizaMe Sets
In this chapter the notions of a unitary set, unitary monoid, and prefix are introduced. Using these concepts a decomposition algorithm for recognizable sets is developed. 1. Unitary Sets
A subset A of Z" is said to be unitary if s;'A
=
s;'A
for all
s,, s, E
s-'A
=
A -'A
for all
sE A
A
or equivalently
Observe that the empty set @ is unitary. T h e notion of a unitary set becomes more transparent when interpreted by means of automata. All automata considered are deterministic, not necessarily complete, and not necessarily finite. PROPOSITION 1.1.
For any subset A of L'" the following conditions
are equivalent:
A is unitary und non-empty. (i) of A has a single terminal state. (ii) The minimal automatoti dA, A is the behavior of a deterministic (possibly injinite) automaton (iii) ,w' = (Q, i, t ) with a single terminal state t that is accessible. 76
77
1. Unitary Sets
Proof. (i) 3 (ii). Sincc the terminal states of -iJ, are the sets of the form s-"4 with s E A , it follows that -d., has a single terminal state. (ii) * (iii). Obvious. (iii) * (i). Let .4 = I ,dI with d =(p,i, t ) and t accessible. T h u s A f @. Let s E A . T h e n is = t and s-',4 = s ' ( i - l t ) = (is)-'t : t-lt. T h u s s ' A is independent of the choice of s E ,4 and consequently A is unitary I
, w ' ,
Given a recognizable subset =1 of S" consider the minimal automaton = (0, i, T ) . Let t , , . . . , t,, be the elements of T. Define 14,
=
I
1 cjI
(0, i, t,) I ,
T h e following properties of the sets A, are clear.
(1.1)
A , is unitary.
(1.2) A, n A L = 3,
1 l j -: lz 5 n.
II
(1.3)
A
=
(JA,. 3=1
(1.4) c d , 5 rxA, Lvhere a 4 is the number of states of the minimal automaton -d, of A. T h e sets A, are called the unitary compoizents of A. From the definition of the minimal automaton it follows readily that the unitary components of A are simply those equivalence classes under the right congruence which are contained in A.
-,
EXAMPLE 1.1. Let .Y consist of a single letter
-4
=
1
u 02 v
0
and let
dfT"
T h e minimal automaton is
03.
- 0 ~ O ~ O ~ 0 1
and thus the unitary components arc 1, d,and d o * . However, we also have the decomposition ,.1 =
(g')"
u
.y,y
into two disjoint unitary sets. T h e minimal automata are
i
I
IV. Structure of Recognizable Sets
78
This shows that the unitary components do not necessarily give thc “smallcst” decomposition. EXERCISE 1.I. Show that the intersection of two unitary subsets of C” again is unitary. 2. Prefixes
the following conditions PROPOSITION 2.1. For any subset A of I*, are equivalent: (i) s-lA = 1 for all s E A . (ii) A n .45+ = 63. (iii) If s, st E A , then t = 1. (iv) If s,t, = sat, with sl, s, E A , then s, = s,, t ,
If A (v)
f @,
A-1A
Proof,
=
t,.
then also the following cotidition is equivalent to the above:
=
1.
T h e verifications are immediate and are omitted
I
A subset A of 1” satisfying conditions (i)-(iv) above is called a prefix. T h e following properties of prefixes are clear :
(2.1) Each prefix is a unitary set. (2.2) fl is a prefix. (2.3) If A is a prefix and 1 E A , then .4 (2.4) Any subset of a prefix is a prefix.
=
1.
EXAMPLE 2.1. For each integer k 3 1 the set Ckis a prefix. Further S’ is a maximal prefix, i.e., no subset A of 2%properly containing Zkis a prefix. EXAMPLE 2.2.
With L = {cr,
A
=
T }
{C’Y
consider the set
I ?I 2 l }
It is a prefix. PROPOSITION 2.2. For any subset A of Sx, the following properties are equivalent:
2. Prefixes
79
-4 is a prefix. (ii) The ?iiinimal automaton d,is enipt-y or has the form ( Q , i, t ) with t a single state and tl: = 0. (iii) A is the behavior of a deterministic (possibly infinite) automaton ,u/ = ( Q , i, T ) with T L = 3. (i)
Proof. (i) = (ii). Assume A f @. Since s-lA = 1 for all s E A , it follows that 1 is the terminal state of -dA,. Since o-'1 = for all B E S it follows that 1 . S = (ii) 3 (iii). Obvious. 3 we have TL'+ = It follows that if (iii) = (i). Since TZ s E A and t E ST, then is E T , ist = @, and therefore st $ A. T h u s A n A S += and thus A is a prefix I
a.
a.
PROPOSITION 2.3.
If .4, u A , is a prefix in 3,then .4,B n A,B
=
( A l n A,)B
for an)' subset B of L*. I n particular, (f A , and A , are disjoint, then A,B and A,B are disjoint. T h e inclusion ( A , n A,)B c A,B n A,B is clear. Assume A,B n A,B. Then s = alb, = a&, with a , E A , , a, E A,, b, , b, E B. Sincc A , u A , is a prefix we must have n, = a2 and b, = 0,. T h u s S E ( A , n A2)B I Proof,
s
E
PROPOSITION 2.4. For u~zysubset R of
A,>= '4
-
I*the set
'4Zf
is a prefix and '4 itself is a prefix i f and only i f .4 = .dl>. I f A is no?iempty, then so is A I , . If A is recognizable, then so is A,, and cxA, 5 (1'4 Proof. Since , 4 1 L + c A S * it follows that AP n ApZ+= @ so that dIJis a prefix. If A f D, then the shortest word s in A is not in .4Zj and thus s E A,,. Let ,CJ = (Q, i, T ) be any deterministic automaton such that be removing I SY' I = A. Let -d;. denote the automaton obtained from all edges t + q with t E T. T h e n it is manifest that
I
d,,1 = RI,
IV. S t r u c t u r e of Recognizable Sets
80
Taking d to be the minimal automaton of A , the last conclusion of the proposition follows I EXERCISE 2.1. Show that a subset A of Z* is a prefix iff wheneaer B,, B , are disjoint subsets of Z*, the sets AB, and A B , are disjoint. EXERCISE 2.2. Let A be a non-empty prefix. Show that A B is a prefix (vesp. is unitary) i f f B is a prefix (resp. is unitary). EXERCISE 2.3. Assume that P,C, = P,C, where P,, P, are non-empty prefixes in I*and C , , C2are subsets of Z* containing 1. Show that P , = P , , C , = C , . Give a counterexample $ 1 $ C,.
let 0: Z* + M be EXERCISE 2.4. Let A be a non-empty subset of 9, the syntactic morphism of iZ with A = Be-,, B c M . Show that A is a prefix iff 1e-l = 1 and B-IB = 1. EXERCISE 2.5. Let 4. c EXERCISE 2.6.
X+.Show that (At),,
=
A,,
Show that 1 E ,4 iff AF> = 1.
Let P , , Qi be prefixes in Z* for i = 1, 2. Show that P;'P, = @ and Pg'P, = (3,then PIQ,* u P,Q,* is a prefix and P,Q,* n P,&* = 0. EXERCISE 2.7.
if
Show that the class V+ is the least class such that: EXERCISE 2.8.
of all recognizable prefixes
i72
(i) k;? E 7'. u E 3 for each u E .Y. (ii) I f P , P' E P' and u - ~ P=' [3, then P' u UPE 2'. (iii) If P, P' E y' and P-IP' #, then P*P' E '9. (iv) 1
3. Unitary Monoids
A unitary monoid is a subset of I*which is unitary and is a submonoid of Z*. PROPOSITION 3.1. For any non-empty subset A of P,the following conditions aye equivalent:
3. Unitary Monoids
(i) (ii) (iii) (iv)
81
A is a unitary monoid. A is unitary and 1 E A. s-'A = A for all s E A. I f s E A , then st E A q and only (f t
E
A.
T h e implication (i) 3 (ii) is trivial. (ii) implies s-'A 1-lA = A for all s E A thus proving (iii). Statement (iv) is simply a reformulation of (iii). Assume (iv). Clearly A is closed under multiplication. Since A is not empty we deduce that 1 E A. T h u s A is a submonoid of 1". Since s-'A = A for all s E A , it follows that A is unitary. T h u s (i) holds I Proof,
=
PROPOSITION 3.2.
For any subset A of S", the following conditions
are equivalent:
A is a unitary monoid. The minimal automaton LdA, has a single terminal state which coincides with the initial state. (iii) A is the behavior of a deterministic (possibly infinite) automaton d = (0,i, i ) with a single terminal state i which is also initial. (i) (ii)
This is an immediate consequence of Proposition 1.1 and the fact that any one of the conditions (i)-(iii) implies 1 E iZ I EXAMPLE 3.1. Let S = {a, T } . For each s E S" let I s lo and I s I r . denote the number of times a and T appear in s. T h u s I s I = I s lu I s IT. T h e set
+
M=
{SIS€S",
/SI,=
ISIT}
is then a unitary monoid. Similarly unitary monoids are obtained by imposing the condition k I s lo = 11 s IT for some integers k 2 0, 12 0. Condition (iv) of Proposition 3.1 is the most convenient one to verify. PROPOSITION 3.3.
If A is a prefix and a unitary monoid, then A
=
1.
Indeed, since A is a submonoid it follows that 1 E '4. Since .4 is a prefix, it follows that A = 1 I PROPOSITION 3.4.
For any non-empty unitary subset A of L'* the
set
A.1,
=
A-'A
IV. Structure of Recognizable Sets
82
is a unitary monoid, and
A
=
ApAAII.
I f , further, A is recognizable, then so are AIJ and AAIland uA,, 5 (LA, aALlf5 uA. Proof. Let &'= (Q, i, t ) be the minimal automaton of A. Then A = i-It and iA = t. Therefore
I (Q, t , t ) I = t It
=
(iA)-'t
=
A - l ( i - l t ) = A-'A
=
This shows that Anf is a unitary monoid. If A is recognizable, then Q is finite and thus A, is recognizable. Further (*A, 5 card Q = (LA.T h e inequality " A p 5 aA has been proved in Proposition 2.5. Each successful path c : i + t in a ' admits a unique factorization
i - tP- t with p shortest possible. Then I p A = A141 I PROPOSITION 3.5.
in L'*, then the set A
1%
1
E
AP and 1 m I
E
A.3I. This implies
If P is a prefix in Sx and M is a unitary monoid PM is unitary and P = A!, , M = A J I .
=
Proof. Let a E A and let t E a-IA. Then a = p m with p E P , m E M , and at E A. Since pmt E PM and P is a prefix it follows that mt E M . Since M is a unitary monoid, this is equivalent with t E M . Conversely if t E M , then nit E M and at = pmt E PM = A. T h u s a-'A = M . This proves that A is unitary and that A -'A = M . T h u s M = A.,f. Let p E P. Since 1 E M it follows that p E A . If p E AS+ = P M P , then p E PS+ which is impossible since P is a prefix. T h u s p E A - AZ+ = A p . Conversely let p E A - AL'+. Since p E PM, it follows that p = p ' m with p' E P c A. However p $ AS+. T h u s m = 1 and p = p'. T h u s pEPandP=A, I EXERCISE 3.1.
Show that the intersection of two unitary monoids is
a unitary monoid. EXERCISE 3.2.
Let A be a subset of Zx with minimal automaton = I ( Q , t , t ) I. Show that for each
d =( Q , i, T ) . Let t E T and let M s E A such that is = t we have M
=
{ m I sm
s>
4. The Decomposition Algorithm
83
Show that a unitary set A is a unitary monoid z f f AA,[and z f f A p = 1 .
EXERCISE 3.3.
A
=
EXERCISE 3.4.
Let M be a unitary submonoid of 2". Define
U = { s E S " I S ( M - 1) c M - l }
v = {s E z'" I s(2"
-
M ) c 2"
-
M}
Show that U and V are submonoids satisfying
M = U n V
u-'V EXERCISE 3.5.
c
v,
V-1U c
u
For any subset A of 1" define
M = {sEz'"Is-'A=AJ B
=
A
-
( M - 1)A
Establish the following facts:
M is a unitary monoid. (i) (ii) s-'B = B s = 1. (iii) A = MB. (iv) A is recognizable iff M and B are. a M 5 uA, aB 5 (LA. (17)
4. The Decomposition Algorithm
THEOREM 4.1.
Each recognizable subset A of 2%admits a decompo-
sition
(4.1)
A
=
P,M, u . . . u P,%M,,
(4.1)
where, for 1 5 j 5 n, P j M j are the unitary components of A , Piare nonempty prefixes, and M j are unitary monoids such that
This is an immediate consequence of the definition of the unitary components and of Proposition 3.4 I
IV. Structure of Recognizable Sets
84
Observe that pj = 1 or M j = 1 or P j = M j = 1 are not excluded. In order to push the decomposition of A further, we consider any subset A of Z+. Then we have the partition
with some of the sets Ao-' possibly empty. PROPOSITION 4.2. If A is a recognizable subset of Z*, then Ao-l is
recognizable and a(An-') 5 crA
(4.3)
If further '4 is a non-empty prejix, then a(Ao-') < uA
(4.4) Proof,
Let d
=
((3, i, T ) be the minimal automaton of A. Define Ldo-l =
((3, i, To-')
where Ta-' = {q I q E (3, qn E T } . The fact that I I = An-' is clear and this implies (4.3). If A is a non-empty prefix, then, by Proposition 2.2, T = t is a single state and there are no edges issuing from t. Consequently in the automaton &'o-' the state t is no longer coaccessible and can be removed. This implies (4.4) I T h e decomposition algorithm started in Theorem 4.1 now continues as follows. In each of the components P j M j for which P, f 1 the prefix Pj is partitioned Pj = (J AJog U€Z
where Aj, = P j r l . There results a decomposition
PjM,
=
(J AjooMj "€Z
in which, by Proposition 2.3, the summands are disjoint. Since the sets Ajuare recognizable the process may be repeated for each of the factors A j u . Since by (4.2) and (4.4) a A J o< rxA
the process will terminate after at most rxA steps.
4. The Decomposition Algorithm
85
T o conveniently formulate the final outcome we introduce the notion of a unitary-prejix monomial (up-monomial for short). A up-monomial of degree k is a recognizable set of the form
U = MkakMkp,akp., . . . alMo
(4.5)
in which M k , . . . , M , are unitary monoids and each of the sets
Mka, . . . M i a i , is a prefix. If k
=
15i 5k
0, then U = M,. If k > 0, denote
U' Then
=
Mkak . . , a,M,
u = U'o,Mo
Since U'u, is a prefix and Mo is unitary, Proposition 3.5 asserts that U is unitary and that
U'a,
= up,
M, =
u,,,
while Proposition 3.4 asserts that U'u, and AT, are recognizable and "(U'O,) 5 (XU,
CLM,
5 (XU
From Proposition 4.2 it then follows that U' is recognizable and
CrU' < uu It follows that U' is a up-monomial of degree k - 1. It also follows that the representation (4.5) of U is unique and that k < uU. Combining the above remarks with the decomposition procedure we obtain: THEOREM 4.3. Each recognizable subset A of .P admits a disjoint decomposition A = U , u . . . v U,,
where U, (1 5j 5 n ) is a up-monomial of degree < U A
I
The decomposition of A obtained by applying the algorithm above is called the unitary-prefix decomposition (up-decomposition for short) of A. T h e up-decomposition does not attempt to dismember the unitary monoids that are produced on the way. This will be done in Section 6.
IV. Structure of Recognizable Sets
86 EXAMPLE 4.1.
Consider the set
A
= S"Z
with Z = {a, t}. T h e minimal automaton &is'
Thus A is unitary. T o obtain the decomposition
A=PM where P is a prefix and M is a unitary monoid we follow the procedures of the proofs of Proposition 2.4 and 3.4. If we remove all edges issuing from t , we obtain the automaton
and thus
P T o obtain M we consider &'but
M
= a*t
with t as both initial and terminal. Thus
1 u S"t = (a".)"
=
Thus A is a single up-monomial of degree 1
A
= M'tM
EXAMPLE 4.2.
with
With Z =
A
M'
{gl t}
= a*l
M
of Z*. T h e minimal automaton of A is
T h e decomposition of A into its components is = A,
(a".)"
consider the submonoid
= {a, U G T , TCT, zt}"
A
=
v A, u A,
87
4. The Decomposition Algorithm
where A i (i = 1, 2, 3 ) are the unitary sets whose minimal automata are
We notice that A , = M , already is a unitary monoid. The decomposition algorithm applied to A , yields
with M , and M , given by the minimal automata
L
l2
./l,
The algorithm applied to A , gives A ,
A,
=
=
A,oL'*. Thus
M,oM,oL'*
Conscquently the up-decomposition of A is
A
=
M I v M20M, v M20A!13aL'*
IV. Structure of Recognizable Sets
88 5. Bases of Unitary Monoids
A subset B of Z" is called a base if whenever
b,
. . . b k = b,' . . . bin
with b , , . . . , b k , bl', . . . , bk' E B, then k = k' and bi = bi' for all 1 5 i 5 k . Clearly if B is a base, then B c L'+.A submonoid M of Z* is free if there exists a base B such that M = B". Such a base is unique since B = ( M - 1) - ( M - 1)(M - 1) and we call B the base of M . In particular, if M = L'",then B = Z. T h e base B is said to be maximal if it is not a proper subset of any other base in Z". PROPOSITION 5.1. A unitary submonoid M of Z" is free and its base is the prefix ( M - l ) I J .Conuersely any prefix B f 1 is a base and B" is a unitary monoid.
Proof.
Given M , define
B = ( M - 1 ) - ( M - 1)(M- 1) We assert that B" = M . Since B c M we have B" c M . Assume s E M - B" and let s be shortest possible. Since s @ B and s E M - 1 it follows that s E ( M - 1)2 so that s = s,s, with s,, s, E M - 1. Consequently sl, s, E B* and thus s = s,~, E B" contrary to assumption. Now assume that M is unitary. Then m, mt E M implies t E M and therefore
B
=
( M - 1) - ( M - 1)2
=
( M - 1) - ( M - 1)Z+= ( M - I),,
This shows that B is a prefix and B f 1. The fact that M = B" is free follows from the next argument. Conversely assume that B f 1 is a prefix. We first show that B is a base. Indeed if b, . . . bk = b,' . . . bi, with b , , . . . , b,, b,', . . . , bi, E B, then since B is a prefix it follows that b, = b,'. Consequently b, . . . bk = b,' . . . b;, and the argument continues by induction. Next we show that M = B" is a unitary monoid. Let s, s t E M . Then s E B" and st E B" for some integers n, m E N . If n = 0, then s = 1
5. Bases of Unitary Monoids and t
E
89
M . Assume n > 0. Then m > 0 and s = b,
. . . b,, ,
st
=
c1 . . . c,,,
with b,, . . . , b,, , cl, . . . ,c,,, E B. Since B is a prefix it follows that n 5 rn and b i = c i for i = 1, . . . , n. T h u s t = c , + ~. . . c,,, E M and M is a unitary monoid I Observe that the case B = 1 was excluded, since 1 is not in the base of any free submonoid of 2'". However, B = @ is permissible, since B" = M = 1 is a unitary monoid and is free with an empty base. EXAMPLE 5.1. T h e monoid M = {a, or}" is free with base = {a, o r } which is not a prefix. Therefore M is not unitary. However, the reversal Me is free with base Be = {u, ~ u which } is a prefix. T h u s &I@ is unitary.
B
EXAMPLE 5.2. Let 9:S* + G be a morphism where G is a monoid. T h e n the kernel M = 19-l of pl is a unitary monoid. If G is a group and pl is surjective, then the base B of A2 is a maximal base. Indeed, let s E L'* - M . T h u s scp f 1 and there exists a t E 2" such that (sp)-' = t p . Setting m, = st, m 2 = ts we have m l , m, E M . Since m,s = sts = sm, it follows that s v B is not a base.
Free monoids may be used for coding purposes as follows. Let W be the set of all words in a language. T h e n the messages to be transmitted are elements of W". Given a free submonoid M of Sx with base B, a code is an injective function y ~ :TY + B. This function extends to a unique morphism 9'": W" + M . T h e fact that B is a base for M implies that 9" is injective, and this means that the coded message can be decoded in a unique way. However, unless A4 is unitary the decoding cannot start until the entire message has been received. If, however, M is unitary, i.e., B is a prefix, the initial segments of the coded message may be decoded as they are received. PROPOSITION 5.2. Let M be a unitary monoid in L'" and let B be its base. Then M is recognizable ;f and only ij B is recognizable. Further if M f 1, then rrn4 5 lrB 5 I r x ~ ~
+
IV. Structure of Recognizable Sets
90
Proof. Let &’ = (Q, i, i) be a deterministic automaton accepting M . We define the “unfolding” dv of d a s
d”= (Q u t , i, t ) where t is a state not in Q and where each edge q 5 i in d is replaced by an edge q 2 t in do. There are no edges issuing from t. T h e n dv is deterministic and from the construction it is clear that I &’v I = B. If d“ is chosen to be the minimal automaton of A , then card Q = (xM and thus aB 5 1 cwM. Next let B be a prefix and let -3’ = (0,i, t ) be a deterministic automaton such that tZ = 0 and I ~2’I = B. Since B # 1 we have i f t. Consider the automaton @‘ = (Q, t , t ) where for each edge i”. q a new edge t -% q is added in g.T h e n ‘8is deterministic and I G‘ I = B*. If B f 0 and 9 is the minimal automaton of B, then card Q = cwB and thus crM 5 aB
+
EXAMPLE 5.3. Let 11.1 = S*.Clearly M is a unitary monoid with = 1. T h e base of M is B = Z which is a prefix with U B = 2. T h u s aB = 1 cxM in this case.
cwM
+
EXAMPLE 5.4. With 2’= automaton &‘of M is
{(T, T
}
let M
=
1 u Z*T. T h e minimal
“CY+i‘3.
T h u s M is a unitary monoid with cxM = 2. Since M may also be written as M = (o*T)* and B = a*t is a prefix, it is the base of M . T h e minimal automaton of B is
uEo2o+ so that irB = 2. T h u s in this case trB do of d is
=
uM. Note that the unfolding t-+
a+
This automaton is not reduced since the states i and q are equivalent.
6. Iterated Up-Decomposition
91
The unfolding d vdefined in the proof of Proposition 5.2 may be called the "terminal unfolding of A?." There is a dual notion of an initial unfolding = (0 u i ' , i', i ) EXERCISE 5.1.
where i' is a new initial state with edges i' q added for each edge i 2 q in d. Verqy that 1 &'* 1 = M-1 and therefore IA,,'& I = ( M - l ) p = B. Use this construction to show that the equality uB = a M holds zff the minimal automaton S ' = (Q, i, i ) of M contains a state q such that I (Q, 9, i ) I = M - 1. EXERCISE 5.2. Show that a submonoid M of Z* is free iff
M-lM n M W 1 c M Since the opposite inclusion is clear, the inclusion may be replaced by an equality. Apply this to prove that the intersection of any family of free submonoids of Z* is again a free submonoid of P. 6. Iterated Up- Decomposition
Propositions 5.1 and 5.2 may be used to push the up-decomposition of a recognizable set further, by decomposing the bases of the unitary monoids appearing in the decomposition. Thus (4.1) will be replaced by
(6.1)
A
=
P,B,* u . . . u P,,B,,"
where each B, is the base of M , of (4.1). In the up-decomposition of A , the sets M , = B," were left alone and the algorithm continued to dismember the sets P,. Once this is done we can return to the sets M , and apply the up-decomposition to each of the prefixes B,. In iterating this procedure we encounter a curious problem of convergence that we shall now discuss. We have the inequalities
cxB, 5 1
+ (xM, 5 1 + rxA
Since B, is a prefix and B, f 1 the next step in the up-decomposition of B, is B, = (J (B,'T-~)'T nE.E
Since
a(B,a-') < uB,
IV. Structure of Recognizable Sets
92
we obtain
cx(Bjo-') 5 nA Since equality in this formula is a distinct possibility, we must look for some other way of expressing the fact that Bjo-' is "smaller" than A. Otherwise there is a possibility that the algorithm becomes circular and does not terminate. Let d =(Q, i, T ) be the minimal automaton of A. If P j M j is the unitary component corresponding to some state t j E T , then
and
M j = I 'gj1
with
Fj = ( Q , t j , t j )
T o obtain an automaton for Bj the unfolding 'gjV
=
(Q u t , t j , t )
is constructed. Each edge q A t j in 'gj is replaced by an edge q 5 t. An automaton for B j o - l is then
q?-'
=
(Q u
2,
tj,
tr')
The state t may now be removed since it is not coaccessible. We note that tap' in qv coincides with tjo-' in T h u s removing t we obtain the automaton 9 Y j , = (Q, t j , t j a - ' )
q.
derived from &' by removing all the edges q --t t j . Thus even though it is possible that u(Bjo-') = u A , the minimal automaton of Big-' will have fewer edges than that of A. This suffices to ensure the convergence of the algorithm. EXERCISE 6.1.
Iterate the decompositions of Examn$les 4.1 and 4.2.
7. Maximal Prefixes
A prefix A in .Y* is maxiiiial if it is not a proper subset of any other prefix in Z*. PROPOSITION 7.1.
A pre$x A in 2" is maxiwid
L* = AS*-' u AS"
and only ;f
7. Maximal Prefixes
93
i.e., and only if each s E 1%either is an initial segment of a word in A or has a word of iz as an initial segment. Proof.
Let s E L'" - A. Then clearly A u s is a prefix iff s E S" - (AS"-'
This yields the conclusion
uA P )
I
PROPOSITION 7.2. If A is a complete subset of S",then the prejix A,, is maximal.
We recall that A is a complete subset of Z" iff the minimal automaton .y'., is complete or equivalently if AL'"-' = 2". Let s E 2". Then s is an initial segment of some a E A. Some initial segment p of a is in A ,,. It follows that either s is an initial segment of p or vice versa. Thus s E u AIL'* and the conclusion follows from Proposition 7.1 I Proof.
PROPOSITION 7.3. A prejix B f 1 is maximal i f and only i f the unitary monoid M = B" is complete. Proof. If M is complete and M f 1, then so is M - 1. Since B = (M it follows from Proposition 7.2 that B is a maximal prefix. Conversely, assume that B is a maximal prefix and that M is not complete. Let s E S" be a shortest word such that M n sL'" = 0. Since B is a maximal prefix we have by Proposition 7.1
s E BE"-'
u RS"
If s E B P - I , then since B c M it follows that s E M P - ' contrary to the assumption ill n s S + = (2. Thus s E BE*, i.e., s = bt with b E B and t E S". Since B -f 1, we have b E Z + .Consequently I t I < I s 1 . Therefore M n t S * @, and thus tu E M for some u E 2". This implies su = btu E B M c iVl
+
contrary to assumption
I
Observe that 1 is a maximal prefix and the conclusion of Proposition 7.3 is valid for B = 1 ; however, B is then not the base of M = B".
IV. Structure of Recognizable Sets
94
We shall say that a subset A of S* is dense if Y+-IA\‘x-l
I
= 2”
or equivalently if any word in C+ is a segment of some word in A , i.e., if A n Z+sC* f @ for all s E C*. THEOREM 7.4. (Schutzenberger) Let M be a free submonoid of 2‘” with base B. If B is a maximal base, then M is dense. If M is recognizable and dense, then B is a maximal base.
Proof. Assume that M is not dense, i.e., that
M n PsC* = @
(7.1)
for some s E 2+.We shall prove that there exists t E P s Z * such that B u t is a base. If Z has a single letter, then (7.1) implies M = 1, i.e., B = 0. Thus B u t = t is a base. Thus we may assume that s = au and that C has at least one letter z f c. Let
This word cannot “overlap” with itself, i.e., t 2 + n X+t = tZ*t
(7.2)
Since s is a segment of t it follows that
M nC*tP
(7.3) and in particular t
E
a,,
=
0
C+ - B. T o prove that B u t is a base, assume
. . . ,a,,,
b,, . . . , b,, E B u t a1
f b,
a, . . . a,,= b,
. . , b,
Since B is a base, all these elements cannot be in B. Thus we may assume that a j = t and that J is smallest possible. Because of (7.3) it also follows that one of the elements b, , . . . , b,,, is t. Then let b, = t with k
7. Maximal Prefixes
95
smallest possible. If a, . . . a j = b ,
. . . bk
then since a j = b, = t it follows that a , . . . aj-l = b, . . . b,-l contrary to the assumption that B is a base. Thus we may assume that l a , . . . ajl < Ib,
. . . bkl
We thus have a , . . . aj_,tu = b, . . . bkp,t
for some u E Ci-. From (7.2) it then follows that u = vt for some z, This implies a , . . . aj-ltv = 6, . . . bRpl
E
C*.
contrary to ( 7 . 3 ) . Now assume that M is recognizable and dense and let &' = ( Q , i, T ) be a complete automaton such that I LP' I = M . Since M is recognizable, we may assume that Q is finite. Let
n
=
inf card(Qu)
with u ranging over 2" and choose u
n
=
E
Z* so that
card(Qu)
Since M is dense, we have vuw = m E M for some v,w E 2*. Since Qvu c Qu, it follows that card Qm 5 card Qu. Thus by minimality it follows that card Qm = n. Let Q' = p m . Since Q'm = Qmm c Qm = Q', it follows from the minimality of n that Q'm = Q' and thus m defines a permutation of Q'. Thus replacing m by a suitable power we may assume that q'm = q' for all q' E Q'. Let s E C* - B and let t = msm. Again we have Qt c Qm and thus Qt = Q' = Q't. Thus again for some power tP, p 2 1, we have q'tp = q' for all q' E Q'. T o prove that B u s is not a base it suffices to show that
tp = (msm)P E B* and for this it suffices to show that qtp = qm for all q E Q. Since qmm = qm, it follows that qt = qmsm = qmmsm = qmt and therefore that qtp = qmtp. Since qm E Q', we have qmtp = qm. Thus qtp = qm, as required I
IV. Structure of Recognizable Sets
96 PROPOSITION 7.5.
If B is a recognizable maximal p r e j x in Z+, then
B is a maximal base. Let M = B + . Then M is a recognizable unitary monoid with base B. Since B is a maximal prefix Proposition 7.3 implies that M is complete, i.e., M F - ' = Z+. Consequently L'+-'MZ+-' = S* and the conclusion follows from Theorem 7.4 I Proof,
Let M be a recognizable free submonoid of P. Then the following conditions are equivalent: PROPOSITION 7.6.
(i) M is complete. (ii) M is unitary and complete. (iii) M is unitary and dense. Let B denote the base of M . (i) => (ii). Let B , = ( M - l)!,. Clearly B , c B. Since M is complete, it follows from Proposition 7.2 that the prefix B , is maximal. Since M is recognizable, so is B,. Thus by Proposition 7.5, B = B,. Thus M = B+ is unitary. (ii) 3 (iii). Obvious. (iii) 3 (i). Since M is unitary, B is a prefix. Since L'+-'MZ*-' = Z* it follows from Theorem 7.4 that B is a maximal base and therefore also a maximal prefix. Thus by Proposition 7.3 the monoid M = B* is complete I Proof.
EXAMPLE 7.1.
With 2'
B
= {a, T }
consider the non-recognizable set
I
= {T'"~s sE
L'+}
Clearly B is a prefix and 2 * - L B= P . Consequently M = B* is a unitary monoid and L""-'M = Z*. Thus L*-lML'+-l = Z+, but M is not complete ( M n az" = 0) and this negates the implication (iii) * (i) in Proposition 7.6. Since B u a is a prefix and thus also a base, B is not a maximal base and this negates Theorem 7.4. Since M is free with base B, the reversal Me is free with base Be, and MeZ*-l = Z+. Thus Me is complete, but Be is not a prefix since BeZ+-* = P. Thus Me is not unitary and this negates the implication (i) => (ii) in Proposition 7.6. This example shows that the assumption of recognizability is essential in Theorem 7.4 and Proposition 7.6.
8. Recurrent States
EXERCISE 7.1.
97 With S = { a , T } consider a subset A of 2+and write
A
=
u A , u TA,
Show that A is a prefix zff both A , and A , are prefixes. Show that A is maximal ifJ both A , and A , are maximal prefixes. EXERCISE 7.2.
Let A be a prefix in S". Define
A' Show that A n A' EXERCISE 7.3.
=
= @
[S"
-
(AZ"p' u AS")],,
and that A u A' is a maximal prefix.
Given two bases A and B in 2" define
A 0B
= base
of A* n B X
(see Exercise 5.2). Show that the set of all bases in 2" is thus converted into a commutative monoid with S as unit element and @ as zero. Show that prefixes, recognizable bases, and recognizable prefixes form submonoids. Verifr that ZP0 2 q = Zr, where r is the least common multiple of p and q. Show that if A' c A , then A' 0 B c A 0 B. EXERCISE 7.4.
Show that a subset A of Z* is a maximal prefix
2 .
the sets
AZ 1-
~
l,
A , AS+
form a (disjoint)partition of 2'". 8. Recurrent States
Let Q be a right Z-module. An element q E Q is said to be recurrent if for each u E 2" there exists v E 2" such that quv = q. Equivalently q is recurrent if (8.1)
qZ+ = quS"
for all
u
E
S*
In particular, qu f @, i.e., qS" is a complete right Z-module. Let d '= ( Q , i, T ) be a finite, complete, coaccessible Z-automaton and let Tcecdenote the set of all states in T that are recurrent. Then the automaton ( Q , i, Tree) also is coaccessible. PROPOSITION 8.1.
IV. S t r u c t u r e of Recognizable Sets
98
Proof. Let q be any state in M and let Q' be a minimal non-empty submodule of qZ*. Since M i s coaccessible Q' must contain a terminal state t . Let u E 2". Since is complete we have @ f tu2" c tZ" c
Qt
and thus by the minimslity of Q' we must have tZ* recurrent. Since t E qZ# the conclusion follows I
=
tuC". T h u s t is
PROPOSITION 8.2. Let A be a recognizable subset of C x .If A is not complete, then:
(i)
there exists s E 2" such that
l s J -( M A A n sCx = 0 If A is complete, then: (ii) for any s, s'
E
Z x , there exist u, 14' E Zx such that
I u I < aA, su -.,
I u' I < rxA sus'u'
su(s'u')+ c
A
Proof, Let d '= (Q, i, T ) be the minimal automaton of A . First consider the case A = 0. T h e n (i) holds with s = 1. Assume now that A f 0 and that A is not complete. Then qa = 0 for some q E Q, a E 2. Since q is accessible we have iu = q for some u E Z". Further u may be chosen so that the path i + q with label u has no repeated vertices, and thus 1 u 1 txA. Setting s = ua we have isC* = and thus A n sZx = @. Next consider the case when A is complete. Let s, s' E 2" be arbitrary. By Proposition 8.1, there exists a recurrent terminal state t such that is is coaccessible from t , i.e., such that isu = t for some u E C x . Further u may be chosen so that I u I < U A .Since t is recurrent there exists u' E Z* such that ts'u' = t and again u' may be chosen so that I u' I < aA. I t follows that su -., sus'u' and that su(s'u')P E A for all K 2 0 -/
PROPOSITION 8.3. For any unitary submonoid M of properties are equivalent:
(i)
M is complete.
P the following
99
References
(ii) The base B of M is a maximal prejix. (iii) The minimal automaton of M is complete. (iv) In the minimal automaton of M all states are recurrent. (v) In the minimal automaton of M the initial state is recurrent. (vi) M is the behavior of a deterministic automaton d = ( Q , i, i ) with i a recurrent state. (i) e (ii). Proposition 7.3. (i) + (iii). Proposition IIIJ.4. (iii) 3 (v). Since is complete and coaccessible, it follows from Proposition 8.1 that .dtf has a recurrent terminal state. Since in dAr the initial state is the only terminal state it follows that the initial state is recurrent. (v) o (iv). Since dA, is accessible and i is recurrent, all states in M',, must be recurrent. (v) => (vi). Obvious. (vi) 2 (i). Since i is recurrent it follows that for each s E 2" there exists t E Z" such that ist = i. Thus st E M , and s E Mt-' c ML'"-' I Proof.
EXERCISE 8.1. Let A be a subset of 2". A n element a E A will be called recurrent if the terminal state a - l A of the minimal automaton is recurrent. Let Arc"be the set of all recurrent elements of A. Show that (Arec)rec = Arec
Show that if A is recognizable and complete, then so is A'"".
References
T h e notion of a prefix is well known in coding theory. T h e idea of the up-decomposition grew out of conversations of the author with C. C. Elgot. B. Tilson, T h e intersection of free submonoids of a free monoid is free, Semigroup Forum 4 (1972), 346-350.
This is the source of Exercise 5.2. 'The first statement of Exercise 5.2 was already known to M. P. Schutzenberger ("Une theorie algkbrique du codage," Seminaire Dubreil-Pisot, Paris, 1955/56). Schutzenberger's Theorem 7.4 appears here for the first time.
CHAPTER
v The Integers
I t is natural to expect that the integers, and particularly the set N of non-negative integers, play an important role in computing. This chapter deals with the integers, the various ways of writing them, and the related notions of recognizability. 1. The Monoid N
+
We denote by N the monoid of all integers n >_ 0 with as monoid operation. T h e unit element of this monoid is the integer 0. T h e monoid N clearly is isomorphic with Z* with Z consisting of the single letter u. T h e unique isomorphism N = Z* assigns to each integer n E N the word s = un of length n. A complete accessible Z-automaton d must have the following form
with qo as initial state and with the set of terminal states T to be chosen arbitrarily. T h e integers s 2 0 and p > 0 are called the stem and the period of .-d. It is understood that if s = 0, then ro is the initial state. Thus
Q = Q' u Q" 100
1. The Monoid N
101
T h e terminal set T breaks up accordingly
T
=
T' v TI',
T'
=
T n Q',
T"
=
T n Q"
c
With each recognizable subset A of N we may thus associate the pair
( p , s) indicating the period and the stem of its complete minimal automaton d.lc. T h e (not necessarily complete) minimal automaton ,d., coincides with d.lC except when A is finite. I n the latter case Ld-, has the form
is with qs-l (and possibly other states) terminal, while dAtc
with r0 a non-terminal sink state. ' is easily calculated. Each state Y T h e behavior A of the automaton L qi E T ' contributes a single element, namely 4, while each state r i E T" contributes the set as+i(up)*. We thus find
A
=
B u C(O~)'
with
Transcribing this from the multiplicative notation in L'" to the additive notation in N we have
PROPOSITION 1.I. For any subset A of N the following conditions are
equivalent : (i) (ii)
A is recognizable. A is ultimately periodic, i.e., there exist integers n o , p nEA-n+pEA
f o r all
n2no
E
N such that
V. The Integers
102
(iii) A is the union of a finite set and of a finite number of arithmetic progressions all of which have the same period (i.e., increment). (iv) A is the finite union of arithmetic progressions. Proof. (i) 3 (ii). This follows from formula (1.1) if we choose no so that b < no for all b E B. (ii) * (iii). Define
B= {nInEA, n<no} C
=
{n I n
E
A , n, 5 n < no +p.}
Then (ii) implies that
A = B u (C+p") Thus (iii) holds. (iii) * (iv). Obvious. (iv) => (i). An arithmetic progression in N has the form c p" and is recognizable by one of the automata described above. Thus as a finite union of recognizable sets A is recognizable I
+
Since N is commutative, the right congruence -;I of A and the syntactic congruence of A coincide. Both are given by
nmS4m
iff
n+iEAc-m+iEA
for all i E N . T h e syntactic monoid M., of a recognizable subset A of N can easily be read from the automaton d =dAc. It is the cyclic monoid with a single generator c and a single relation
T h e monoid has s
+ p elements 1,
(T,
(Tz,
. . . , c a + p -1
and is denoted by Z(p,y,. If s = 0, then Z ( p , s is , the cyclic group Z, of order p. If s > 0, then, in addition to the unit element, Z,,,,, contains one idempotent element, namely i = us+l, where 0 5 15 p and s 1 3 0 modp. T h e elements us, . . . , as+p-* then form a cyclic group
+
2. Integers a t Base k
103
p with i as unit element. If p
1 , this group is trivial and C T ~= osfl is a zero for the monoid Z ( l , y )It . is worth mentioning that the monoid Z ( p , s may , be viewed as a submonoid of the direct product
of order
if we identify CT with the pair is the generator of Z(l,s).
(t,y )
=
where
t
is the generator of 2, and y
EXERCISE 1.I.Show that any finite monoid M that is cyclic (i.e., is ) described above. generated by a single element) has the form Z ( p , sas
Let A l be a non-trivial submonoid of N and let p be the greatest common divisor of all the non-zero elements of M . Show that M c pN and the dtgeerence pN - M is a finite set. Deduce that M is recognizable. Deduce that M is finitely generated, as a monoid. Construct examples showing that the minimal number of generators for M may be arbitrarily large. EXERCISE 1.2.
+
Let A be a subset of N such that n A c A for some integer n E N , n # 0. Show that A is recognizable and that A = C n" for some jinite subset C of N . [Hint: Consider the sets Dk = {iI 0 2 i < n, k n i E A } for k E N . ] EXERCISE 1.3.
+
+
EXERCISE 1.4.
Show that in (ii) of Proposition 1.1 the weaker condition
n E A s n + p E A
for all n L n ,
suffices. 2. Integers a t Base k
T h e method of recording integers as elements of 2" with Z consisting of one letter CT,has the property that for each integer n the corresponding word s E 2" has length n. This amounts to recording the number 15 by making fifteen vertical strokes. For practical reasons it is useful to increase the size of the alphabet 2 and in return reduce the length of the word representing any given integer. T h e usual way of doing this is to use expansions at some base k > 1.
V. The Integers
104
Given an integer k 11 we consider the alphabet
k = {0,1, . . . , k - l } the elements of which will be called digits at base k . I n order not to confuse the digit 1 E k (if k > 1) with the unit element of k", the latter will be denoted by A . For k > 1, the function v p : k"
+
N
is defined by setting
if
s=do
... dn,
d , E k for O s i s n
This function satisfies
Av,
(2.2)
=
dvp = d
0,
+ tvp
(st)vp= klll(svp)
for for
s,
d
E
k
t
E
k"
T h e integer svp is called the standard interpretation of the word s E k". T h e function v, is surjective but not injective. Indeed we have
(2.31
(Os)vp = s v p
T h e words in the set
Pp
=
k'
- Ok"
are called proper; they do not start with a zero. T h e function vk maps Pp bijectively onto N . For each integer n E N the word s E Pp such that svp = n is called the expansion of n at the base k and is denoted by [ n I k . This is the shortest s E k" with svp = n. T h e description given above to expansions at base k differs from the usual one in only one respect: the expansion of 0 E N is A E k* and not 0 E k as is customary. T h e notation svp will frequently be replaced by the shorter notation ( s ) ~ ,or even still shorter notation (s) if there is no doubt as to what the I 1 is. Similarly we shall write [n] instead of [.Ip. base K '
2. Integers at Base k
105
T h e following description of k" by means of pairs of integers is frequently useful. Since each element s E k" is uniquely described by the pair of integers ( % , I s I) and since
< kl*l
svk
we can identify k* with the set of all pairs
satisfying x < k.!'
Multiplication in k" is then given by the formula (2.4)
(x, y)(.',
y')=
(WX
-1.- x', y
+y')
T h e above representation of k" will be called the standard pair-representation. PROPOSITION 2.1. Let 2 a morphism
=kp
rp:
with k > 1, p
I"
+
0. There exists then
k"
such that the triangle
1"
k*
commutes. The morphism is injective. Proof, Using the notation ( X , Y ) ~for the elements of the pair representation of k" and similarly for I" we define
V. The Integers
106
T h e inequality .r: < 1" then implies x < kp!'. T h e facts that yj is a morphism and that the triangle commutes are clear I T h e formalism described in this section fails for k formula (2.1) should be replaced by
sv1
=
=
1. In this case
IsI
and consequently
[n],= 0" This is the expansion at base 1. In this case v , is bijective and
P,
=
O*.
Several interpretations other than the standard one will be discussed in Section 6. EXERCISE 2.1.
Show that the morphism asserted in Proposition 2.1 is
unique. EXERCISE 2.2. For each s E k*
(k > 1) define the matrix
kl.1
sA =
[l,,,
0 11
Show that iis an injective morphism
of k* into the monoid of 2 x 2-matrices with entries in N . 3. k-Recognizable Sets PROPOSITION 3.1. Let k > 1. For any subset A of N the following properties are equivalent :
The set A Avi' is recognizable. [ A ] , = A^ n Pk of all the expansions of elements of A is The set (ii) recognizable. (iii) There exists a recognizable subset A' of k" such that A'vk = A. (i)
Proof. (i) 3 (ii), Since Pk is recognizable, this follows from the fact that the intersection of two recognizable sets is recognizable.
3. k-Recognizable Sets
107
(ii) 3 (iii). This is clear since vk maps [A],.onto A . (iii) = (i). We observe the identity
Since A' is recognizable, the bracketed set is recognizable by Proposition III,3.1, and thus -4 is recognizable by Exercise III,8.3 or Kleene's Theorem of VII,6
If the conditions (i)-(iii) of Proposition 3.1 are satisfied, we say that the subset A of N is k-recognizable. COROLLARY 3.2. The class of k-recognizable subsets of N is closed under Boolean operations I PROPOSITION 3.3. A subset A of N is k-recognizable the equivalence relation
n,
-.i,t
n,kr
+i
nl , n,
n2,
E
if and onZy if
N
dejined by the condition
for all r E N , 0 5 i
E
A
0
+i E A
npkr
< kr, i s j n i t e .
Proof. Let j , and j p be integers such that nl /:kil for 1 = 1, 2. T h e n in the pair notation ( n l , j l )are elements of k". Further
( i , r ) ( n , ,j , ) = (nlkr
+ i , r +j , )
Consequently
(i, r ) E ( a , i - * A 9
holds iff
(nlkr
+ i, r + j l ) E
or equivalently iff ntk'
+i
E
A
T h u s the finiteness of the equivalence relation - A , , k is equivalent to the finiteness of the family of sets { ( n , j ) - I A } , i.e., to the recognizability of A I
V. The Integers
108
PROPOSITION 3.4. If A is a recognizable subset of N , then A is also k-recognizable for all k -, 1.
Proof. By Corollary 3.2 the union of two k-recognizable sets is krecognizable. Also if A is a single element of N , then [ A ] is a single element of k". T h u s A is k-recognizable. In view of Proposition 1.1, it suffices to consider the case when A is the arithmetic progression
A=c+P" for fixed c , p E N , p > 0. For any r E N , 0 5 i, we have nk7
+iE A
iff the following two conditions hold nkr
+i 2c
nk'f i = c modp Thus if n, , n, satisfy
n, 2 c,
n, = n2 m o d p
n2 2 c,
n2. Consequently the equivalence relation then n, wad,, and thus A is a k-recognizable by Proposition 3 . 3 fl EXAMPLE 3.1.
is finite
Consider the subset of N
A = {k" I n E N ) with k > 1, an integer. This set is not recognizable, since it does not contain any arithmetic progressions. However, [k"]k
=
10"
so that
[ A ] ,= l(0") and thus [Alpis recognizable. Thus A is k-recognizable. EXAMPLE 3.2. Let s be any element of k" recognizable subset of kX. Since
~
Ok". Then
sX
is a
3. &Recognizable Sets
109
Thus if s 11, the gaps in the sct . , s " ) ~ increase in a manner sufficient to ensure that <s*)* contains no arithmetic progression. Since :s+),. is infinite, it follows that the set < s * ) ~is not recognizable. It is, however, k-recognizable.
Let 1 = kp with k > 1, p >; 0. A subset A of N is k-recognizable ;f and only if it is I-recognizable. PROPOSITION 3.5.
Proof. Consider the morphism q ~ :1"
4
k+ of Proposition 2.1. Since
it follows from Proposition 11,3.2, that if Avil is recognizable, then so is Av;'. Next observe that
[AILPJk = A If A is I-recognizable, then [ A ] ,is recognizable. Since p is injective it iollows from Proposition II,3.3 that A' = [AIlpis a recognizable subset of k + . Since A'vk = A it follows from Proposition 3.1 that A is k-recognizable I We shall say that the integers k > 0 and I > 0 are multiplicatively dependent if lq = kp for some integers q >: 0, p > 0. Otherwise, k and I are said to be ntiiltiplicatively independent. A consequence of Proposition 3.5 is:
If k and 1 are multiplicatively dependent, then every k-recognizable set is also I-recognizable I C O R O L L A R Y 3.6.
This corollary has a remarkable counterpart which we state without proof. T H E O R E M 3.7. (Cobham) If k and I are multiplicatively independent, then every set which is both k- and I-recognizable is recognizable I
110
V. The Integers
4. Iteration PROPOSITION 4.1. Let A be an infinite k-recognizable subset of N with k > 1. There exist then integers a, b, c, d E N with b > 0, d > 0 such that knd - 1 en = aknd b kd - 1 + c
+
is in A for all n E N . Proof. Let B = [ A ] ,c k*. Since A is k-recognizable and infinite it follows that B is recognizable and infinite. Then, by Corollary 113.2, there exist elements u, w , v E Z* such that w 1 > 0 and uw"v E B for all n E N. Let el, = (uw'lv). Then ell = aknd with d
=
+ b(l + K" + . . + k",+'jd)+ c
1 w 1, a = (u)k("), b = (w)k("),and c = ( v ) I
COROLLARY 4.2. Let A be an injinite k-recognizable subset of N with k > 1. There exist then rational numbers a , b and an integer d E N such that a > 0, d > 0 , and
+bEA
e,L= akTId for all n E N
I
PROPOSITION 4.3. Let A be a k-recognizable subset of N consisting entirely of prime numbers. Then A is finite.
Proof. Indeed, assume that A is infinite. With the notation of Proposition 4.1 we have e n f r= e,
+ akd(kTd- 1) + bknd
krd - 1 kd - 1
Choose n so that kd and kd - 1 are not divisible by the prime e n . Then choose Y E N so that Krd = 1 mode, With these choices, it follows that en+?is divisible by e,l. Thus entr is not a prime, contrary to assumption I
111
5. Gap Theorems COROLLARY 4.4.
k>1
The set of all primes is not k-recognizable f o r any
I Give examples in which b < 0, b
EXERCISE 4.1.
=
0, b > 0 in Cor-
ollary 4.2. 5. Gap Theorems
Let A be an infinite subset of N , and let
ao
R,,
ai+1 = lim sup -
i-+m
ai
or by considering consecutive differences and defining
D.i = lim sup(ai+, - a i ) i+m
Observe that the quantities R., and D., are not entirely independent. We have (5.1)
D-.l < 00
implies
R,
=
1
+
Indeed, assume R, > 1. Then for any E > 0, ai+l > a i ( l E ) holds for infinitely many indices i. Thus a j + ]- ai > &ai for infinitely many indices i. Therefore lim sup(ai+]- a i ) = 00. PROPOSITION 5.1.
If A is recognizable, then R,
=
1 and D A < 00.
Proof. Since A contains an infinite arithmetic progression, Thus R.4 = 1 by (5.1) I
D d < 00.
PROPOSITION 5.2. If A is an injnite k-recognizable for k > 1, then A contains an injinite subset
A'
= (ao'
< a,' < . . . < ai'< . . . }
V. The Integers
112
such that a:+, = kd lim ai
(5.2)
n+m
for some integer d > 0. Proof.
= e,, =
Let a,'
4 + 1 --
aknd -
a,'
with lim c, = 1
+ b be as in
Corollary 4.2. Then
akOl+l)d + b = kdC, ak"" b
+
I
PROPOSITION 5.3.
If A is k-recognizable for some k > 1, then
R;! < 00. Proof, Consider the subset A' of A given by Proposition 5.2. For all i sufficiently large we must have
ail 5 a i < a i t l I for some j
E
N . Since Ui,.l/Ui
I Uj+l/Uj'
and since j approaches infinity as i approaches infinity, it follows that lim sup a i + l / a i5 ki i+m
EXAMPLE 5.1.
I
If a, = i ! , then the set A is not k-recognizable for
any k > 1. Indeed a i + l / a i= i -}- 1
and thus R.,
= 00.
THEOREM 5.4.
T h e same argument applies if ai
=
ii.
If A is k-recognizable for some k > 1, then either
or
(5.4) The two possibilities are mutually exclusive.
5. Gap Theorems
113
T h e last statement follows from (5.1). Define
Proof,
R
=
[ A ] u Ok"
and consider the following condition :
(5.5) For each
s E Z*
there exists an integer
p,
E
N such that
s-IB n k p # @ for all
p 2 p,.
Assume that (5.5) does not hold. Then for some s E Z* the set
D
{ p I s-'B n kp = 0)
=
is infinite. T h e complement of D is the image of s-lB under the very fine morphism k" + N given by t + I t I. Thus D is a recognizable subset of N and since it is infinite it must contain an arithmetic progression {a rq I q E N } , with Y : , 0. Replacing s by st with I t I = a Y we obtain s E Z+ and s-'B n krq = @
+
for all q
+
E
N , or equivalently
B n skrq =
(ZI
for all q E N . Since Ok" c B it follows that s E k" - Ok*, and thus [n] for some n E N , n > 0. Consider any integer of the form
s =
s = nkrq
+ c,
0 5 c < krq
Since [x] E skrq it follows that [x] 4 B and thus .r: 4 A . Consequently A has no elements in the interval
Thus for sufficiently large aj
Y
we must have
< nk'" < ( n
+ l)W 5
for two consecutive elements a i , ai Qi+lbi
which proves ( 5 . 3 ) .
> (n
ai+l
of A. Consequently
+ 1)in
V. The Integers
114
Next assume that (5.5) holds. Since B is a recognizable subset of k*, the family of sets {sr’B} is finite. Thus, in (5.5), p o may be chosen uniformly for all s E k*. Now let n E N , n > 0 be arbitrary and let s = [ n ] . T h e n st E B for some t E k”0. Since s .f A and s 4 OK*, it follows that st 4 Ok* and thus st E [ A ] . Consequently ( s t ) E A and thus
nk”0
+ (t)
E
A
where 0 5 t < k”0. Thus A has at least one element in each interval
nkPo 5 x < ( n
+ l)kPn
for all n > 0. T h u s lim ~ u p ( a ~ +ai) ~ 5 2kP0 COROLLARY 5.5.
I
If lim aitl/ui = 1 lI+cu
and lim sup(aitl
-
ai) = 00
ii+m
then the set A is not k-recogniza6le f o r any k > 1 EXAMPLE 5.2. Let a i = it’ where 6 > 1 is a fixed integer. Then A is not k-recognizable for any k > 1. Indeed, ai+,/ai = [l (1 /i)I6while ai+,- a i > i6.
+
EXAMPLE 5.3. Let a ibe the ith prime number p i (counting 1 as the 0th prime po). Sincc for any integer n > 1, the sequence
n ! + 2 , . . . ,n ! + n contains no primes, it follows that lim sup(pi+] - pi)= )7
00
+a
T h e fact that pi+l/pj+ 1 is a well-known consequence of the Pritne Number Theorem. Consequently A is not k-recognizable for any k > 1. T h e proof given in Proposition 4.3 is preferable because it proves a stronger result by more elementary means.
6. O t h e r I n t e r p r e t a t i o n s
115
EXERCISE 5.1. Let k and I be multiplicatively independent integers, k > 1, 1 > 1. Show that the set A = {ki 1 i E N } is k-recognizable but not I-recognizable. [Hint: Use Proposition 5.2. Note that this i s a special case of the (unproved) Theorem 3.7.1 6. Other Interpretations
I n addition to the standard interpretation v : k" --* N (k > 1) used in the earlier sections other interpretations can and sometimes should be used. One of these is the reversed interpretation VQ:
k"
--f
N
defined as the composition
T h e explicit definition of
VQ
is I1
S V ~=
1 d,ki i=O
if s = do . . . d , , di E k for 0 5 i 5 n. T h e reader should have no trouble in transcribing the formalism of Section 2 for the reversed interpretation. I t should be noted that since the reversal of a recognizable subset in k" is recognizable, the reversed interpretation does not lead to a new notion of k-recognizability. It will be seen in XI,4 that for certain problems in digital computation, the use of the reversed interpretation is quite essential. I n some situations (e.g., in the theory of recursive functions) it is advantageous to use the bijective interpretation
which is closely related to v. We observe that v maps the set krof all words in k" of length r bijectively onto the interval 0 5 n < 'k of N . Consequently the formula
will define a bijection. Explicitly if s
=
do . . . d,, d i E k for 0 5 i 5 n,
V. The Integers
116
then
n
sv
C dzkFLpi
=
i=o n ST
(di
=
+ l)k"-'
i=O
If in the formula above we replace knpi by k' we obtain the reversed bijective interpretation rp. I t will be shown in XI,8 that the use of the interpretations 77 or leads to the same notion of k-recognizability as v. T h e Russian interpretation Y:
k'+Z
where 2 is a set of all integers is defined for k odd, k SY =
=
2p
+ 1, p 2 1 as
C ( d , - P )k"-
i=O
This is equivalent with using
-p,-p+
1,
...,-1,0,1,..., p
for digits at the base k rather than the usual digits 0, 1, . . . , k 'I'h e Polish intel-pet ation
-
1.
p : k'+Z is given by the formula
Show that the bijective interpretation may be dejined inductively by the formulas EXERCISE 6.1.
ill/
=
0,
dt7
=
( s d ) v = (srl)k for d
E
E
+1
+ dy
k, s E k', and that ( s t ) q = (srj)k"l
for t
d
+ t?]
k'.
EXERCISE 6.2. Derive for.rnulris similar to those of Exercise 6.1 for the Russian and Polish interpretations.
117
7. Coding 7. Coding
r*
An injective function f:2" + is frequently referred to as a coding. We usually expect that for each s E S" the value sf should be effectively calculable and similarly for each g E P, the value of gf-' should be effectively calculable. If sf = g, then g is called the coding of s while s is the decoding of g. An example of such a coding is the injective function N + k" which to each n E N assigns its expansion at the base k (using either the standard or the reversed interpretation). T h e decoding is then achieved by ( 5 ) r . Another example of a coding N + k" is given by the inverse of the bijection rj: k" N of Section 6. A very useful coding
LI.[
--f
k" + 2"
T ~ :
sterns from the observation that the elements {Odl I d _> 0 } are the basis of the free submonoid A u 2"1 = 2* - (2*)0 of 2". 'Thus T~ is defined by
d t k = Oil
for
dEk
A variant of this coding is obtained by sending d into lod. T h e usefulness of tt stems from the fact that being an injective morphism, both tkand T ~ transform I recognizable sets into recognizable sets (Propositions III,3.3 and 3.4). T h e composite injective function
satisfies
if s
If we allow k
=
do . . . d,,,
= 00, we
di E k for
05i5n
obtain the bijection
given by the same formula as above. Here N X is the free monoid with base 0, 1, . . . , n, . . . . T h i s bijection is useful in the theory of recursive functions.
V. The
118
Integers
Another bijection useful in the theory of recursive functions concerns the sets N and N x N . Using the methods of this chapter we can define a family of such bijections. We choose a base k = k,k, with k, > 1, k, > 1. T h e integer n is expanded at the base k using, say, the standard interpretation. In this expansion each digit d E k is replaced by the pair (b, c) E k,x k, with d = bk, c . There result elements of k," and k," which by application of the standard interpretations yield a pair of integers (n,, n,) E N X N . Thus the bijection N 4N X N is defined using the commutative diagram
+
k"
-
NEXERCISE 7.1.
k," x k,"
NX.N
Show that the diagram above does dejine a bijection
N-tNxN. References R. W. Ritchie, Finite automata and the set of squares,]. Assoc. Cornput. Mach. 10 (1963),
528-531.
This paper proves that the set of all squares is not 2-recognizable (see Example 5.2). This seems to be the first result in this direction. M. I,. Minsky and S. Papert, Unrecognizable sets of numbers, J . Assoc. Cornput. Mach. 13 (1966), 281-286.
This paper, motivated by Ritchie's paper cited above, proves a theorem similar, but somewhat different from Theorem 5.1. While in Theorem 5.1 the two cases correspond to condition (5.5) holding or not holding, the Minsky-Papert theorem deals with the condition s-lB f 0 for all s E 2'". Theorem 5.1 was obtained by M. P. Schutzenberger and the author (unpublished). A. Cobham, On the base-dependence of sets of numbers recognizable by finite automata, Math. Systems Theory 3 (1969), 186-192.
This paper contains the proof of Theorem 3.7. T h e proof is correct, long, and hard. It is a challenge to find a more reasonable proof of this fine theorem.
References
119
Z . Pawlak and A. Wakulicz, Use of expansions with a negative basis on the arithmometer of a digital computer, Bull. Acnd. Polon. Sci. CI. III, 5 (1957), 233-236.
This is the source for the Polish interpretation. T h e Russian interpretation is hearsay.
CHAPTER
VI Multiplicity
T h e phenomenon of multiplicity appears whenever any fact takes place for several reasons and we wish to study not only the fact itself but also the reasons for which it takes place. For instance, the fact may be s E I d I with s E L’*and &’an automaton. The reason for this is the existence of a successful path c in &’with s as label. T h e objective of this chapter is to lay down a general theory and to apply it to automata. Numerous other applications will be made later in this work. 1. Multiplicity in Automata Let d b e a (non-necessarily deterministic) X-automaton. T h e behavior
1 &’ 1 was defined as the set of all labels of successful paths. Each successful path c with label s E Z+constitutes a “computation” for s or a “proof” that s E 1 d 1. There may be more than one such path c with a given label s. If the number of such paths is n (it is necessarily finite), it is appropriate to say that s belongs to 1 a ‘ 1 with multiplicity n. Writing s Id[ instead of n we obtain a function (1.1)
I&’):
Z*+N
and we may wish to call this function “the behavior of d.” Observe that s I d I = 0 corresponds to the case when s 4 I &’ I in the earlier notation. We give a number of examples where 1 &’ 1 regarded as a function (1.1) is calculated. 120
1. Multiplicity in Automata
1 21
EXAMPLE 1.1. Let z'be a finite alphabet and let the automaton ,d 2'
Every successful path in 'VL
t E
Z. Consider
Ei2+t3 z
admits a unique decomposition c
i-i-t-t
r
d
where I c 1 and I d I are arbitrary elements of P . Thus as an ordinary subset 1 LY' 1 = .Y+zz'*. T h e multiplicities are
where
I s It
is the number of appearances of
t
in s.
EXAMPLE 1.2. As in the previous example consider sider the automaton
t l ,t2E
Th en s I ,d 1 is the number of occurrences of the word in s.
t,tZ as
2. Con-
a segment
EXAMPLE 1.3. Consider
Then for s E 1"
EXAMPLE 1.4. Let S = {c} and consider the automaton
aGJJ U Aq n
Let
d
VI. Multiplicity
122
Then clearly
Every successful path c of length n into either
1
a, =
a, = 1,
2 2 admits a unique factorization
pZp’-qAp or
p 5 p L p with
I c‘ I = anp2and I c“ I = an-’. This a, = aa-]
+ u,-~
implies
for
n 22
Th u s a,, is the nth Fibonacci number. This example will be reexamined in VIII,2.
An ordinary subset A of z’* (without any multiplicity considerations) may be regarded as a function (1.2)
A: F - 9
where = (0, l } and the value sA is 1 or 0 depending on whether s E A or s 4 A. We are thus confronted with two kinds of “subsets” of Sx, 9 - s u b s e t s and N-subsets. Other kinds of “subsets” will have to be considered in the sequel. T h e purpose of this chapter is to study these phenomena in some detail and to set up a framework within which the various types of “subsets” can be studied side by side without discomfort. T h e unifying concept is that of a semiring K (the sets 9and N considered above are converted into such semirings). A K-subset A of set X is then a function
A:X+K With proper terminology and notation, such “subsets” can be handled just like ordinary subsets. 2. Semirings
A semiring K is a set equipped with two operations: addition and multiplication. With respect to addition K is a commutative monoid with
2. Semirings
123
0 as a unit element. Thus
With respect to multiplication K is a monoid with 1 as a unit element. Thus
T h e two structures are connected by the following axioms
+
+
x ( y 2) = xy X" (x y)" = xu" + y z
+
xo
=
0 = ox
Clearly any ring is a semiring. We list a number of semirings that will be of interest to us and that are not rings. They are all commutative (i.e., satisfy xy = yx).
9:This semiring has two elements 0 and 1. Addition is given by l + l = l
Note that the remaining rules of addition
o+o=o,
1+0=0+1=1
are forced by the requirement that 0 is a unit element for the addition. T h e multiplication is entirely forced by the axioms and is 11=1, 10=01=00=0 the semiring of all integers n 2 0 with the usual addition and multiplication ; J'": the semiring N completed by the adjunction of an element 00. Addition and multiplication are extended by the rules
N:
n+oo=m+n=cx3+m=co
nco=mn=m moo =
00,
if
EN, n > O
o m = coo = 0
VI. Multiplicity
124
the semiring of all real numbers s >_ 0 with the usual addition and multiplication; the semiring R , with 00 adjoined. T h e operations are extended 9+: exactly as in the case of the passage from N to J”; Q+: the subsemiring of R , consisting of all non-negative rational numbers.
R,:
Consider an indexed family
{xiI i E Z} of elements of the semiring K. Such a family is nothing but a function X:
I
-+
K
with the value of the function at i E I written as xi instead of ix. If I is finite, then the sum
is defined and is an element of K . This sum has the following properties:
(2.5) If I has a single element i, then
(2.6) If Z =
UjeJI j
is a disjoint partition of Z, then
(2.9) If I = 0, then CieIx i = 0.
+
One could adopt (2.4) as a basic notion in place of the addition x y, and treat (2.5)-(2.8) and (2.2) as axioms. One can then define x, x2 as CiElxi with I = (1, 2} and define 0 by (2.9). Axioms (2.1) follow from (2.6) and (2.5) (see Exercise 2.1) and (2.3) follows from (2.7) and (2.8). In all this it was assumed that I in (2.4) was finite. If we drop this assumption and assume that (2.4) is a well-defined element of K for
+
125
2. Semirings
any indexing set I , then with (2.5)-(2.8) and (2.2) as axioms, we obtain the notion of a complete semiring. Each complete semiring also is a semiring. In the semirings (%', X, and .!Z+the definition of addition can be extended to define (2.4) for any indexing set I so that they become complete semirings. Using the obvious orderings in .%', X, and 9+ one can define (2.4) as the least upper bound of the elements zit,, xi where J ranges over all the finite subsets of I . Given two semirings K , K' a morphism p: K + K' is a function satisfying
From this we easily deduce (2.10c) for I finite. For a morphism of complete semirings (2.10) is replaced by ( 2 . 1 0 ~ )for an arbitrary I . A semiring K is said to be positive if it satisfies the following three conditions: (2.12)
0 # 1.
(2.13) If x (2.14)
+ y = 0, then x = 0
= y.
If xy = 0, then x = 0 or y
=
0.
Given such a positive semiring define the function
by setting
0t
=
0
xt=1
if
xfO
I t is then easy to see that -i-is a morphism of semirings, and if K is complete, then t is a morphism of complete semirings. Conversely if t is a morphism, then K is positive. All the examples of semirings listed above are positive.
126
VI. Multiplicity
Show as a consequence of (2.6) and (2.5) that i f q : I is a bijection, then
EXERCISE 2.1.
J
--f
EXERCISE 2.2.
Show that in any semiring
provided I and J arejnite. In a complete semiring I and J can be arbitrary. EXERCISE 2.3.
Show that a ring can never be positive.
EXERCISE 2.4.
Show that i f 0
=
1 in K , then 0 is the only element
of K. EXERCISE 2.5. Show that for any semiring K there is a unique mor-
phism y : N
--f
K.
3. K-Subsets I t will be assumed throughout that K is a semiring which is not trivial, i.e., such that 0 f 1. Equivalently, it will be assumed that K contains at least two elements. Also, unless otherwise stated, K will be assumed to be commutative. Let X be a set. A K-subset A of X is a function
A: X + K . For each x E X the element
xA of K is called the multiplicity with which x belongs to A . If the only values that xA takes are 0 and 1, we say that the K-subset A of X is unambiguous. Since we assume that 0 f 1 in K , the unambiguous subset A of X may be identified with the subset
{x I xA
=
l}
3. K-Subsets
127
of ;’iin the usual sense. In particular, if K = 9all K-subsets of X are unambiguous and every .%‘-subset may also be viewed as an unambiguous K-subset. Examples of unambiguous subsets are X , 0, and x for each x E X , defined by XX5 1 for all x E X
x@= 0
for all X E X
1 0
Y”
if y = x otherwise
The unambiguous subsets x will be called “singletons.” Whenever A is an unambiguous subset of X , the notations x E A and x A = 1 are synonymous. If A is a K-subset of X and y,: K 4 K‘ is a morphism of semirings, then the composition
x-
d
KL K‘
is a K’-subset Ay, of X . In particular, if K is positive, we may consider the morphism t: K 4 9. T h e :%’-subset A t is called the support of A. Viewed as an ordinary subset of X it is At
=
{ x I XA f O }
We now turn our attention to operations on K-subsets. T h e first operation to be considered is the union or the sum, denoted either by U or by C depending on whether we wish the notation to resemble set theory or algebra. For any indexed family { A i , i E I } of K-subsets of X we define
The definition requires no comment if K is a complete semiring. If K is just a semiring, we must assume that the family { A j , i E I } is locally jinite, i.e., that for each x E X we have x A , = 0 for all but a finite number of elements i E I. This is always true when I is finite. If I = (1, . . . , n}, then we may use the notation
A , u ... instead of U A j or C A , .
uA,
or
A,+
. . . +A ,
VI. Multiplicity
128
T h e second operation that we consider is the multiplication of a Ksubset A by an element k E K. T h e result is a K-subset k A defined by x(kA) = k(xA) T h e following formal rules are clear
1A
=
A,
OA = 0, (kIk2)A = kL(k2A)
T h e intersection A n B of two K-subsets is defined by x(A n B ) = (xA)(xB) This formula also applies if B is a K-subset and A is a .%'-subset, by simply regarding A as an unambiguous K-subset. Thus in this case X(A
nB)=
{ :B
if if
X E A x@A
For each K-subset A of X we have
(3.1)
A
1 (xA)x
=
X t S
Note that the family ( x A ) x is locally finite since if y = x otherwise
y ( ( x A ) x )=
T h e right-hand side of (3.1) is called the expansion of A (in terms of singletons). It is a useful formal device in manipulating K-subsets. For instance, we have
A nB
=
C (xA)(xB)x X € S
Let A be a K-subset of X and let X ' be a-q-subset of X . If xA = 0 for all x E X - X', then we may regard A also as a K-subset of X ' . We shall write A c X ' . Note that A c X ' iff A n X ' = A. Establish the formal properties of the operations C A I , kA, and A n B. Examine their behavior under a morphism p: K 4K'. EXERCISE 3.1.
129
4. Relations and Functions
In particular, if K is positive, show that
4. Relations and Functions
In 1,2 a relation f : X + Y was described as a function f : X + P, where P stood for the set of all subsets of Y. T o define a K-relation f: X + Y we shall proceed similarly but will replace P by the set KY of all K-subsets of Y. Thus a K-relation
is defined as a function
(4.2)
f: X + K’
We shall assume throughout, when dealing with relations, that either K is complete or else the family
{xfl x E X ) is locally finite. With this assumed, the function (4.2) can be extended to a function
(4.3)
f: KS + K’’
by setting
Af
=
c (xA)(xf)
xt.r
Defined in this fashion, the function (4.3) satisfies
(4.4) (kA)f= W A f ) Thus (4.3) is the linear extension of (4.2). This gives us the second definition of a relation (4.1) namely as a function (4.3) which is linear [i.e., satisfies (4.4)]. If K is not complete, then one must verify that conditions (4.4) when properly interpreted imply that the family {xf I x E X } is locally finite.
VI. Multiplicity
130
T h e second formalization of the definition of a relation leads directly to the notion of the composition of relations, as the composition of two linear functions
KI' 5 K Z
KS is again a linear function
f g : K"
+
KZ
I t is easy to see that sets and K-relations form a category. T h e graph #f of a K-relation f : X + Y is the K-subset of X x Y defined by
(X,Y)#f = y ( x f ) T h e inverse relation f
-l:
Y
-+
X is given by
4yf-l) =y(xf) This definition is legitimate when K is complete. If not, the relationf-' may not be well defined since the family { y f -l 1 y E Y }need not be locally finite. I n the set of all K-relations X Y we may define the linear operations of addition (with any indexing set) and multiplication by an element of K . This is best seen by applying them to the graphs that are K-subsets of --f
X x Y. EXAMPLE 4.1.
Let B be a K-subset of X . Define the relation
ne: X + X by setting
x ( n B )= ( x B ) x T h u s nl? satisfies the local finiteness condition. For any K-subset A of X we then have
T h e graph of this relation is
4. Relations and Functions
131
and the relation n B is its own inverse. If C is another K-subset of X, then the associativity formula
A n (B n C)= (A nB) n C implies that n ( B n C) is the composition of the relations nB
x-X-LX.
nc
T h e completeness of K was not required. For a K-relation f: X
4
Y the following definitions are made: {x I xf f @ }
Domain o f f :
Domf
Image o f f :
.f Imf= Y
=
C.r xf.
XE
Observe that Domf is a 23’9-subset while I mf is a K-subset. A K-relation f : X + 1’ is said to be unambiguous if for each x E X the K-subset xf of 1’ is unambiguous, or equivalently if the graph #f is an unambiguous subset of X X 1’. A function (or a partial function)f: X + Y is a special case of a .&’relation such that xf is always a singleton (or is a singleton or 0). If K is a complete semiring, thenfalso defines a K-relationf: X 4 Y denoted by the same symbol. If K is not complete, then local finiteness of the family {xf I x E X} is required. This is equivalent with the following condition :
(4.5) yf-’ is finite for all y
E
Y.
T h e relation f-’always satisfies the local finiteness condition (because the sets yf-’ are mutually disjoint) and therefore f - l : Y + X is a Krelation for any K. Note that
Indeed, since
VI. Multiplicity
132
T h e only non-zero term in this summation will be when y which case x ( y f - l ) = 1 and y B = ( x f ) B . This proves (4.6).
in
X + Y and any K-subset B
For any function f :
PROPOSITION 4.1.
= xf
of Y the diagrams
commute, where B' Proof.
Y-Ynn
x-xnw
x-xnw
Y-
= Bf
Indeed, let y
Similarly for x
E
'E
-I.
E
Y.Then
X we have
(x n B ' ) f
COROLLARY 4.2.
of
nu
=
[ ( x B ' ) x ]f
=
( x f ) B ( x f )= xf n B
=
xB'(xf) = x(Bf-')(xf)
For any function f :
X+
I 1' and any K-subsets A
X and B , C of Y we have (C n l3)f-I
=
Cf-l n Bf-I
( A n Bf-l)f
=
Af nB
Let f : X subset A of X the relation COROLLARY 4.3.
+
I
Y be a function. Then for any KY
n ( A f ): 1'is the composition f-' n4 Y-x-x-Y
f
I
5.
133
Monoids and Matrices
EXERCISE 4.1. Let f:A‘ + E’, g : I’+ Z be K-relations. Show that ( f g ) - ’ = g-tf-I. Show that the graphs # f , #g, and #( f g ) are related by the convolution formula
EXERCISE 4.2. Verify that the conclusions of Proposition 4.1 remain valid i f f is a partial function, provided we interpret @ B as 0. EXERCISE 4.3. Give examples showing that the composition of two unambiguous relations need not be unambiguous. 5. Monoids and Matrices
Let S be a semigroup and let A and B be K-subsets of S. Our first aim is to define the K-subset A B of S. If A and B are the singletons x and y , then xy is defined by the multiplication in S. Since we expect AB to be bilinear and since
A
(~A)x, B
=
=
C (yB)y ycs
XES
the calculation
suggests the “convolution formula”
(5.1)
z(AB)=
c (.rA)(y B )
.cy=z
Formula (5.1) may certainly be used as a definition of A B when K is complete. Cases when A B is defined even when K is not complete will be discussed later. With A B defined by (5.1), we have the desired bilinearity, to wit:
( C A,)B ie I
=
C A,B itI
( k A ) B = k ( A B )= A ( k B )
VI. Multiplicity
134
Further A B is associative. Thus if M is a monoid, then K." is a (not necessarily commutative) semiring. We now reexamine formula (5.1). In general, there may be infinitely many pairs (x,y ) such that xy = z with z E S fixed. Because of this it is necessary to assume that the semiring K is complete. There are, however, important cases when this is not needed. Indeed, suppose that S = X+ is a free semigroup with a base 2 (not necessarily finite). Then the number of factorizations xy = z is exactly I z I - 1. Thus the summation in (5.1) is finite and the assumption that K is a complete semiring is not needed. T h e same argument applies if S is a free monoid S = L"3C or if S is a product of a finite number of free monoids. Let P and Q be finite sets. A K-subset A of P X Q will frequently be regarded as a matrix with the rows indexed by the elements of P, the columns indexed by the elements of Q, and with entries in K. When this is done, then instead of writing ( p , q)A we shall write A,, and the matrix will be recorded as A = [A,,]. Addition of matrices is defined using addition of K-subsets. Thus if B E Kz'xQis another P XQ-matrix, then ( A B),, = A,, 4 1 ,
+
+
A new operation is matrix multiplication. Given matrices A
E
B
K'xQ,
E
KQxR
the product
A B E Kpxrz is defined by
T h e usual properties of matrix multiplication are easily established. For P = Q, the matrices Kt'Xp form a semiring in which the unit l p is the matrix
If A is a P XQ-matrix and P is a single element, then A is called a row vector. Similarly if Q is a single element, A is called a column vector. D e j k e the product K , x K , of two semirings and also of two complete semirings. Show that if S is a semigroup, then EXERCISE 5.1.
( K ,x K,)"
-
K ISx K,"
135
6. K-S-Automata
EXERCISE 5.2. Dejne the K-relations L ,: S + S and RAi:S S where A is a K-subset of S. Derive the formalproperties following the pattern of III,3. Dejne the K-subsets A-lB and AB-' and establish their formal properties in the manner of III,3. Consider the cases when K is complete or S is free. -+
6. K - Z - A u t o m a t a
Let Z be a finite alphabet and K a commutative semiring. A K-2automaton d =(P,1,T ) is given by a finite set
0 with K-subsets I and
T and by a K-subset E of
If then we say that the edge ka
p-q is in d a n d that ka is the label of the edge. As in the case of 2-automata, paths c:
p+q
are considered. If c is the path
p-q,' kiai
I
.
- 411-1
.
knon
q
then its label is
IcI
=
with
ks
k
=
k, . . . k,,, s = a1 . . .
0,
and its length 11 c 11 is n = I s I. T h e behavior of JP' is the K-subset of Z* defined by
I
Sd
I
=
c c (PI>I c I ( q T )
P,FQ
0
with c ranging over all paths c: p q. Since for each s E L'* there is only a finite number of paths with label ks, k E K , the summation is --j
VI. Multiplicity
136
locally finite and 1 M‘l is well defined, without assuming that K is a complete semiring. T h e only paths of length 0 are the trivial paths q -+ q with label 1, and therefore
where I T is the product of the row vector I with the column vector T. T h e K-subset E of QxL’xQ is a function
E : QxL‘xQ-K Thus writing
( P , 0,9 ) E = CE,, we find that EPqis a K-subset of 2‘ so that E may be viewed as a matrix
E: Q x Q + K 2
(6.1)
called the transition rnatrk of Ld.Each K-subset of 2‘ may be viewed as a K-subset of Z*(with value 0 on each s 4 2) and therefore E may also be viewed as a function
i.e., as a 0 x Q-matrix with values in k”*.Since K-’* is a semiring, matrix multiplication can be used. T h u s for n E N the matrices
may be defined with EO
=
l,, El = E. Since
sEpnq = 0
if
1s1 f n
it follows that the family
{ E & , n E NJ is locally finite and we may define
There results a matrix
(6.3)
(6.4)
E*: Q x Q - K Z * E*=11,+E+E2+
. . . +E n + . . .
137
6. K-2-Automata
called the extended transition matrix of A . For each s E S" we may consider the matrix
sE"
=
[sE,&]E K QxQ
If s = o1 . . . o r i ,then
sE" = sE"= (o,E) . . . (o,,E) = (a,E") . . . (o,,E") It follows that E" may also be viewed as a matrix-valued morphism
PROPOSITION 6.1. For an-v p , q E Q the K-subset E& is the sum of all the labels of paths c : p + q in d. Proof. I t suffices to show that for each n E N , the K-subset E& is the sum of all the labels of paths c : p 4q of length n. For n = 0 this is clear since E,O, = 1 if p = q and E& = 0 otherwise. For n = 1 this follows from the fact that I?;,* = E,, and from thc dcfinition of E p g . For n > 1 this follows inductively from the formula
COROLLARY 6.2.
The behavior of d i s
with Z regarded as a row vector and T as a column vector
I
We shall now join up with the module notation used informally in 11,4, and more formally (in the deterministic case) in I I I , l . Let X be a K-subset of Q. We may regard A' as a row vector (i.e., a 1 x Q-matrix of elements of K ) . For each s E Z*, the matrix sE" is a Q X Q-matrix of elements of K and therefore we may denote
X S = X(sE") This is again a row vector, and
VI. Multiplicity
138 T h e formal rules
X(st)= (Xs)t,
x1 = x
( k X ) s = k(Xs) are then clear. If X is regarded as a column vector, we may write
s x = (sE”)X so that
and
(st)X = s(tX),
1x = x
k(sX) = s(kX) In particular, in the automaton s‘, I is regarded as a row vector and T as a column vector. From Corollary 6.2 we thus deduce: COROLLARY 6.3.
For eack s
E
2’”
s I d I = (Zs)T = I ( s T )
Indeed, s I d
I
= I(sE”)T
I
A K-2-automaton d = (Q, I, T ) is said to be normalized if I T = t are distinct singletons and if further there are no edges ka
9-29
.
=
i and
kn
t-9
(with k f 0). Clearly for such an automaton we have
I &’ I
c Z+.
PROPOSITION 6.4. For any K-2-automaton d there exists a nornialized K-S-automaton A?” such that
7. Recognizable K-Subsets Proof.
139
Let A?'= ( Q ,I , T ) . Define
Q'=Q u i u t where i and t are two distinct new states. Define the new transition matrix E' as follows
E L = E,, EL, = 1 IpEpp PE Q
E,; where I ,
= pI
=
Eli= E,,
=0
and T , = qT. A simple calculation then shows that
Elt"
= IE+T
where
E f = E f E 2 + . . . f El'+ . . .
=
EE"
T h e automaton d' = (Q', i, t ) is normalized and
T h e construction of A?'' from &'described as the normalization procedure.
above will be referred to
7. Recognizable K-Subsets Let K be a (commutative) semiring and 2 a finite alphabet. A K-subset A of Z" is said to be recognizable if there exists a K - 2 - a u t o m a t o n d s u c h ' I = A. that I a We first tabulate those properties of recognizable K-subsets which are the analogs of properties of recognizable .%'-subsets established in II,3. T h e proofs will not be repeated since the constructions defined in I I , 3 apply with trivial modifications, due to the presence of the elements of K in the labels.
140
VI. Multiplicity
PROPOSITION 7.1. The class of recognizable K-subsets of 2 7 is closed under jinite union, intersection, and reversal. This is an analog of Proposition II,3.1. We must note that the reversal Ae of a K-subset A of C* is the composition
PROPOSITION 7.2. I f f : r*+ C* is a fine morphism and A is a recognizable K-subset of P, then Af is a recognizable K-subset of P . This is an analog of Proposition II,3.2 I PROPOSITION 7.3. Let f : r" Z* be a morphism such that 1 = 1f -I. If A is a recognizable K-subset of 11*,then Af is a recognizable K-subset of C*. ---f
We first note that the condition 1 = If-' is equivalent with the condition that sf -l is finite for all s E s*. This is precisely what is needed to define Af, without assuming that K is complete [see (4.5)]. T h e conclusion now follows by a slight modification of the construction used to prove Proposition II,3.3 I Let C and P be disjoint alphabets and let
be K-subsets of L'* and P , respectively. For x E T* and y E P , the shuffle product x LLJYis a finite subset of (S u I')". Further the sets x UJ y and x' w y' are disjoint except when x = x' and y = y ' . This iiiipIies that the summation
A
LL
B
=
c ( x A ) ( y B ) ( xw y )
ztZ"
?/€I,*
is well defined, yielding the shuffle product A LU B of two K-subsets. T h e construction given in the proof of Proposition I I , 3 . 4 then yields: PROPOSITION 7.4. If C and r are disjoint alphabets, A is a recognizable K-subset of Z", and B is a recognizable K-subset of P, then A w B is a recognizable K-subset of (Z u T)* I
141
7. Recognizable K-Subsets T h e passage from the shuffle product
LL
to the internal shuffle product
A u B of two K-subsets of L'" is handled exactly as in II,3. T h e analog of Proposition II,3.5 is:
If A and R are recognizable K-subsets of 2",
PROPOSITION 7.5.
then so is A u B
I
We shall now establish a number of propositions for which no analog in II,3 has been stated.
Let A be a recognizable K-subset of 2" and let K . Then k A is a recognizable K-subset of S".
PROPOSITION 7.6.
k
E
Proof. Let SY' = (0,I , T ) be a K-2-automaton recognizing A. Then k A is recognized by either one of the K-2-automata
k d = ( Q , kI, T ) , with the transition matrix unchanged PROPOSITION 7.7.
q the
K-subset A'
=
d k
=
(0,I , AT)
I
A K-subset A of 2" is recognizable A n I+is recognizable.
q and
only
Proof. If A is recognizable, then A' is recognizable by Proposition 6.4. Another way to see this is to use Proposition 7.1 and the obvious fact that L+ is recognizable. Conversely, assume that A' is recognizable. Since .4 = kl A'
where k = 1A and since 1 is recognizable, it follows from Propositions 7.6 and 7.1 that A is recognizable I PROPOSITION 7.8.
I f A and B are recognizable K-subsets of X",
then so is AB. Proof.
Let
-4 with A'
=
'4 n Z+,B'
kl =
+ A',
I3 = 11
+ B'
B n X+.'Then
A B = k l l 4-kB' + IA' $- A'B'
VI. Multiplicity
142
Thus by Propositions 7.1, 7.6, and 7.7 it suffices to show that A'B' is recognizable. Let L d=
(Qi
9
ii
1
ti
),
.z = ( Q 2 ,i,, 2 , )
be normalized K-2-automata recognizing A' and B'. Consider the normalized K-S-automaton '8 = (Q, i,, t , ) where Q is obtained from the disjoint union Q1 u Q2 by merging t , with i,. T h e edges of $5' are those of &' and those of 9?. Clearly
PROPOSITION 7.9. Let A be a recognizable K-subset of 2f. Then the
K-subsets
A+=A+A'+
. . . +A " +
...
A*= 1 + A + A 2 + . . . + A " + . . . are recognizable. First we must observe that the family of sets {A" I n E N ) is locally finite, so that A+ and A" are well-defined K-subsets. Indeed, since A c Z'f we have sAJJ= 0 whenever I s I < n. Let & = (Q, i, t ) be a normalized K-2-automaton recognizing A. Then merging the two states i and t into a single state which is both initial and terminal we obtain a K-S-automaton &' * (no longer normalized). It is clear that I & " I = A*. Thus A" is recognizable. Since A t = A" n Zf, the same follows for A+ 1 Proof.
THEOREM 7.10. (Schutzenberger) A K-subset A of Zfis recognizable if and only if there exists an integer n > 1 and an nxn-matrix E of K-subsets of Z such that A = E:l.
Proof, Assume that A is recognizable and let & = (Q, i, t ) be a normalized K-2-automaton recognizing A. Without loss we may assume that Q = (1, . . . , n} with i = 1, t = n. Since i f t it follows that n > 1. By Corollary 6.2, I & I = E& = Et,l. Conversely, assume that A = Ef,t, where E is an n x n-matrix of Ksubsets of .Z and n > 1. Then setting Q = (1, . . . , n } we obtain a K-Z-automaton M = (Q, 1, n ) with transition matrix E. As above Idq=E;,=A I
8. The Equality Theorem
143
As a by-product of the argument above we obtain COROLLARY 7.11. If E is a n x n-matrix of K-subsets of L', then for any 1 5 i, j 5 n the K-subsets E$ and E$ are recognizable I PROPOSITION 7.12. Let p: K + K' be a morphism of semirings. Zf A is a recognizable K-subset of P, then A p is a recognizable K'-subset of 2".
Let d =(Q, I , T ) be a K-2-automaton with transition matrix E, such that I ,d I = A. Then the K'-2-automaton d p = (Q, Ip, T y ) with transition matrix Ep, satisfies I d p I = I d I p = Ap I Proof,
COROLLARY 7.1 3. If K is a positive semiring and A is a recognizable K-subset of S*,then A t is a recognizable 9-subset of L'* I PROPOSITION 7.14. Let A be a recognizable 93'-subset of 2*. Then A viewed as an unambiguous K-subset of Z* is recognizable. Proof. Let &' be a deterministic 2-automaton with behavior A. If we view d as a K-S-automaton, then its behavior is A regarded as a K-subset
Corollary 7.13 and Proposition 7.14 jointly show that for unambiguous subsets of Z*, the notion of recognizability is independent of the choice of the semiring K. EXERCISE 7.1. Make explicit the constructions of the automata required to prove Propositions 7.1-7.4. 8. The Equality Theorem
In this section it will be assumed that K is a subsemiring of a (commutative) field F. This includes the semirings N , R,, and Q+ but excludes 9, -,F, and 9+. It also includes those commutative rings which are integral domains, e.g., the ring 2 of all integers. THEOREM 8.1. (The Equality Theorem). Let A , and A , be recognizable K-subsets of Z* and let di = (Pi, Zi,Ti)be K-2-automata such that I di I = A i for i = 1, 2. If ni = card Q i and
sA,
= sA,
VI. Multiplicity
144
for all s E Z* such that Is1
then A , Proof.
=
A,.
Consider the automaton
where Q1 and Q, are assumec disjoint and the transition matrix is Qi
QZ
E= From dlu d, we derive the automata
and observe that
I , qI i= I &di I = Ai,
i
=
1,2
T h u s the conclusion of Theorem 8.1 follows from: THEOREM 8.2. Let
di = (Q, I i , T ) ,
i
=
1, 2
be K-Z-automata differing only in their initial subsets. Then I dlI if and only if sId l I =sI I
=
I d, 1
for all s E Z* such that
I s I < card Q Proof, By assumption K is a subsemiring of a field F. Thus we may I and I ,d2I are equal as F-subsets regard dias F-Z-automata. If I dl of Z*, then they are also equal as K-subsets. Thus we may replace K by F, or equivalently assume that K is a field. Thus K Qis a vector space over K of dimension n = card Q. Consider the K-Z-automaton
d =(Q, I , T )
8. The Equality Theorem with I = I ,
-
145
12.Since s 1 ‘YL
I = s I dlI
s 1 -d, I we have
( s ( < n
if
s l d ( = O
-
and we wish to prove that sId
I =0
Z*
for all s E
Equivalently, in view of Corollary 6.3, we are given that
(Is)T = 0
I sI
if
r‘ n
and we wish to prove that
(Is)T = 0
for all s E .Z*
Define
W = {X 1 X
E
K4, KT
=
O}
V , = subspace of K Q generated by vectors Is with I s I 5 k. Assuming that n > 0 we have
vo c . . . ‘The cases I = 0 or T (Is)T = 0. Therefore dim I/,
=
c V,-, c
W
0 may be ruled out since then obviously
=
1,
It follows that for some 0 5 k < n
dim W -
=n -
1
1
v, = v,,, Since V,,, is generated by all the vectors X and XG with X E V,,, , it follows that V,+, = V,,, and thus by induction V , = V k + pfor , all p 2 0. This implies V , c W for all K E N . T h u s for any s E Z*we have Is E W , i.e., (Is)T = 0 COROLLARY 8.3.
i j and only i j s I d I
If.#= (Q,I, T ) is a K-E-automaton, then I d 1= 0 0 for all s E S* such that 1 s I < card Q I
=
T h e following example shows that the numerical bound in Theorem 8.1 is the best possible.
VI. Multiplicity
146
EXAMPLE 8.1. Let 0 . I n1 5 n2 be integers. Consider the alphabet L consisting of a single letter (r. Let dlbe the deterministic automaton with n , states represented symbolically by the path
T h u s A , = a’+’. Let -d2be the deterministic complete automaton with n2 states represented symbolically by the loop
with t
=
i(r’21-1
as terminal state. Then
However, for all lower exponents k we have & E A , iff
(rt
E
A,
An important consequence of Theorem 8.1 is: THEOREM 8.4.
G i w n any two recognizrrble K-subsets A, I
I”, it is decidable whether or uot A ,
;2,
and ‘3, of
:
This statement requires several caveats. First thc word “given” should be interpreted to mean that K-:-automata -d, = (Q,, I , , T , ) such that I dt I = A , for i 1, 2 arc cxplicitly provided. Then, of course, all the card Q, can be enumerated and paths of length less than n = card Q, thus s I dl1 and s I d2 1 can be computed for I s I < n. W e must then 1 for all 1 s 1 ;n. be able to decide ahether or not s I dl1 = s 1 d2 This means that the semiring A’ must be known well enough to permit such decisions. T h u s we see that Theorcm 8.4 silently assumes that a number of other facts are decidable.
+
EXERCISE 8.1. Let A , , A, be recognizable .8’-subsets of 2” and let -dibe autotrwt(z wit12 ni states sirrh that 1 di1 = A , for i = 1, 2. Show
that if S E
A,
~
S
A ,E
9. The Case K = N
147
OPEN PROBLEM. cise 8.1 ? 9. The Case K
=
IC'limt is the best possible bound f o r
Is1
in Exer-
N
In this and the subsequent sections of this chapter we shall concentrate on thc casc K = N . W e recall that an N-I-automaton
two N-subsets I and T of 0, and an N-subset E consists of a finite set 0, of ,O < 1:Y 0. If the subsets I , T , and E are unambiguous, then the automaton ,iJ is said to be iincrinb/'gitozrs. l'he unambiguous N-1-automata are exactly the 1-automata of Chapter 11. Note that if ,Jis unambiguous, then for each o E L,the niatris oE has 0 and 1 as its only entries.
Let 2 = (0, I , T ) be an N-L-automaton such that .-I = I 3 1. T h e N-subsets Z and T of 0 may be written as finite sums of unambiguous subsets (e.g., singletons) Proof,
I=Z, r 7
+ ... +Ii,
T = T,
+ . . . + TA
Ihen = LA,,nith 1 5 i 5 I , 1 ( j 5 k and A,, = 1 ( Q , Z L , T ) )1. If for each A ( , n e can construct an unambiguous automaton d I , such I, then the union of the automata dL, provides an that A,, = 1 dl1 unambiguous automaton L.u/'such that d = 1 d 1. Consequently it suffices to consider the case whcn Z and T are unambiguous subsets of Q. Each edge of 4' has a label of the form no nit11 n 2 1 and o E 1. Let k be the largest integer n thus obtained. Consider the unambiguous automaton d =( Q X k , I x O , T x k )
VI. Multiplicity
148 with edges defined as follows. For each edge
.>
introduce the edges
(P, L+ (4,
(9.2) provided u -v z
1 mod k
0 5 1 < n.
with
We shall say that the edge (9.2) coeiers (9.1). For each edge (9.1) there are exactly nk edges covering it. However, there are exactly n edges covering (9.1) if the start state ( p , u ) of the edge (9.2) is specified. A path c' in &is said to cozier a path c of 9' if the j t h edge of c' covers t h e j t h edge of c for 0 < j 5 11 c 11. From the observation made above we deduce (by an easy induction on the length):
q with label ns, there are exactly n paths c': (9.3) For every path c: p ( p , 0) 4 (9, z)), v E k , covering c. Each of these paths has the --f
label s. T h e path c' is successful iff the path c is. T h u s a simple count shows that I 3' I and therefore I I = A. If A is in L", then 29 = (0,i, t ) may be chosen to be normalized. In the resulting unambiguous automaton
s I LdI = s
, d =(Q>
0 5j<
Ld= , ( Q x k , (i,O), ( t , j ) ) , is normalized
I
COROLLARY 9.2. For each recognizable N-subset A of V + there exists an unambiguous X-automaton Gdwith a single initial state (or with a single termirial state) siiclz that I I = '4. Indeed, it suffices to pinch together the initial states (or the terminal states) of the normalized automata in the conclusion of Theorem 9.1 I EXAMPLE 9.1.
Consider the N-1-automaton
Ei
:
-T, t
3
2:
9. The Case K = N
with
T
149
a distinguished letter in L'. Then A
=
1 -d1 is
given by
the summation extended over all decompositions s=
UTZ',
u, v E
L'*
Observe that A may also be defined inductively by the formulas
1A
=
0
(os)A = s A
( t s ) A = 2'"' We now apply to obtain
for
o#
T
+~'4
the procedure of the proof of Theorem 9.1. We
Since the state (i, 1) is not coaccessible it can be supressed. We thus obtain the unambiguous (and trim) automaton
Theve exists THEOREM 9.3. Let A be a recognizable N-subset of P. a finite alphabet Q, a local subset L of Q*, and a fine morphisin f:f2* + 9 such that Lf = A. If A is an N-subset of Z+,then f may be chosen to be very fine. Proof. We first consider the case when A is in S+. I n view of i-' an unambiguous Theorem 9.1 we may assume that A = I d 1 wheres@
150
VI. Multiplicity
C-automaton. We now apply the graph construction of II,6. This yields the alphabet Q, the very fine inorphisni f,and thc local set L = #Ld. We have shown in II,6 that f establishes a 1-1 correspondence between the words c in L and the successful paths in JX' with label cf. T h u s the equality Lf = A is an equality of N-subsets. T o consider the general case we write
A
=
n1
+ A',
A' = A n C +
and construct the very fine inorphisin f ': Q'* 49and the local subset L' of 9'" so that A' = L ' f ' . We now define Q by adjoining n letters T , , . . . , z,, to Q' and extend f ' to a fine morphism f: sZ* + I*by setting t i f = 1 for 1 5 i f n. T h e n 1, = L' u { T ~ ., . . , r,?} is the required local set I EXERCISE 9.1, Show that a normalized and unambiguous autowinton for a recognizable N-subset A of P exists iff A c 2-i and A n C is unanzblguous. EXERCISE 9.2. Show that if the N-2-automaton the multiplicity of the edges is 5 k then
EXERCISE 9.3.
&'
has n states, and
lJse Exercise V,2.2 and Theorem 7.10 to show that the
function
vk: k*
4
N
of V,2, viewed as an N-subset of k* is recognizable. Establish the same fact for the bijective interpretation of V,6. 10. The Division Theorem
Let p > 0 be an integer. Every integer x E N may then be written uniquely in the form
x = p(x.)
+ xp
with 0 5 x/" < p and 0 5 xrx. Consequently for every N-subset A of a set S we have
(10.1)
A
= p(Arx)
+ A/3
10. The Division Theorem
151
where An is an N-subset and '41 is an N-subset satisfying x(AP) < p for every .T E S.
p
THEOREM 10.1. Ldet A be a recognizable N-subset of -Y*, and let -, 0 be an integer. Then in the decomposition (10.1 ) the N-subsets Ars and
'411 are recognizable. Further, f o r every 0 5 k ': p the 3-subset A,
= {s
I sA
k modp}
i s recognizable. Proof. Without any loss of generality we may assume that A c Ti. By Corollary 9.2, A is then the behavior of an unambiguous 2-automaton d =(Q, I , t ) with a single terminal state t. For each function r: Q-p
we introduce a new state . r ) . Let R be the set of states thus obtained. We shall construct a new automaton .iA with Q u R as the set of states. T h u s if d h a s n states, then A will have n p" states. Every N-subset of Q will also be viewed as an N-subset of Q u R. Note that Y above is an N-subset of Q and thus also of Q u R. However, r ) is a single element of R. For every s E S" and every N-subset B of Q, Bs is again an N-subset of Q. We now extend this action to the set R by setting
+
r ) s = (rs)cI
If s r)l
=
+
(rs)P)
1, then Y S = Y , ( Y S ) ~= ru = 0, and (rs)/3 = r/3 = For v E L'* we verify that
= (r).
(10.2) Indeed, setting C
.'Y)(SU) =
= YS
we have
(
Y.
Thus
VI. Multiplicity
152
Thus equality (10.2) follows from the following two equalities
(CU)"
+ [(CP)v]a
=
[(CB)VIP
=
.+
T o prove these two equaIities we use the identities C ( P . y)" = Y", and (P. y)B = YB.Then
+
+
=
p(Cu) + C/3,
+ (CP>vIa
( C V b = [(P(C@))V =
{P[(CU)VI
+
=
(CV)P = C(P(C")V
[(CP)V]W
+ (CPbIB
= {P[(CQ)VI =
+ (CPbh
+ (CP>V)P
[(CPbIP
as required. Next, if I is the set of initial states of -d, we may regard I as an N subset of Q and thus ( I ) E R. We take I) as the initial state of the automaton 3'.With the terminal state t unchanged, we have s
I 29 I
=
t(/l)s)
=
t[(ls)u
=
t[(Is)a]= [t(Is)]rx= (si4)c-x= s ( A a )
+
(Is)B>I
I 23' j = Au. Thus Au is recognizable. To prove the second part of the theorem we choose 0 5 k < p . We as before, but with the set of terminal states T L define the automaton
so that
TL = (i~) J tr = k} where t is the unique terminal state of d.Then s E I -gn I iff ( 1 ) s n TI.# 0. Since ( 1 ) s = ( 1 s ) ~+ i(Is)P), this is equivalent tvith t((Is)B) = k
i.e., with
t(Is)= K
modp
or still with s l d J = k modp
Thus
I .a9, I = A, and A, is recognizable.
11. The Subtraction Theorem
153
T o conclude the proof we note that
AP
=
A,
+ 2 4 + ... + (p
-
l)Ap-,
I
so that the N-subset i3B is recognizable
COROLLARY 10.2. If A is an N-subset of S" and p A is recognizable f o r some p >* 0, then '4 is recognizable I COROLLARY 10.3. For any recognizable N-subset '4 of 3,the following conditions are equivalent:
(i) (ii)
There exists an integer p 2 0 such that s.4 5 p f o r all s E L'*. A is the finite union of unanibigiioits recognicable N-subsets of Sx
I
11. The Subtraction Theorem
Let A and B be N-subsets and assume that
B I A i.e., that sB 5 s A for all s E Sx. 'I'he difference '4 defined by s ( A - B ) == s.4 - SB More generally, without assuming B
EXAMPLE 11.1. Ex given by
With 1:=
{G, T }
-
B is the N-subset
5 A , we may define A
B by
1
consider the N-subsets C, D of
1 s + I s IT2 = 2 I s 1" I s IT
sc
=
S D
Then C and D are recognizable, since
C
=
(-4n A )
+ ( B n B),
D
=
2AB
where A and B are the sets given by Example 1.1. Clearly D However, s(C - D )= (I s lo - I s I r ) 2 and thus
( C - D)t
=
{s
IIs
I0
f I s 1),
5 C.
VI. Multiplicity
154
This is the complement of a non-recognizable set (Example II,S.4). 'Thus the N-subset C' - I1 of L'" is not recognizable. Let A and 13 be recognizable N-subsets .f L" nrid assiime thnt B is boiiiided, i.e., sB 5p for nll s E .Y* and some jixed integer p 2 0. Then A B is recogriizmDIe. THEOREM 11.1.
Proof. T h e proof depends upon a "cross section" thcorern that nil1 be proved in IX,7. B y Corollary 10.3 we niay assiiiiie that B is the finite union Bl 4- . . . -1 B, of recognizable unainbiguous subsets of S".Since
-4
B ' ) L B,
I1 = ( A
:
with B' = H, -1- . . . -1 B,-, , it suffices to prove the theorem when B is unambiguous. '3'ince
.
'4
B
=
(A
,4t)
~
+ (.4?
L
B)
and A t A B, as the difference of unambiguous recognizable sets, is recognizable, it suffices to prove that A ' = il - .+It(i.e., .4 1L'*) is recognizable. Without loss of generality, we niay assunie that 1'4 - 0. By 'Theorem 9.3 there exists a finite alphabet l', a very fine Inorphisin f : 1'" + L", and a local set 13 in TI such that Bf A . I
~
COROLLARY 11.2.
For ever-v integer k 2 0, the set
A
L
k.Y*
is recogiiizable COROLLARY 11.3.
I;Or niiy iiiteger k
1k) is a recognizable +'-subset of
L*,
Indeed this set is ( A - k P ) t
I
0, the set
12. Undecidable Propositions
,.1his follows from Corollary
155
11.3 using eoniplcmentatioii and inter-
I
section
Show that -4, is reco~tti:nl)le. 12. Undecidable Propositions
O n tlic previous pages and also in Chapter I 1 we gave a nrimbcr of efkctive procediires for dccicling a number of questions. \Ve did this lvithout defining the notion of an “effective procccliire.” \’e siniply described thc procediire and assumed that the reader will find it “effective” enough for his satisfaction. \I’hcn it conies to proving that in sonic situation such an effective procedure docs not esist, obviously a tiiorc formal definition is needed. ‘l’liis, however, \vill not take place until Yolurne I). In the tncantiinc, \ve shall have to be satisfied \vith a “relative undecidability” in the follo\ving sense : O n e particular undecicl;iblc proposition I’ will be stated (its undccidability ivill be pro\,ed in Volume I)). Any proposition (1 will be called rinderidnhle if a decision procedure for Q \rrould, using naive means, imply a decision procedure for I). ‘L’he particular proposition most suited for a choice o f P is tlic POST CORRESPONDENCE PROBLEM. Giwn any finite nlphnhet 1: and given t w o mwpltisitis g, 11 ; 1* + 2* decide wlwtlitv or not there exists sl1. sE s1rclz thmt sg \‘I
If L
(12.1)
~
~
{cT,,
. . . , u,?}, then g and h are defined by words XI,
. . . , x,, E 2”,
y , , . . . , y n E 2”
VI. Multiplicity
156
given by x i = uig, y i = uih. If s E S+ is given by s = ui,. , . u i k ,k then sg = sh holds iff (12.2)
xi,
> 0,
. . . x.hk = y i , . . . yis
T h e problem consists in finding an effective procedure for deciding, once (12.1) is given, whether a sequence (il,. . . , ik) exists with k > 0 such that (12.2) holds. I t will be shown that (with a suitable definition) such a procedure does not exist.
Given recognizable N-subsets B and C of S" such that B 5 C , it is undecidable whether or not there exists s E S+ such that sB = sc. THEOREM 12.1.
Proof. We show that if a decision procedure for the problem above exists, then a decision procedure for the Post Correspondence Problem would follow. T h e proof utilizes an injective morphism
where N2x2 is the monoid of 2x3-matrices with entries in N . From Exercise V,2.2 it follows that
yields such a morphism. Another one is given by
T h e choice of the morphism y is immaterial for the rest of the proof. The only fact needed is that it be injective. Given morphisms g , h : S" + 2 " consider the compositions
12. Undecidable Propositions
157
where
Gij, H i , : Z* + N ,
i, j
E
2
are functions. T h u s we may regard G i j and H i j as N-subsets of S*. By Corollary 7.1 1, these N-subsets of I * are recognizable. Consider the N-subsets A , B, C of S* defined by the functions
,4
=
C (Gij- H i j ) 2 L.J
Then
A
4-B = C,
B 5C
Clearly B and C a r e recognizable since they are obtained froni recognizable subsets by the operations and n. Let s E z".T h e n sB = sC iff sA = 0. This holds iff sGij = s H i j for all i , j E 2, i.e., iff sgy = shy. Since y is injective, this holds iff sg = sh. T h u s a decision procedure for finding such an s, leads to a decision procedure for the Post Correspondence Problem [
-+
THEOREM 12.2. Given recognizable N-subsets B and C of 2'*, it is undecidable whether B 5 C .
Let B' and C' be recognizable N-subsets satisfying B' 5 C'. Consider the recognizable N-subsets Proof.
B
=
B'
C= f If,
C'
Then the inequality
B I C holds if€
sB' < sC'
for all s E z"
This question has however been shown to be undecidable
[
Let B and C be recognizable N-subsets of X*.Define by setting SD = Sup(sB, SC)
Sup(B, C)
D
=
158
VI. Multiplicity
T h e question whether , ! I5 C is then equivalent with the question whether D = C. If we could (constructively) prole that D always is recognizable, then by the Equality ’l’hcoreni we could decide whether D= C, i.e., \+hethcr B B 5 C. It fo1lon.s that given automata 8 and ‘6such that I 8 I and 1 P 1 = C there is no algorithm for constructing an automaton 3 7 such that I 9 I = D. This does exclude the possibility that D is recognizable. However, this is extremely unlikely since a constructive proof cannot exist. An explicit counterexample is lacking. A similar argument applies to Inf(B, C). ‘Two other open problems are listed: OPEN PROBLEM.
‘4
Let A , B, C be N-subsets of =
B nC
and
Bt
=
P. iZssiiine Ct
If A and B are recognizable, is C recognizable ? OPEN PROBLEM. Let A be an N-subset of 2’”. If A n A is recognizable, is A recognizable ? References M. P. Schutzenberger, Certain elementary families ot automata, “Proceedings of Sy mposium o n Mathrimtical Th eo r y of Automata,” Polytcchnic Institute of Brooklyn, 1962, 139-153.
This paper introduces Z-subsets, N-subsets, and also #-subsets through the mechanism of formal power series which arc essentially the expansions (3.1). Subsequent publications of Schutzenberger and several of his associates considered only the case K = 2 (or more generally, the case when K is a comniutativc ring) and took on a very algebraic or analytic outlook. T h e aim has become to generalize various theorems from classical analysis to the case of power series in several non-commuting variables. T h e results of Sections 8-12 are new and were obtained by the author in collaboration with M. P. Schutzenberger. T h e proof of the Equality Theorem (Theorem 8.1) went through several improvements, and one major improvement was contributed by M. 0. Rabin.
CHAPTER
VII Rationa/ Sets
In this chapter we consider rational sets (also known as “regular sets” or “regular events”). T h e key result here is Iilcene’s Theorem which asserts that “rational” equals “recognizable” in a finitely generated free monoid. Kleene’s Theorem is the first major theorem of the theory of automata, both chronologically (1956) and in terms of its actual position in the subject. 1. +-Algebras
Let K be a commutative scmiring. ,4n algebra over K (or a K-algebra) consists of a set ‘4 equipped with four operations. T w o of these are binary operations which to elements a, 0 E i3 assign elements a
+ b,
a
. b (usually written ab)
of A. One is a mixed operation which to each k E K and each a E A assigns an element ka E ‘4. T h e fourth one is a nullary operation which singles out a zero element 1.3of ’4. T h e axioms are
a + b - b f a a -1- ( b $- c ) = (0 b ) c (k,k,)rz = h,(k,n), l a = a, Oa Ld k ( ~ b ) = ka -k kb (k, k 2 ) a = k , -4~ k,cl, a(bc) = (a/,)c a(/) c) = ab ac ( a b)c = ar $- be, k(ab) = ( k ~ ) = b a(kb)
+ +
:
+
+
+
+
159
+
VII. Rational S e t s
160
T h e axioms are a paraphrase of the axioms of an algebra over a commutative ring adapted to the semiring situation. Indeed if K is a ring, then we may define -a = (-1)a. Then a
+ (-a)
= la
+ (-1)a
=
+ (-1)).
(1
=
Oa
=
@
so that A becomes a K-algebra in the traditional sense. We prove that
a+ @=a,
@a= @ = a 0
Indeed a+ D=la+Oa=(l+O)a= la=a @u = (O@)a = O( @a) = @ a @ = a(O@) = O ( a 0 ) = 0 As in the case of a semiring (see VI,2) the operation a replaced by the operation a<
+ b may be
c
,ieI
for any finite indexing set I , and the axioms may be reformulated accordingly. If K is a complete commutative semiring and if Ciclai is given for any indexing sct I (not necessarily finite), with the proper generalization of the axioms satisfied, then we say that A is a complete K-algebra. We let the reader make an explicit list of the axioms. A +-algebra over K (or a K+-algebra) is simply a K-algebra A with an additional unary operation a+ subject to no axioms whatsoever. T h e a2 ... operation a + is intended to represent the infinite sum a an . . .. Consequently if K is complete and A is a complete Kalgebra, A can always (and always will) be converted into a K+-algebra by setting
+ +
+ +
m I
a+ = C an fl=l
Let A be a K+-algebra. A subset B of A is called a subalgebra of A if B is non-empty and if for any b, b’ E B and k E K , the elements
(1.1)
b
+ b’,
bb‘,
kb,
b+
are in B. Since Ob = @ it follows that 0E B. Thus B is a K+-algebra. It is clear from the definition that the intersection of any family of subalgebras of A is again a subalgebra of A. Consequently given any
1. +-Algebras
161
subset B, we may define the closure
B
as
where C ranges over all the subalgebras of A containing B. T h u s B is the smallest subalgebra of A containing B. I n other words B is the smallest non-empty subset of A , containing B and closed under the four operations (1.1). We shall refer to these four operations as the rational operations. T h u s a subalgebra is a non-empty subset which is rationally closed (i.e., is closed under the four rational operations). Let a : K + K' be a morphism of semirings, A a K+-algebra, and let A' be a K'+-algebra. A function p: A A' is called a morphism of Kf-algebras (relative to a ) if it satisfies --f
a.
for all a , b E A and K E K . Taking k = 0 it follows that = When K = K' and c( is not specified, it will silently be assumed that ( I is the identity. With K fixed, the K+-algebras form a category in the obvious manner.
PROPOSITION 1.1. Let A be K+-algebra, A' a K'+-algebra, let p: A + A' be a morphism relatice to a morphism u : K + k".
and
I f B' is a subalgebra of A ' , then B'T-' is a subalgebra of A. I f (1 is surjective and B is a subalgebra of A , then By) is a subalgebra of A'. (iii) For any subset B of A
(i) (ii)
Bp
c
Bp,
I f further u is surjective, then Bp
=
Bp
+
Ad (i). Let a, b E B'vl-', i.e., ap., b y E B'. Then ( a b)p = ap bp E B' so that a b E B'q-1. T h e proof for the other operations is similar. Proof.
+
+
VII. Rational Sets
162
Ad (ii). Let a', b' E B y , i.e., a' = aq, 6' = bp with a, b E B. T h e n b' = up, bq = ( a b ) y E Bv. Similarly a'b' E Bq and a'+ E Brp. If k' E K ' , then since a is surjective, k' = ku for some k E K . Consequently k'a' = ( k a ) ( a p ) = (ka)p E Bp
a'
+
+
+
Ad (iii). Since B c Byy-' c Byy-' and &y]-' is a subalgebra of A [by (i)] it follows that B c &q-l, i.e., Bq c If (;I is surjective, then
&.
by (ii), By is a subalgebra of B. Since Bp c Bp it follows that
&c
I
The construction of the rational closure B of a subset 13 of a K+algebra A may be presented inductively by constructing a sequence
B'-" c B(O)c B ( ' )c . , . c B'") c . . such that
(1.2) T h e definition of the sets B(h) is as follows:
(1.3) B'-" is empty. consists of all finite sums of monomials (1.4) B(h+l)
k n , . . . a,, with k
E
K , and
ai E
R or a i = C + with c E B ( h )
Thus, in particular, B'O) consists of all finite sums of monomials ka, . . . a,, with a , , . . . , a,, E B. T h e verification of (1.2) is immediate. T h e elements of - B'h-l) are said to have height h . T h e K+-algebra '4 is callcd zinituvy if there exists an element l A E j A such that for all a E A l,a = u = a1 I, For a unitary K+-algebra '4, we denote a" = 1
+ a'
2 . Rational K-Su bsets
163
Even when A is not unitary we shall use
a"6
and
6a"
and
6 +bat
as convenient abbreviations for
a76
+6
2. Rational KJubsets
Let K be a commutative complete semiring and let S be a semigroup. With the operations
as defined in V1,3 and VI,5, the set k'" of all the K-subsets of S forms a complete K-algebra. Consequently with
K s also is a K-+-algebra. We shall bc interested in the subalgebra Rat,; S which is the closure of the class of all singletons of S . T h e K-subsets of S belonging to RatI; S are called rational. More generally given any class '8 of K-subsets of S we shall denote by Rat,<'&'
or
Rat '8
the closure 7 of @' in K". We call Rat,; 5 the rational closure of the class '8. It is important to emphasize that even though in eS infinite summation is available, in the formation of Rat,; '%' only finite sums are used. Otherwise the closure of the set of all singletons of S would be all of K.". Let Q : K 4 K , be a niorphisni of complete semirings and S a semigroup. For each A E nS, we have A p E K,S and there results a inorphism of +-algebras
VII. Rational Sets
164
over cp: K + K,. Since (2.1) maps singletons into singletons, Proposition 1.1, (iii) implies: PROPOSITION 2.1.
If y ~ K : + K' is a morphism
of complete semirings,
then for each semigroup S
(Rat,; S)v c RatK, S.
If further
'p:
K + K ' is surjective, then (Rat, S)'p = Rat,, S
COROLLARY 2.2.
I
If K is positive, then (RatK S)t = Rat.2 S
I
Let S , S' be semigroups and let
f: S + S ' be a K-relation which is multiplicative, i.e., such that
for all x , y E S . For each A results a function
E
KS we then have Af E Ks' and there
f: Ks + KS' which is a morphism of K+-algebras. This follows from the identities
From Proposition 1.1, (iii), we deduce: PROPOSITION 2.3. Let S , S' be semigroups and f: S tiplicative K-relation. Let
@ = {xf
IXE S}
+
S' a mul-
2. Rational K-Su bsets
165
Then (RatIc S)f
=
Ratl,.
5 I
Since a morpliism f : S + S' is a special case of a multiplicative relation we obtain : PROPOSITION 2.4,
Let f ; S
4
S' be a morphism of senilgroups. Then
(Rat,; S ) f c Ratlc S'.
I f further f : S
+
S' is surjective, then (RatK S)f
=
Rat,,. S'
I
PROPOSITION 2.5. Let S be a semlgroup. For each A E RatK S there exists a finite alphabet .Z and a niorphisni f : S+ + S such that A = Bf for some B E RatK S+.
Further, ;f I' is any subset of S generating S , then f may be chosen so that Zf c r. be an alphabet in a 1-1 correspondence with the set l', Proof. Let and let f : p++ S be the morphism defined by pf = y . Since generates f is surjective. T h u s by Proposition 2.4 we have A = /if for some A E Rat,; p. T h e conclusion now follows from:
r
S,
PROPOSITION 2.6. Let k' be a complete semiring and r an infinite alphabet. For each A E Ratli r+(resp. A E Rat,; P ) there exists a finite subset S of I ' s u c h that A E Rat,; If(resp. A E Rat,; Z"). Proof. Let A be the class of all rational K-subsets of T+ for which the conclusion holds. Clearly all singletons are in g.It is also clear that t8' is rationally closed. T h u s Rat!; T +c 6' I
COROLLARY 2.7. For each seinigroup S Rat,; S =
U RatK Si
where S , ranges ocer all the finitely generated subsemigroups of S . If S = I*or S = Yr+, it suffices to consider S , = Eb*or S , = S,+ with
z l C sI
VII. Rational Sets
166
\lie rcnrind the reader that in this section K is assumed to be a complete semiring. 'l'lic case \\.lien K is a seniiring that is not ncccssarily complete will be treated in Section 4. EXERCISE 2.1. Let K 1)r N (coniniiitati7~ecomplete) semiring, and let A , '4' be cntnplete K-algebras. Dejinr ( I morphisni (1 : .4 -+ '4' as a function S(I t i s f ying
(C JOT (k.J)r/
IZ(A/),
c (J,T)
('4/1)(/
~
(.4f/)(Hy)
Show tlicrt this yields a category A,; (4roniplete I\'-algehr.os. Show that in this rntegory the (rIgehras Kx', where V is any set, are free. This means that for anjl roniplete K-algebrii A , tiny fiinctiori f : .Y -* '4 udniits a unique tnorphism 78: K L 1-+ .4 which iigvees with ,f on the singletons 0 E I. EXERCISE 2.2. IVithitz thr terniitzology of Exerrise 2.1, show that any tnorphistn 71: K s + P ' ,where S and S' are semigroiips, is defined by a niiiltiplirntive K-relation f : S + S ' .
I d K be a coniplrte serniritig cind S a sernigroiip. Show that the K-(rlgebra KS is coniniiitative ;ff S is commutatizw. Show that Es is unitary I# ,S is n motioid. EXERCISE 2.3.
EXERCISE 2.4. Let K be a (conzplete rotnniiitativr) serniring. 1,rt ( S ,, i E I ) be a f(ztni1y of subsemigroups of n srtnigroiip S siirlr that
(i)
S
=
u Si it I
(ii)
Given i, , i, E I , there exists i E I such that
Show thut RatK S =
Rat,; Si it1
3. Rational Expressions and Identities
In making ~ 1 pthe list of axioms for a K+-algebra we did not list any axioms involving the operation a ' . In the K-+-algebras k'" that we studicd in Section 2 many identities liold involving thc operation a +.
3. Rational Expressions and Identities
167
We give a partial list of the ones that seein to be of importance
(3.1)
.3'
(3.2)
aaf =
3 a+a
(3.3)
(I
=
a"0
(3.4P)
lZ+
=
( a -1 . . .
(3.5)
(""b)+
(3.6)
(a
(3.7)
= (a
+ aP)(uP)",
p
1
-16)"b
t 6 ) + = (a*b)+cz" + a ' (ah)+- a(0a)"b
Before we indicate the proofs, we must discuss the meaning of these equations. Consider (3.5)-(3.7). If a and 6 are elenients of a K+-algebra A , then both the left-hand side and the right-hand side are elements of '4 that we may denote by
respectively. These functions
are built using thc rational operations only and are called rational expressions in two variables. T h e equation ( a , b ) u = (a, O)ZJ does not hold in all K+-algebras A. Howcver, it does hold if .4 = k's, where S is a semigroup. We show that it suffices to verify the equation ( a , / I ) . = ( a , 6)u in the generic case when S {o,-c}+ and a = 0 , 6 T . Indeed, assume :
Let A , B
E
Ks, and consider the multiplicative A--relation f:
(0,
-c}++S
defined by Uf'-
iz,
Tf
Then f defines a morphistn f : K{'~ri'
--f
=
B
k"of K+-algebras. Since u
VII. Rational Sets
168
and
ZJ
are built using only the rational operations, we have
and similarly for v . T h u s (3.8) implies
( A , B)u = ( A , B)" as required. When written in the generic case the identities become obvious. For instance, (3.8) becomes
(rift)'which asserts that any word of written in the form
= (0 (0,7 ) '
C,TC27
+ T)*T ending with
T
can uniquely be
. . . C,,T
with n > 0 and with each c i a power of 0 or c i = 1. From these identities one can derive others that are much less obvious. We give an interesting example. Let a ( p ) denote the pth iterate of a+
a(P)= ( p a ) * a
(3.9)
for all p 1 1
For p = 1 the equation becomes a+ = .+a (3.9) for p we compute using (3.5) a(P+')= (a(,))+ = ((pa)*a)' = ( p a
which is (3.3). Assuming
+ a)*a = ( ( p + l)a)*a
as required. Observe that if K = .a,then p a = a so that (3.9) becomes a(,) = a + or equivalently a++ = a+. Let L be any list of identities valid in all the K+-algebras Ks. Denote by A ( L ) the class of all K+-algebras in which all the identities in L are valid. We say that I, is complete if A ( L ) c A ( L ' ) where L' is any other such list. W e quote without proof the following:
.'a,
(Conway) If K = then any complete list of identities must contain infinitely many identities with two or more variables I THEOREM 3.1.
3. Rational Expressions and Identities
169
We shall now assume that the semiring K is positive. T h e height uh of a rational expression u is defined inductively as
@h=0, (u
ah=O
+ v ) h = max(uh, vh)
( k u ) h = uh
if
(uv)h = max(uh, v h ) (11
' )h = 1 f
ku f 1 3 if
u # 3f v
24h
T h u s the height measures the number of nested +-operations. In identity (3.1) the left-hand side has height 1 while the right-hand side has height 0. In ( 3 . 5 ) the left-hand side has height 2 while the right-hand side has height 1. If A E Rat,; E + ,the height iliz of A is the least height of a rational expression representing A. T h e question as to whether one can effectively determine the height of any rational K-subset of S t is open. An equivalent question is to give an algorithm to decide whether, for a given rational expression u of height 11, a rational expression v of height lower than h can be found representing the same K-subset of S t as u. T h e following $-subsets Ah of {a, 7 ) ' are known to have height exactly h A, = (at)'
A,,, EXERCISE 3.1.
=
(a?4,LT?4h)t
Let
be rational ecpressions. Show that if the equation (a,,
. . . , a,,)u= ( a , , . . . , a , , ) ~
holds for a , , . . . , a , E Rat,; {a, t}+,then it holds f o r a , , . . . , a,, E K S , where S is aniv semigroup. [Hint: Use the coding S* + 2" of ~ 7 . 1 EXERCISE 3.2. Show that the dejinition of height given in this section agrees with the one given in Section 1.
170
VII. Rational Sets
4. Locally Finite Monoids
In trying to define the class Rat,,- S when S is a semigroup and K is a commutative semiring not assumed to be complete we encounter the following difficulties. T h e formula
x ( A B )=
c (yA)(zB)
z=gz
cannot be used unless x admits only a finite number of factorizations x = y z . Also the family of K-subsets A”, n E N , need not be locally finite, so that A’ cannot be defined. T o overcome this difficulty we must put some restriction on the semigroup A semigroup S is said to be locally jinite if each x E S admits only a finite number of factorizations
s.
.Y = .Y1
(4.2)
. . . xjl
A locally finite semigroup cannot have an idempotent element and thus cannot have a unit element. For a locally finite semigroup the summation (4.1) is finite. Also, if n is the largest intcger for which a factorization (4.2) exists, then x ( A p ) 0 for n < p and .4+ = AILis well defined. Consequently k”’ becomes a K +-algebra and Rat,; S is defined without any difficulty, just as in the case when K was complete. All the conclusions of Section 2 now carry over with the completeness assumption on K replaced by the local finiteness of the semigroup. I n Propositions 2.3 and 2.4 we must assume that f is locally finite (see VI,4) while in Proposition 2.5 we must add the local finiteness off to the conclusion. We let the reader verify the details. T h e difficulties are, however, not yet over. Since a locally finite semigroup cannot have a unit element, we do not have the class Ratli V* except when K is complete. Indeed 1” will involve the infinitc summation 1 1 .... A monoid M is said to be locally jinite if each x E M admits only a finite number of factorizations (4.2) with x, f 1 for 1 5 i 5 n. I t follows that if xy = 1, then s = 1 = y , since otherwise infinitely many factorizations xysy . . . xy of 1 are obtained. If follows that M - = M - 1 is a semigroup and indeed is a locally finite semigroup. Conversely, if M - is any locally finite semigroup, then the monoid
x:=l
+ +
(4.3)
M=l+M
171
4. Locally Finite Monoids
obtained from Ill- by adjoining a unit element, is locally finite. Exercises 4.1-4.6 show that the class of locally finite monoids is very manageable. Now given a semiring K and a locally finite monoid (4.3) \ve consider the class 'fl of all K-subsets '4 of A2 such that
Note that Rat,,. izI- is lie11 defined since Ill- is a locally finite semigroup. Equivalently f l is the class of all K-subsets of ,I3 of the form '4
(4.5)
=
k
+ B,
B
E
Ratli "lI
where \ve write k instead of k l , with 1 the unit element of A I . PROPOSITION 4.1. Let ,/2Zbe a locally jinite monoid. The class 67' of all K-subsets of M of the f o r m (4.5) is the smallest class coiitaining all the singletom of A1 and closed zmder the four rntional operations with the operation A restricted to K-subsets of AZ- = A l - 1. If, fiirther, K is a complete seiniring, then = Rat,,. M. Proof.
Let
L4 = k with B, B'
E
+ B,
Rat,; M" and let I
A
E
-4'
=
k' -t R'
K . Then
+ A' = (k + k ' ) + ( B + R') '4.4' = kk' -1- (kB'+ k'R + B B ' ) 1-4
7
lk
4-1B
+
so that '4 A ' , A A ' , and lA are in '6, If, further, A is in M-, then A = B. T h u s A + E RatTin/3- c '6T. h u s '8 contains all the singletons of A l and is closed under the operations listed in the proposition. If 8' is another such class, then Ratlc 111- c H' and K c 8' so that 8 ' c 8'. Now assume that K is a complete semiring. By the part already proved, 8 c RatTi AZ. T o probe the opposite inclusion it suffices to show A+ E '8 for every A E 6. Let A = k B with B E Ratli M-. Applying formula (3.6) we obtain
+
=
so that A+ E @ ' '
I
(k + B)'
=
k+
+ k*(k*R)+
VII. Rational Sets
172
In view of Proposition 4.1, we define the class Ratl( M for K a semiring and M a locally finite monoid to be the class of all K-subsets of M of the form (4.5). Various facts established in Section 2 under the assumption that K is complete can now be reestablished. PROPOSITION 4.2.
If p: K
is a morphism of semirings, then f o r
+ K'
each locally finite monoid M (RatKM)p c RatKtM
If, further, q~ is surjective, then ( RatK M)p = Rat,, M Proof. This follows from Proposition 2.1 stated for locally finite semigroups I COROLLARY 4.3.
If K is positive, then (Rat,; M ) ?
=
Rat,* M
I
Let M , M ' be locally finite monoids and let f: M ' be a morphisin which is locally jinite (i.e., y f is finite f o r all y E M ' ) . Then for any semiring K PROPOSITION 4.4.
M
+
(Rat, M ) f c RatK M '
I f , further, f is surjective, then (Ratl; M ) f
=
Rat, M '
Ry Exercise 4.5, f defines a locally finite morphism of semigroups M - 4M'-. Thus the conclusion follows from Proposition 2.4, stated for locally finite semigroups and a locally finite morphism I Proof.
Let M be a locally finite monoid. For each A E Ratli M there exists a jinite alphabet Z and a locally finite morphism f: P + M such that A = Bf for some B E RatK 1". PROPOSITION 4.5.
4. Locally Finite Monoids
173
Further, if I' is any subset of M generating M as a monoid, then f may be chosen so that 2f c I' I PROPOSITION 4.6. Let T b e an infinite aphabet. For each A there exists a finite subset Z of r such that '4 E RatIi 2" I COROLLARY 4.7.
E
Ratli P ,
For each locally finite monoid M Ratli M
= (J RatR M
i
where M , ranges over all the finitely generated submonoids of M . If M = Z", it suffices to consider M i= Zi" with Xi c Z I These are paraphrases of Propositions 2.5, 2.6, and Corollary 2.7.
A K-relation f: I ' " + X " is called a substitution if it satisfies
for all s, t E P.Such a substitution is completely defined by the family of K-subsets
{Yf I Y E I'I PROPOSITION 4.8.
Let f: 1'"
--f
2" be a substitution where I' is
finite. If y f RatK ~ L'+ for each y E
I', then f is locally finite and ( RatK P ) f c Ratll Z"
Proof,
Since each yf is a subset of 2+it follows that
~ ( x f= ) 0
if
x
E
P, y
E
Z+, I y
I < 1 .Y 1
Since I' is finite it follows that for a given y E S", y ( x f ) # 0 only for a finite number of elements x E 1'" and thus f is locally finite. Further f defincs a locally finite multiplicative relation g : I T ++ I+so that the conclusion follows from Proposition 2.3 stated for locally finite semigroups
I
VII. Rational Sets
174
PROPOSITION 4.9. Let f : 1'" 1"be a $tie morphisnz, where I' is finite. For any rationcrl K-sithset '4 of 9 the K-subset A f of r" is rational. --f
Proof.
Without loss we may assume that L is finitc. Define
Since 1' is finite, thc sets D and C, arc finite. For each
we have
Define the substitution
Then
sf - 1
=
(sg)D"
Since ag E Rat,; 1'1, it follows from Proposition 4.9 that for any rational K-subset '4 of S", the K-subset A g of 1'" is rational. T h u s A f -* = ( A g ) D also is rational I Formula (4.6) shows that f is almost a substitution but not quite. In fact for K = . A ,f - l is a substitution since D*D* = D" in /A"*. EXERCISE 4.1. Show that a inonoid is free zff it is locally jinite and has the siibdizlision property of Exercise III,12.10.
EXERCISE 4.2.
Show that a subnionoid of a locally jinite inonoid is
locally jinite. EXERCISE 4.3.
Show that the product M I x M 2 of two locally jinite
monoids is locally jinite. EXERCISE 4.4. Let M be a locally .finite inonoid and let I' = A4 - M 2 . Show that rgenerates M as a nzonoid and I' is contained in m y sirbset I"
5. Kleene's Theorem
175
of ill generating ill. Let that the movphisni f: p"
p
be a set in a 1-1 correspondence with r. Show ill defined by pf = y , is localij jinite.
+
EXERCISE 4.5. Let 11.1, M'be locally jinite monoids and let f:ill 4 M ' be a movphism. Show that i f f is localij jinite (i.e., yf - I is jinite f o r all y E hg'), then 1 If - I . Thus f defines a locally jinite movphisni of semigroups il.1 - 1 4 il4' - 1. Show that i f M is jinitel-v generated and 1 = 1f - I , then f is locnlly jinite. EXERCISE 4.6. Show that a monoid ill is localij jinite both of the following two conditions:
18it
satisjies
Each .Y E ill has a jinite numbev of factorizations y,zEM,y#l~,-. (ii) There exists a function y: ill N satisjying
.2: =
yu" with
(i)
---f
.2:y .YT
0
+ yy 5 (xy)y
f 1
for all
,Y
for all
.x, y
E
il.1
EXERCISE 4.7. A substitiition f: 9-+ 1'" is said to be finite q cf is a finite (unambiguous) subset of r". Show thnt i f 1: and r are jinite, then each such a substitution is the composition
p
8-1 L
s*
6 __+
1'*
where ~2is a jinite alphabet, g : 9" -+ Z" is a ziery jine morphism, and h is a morphism. 5. Kleene's Theorem THEOREM 5.1. (Kleene). Let K be any senliving and Z a fiizite alphabet. A K-subset iz of S" is recognizable ;f and only i f it is rational. Proof. 1,et '6be the class of the recognizable K-subsets of Z". T h e singletons 1 and B E L arc recognized by the automata
-0-
+0'-04
and thus are in '6Propositions . VI,7.1, 7.6, 7.8, and 7.9 show that '6 is closed under rational operations with the operation A t restricted to
VII. Rational Sets
176
K-subsets of S+.Thus, by Proposition 4.1, RatK Z* c 6‘. This proves the theorem in one direction. To prove the theorem in the opposite direction, let d =((I,I , T ) be a K-Z-automaton. Let Q = (1, . . . , n } and consider the K-subsets Aij = I ((I,i , j ) I
for 1 5 i,j 5 n. Since
I JY’ I = C ( i I ) ( j V i j i,j
it suffices to show that all the K-subsets Aij are in RatK Z*. For any integer 0 5 k 5 n, let C$) be the set of non-trivial paths c:
i-j
which do not pass through any state I > k . More exactly, for each factor-
into non-trivial paths the inequality I < k must hold. Let Bjf) be the sum of the labels of the paths in Cg). We have
B!?’ = E.. 11
Bit’ = j 3 - I ’
+Bik
(k-1’
B‘k-1) +B‘k-I’
( k k
)
kj
,
O
We recall that E is the transition matrix of d.T h e last formula follows from the observation that a path c : i j is in C$)iff either it is in C$-l) or has a factorization --f
.
11
CI
ce
z - k - k - . . . k % k ~ j
,
n 2 0
into paths in C#-’). This factorization is unique. Since E i j are rational K-subsets of Z* it follows from the above formulas that Bit) are rational for all 0 < k < n. Consequently A i j are rational I It should be observed that the proof of Kleene’s Theorem as given above is effective in the following sense: Given any rational expression
177
5. Kleene's Theorem
( a l , . . . , cr,)u with r = Card S, the proof gives (by tracing through Propositions VI,7.1, 7.6, 7.8, and 7.9) an effective construction of a S - K automaton ,a/ such that I d I = ( a l , . . . , ar)zi. Conversely given such an automaton, the second half of the proof constructs a rational expression (o,, . . . , ar)u such that 1 -dI = k ( o l , . . . , ar)u with k E K also effectively calculable. In particular, this implies that in those cases in which the question 1 dl 1: I d. I is decidable (i.e., at least when K = .%' or when K is a subsemiring of a field) the question as to whether ( a , , . . . , ar)u = (ol , . . . , crr)u for two rational expressions u and ZI also is decidable. We list some other consequences of Klecne's Theorem :
+
THEOREM 5.2. If A l is a free monoid or a free semigroup, then the class Ratli ill is closed under intersection.
i' = S" with S possibly Proof. I t suffices to consider thc case when h infinite. I,et A , B E RatK I* T h e n. by Proposition 4.6 we have A , B E Rat,; El*, where 2, is a finite subset of L'. T h u s by Kleene's Theorem, A and B are recognizable K-subsets of 1,". By Proposition VI,7.1, the same holds for '4 n B. T h u s by Kleene's Theorem ,4 n B E Rat,; Zl* c Rat,< 1" I T h e following example shows that Theorem 5.2 fails when M is not free. EXAMPLE 5.1. Let M = {a, t } " x (7)". T h u s M is the monoid = qa, tq = vt. generated by the letters cr, t, 7 with the relations Consider the rational .??-subsets
If n : M
+
{a, t}" is the projection given by an = a, tx =
t, qx =
1,
then
( A n B ) n = {aptp I p L O} Since ( A n B)n is not rational (with K = 9?), it follows that A n B is not rational.
178
VII. Rational Sets
PROPOSITION 5.3. Let K be a complete semiring, let M be a monoid, and let B be a recognizable L??-subset of M (in the sense of III,12). If A E RatK M , then A n B E Ratlc M . Proof, By Proposition 2.5, there exists a finite alphabet Z and a morphisni f: Z+ ---t M of semigroups such that A = A ' j for some A' E Ratl; S+.Setting If = 1 we may extend f to a morphismf: Z* M and may regard A' as an element of Rat,; 1". By Exercise III,12.4, Bf-l is a recognizable .a-subset of 1". Consequently by Proposition VI,7.14, Bf is also an unambiguous recognizable K-subset of S*. Thus by Kleene's Theorem Bf E RatK P and therefore by Theorem 5.2 +
p1
A' n Bf-'
E
Rat/; L'*
From Proposition 2.4 we deduce that (A' n B f - ' ) f ~Rat,{ M However, by Corollary VI,4.2
(A' n Bf-')f
=
AY n B
=
A nB
I
PROPOSITION 5.4. (McKnight). If B is a recognizable subset in a finitely generated monoid M , then B E Rat,&M .
Since M = F t for some finite subset F of M , it follows that Ratd M . Thus Proposition 5.3 yields B = M n B E Rata M I
Proof.
M
E
If S is an infinite alphabet, then recognizable subsets of L'* may be defined in two different ways. T h e first method is that of III,12 applied to the monoid M = 2". With this definition L'* is a recognizable subset of itself. T h e other method is to define a K-S-automaton to be a K-1,automaton where Zl is any finite subset of 2. With this definition it follows from Corollary 4.7 that Kleene's Theorem remains valid for infinite Z. Of course Z* is no longer a recognizable subset of itself, and thus the class of recognizable .&'-subsets of Z* is no longer closed under complementation. EXERCISE 5.1. Let Z be an injinite alphabet, Zl a Jinite subset of 2, and A a recognizable @-subset of Z1*.Show that A is also a recognizable 9 - s u b s e t of 1*in the sense of III,12. Conclude that rational %'-subsets of 2+are recognizable.
6. Linear Equations
179
EXERCISE 5.2. Let L be an alphabet (possibk injnite). Show that the recognizable 3'-subsets of 2" coincide with the class RatN R where 8 is theclassofallsubsetsof 1 u 1. [Hint: Use E.vevcisesIII,12.10and 12.11.1 EXERCISE 5.3. Consider an alphabet L = {a,,I 1 5 i,j 5 n } and let E be the n A n-matrix with ELi= c,,. Show that all the entries of the matrix E" are in Rat,; L* and all those of E i are in Rat,i S+. [Hint: Construct an automaton with E as transition matrix.] EXERCISE 5.4. Let K be a semiring and S a semigroup. Assume either that K is complete or S is locally jinite. Let $' 3' be a class of K-subsets of KS and let E be an n / n - m a t r i x with entries in '8Sliow . that the matrix E+ has its entries in RatK fl. [Hint: CTse Exercise 5.3 and a nzultiplicative relation.]
6. Linear Equations
T h e proof of the second half of Rleene's Theorem gave an effective method for computing the behavior of a K-S-automaton. It is desirable to have a method which is more algebraic. Such a method (which in essence is a reformulation of the present proof) depends on the study of linear equations. Since a full discussion of equations (not necessarily linear) will be given in Volume C in connection with the theory of context-free languages, we will present here only the minimum necessary. Consider a system of n equations with n unknowns
where Eij and T j are h'-subsets of 2'" and so are the unknowns X i .I n matrix notation the system takes the form
(6.2)
S = EX+ T
where X and T are column vectors. PROPOSITION 6.1.
The vector
(6.3) is a solution of the system (6.2)
X = E"T
180
VII. Rational Sets
Proof.
Writing 1 , for the n x n unit matrix we have
E"T
=
(1,
+ EE")T = E(E"T) + T
If
PROPOSITION 6.2.
Eij c Z+
(6.4)
I
for all
1 5 i, j 5 n
then the system (6.2) has a unique solution. Proof. Let X and Y be vectors of K-subsets of Z* solving (6.2). We shall prove that
sXi = sYi
for
15 i 5 n
and all s E 2". This will be done by induction on the length I s I. If 1 s 1 = 0, i.e., s = 1, then since lELj= 0 by hypothesis, it follows that 1Xi zz 1Ti = 1Yi. We now proceed by induction and assume I s I > 0. Then
and similarly with the X's replaced by Y's. Since uEij = 0 when u = 1, we may exclude the case u = 1 , 2, = s from the summation, and thus consider only I v 1 < I s I. Since v X j = vYj by the inductive hypothesis, we obtain sXi = sYi I We note that condition (6.4) is sufficient but not necessary for uniqueness. Some condition is however needed because the equation X =X 1 (one equation with one unknown) is satisfied by every subset X of Z* such that 1X = 1X 1 . In particular, if K = ~ 2 then , any subset of 2* containing 1 is a solution.
+
+
PROPOSITION 6.3.
(6.5)
If in addition to (6.4)
E i j , T i E RatK 2"
for
1 5 i, j I n
then the unique solution of (6.2) satisfies
X I , . . . ,X ,
E
RatK Z"
181
6. Linear Equations
+
E,,T, is a solution and Proof, If n = 1, then X, = E,,T, = T , is in RatK 2". Now proceed by induction and assume n > 1. Write the nth equation as
it follows from Propositions 6.1 and 6.2 that Since En, c 2+-
Substituting this into the first n
of n - 1 equations with n
-
-
1 equations we obtain the system
1 unknowns with
Thus the system (6.8) still satisfies condition (6.5) and (6.4), and thus by the inductive hypothesis its unique solution X , , . . . ,X,-, is in RatK 2". Substituting in (6.6) we obtain C E Rat, 2". Thus (6.7) yields X,, E RatK 2". Since S,, . , . , X,,clearly solves (6.2), the conclusion follows I T h e procedure of the proof gives a definite algorithm for expressing the solutions X , , . . . , X , , as rational expressions in the coefficients Eij, Ti.These expressions will depend upon the numbering of the equations. Now let d =(0,I , T ) be a K-2-automaton and assume that Q = (1, . . . , n } . Let E be the transition matrix of d. Define
Then by Corollary V1,6.2
Xi
=
(E"T),
so that
X = E"T
VII. Rational Sets
182
Since E i j c Z, condition (6.4) is satisfied and thus X is the unique solution of the system of equations
X = EX+ T Since all the coefficients are in Ratli Z", it follows that X , , in Ratli Z". Since
. . . , X n are
where I i = il is the value of I at the state i, it follows that
As a by-product we obtain: Let d =( Q , I , T ) be a K-Z-automaton with (1, . . . , n } and with transition matrix E. Then (6.9) holds with ( X , , . . . , X,,) the unique solution of the system of equations
THEOREM 6.4.
Q X
= =
X = EX+ T
I
7. Examples EXAMPLE 7.1.
Consider the automaton
T h e equations are
x, = a x , + TX,
x,= (.
+ ")X,+ 1
Solving the second equation yields
x, = .(
+ T)"
Thus the first equation becomes
X I = GY' ,
+ z(a + T)"
so that
X,
= u*t(.
+ T)"
7. Examples
183
This is the behavior of the automaton. It is the unambiguous set of all words in {a, z } * which contain at least one letter z. EXAMPLE 7.2. Consider the automaton
T h e equations are
x,= ax, + T X , + 1 x,= zx,+ ax,
From the second equation we obtain
Th u s the first equation becomes
x,= ( 0 + to%)X, + 1 and therefore
x,= (a + T&)*
This is the behavior of the automaton. It is the unambiguous subset of those words in { G , T } * which contain an even number of T ' S . If we first solve the first equation, we obtain
x,= a*(tS, + 1) Th u s the second equation becomes
x,= (a + t a " t ) X , + za* Consequently
x,= (a +
and therefore
XI = a*t(o
+
TfJ*T)*T(T*
TU*T)*TB*
+ 0%
Th u s the second procedure yields a considerably more involved rational TO*T)*. expression for the set (a If we retain 1 as an initial state but regard both 1 and 2 as terminal states, the behavior of the automaton should be {a, t}*, as the automaton is complete, deterministic, and all its states are terminal. T h e
+
VII. Rational Sets
184
equations however are
x,= ox,+ tx,+ 1 x,= t X , + ax, + 1 T h e second equation yields
x,= a"(tx,+ 1 ) so that the first equation becomes
x,= (a + ta*t).Y, + TO* + 1 Consequently
This indeed is the set {a, t}" represented as the union of the set of words having an odd number of t ' s and the set of words having an even number of t's. EXAMPLE 7.3. We propose to find a rational expression representing the unambiguous set
A = Z*
-
Z"ataZ+,
Z
{a, t}
=
We start with the non-deterministic automaton a
0 0
+1"2L3"4+ T
a
0 0
whose .2?-behavior is Z*ataL'*. Applying the subset construction we obtain the table
l a = 12, 12a = 12, 130 = 124, 1 2 4 ~= 124, 1 3 4 ~= 124, 1 4= ~ 124,
It= 127 = 13t = 124t = 134t = 14t =
1 13 1 134 14 14
7. Examples
185
which leads to the complete automaton n
U
in which 1, 2, 3, 4, 5, 6 replace 1, 12, 13, 124, 134, 14. T h e state 1 is initial and 4, 5, 6 are terminal. 'I'he behavior is the unambiguous set given by S"~TGL'". T o obtain a complete automaton ,u/ with I ,w' I = A we must replace the terminal states 4, 5, 6, by 1, 2, 3. In this automaton the states 4, 5 , 6 are no longcr coaccessible and thus may be omitted. This leaves the deterministic automaton
T h e equations are
s,= T S , + us, + 1
x,= ox, + tX;,+ 1 x,= tX, + 1 Eliminating X, we obtain
x,= LY, + o x 2 -k 1 'Y, = O X , + ?XI + 1 + t. Thus
x,= O " ( t ~ X ,+ 1 + t)
and the first equation becomes
VII. Rational Sets
186 8. Unambiguous Rational Sets
Let M be any monoid. We shall consider the unambiguous subsets of M and will restrict the rational operations in such a way that only unambiguous subsets can be obtained. This means that the union A u B can be formed only if A and B are disjoint. Similarly the product A B can be formed only if 4 6 , = a,b, with a,, a, E A , b , , 6 , E B implies a, = a 2 , 6 , = 6,. I n order to form A 1 we require that each All, n > 1 can be formed and further that the resulting sets A , A2, . . . , A", . . . are disjoint. This is easily seen to be equivalent with the following condition: If a, . . . a,, = a,' . . . a;,, with a , , . . . , a,,, a,', . . . , E A , then n = n' and a, = ai' for all 1 5 i 5 n. Such sets were considered in IV,5. We called such a set a base because the submonoid A" of M is free and has .4 as its base. Since the unit element 1 of M cannot then belong to A , the condition is equivalent with A + being a free subsemigroup of M with A as base. T h e three operations A u B, AB, and A +just described, with the restrictions concerning their applicability, will be called the unambiguous rational operations. T h e class URat M of the unambiguous rational subsets of hf is the smallest class '$ of unambiguous subsets of M such that :
(8.1) all singletons (8.2) E 'if,
712
are in 'fi,
a
(8.3) '6is closed under the unambiguous rational operations. PROPOSITION 8.1. Let A be an unanzbiguous subset in a monoid M . E Rat.v M if and only A E URat M .
Then A
Proof, Clearly if A E URat M , then also A E Rat, M . To prove the opposite implication, denote by d the class of all N-subsets of M that are not unambiguous and define
9 = '6u URat Ad Clearly all singletons are in 9. We propose to show that 9 is rationally closed. Assume A , B E 9.If A u B is not unambiguous, then A u B E '6 c 9.If A u B is unambiguous, then A and B must be unambiguous and A n B = (2. Since A , B E 9 it follows that
8. Unambiguous Rational Sets
187
A , B E URat A2 and thus A u B E URat Ai' c 9.T h u s in all cases '4 u B E 3.If A R is not unambiguous, then rZB E 6'.If A B = (i.e., A = ~4 or B ,-I), then AB E URat M . If A B f (3 and A R is unambiguous, then ;2 and B must be unambiguous and thus A , B E URat h2, \$hich implies .4B E URat M . 'l'hus in all cases A B E 9.Let k E N . If k = 0 or A = (23, then k A = (3and thus k A E URat M . If k = 1, then k,4 A E A. If k 7 0, 1, A f @, then k A E 6'.'l'hus in all cases k.4 E 2'. If A + is not unambiguous, then A + E 6.If A+ is unambiguous, then A also must be unambiguous and thus A E URat IIf. Consequently A1 E LJRat M . T h u s in all cases A+ E 9. :
~
Having shown that
$1
is rationally closed we deduce that
Rat, hi' c '8' u URat ICZ This is precisely the desired conclusion THEOREM 8.2. Let A be a recognizable zmambiguous subset of 3". E URat Z",
Then A
Proof. By Proposition VI,7.14 and by Kleene's Theorem we have E Rat, S". Since A is unambiguous the conclusion follows from Proposition 8.1 I
'4
Another way of verifying Theorem 8.2 without using Proposition 8.1 is as follows. We apply to A the iterated up-decomposition of Chapter IV, and verify that all the operations applied are unambiguous rational operations. T h u s the iterated up-decomposition effectively shows that
.4 COROLLARY 8.3.
E
URat 1"
Rat,, 1%= URat 1".
We quote without proof the following: THEOREM 8.4.
monoid, then Rat
(Eilenberg-Schutzenberger) = URat M I
If M is a commutative
M
T h c conclusion fails when M is the product monoid {a, t
} "{ q ~} " .
EXERCISE 8.1. Let '3 be an uizanzbiguous subset of the free monoid Z". Show that the following conditions are eqitiualent :
VII. Rational Sets
188
(i) A is a base. (ii) A+-is unambiguous. (iii) A* is unambiguous. (iv) a,A" A a2A" = @ f o r a , , a? E A , a , # u2 EXERCISE 8.2. Consider the N-subset A = {a,TC, at}* of {(T, T } " . Exhibit an element s E {a, r}" such that sA = 2. Show that a,T ( T , (TT form a unique minimal generating subset for the submonoid A of {a,T}". EXERCISE 8.3.
Show that in a commutative monoid M an YIr-subset
A is rational ifJ
,4
1
(JC'Bi"
where the union i s j n i t e , ci E M , and B iare$nite subsets of M. What conditions must be imposed in order to ensure that A is unambiguous? 9. The Semirings N and ./r
Next to the semiring /A the semirings N and -!/'are the ones that are most important for us here. In fact, the introduction of a general semiring K was mainly a device for not having to mention constantly a, N , or L YT h e semiring N comes up most naturally when we consider multiplicity in automata. T h e semiring -N" will similarly appear in more evolved machines that will be considered later. T h e simplest way in which the semiring JPappears is when we consider a morphism f: C" + P which erases a letter (T, E Z (i.e., such that cr, f = 1). Then a,+fif interpreted with multiplicity must be the element 1 of P with multiplicity 00. In view of the inclusion N c J e a c h N-subset A of a set X may also be regarded as an &subset. W e shall then say that A is a non-singular J"-subset. T h u s an ,Y-subset A of X is non-singular if x A f 00 for all x E X.
Let M be a locally finite monoid and let 1. For any N-subset A of M the following conditions are
PROPOSITION 9.1.
M-
=M
-
equivalent : (i) (ii) (iii) (iv)
A E Rat,. M . A n M - E RatAvM-. A E Rat M . A n M - E R a t r M-. fp
9. The Semirings N and JT
189
Proof. T h e equivalences (i) c (ii) and (iii) c-(iv) and the implication (ii) 3 (iv) are clear. T h u s only the implication (iv) 3 (ii) needs to be proved, and thus we may assume that A c 111-. Let '6 be the class of all . Ksubsets of M that are singular and define
9 = '6u Rat, A!T h e class P clearly contains all the singletons in M -. I t is also easy to verify that 9 is rationally closed. Consequently Rat ) . M - c '6'u Rat, M n u t this signifies that a non-singular subset in Rat, M - is in Rat.v M - I For each /"-subset A of -I' we define the Ksubsets A,, , A , as follows zzz
{ 0xA
xA
if
:<
00
otherwise
Clearly
A
=
A,,
{ :A
xA,=
+ iz,,
A,, n A ,
=
if xA = 00 otherwise @
We call A,, the non-singular part of .4 while A,, is called the purely singular part of A . If A and B are ,Y-subsets of I*, then we have the formulas
( A -t q,, = A , -t R , ( n A ) ,=
{ tis
if if
PROPOSITION 9.2.
( A q h = A,B
n f c c n=co
If A
E
( A + ) ,=
+ m$
{ A"A,A m(A+)
if
A c S+
otherwise
Rat, S",then I
A,, E Rats S",
A , E Rat I 2"
Proof. Without loss we may assume that Z is finite. Let '6be the class of .Y-subsets A of S*such that A , E Rat,' P. T h e formulas above show that '& is rationally closed. Since all the singletons are in @ it follows that Rat I 'S*c '6 and thus .4 E Rat L'* implies A , E Rat,- L'". T h e assertion about A,, follows from the formula
,
I
A,, = A n (2*- 'qSt) Indeed, since A,vis rational, so is '4?t. T h u s A , is recognizable and so is S* - A,?. Since A is rational it is recognizable. T h u s A,, is recognizable and thus also rational I
VII. Rational Sets
190
Observe that the proof of rationality of A , holds if S* is replaced by a locally finite monoid. However, the proof for A,, requires passing to the complement, and thus fails unless the monoid is free. PROPOSITION 9.3. Let 2 = S u T , T $ S and let n: 2*+ 2" be the fine morphisnz erasing t . Then A E Rat S+ if and only if A = Bn for some B E Rat.v T i . Proof. If B E R a t s f + , then also B E R a t , . f * and thus B ~ Rat E ,-P, by Proposition 2.4. This gives the conclusion in one direction. Now let A E Rat, S+. Without loss we may assume that S is finite. Since by Kleene's Theorem the .,YLsubset A is recognizable, it follows from Proposition VI,6.4 that there exists a normalized .KJ-automaton &'such that I d I = A n S+. We convert J/ into an N-2-automaton as follows. T h e edges p q with labels of the form no, n E N , remain unchanged. If the edge p + q has the label ma, then we adjoin a new state r and replace the edge by the configuration 1
Jjn
p-r-
4
where Y is a new state. We must make sure that a different state r is used for each edge replaced. There results an N-2-automaton 8 such that I "A I n = A n L'k. Since
A
=
k
+A
n S+, k
we set
kr+lZ'l T h e n Bn
=
A and B E RatAvz'+
PROPOSITION 9.4.
if
E
r
IzeN
I
Let A be an !'-subset of Z*. Then A I
E
Rat,- S*
if and only if there exists a finite alphabet Q, a local subset L of .R*, and a fine inorphisin such that Lf = A. Further .f can be chosen to be very fine $ and only ;f A is in Z+ and is non-singular. Proof, Assume A E Rat!, L*.Applying first Proposition 9.3 and then Theorem VI,9.3 we obtain f2, L, and f . Conversely if Q, L, and f are given, then L E Raty-Q* and A = L ~ REa t f -X* by Proposition 2.4.
10. Generalized Automata
191
I f f is very fine, then since L c 9 +it follows that A c Zt-and A is non-singular. If A c J" and A is non-singular, then, by Proposition 9.1, A E Rats S f . By Kleene's Theorem A is an N-recognizable subset of \'+ and the conclusion follows from Theorem VI,9.3 I PROPOSITION 9.5. Let 111 be a monoid and let ,4 E RatI.M. There exists then a finite alphabet E, a rnorphism f : 1" + M , and a local subset L of 2" such that A = Lf. This follows from Proposition 9.4 and Proposition 2.5 I
Establish EXERCISE 9.1. Let .4 be any non-singular N-subset of Z+. the equiualence o j the following conditions:
A 1 is zinanibiguous. 4 +: 2" for all s E 9. (ii) ( ~ " ) ~ (i)
EXERCISE 9.2. For any A E Ratr L" and for any integer k > 0 show the equivalence of the following conditions : (i) A is thefinite union of products of no more than k unambiguous rational subsets of Ed. (ii) There exists c E N such that
(s)A 5 c I s l h -
*
for all s E Zi. EXERCISE 9.3. For any positive rational subset A of Z+, show that the following conditions are equivalent:
(i)
(ii)
A is the finite union of finite products of unambiguous rational subsets of 2 ' . For each E > 0 and all 11, v, w E 1" lini sup )I + c a
(uvvlw)A =0 (1 E ) "
+
10. Generalized Automata
Let IC.1 be a monoid. A generalized M-automaton is the triple L Y ' = (0, I , T ) where Q is a finite set and I and T are unambiguous subsets of Q, together with a finite number of edges 111
P--4
VII. Rational Sets
192
with p , q E Q, m E M . Thus the set of edges is a finite (unambiguous) subset of Q x M X Q. Paths, successful paths, and their labels are defined l is an .&'-subset of M ; x I in the usual fashion. T h e behavior I d is the number of successful paths c in .13with label I c I = x. Since there is no a priori limit on the length of such paths this number may be infinite and that is why I d l is an uF-subset and not just an N-subset as in the case of Z-automata. THEOREM 10.1. A n uF-subset of a monoid M is rational i f and only i f it is the behavior of a generalized M-automaton.
A n JF-subset of a locally Jinite monoid M is rational and non-singular if and only i f it is the behavior of a generalized M-automaton with labels in M - 1. THEOREM 10.2.
Proof. Let d =(Q, I, T ) be a generalized M-automaton. For each m E M occurring as a label of an edge of -d, introduce a letter o J a ,and let Z be the alphabet thus obtained. Let f: Z* + M be the morphism given by gJnf = m, and let .2? be the Z-automaton obtained from d be replacing each label m by CT,,.Then I ."A If = I d 1 . Since I 93' I E RatN Z* c Ratf. Z* it follows from Proposition 2.4 that I j3 I E Raty Z*. If M is locally finite and d h a s labels in M - 1, then If-' = 1. From Exercise 4.5 it then follows that f is locally finite. Thus I d I E RatA$,M by Proposition 4.4. An alternative argument appeals directly to the local finiteness of M . Since no edge of JY' has label 1, there can only be a finite number of paths in d with a given label x. Thus I d I is non-singular and by Proposition 9.1, I &' I E Rats M . This proves both theorems in one direction. For the other direction consider A E Rat,' M . By Proposition 9.5, there exists a finite alphabet Z, a morphismf: Z* + M , and a rational set B E Rat, S* such that A = Bf. If further M is locally finite and A E RatAvM , then Proposition 4.5 can be used instead so that f can be assumed to be locally finite. If for two distinct letters C T ~ o2 , E Z we have o,f = C T ,then ~ , the letters ( T ~and C T ~can be merged and the morphism f can be factored into
Z* --t L"* + M
where S' is a smaller alphabet than Z. Thus there is no loss is assuming that f is injective on the set S.
10. Generalized Automata
193
Since B E Rats S",Kleene's Theorem yields a L-automaton 9 such that I 29 I = B. Further by Theorem VI,9.1 it may be assumed that 29 is unambiguous. Replacing each label u of 9 by af we obtain a generalized M-automaton d s u c h that I ,3 1 = I R I f . T h u s '4 = I d I. If M and f a r e locally finite, then crf f 1 for all u E S a n d thus , d h a s labels inM-1 I I t should be noted that the assumption that &'has no unit edges (i.e., edges with label 1) is quite essential. Indeed the automaton
has behavior 1 with multiplicity
00.
C O R O L L A R Y 10.3. An Jr-sii6set of a locally$nite monoid 111 is rational if and only if it is the behavior of a generalized M-automaton with labels in I
(M- hP) u 1. Since each element of 111 - 1 is a product of elements in M - M2, the corollary follows from Theorem 10.1 by subdivision of edges I C O R O L L A R Y 10.4. An -Y-subset of S" is rational if and only the behavior of a generalized L"-automaton with labels in Z u 1
if
it is
I
C O R O L L A R Y 10.5. An 4"-subset of a locally JSnite monoid M is rational and non-singular ;f and only if it is the behavior of a generalized M-automaton with labels in M - W . I
This follows from Theorem 10.2 by subdivision of edges
I
In the definition of a generalized M-automaton we insisted that I and T be unambiguous subsets of Q and that the set E of edges be a finite unambiguous subset of Q X M X 0. T h e method of Theorem VI,9.1 shows that there is no harm in permitting finite multiplicities. T h u s we may permit I , T , and E to be finite . Y-subsets (i.e., N-subsets with finite support).
194
VII. Rational Sets
References
There is a considerable amount of literature related to matters discussed in Section 3. T h e following three references treat some of these questions (in the case K = 2? only). A. Ginzburg, “Algebraic Theory of Automata,” Chapter 4, Academic Press, New York, 1968. A. Salomaa, “Theory of Automata,” Perganion Press, Oxford, 1969.
Chapter 3 contains the proof that the set A, defined in Section 3 has height exactly h. J. €1. Conway, “Regular Algebra and Finite Machines,” Chapters 3, 4, 12, and 1 3 , Chapman and Hall, London, 1971.
Theorem 3.1 is on p. 118. S. C. Kleene, Representation of events in nerve nets and finite automata, “Automata Studies” (C. E. Shannon and J. McCarthy, ed.), pp. 3-42, Princeton Univ. Press, Princeton, New Jersey, 1956.
This is the original reference to Kleene’s Theorem. J. M c l h i g h t , Kleene’s quotient theorems, Pacific J . Math. XIV (1964), 1343-52.
Contains Proposition 5.4. S. Eilenberg and M . P. Schutzenherger, Rational sets in commutative monoids, J . Algebra 13 (1969), 173-191.
Contains a proof of Theorem 8.4.
CHAPTER
vlll An Excursion into Analysis
This chapter establishes a connection between the rational subsets of 2%and rational functions in the sense of algebra and analysis. This provides analytic methods for solving various “counting problems” and establishes mild connections with probability theory. 1. Generating Functions
We consider an alphabet S consisting of a single letter a. With each K-subset A of a*, where K is any commutative semiring, we may associate the formal power series m
a,, =
a“,4
If K is a subsemiring of the field C of complex numbers, the formal power series becomes a genuine power series in the complex variable z . Note that as a concession to the usual notation in function-theory we . T h e radius of convergence of the power write f . , ( z ) instcad of zf,, series f.l is denoted by Q., . T h u s the series 2 a,2znconverges absolutely for all x such that 1 I1 < p., and diverges for all x such that 1 z 1 > e - 4 . Note that 0 I :p.l 5 00. We recall the well-known result pL4= lim inf I a,,
195
VIII. An Excursion into Analysis
196
or equivalently (if
Q..,
> 0) 1 = lim sup I an Illn eA
Thus for any
E
> 0 the inequality
holds for all n sufficiently large. Let K c C. T h e K-subset A of a* is said to be analytic if p.4 > 0. T h e analytic function fA represented by the power series is called the generating function of A. EXAMPLE 1.1.
T h e N-subset A of a* given by
anA = n ! is not analytic. Indeed the power series m
C n!zn n=O
has radius of convergence zero. We shall now consider the behavior of the generating functions under various operations on subsets. Clearly if k E K , then fkA = k f 4
Thus if K c C, then @ k A == @ A
f 0
if
Let
f.d(z) = C anzn,
fIj(X)
Since @ ( A u B ) = onA it follows that
=
C bnx"
+ onB
+ b,,)z'*
f L l d z )= C (atl
1. Generating Functions
197
Consequently f.,uu e.tut{
=f.,
+fil
L We., , e B )
Since u ” ( A B )=
K cC
if
c (aPA)((TQB) c upb, =
p i q=n
ptq=n
it follows that
f.,n e.40
=f.1
2 We.,,e d
fu
if
K
=C
Since
d i ( A n B ) = (atiA)(a”B) = a,,b,, it follows that f;rne(n)=
c a,b,r4’’
This operation on power series is known as the Hadumardproduct. If we use the symbol n to denote this product, then f.4nu =
f., (3 fI3
If K c C, then lim sup I a,,b,, l * l n 5 lim sup I a,, Illrrlim sup I bn
For the internal shuffle product we have
where
( p , q ) is the binomial coefficient ( p + q ) ! / p ! q !Thus .
This operation on power series is called the Hurwitzproduct. If we denote this product by the symbol u,then fAun
=fA U f B
VIII. A n Excursion into Analysis
198
It is known that if K c C, then
Since we shall not use this result we leave it without a proof. Assume that A c Z+, i.e., a, = 0, and consider
A+ = A v A' v . . . v A" u Thus (1.1)
f.t+(z> = f.l(.)
+ [f.1(z)l2 + + [fn(z)I"+ . . . * * *
This yields a formal power series expansion =
fA+(X)
c b,zn
Since a, = 0, only terms with k 5 n contribute to the summation, so that b,, is well defined. I < 1. Consequently Assume K c C. Then (1.1) converges iff
ear+= sup{r In particular, if
Ir < edi,
~ f ( zI )< 1 for all I z
I
=
r>
eAI> 0, then 0
e.4. 5 e.1
As a function, f A l + is given by the formula
Since A*
=
1 v A+ we have
e.1.
=
e.I+
Since each formal power series f is of the form f =f., for a unique K-subset of (s*, the constructions described above may be viewed as operations on formal power series. Thus we may denote f + = f a t + and f * = fAI. provided f(0) = 0. In the exercises below we assume K c C.
2. K-Recognizable Power Series
199
Show that ;f '4 is an infinite unamblguous subset of o*, then Q . ~= 1. Deduce that p.4 5 1 whenever A is the$nite union of products of N-subsets of o* with bounded ambiguity. EXERCISE 1.2.
2. K-Recognizable Power Series
A formal power series
c a,,=" M
f ( x >=
,r=o
over a semiring K is said to be K-recognizable if the corresponding Ksubset A of O* (i.e., the subset satisfying f = f . 4 ) is recognizable. Since the formal power series fA4 is just a different way of writing the subset A , Kleene's Theorem and its various consequences apply and need not be restated. If K is a subsemiring of the field C of complex numbers, then each K-recognizable formal power series f is also C-recognizable. PROPOSITION 2.1.
Each C-recognizable subset of o* is analytic.
Proof. This follows directly from the fact that the class of analytic C-subsets of o* is closed under rational operations I
As a consequcnce of the above, each recognizable K-subset A of 0 * , has, in the case K c C , a generating function fA4 that is analytic. We shall now give some examples which show how this analytic function can be calculated. EXAMPLE 2.1.
If
A
= cTycT
+ + cT2
63)*
+ (20)"
then
T h e radius of convergence is
since z
+ z2 + x3 < 1 for z = t .
VIII. An Excursion into Analysis
200 EXAMPLE 2.2.
Let A be defined by the automaton
of Example VI,1.4. Clearly A
=
(a
+
a2)*
and thus fii =
1 1 - ( z + 9)
T o find the radius of convergence we solve the equation 1 - ( z
+ z 2 )= 0
and find
T o find the coefficients in the power series expansion
we note that
(1 - z
- z”fil(z) =
1
Equating coefficients on both sides we find
a,
=
1,
a, - a, = 0,
an+2 -
a,.,, - a,, = 0
for n > 1. Thus a, = a , a, =
+ an.-2
=
1
for
n >1
These are the recursion formulas for the Fibonacci numbers. A more formal way of computing A is to set u p the system of equations
X=oX+uY+l
Y=aX T o pass to generating functions all that needs to be done is to replace o by z . Thus z X f zY 1
x=
Y=zX
+
2. K-Recognizable Power Series
201
Consequently
A- = z.Y
+ zzx + 1
Thus (1
-
z - Z”’Y
=
1
and
A- = EXAMPLE 2.3.
1 1-z-2,
Let A be defined by automaton
with all edges carrying the label
0. T h e
equations are
x,= zs,+ 2 X , + zx3+ 1 x,= zx,-t zx, + zx, x,= :xl + ZX, + zx, Thus X ,
=X
, and the equations become
-Y,= zx,+ 2zxz + 1
x, = zx,+ 2zx, T h e second equation gives
x,= ____ x, 1 - 22 Substituting we obtain
x,= zx, + and upon calculation
222 ~
1 - 22
X,= fA4(z)becomes
x, + 1
VIII. An Excursion into Analysis
202 Thus e.4
EXAMPLE 2.4.
=
4
Let D be the subset defined by the automaton
It is clear that D has the value n on u” and thus
c nzn OD
f&)
=
n=o
T o obtain a closed formula we note that
and therefore
Alternatively (and more formally) we may consider the equations
X=zX+zY
I’=zY+I T h e second equation yields
T h u s the first becomes
x = zx +
z ~
1--z
so that
s=
z (1 - z)Z
Note that if cfl
is any formal power series over a semiring K , then (g nf,,)z =
c na,,z”
2. K-Recognizable Power Series
Thus if g
=f
203
B , where R is a K-subset o f c*, then r l ( B n D)
yields the formal power series g’(z) =
C na,,zn-* 11=1
which is the formal derivative of g. Consequently if g is K-recognizable, then SO is g’. EXERCISE 2.1. Let f ( z ) = Cr=oa # ’ be a formal power series over a semiring K , and let r E N . Show that f is K-recognizable zfJ the formal power series
c co
g(z)=
t1=O
is K-recognizable, If K c C , then show also that eJ = p u . Give two proofs; one using automata and another one using rational operations. a,,zJ1 be a K-recognizable formal power EXERCISE 2.2. Let f ( z ) = xTxo series and let p 2 1 be an integer. Show that
is K-recognizable. If K c C, then show also that p9 2 (p,)”. [Hint: Given a K-a-automaton d recognizing f , construct an automaton whose edges are the paths of length p in d . 1
a,,z” = be a K-recognizable ;”= formal power , EXERCISE 2.3. Let f ( z ) = I: series and let k E K. Show that the formal power series
c a,k”z” cn
g ( z ) =f ( k z ) =
n =o
is K-recognizable. If K c C , also show that pu = 1 k interpreted as 00 (f k = 0.
‘@J,
with
k
I-’
Let f(z)= a,,z”, g ( z ) = C b,$’ be formal power series over the semiring K . Assuming that b, = 0 , define the composition EXERCISE 2.4.
(g o
f
=f(g(x))
VIII. An Excursion into Analysis
204
by formal substitution. Show that i f f and g are K-recognizable, then so is g o f . [Hint; With g $xed consider the class of all f ' s for which the conclusion is valid.] EXERCISE 2.5. Let ?k be the class of all K-recognizable formal power series f ( z ) = C a,,zn such that a,, = 0. Show that 8 is the smallest class containing the series
and
z
zn n=l
and is closed under the operations kf, f
+ g , f g , and g
of,
where k
E
K.
EXERCISE 2.6 Show that for any formal power series f ( z ) = Z&, a,@
with coeficients in a semiring K the following conditions are equivalent: (i)
The sequence a,, is ultimately periodic, i.e., there exist integers m 2 0,
p > 0 such that a,, = an+pfor n 2 m. (ii) f ( z ) = r(z)(zp)", where r is a polynomial and
p > 0.
3. The Case When K I s a Ring
We shall now assume that K is a commutative ring. T h e formal power series M
f ( z )=
C
a,,zl'
n=o
will be called rational if there exist polynomials p and q with coefficients in K such that qf = P, do) = 1 The polynomial q will be called a denominator off. We show that this notion of rationality coincides with the inductive one defined using rational operations. With p and q as above, write r = 1 - q. Then r is a polynomial, r(0) = 0 and q = 1 - r . Thus
r*q
= r* -
r+ = 1
Consequently
r#p
= r*qf = f
T o prove the converse, let 8 denote the class of all rational formal power series with coefficients in K. Clearly all polynomials are in %.
3. The Case When K Is a Ring
Let f,f' E @ and let q f
=
205
p , qlf = p', q(0) = q'(0) = 1. T h e formulas
show that kf, f+f', and ff' are in '8. Next assume that f ( 0 ) = 0 or equivalently that p ( 0 ) = 0. Define q = q - p . Then q(0) = 1 and
Consequently, proved
fj-
E
@. Thus 8'is rationally closed. We have thus
THEOREM 3.1. A formal power series with coefficients in a commutative ring K is K-recognizable if and only if it is rational I PROPOSITION 3.2. Let K be a subring of a commutative ring L, such that K is a direct summand of L as a K-module. Then any formal power series f with coefficients in K which is rational over L is also rational over K.
Proof. T h e hypothesis implies (and is actually equivalent to) the existence of a K-morphism p: L + K such that ~ ( 1 = ) 1. Since f is rational over L, we have
where q and p are polynomials over I,. Applying rp to the coefficients we obtain polynomials q' and p' over K , such that q ' f = p', q'(0) = 1 I Note that the hypothesis of the proposition always holds if K is a field. PROPOSITION 3.3.
Let f
and let q(z) = 1
=
C
be a formal power series over K
+ c,z + . . . + c,,z"',
c, f 0
be a polynomial of degree m over K. Then f is rational and has q as a denominator if and only if the following "recursion formula" holds
(3.1)
at+,i,
+ cla/+f,'-l+ . . . + c,i,a,
for all t sujiciently large.
=
0
VIII. An Excursion into Analysis
206
Proof. Equation (3.1) is simply a restatement of the fact that the coefficient of z 1 + ’in l Lthe power series expansion of qf is zero. T h u s (3.1) holds for all t sufficiently large iff qf = p is a polynomial I
T h e argument above shows that formula (3.1) holds as long as
t>O
and
t+m>degp
Thus if deg p < r then (3.1) holds for all t 2 0. This is the “normalized” case in which qf = p with d e g p < deg q. Observe that if the recursion formula (3.1) holds for all t >_ s, then the coefficients of the formal power series m
g(z) =
C
an+szlz
ll=O
+
satisfy (3.1) for all I2 0. Since f ( z ) = ~ ( z ) g ( z ) z 5 with deg u < s, any denominator o f f also is a denominator of g . Thus if we replace f by g , we are in the normalized case. Symbolically we can write
with deg u < s, d e g p < deg q. T h e following theorem will not be used in the sequel and is stated without proof. T h e proof is rather difficult. (Skolem-Mahler-Lech) Let K be a field of chara,,z” be a formal power series rational acteristic zero and let f ( z ) = CT=‘=, over K. Then the subset A = ( n 1 a , = 0} THEOREM 3.4.
of N is recognizable
I
‘The following example shows that the hypothesis that K has characteristic zero is essential. EXAMPLE 3.1. Let p > 1 be a prime and let K be the field obtained from the prime ficld 2, by adjoining a single indeterminate x. Define
a,, = (1
Then a ,
=
+ x)” - 1
-
x”
O iff n is a power of p and thus the set A is not recognizable.
4. The Case K = 2
207
However, the recursion formula
+ .v)a,_, - ((1 + x)* + x)a,-, + x ( l + x ) a L P g
a , = 2(1
holds for all i 2 0. T h u s the formal power series f ( z ) = xT=o a,@ is rational over K . 4. The Case K
=Z
Let 2 be the ring of all integers, and Q the field of rational numbers. Proposition 3.2 then has an analog with h‘, L replaced by Q, Z .
If a power series f is rational over Q and has coefficients in Z, then f is rational over Z. Further the lowest denominator o f f over Q has its coefficients in Z. THEOREM 4.1.
This is a reformulation of the so-called “Lemma of Fatou.” I n XVI, 10 we shall state a considerably stronger theorem. We therefore omit the proof of Theorem 4.1. THEOREM 4.2. For any power series .f(z) = ~ ~ = o a , , with s n integer coefficients the following conditions are equivalent :
(i) f is rational and the sequence I a,, 1 is bounded. (ii) There exist integers m 2 0, p > 0 such that a,,+, = a,,for all n 2 m. (iii) There exists apolynomial r and an integerp > 0 such that f = (zP)*r.
I f the above conditions hold and $further a,, E N for all n N-recognizable.
E
N , then f is
Proof. (i) (ii). Since f is rational we may assume that the recursion formula (3.1) holds. Since the coefficients a,, are integers and 1 a,LI is bounded, the coefficients a,, take on only a finite number of values. Consequently with n fixed there is a finite number of distinct sequences ak 9 att1,
Then let m
...
9
%+,1-1
2 0, p > 0 be integers such that a i= a p t i
if
nr
cism +n
It then follows from the recursion formulas (3.1) that a , = i 2 m. This proves (ii).
for all
208 (ii)
-
VIII. An Excursion into Analysis
(iii).
Define
+
+
+ +
q ( x ) = a, a,x . . a/,6~lZm-1 s(z) = a,z* a n l + l ~ m + l. . . a,n+p-lx m f p - l
+
*
+
Then (4.1) This implies
+
s(x). with ~ ( z=) q(z)(l - xp) (iii) 3 (i). Obvious. If the coefficients a, are all in N , then the polynomials q ( z ) and s(z) defined above have coefficients in N and thus formula (4.1) shows thatf is N-recognizable I COROLLARY 4.3. An unambzguous subset A of N is recognizable if and only if its generating function fa,,is rational.
Indeed, if f..,is rationaI, then by (ii) A is ultimately periodic and vice versa I 5. Positive Analytic Functions
T h e results in the case when K is a ring are fairly complete. When we pass to the cases K = N o r K = R , which are more important from the point of view of automaton theory, the algebraic methods of the last two sections break down and in fact the main conclusions are false. Indeed, in Example 6.1 a rational functionf(z) = C unz” with coefficients in N will be constructed which is not N-recognizable. T h u s the key theorem, 3.1, fails to generalize. There are however some compensating advantages to be derived from the assumption K c R+. They are analytic in character, and will be investigated in this section.
5. Positive Analytic Functions
209
We shall consider analytic functions given by a power series m
with a radius of convergence
Such a function will be called positive if
arrE R,
for all
n 1 0
Clearly all H+-recognizable functions are positive. We shall examine here some of the consequences of positiveness. T h e basic tool is the study of the singularities o f f on its circle of convergence I z I = Q ~ .A point z,, on this circle is said to be regular iff admits an analytic continuation with center at x o . Otherwise zo is said to be singular. If for some integer n > 0, zo is a regular point for the function (2 - z,,)"f(z)but is a singular point for the function (2 - zo) I i ' f ( z ) ,then zo is said to be a pole of order n for f. If n = 1, then the pole is called simple. Iff is rational, then it is known that all the singularities off are poles. W e emphasize that we only discuss the singularities o f f on its circle of convergence. Singularities that may be encountered further out, when f is continued analytically, are of no concern to us here. T h e period of the function f is the highest common factor of the set of integers n > 0 such that a,, f 0. T h u s if f has period p , then
c anpz~'P "3
f ( z )=
n=O
and p is the largest integer for which this is true. If unity, then
E
is any pth root of
f ( Z E ) = f(Z>
EXAMPLE 5.1.
fk)= has period
p.
T h e function 1
00
C
znp - ,l=o
with
p~ N , p > 0
VIII. An Excursion into Analysis
210
Let f be a positive analytic function. For each z
PROPOSITION 5.1.
such that I z
I < ef we have
with equality holding
if and
If(.>
I L j I x I)
only
if
z = Iz where
E
&
is a p t h root of the unity and I is the period o f f .
and this holds iff
Let z
=
1 z 1 E with I E 1
=
1. Equation (5.1) is then equivalent with
a , ( ~ 1) = 0
for all n E N
or equivalently cn = 1
From the definition of
if a, f 0
p , this is equivalent with
THEOREM 5.2. Let f be a positive rational function which is not a polynomial. Then ef < 00, ej is a pole for j , and for any other pole zofor f such that I zo I = er, the multiplicity of the pole zo does not exceed that of ef.
Proof. Let n be the multiplicity o f a pole zo o f f (with I zo I Then the rational function
=
er).
21I
5. Positive Analytic Functions
is regular at zo and further g(zo)1 0 , since otherwise ( z - z0)”-’f(z) would already be regular. Consequently
By Proposition 5.1, the same inequality must hold with zo replaced by I zo I = e f . Consequently, the rational function
does not vanish at z = el. If h has a pole at er, then f has a pole at of order > n. If h is regular at er, then f has a pole at ef of order n
ef I
We note that Theorem 5.2 is a counterpart for rational functions of Pringsheim’s Theorem asserting that iff is positive analytic with Q, < 00, then Q, is a singular point for f. Pringsheim’s Theorem itself will not be used. PROPOSITION 5.3.
Let
m
f(z)=
C a,xn,
a, =
0, a,
E
R+, ef > 0
n=o
and let
Then 0 < er* I @f
The equality
e r = er holds if and only if
er < 00 and
If efl < ef (i.e., if 1 < C;=o anern),then: (i)
pf.
=
r is the unique solution of the equation
VIII. An Excursion into Analysis
212
The singularities o f f * on the circle I z I = r are simple poles located at rE where E ranges over all the pth roots of unity and p is the period off. (iii) lim,+w cnprnp = p / r f ' ( r ) , where f ' is the derivative off.
(ii)
The same conclusions hold for the function
Since f(0) = 0 it follows that) . ( f I I < 1 for I z small. This implies 0 < ef.. Since a, 5 c , it follows that Next observe that for any r < ef we have Proof.
Thus if
I sufficiently 6 pf.
CEOanern 5 1, then f ( r ) < 1 for all r < ef and therefore
equivalently er = pf*. If Cr=n > 1, then the same holds already for some r < e f . Thus f ( r ) > 1 and by (5.2), pf* 5 r. Consequently er* < ef. Now assume that ef* < ef or equivalently that C,"==,anern > 1. Since for 0 < Y < er the function f ( r ) is continuous and ascending and since f ( 0 ) = 0 and f ( r ) > 1 for r sufficiently near to ef it follows that the equation f ( r ) = 1 has a unique solution. It then follows from (5.2) that eft = r if r is this solution.
ef 5 el*, or
T o prove (ii) and (iii) it is convenient to replace the function f ( z ) by the functionf(rz) where r = ere. After this change we may assume that
er > 1,
@f*
=
1,
f(1)
=
I
T h e singularities off*(.) are the zeros of the functiong(z) = 1 - f ( z ) . Clearly g( 1) = 0. Sincef( 1) = C a, = 1 it follows thatf '( 1) = C nu,, 2 1. Thus g'(1) f 0 and therefore 1 is a simple zero for z. If E is a primitive p-th root of 1, then g(xE) = g(z). Consequently, (1 5 i 5 p ) are simple zeros for g. For all other z on the disk I z I 5 1, Proposition 5.1 implies If(%) 1 < 1 and thus g(z) f 1. This proves (ii). Since the functions g(x) and 1 - zp have the same zeros (with the same multiplicity) on the disk I x 1 5 1, the same holds on a larger disk
5. Positive Analytic Functions
I z I < 1+q
213
for some q > 0. Thus the function
h(z) = has no zeros for Since
~
1 - zp g(4
-
(1
-
z")f"(z)
I z I < 1 + 11. m
we have m
f"(z)=
1 c,pz"p n=O
Let
Comparing coefficients we obtain
c , , ~- c(n-l)p= bnp
for
n >0
and
cO= bo = 1 This implies n
c*p
=
1 bi,
i=O
and therefore lim cnp = h( 1) n+M
Since
h(z)= if
1-zp 1-f(z)
-
1-zp 1-z
I z 1 < 1 + q, a passage to the limit with z
1-27
1-f(z) +
h(1) = P / f ' ( l ) as required. T h e conclusion for f
+
follows from the identity
1 yields
VIII. An Excursion into Analysis
214 COROLLARY 5.4.
I f f is a positive rational function, f(0) = 0, and
f f 0, then 0 < ef* < er and
f(Qf*) = 1 Further (ii) and (iii) hold.
Indeed, either pf = 00 and f is a polynomial, or else is a pole for f. T h u s in either case
er < 00
and
ef
I t is worth observing that conclusion (iii) of Proposition 5.3 holds also a,,ejn = 1 provided f ' ( r ) is replaced by in the case xF=O M
(5.3) and suitable conventions if (5.3) is infinite. This is with r = ern = Feller's Tauberian Theorem. EXAMPLE 5.2.
Let f(z)= 2.Then m
1
Thus in this case
p
=
2, r
=
1, and lim cr,prnp= 1. Since f ' ( r ) = 2
we have p / r f ' ( r ) = 1. EXAMPLE 5.3.
Consider the function of Example 2.2. We have
).(g
Here p have
=
1 and r
=
(45
-
=
z
+
272
1)/2. Since g ' ( r ) = 1
+ 2r = 47 we
6. R+-Recogn izable Fu nc t ions
215
Consider
EXAMPLE 5.4.
f ( z ) = 1 - dTzF Clearly f is not rational, f ( 0 ) = 0, and pr
1. Since
=
we also have pr* = 1. PROPOSITION 5.5. Let f and g be positive functions. Then Qf+g
=
inf(er, e,)
Also i j neither f nor g is identically zero, then
Proof.
erg
=
2w e / ,
Qg),
inf(e,f, e,)
T h e inequalities ertg
erg
2
w e / , e,)
hold trivially (and without the positiveness assumption). T o prove the opposite inequalities let
f ( z ) = C a,$#,
g(z) =
C b,zn
+
+
+
Then the coefficients o f f g are a,, b,,. Since 0 5 a, 5 a,, b, it 5 er. Similarly Q , + ~ I eo. Let { c n } be the coefficients follows that , ,@+, in the expansion of f g , and let bi f 0. Then
0I a,,& 5 c,,+i and therefore
0 5 a,, I c,+ilbi
6. I?+-Recogniza ble Functions
THEOREM 6.1.
(Berstel)
Let f be an R+-recognizable function. I f such that
er < 00, then pr is a pole for f and $ zo is any other pole for f I zo I = e , then zo = efrE where E is a root of unity.
VIII. An Excursion into Analysis
21 6
Proof. Let 8 denote the class of R+-recognizable functions for which the conclusion of Theorem 6.1 holds. I f f is a polynomial, then er = 00 and therefore f E @. Suppose f , g E 8. Since by Proposition 5.5
efg= ef t U = inf(er eg>
+
and since each pole of fg or off g must be a pole of either f or g, it follows that fg and f g E @. If Y E R+ , r > 0, and f E i?, then clearly rf E.'?!it Finally assume that j E @, f f 0, f(0)= 0, and consider f+. If ef = 00, then f is a polynomial and f(r) 00 as r 00. If er < 00, then pf is a pole for f and f ( r ) + 00 as r --+ p,. Thus in either case the hypotheses of Proposition 5.3 are satisfied and thus f + E k?. Having shown that 8 is closed under rational operations, it follows that all R+-recognizable functions are in 8 I
+
-+
-+
From Theorem 6.1 and Corollary 5.4 we deduce: COROLLARY 6.2. Let f be an R+-recognizable function with f(0)= 0 and f # 0. Then p f , < ef and conclusions (i)-(iii) of Proposition 5.3 hold with r = pf, I EXAMPLE 6.1.
Consider the function
c (cos2nt3)zn m
f(x)
=
n=O
with 0 i t3 < 2n. Clearly
er = 1. We
assert that:
(6.1) j is rational and its poles are 1, eZio,eczi0. Indeed we have cos no and therefore ~
Consequently
0
=
nfJ ~ =2 a
B(ein0
$in0
+ e-ino)
+ $ e-2in0
-
4
217
6. R+-Recognizable Functions
This proves (6.1). From Berstel’s Theorem it now follows that (6.2)
If eiO is not a root of unity, then f is not R+-recognizable.
Next consider integers
O t a t c and define 8 by the conditions cos 0
=
0 < 8 in/2
a/c,
Since cos nU is a polynomial of degree n in cos 8, it follows that cn cos n8 is an integer and thus c“’ cosa nU E N This yields:
Next we prove: (6.4)
If c # 2a, then eiO is not a root of unity, or equivalently e/z is irrational.
Thus eiOsatisfies the equation a c
-=-
1 2
(z +1 )z
or equivalently 2 2
2a -z C
+l=O
Consequently the degree of the field Q(eio) over the field of rational numbers is at most 2. On the other hand it is known that for a primitive
VIII. An Excursion into Analysis
218
nth root of unity the degree is p?(n) where
p?
is the Euler function defined
by
d n m ) = p?(n)gs(m)
n and m are relatively prime
if
dp')= (P - l)Pr-l
if p is a prime
T h e condition p ( n ) 5 2 thus yields n = 1 , 2, 3,4, or 6. These possibilities are however ruled out by the assumptions 0 < 0 < n/2, cos 0 rational, and cos 0 # 6 . Summing u p we see that if c f 2a, then the power series h ( z ) has coefficients in N , is a rational function, but is not R+-recognizable.
PROPOSITION 6.3. Let f ( z ) = C a,,z" be a rational function with coeficients a , in R (or Q or Z ) . Then
f
= f t
-f
where f and f - are R,-recognizable (or 8,-recognizable or N-recognizable). Further, either sup(ef+ Q J = ~ er or Qf, =
Proof.
and g
==
-= er
e,_
T h e conclusion is clear if f is a polynomial. Also i f f g , - g-, then
fg
=
( f + g ++ f - g - )
-
= f+ - f-
(f-g, +ftg-)
Since f = p / q with p and q polynomials and q(0) = 1 it suffices to consider f = l / q with q(0) = 1. Let then
q=l-q-fq, where q+ and q - are polynomials with positive coefficients and such that q + ( 0 )= 0 = q - ( O ) . Then with q+ y = 1 - qwe have r ( 0 ) = 0 and the identity
1 q
1 1 l-qq_l-rr"
1 r 1-qq1-r2
yields the required decomposition o f f = l / q . T h e assertion concerning the radii of convergence is clear
I
7. Behavior
21 9
of Coefficients
EXERCISE 6.1.
Let f be an R ,-recognizable fiinction such that eS < 00.
Show that
I(.)
1
(p?
-
z')-'h(=)
for suitable integers k 2 1, 12 1, and a rational function h such that 0. p h > pf and h(Q,) EXERCISE 6.2. Let f be an N-recognizable function such that p, = 1.
Show that
f(~) = (1 - =')-'h(Z) for suitable integers k 2 1, 1 2 1, and a polynomial h with integer coefficients. 7. Behavior of Coefficients
Let
be an R+-recognizable function. We shall establish some properties of the sequence a,, a,, . . . , a,,, . . . of the coefficients off. PROPOSITION 7.1.
There exist integers k and p and a real number
> 0 such that p > 0 and attip 2
V I >
for all n 2 k. If further f is N-recognizable, the conclusion holds with 71 =
1.
Proof. Without loss of generality we may assume that a, = 0. Therefore by Proposition VI,6.4,f is computed by a R+-a-automaton N'= (Q, i, t ) , where i and t are singletons. Let no be the number of states in d. Let c: i t be a successful path in d o f length 1) c 1) = n 2 n o . Then a state in c must be repeated so that c admits a factorization --+
.
c,
1-q-q-t
d
ca
VIII. An Excursion into Analysis
220
with 11 d 11 = 1 > 0. We choose this factorization so that I is the smallest possible, and then we choose it so that /I c1 11 also is the smallest possible. Then 0 < 1 5 no. Let p be the least common multiple of all the numbers 1 that arise in this fashion when c ranges through all the successful paths in & + w i t h11 c 1) 2 n o . Clearlyp 5 n o ! . With the path c thus decomposed we may associate the path e = cld'+P/lc,. Then e is a successful path and
If
where 11 is the smallest of the finite set of numbers u1+P/I involved. Next we observe that the function which to c assigns e is injective. Thus summing (7.1) over all the successful paths c in A of length n we obtain CP-I-PA2 V ( O " A ) and consequently an+p 2 Tall I f f is N-recognizable, then A may be taken to be a N-o-automaton. Then u are integers and thus q 2 1 I (Limit Theorem). If pf 2 1, then there exists an 2 1 such that the limits
THEOREM 7.2.
integer
p
ri = lim n+cu
exist for 0 5 i < p . Further, if F is a suhjield of R such that a,, E F n R , for all n then ri E F for all 0 5 i < p.
E
N,
7. Behavior of
221
Coefficients
T h e proof is inductive. We denote by '@' the class of all R+recognizable functions with a,, E F n R , such that either p, < 1 or else the limits y i exist for some integer p 2 1. Clearly f E 8 i f f is a polynomial. Next assume that Proof.
are non-zero and are in We propose to show that f ' $- f " and f 'f" are in 8. Since by Proposition 5.5 .@ I'
ca ,+,,
=
inf(e,. , eft,) =
pfjJ,s
we may assume Q,, 2 1 and pr., 2 1. Therefore integers p' 2 1 and p" 2 0 exist such that the limits ri' = lim a i L p , + i , rj" = lim
exist for 0 5 i < p ' , 0 5 j < p". Replacing p' and p" by their least common multiple we may assume that p' = p" = p. Since ri'
it follows that f '
+f
"
+ r;' = lim(a;p.+i + u ; ; ~ + ~ )
E
@'.Next setting
we easily calculate lim b n p f i=
1
Y~~Y;!,
n +w
the summation extending over all pairs (i', i") such that
0 5 i' < p, Thus f 'f" E '8. Finally assume that f
0 5 i" < p,
E
(@ and f(0)
i' =
c
+ i"
= i modp
0. Consider
m
f + ( z )=
c,zn
n=O
If pr+ < 1, then f + E & by the definition of 8'.If pf+ > 1, then and thus lim c,, = 0 so that again f +E g.If pf+ = 1, then by Corollary 5.4, p, > 1 and
C c, < 00
lim c n p 11 +cu
=P/f'(l>
VIII. An Excursion into Analysis
222
where p is the period of f. Since p also is the period o f f + it follows that C n p t i = 0 for 0 < i < p. Thus the required limits exist for f +. Further since a,, E F n R , for all n E N , the same holds for c,, . T h e functionf is, by Proposition 3.3 and Theorem 3.1, rational over the field F. Thus the same holds for the derivative f ' and consequently f ' ( 1 ) E F. Thus f + E @
I
EXERCISE 7.1.
Show that ;f Oln is irrational and a,, = cZlrcos2 nO,
then antp lim inf -0
a11
n-+m
for all integers p > 1. Thus the function h of Example 6.1 violates the conclusion of Proposition 7.1. EXERCISE 7.2. =
1/[1 - f ( z ) ]
=
EXERCISE 7.3.
Let f = C a,z", a , E R,, a,, = 0 and let f " ( z ) 2 c,,zn. Show that cntm2 c,,c,,~. Using Exercise 7.2 give an inductive proof of Proposi-
tion 7.1. EXERCISE 7.4.
Show that the function
is Q+ recognizable zfs the function m
g(z)=f(pz)
=
C anpnzw n=O
is N-recognizable for some integer p > 0. [Hint: Consider the automaton p L d where ,dis a Q+-a-automaton recognizing f . ] EXERCISE 7.5.
Let f(z)= Crzoa,,z" be R+-recognizable. Show that
the set
B
=
{n I a,, = O }
is a recognizable subset of N. [Hint: Consider the support A t of the R+subset A of 0" given by f. Note that this exercise is a special case of the Skolem-Mahler-Lech Theorem.]
223
8. Bernoulli Distributions
This concludes our discussion of the K-recognizable subsets of cr* and of the related function theory. We list a number of open problems that deserve consideration. PROBLEM 7.1. Let f = p / q be a rational function where p and q are explicitly given polynomials with real coefficients and q(0) f 0. Is there an egective procedure for deciding when :
(a) (b) (c) (d)
f f f f
is positive? is R,-recognizable? is Q+-recognizable? is N-recognizable?
PROBLEM 7.2.
Let f ( z )=
x;P=oa,$’
be a power series with coefficients
in R L . (a)
Iff is R,-recognizable and the coeficients are in Q+, is f Q+-recognizable ?
(b) Iff is Q,-recognizable and the coefficients are in N , is f N-recognizable ?
8. Bernoulli Distributions
Let 2 be an alphabet with k letters. A Bernoulli distribution is a function
such that crn > 0
for
c r L’ ~
co7c=1 acl’
T h e function
7z
is extended to a morphism
inductively by the formulas In = 1,
(so)n = (sn)(an)
VIII. An Excursion into Analysis
224
Given any R+-subset A of Z* we define
c
m
eA radius Note that frequently J A
=
of convergence of 00.
a,, =
J
fat
However ~n
n A < 00.
If A is unambiguous, then
~ , - S Z ' "J Z~~A= I< In particular,
1
fE*=
l + z + X 2 + . . G --
J
Z"=
oo,
&-*=
1
T h e Bernoulli distribution n is assumed to be fixed. It plays an auxiliary role and is not displayed in the notation. An important special case is the unzyorm distribution ~ n l=/ k where k = card Z. T h e assumption that n is positive (i.e., that un > 0 for all u E 2) is convenient and harmless. If we allow mz 2 0, then setting
r = { o ~ u E ~c,n > o ) B = A ~ P we find that fA4 = fs and J A = J B . Thus there is no loss in assuming that n is positive. PROPOSITION 8.1. Proof.
If A is an unambiguous subset of Z", then pit L 1 .
This follows from the inequality p.,z 2 pz*
=
1
I
8. Bernoulli Distributions
225
PROPOSITION 8.2. If A is an R+-recognizable subset of Z*, then f.l is R,.-recognizable. More generally $ A is K-recognizable, where K is a subsemiring of R , , then f.l is K[n] recognizable, where K[n] is the subsemiring of R , generated by K and the numbers on for c E 2.
Proof, Let ,d be a K-2-automaton recognizing A . Consider the alphabet consisting of a single letter t. Let be the K[n]-t-automaton obtained from LY’ by replacing all the edges
p%q by a single edge
Then
( P ) B = C (sA)(sn)= a,, h€2”
and thus f A l
=f
B . Consequently
PROPOSITION 8.3.
f.4
is K[n]-recognizable
I
If p., > 1, then
If A is R,-recognizable and J A < 00, then
> 1.
Proof, ’The first assertion is clear since f ( 1) = Czp=, Assume that A is R+-recognizable and that J A < 00. Since Cz=P=oa,l < 00 it follows 2 1. If, however, ear= 1, then by Theorem 6.1, 1 is a pole for f, that contradicting 2 a,, < 00. Thus Q , ~> 1 I
As an application we prove a curious property of k-recognizable sets. Let A be a subset of N . For each n > 0 we define
1 i
? ( A ) = lim inf n ( n , A ) n +m
??(A)= lim sup n ( n , A ) n --)m
VIII. An Excursion into Analysis
226
If g ( A ) = ii(A),their common value is denoted by n ( A ) and is called the asymptotic density of A. THEOREM 8.4.
Let A be a k-recognizable subset of N . is a rational number.
(Cobham).
If the density n ( A ) exists, then it
Proof. Let B = Av-I where v : kX 4 N is the standard or the reversed interpretation. Consider the generating function
-
with respect to the uniform Bernoulli distribution n: k [0, 11 given by jn = 1/k for all j E k. Since A is k-recognizable, B is an unambiguous recognizable subset of k*. Consequently pz, 2 1, by Proposition 8.1. Therefore by Theorem 7.2, there exists an integer p 2 1 such that the limit r = lim b,, n+w
exists and is a rational number. By definition
b,,
1
= -card(B
k”
Let s E k”. In the pair notation s i
=
n 2,)
(i, I ) of V,2 we then have
i=sv,
IsI=l
i
l=n
T h u s s E B n Z” iff iEA, Consequently b,
1 kn
= -card(B
n 2,)= n(k”, A )
T h u s we obtain r
=
lim n(k’*P,A ) n +m
Since the asymptotic density n ( A ) is assumed to exist, it follows that n ( A ) = Y. Thus n ( A ) is rational I
9. Prefixes and Bases
227
Let A be an R , -recognizable subset of Sx such that
EXERCISE 8.1.
and
.) A = C a , , <
00
11=o
Show that f o r all p -,0
Show that f o r p
of elements
of
=
1, this summation is the "average length"
A , and is f,4'(l) f p., > 1.
9. Prefixes and Bases
There are strong points of contact between the considerations of Section 8 and prefixes and bases. We recall that a prefix in Z" always is unambiguous. As in Section 8 a positive Bernoulli distribution n: I+ [0, 11 is assumed to be given.
If P is a prejix in I" then ,
PROPOSITION 9.1.
Proof.
Let B
=
PI". Since P is a prefix, B is unambiguous. Con-
sequently b,,
=
[
Zjl
nB 5
[
=
1
Further
f d z ) =f d z )
1
+ z + x% + . . . + zn + . . .)
=fp(.)(l
This implies I1
b,
=
2 Pi
i=l
VIII. An Excursion into Analysis
228 where
are the coefficients of the power series fp(z). Therefore r
J
m
1
P=Cp,=limb,Sl a=o
n+m
PROPOSITION 9.2. Let s E C" and let
P = C"s
-
Z"sZ+
Then P is a maximal prejix, p r > 1, and
Proof. We have
P=
(Z"S),n
and thus P is a prefix. Let t E Z". If s is a segment of t , then t has an initial segment in P. If not, then s has a terminal segment u such that tu E P. Thus P is a maximal prefix. To prove that S P = 1 it suffices, in view of Proposition 9.1 to show that lim n+m
s
Cnn PZ* = 1
J
~n
or equivalently that (9.1)
lim n-tm
PZ"
-
If s = 1, then P = 1 and ZpL- P2" that I s 1 = d > 0. Define
c, = Z n
-
=
=
0 and (9.1) holds. Assume
PZ"
and observe that
Cn+dn Cs,
=
0
Thus Cn+d t
o
Cn(Zd - S)
9. Prefixes and Bases
and therefore
Since C,,
=
229
J
Cn+d
I (1 - sn)
J’
c n
1, it follows that
s c,,
5 (1 - sn)?
Since sn > 0, we obtain
Since the sequence J C n is non-increasing it follows that lim
J C,
=
0
n+m
This proves (9.1). Since P is recognizable, it follows from Proposition 8.3 that EXAMPLE 9.1. set
ep > 1
We shall calculate the generating function f p of the
p
,r*s
-
,r*s&y+
in the case s = u p is the power of a single letter. T h e remaining letters in Z may without loss be merged into a single letter, thus reducing us to the case Z = 2, s = On. T h e Bernoulli distribution n is determined by a single number 0 < a = On < 1 and In = 1 - a = b. An unambiguous formula for P is
P = (Cl)*OP with
c = { A , 0,02,
.. . ,OP-l}
Since
fc. and
=
1 = az
+
a222
+ ... +
up-1zP-1
=
1 - aPzP 1 - az
VIII. An Excursion into Analysis
230
Substituting z = 1 we find frJ(l) = 1. Thus J P Proposition 9.2.
=
1 in agreement with
THEOREM 9.3. (Schutzenberger) Let A be an unambeuous subset = 1 , then A is dense. If A is recognizable and dense, then of Z*. If @..I =
1.
Proof.
If A is not dense, then
for some s E Z*. Consider the prefix
and define C = Z* - P P . Then
C = 1"- C*sZ* This implies
5
Q ~ ,
e.,.
and
A cC
Since the product P P is unambiguous we have
Therefore
1 - fi+) Since, by Proposition 9.2, e.4
=
(1
er > 1,
-
z )fc:(.)
therefore pc! > 1. I t follows that
> 1-
Now assume that A is recognizable and dense. Thus Z*-'AZ*-' = Z*. Since A is recognizable, there exist finite sets B and C such that
Consequently
B-lAC-1
=
Z*
Thus there exists a finite sequence (u, , v,), . . . , ( u k ,vk) of pairs of elements of P such that
u u;'A~;l h.
i=l
=
Z*
9. Prefixes and Bases
23 1
the union not being necessarily unambiguous. Thus one of the sets u;lAv;' must have radius of convergence 1. Since
u~(u~'Av~ c 'A )v~ it follows that PA, 5 1. Since A is unambiguous we have PA, 2 1 and Ahus e.4 == 1 I T H E O R E M 9.4. Let B be a base in P. Then S B 5 1. Further the following implications hold with M = B"
1 B=1
-
B is a maximal base
If B (or equivalently M ) is recognizable, then the above implications are equivalences. ) 0, the Proof. Assume J B > 1. Thus f u ( l )> 1 and since f L I ( 0 = conditions of Proposition 5.3 are satisfied by f = fa. Let r = ef, = e.li. Then flI(r) = 1 and thus r < 1. This is impossible since M is unambiguous. Assume J- B = 1. If B' is any base such that B c B', then B 5 B' 5 1. This implies J R = J R' and therefore B = B'. Thus B is a maximal base. If B is maximal base, then, by Theorem IV,7.4, M is dense. Assume S B = 1. If en > 1, then since ftl(l)= 1 it follows from Proposition 5.3 that = 1. If e n = 1, then Q.,~ 5 O R = 1. Since M is = 1. unambiguous it follows from Proposition 8.1 that If ew = 1, then M is dense by Theorem 9.3. Assume now that B is recognizable and that M is dense. Since M = B" is recognizable and unainbiguous it follows from Theorem 9.3 that P.lr = 1. Then 1 = < pIi andf,,(l) =fIj(p.lf) = 1 by Proposition 5.3. Thus J B = f n ( l ) = 1 I
s
Examples 9.2 and 9.3 that follow show that all the inverse implications fail if thc assumption of recognizability is dropped. EXAMPLE 9.2.
Consider the set
A
I
= { T ' ~ ' u ss E
Z+}
VIII. An Excursion into Analysis
232
with 2 = { a , T } . Clearly A is a prefix and A is dense; in fact, 2"-'A = Z". T h e generating function of A is M
where q = tn, p vergence is
=
on = 1
-
q with 0 < q < 1 . T h e radius of con-
@a =
q-1'2
>1
Thus the assumption of recognizability in Theorem 9.3 is essential. We also have fA(1) = - q) = 4 < 1 and therefore @A*
>1
Now consider the set
B
=
A - 2+A
Both B and Be are prefixes. Further B is dense; indeed, if s E Z+, then t2181a~tlXI E B. Let M be the (non-recognizable) unitary monoid B". Then M also is dense. However, B is not a maximal base since B f A. Further ear 2 @.I* > 1 This shows that the implications
B is a maximal base
of Theorem 9.4 fail if B is not recognizable.
EXAMPLE 9.3. Consider the non-recognizable submonoid of 2" = {a, T}" given by m
M= Uanutn fl=O
Thus M consists of all words in 2" which have the same number of as T ' S . Clearly M is a unitary monoid and m
(J'S
233
9. Prefixes and Bases
where (n,n) is the binomial coefficient ( 2 n ) ! / n ! i z ! and , q = 1 q, 0 < q 1. A calculation shows that ~
=
m, p
=
an
6 :
f.&)
=
1/ 2/ 1 - 4PP2
Let B be the base of M . Since
it follows that
and therefore
f&)
=
1 - 2/ 1 - 4pqz2
=
en
This implies
1 / 2 62 1
with equality holding only if p = q. Next observe that h i' is the kernel of the surjective morphism L'" 4 2 such that B 4 1, z 4 -1. Thus, by Example IV,5.2, B is a maximal base. Taking q f 4 we find that the implication
J
B
=
1 2 B is a maximal base
does not hold in the absence of recognizability. Next define = B'" B' = B n tz:", Since B' is a prefix, M ' is a (non-recognizable) unitary monoid. T h u s M ' is free. W e have f w = Pfil and therefore
1
VIII. An Excursion into Analysis
234 Thus
Since B’ is a proper subset of B we have
jB’ < jB = 1-41 4pq -
T h u s for
p
=q =
we have
negating the implication nizability.
ens= 1
-
JB
=
1 in the absence of recog-
EXERCISE 9.1. Let {ariI n > 0 } be a sequence of elements of N , and let Z be an alphabet with k letters. Show that the following conditions are equivalent ;
(i) (ii)
m Cn=, a,,/k”I 1.
There exists a prejix A in L’” with
as generating function, relative to the unqorm distribution on S. (iii) There exists a prejix A in .Psuch that
a,,
=
card(A n Pi)
EXERCISE 9.2. Let P be a prejix in 2” such that
c = /y”
-
pz+
Show that ec
1-fp(Z)
If, further, el. > 1 , then
= @I>
=
(1 - .)fc(.)
sP
=
1. Dejine
235
References
Let ‘4 nnd B be unand~igi~oirs secogniznble siihsets of P . = i ?,then .4 u R is dense iff either il or B is dense. Show that f A B is unambiguous, then AH is dense iff either A or B is dense. EXERCISE 9.3.
Show that if A n B
EXERCISE 9.4.
Show that
if
B is
n
recognizable base in I* then B ,
is not dense, References C. I,ech, A note on recurring series, Ark. Mot. 2 (1953), 4 1 7 4 2 1 .
Contains Theorem 3.4, Example 3.1 and references to earlier work by Skolem and Mahler. J. 13erste1, S u r les poles et le quotient de Hadamard de series N-rationelles, C.R. Acad. Sci. Paris 272 (1971), 1079-1081.
Contains ‘l’heorem 6.1. W. Faller, “An Introduction to Probability Theory and its Applications,” Vol. I, 3rd Ed., Wiley, New York, 1967.
Chapter XI11 is relevant to the topics discussed here. I n particular the Tauberian Theorem mentioned after Corollary 5.4 is proved on pp. 335-338. A. Cobham, Uniform tag sequences, Math. Systems Theory 6 (1972), 164-192.
Theorem 8.4 is stated on p. 180. R. A. Sittlcr, Systems analysis of discrete Markov processes, I R E Trans. Circuit Theory CT-3 (1956), 257-266.
Contains an elementary discussion of matters related to Sections 8 and 9 as viewed by an electrical engineer. M. 0. Kabin helped with Example 6.1. Proposition 6.3 is by Schutzenberger (unpublished). T h e same applies to Theorem 9.3. Theorem 9.4 and the examples that follow were obtained by Schutzenberger and the author (unpublished).
CHAPTER
Ix Rational Relations
In Chapter VII we studied rational sets in an arbitrary monoid, but the main results were confined to finitely generated free monoids. In this chapter we consider rational relations f:S + S‘, i.e., relations whose graphs are rational subsets of the product monoid SXS‘. Since this product is not free (unless S = 1 or S’ = l), most of the results of Chapter VII (in particular, Kleene’s Theorem) do not apply and new methods must be developed. Rational relations form one of the cornerstones of the structure of the theory. 1. Definitions and Examples
Let S, and S , be monoids. A relation f:S , + S , is called rational if the graph #f is a rational subset of the product monoid S , x S,. We must specify what kind of subsets and relations are being considered. In principle, the definition can be made for K-subsets and Krelations where K is any complete semiring. Actually we shall be interested only in the cases K = ~3’ or K = JF. By considering ,Ksubsets and X-relations that are non-singular, we obtain indirectly a way of treating N-subsets and N-relations. It follows from Corollary VII,2.2 that for each rational .%‘-relation f: S , -+ S,, there exists a rational X-relation g: S, S , such that gt = f.This observation allows us to derive results for .2-relations from those for X-relations. In all the interesting cases S , and S , will be either free monoids or finite direct products of free monoids. Thus, in practice, 236
1. Definitions and Examples
237
S , , S,, and S , x S , will always be locally finite, in the sense of VII,4. In this case the relation g above may be chosen to be an X-relation or equivalently a non-singular N-relation. As a result of the above discussion, we can restrict our attention to X-relations and when appropriate make statements about non-singular ,F-relations. They will then automatically also apply to 8-relations. Our notation will thus be geared to the case K = X I
PROPOSITION 1.I.If f: S , + S , is a rational relation, then so is the
relation f-': S ,
--f
S1 '
Proof, T h e set #( f - l ) c S,X S , is obtained from the rational set c S , x S , by the isomorphism h : S , x S , + S , x S , given by (s, , s,)h
#f =
(s,,
s,).
Thus #( f-')is rational
I
PROPOSITION 1.2. If A i is a rational subset of Si ( i = 1, Z), then A , x A , is a rational subset of S , x S , and the relation f:S , + S , defmed by
is rational.
Proof. Since A , x A , = ( A , x 1)(1 x A,) it suffices to show that A , x 1 is rational. This, however, is the image of A , under the morphism S , + S , x S , given by s1 + (s,, 1). T h e relation f is rational since its graph is A , x A , I PROPOSITION 1.3.
Let 5' be a jinite alphabet and S a monoid. If
f: .Z* + S is a rational substitution, then f is a rational relation. Proof. For each CT E Z, of is a rational subset of S and therefore by Proposition 1.2 the subsets
of Z * X S are rational. Since
it follows that f is rational
I
IX. Rational Relations
238
Every morphism f : L'*
COROLLARY 1.4.
--+ S
is rational
1
PROPOSITION 1.5. For any subset A of S the relation ( ) A : S -+ S dejined by X ( n A ) = X n A is rational if and only if A is a rational subset of S.
Let A : S 4 S X S be the diagonal morphism s/l = (s, s). T h e graph of the relation n A is then the set An. Thus if A is rational, so is All by Corollary V,2.3, and thus n A is a rational relation. Since A is the image of Ail by either of the two projections S X S + S, it follows that if n A is rational, so is A I Proof,
I f f l ,f 2 : S , uf2.
PROPOSITION 1.6.
the relation f Indeed #f
=f
=
+ S'
are rational relations, then so is
I
#fi u # f 2
PROPOSITION 1.7. I f f , : S , 4S1', f , : S , 4 S,' are rational relations, then so is the relation
f
=f , x f , :
s,xs,~s,'xs,'
dejined by (s1
9
szlf
= (Slf,
1x ( S J - 2 )
Proof, The graph # f is a subset of S , x S, x S,' x S,' and is obtained from the subset #fl x # f 2 of S , x S,' x S , x S,' by an interchange of the middle coordinates. Since # f l x # f , is rational by Proposition 1.2, it follows that # f is rational I PROPOSITION 1.8. I f 2 is a jinite alphabet, then the function
f: C"XZ"+Z" given by multiplication (or concatenation) (s, t ) f
=
st
is rational. Indeed #f
= ((0,
1, u)}*{(l,
t,t)}"
where
u,
tE
Z
I
1. Definitions and Examples
239
PROPOSITION 1.9. If E is a finite alphabet and A is a rational subset of
La,then the relation f : E"
+
~
sf
1"given by
=
AS c Z"
is rational. Indeed
#f- (1 xA){(a, (r) 1
fJ
E
El*
I
EXERCISE 1.1. Let f : Ela*+ E2* be a relation and let t be a letter not in .Zl nor in S,. Dejine Z1= Sl u T , 2, = L', u t, and consider the relation
j :T1* &* ---f
dejined for s
with so, . . . , s,
E
= SOTS1
9
. . S,p,TS,2
Zl * by
Show that i f f is rational, then f is rational. EXERCISE 1.2.
relations Z*
+ E*
Show that for every Jinite alphabet L' the following are rational
s(1Seg) = { u I s
E
UP}
1 s E S*u} s(Seg) = { u I s E Sr+uEr+} s(SWd) = { u I u is a subword
s(TSeg)
= {u
of s}
The last relation may be defined inductively as follows 1(SWd) = 1 (as)(SWd) = (1 u o)[s(SWd)]
Thus if s
=
(r,
. . . crl,, then s(SWd)
(1 u a,) . . . (1 u a,)
Show that SWd is a rational substitution.
IX. Rational Relations
240 2. First Factorization Theorem
T h e following purely “set theoretic” lemma is useful. LEMMA 2.1. Let
f: X+Y,xY,,
fi: X+Yi,
i= 1,2
be relations such that
xf = (Xf1)X (xf2) for all x
E
X. Let A be a subset
of X and let g be the relation
fi’ nA Y,-X-X-Y,
j8
Then #g Proof.
Let Y
=
Af
Y,xY,. Consider the projections
=
ni: Y
--f
Yi, i = 1, 2
Since fi= fni the composition g is
- -x-x--
Y,
ni 1
Y
nd
f-l
f
Y 2Y,
By Corollary VI,4.3, this composition is
Y,
with B
=
nil
Y
ns
Y””. Y,
Aj. T h e graph of this relation is B as is clearly seen by taking B
to be a singleton
I
THEOREM 2.2. (First Factorization Theorem) A relation f:S , +S, is rational if and only i f f admits a factorization (2.1 1
s, q’ z* d
-.z* nA
n
2s,
where S is a jinite alphabet, gj:L’++ Siare morphisms (i = 1, 2 ) , and A is a rational subset of Z* I COROLLARY 2.3. If riis a generating subset f o r Si(i = 1, 2), then gl and g , may be chosen so that .zgi c 1 u ri for i = 1, 2. I n particular, if Siis free, then g i may be chosen to be fine
I
2. First Factorization Theorem
241
The set A may be chosen to be an unambiguous local
COROLLARY 2.4. subset of Z+.
Proof. Assume first that f is the composition (2.1). Then by Lemma 2.1 we have #f = Ag whereg: 1"4 S , Y S, is defined by sg = (sg, , sg,). Since A is rational, so is Ag and thus f is a rational relation. Conversely, assume that f is a rational relation, i.e., #f is a rational subset of S , x S,. Let I', (i = 1, 2 ) be generating subsets for Si.Then
r-
(1 u r 1 ) x ( iu
r,)
is a generating subset for S , x S,. Ry Proposition VII,9.4, there exists a finite alphabet S, a morphism g : 2" + S , x S,, and a local subset A of Z +such that Zg c r, A g = #f Defineg,: S' + S , (i = 1, 2) so that sg = (sg,, sg2). Then Zg, c 1 and f is the composition (2.1) by Lemma 2.1 I
u I',
There is a variant of Theorem 2.2 valid if S , and S , are free monoids. Consider two disjoint alphabets Zl and S, and define the canonical projections x i : (2,u Z,)* + ZiX, i = 1, 2 by setting for
0,
E
X,,6, E Z2 O17cL = fJ,,
1,
61n2 =
fJ2n1 = 1 6,7c2= 62
Then define the canonical morphism 32:
( 2 ,u &)*
4
Zl"XZ,*
so that
sn
=
(sn, , sn,)
Thus c7,n
= (c7,
, l),
(T,n
=
(1, ),.
THEOREM 2.5. Let Z,and Z,be disjoint alphabets. A relation Z,* + Z2*is rational (f and only (f f admits a factorization
2,"
n;'
(XI
nA u Z2)*+ (1, u Z,)" 5 Z,"
where A is a rational subset of (Z1u Z,)*.
f:
242
IX. Rational Relations
Assume that f has the form above. Then by Lemma 2.1 we have #f= An. Since A is rational and n is a morphism it follows that #f is rational. Conversely assume that #f is a rational subset of 2," x Zi*since n is a surjective morphism, Proposition VII,2.4 implies the existence of a rational subset A of (C1u Xz)*such that #f = An. T h u s by Lemma 2.1, f factors as above I Proof.
COROLLARY 2.6. I n Theorem 2.5, the relation f is non-singular if and only (f the subset A of (El v Xi)*is non-singular. Indeed, for each (s, t ) E XIax Z2"the set ( s , t)n-' is finite. This readily implies that #f = An is non-singular if and only if A is I EXERCISE 2.1. Show that every rational relation f:S,"+ S,"is the is a non-singular rational relation union f = f i u fi where f i : 2," -+ 1," while fi:S,"-,Zz" is a purely singular rational relation (i.e., #f, is a purely singular rational set). [Hint: Use Proposition VII,9.2.] EXERCISE 2.2. Let A be a rational <%'-subset of S * x P . Show that A supports a rational .A"-subset B such that for all s E S",g E P
where
( p , q ) is the binomial coeficient ( p + q ) ! / p ! q !
3. Evaluation Theorem THEOREM 3.1. (Evaluation Theorem) Let f: S , + S be a rational relation with S , free. If B is a rational subset of S , , then Bf is a rational subset of S .
Represent f by the composition (2.1) of Theorem 2.2, in which g , : S* + S , may be assumed to be fine. Then by Proposition VII,4.5 the set g;'B is rational. Therefore, by Theorem VII,5.2, the set (g;lB) n A is rational. As a result, the set Proof.
Bf is rational
I
=
(Bg;' n A ) g z
3. Evaluation Theorem
243
In Example VI1,S.l W C constructed in the monoid two rational subsets A and B such that A n B is not rational. Consider the relation f = S + S. By Proposition 1.5, f i s a rational relation, however Rf = A n R is not rational. This shows that the assumption made in Theorem 3.1 of S , being free is essential. EXAMPLE 3.1.
S
=
{a, Z } * X
{I/}*
PROPOSITION 3.2.
n.4:
Let
f: s,xs,-s be a rational relation with S , a free monoid. For every rational subset A , of S , the relation g: S,+S defined by szg = ( A l X 4 f
is rational. By assumption #f is a rational subset of S , x S , x S. Let h : S , + S,><S be the relation whose graph coincides with #f. Then h is rational. Since S , is free and '4 is rational, it follows from the Evaluation Theorem that A l h is a rational subset of S,x S. However, A,h = #g. T h u s g is rational I Proof.
PROPOSITION 3.3. If in Proposition 3.2 both S , and S , are free and if A , and A , are rational subsets of S , and S , , then ( A ,x Az)f is a rational subset of S . This follows directly from Proposition 3.2 and the Evaluation Theorem I
In order to properly exploit Propositions 3.2 and 3.3 we introduce some additional notation concerning relations. Consider a relation
I: x x +'E
z
Instead of writing (2, y ) 1 for the value of 1. at (x, y ) , we shall write .1c Iy . I n analogy with the division calculus developed in 111.3 we denote x-1 l . Z = { Y I Y E Y , X E X l y }
x ly-'=
{XIXEX,
Z E X
Ly}
IX. Rational Relations
244
T h e sets A-l IC and C I B-' for A c X , B c Y , C c 2 are then defined by distributivity
A-' IC
=
UX-' IX,
C IB-' = U X L y - l ,
A, x
E
C
y E B, x
E
C
x
E
T h e above definitions were appropriate for .%'-relations and .%'-subsets. T o include the case of JT-relations and JT-subsets, the definitions are rewritten as y(x-1 Iz ) = x ( x r y ) x(x l y - 1 ) = x(x I y )
y(A-1 IC ) =
c (x A ) ( z C ) ( z ( xIY ) ) c ( y B ) ( x C ) ( x ( x- L Y ) ) 5,z
x(C 1B-'1 =
u.2
P R O P O S I T I O N 3.4.
If I:s,xs,-s
is a rational relation, then so are the relations
I': S,XS+S, 1": sxs, + s, defined by S'
s
1's = s;' Is
I"s2 = s Is,'
Indeed, the graphs of 1'and 1'' are obtained from the graph of I by morphisms permuting coordinates I Combining Proposition 3.4 and 3.3 we obtain: P R O P O S I T I O N 3.5.
If S , , S , , S are free monoids and I:S,XS,+S
is a rational relation, then for any rational subsets A c S , , B c S , , C c S the subsets
A IB c S , are rational
A-' IC c S , ,
C IB-' c S ,
4. Composition Theorem COROLLARY 3.6.
245
If A and B are rational subsets of Z* with ZJinite,
then so are the subsets
AB, A-IB, AB-I This follows from Proposition 3.5 applied to the rational relation Z*XZ* + Z* given by concatenation I EXAMPLE 3.2. Let Z =
{ C T ,T } and
consider the function f : Z* -+ Z*
defined inductively as
If
=
1,
(.s)f
(os)f= a($),
=
Thus sf=
optp
+
if I s I = p q and u and z appear in s, p , and q times, respectively. We show that this function is not rational. Indeed
Since (m)* is rational while the set on the right-hand side is not, the Evaluation Theorem implies that f is not rational. EXERCISE 3.1.
Generalize Proposition 3.5 to more than two variables.
EXERCISE 3.2.
Let Z and T be disjoint alphabets. Show that the shufje
product UJ:
z*xr*+ (2 v r)*
is a rational relation. Show that the internal shuffle product
u:Z " x Z * + Z * is a rational relation. Derive conclusions analogous to Corollary 3.6. 4. Composition Theorem
THEOREM 4.1.
(Composition Theorem) Given rational relations
- -s,
s, fl s
fe
with S free, the composition f,f,:S , + S , is a rational relation.
IX. Rational Relations
246
T h e crux of the proof is the following lemma, which itself is a special case of Theorem 4.1. LEMMA 4.2.
Given fine morphisms
with S and E finite, the composition gh-l is a rational relation. Proof,
Let 0 consist of all pairs
(a,1)
with
ug
(1, E )
with
Eh = 1
E)
with
ag
(a,
=
=
1 Eh f 1
Define the morphisms
Further consider the local subset A of 0" defined by
A
=
0" - UO"(1, Q(u, 1)0"
the union extended over all pairs (1, E ) , (a, 1) in 0. We assert that gh-' is the composition
By Lemma 2.1 this is equivalent to the assertion #(gh-')=
Am
where
m: 0" + Z " x X * ,
tm = (tk, t l )
for
t E 0"
We further note that (s, x) E #(gh-l) iff sg = xh, s E 2 7 , x E 8". Since kg = lh, the needed conclusion follows from the following assertion.
(4.1) For every pair (s, x), s E L'", x E 8* such that sg = xh, there exists a unique element a E A such that am = (s, x).
4. Composition Theorem
247
To verify (4.1) observe that element s E S" has the form
with gig f 1, sig
=
1. Further n
=
1 sg 1. Similarly x
x = XOElxltz
* * *
E
P has the form
Xn-1EnXn
with t i h f 1 and x i h = 1. If we assume that sg = xh, then the integer n in the expansions of s and x will be the same. Further oig = Eilz for 1 5 i 5 n. Consider the element of
with ai = (Si,
05i5n
1)(1, Xi),
It is understood that (si, 1) stand for the appropriate product of generators (0,1) of 0 and similarly for (1, x i ) . Clearly ak = s and al = x . T h e uniqueness of a follows from the observation that a representation (4.2) of an element a E A is unique I We now turn to the proof of Theorem 4.1. T h e First Decomposition Theorem is used to represent f, and fi as compositions
with g, and g, fine morphisms and A and B rational subsets of Z," and Z2*,respectively. Further, by Lemma 4.2, the relation g,g-l: Zl* + Z," is rational and so it admits a factorization
with h, and h, fine morphisms and C a rational subset of Z3*. As a result, flf2
where k is the composition
2,"
nA
2,"
hT1 __f
2;"
= g-%'
- - nc
Z;"
h2
z,*
nLi
2,"
IX. Rational Relations
240
Applying Proposition VI,4.1 we find that k is Z,"
with A '
- - - - - - hT
= h;'A,
C," n A ' C,"
B'
nc
nB'
Z,"
= h;'B. Consequently,
C,"
h;'
C,"
nD
C,"
C,"
h,
Z,"
k is the composition hn
C2"
with D = A ' n C n B'. Since A ' and B' are rational sets by Proposition VII,4.5, it follows from Theorem VII,5.2 that D is rational. Since f lf, is the composition
- - -s, (big)-'
2,"
it follows that flfi is rational
I
s, EXAMPLE 4.1.
nD
Z,"
hag'
Consider Example 3.1. In the diagram
the two relations are rational, however their composition is n C with C = A n B which is not rational. Thus the assumption that S in Theorem 4.1 is free, is essential. 5. Second Factorization Theorem
THEOREM 5.1.
(Second Factorization Theorem) For every relation
f:2" -+ P , where Z and r are finite alphabets, the following conditions are equivalent : (i) f is rational and If (ii) f is the composition
=
0.
2Q* Q. +nL
.p
-r" h
where Q is a finite alphabet, g : 9"+ C* is a very fine morphism, L is a local subset of Q+, and h is a rational substitution. Further, f is non-singular if and only i f h may be chosen to be non-singular. T h e following lemma is essential. A substitutionf: C*+ P is called positive if (rf c rf for all (r E C or equivalently if If -l = 1. T h e following lemma is essential:
249
5. Second Factorization Theorem
LEMMA 5.2.
The relation f nL z*+ r*_ ., r*
(5.1)
where f is a positive substitution and L is a local set is the composition Z*
(5.2)
nni
-+Q*
k
-+
r*
where h : Q* + Z* is a very jine morphism, M is a local set, and k is a substit u tion sa tisfring cok = (whf ) n (01 where 1: 9" + r# i s a local substitution.
Proof. We first consider four special cases for L. Case 1. L = AT* with A c I: We choose Q = Z v 1 where 2 is a copy of Z disjoint from 2. We define h by setting ah = cih = u. Then define M = ZQ* and a1 = AT",
cil
=
(r- A ) P
T he verification that the compositions (5.1) and (5.2) coincide is then straightforward. Case 2. L = F*B with B c r. T h e definitions of Q and h are as above, but M = Q*Z and
Case 3.
L
=
r*
-
r * y 1 y 2 r * . We define Q=ZUZ1 VZ2VZl2
where El,Z2, Z12are copies of Z disjoint from Z and from each other. T he fine morphism h : Q* + Z* is defined by oh = n l h = o,h = a,,h = u. Finally we choose
M
Q*(L',Z, v ZIZ,, u Z,,L',)Q* - yzr* - r*yl - r "Y 1Y zr*
= Q+ -
ui = rt all = r*yl - yzr* - r*ylyzr*
yzr*- r*yl- r*yly2r* olZl= ysr* n r*yl r*yly2r* azl=
-
The verification that the compositions (5.1) and (5.2) coincide is omitted.
250
IX. Rational Relations
Case 4. L = L, n L, where L , and L, are local sets for which the conclusion is known to hold. We note that (5.1) is then the composition
z*
f _+
-
nr, r* n L l r*A r*
Applying the conclusion to f ( n L 1 ) we obtain h-' z* L Q,*
-r*
+I ki 'n? Q ~ *
with
o,k,
=
roll, local
( w , h , f ) n oll,,
Next we consider the composition
For f(n L ) we obtain the composition h-' nnf ZL Q,* 2Q
1,;'
~ *
Q*
n $1 2 Q*
k __+
r*.
We now use the fact (Proposition IV,2.1) that (nM,)h;' is also the composition h-' GI* 5 s,*
where N ,
=
nNi
Q*
M,h;l. Thus finally for f( nL ) we obtain the composition k z*-n* .n-wa* -r* h-1
with h
= h,h,
,M
=
N , n M , , and
wk
=
(df) n (01,
to1 =
wh,l, n (01,
as required. Since every local set L is the finite intersection of local sets considered in the first three cases the conclusion follows I We now turn to the proof of Theorem 5.1.
5. Second Factorization Theorem
251
Proof. (i) * (ii). By the First Decomposition Theorem f is the composition 2p i-l.II 2" k p _*
~
I
where d : 0" + L* is a fine morphism, M is a local subset of O*, and k is a morphism. Since If = kg, f remains unchanged if we precede it by the relation nL'f: Z* + I*. We first consider the composition
I"n_.+p
(5.3)
~
d-1
F"
Y
and prove that the conclusion of the theorem is valid in this case. For this we consider the augmented alphabet 2'. Define the very fine morphism e: E*+ f*by setting te = a if Ed = a E L' and (e = d if Ed = 1. Then the composition (5.3) becomes
(5.4)
2 ' "n-1d -f% F" c
&
L
r,
Next consider the alphabet 5 = S u where 2 is a copy of L' disjoint with L.Define the very fine niorphism c : + S* by setting ac = c?c = a and define the rational positive substitution m: 5* + L?* by setting 3m = d*od*. am = ;*a,
z*
We let the reader verify that the composition (nSi )rl coincides with the composition
\,"
~
e-
I
2"
f* 5 2'"
Since the set I*,is "local, replacing m by me-' gives the required result for (5.3). We now return to the decomposition
m+
=:o,p
k
Y
o f f . We have just proved that ( n S + ) d - l has a factorization c-I
2" d
@ @ .'*-"
nv
F* Y
with c very fine, N local, and n a rational positive substitution. W e now apply Lemma 5.2 to the composition n(nM). I t asserts that n ( n M ) is the composition @" 1-LQ* nr' Q" o_ 2""
-
IX. Rational Relations
252
with b very fine, P local, and o a rational positive substitution. This yields the following decomposition for f
T h e composition ( 0 N ) b - I may be replaced by b - I ( n ( N b - I ) ) and so we obtain the following decomposition of f
with h = bc, L = P n (Nb-I), and 1 = oh. This proves (ii). Note that we may assume that each letter w E Q appears in some word w E L. Thus setting s = wh we see that wl will be a subset of sf. Thus i f f is non-singular, it follows that wl is non-singular and wl is nonsingular for all w E Q. Consequently 1 is non-singular. Assume that (ii) e-(i). I t is clear that f is rational and that If = 0. 1 is non-singular. For every s E Z"the set (sh-I) n L is finite and therefore [(sh-l) n ,511 is non-singular. Consequently f is non-singular I
f: C,"+ C2*, where the alphabets Z1 and Z2 are disjoint, defne the substitution f:2," + (C,u 2,)" EXERCISE 5.1. Given any substitution
by setting af= a(af)for every a E C l . Show that for any subset B of C,"the composition
z;"
- nB
coincides with the composition
2,"
Z,"
-
f
2," f
(Z1 u 2,)" nBni' (Z, u 2,)"52 2 "
where zi: (2,u 2,)"+ 2$*are the canonical projections. 6. Length-Preserving Relations
Given finite alphabets Z,,
T = (C1X
. . . , Ck we consider the
. . . XZk)" C C,"X
XZkc
monoids =
S
the inclusion being obtained by identifying each generator (a,,. . . , ak) of T with the same element viewed in S. THEOREM 6.1.
If A
c
T and A
E
Rat S, then A
E
Rat T
253
6. Length-Preserving Relations Proof.
We introduce the morphism a: S + N k ($1,
.. ,
(I
=
*
$1
I, . . .
9
15,
I)
Given any element p E N k , let rp= p r l . Clearly the sets For any t E T and any element u E rpwe have ut =
rpare finite.
t'u'
for unique elements t' E T , u' E F,. Consequently for every A c T and every p E Nk we have a matrix of subsets of T
D(A,P) = A,, indexed by u , v
E
r,, such that U A=
A,,v 2,
Clearly
(6.1)
D(A
+ B, P)
=
W A ,P)
+ W B ,PI
for A , B c T . We also have
(6.2) Indeed
W A B ,P) = D(A,p)D(B,P) uAB = C ABv,,
=
2)
so that
(AB),,
=
Cu Cw AuvBvlvw
C AUUB,, 2)
as required. From (6.2) we deduce
(6.3)
D(A+,P) = [ W A ,P)l+
Next we prove:
(6.4) If A E Rat T , then for any p D ( A , p ) are in Rat T.
E
N k the entries of the matrix
Indeed let 8 be the class of all subsets of T for which (6.4) holds. If A is a singleton, then each entry of D ( A , p ) is either empty or is a sineleton and thus A E @'. Formulas (6.1') and (6.2') show that if
254
IX. Rational Relations
A , B E V, then A u U and A B E '8. Formula (6.3), together with Exercise VII,5.4, shows that if A E d,then A+ E 8. T h u s '8' is rationally closed and contains all the rational subsets of T. This proves (6.4). To conclude the proof of the theorem we employ the notion of height introduced in VI1,l. Letting B be the class of all singletons in S we have m
Rat S
=
(JB ( h ) h=O
with B ( k )defined inductively by VII, (1.3) and (1.4). It suffices to prove that for all h E N : (6.5)
If A c T and A
E
BoL),then A
E
Rat T.
If h = 0, this is clear from the definition of B'O).We now proceed by induction, assume (6.5), and consider A c T , A E B'h+l).T h e n A is a finite linear combination with coefficients in JF of monomials of the form
) . may thus assume that A with u , , . . . , u, E S , B , , . . . , B, E B ( / L We itself is the monomial. Elementary length considerations show that if xyz and xyyz are in T , then y must be in T . This implies B , c T and thus by the inductive hypothesis B , E Rat T and therefore B,+ E Rat T. By what we proved earlier uoBl-kis a finite sum of subsets of the form Cv with C E Rat T , v E S. T h u s A is a finite s u m of subsets of the form
(6.7)
Cvu,B,fu, . . . u, -,B,+u,.
Since C and the entire monomial are in T it follows that
is in T. T h u s by induction with respect to the integer r we may conclude that (6.8) is in Rat T. T h u s (6.7) also is in Rat T , and so is A I
r"
Call a relation f : Z* -+ length-preserving if I s I = I g I whenever g(sf) # 0, i.e., whenever g E (sf)t. Equivalently f is length-preserving if the graph #f o f f is contained in the subset (Zx T)*of Z* x
r".
PROPOSITION 6.2. For any relation f : Z* + T*,where Z and T are jinite alphabets, the following conditions are equivalent :
6. Length-Preserving Relations
255
(i) f is rational and length-preserving. (ii) f is the composition
-
rl-' n .i .z* 2 ( Z X r)*
where
rl and r2 are
(ZX
-r*
r)*
qa
the very fine morphisms given by
(a,Y h ,
=
a,
(0,Y)r2 =
Y
and A is rational. Further, f is non-singular i f and only i f A is non-singular. Proof. By Lemma 2.1, condition (ii) is equivalent with #f = A c (L'xT)*.T h u s f is rational iff A is a rational subset of P x P and
this by Theorem 6.1 is equivalent with the rationality of A as a subset of (EXT)*, Clearly f is non-singular iff #f = A is non-singular I THEOREM 6.3. For any relation f: S* P,where .Z and finite alphabets, the following conditions are equivalent : --f
(i) f is rational, non-singular, length-preserving, and If (ii) f is the composition nL h z* LQ* -Q* -r*
=
r
are
0.
where Q is a finite alphabet, L is a local subset of Qf, and g and h are very fine morphisms. Proof, (i) (ii). Apply Proposition 6.2, and consider the rational non-singular subset A of ( E x r)*given in (ii). Since If = (3it follows that A is a subset of (EXT)+.By Proposition VII,9.4 there exist a finite alphabet Q, a local subset L of Qf, and a very fine morphism k : 9" + ( Z x r ) " such that A = Lk. By Corollary VI,4.2, the relation r)A is the composition
- -a*-
(EX TI*
k-1
Q*
nL
k
(ZX
r)*
The conclusion now follows with g = k q l , h = kTI2. (ii) = (i). This follows readily from Theorem 5.1 EXAMPLE 6.1.
I
Let .Z = {a, T}. T h e reversal function z'*-+.Z*
&I:
IX. Rational Relations
256 is defined by l @= 1,
a@= u,
t@ = t,
(St)@ =
(t@)(S@)
We shall show that e is not rational (as a .q-relation). Indeed let A = # e c (Ex 2)".If A is a rational subset of Z+x Z", then by Theorem 6.1 it is also a rational subset of (ZX2)"and therefore by Kleene's Theorem A is recognizable. Since A consists of all pairs (s, sp) with s E 2" it is easy to verify that (u'j, t")-'A = A ( t " , an) for all n 2 0. This shows that the sets (on,tn)-lAare all distinct and thus A is not recognizable. We can use the same method to prove that the conjugation relation (see Exercise III,12.6) c : Z"
+ Z",
sc
=
{uv I v u
= s}
is not rational. If A is the graph of c, then we easily verify that (tP, UP) E
iff p
=
(u", P - ' A
n. Thus again A is not recognizable.
7. A Cross-Section Theorem
r"
Let f: 4 2" be a morphism with I' and Z finite. there exists then an For every unambiguous recognizable subset A of unambiguous recognizable subset B of A such that f maps B btjectively onto ( / I f ) ? . The subset B will be called a cross-section off on A. THEOREM 7.1.
r"
Proof. Let g: L'" + 9" be a morphism. We show that if the conclusion is valid for f and for g, then it is also valid for f g : r" + Q". Indeed let A c P be recognizable and let B be a recognizable crosssection off on A. Set C = A f t = Bf,and let D be a recognizable crosssection of g on C. Define E = B n Of-'.Then E is recognizable, f is injective on E, and Ef = D. Since g is injective on D it follows that f g is injective on E. Further Efg = Dg = Cgt = Afgt as required. Next we observe that iff is injective, the conclusion holds trivally by taking B = A. Since any morphism f: I'* + 2" admits a factorization
r*AQ*Lz*
257
7. A Cross-Section Theorem
with g injective and h fine, it suffices to consider the case when f is fine. Factorization of the fine niorphisni f shows that it suffices to consider the following cases
r=
(01,
s=
'.',c,,,c,,tl},
e i f = ai U,,+lf =
for
-..,c,,}
1 5i s n
or
an
{(TI,
=
.,If
1
We define a total order in P by setting s < t if either of the following two cases holds
t
=
sw
t
s = ualv,
=
uc,w
with
w # 1
with
i <j
Next we define the %-relation
h: P
+r*
s h = { t l s < t and
sf=
tf}
and set
B=A-Ah T h u s for each x E A , the smallest element in A n xff -l is selected and B is the set of all elements so selected. T h u s B is a cross-section off on A. T o prove that B is recognizable, it suffices to show that A h is rational and for this it suffices to show that the relation h is rational, Le., that its graph # h is a rational subset of x 2'". W e define D = { ( a 1 ,a,) I 1 I i 5 n}
r"
E F
+
{(a,, a,) I 1 5 i 5 1) = graph of f f - ' : I'" + rX =
T h e n in the case a n f lf
=
a,, we have
#h
=
Jwa,,,o,+,)F
I n the case a,,+lf = 1 we have
#h Since ff-I
=
E"(1,
u E"(1, anf1)+DF
G,,,~)+
is rational, F is rational and thus #h is rational
a
T h e Cross-section Theorem has already been used to prove Theorem V1,ll.l. Other applications are given in the next section.
IX. Rational Relations
258
8. Rational Partial Functions THEOREM 8.1. Let f : 2" + r" be a partial function where 2' and r are jinite alphabets. Then f is rational as a 9-relation if and only if f is rational as an unambiguous X-relation.
Let f be the composition
Proof.
Z"
(8.1)
nL ZQ" -a*
h d
T"
as given by the First Factorization Theorem. Then g: 2'" is a morphism and L is a local subset of SZ+. Since L is recognizable, the Crosssection Theorem may be applied. Then let L , be a recognizable crosssection of g on L . Then replacing L by L , in (8.1) we obtain an unambiguous rational .F-relation f i which is a partial function and such that Dom f = Dom fl --f
Since f is a partial function, it follows that f
If in the argument above we set L' ing L by L' in (8.1), we obtain:
=
L
-
=f l
I
L , and define f' by replac-
PROPOSITION 8.2. Every rational relation f: Z" + I'" is the sum f = f , u f ' where f,, f ' : 2" + I'" are rational relations, f, is a partial
function, and Ilom f i
=
Dom f
I
Given an J ' k u b s e t A of X we define the cardinality of A as card A
=
C xA J€.Y
Thus, in general, card A E ,Y: If card A is finite, then we say that A is Jinite. Note that i f f : X -+I' is a function, then card(Af ) = card A. PROPOSITION 8.3. Let f : L'* + P be a rational J'-relation and let k > 0 be an integer sucR that
card(sf) 5 k for all s
E
2'". Then f = f , u ... Ufk
8. Rational Partial Functions
259
where f i : .F+ IT*,1 5 i 5 k, are rational partial functions such that Doinfi Proof.
=
{ s I i 5 card(sf)}
We apply Proposition 8.2. Then Domf,
Since the equality f
= fl u
=
{s I 1 5 card($)}
f' holds for ,,F-relations it follows that
card($') 5 k {s
1 i 5 card(sf
I ) }
= {s 1
-
i + 1 5 card($))
'The conclusion now follows by induction E X A M P L E 8.1.
1
I
Let .L'= {ul, cr2), I ' = { y ) . Consider the .R-subset
A=
{a,Po,qy
Ip
=
r
or
q = Y}
of L'" x P.Clearly A is rational since
A
= (O1y)"az"
u u,"(o,y)"
We shall prove that A viewed as an unambiguous N-subset is not rational. First observe that A is the graph of the .a-relation
j: S" + 1'" defined by (OIP, (UIP,
4.f = {Y, P} Qlf = Y P 4f=(z,
if P f 4 otherwise
(S1>
I t suffices to show that f is not a rational J-relation. Indeed, suppose that this is the case. Since card($) 5 2 for all s E 3 it follows from Proposition 8.3 that f = f l ufi,where f, and f, are rational partial functions with Domf, = {s I 2 5 card($)} Thus Domf,
=
1p
{01~02q
.f q }
260
IX. Rational Relations
and this set is not rational. Since Dom fi = P f ; ' it follows from the Evaluation Theorem that Domf, must be rational. Theorem 8.1 is of considerable importance. We shall use it in proving: THEOREM 8.4.
If
=
0 or If
=
Every rational partial function f: Z* 1 is the composition
--f
r" such that
--r*
Z* 2Q* A
where g is a length-preserving rational partial function and h is a morphism. Proof.
It suffices to consider the case when l f =
0. We shall treat
f as an unambiguous X-relation. By the Second Factorization Theorem f is the composition Z*
k-1
nL Q* -Q*-
h
r*
where K : Q* + Z* is a very fine morphism, L is local, and h is a rational substitution. Without loss of generality we may assume that wh f 0 for all o E Q and that each letter w in SZ appears in some word of L. We claim that h is a morphism. Indeed if card(wh) > 1 for some w E Q, then for a word w E L involving w we have card(wh) > 1. Setting s = wk it would then follow that card($) > 1 contrary to the assumption that f is a partial function. Define g = ( K - l ) ( n L ) .Clearly g : Z* + Q" is a rational length-preserving relation, and further f = gh. Since this is an equality of uFrelations we have for each s E 2" card($)
=
card(sg)
Consequently card(sg) 5 1 and g is a partial function
1
EXERCISE 8.1. Show that iff: N + N is a rational partial function, then the domain o f f is the union of a jinite number of arithmetic progressions P,, . . . , Pk and of a jinite set F. Further there exist elements of N
a,, . . . ,a k ,
b,,
. . . , bk
such that for all 1 5 i 5 k nf [Hint:
=
ain
Use Exercise VII,8.3.]
+ 6,
for
n
E
Pi
9. Iteration
261
As an application show that the function f : N nf
+N
given by
= n2
is not rational. Show the same for the function nf
=
[an]
where a > 0 is an irrational number and [an] is the integral part of an. Show that this function is rational if CI is rational. 9. Iteration
Let A be a rational .R-subset of 2 7 x r*.There exists then an integer n such that if PROPOSITION 9.1.
IsI+Igl>%
(S,X)EA,
then s and g have factorizations s
g
= UlWlVl,
= U~W~V,Z
such that
+
+I
0 < I w1 I I w2 I 5 I u1 I E A (ulwIEvl,
WI
I
+I
UZ
I
+ I wz I 5 n
for all k 2 0
Proof. We may assume that Z and T are disjoint. Let n: (2 u 1'). 2'" x P be the canonical surjective morphism and let B be a rational 3 - s u b s e t of (2u T)*such that B n = A. By Kleene's Theorem, B is a recognizable subset of (2 u and thus Proposition II,5.1 may be applied to B. Let n be the resulting integer. Then for (s, g) E A , I s I I g I 2 n we have (s, g) = t n for some t E B such that I t I = I s 1 I g I 2 n. Then t admits a factorization t = uwv such that --+
r)*
+
+
O
N
As an application we shall show that not only is the squaring operation + N not a rational function (see Exercise 8.1 ), but that this cannot be
IX. Rational Relations
262
remedied by a choice of bases. We shall use the reversed interpretations v@ as defined in V,6. However, the results hold equally well with the standard interpretations 1'. PROPOSITION 9.2. Given
k 2 1, 12 1, there exists no rational
relation
f: k" -1" such that the composition ,e-i
NLk".
f
, @
1 " L N
is the squaring operation. Proof. Given such a relation f let A c k"x1" be its graph. Then by Proposition 9.1, there exists an integer n > 0 such that if
If k > 1, then upon calculation we find
where
Similarly if 1 > 1, then ( U ~ W , ~ V ,= ) ~ a,
+ bSc2P
T h u s if k > 1 and 1 > 1, we must have
(9.1)
(al
+ b , ~ , p ==) ~ a2 + bZc2P
for all p
20
263
9. Iteration
+ I wz I
Since cI = klu'll, c, = I 1 u ' z l , and 0 < 1 w1 I cI = c2 = 1. T h u s (9.1) implies that either (9.2)
b,
=
b, = 0
we cannot have
aL2= a,
and
or
b12 = 6, f 0
(9.3) If b,
=
c l P= c2 f 0
and
0, then ( w , ) = ~ (v,)
I u, I 5 n this would imply
= 0 so that ( s ) = ~ ( u , ) , and since (s)~ < k". This is a contradiction since the
pair (s, t ) may be chosen with (s)~ arbitrarily large. If (9.3) holds, then (9.1) becomes a12 2a,b1c,p = a2 and since 6, # 0, c, # 0, 1, this can take place only if a , = a, = 0. If a, 0, then (ul) kl'll(wI) = k ( u , ) or equivalently ( U ~ W = (Ou,),. This is possible only if ulwl E 0". Similarly a2 = 0 implies uzw2E 0". Since 0 < I u , I I w , I 1 uz I I wz I it follows that either s or t (or both) must begin with a zero. T h u s either (s), is divisible by K or ( t ) l is divisible by 1. However, the pair (s, t ) may be chosen so that this is not the case. If k > 1 and l = 1, then (u2w2*v2)= I u2 1 p I w z 1 1 v z 1 and (9.1) is replaced by
+
+
+
+
+
+
(a,
+
b,Clp)3 =
I u2 I
+P I w, I + I
+
W,
I
Since c1 = k'u'll and 0 < I w , I + 1 wz I this is possible only if b, T h u s as before we have a contradiction. If k = 1 and 1 > 1, then (9.1) becomes
(I
UI
I
+ P I w1 I + I
Ul
I),
=
a2
=
0.
+ b&zP
and this is possible only if b, = 0. T h u s we obtain a contradiction as above. If K = l = 1, (9.1) becomes ( I . l r + P I ~ l I + I ~ 1 1 ) 2 = I ~ 2 1 + P I W 2 1 + I ~ z I
and this is impossible since 0 I: w 1I
+ I w, I I
We shall usc the same method to prove: PROPOSITION 9.3.
A rational relation
f: k*
--j
1"
~ ) ~
IX. Rational Relations
264
for k 2 1, 12 1 such that the composition
and o n b if
is the identity exists
for some integers x > 0, y > 0. In particular, i f k vice versa.
=
1, then 1 = 1 and
Proof. T h e proof proceeds exactly as in the previous proposition except that (9.1) is replaced (in the case k > 1, 1 > 1) by
(9.1')
a,
+ blclP = a , + b2c,7'
for all p 2 0
with c1 = c2 = 1 excluded. This implies either b, = 0 or b, = 0 or c1 = c,. As before b, = 0 or b, = 0 lead to contradictions while c1 = c, gives klqoll= Z I W a l as required. If k > 1 and 1 = 1, then (9.1') becomes 01
+
blClP
=
I u2 I
+P I
WE
I
+I
%I
+
which gives a contradiction since c1 = kl"ll' and 0 I w , I 1 w , 1. T h e case k = 1, 1 > 1 is handled symmetrically. Suppose now that kz = l g for some integer x > 0, y > 0. Let m = Kz = lv. Consider the morphisms :<
g : m+ +k*,
h : m+ - e l x
defined by the conditions
(dgh
=
d,
(dh), = d, for all d E m. Then the relation f property I PROPOSITION 9.4.
I dg I = x 1 dh I = y = g-lh:
k" + 1" has the required
For k > 1 the function vk@: k"
--f
N is not ra-
tional. Proof,
Indeed, assume that vk is rational. Let f be the composition VK@
"8-1
k"-N-Ll"
References
265
Then f is rational and the composition v f - y v , ~ is the identity. This contradicts Proposition 9.3 I EXERCISE 9.1. Let C be an N-subset of S*. Show that f C regarded as a function C : Z*+ N is rational, then C is a rational N-subset of Z*. Show that the converse is not true by taking Zto be a single letter alphabet and setting 0°C = n2. EXERCISE 9.2. Show that i f f : L’* P is a rational relation then so is the relation fe: L‘* + P dejined as the composition --f
5p
~31:
L,
p 5p
Deduce that the conclusion of Propositions 9.2-9.4 remain valid with the reversed interpretation ve replaced by the standard one v. References C. C. Elgot and G. Mezei, On relations defined by generalized finite automata, IBM J . Res. Deuelop. 9 (1965), 47-65.
This paper introduces rational relations (called “transductions” by the authors) and proves most of their properties. T h e paper is rather hard to read and this is perhaps why it received much less attention than it deserves. M. Nivat, Transductions des languages de Chomsky, Ann. Inst. Fourier (Grenoble) 18 (1968), 339-455.
This paper reproves some of the results of Elgot-Mezei and continues with applications to algebraic sets (i.e. context free languages) that will be treated in Volume C. Theorem 6.1 can be deduced from the results of Elgot-Mezei. T h e proof given here was found by the author jointly with M. P. Schutzenberger (unpublished). Theorem 7.1 appears to be new.
CHAPTER
x Machines
T h e notion of a “machine” as presented here is closely related to that of an automaton. T h e “type” of a machine is the class of relations (usually partial functions) that constitute the elementary operations or moves that the machine is capable of performing. A variety of such types is considered. Many more types will be considered in Volumes C and D to describe progressively richer families of sets, functions, and relations. 1. Basic Definitions
I,et S be an arbitrary set and let @ be a family of relations y : A’ -+ X. An X-marhine .&of type @ is simply a @-automaton (Q, I , T ) . Here @ is viewed as an abstract alphabet. Since @ may be infinite, we must remember that, in accordance with the remark made at the end of VII,5, a @-automaton is a @,-automaton for some finite subset of @. This ensures that .Ahas a finite number of edges, despite the infinite number of available labels. T h e distinction between an automaton and a machine lies in the definition of the behavior. This shows up first when we define the label of a path. Let r:
PI
40-
ql.
c”2
P’n d
4 1 1
be a path in A of length n 2 1. While in an automaton the label I c 1 of c is the “formal product” or “word” q, . . . p,! treated as element of the free monoid @* with base @, in a machine the label 1 c 1 is the composi-
266
1. Basic Definitions
267
tion cy, . . . cy,, viewed as a relation
X +X .
Thus
Consistent with this, the trivial path 1,: q -+ q of length zero, will have as its label the identity transformation 1,: X + X. T h e behavior of /G is the relation 1 . A q :
x-x
defined as
Id1=
u
I C I
with the union extending over all the successful paths c in .A’. I n addition to X and @ two other sets Y and Z and relations
called the input code and the output code will be given. T h e composite relation
will be called the relation computed by A‘ (using the given input and output codes (I and w ) . Before proceeding any further with more definitions, we shall describe a general class of esamples which are quitc typical for what will actually take place later. We let Y = P, Z = P,where .Y (input alphabet) and (output alphabet) are finite alphabets. T h u s relations f: L’*+ will be computed. T h e set X w i l l have the form
r
r*
where M is a monoid referred to usually as “storage” or “memory.” I n practice M will usually be a product R,* x . , . x Rr* where Q, , . . . , Qt. are finite alphabets; in this case we shall say that A has r 2 registers of which one (the last one) is the input register, one (the first one) is the output register, and the intermediate Y registers are memory registers. T h e input and output codes
+
X. Machines
268
may be defined by SIT
(g,m,s)w
=
=
(1, 1, s) if m = l , otherwise
{$
s=l
With X , Y , 2, 01 and o fixed, the class of relations Y + 2 computed by (1.1 ) will depend upon the type @ and may be denoted by Comp( a). In general, the larger @, is the larger Comp(@). Given two such types @, CD', we shall write @I
<@
if each relation y ' : X + X in @' is the composition p' = pl . . . pn, n > 0, of relations ql,. . . , y n in @. If A' is an X-machine of type @', then each edge v'
P-4 in A' may be replaced by edges
where r l , . . . , r,2p1are new states. There results an X-machine A of type @ such that 1 A' I = I A 1 . Thus also f p = fd.We have thus proved :
If
PROPOSITION 1.1.
-
If CD' < @ and CD < alent and write CD COROLLARY 1.2.
@I,
@'
< @, then Camp(@')
I
c Camp(@)
then we say that the types @ and dj' are equiv-
@I.
If @
-
@I,
then Camp(@')
=
Comp(@)
I
T h e discussion above was geared to the computation of relations f: + 2. If we wish to compute subsets of Y , then we set 2 = 1 (or better: 2 = T* with r = 0, i.e., have an empty output alphabet). T h e relation f: Y --t 1 may then be identified with the subset A = If-' of Y. SimiIarly the output code 0 : X + 1 may be identified with the subset
Y
x<,, = 1
(1J-l
of X (called the terminal subset). I f f : Y -+ 2 is the composition
Y 2 X J f L X L l
1. Basic Definitions
269
is the subset of Y computed by the X-machine .AHwith X, as terminal subset. Intuitively one should think about @ as a collection of components or devices each available in an unlimited supply and each capable of performing some (usually relatively simple) function. T h e machine &?’is then a “hook-up” of a finite number of such components. T h e input code u prescribes how the data given are fed into the machine, while the output code (0 prescribes the way of reading the results once the machine has completed a task. T h e terms “program” and “flow chart” are sometimes used to describe what we call “machine.” I n the discussion above no mention was made of multiplicity or ambiguity. This means that we silently assumed the semiring K = sgas ground semiring. However, all can be done with K an arbitrary (nontrivial, commutative) complete semiring. T h e relations y E @, a, and (0 will then be assumed to be K-relations and &?will be a K-@-automaton. T h e relation 1 A‘ I : X + X is then a K-relation and so is f / : Y + 2. I n (1.2), X, and A are K-subsets. Actually we shall be interested only in the cases K = 9 9 and K = *F. In the latter case it still will be assumed that the X-machines A?‘ = (Q, I , T ) are unambiguous, i.e., that I and T are unambiguous subsets of Q and that the set of edges E is an unambiguous finite subset of Q x @ x Q. However, in view of Theorem VI, 9.1 and its proof, we shall be free to admit X-machines in which I , T , and E are finite .F-subsets, because such X-machines can be replaced by unambiguous ones with the same behavior. T h e relations y E @, u, and w will be permitted to be ./+’--relations, however with rare exceptions they will be unambiguous. I n this case the multiplicities encountered in the relation f4 will genuinely reflect the multiplicity resulting from the computation. T h e following definition should explain this point. Suppose that z E y f x or equivalently ( y , z ) belongs to graph of fd (viewed as a 9 - s u b s e t of YxZ). This means that in the machine A?‘ there exists a successful path
X. Machines
270 such that
x
E
y(a93, *
. . pJ7w)
Consequently there exists a scquencc xg,
such that for 0
. . . , X,[ E
X
yu,
x,E xL&I'p,,
z E
X,,rI)
T h e pair consisting of the path c and the sequence (xo,. . . , x J l )with n = 11 c 1 will be called a computation for the pair ( y , z ) on the machine -H. For a fixed ( y , z ) there may be several (possibly an infinity) of such computations. Their number is exactly the multiplicity with which ( y , x) appears in the graph of f g when regarded as an . F-subset. Equivalently when f d is regarded as a !/-relation, then the element x( y f a ) E will be the number of computations on #for the pair ( y , x). An important special case to keep in mind is when @ contains only partial functions and CI and (0 also are partial functions. In this case, the path c and the element y E Y uniquely determine x,,, . . . , x, E X and x E 2 if they exist. T h u s a I c I (0 is a partial function and I
I
I
(1.3)
z = y("
IcI
0))
T h e multiplicity z ( y f a ) will thus be simply the number of successful paths c in J? satisfying (1.3). Numerous examples discussed later in this chapter will further illuminate these ideas. EXERCISE 1.1. Let K be a complete semiring and X a set. Convert the set Relic A' of all relations X + X with composition as multiplication into a complete semiring. Given any subset CD of Rel, X , let @* be the free monoid generated by @ (as contrasted with a submonoid of Rel, X ) . Show that there is a unique morphism of complete semirings y : KO'
+ RelK X
such that py = p f o r E @. Show that if K is commutative, K"" and Rel, X may be regarded as complete K-algebras and y is a morphism of complete K-algebras. Consequently y also is a morphism of K+--algebras if KID*and RelK X are regarded as such.
2. Automata as Machines
271
EXERCISE 1.2. With the notation of Exercise 1.1, let &' be a K-@automaton which dejnes the ,Ti-machine J6of type 0. Show that
1-41= I
IY
Jlf
Deduce, using Kleene's Theorem, that the set of all behaviors of K-Xmachines is the closure 6 of the subset @ of the K f -algebra Rel, X . 2. Automata as Machines
Let S be an alphabet which may be infinite and let ,d=(Q, I , T ) be a (unambiguous) Z-automaton. W e recall that A?' is the Z,-automaton for some finite subalphabet C, of 2. T o consider such an automaton as a machine we make the following definitions:
x=y=/,p (2.1)
a : 2"
+ 2"
the identity function
x, = 1 E 2" T h e type 0 is given by
L;'
I
(T
E
2
where L;': 2* + 2" is the partial function defined by sL;' = CIS. We may now construct an X-machine k o f type @ as follows. T h e sets Q, I , T remain unchanged but each edge
p-2q
in S '
I,,'
in JY
is replaced by an edge
p-q
T h u s k is obtained from d by "relabeling." For each path c : p + q in d let c' : p + q be the corresponding path in A? If ICI
=
(rl
...
(Tn
is the label of c, then c' has the label
I c' 1
=
L,; . . . L,;
=
L,{
Consequently summing over all the successful paths we obtain
I A1 = L&,: 2* + 2"
272
X. Machines
Since X , = 1 and CI is the identity it follows that 1 I of 2* computed by LA. Thus we obtain the fact that:
is the subset
ifc computes the subset I d I of Z*.
(2.2)
This shows that consideration of 2-automata and of machines of the type described above leads to the same class of subsets of Z* namely to the class Rat, Z*. All the above transfers without any change to the generalized M automata (see VI1,lO) for any monoid M . We only need to replace 2* by M in (2.1). T h e type is
L,’
mE
M
The class of subsets computed by machines of this type is R a t F M . This follows from Theorem VI1,lO.l. If M is a locally finite monoid and if the type is
then the class RatLvM is obtained. This follows from Theorem VII,IO.2. Thus the exclusion of unit edges (i.e., edges with identity labels) is responsible for the resulting sets being non-singular. 3. Transducers and Rational Relations
We shall now consider rational relations f: S + T where S and T are monoids. T h e following choices are made
Y=S,
X=TxS,
a: S -+. T X S,
(3.1) OJ:
TxS
+
T,
( t , 1)w
=
t,
Z=T
~a = (1, S)
( t , s)m
=
0
if
sf 1
Various types @ will be considered, but regardless of the type, the
273
3. Transducers and Rational Relations
machines with X, Y , 2, a, co as above will be referred to as transducers, T h e reason for choosing X = T x S rather than S x T will be explained later. A transducer -k' of any type will compute a relation
f: S - T that is the composition I. *I SL TXST
ST ~
X
At the start we consider the type
R,xL,'
(3.2)
1
t E T, S E S
With each transducer d? of this type we associate the generalized S x Tautomaton &' by replacing each label of an edge
T h e passage from ..&? to procedure.
&'
and vice versa will be called the replacement
PROPOSITION 3.1. If -29 results from .X by the replacement procedure = a I A I w is the relation S + T computed by A, then the graph
and i f f off is
#f=I&l
(3.3) Proof,
Let
c : go
(81.11)
gl-
(82. ( 8 )
...
- (8n-1,tn-1)
(8n.h)
4n-1
9n
be a successful path in -c9 and let c' be the corresponding (also successful) path in M. T h e label of c is IcI=(s,t),
while the label of c' is
s=s,
. . . s,,
t = t l...tn
X. Machines
274 T h u s the relation
s".
TXS-
u(a I c'
I 0)) =
lC'l
satisfies
T
TXS-
{b
if if
u=s u f s
and thus #(a
I c' 1
(0)
=
(s, t ) = I c
1
Formula (3.3) now follows by summing over all successful paths THEOREM 3.2. A relation
f: S
computed by a T XS-transducer
---f
1
T is rational ;f and only ;f it is
of type (3.2).
.A?
Proof. Assume that f is rational and let A = #f be its graph. Then A is a rational !'-subset of S X T and by Theorem VI1,lO.l we have A = I ,W' I for some generalized S X T-automaton with labels in S XT. Let /i/ be the T XS transducer obtained from d by the replacement procedure. T h e n by Proposition 3.1 #(a
1 L//Y I
(1))
=
I ,dI
=
A
=
#f
T h u s f = a I A I (11. Conversely given .Asuch that f = a I -&I w, the generalized automaton ,W' is defined by the replacement procedure. Then I -3I = # f so that f is rational I W e shall use the letter I to denote the identity function S + S or T --t T. It will be clear from the context which of them is intended. COROLLARY 3.3. A relation f: S + T is rational ;f and only $ it is computed by a T x S-transducer of type
R , x I , IxL;',
IxI
SES, t E T
COROLLARY 3.4. A relation f: X* + P is rational (f and only ;f it is cornputed by a 1'" x 2"-transducer of type
Both corollaries follow from Theorem 3.2 and Corollary 1.2, since type (3.2) is equivalent with the types listed above I
3 . Transducers and Rational Relations
275
THEOREM 3.5. 1,et S mid T he loctrlly finite nionoids. .-I relation f : S 4 7’ is rcrtion~lmid non-siugiilw i f nrid only if it is ronipiited by N 7‘ Stratisdiicer of t j p e
.:
R,XL;‘
(.s, t ) E s x 71, (.s, t )
(1, 1 )
Proof. T h e theorem follows from ‘I’heorcni VlI,lO.2 in the same way as I heoreni 3.2 follo\vs from ‘l’heorem VI1,lO.l I I
,
As beforc we have: COROLLARY 3.6. Let S and T he lo call^^ jinite moiioids. A relntion f : S + 7’ is rationd and noti-singulrir if trrid only ;f it is conipiited by a T x S-traizsducer of type
COROLLARY 3.7. A rekition f : L’* + IT*is rntionnl and mn-singulor ;f and otilv ;f it is computed l1-y N 1’” Y Y*-trmsdiicer of type
R,,Y I ,
I\; La1
I
\Ve now show the reason why we chosc S = Ti.: S rather than S Y T . Assume S = Y, T l’*.An edge p + q with label I X 1,;’ acting on a pair ( t , s) E I’*xL‘* u d l yield zero if s docs not begin with 0.If s : os’, then it will give ( t , s’). If thc edge has the label Kj,xI , then ( t , s) is transformcd into ( t y , s). T h u s in both cases thc change to which ( t , s) is subjected is “local” in the sense that it takes place to the immediate left o r the irnrnediate right of the comma. If w e took S: . S X 7’ t h e pair (s, t ) would be modified at one of the two estreniities. I n discussing rational relationsf: 9+ P, one can harmlessly admit V a n d / o r I’ to be infinite. Indeed, sincc #f is a rational . f’lsubset of ”+ x P, it follous readily from Proposition V I I,2.6 (or even better from Esercise V11,2.4) that # f is a subset of \-,*>’f’,* with Y, and I’, finite subsets of L’ a n d I’, respectively. ~
I
EXERCISE 3.1. In the situation of Theorem 3.2, show that the inverse relation f -I : ‘I‘-+ S is conipiited hy tfie S < T-transducer N - I obtainedfrom // by reziersing the direction of all the edges, repliring all labels R , Y L;’ by R, x L;I, mid interchanging the roles of the initial and terminal sets.
X. Machines
276 4. Accelerated Transducers THEOREM 4.1.
For any relation f : Z"
+
r" the following properties
are equivalent : (i) f is rational and length-preserving. (ii) f is computed by a F" x 2:"-transducer A! of type
RYXLi1, I X I y € r , f J € Z Further f is non-singular if and only if
may be chosen of type
-
Proof, (i) (ii). Let A = #f be the graph off. Since f is lengthpreserving A may be viewed as a subset of the submonoid ( Z X ~ )of" Z " x r " . By Theorem IX,6.1, since A is a rational subset of Z * X P it is also a rational subset of ( C x r ) " . Thus by Corollary VII,10.4, A is the behavior of a generalized ( Z ~ r ) " - a u t o m a t o n d with labels in Z x T u (1, 1). Thus the replacement procedure yields the transducer d of type (4.1). If, further, f is non-singular, then A is a nonsingular Then the automaton d can be chosen and rational subset of (L'xT)*. with labels in Z x I' and thus &will be of type (4.2). (ii) 2 (i). That f is rational follows from Theorem 3.2. If c is a successful path in A,then its label must have the form I c 1 = R,x L;' with 1 g I = I s I. Thus the relation a I c I w is length-preserving. Consequently f = a I dl w also is length-preserving. If, further, has no unit edges, then we also have I/ c I/ = I g 1 = I s I. Consequently, for a given pair ( g , s), there is only a finite number of successful paths with label t , x L;l. Thus f is non-singular
A transducer A! of type (4.2) is called accelerated because the length of any successful path computing sf is of length I s I. One also uses the phrase that A?' "operates in real time." For the next type of transducer we need thex-relation
R,: defined for any -4'-subset
r*+r*
D of F* by setting gRD
=g D
4. Accelerated Transducers
277
THEOREM 4.2. For any relation f: L'" ru; satisjying If some k E N the following properties are equiualent : --f
=
k1 f o r
(i) f is rational. (ii) f is computed by a I'" x 2"-transducer A? of type
(4.3) Further f is non-singular ;f and only ;f -P can be chosen so that all the sets D occuring in its labels are non-singular.
Proof. (i) a (ii). Without loss we may assume that If f admits a factorization Theorem IX,5.1,
=
0.By
where 1 is a non-singular length-preserving rational relation and h is a rational substitution, which may be chosen to be non-singular i f f is non-singular. By Theorem 4.1, 1 is computed by a Q* x Z"-transducer A'of type R,x L;' with w E Q, G E Z. Replacing each label R,x L;' by R,,x L;' we obtain the desired P x Z*-transducer Jfcomputing lh = f. (ii) (i). For each D occurring in a label of the transducer ..&choose a letter and let Q be the finite alphabet thus obtained. Let h : Q" + be the substitution wI,h = D. Let -A?' be the Q* x P-transducer obtained from ddby replacing each label Rr,x L;' by RUD x L;'. By Theorem 4.1, the transducer computes a non-singular rational length-preserving relation 1: Z+4P . T h e equation lh =f is clear. Thusf is rational. If, further, the sets D are non-singular, then h is non-singular and so is f = lh, since sl is finite for every s E Z* I
-
r*
THEOREM 4.3. For any relation f: 2" + r* the following conditions are equivalent : (i)
f is rational, If = kl for some k E N and card(sf) < 00 f o r all s E Z".
(ii) f is computed by a
(4.4)
I'" x P-transducer
R,X L;'
g
E
A? of type
r*, a E Z
278
X. Machines
(i) 3 (ii). By Theorem 4.2, f is computed by a Z'* x 9of type (4.3). Edges with labels R x L;' may be omitted transducer and A may be assumed to bc trim. Let c be a successful path in .Iof length n > 0. T h e label I c I of c has then the form K,,x L;' where D = D , . . . D,,are the sets occuring on the successive edges of c and s E L'", I s 1 = n. T h e n Proof.
s((x
1 c I tt))
D
Since card(sf) 00 it follows that D is finite, and thus the sets D,, . . . , are finite. Since -4 is trim, each edge appears in a successful path and thus all the sets D occurring in the labels of -4 are finite. Consider an edge y ,
-P
RnxL,,'
4
and let I,
D
=
n , E N , g , E r*
2 n,gL, ,=1
'The edge may separate into k edges
-P
n&,xLiL
4
We thus obtain a transducer of the required type but in which the edges may have finite multiplicity. T h e procedure of Theorem VI,9.1 can now be applied to obtain an unambiguous transducer. (ii) 3 (i). T h a t f is rational follows from Theorern 3.2. For each s E C* a successful path c with label R, x L;' must have length 1 s 1 and thus there can be only a finite number of such paths. T h u s sf is finite. Further, if s = 1, then necessarily g = 1 and thus If is an integer multiple of l I As an application of Theorem 4.2 we prove an iteration property for rational relations, that is somewhat different than that stated in Proposition IX,9.1. PROPOSITION 4.4. Let A be a rational .%'-subset of Z* x exists then an integer n > 0 such that if
( s , g )E A ,
Is
I Ln
then s and g have factorizations s = U,WlVI,
g
=
u,w,v,
r*.There
5. Positive Rational Relations and Transducers
279
such that
f 1 ( z L , w , ~ vupwaPv2) ,, E A f o r all k 2 0 WI
Further w , can be chosen to be a subsegment of any segment of s of length n. In particular, I w , I 5 n. Proof. Let f : S" + T* be the rational relation with A as its graph. Without loss, we may assume that If = g.By Theorem 4.2, f is computed by a x Y"-transducer A of type
r"
I
H,,x La1 D
E
Rat P ,
(T
E
2.
Let n be the number of states of A. I x t (s, g) E A , I s I 2 n and let s' be any segment of s of length n. Since g E sf there is a successful path c in A with label R,,x L;' and with g E D. T h e length of c is precisely I s I and further the segment s' of s determines a segment of c' of length n. It follows that c' must contain a loop. T h e rest of the argument is clear I
Given a finite alphabet L, define the augmented alphabet 2 = 1 v ci where 6 is a letter not in 1.Denote by ?I: 2% 2* the jine morphism given by rin = 1 and cin = (T for G E 2. Show that every rational relation f : Z* + P admits factorizations EXERCISE 4.1.
---f
p h 5%
-z* 2 n-1
L+ p* >I'"
ri nl_ 2"
h
I'"
,,
111
I;"
p
where f ' , f " , f " ' are non-singular rational relations and f " ' is lengthpreserving. [Hint: Use the new letters to eliminate undesirable labels from the transducer ~i of Theorem 3.2.1 5. Positive Rational Relations and Transducers THEOREM 5.1.
For any relation f : Ex +
r* the following
conditions
are equivalent : (i)
and If -I is ajinite multiple f is rational, gf -I isjinite for each g E P, of 1.
X. Machines
280 (ii)
f is computed by a
r*x P-transducer R,XL;'
S E
of type
z*,g E r+
r*x P-transducer
(iii) f is computed by a
R,XL;~
I
(iv) f is the composition
SEz*, y E r
-sz*
z*--+on. O R h-1
(v)
of type
1
-+
r*
where Sz is a j n i t e alphabet, R is a non-singular rational subset of Sz", h : Q* + Z* is a morphism, and I: Sz* + l'* is a very$ne morphism. f is the composition
z+=sz*-r* m
where m is a rational non-singular length-preserving relation and h : 9" -+ Z* is a morphism. (vi) f is rational and non-singular, and there exists an integer k > 0 such that g(sf ) > 0 implies I s 1 'klgl
Proof. (i) (ii). Condition (i) implies that f is non-singular. Since f is rational and non-singular it follows from Corollary 3.7 that f is computed by a transducer A' = (Q, I , T ) of type R, x I , I x Lzl. Since If is
a finite multiple of 1, we may assume without any loss of generality that If = @, i.e., that I n T = 0. By Proposition VI,6.3, the machine d may be normalized so that I = i, T = t , and no edges issue from t or enter i. Also superfluous states can be removed so that .I may be assumed to be trim. Let n be the number of states of .k.We assert:
(5.1)
Each path in R,x r.
A of length 2 n has at least one edge with label
Indeed, suppose that a path of length 2 n exists without labels R,x I. Since this path has repeated vertices, we obtain a path C
4-4 with label I x L;I,
s E
Zf. Since A? is trim this path may be completed
5. Positive Rational Relations and Transducers
281
to a successful path .
a
r
Z-q-q----rt
b
Let the labels of a and b be R, x L;' and R,, x L;l. T h e successful paths ac'b, i 2 0 show that (gh)f-' is infinite, contrary to (i). T h i s proves (5.1). Every successful path in & may be factored uniquely into
with c l , . . . , cp of length n and d of length 5 n. A transducer .&of the type required in (ii) is now constructed. T h e states, initial states and terminal states, of .&are the same as those of A? Let p and q be states and let g E T+,s E S", I g I I s I = n. I,et k be the number of paths
+
c: p + q
with labels I c
I
=
in ,I
R, x L;'. If k > 0, then we create the edge kR, x I.;'
p-q
in
.d
If q
=
t is terminal, we have additional edges obtained by allowing
p
=
i and q = t , additional edges are obtained by allowing
If
I g l + I s 1 .=n
--
There results a transducer .,&of type (ii) (with multiple edges). I t is clear that I .XI = I k l. (ii) (iii). This follows from Corollary 1.2. (iii) (iv). For each label R, x L;' occurring in .A?introduce a letter w of a finite alphabet 0.Replacing the label R,x L;' by Q we obtain an 0-automaton whose behavior is a non-singular rational set R. Consider the morphisms
defined by wh = s, wl = y. T h e n the graph o f f is R(h, 1) and therefore (Lemma IX,2.l) f is the composition k ' ( n R ) l as required.
282
X. Machines
-
(iv) (v). I t suffices to define m = ( n R ) l . (v) = (vi). T o show that f is non-singular, it suffices to show that g f -I is finite for each g E l'*. Since gf - l = (gm-')h it suffices to show that gm-' is finite. This is clear since m is non-singular and lengthpreserving. Next define k >: 0 so that I ruh I 5 k for each (I) E 9. T h e n 1 o ~ hI 5 k I OJ I for all (11 E 9. Since m is length-preserving the inequality required by (vi) follows. (vi) (i). Obvious I Relations satisfying conditions (i)-(vi) of Theorem 5.1 will be called positive rational. Using condition (i), the following properties of positive rational relations are easily obtained. PROPOSITION 5.2. A morphism Z* 4 I'* where X i s a .finite alphabet, is a positive rational relation if and only if it is locally finite I
I*, where PROPOSITION 5.3. For each morphism h : 1'" jinite alphabet, 12-1 is a positive rational relation I --f
r
is a
PROPOSITION 5.4. For each non-singular rational subset R of Z* the 4 I * is positive rational I
relation OR: S*
PROPOSITION 5.5.
is positive rational
The composition of two positive rational relations
I
-
PROPOSITION 5.6. Zf f : S* T* is a positive rational relation, then for any non-singular subset A of P,Af is a non-singular subset of I'" I
6. Two-way Automata
T h e discussion is restricted to .%subsets (i.e., multiplicities are ignored). Let S be a finite alphabet. Define
6 . Two-way Automata
283
just as for 9x S+-transducers. T h e type is
R;’~L,, I X I
R,,XL;~,
I aEz.
Observe that if c: p + q is a path in a machine either above, then for each (s, t ) E 3 x 1+ ($9
t)I c
I
=
of the type described
.3
or (s, t ) I c
I
=
with
(s’, t ’ )
st
=
s’t’
Such a machine will be called a two-way automaton. It is convenient to adopt the following phraseology. Call st the “input” and call the integer I s I the “position of the reading head,” i.e., the position of the comma. Then during a computation the input does not change but the reading head may move in either direction (or remain stationary). T h e definitions of u and r o show that a successful computation begins with the reading head in the leftmost position and ends with the reading head in the rightmost position. If c: i + t is a successful path, then the partial function u I c 1 t o : S*
+
z+
satisfies s(u
I c I).C
=
{&
if (1, s) I c 1 otherwise
= (s,
1)
Consequently the partial function
also satisfies s(u
I dd I
to) =
If A is the domain of A = {s I (1,
s)
if (1, s) I c otherwise
{
CI
1 = (s, 1) for
some c
I ,,,dto, l then
IcI
=
(s, 1 )
for some successful path c}
We then say that ‘4 is the set computed by the two-way automaton k. A successful path c such that (1, s) 1 c I = (s, 1) is called a computation for s. -4n ordinary 1-automaton d =(Q, I , 7’)may be converted into a two-way automaton d by replacing each label cr by the label R,x L i l .
X. Machines
284
Thus in A?’the reading head moves only to the right. This justifies the term “two-way automaton” as opposed to “one-way automaton.” I t is clear that A? above computes the set 1 d I. The objective here is to prove the converse. Let A= (Q, I , T ) be a two-way automaton computing the set A c 2”.Then: T H E O R E M 6.1.
has cardinality 5 2m‘m+1), where (6.1) The family of sets {s+A I s E P } m = card Q.
(6.2) There exists an effective procedure which for each s E 2* decides whether s E: A or not. Combining this with Theorem III,8.3 we obtain: C O R O L L A R Y 6.2. The set A is recognizable and the minimal Zautomaton dAmay effectively be constructed. I t will have at most 2m(m+l) states I
We begin the proof with : LEMMA 6.3.
Every path e : i -+ t such that ( 1 , su) I e
I = (su, 1 ) admits
a decomposition
(6.31
e
=
a: i+pl,
d:
Pntl
+t,
ab,c,
. . . bnc,d (1,
s)
Ia I
= (s, 1)
( 1 , u ) I d I = (u, 1 )
Conversely for any product (6.3) satisfying (6.4) the equality ( 1 , su) I e = (SU,1 ) holds.
1
Proof. Let k = I s I. The proof is obtained by watching the position of the reading head and noting when it crosses k. Thus a is defined as the largest initial segment of e such that during the computation given by a the reading head remains in positions 5 k . Thus (s, u ) = (1, su) I a I, but since the reading head is always in a position 5 k , the word u plays no role in the computation and thus (s, 1) = ( I , s ) I a I. Let e = ae’. Then (s, u ) I e‘ I = (su, 1). Two possibilities may now take place. If the
6. Two-way Automata
285
reading head remains now in positions 2 k, then we set e' = d and have (1, u ) I d I = ( u , 1). If the reading head during the computation given k, then we denote by b, the largest by e' ever returns to a position initial segment of e' such that during the computation given by b, the reading head is in positions 2 k. Then (s, u ) I b, I = (s, u ) and (1, u ) 1 b, I = (1, u ) . T h e continuation of the argument is clear. T h e converse part of the lemma is obvious. We are now ready to establish the inequality
.:
For each s E
L'* define the relation sp: Q - Q
and the subset se
=Q
as
I = (1, s) for some path c : p q } { q I (1, s) I c I = (s, 1) for some path c: i + q with i E I }
p ( s p ) = { q I (1, s) I c sp
=
4
T h e total number of possible pairs (sp, sg) being 27n(m+1), formula (6.5) is proved if we show (6.6)
sp
=
t p and
se = tp
imply
srlA
=
t-'A.
Indeed assume u E srlA, i.e., su E A. Let e : i + t be a successful path such that (1, su) I e 1 = (su, 1) and consider the decomposition of e as given in Lemma 6.3. Since sp = t p the path a : i + p l may be replaced by a path a': i' -PI such that (1, t ) 1 a' 1 = ( t , 1). Since sq = tp for each of the paths c j : qj -pj+, there exists a path c j r :qj + p j , such that ( t , 1) I cj' I = ( t , 1). Consequently the path e = a'blc,' . . . b,,c,'d satisfies the conditions of Lemma 6.3 with s replaced by t. Therefore (1, t u ) I e' I = (tu, 1) and thus tu E A , i.e., u E t-'A. This proves (6.6), and with it (6.5). T h e proof of (6.2) follows from: LEMMA 6.4.
Each s E A is calculated by a successful path c such that
X. Machines
286
Let c: i t be a successful path in , I such that (1, s) I c I 1) and assume that 1) c 1) > m(l s 1 1). For each 0 C j 5 II c /I decompose c into Proof.
--f
+
= (s,
.
"I
bj
11
qJ A t 7
A
11 = j
' J
Then
(l, ') I ' J I ($I>
1,)
=
('JY
I 6, I =
($9
t))
1)
s = S,tJ
Consider the pairs (I sJ 1, qJ) for 0 5 j 5 I/ c a repetition must occur and thus we have
(1
'J
1,
9,) =
(1
'1
11. Since I/ c II > m(I s I
+ 1)
1, q k )
for some 0 c j < k 5 11 c 11. Since both sj and sk are initial segments of s, it follows that sj = sk and consequently also t j = t k . Thus we see that
.
al
z * qj
=
qk
-
is a shorter successful path calculating s
bt
t
1
7. Other Machines
We shall rapidly list a number of important types of machines. Most of these will be studied in Volumes C and D. This section is mainly addressed to the reader who has already encountered some of these machines presented in a different manner. A rapid preview might serve to eliminate terminological and notational misunderstandings.
A. Push-down
Let
automata:
I (7.1)
XL,'
a € _r
R ~ X I?
RY'xI y
E . r
E
I'
287
7. Other Machines
Using either the terminal set X,,, or X,,, the machines of this type compute the class of contest-free languages in V". T h e register T* plays the role of a memory (push-down store) and the class of sets computed is independent of T as long as card T > 1. If card I' = 1, then a smaller class of sets, called counter languages is obtained. In an accelerated push-down automaton the type is replaced by
(7.2)
R,R;~x L;'
(T
E
s,
u,
E
r*
This type computes the non-singular context-free languages in C*. If to the type (7.1) we adjoin I x L , , we obtain machines of the same strength as Turing machines. They will compute all the recursively enumerable subsets of S". T h e same phenomenon takes place if we adjoin a second push-down register, i.e., set X = I'* x r*x C", with a, X,", and the type suitably modified. B . Stack automata: We define the partial function
E: 1'*4T*,
1E= 1,
8
gE=
if g f l
This partial function "checks" whether the register Now consider
I'* is "empty."
x =rvr*xz*
*,'
a:
3 X )
sc;l = (1,
1, s)
x, = r * x x * x 1 T h e type is given by
I x I x L;'
R, x L;' x I
R,xExI
R;I x L, x I
R;'xExI
T h e third register L'* is the input register. On the input register only reading and erasing is permitted. T h e first two registers jointly (i.e., I'*xI'*) are called the stack; an element ( g , h ) of the stack may be viewed as a single element gh E r" equipped with a pointer. The second and third partial functions in the type allow this pointer to move to the right or to the left. T h e last two rules permit erasing and printing on the right of the stack, but only if the pointer is in the utmost right position (this is the role of E ) . We described a one-way stack automaton. In a two-way stack automaton 2" is replaced by L'* x 3 exactly as when passing from a ,'-automaton to a two-way V-automaton (see Section 6).
X. Machines
288
C. Turing machines (one of many possible models):
Let
x = Z"xZ+ a: Z"+X,
X,
sa= ( 1 , s ) =
(1, 1)
T h e type is given by
R,x I , RilxI,
I x L, I x L;'
for u E Z. Machines of this type compute all the recursively enumerable subsets of 2". T h e list of examples could be continued indefinitely.
8. Deterministic Machines
T h e aim of defining deterministic machines is to compute partial functions rather than relations. I n the case of machines with an accepting set (instead of an output code), the aim is to compute unambiguous sets. The following preliminary conditions are assumed : (8.1)
All elements p: X --t X of the type @ are partial functions.
(8.2) a : Y + X is a partial function. (8.3) w : X + 2 is a partial function. Note that condition (8.3) is automatically satisfied if an (unambiguous) accepting subset X , of X is given, as then Z is a single point and w is the unique partial function X + 2 with domain X,,,. A machine A = (Q, I , T ) of type @ is called deterministic if it satisfies the following two conditions:
(8.4) card I < 1. (8.5) If p p12
-
=
Vl
q1 and
p
2 q2 are distinct edges, then Dom p 1 n Dom
0.
These conditions will frequently (but not always) ensure that
f = a I 4I o is a partial function. However we have:
289
8. Deterministic Machines
PROPOSITION 8.1. If R is a deterministic machine in which no nontrivial p a t h connects two terminal states, then -&computes a partial function
f: Y -z.
Conditions (8.1)-(8.3) ensure Proof. Let c be a successful path in
J=
U w l c l co
for all successful paths c, we must show that if c1 and c2 are distinct successful paths, then Dom(cc I c, 1
(0)
n Dom(u
c2 1 m) =
0
For this it suffices to prove that
Since there is at most one initial state, c1 and c2 start at the unique initial state. Because of the condition imposed on A, c1 is not an initial segment of c2 and viceversa. Thus c1 and c2 must decompose as follows
with d , e l , and e2 possibly trivial but with the middle edges distinct. T h u s since is deterministic we have Dom q1 n Dom p2 = 0 and this implies Dom I c, I n Dom I c2 I = 1;7 I Observe that if, under the same conditions, an accepting set X , is given is instead of an output code, then the subset A of Y computed by unambiguous since A = Dom(a I I ( 1 ) ) and (u is a partial function with domain X a o . Also note that if the condition concerning terminal states stated in Proposition 8.1 holds, then the behavior I d l remains unaltered if all edges t 4q, with t a terminal state, are removed. Once this is done all the terminal states may be merged thus creating a single terminal state with no edges issuing from it. We shall now survey the various types of machines considered in Sections 2-6 to see what the deterministic conditions mean in each case.
X. Machines
290 We first look at the type
considered in Section 2 in conjunction with 2-automata. T h e preliminary conditions (8.1)-(8.3) are met. Further the condition Dom I,;: n Dom L;:
=
0
is equivalent to ul f u2. Thus condition (8.5) simply asserts in the corresponding automaton two distinct edges issuing from the same state carry distinct labels. Thus we find that a machine . d is deterministic iff the corresponding Z-automaton is deterministic. For generalized S-automata mentioned in Section 2 and the corresponding type CD given by the relations L;l, s E S, the preliminary condition (8.1) is not satisfied unless left cancellation holds in S (as for instance in the case S = Z * XP). We let the reader analyze what “deterministic” means in this case. T h e same difficulty concerning cancellation applies to the type R,x L;’ with t E T,s E S. Next we discuss the r xx I*-transducers considered in Theorem 3.3. T h e type is
R , , x I , IxL,’,
IxI y g r , ~ E Z .
Condition (8.5) for a transducer &then asserts that each state p in falls into one of the following three classes: (i) (ii) (iii)
,A
A single edge issues from p and its label is I x I . A single edge issues from p and its label is R,x I . All edges (if any) issuing from p have labels of the form I X L;’ with distinct u. Thus the number of edges issuing from p does not exceed the cardinality of X.
T h e above conditions arc not sufficient to ensure that partial function. Indeed in the machine . IxL;’ -2-
p
.A’ computes
a
-RYxI
t,
R,xl
t, +
J
computes the relation cf = { y , y 2 } . A reasonable additional condition to impose upon a deterministic
291
8. Deter rni n isti c Machines
transducer of the above type is to require that all terminal states are of type (iii). This will ensure that . /?' computes a partial function. Things changc radically when we pass to the type
R,,x L,'
I
y
E
I',
oE S
considered in Theorem 4.1. We note that U v l xI,;: and R y 2 xL;: have disjoint domains iff thcir inputs labels are distinct, i.e., o1 f oZ. T h e output labels y 1 and y a are irrelevant. T h u s if we disregard the output label and replace each edge
-P
/ l y x L,'
9
simply by a
P-9 we obtain a deterministic S-automaton. T h u s -/?' may be viewed as a deterministic Z-automaton with outputs. T h e edges are traditionally written as
If all states are regarded as terminal, these are exactly the sequential machines that will be treated extensively in Chapters XI and XII. T h e transducers considered in Theorem 4.2 with labels R / , x L;' do not meet condition (8.1) since R,, is a relation and not a function unless D is a single element. This brings us to the transducers of Theorem 4.3 of type R,X L;'
gE
r*, G E z
These bchave exactly as transducers of type R, x L;' considered above, except that the outputs instead of being letters in are words in T h e edges are traditionally written as
r
r*.
These transducers (when all states are terminal) are the generalized sequential machines that will be studied in Chapters XI and XII. We leave it to the reader to discuss deterministic two-way automata.
X. Machines
292
EXERCISE 8.1. Let A be a deterministic machine of type @ computing a relation f = cx I A I w : Y 42. Show that there exists a deterministic machine A' such that A' computes a partial function f ' : Y + 2 satisfying
Domf'
=
Dom f
[Hint: Remove some edges from d.] 9. A Conversion Theorem
We shall show that by a suitable enrichment of the set X, the type, and the input code, every machine ~8 can be converted into a deterministic machine A w h i c h computes the same relation Y + 2. We consider an X-machine -.&of type @, with input code a : Y + X and output code o:X 2. We shall assume that @ is composed of partial functions X + X . We shall also assume that A has a single initial state ; this is no real limitation considering the normalization procedure of Proposition VI,6.4. Given such a machine A = (Q, i , T ) , we denote by 0 the set of all edges --+
8: p 2 q of d. We define
a
=XXO"
and consider the type
6 = { P , ~ ~ , q g 8, ~d @ ) , The input and output codes 6:
Y+X,
G:X-+Z
are defined by
ya = y u x O " if t = l (x, t)& = if t # l
{g
We now define a machine .&'of type @ as follows: .&' has the same states, initial state and terminal states, as A?, i.e., A= (Q, i, T ) . T h e edges of d a r e obtained from the edges
9. A Conversion Theorem
293
of A& by replacing the label q by q x L i 1 . Let 6 denote the edge of 2 thus obtained. T h e resulting machine . l i s deterministic. Indeed consider two distinct edges
i = 1,2 Then 8, and 8, are distinct and thus L;,' and L;: have disjoint domains. Consequently ql x L;: and q2x L;: also are partial functions with disjoint domains. We now prove a I AT1 w = d
(9.1)
I
&fq6
Let c be any successful path in d, and let c" be the corresponding successful path in A? Since this establishes a bijection between the successful paths in A?' and those of it suffices to prove
(9.2)
n!lclw=cr'u"lc"l6
We note that
Ic"l
= IClXLL1
Therefore y6 I c" I 6 =
(J* [ ( y a ,t)(l c I x LL')]G t€O
I n order for 6 to give anything f 0, the second coordinate must be 1. Thus we must have tL;' = 1, i.e., t = c. Therefore
ycr' I Z I co thus proving (9.2)
=
( y a I c I, l)6 = y a I c I u
I
T h e result and its proof are a swindle. T h e machine &is made to be deterministic by shifting the burden to the new input code 6. Indeed, cr' is made to "try" or "search" over all paths in .Ato find the right ones. I n particular, if u : Y x i s a partial function, 6: Y R no longer is one. There is another objection against the result above, and that is that the type 6 depends not only on 0 but also on -/Z, since 0 is the set of all edges of A'. This objection can however be removed by the use of a coding 17: 0" 2" --f
--f
--f
X. Machines
294
so that 0" may be replaced by 2*. In order to carry this out the set 0 is enumerated 0 = {O,,, . . . , O,.} and the coding q is defined by (see V,7) Oil/ =
0'1
T h e first temptation is to replace each edge Qi X I J ~ :
P-9 by a path 1x
L,'
P-0
1 x I',;
- 0. ... 0
p i x 1,;'
I
Q
introducing i new states. This procedure will however not give a deterministic automaton, and a slightly more subtle procedure is needed. W e illustrate this by an example. Suppose that exactly three edges issue from the state p as follows
-9% x Lo;
90
P
02
x 1';;
92
with p , go, g2, g5 not necessarily distinct. T h e entire configuration above is then replaced by I x I,;'
P-0
I
9'0
90
x
I x I$
-0-0-0-0
I x I,,;
I
'
I x L;'
I
x L,l
I
01 x 1,;'
92
PI x
L;'
95
with five new states. This process of replacement yields a deterministic machine. Summarizing, we obtain : THEOREM 9.1. Given an X-machine .Iof type @ and input and output codes c1: 1' 4 X , (u: X 4 Z , there exists a deterministic X X 2"machine .A? of type
6 = {IXL,',
pxL;'
I p E @}
References
295
such that (5 I
-48
6 = (1 I
I
OJ
where 6:
Y +sx2*,
y6
= yrxx
(5; x x 2 *
+
z
are given by 2*,
(x,i)6 = xw
I
I n situations in which S is explicitly given (e.g., for Turing machines) it may be possible to replace X X 2” by X through the use of a suitable coding -Yx 2* + X . References
T h e notion of a machine as defined in this chapter seems to be new. T h e closest existing notion is that of a “flow chart” or “flow diagram.” T h e definition presents the advantage of making the entire technique of the theory of automata instantaneously available for the study of machines. Great savings in space were achieved by avoiding the notion of an “instantaneous description” which had to be repeated each time the type was modified. D. Scott, Some definitional suggestions for nutntnnta theory, J . Comput. System Sci. 1 (1967), 187-212.
T h e suggestions made in this paper differ considerably from the methods followed in this text. J. C. Shepherdson, T h e reduction of two-way autnmata to one-way automata, I B M J . Res. Dezielop. 3 (1959), 198-200; reprinted in “Sequential Machines” (E. F. Moore ed.), pp. 92-97. Addison-Wesley, Reading, Massachusetts, 1965.
This paper contains the theorem on two-way automata. T h e proof given in the text is an elaboration of the one indicated by Shepherdson. An earlier (more complicated) proof by Rabin is not well known. S. Eilenberg, C. C. Elgnt, and J. C . Shepherdson, Sets recognized by n-tape automata. J. Algebra 13 (1969), 447464.
This paper is listed for supplementary reading even though it has no direct connection with this chapter.
CHAPTER
XI Sequential Machines
Sequential machines are related to functions as automata are to sets. A (deterministic) Z-automaton computes a subset of P . With sequential machines we begin with two alphabets 2 and r (the input and output alphabets). A sequential machine dt&: Z + r computes a partial function f : Z* 4P . Partial functions obtained this way are called “sequential.” They are the direct analog of recognizable sets. 1. Basic Definitions
Let 2 and I’ be finite alphabets. A sequential machine
A:2-r consists of the following data: (1.1) a Jinite set Q, the set of states, (1.2) an element i E Q, the initial state, (1.3)
a partial function QxZ-Qxr
T h e partial function ( 1 . 3 ) breaks up into two partial functions
296
1. Basic Definitions
297
having a common domain. T h e first of these partial functions, called the next state function, is not given a notation because its value on (q, a) is denoted by qa. We describe it simply by saying that Q is a right 2module. T h e partial function I is called the output. With this notation we write
a
satisfying the usual module identities
Similarly (1.5) yields an extended output
which is a partial function satisfying
for all s, t E P. T h e partial function I of (1.7) is defined inductively as
Then (1.9) is proved by induction with respect to I t I. If I t I = 0, then t = 1 and (1.9) holds trivially. If t = ua, then arguing by induction we have (4, s t ) A = (4, sua)A = (4, su)A(qsu, a)A
as required.
=
(4, s)I(qs, uMqsu, a)A
=
(4, s)I(qs, ua)A
=
(q, s)I(qs, t ) I
XI. Sequential Machines
298
T h e partial function coinputed by function
I
R or
the result of . R is the partial
fs: L" + r*
defined by SJH =
(i,s)A
Clearly
(1.10)
A partial function f:
""+I'"
is said to be sequential iff = J H for some sequential machine kf:2' + T. T h e sequential machine ~ i S: + is said to be complete if (1.3) is a function (rather than a partial function). This is equivalent to assuming that (1.4) and (1.5) are functions. T h u s . R = ( Q , i, A) where Q is a complete right "-module and 1: Q x L' + P is a function. I n this case the extended output (1.7) also is a function. Let us consider the special case when the sequential machine A?'=(Q, i, A) has only one state, i.e., Q = {i}. I n this case the output A may be viewed a s a partial function A: 2 T.T h e partial function Q X .Z + Q is then determined by
r
--f
T h e extended output and the result then coincide and are partial functions a =if:.y + I'* In fact A is a very fine morphism
A; I'* 1'" +
where 1'1 d
-
(01
a€
x,
a n # @}
T h u s a sequential machine d: 2 + 1' may be viewed as a generalization of the notion of a partial function S + Y while a sequential partial functionf: L* + f " is a generalization of a very fine rnorphism S'* I'" where 2' is a subalphabet of L'. Sometimes an initial state of a sequential machine is not specified. We then write M = (Q, A) and this pair is called an output module. T h e ---f
1. Basic Definitions
299
r
notation M : L + is still used. Everything said above for sequential machines still applies to output modules except that the result j,, is not defined until an initial state is singled out. I n fact any state q E Q may be used as an initial state and thus a family
of sequential partial functions is defined. T h e notion of a generaliced sequential machine A: T* + I'" with
A= ((2, i, 2) is obtained from that of a sequential machine by one modification: the partial function Q X 1+ Q Y I' of (1.3) is replaced by a partial function
Q2x s +
I'"
T h u s the output is a partial function
-
r"
is defined as before and is the T h e estended output 2: Q X 1"+ result f [: 1" P. A partial function f : S" + is called a generalized sequential partial function iff = JC[ for some generalized sequential machine A?:Ce P. We leave it to the reader to discuss generalized sequential machines with a single state. A generalized output module Ad: 1"+ r" is defined as before as a generalized sequential machine M = (Q) 1)in which an initial state has not been specified. T h e distinction between output modules and sequential machines is so slight that many authors do not distinguish between them. hlany authors (particularly Russian and German) also use the term "automaton" to designate what we refer to as "output module." T h e connection between automata and sequential machines is very close. A complete discussion will be given in Section 6. T h e sequential machines described here are also called "Mealy machines." A variant of these are the "Moore machines" or state-dependent machines in which the output (q, o)1 depends only on the state qo. We shall have only very limited use for these machines and will discuss them in Section 5.
r*
-
3 00
XI. Sequential Machines
We shall use the abbreviations: s-machine,
cs-machine,
gs-machine,
cgs-machine
sp-function,
s-function,
gsp-function,
gs-function
using the abbreviations: c for complete, p for partial, s for sequential, and g for generalized. EXERCISE 1.I. Show that each sp-function f:2"
+
r*can be extended
to an s-function f ' : 2" + f*.Similarly for gsp-functions. EXERCISE 1.2. Show that the domain of a gsp-function f: 2* + r* is a non-empty recognizable subset A of Z* such that
stEA-sEA
Conversely show that each such set A is the domain of an sp-function. EXERCISE 1.3. Show that i f f : Z* + f* is a gsp-function (resp. an sp-function) and i f A is a subset of L'* satisfying the conditions of Exercise 1.2, then the composition
z*
nA
d
z*
f d
f"
is again a gsp-function (resp. an sp-function). Let A= ( Q , i, A ) : 2" + f* be a gs-machine. Show that i f d i s accessible (i.e., Q = is*) and i f f a is a function, then .Rmust be complete. EXERCISE 1.4.
2. Notation and Interpretation
One should imagine a sequential machine A'
=
( Q , i, A ) : 2 + r
as a mechanical device capable of assuming n = card Q internal states. T h e device has a slot on the right into which letters of the input alphabet 2 will be fed one at a time. On the left there is a slot out of which the letters of the output alphabet f come. If the device is in state q and the input letter (T is fed in, the output letter y = (q, CT)A will be produced
2. N o t a t i o n and Interpretation
3 01
(or printed) and the device will pass into state q a . This is if q a f @. If q a = a1the device will block (or stop). This may be represented by the following two pictures
after
dy
T o calculate the value of s - g with s E L'+ with s = a1 . . . an, the device is started in the initial state i and the inputs u l , . . . , an are successively fed in. We obtain states
z
=
40, . . *
, QnQk
=
Qk-10,
and the outputs Yk =
(qk-1,
for 1 5 k 5 a. Then
sf.# = y1 . . . Y n 0, the device blocks
If, for some k, qkPlak= and s f l / = 13. T h e following two pictures show two consecutive steps in the computation
T h e computation is completed after n steps unless it blocks any time earlier. T h e pictures show how the input word s is read and destroyed from the left while at the same time the output word sf is printed on the right. In the case of a gs-machine the picture is similar except that instead of the output letters y k = ( q k p l ,0)A we have output words u k = (q,+l, o)A. An s-machine d '= (Ql i, A): L'+ r is frequently represented by means of a table for which we give an example
i
XI. Sequential Machines
3 02
I n each square the next state and the output are given. T h i s machine is complete since all the squares are filled. In general some squares may be left blank. W e much prefer the diagram notation using edges. An edge a1 r
P-s is drawn whenever
po
=
q
( p , a)l=
and
I n a gs-machine we may have
( p , o)A = g E 1’” and thus the edge oln
P-s
would be drawn. Let c: p 4q be a path of length n in A? and let
be the succession of labels of c. Setting s = c1 . . . find that ( p ,s)A = g 4 = ps,
g
gJZ,
=
. . . Y , we ~
T h u s the path may symbolically be denoted by XlY
P-s Similarly for gs-machines. If each edge
P - 01s Y is replaced by the edge
-P
H, x I,<;’
4
there results a I’* x 2”-transducer J rof type {R,x L;l}. This transducer is deterministic and satisfies the following two additional conditions :
(2.2)
A‘has
exactly one initial state.
(2.3) All states in d rare terminal.
3 03
2. Notation and Interpretation
Conversely every such transducer is obtained from a unique s-machine. It should bc noted that condition (2.2) must be specified since in a deterministic transducer the set I of initial states satisfies card I < 1 and thus may be empty. T h e significance of condition (2.3) will be discussed in Section 3. We shall now discuss the connection between the result
fa: S" +I'" of -A#', the behavior
computed by Let
A'. c:
-i
SIY
4
be a path in -A#' starting at i. T h e corresponding path c' in A'will then be successful and will have the label R,x Consequently
(u,u ) I c' I
We now note that g = sfs.
This yields
Applying this to the element ua
I n order for
(0
if u = st otherwise
=
=
(1, u ) we obtain
to have a value we must have t
=
1. T h u s we obtain
which shows that the result of the sequential machine A is the partial function computed by the transducer A'. T h e same applies to gs-machines except that the transducer 4' is then of the type {R,xL;'}.
304 EXAMPLE 2.1.
X I . Sequential Machines
Let 2 = {a}, r
d: .Z + r with n states
nl n
i=q,-
nln
ql-
Consider the cs-machine
= {a, r } .
...
al n
4n-1
Then
T he result fd is then (Uk)ff =
(a"-%)W
where
k=pn+r,
O
Thus f replaces each nth letter in ak by r. This cs-machine is called a "mod n counter." EXAMPLE 2.2.
Let C =
given by
r = {a, r } .
Consider the cs-machine 4
C93 TIT
am
i
q
n1.c
This is the diagram description of the sequential machine described by the table (2.1), with {al, a,} = { r l , r 2 } replaced by {a, T}. For each s E z'* let I s I T denote the number of times the letter t appears in s. Then (sf)a if I s I r is even if I s I T is odd = (sf).
("liX
=
{ sf)r { ((sf)a
if if
I s I , is even 1 s IT is odd
Thus whether f n changes the ith letter of s or not depends upon the parity of the number of T'S preceding the ith letter. T h e functionif: 2* + 2Y is bijective. This can be seen by replacing the label a/t by r / a and vice versa. There results a cs-machine A'and f ~is,the inverse of i d (see Exercise 2.1 below). T h e machine A may be used for coding messages. T h e machine A' would then be used for decoding.
2. Notation and Interpretation
EXAMPLE 2.3.
3 05
Let S = {a, b, c } , 1' = {x,y } , and consider the gs-
machine
i
ail:
T h e resulting function f: E+ I'" is bijective. T o see this we record the following two unambiguous rational expressions for E* and +
r*
A comparison of the two expressions shows that f is bijective. L + I' be an accessible s-machine. Show that EXERCISE 2.1. Let .I: Z* + is an injective partial function 18replacing each edge
fd:
r*
:r 2. Show that in this case f t,= 1%. yields an s-machine .kt Show that if further Lk'is complete and fa is injective, then card 2 5 card r.Equality holds iff f is bijective or equivalently i f f .R' is accessible. ---f
EXERCISE 2.2. L e t . 4': 2" 4 r*be an accessible gs-machine such that card L' 5 card I' and that i f :E* + I'* is bijective. Show that &is then an s-machine.
3 06
XI. Sequential Machines
3. Properties of Sequential Functions PROPOSITION 3.1.
Every generalized sequential partial function f is
rational. Proof, This follows from the fact that f is computed by a transducer described at the end of the last section I
-
PROPOSITION 3.2. Every generalized sequential partial function f : \'+
3
I'" is initial segment-preserving, i.e., l f = 1,
for all s, t Proof,
E
(st)f c ( s f ) P
3.
This follows at once from formulas (1.10)
PROPOSITION 3.3.
I
Every sequential partial function is Iength-pre-
serving. Proof.
This follows inductively from (1.10) with t
=
(T
I
For gsp-functions length-preservation is replaced by a Lipschitz condition. PROPOSITION 3.4. For each generalized seqzientinl partial fimction f : I + 3 there exists an integer 0 5 M such that
r+
I (stlfl
-
I sf I -5! t I J4
f o r all s, t E 1"such that (st)f f @. Equivalently
I for all
SO E
(SOlfI -
I+such that (so)f f
I sf I I M
@.
-
Proof. Let .k'= (Q, i, A ) : Z+ I'+ be a gs-machine such that f =f{, Then (s.)f = ( $ ) ( i s , o)n and thus I (so>fI - ! sf1 = ! (is, o)A I
whenever ( s o ) f +
a.T h u s it suffices to take M = sup I (4, u)A I
1
3. Properties of Sequential Functions
3 07
I t will be shown in Section 7 that the conditions of Propositions 3.1-3.3 characterize sequential partial functions. Proposition 3.1, 3.2, and 3.4 do the same for gspf's. Proposition 3.2 contains the reason why in an s-machine (and in a gsmachine) all states are considered terminal. If this is not the case, then f need not be initial segment-preserving. Let
S* j r *
be a gs-machine and let
be morphisms. A new gs-machine
is defined as follows. If ,R = (0,i, A), then h ~ J k= (Q, i, A,), where Q is converted into a right S,-module by
If A? is complete, then so is 1z.d'k. If & is a sequential machine and h and k are very fine morphisms, then h . k k is a sequential machine. If 2, = S and h is the identity, then we may write - L k instead of h Lk. Similarly we write hA' if TI= I' and k is the identity. T h e composition just described is a special case of a more general composition operation that will be defined in X I , % A consequence of the above construction is: PROPOSITION 3.5. I f f : Z* 4 r" is agsp-function and h : Zl* + 2% and k : r* lTI* are morphisms, then h f k : El* + ill* is a gsp-function. If further f is an sp-function and IZ and k are fine, then lzfk also is an spfunction I ---f
XI. Sequential Machines
308
PROPOSITION 3.6.
Every gsp-function f: Z*
-+
P admits a factor-
ization k z* 5a*-+ r*
where f ' is an sp-function and k is a morphism. Proof. Let f = -flwhere A = (Q, i, A ) : 2* + T* is a gs-machine. Define Let SZ consist of all pairs (q, a), q E Q, a E 2 such that qa f 0. AT' = (Q, i, A ' ) : 2 SZ by setting (q, a)A' = (q, a). Further define the morphism k : 9" -+ r* by setting (q, a)k = (q, a)A. Then clearly A ' k = AT, Thus -ffl k = -fl= f as required I -+
EXAMPLE 3.1. We shall now give an interesting example as to how the composition operation h d k may be used. Let A: Z* + f'* be a gs-machine. Consider an integer p 2 1 and consider the morphism h : (Zp)* + Z* defined by the inclusion mapping ,P c Yr*. In other words if s E D,then sh = s E 2". T h e gs-machine .&P = h d : (2")"+ r*is then the machinedspeeded up by the factor p , in that the inputs are fed in blocks of length p . If .&?is an s-machine, then the composite h &? may be regarded as an s-machine k ( p ' : ZP + P. EXERCISE 3.1. Let .k= ( Q , i, A ) : S* + I'" be a gs-machine. Then A? is said to be positive if A has values in i.e., d has no edges
r+, if
dl
P-4
AT is said to be almost positive i f .Acontains no non-trivial closed path composed entirely of such edges. Establish the equivalence of the following conditions:
(i) d is almost positive. (ii) If p = card Q , then the gs-machine d ' ( 1 ' ) of Example 3.1 is positive. (iii) J&'(P) is positive for some p 2 1. Show that these conditions imply : (iv)
There exists an integer p 2 1 such that Is1
4PISJfll
for all words s E 2" such that s f a f
8.
4. Digital Computation
309
EXERCISE 3.2. For any function f:Z* Z* + by setting
r"
sfe=
+
r* define
the transpose f e :
(Pf)"
where P is the word s reversed. Show that f and p are both length- and initial segment-preserving i f f is a very fine morphism. 4. Digital Computation
We shall give some examples as to how sequential machines can compute some functions on integers using an expansion of the integers at some base k > 1. Notations introduced in IV,2 and IV,6 will be used. T h e first example that we shall consider is the function
x,y
Max(x,y),
E
N
Let s and t be the expansions of x and y at base k. T h e usual way to decide which of the two integers x and y is the larger one is to compare corresponding digits in the expansions s and t. Two facts emerge: (1) since the more significant digits must be compared first and since our sequential machines read the input from left to right, the standard interpretation vk: k* + N should be used; (2) pairs of digits will be compared, thus the words s and t of k* should be of equal length (i.e., of the same format). This can be achieved by writing a sufficient number of zeros at the left end of the shorter one. T h e pair s, t E k* such that I s I = I t I is now treated as an element of (kx k)* and a complete sequential machine
A:k x k - k is constructed such that
T h e machine .kis given by the diagram (d,d)/d
(d,d')/d'
c
0
Its functioning is clear
(d,d')ld' d
t
d,d'
0
3
(d,d')/d
Xi. Sequential Machines
31 0
+
T h e next example is the function x y. We first examine the procedure by which the integers 6 and 11 (at base 10) can be added using expansions at base 2. Since the usual way of performing addition starts with the least significant digits first, it is clear that the reversed interpretation should be used. We have
6 = (001),
11 = (1101)
It is clear that in order to perform the addition by the usual method (but proceeding from left to right) we replace 001 by
6
=
(0110)
thus bringing both expansions of 6 and 11 into the same “format.” We now perform the addition writing the “carry” in a line above. We obtain 00111
carry
~
01 10 + 1101 1000
result
T h e computation cannot be completed because we are left with a “carry” with nothing else to add to it. Thus we must use the expansions
6
=
(01100),
11 = (11010)
Now the addition can be performed 00111 +
carry
01100 11010 10001
result
which gives the correct result since 17 = (10001). This computation suggests that the “carry” should be used as a state, while the input alphabet should be a pair of digits. We therefore define a sequential machine (4.1)
-k’:k x k - k ,
k > 1
with states 0, 1 and with 0 as initial state. T o define the action and the
4. Digital Computation
311
output consider
d , , d,
E
and write
j + d, with 1 = 0, 1 and 0 5
Y
k,
+ d,
j
=
lk
=
0, 1
+
Y
< k. Then
T h e result of this machine is a function
f N: (kxk)"
-+
k"
satisfying
where sl, s, is any pair of words in k" such that 1 s1 I = I s2 1. T h e computation performed earlier for adding 6 and 11 is now represented by the path
with output 10001. Observe that in a sense the state 0 is regarded as terminal since a computation is not complete if a non-zero carry is left over (this phenomenon is called an "overflow"). This is the reason why (sl, s2) is replaced by (slO, ~ ~ 0 ) . T h e same procedure may be used for adding 1 integers provided 1 5 k. T h e carry can then take the values 0, 1, . . . , 1 - 1 and those will be the states of the appropriate sequential machine. Adding more than k integers at the base k is troublesome. T h e fact that for computation of Max(x,y) we used the usual interpretation while for x y we used the reversed one is not accidental. From Exercise 3.2 we can draw the moral that things could not be done the other way around. T h e situation concerning multiplication is radically different. I n fact Proposition IX,9.3 shows that the squaring operation N 4 N cannot be obtained from a rational relation f: k" + 1" (using v k and q).
+
312
XI. Sequential Machines
EXERCISE 4.1.
Let k
= 2p
+ 1 be an odd integer with p
2 1, and let
r : k" ---t Z be the reversed Russian interpretation as defined in V,6. Construct sequential machines
A:k x k + k that will add and subtract, in the same sense as (4.1) adds with the reversed standard interpretation. EXERCISE 4.2.
Show that $ f : k* + 1"
is an initial segment-preserving function such
(Sfh = ( s h = 1' for some integer r > 0. If this is the case, then f may be chosen to be a morphism.
f o r all s E k", then k
EXERCISE 4.3.
1"
+
Let k
=
6 with r > 0. Construct a gs-function f :
k" such that (sf
for all s E
(P)",i.e.,
EXERCISE 4.4.
>k =
all s E 1" such that I s I is divisible by r .
Let k, = 1'1, k, = P a . Construct a gs-functionf: k,"
--+
k," such that
(sf >k2 = ( s > k l for all s E k," with 1 s 1 divisible by r 2 . 5. State-Dependent Sequential Machines
Let A= ( Q , i, A ) : C* ---t P be a gs-machine. We shall say that A? is state-dependent if there exists a
5. State-Dependent Sequential Machines
31 3
function (not just a partial function!)
Equivalently, A? is state-dependent iff
Since 1 and ,8 mutually determine each other we shall write ,A'= (Q, i , ,8). I n the graphical representation of d, whenever we have
dui
41
4
02/02 f--
42
then g , = g z . It is therefore appropriate to remove the output label from the edges and transfer it to the state which is the end of the edge, thus obtaining (TI
g
41 __+ 4
where g
a2
42
=g, =g2.
r*
PROPOSITION 5.1. For each gs-machine (resp. s-machine) .d: Z* + there exists a state-dependent gs-machine (resp. s-machine) .,A'': Z* r* such that fl=fa,. --f
Proof, I n view of Proposition 3.6 (or rather the construction in its proof), it suffices to consider the case when
d = (Q, i, A): S is a sequential machine. Consider the machine
We claim that for all s
E
Z*
-+
r
XI. Sequential Machines
31 4
For I s I 5 1, this is clear. Arguing by induction we have
This proves (5.1). From (5.1) we deduce =
f.W
f.,,
Observe that if in Proposition 5.1 LT is complete, then so is the statedependent machine d” constructed above. ~
6. Recognition of gsp-Functions
be an initial segment-preserving partial function. T h e dzflerential of f is the partial function y : z+ r* defined by the condition
m.
Observe that from the differential y we and (w)y = @ if ( s o ) f = may reconstruct f as follows
1
~
f
{ (u,y)(olu2y).. . (ol.. . =
a,Lp)
if s = l if s = ol. . . g , ! , n > 0
Clearly y is a function iff f is a function. If f is length-preserving and initial segment-preserving, then
6. Recognition of gsp-Functions
31 5
and vice versa. For each y E F, we have
This follows from (6.1). Let y l , . . . , y, be an enumeration of the letters of vector A = (A,, . . . ,A,) A k =
of (unambiguous) subsets of
(r"yk)f-'
I+. T h e following facts are clear:
(6.3)
T h e sets A , , . . . , A, are disjoint.
(6.4)
If s E St and
(6.5) Ilom f
=
1
SZL E
I', and consider the
iz, u . . . u A,, then s E A , u . . . u A,.
u A , u . . , u A,.
Note that (6.4) follows from (6.5) since f is initial segment-preserving. Conversely given a vector A = ( A , , . . . , A,) of subsets of L'+satisfying (6.3) and (6.4), formulas lf=1 ( S C T ) ~=
(sf )y,
if
sf f
0,so E Ak
define inductively a unique length- and initial segment-preserving partial function f for which (6.2) and (6.5) hold. We thus have a bijection between length- and initial segment-preserving partial functionsf: 2" + F" and vectors A = ( A , , . . . , iZ,) of subsets of I satisfying +(6.3) and (6.4). Clearly f is a function iff A, u . . . u A , = Zi-. * + I'* be a length-preserving and initial THEOREM 6.1. Let f : I segment-preserving partial function and let A = ( A , , . . , , A,) be the corresponding vector of subsets of I+wtiere r = card r. TJzen f is sequential if and only $ the sets A , , . . . , A, are rational. Proof. I f f is sequential, then by Proposition 3.1, f is rational. Therefore the sets A , = ( I ' * y k ) f - l are rational. Conversely assume that A , , . . . , A, are rational. If A = @ (i.e., A, = . . . = A, = then Dom f = 1 and f is sequential. T h u s we may assume A f Let
a), a.
31 6
XI. Sequential Machines
be the minimal automaton of type (1, r ) such that I I = A , as constructed in III,13. We recall that the states in QLiare the non-zero vectors of the form
AS = (s-'Al,
(6.6)
. . . , s-'A,)
and that
T = ( T , , . . . , T,) each T, being the set of all states (6.6) for which 1 E s-lA,, i.e., s E A,. Since the sets A, are unambiguous and rational, they are recognizable by Kleene's Theorem. I t follows that QL4is finite. Since As E T, iff s E A k , the disjointness of the sets A , , . . . , A, implies :
(6.7) T I , . . . , T, are disjoint. We assert QAC= T , u
(6.8)
. ..
u T,
First observe that if As E T,, then s E Ak and thus s E C+ since Ak c L'+.Consequently, Tl u . . . u T, c QA4Z. T o prove the opposite inclusion assume As E QA4Z with s E C+. Since &', is coaccessible we have Asu E T, for some u E Z* and 1 5 k 5 r . Thus su E A,. Since s E L'+ it follows from (6.4) that s E A,, for some 1 5 k' 5 r . Thus As E T,,. This proves (6.8). We may now define the function
1: Q , X C - t r
(9, o)l = Yk
if
qa E
Tk
and consider the state-dependent gs-machine J.4
Assume
= (Q-1
A, A)
sf+ 0.Then (self =
(sf )Yk
holds iff so E A, , i.e., iff Aso E T,, i.e., iff (As, o ) l = y,. Thus we have =
( d ) ( A s ,a)J
and this proves that f is computed by the machine
I
6. Recognition of gsp-Functions
31 7
Observe that since A , , . . . , A , are subsets of Z+ the state A of is not in T , u . . . u T,. Consequently Q.1
QA4
A v T , v . . . u T,
is a partition of THEOREM 6.2. For any length-preserving and initial segment-preserv-
in, partial function f: Z*+ r* the following conditions are equivalent: (i) f is rational. (ii) For each rational subset B of P,the set Bf (iii) ( r * y ) f - l is rational for each y E IT. (iv) f is a sequential partial function.
is rational.
-
T h e implications (i) => (ii) (iii) are clear. T h e implication (iii) = (iv) follows from Theorem 6.1. T h e implication (iv) = (i) follows from Proposition 3.1 Proof.
For partial functions f which are initial segment-preserving but are not assumed to be length-preserving, the situation is considerably more complex. Condition (i) is not sufficient to ensure that f is a gsp-function (see Example 6.1 below). (Ginsburg-Rose) For every initial segment-preserving partial function f:zT* + r*the following conditions are equivalent. THEOREM 6.3.
(i)
f is rational and there exists an integer M 2 0 such that
Z+ such that (su)f f 0. For each rational subset B of P,the set Bf is an integer M 2 0 such that
for all su
(ii)
E
p1
is rational and there
for all sa E Z+such that (sa)f # @. +I '* o f f has a finite codomain and gv-' is (iii) The dzfferential p: Z+rational for every g E P. (iv) f is a gsp-function.
XI. Sequential Machines
318
Proof. (i) => (ii). Since f is rational so is f - l : r*+ Z". Thus Bj-I is a rational set for every rational subset B of f*. (ii) * (iii). T h e inequality of (ii) implies
I say I = I sufl
-
I sfl I
and therefore y has a finite codomain. If g E f" and I g I > M , then gy-' = 0. Thus we may assume that I g I 5 M . Define
Bi= { g I g E P , Igl - i m o d M + l} for 0 5 i
5 M . T h e sets B i are rational. Consequently the sets
are rational for every 0 5 i 5 M and every cr it suffices to verify the identity
gp-'
(6.9)
=
E
Z. Thus to prove (iii)
U V,i,a
the union extending over all 0 5 i 5 M and all CT E Z. Assume t E gp-l. Thus t = sa and say = g. Consequently tf = (sf )g. Since 1'" = B, u . . . u B,, we must have sf E B , for some 0 5 i 5 M . Consequently t f B,g ~ and t E (B,g)f-I. Further since s f ~B , we have s E B ,f-' and thus t E ( B , f - ' ) a . We have thus shown that t E V,,". Conversely assume t E Vi,a. Then t E (B,f-')a and thus t = so with s f B~ , . This implies
tf = (salf = (sf )(sa)rp Since also t
E
E
BL(tP))
(Big)f-' we have
+
It follows that I g I = I tp, I mod M 1. Since however I g I 5 111 and I ty I I M we must have I g I = I t y I. Since both g and t y are terminal segments of tf it follows that g = tp, and thus t E gy-'. (iii) * (iv). Let g , , . . . ,g, be an enumeration of the elements of the codomain of y . Consider an alphabet Q with letters w , , . . . , (or and let y : Q* + P be the morphism satisfying w,y = g, for 1 k 5 r . Consider the subsets
6. Recognition of gsp-Functions
31 9
These are disjoint subsets of L". T h u s condition (6.3) is satisfied. We assert that (6.4) also holds. Indeed, s E A , u . . . u A, is equivalent to sq f Since ( s u ) f ~ ~3and s E .L'+implies sp # condition (6.4) follows. Since the sets .4,, . . . , A, are rational by assumption, Theorem 6.1 may be applied to yield a sequential partial function h : 2" L P such that A,. = ( Q " O J ~ ) ~ - ' or , equivalently
a.
a
---f
if sh f
(sa)h = ( s h ) ~ , .
and
su E Al
Applying the morphism y we have
if shy f 8 and su E A,
(sa)hy = (shy)g,
This shows that f = h y and thus f is a gsp-function. (iv) (i). This follows from Proposition 3.1 I Let 1 = {a, T } , r = {a}. Consider the initial segment-preserving function f: S* 4T" defined by EXAMPLE 6.1.
a!f=
for all s E L'*
d t s f = cZk
Then f is rational as indeed its graph is (a,a)"
u
( 0 , a2)*(t,
l)(Z*X 1)
However,
I
(a")f
I
-
I ay1 = k
so that the "Lipschitz condition" of (i) in Theorem 6.3 is not satisfied. T h u s this condition in (i) and (ii) of Theorem 6.3 is not redundant.
Theorems 6.2 and 6.3 imply: COROLLARY 6.4.
The composition
of twogsp-functions (or sp-functions) is a gsp-function (or an sp-function)
I
XI. Sequential Machines
320
This corollary follows much more naturally from the properties of composition of machines defined in XII,8. 7. Sequential Bimachines
T h e theorems of Section 6 relating rational functions and gs-mappings, were restricted to functions that are initial segment-preserving. We shall now show that this very restrictive condition may be dispensed with if we introduce a “two-sided” version of the notion of a sequential machine. A bimachine A:
z+r
where Q and P are finite sets equipped with partial functions
qo and p , are elements of
Q and P , respectively, and 1 is a partial function
called the “output”. No conditions are imposed on the domains of (7.1)(7.3). If (7.1)-(7.3) are functions, then ..&is called a complete bimachine. In a generalized bimachine A?:2*+ r*,the output il is allowed to be a partial function
As usual the partial function (7.1) converts Q into a right 2-module. The partial function (7.1) is extended to a partial function Q X Z* + Q satisfying q l = q, q ( s t ) = (qs)t. Dually the partial function (7.2) is used to convert P into a left 2-module; this partial function is extended to a partial function 2*x P + P satisfying lp = p and (st)p = s(tp). T h e output (7.3) [or (7.3g)I is extended to a partial function
7. Sequential Bimachines
321
defined inductively as
for s E I",0
E
E. T h e more general identity
for all s, t E I*is now proved by induction on I t I. If I t I 5 1, then (7.7) follows from (7.5) and (7.6). If t = uo, then inductively
as required. T h e result of A" is the partial function
This is the only occasion where the initial states q o , p o are used. If A'is a bimachine (rather than a generalized bimachine), then
and thus j K is length-preserving. If .,His complete, then (7.4) is a function and thus alsof8 is a function. I t should be noted that bimachines do not fit into the general definition of machines of Chapter X. If, however, P = Po reduces to a single state and (7.2) is the (unique) function, and if further (7.1) and (7.3) have the same domain (where Q x Z and 0 x Z XP are identified), the bimachine becomes a sequential machine in the usual sense. THEOREM 7.1. Let f : L'* + P be a partial function such that If Then the following conditions are equivalent:
=
1.
322
XI. Sequential Machines
(i) f is rationd. (ii) f is the result of a generalized bininchine
9-+ l’*.
Further f is length-preserving ;f and only iff is the result .f a himachine ./A?: X -+ 1: Also f is a function if und only if . //‘ can Be chosen to be complete T h e proof is given in Section 9. We only note here that in the gcncralized bimachine -/i‘= (Q, q,, P, p , , 1)that will bc constructed, the right S-module Q and the left X-module P are complete and only 1 is a partial function. If, however, f is a function, then 1 as constructed also will be a function and thus R will be complete. 8. Examples of Bimachines EXAMPLE 8.1. tion
Let .Y
=
{o},1’= { y o , y , } , and consider the funcf :
x* r*
{$
(T,lf=
if n is even if n is odd
This function is rational and a bimachine computing it will be constructed. We choose Q = P = 2 with 0 as initial state for both P and 0. T h e right action of a on 0 and thc left action of CT on P are given by
io=ci=I-i
for
i=O,1
T h e output function is y: QXZXP-I’
(i, .,j)y
y,
=
{ yo
if if
i + j is even i + j is odd
We claim that a’lf = (0, a”, O)y
Indeed (0, 8, 0 ) y is the product of terms of thc form (Oak,
o, o)1-P-lO)y,
If n is even, then k - { - ( n - k If n is odd, then k 4- ( n k ~
~
0 5 k -< n
1 ) is odd and thus each term gives y o . 1 ) is even and all the terms are y , .
8. Examples of Bimachines
323
EXAMPLE 8.2. M’e return to the sequential inachinc .//<
( 2 , 0 , 1 ) : kL
constructed in Section 4 to compute addition at base k (using the reversed interpretation). I t tvas shown that if s, , s, E k” are words of equal length I s, I = I s, 1 = n, then
r ,
1 he additional zeros were necded to prevent the computation terminating in statc 1 (i.e., with a carry 1). If we consider (sl, sp)f, then we obtain the first n digits of the “digital s u m of s, and s,.” If t h e computation ends in state 1, then an additional (n 4- 1)st digit equal to 1 is needed. T h u s the digitnl sunz may be defined as
11: ( k y k ) ” + k * (s,, s,)h
=
0(s,, sn) = 0
if
(s,, sJf
We shall construct a generalized sequential biniachine < Y = =( 2 , 0 , 2 , 0 , y ) : k?tk - + k computing 11. ‘I‘hc right action of k \< k on 2 coincides with that in T h e left action is ( d , , d,)O
for all (d, , d,)
E
=
( d , , d,)l
=
.&.
1
k Y k. ‘I‘hc output function is y: 2 x k x k x 2 +k”
(q, d , , d$l q, d , , d,)A
for all (s, , s 2 )
with (d, , d , )
E
E
O(d,, d,) O(d,, d,)
if if
= =
1 and p = 0 0 or p = 1
( k x k)”. If now
k?t k, then setting
E
il
or
E
=
1 if O(s, , s2)
=
0 or
X I . Sequential Machines
324
O(s, , s,)
=
1 , we have
(0, ( $ 1
9
SZ),
0)Y = (0, (tl9 t,)(d, > dz), 0)Y = (0, tl t , , (dl d,)0)?(0(t, tz), 4 d2 0)Y 9
9
9
=
(0, tl , t , 1 )?(O(t, , tz), dl > d,
=
(0, ( t l , t z ) ) ~ ( o ( ttz), l , dl >
=
(0, s 1 , S Z ) l E
9
= (Sl
9
9
9
O h
, sz)h
as required. I t should be noted that if it were only a question of showing that the function g is rational, then this could be achieved easily by modifying the sequential machine -,d to become a transducer A?' by ( 1 ) regarding 0 as a terminal state, and (2) introducing a new state t that is terminal and introducing an edge IXI 1-t whose label is the identity function. As an application of Example 8.2, we prove: PROPOSITION 8.1. Let the function g :
%
=
k" + k" be dejined by
[srl
where q : kX + N is the reversed byective interpretation of V,6 and [rp] is the reversed expansion at base k . The function g is rational. Proof,
If s=dO
then
. . . dn,
n
sv =
C (di + l ) k i i=O
and [sq] is the expansion of sq at base k . I t is clear from this description that sg is the digital sum of s and of a string of 1's of length I s 1. Thus
sg = (s, 1'")h and this proves the rationality of g
I
EXERCISE 8.1. Show that the subset A of N is k-recognizable zfl q~-IA is a recognizable subset of k" where q is the bijective interpretation.
9. Proof of Theorem 7.1
325
9. Proof of Theorem 7.1
T h e following fact, derived from (7.2) and ( 7 . 3 ) by induction will be useful :
w h e r e n = I s l andfor l < i < n
(ii) => (i). Assumef = .fa where R: L'++ f is a gs-bimachine. Let .R = (0, qo , P, p,, A). We generalize the construction of the graph of an automaton as given in II,6. For this we consider the alphabet I
S=
+
Q X Z X P
and define the morphisms
Next we define the local set
Assume u E L and uh B, and C imply that
= s = c1
. . . on with n > 0. T h e definitions of A ,
Conversely if u has this form, then u E L and uh = s. Further, (9.1) implies sffl = ( q o ,s, po)A = ( W J ) . . . ( W n Z ) = ul
XI. Sequential Machines
326 I t follows that f l y is the composition
and thus -ff is rational. (i) (ii). We first consider the case when f is length-preserving. Let f ' be the composition nsi 1" I 1'" 2" d __c
T h e n since f is rational, so is f' and further I f ' VI,6.3, f ' admits a factorization h-1 171, 2" d 0"d R"
I __+
= @.
T h u s by Theorem
1'"
r*
where h : Q* + S* and I: Q* are very fine morphisms and I, is a local subset of SZ". Since I f = 1 it follows that f is the composition ---f
ZR* -a* A(lUL)
1"
I
r*
Let
L
=
AR" n Q*B
A , B c Q,
-
Q*CP
C c sz'
Let D consist of all the finite subsets of f2 and of the element 1. We convert D into a right Z-module by the formulas
10
=
da
=
I (oh = I T , (0 E A } {Q I wh = I T , do) - C # ((1)
a}
for d E D, d f 1 . Similarly we convert D into a left 2-module by the formulas IT^ = { ( I ) I (oh = I T , (o E B }
ad Setting qo = p ,
=
= {(u
I wh = CT, rod
~
C f @]
1 we define
T h u s Q is an accessible complete right 2-module, while P is an accessible complete left 1-module. To complete the definition of the sequential bimachine Jd= ( Q , q 0 , P , p o , A ) :
zjr
9. Proof of Theorem 7.1
327
we define the output
1: Q x Y x P 4 r by setting (4, .,P)A
q
=
=
p
q,s,
=
( 4 0 n op)l
tp,,
s, t
S"
E
We claim (9.2)
Let sot
E
Yk. Then (sot)f # @ iff
qoso n olp,
f
(4
If this is the case, then (qoso n otp,)Z is the nth letter in (sat)f where n = I s I 1.
+
Taking (9.2) for granted for the moment we continue the proof. I t follows from (9.2) that A is a partial function. T h u s the sequential bimachine . k': 1: 1' is well defined. Observe also that i f f is a function, then (9.2) implies that (q, o, p ) A f 0. T h u s in this case .R is complete. Next consider s = (T, . . . o,#E S+ and let sf = y1 . . . y,{. Then (9.2) implies ( 4 0 S L > 0 , t,P,V = Yb ---f
Y
where for 1
5i 5n s
=
i = I s, I
s,o,t,,
+1
Therefore by (9.1) (40,
s, P 0 ) A = sf
This proves that f c f {,. T o prove equality assume sfa f (4 for some s E Xi,and let s = at. 'Then SfR. =
(Q" s, P o V 7
=
(40,
at, P")A
=
( 4 0 , 0,
tPo)440a, 4
1 herefore ( q o , a, tp,)1 # @ and thus, by (7.2), proves f = fa. Before proving (9.2) we prove:
I ,
(9.3) If
E
Q and s
E
L",then (11
iff there exists
zi E
E 40s
Q* such that u(u E
An"
-
Q"CQ*
sf=
P O V
((~t)f+
0.This
XI. Sequential Machines
328
We prove (9.3) by induction on I s 1. If s = a, then we must have u = 1 and (9.3) is in this case a direct consequence of the definition of qoa. Now proceed by induction and assume that s = t a with t E Z+.By definition of (q,t)a, the condition o E q,ta is equivalent to coh = u together with the existence of an w' E qot such that o ' w E C. By induction, the condition w' E qot is equivalent to the existence of u' E 0" such that (u'w')h = t and u'w' E AS" - sZ"CS". Since wh = u and w'w E C these conditions are equivalent to (u'w'w)h= t a = s and u'w'w 4 AS" - sZ"CsZ". Thus the conclusion of (9.3) holds with u = u'w'. T h e argument being reversible, (9.3) is established. Symmetrically to (9.3) we have: (9.4) If w
E
S and s E Z+, then 0
sp,
E
iff there exists v E S* such that (Uv)h = s wv
E
S"B
- S"CS"
We can now prove (9.2). Assume ( s a t ) j f 0. There exists then w E L such that wh = sat. Then w admits a decomposition w = uv such that (9.5)
(uw)h = ~ a , ( w v ) h = at
Further the condition w (9.6)
UQ E
AS"
E I,
implies uv E S"B - S"CS*
- sZ"CS",
Thus by (9.3) and (9.4) (9.7)
w E q,so
n atp,
Conversely assume (9.7). Then by (9.3) and (9.4) there exist elements S" such that (9.5) and (9.6) hold. From (9.5) we deduce that (uwv)h = sat while (9.6) implies UQV E L. Therefore (sat) = (uwv)l and thus ( s a t ) j # 0. Further since I s 1 = 1 u I it follows that wl is the nth letter in (sat)f where n = I s I 1. This concludes the proof in the case when j is length-preserving. T o consider the case when j is rational but not necessarily length-preserving we use Theorem IX,8.4 to obtain a factorization u, v E
+
z*2
-r* h
9. Proof o f Theorem 7.1
329
where 9 is a finite alphabet, g is a length-preserving rational partial function, and h is a morphism. By the above there exists a sequential bimachine <,JT= (Q, q o , P, p , , a): 3 sz such that g = f 8 . Replacing the output I by Ah we obtain a generalized sequential bimachine
jP
=fd= g h = f
If, further, f is a function, then so is g. Thus ,&as constructed above is complete and therefore - & ' also is complete I I t is worth observing that the modules Q and P constructed in the proof satisfied qo $ QL+ and p , $ Z+P. For references, see the end of Chapter XII.
CHAPTER
XI1
Operations on Sequential Machines
This is a continuation of Chapter XI. While in Chapter XI we dealt with a single sequential machine, here we shall deal with two or more. We shall compare them, compose them, etc. This leads to several categories. Also within this framework we shall discuss minimization questions in which the number of states of a machine built to perform a certain task is minimized. 1. State-Mappings
Consider sequential machines
..&, . P : .A? =
(Q, i, A),
z +r .k'= (Q',i', A')
A morphism (or a state-mapping) cp: L&?-L.&?'
is a partial function 91: Q 4 Q '
satisfying
330
1. State-Mappings
for all q
E
331
Q, a E 1.T h e last two conditions imply
(12 ’ ) (1.3’) for all q E Q, s E S”.These formulas are proved by a trivial induction on 1 s I. Taking q = i in (1.3’) we obtain, in view of ( l . l ) , (i‘, s)A’ c (i, $),I and thus
T h e state-mapping p is said to be proper if
This readily implies (and is implied by)
From this we deduce
Indeed if qs = B,then both sides are @ by (1.2’) and (1.3’). If qs f @, then, since ~y is proper, (qpl)s f @ and (99, s)A’ f 0. T h u s (1.6) and (1.7) are implied by (1.2’) and (1.3‘). Taking q = i in (1.7) yields
Observe that (1.5) holds automatically if the sequential machine .,A‘‘ is complete. T h u s in this case every state-mapping cp : A’ 4 dt’is proper and in particular (1.8) holds. .A‘‘ is proper may be reformuT h e fact that a state-mapping cp: lated as follows: If
qZ and qcp #
p is an edge in ,A‘
0, then qcp +OlY pp
is an edge in “dt’
XII. Operations on Sequential Machines
332
The composition of two state-mappings
is again a state-mapping "48
zA"
and further if p and p' are proper, then so is pp'. This follows directly from the definitions. If p": Jd" 4A?"' is another state-mapping, then the associativity (pp')p" = p(p'p") is obvious. Also the identity mapping of Q into Q is a state-mapping 1,d : %I + &Z. Thus sequential machines J&: Z 4 r and state-mappings of such machines, form a category that we shall denote by SM(2, T ) . A subcategory SM'(2, T ) is obtained by restricting the morphisms to be proper state-mappings. A further subcategory CSM(Z, r )of SM'(Z, r)is obtained by restricting the machines to be complete (here all morphisms automatically are proper). Further subcategories may be obtained by requiring the state-mappings to be functions Q + Q'. Everything said so far applies verbatim to generalized sequential machines. This yields categories GSM(Z, r),GSM'(2,r),CGSM(2, F ) . Of course SM(Z, r)is a subcategory of GSM, etc. Similarly everything applies equally well to output modules and to generalized output modules, provided one omits all mention of the initial states. This yields categories OM(2, F ) , GOM(Z, r),and their various subcategories as above. EXAMPLE 1.1. Let AT= (Q, i, A): 2 + r be a sequential machine and let Q' be any subset of Q containing i. Convert Q' into a 2-module by defining the action q'a if q'a E Q' otherwise Then define the output A': Q ' X Z + r by setting
(q', a)A' = (q', o)A
if q'
.a# 0
There results a sequential machine
Q'
=
(Q!, i, A/): 2 jr
called the restriction of /&to Q'. The surjective partial function E:
Q-Q'
2. Accessibility
defined by
q E
333
=
q if q
E
Q' and q t E:
A'
0otherwise is then a state-mapping
= +
A' I Q'
called the restriction-mapping. This state-mapping is proper iff Q' is a submodule of Q, i.e., iff Q'Z c Q'. If this is the case, then the inclusion mapping 1 : Q' Q also is a state-mapping ---f
L:
J$'
I Q'
+
.&
and is proper. Further L E : .II Q' + iY I Q' is the identity. T h e converse is also true: if L : Q' + Q is a state-mapping, then Q'Z c Q'. I
EXAMPLE 1.2. Let p: d + . k ' be a state-mapping with d'= (Q, i , A), JY' = (Q', i f , A'). Let D and I denote the domain and the image of the partial function 97: Q Q'. Then I is a submodule of Q' and is the composition ---f
~ k L % .D dv/ ' - . l '
IILL&'
where p and L are restrictions and inclusion, while p is a uniquely determined state-mapping which is a surjective function y : D + I. Further p is proper iff both p and yi are proper. D and -k" I I will be called the domain The sequential machines and the image of the state-mapping p. They will be denoted by Dom p and I m p. I t will be clear from the context when Dom p is intended to be a sequential machine and when simply a subset of Q. Similarly for I m q. EXERCISE 1.1.
Fill in the missing ver$cations in the above two ex-
amples. EXERCISE 1.2. Show that a state-mapping is an isomorphism in the category SM(Z, r )zfJ it is proper and is a bijective function. 2. Accessibility
A gs-machine d?'= (9,i, A ) : Z* + r* is said to be accessible if iZ* = Q. For any gs-machine .1*d as above (not necessarily accessible) the subset iZ* of Q is a submodule of Q and the restriction k ' l iL'* is defined. Clearly
XII. Operations o n Sequential Machines
334
cessible part of *A'' and denote it by mappings . R.1 L.A?2
L
We have the proper state/,fa
where i is the inclusion and E is essentially 1- l. be a state-mapping with .d'= (Q, i, A), d" = (Q', Let p: .&%+,k' i', A'). T h e composition
is then a state-mapping p a : ,&:% --f , ,&?'a
Observe that pa is defined by (is)@
if (is)p E i'z'" otherwise
=
Conditions (1.1) and (1.2') imply
i's c (is)p T h u s we obtain
( i s ) ~ p= " i's
if
i's f
However, we need not have (is)cp" = @ if i's = @. I n any case it follows that pa is surjective. If p is proper, then so is q*,since i and E are proper. Further if is # @, it follows from the fact that p is proper that i's = (ip)s f g. Thus in this case we have (is)@
= i's
for all s E Z*
This shows that the state-mapping qfa is independent of the choice of the proper state-mapping p: JL+. d'. For some purposes it is convenient to generalize the notion of a gsmachine (and of an s-machine) so as to permit more than one initial state. We thus define an n-fold gs-machine ( n 2 1)
3. Reduction
as a go-module
335
(0, A )
together with an n-tuple
i = (i,, . . . , i , l ) of elements of Q. For reasons that will become clear later we do not assume that i,, . . , , i,, are distinct. The result of such a machine is an n-tuple
of gsp-functions
h.:L'*
+
r*defined
by
Then . /% is said to be accessible if each q E Q has the form q = iks for some 1 5 k 5 n and some s E L'*. Thus the accessible part .,id'a of 4 has the set of states 11
Otherwise there is no change.
3. Reduction In this section and the next, it will be convenient to admit go-modules and gs-machines with an infinite number of states. This turns out to be convenient even if the ultimate goal is to study the finite case only. The alphabets 2' and I' will be kept fixed. We denote by Qo the family of all initial segment-preserving partial functions f: S* + P.Since automatically If = 1, the empty partial function is not in Qo. For any f E Qo and any s E L'* we define a partial function f . s by setting if (stiff 0 t ( f . s) = (sf)-'(st)f { @ otherwise Observe that if (st)f f 0, then .rf is an initial segment of (st)f so that f a s is a well-defined partial function. Further
and
XII. Operations o n Sequential Machines
336
T h e verification of the foIIowing simple facts is left to the reader
(3.2)
f
a
sf
0 iff sf
f
(3.3) f . s E Qo iff sf# (3.4) f * 1
=
0. 0.
f.
(3.5) f * (ss') = (f * s) * s'. (3.6) I f f is a function, then so is f - s. (3.7) I f f is length-preserving, then so is f
. s.
Statements (3.3)-(3.5) assert that Qo is a right Z-module. Statements (3.6) and (3.7) assert that functions and length-preserving partial functions are submodules of Qo. We now convert this Z-module into an infinite go-module
M O= (QO, LO): Z* + r* by defining the output A0. We directly define the extended output LO:
QOXZ*
jr*
by setting
(f,$)A0
(3.8)
=
sf
The identity
(f,s t ) P = (f,S)AO( f . s, t)AO is then just a rephrasing of (3.1). Given any go-module M = (Q, A): Z* 4r* and given q E Q it will be convenient to denote by
qA: Z* jr* the partial function given by s ( d ) = (4, $12
Since q A is initial segment-preserving we have q A E Qo.Thus the extended output A: Q x Z * +T* may be reinterpreted as a function
(3.9)
A: Q + Q o
337
3. Reduction PROPOSITION 3.1.
The function (3.9) is a proper state-mapping 2: Ad
(3.10)
-+
Mn
Further, 1 is the unique proper state-mapping M
--t
M'.
A comparison with formula (3.1) yields t[(qs)11= r ( q i . s) and thus (qs)i = q i
.s
Further by (3.8)
( q A s)A0
=
s(q1) = (q, s)]
a.
T h e n (qs, l ) J = 1 and thus (3.9) is a state-mapping. Assume qs f so that ( q s ) l f 8. T h u s by the above q i . s f b 3 so that 1 is a proper state-mapping. Suppose y: M + M o is any proper state-mapping. T h e n by (1.7) and (3.8) we have = ( q n s ) i " = s(qy) (9, and thus q1 = qT so that y
=
2 as required
I
Let 11.1' denote the image of (3.10). There results a proper statemapping p : M + 11.1' which is a surjective function. Under this mapping two states q1, qn E are merged iff =
q22
=
(q.3
0
i.e., iff (41,
for all s E
P. When this is the case we say that
q, and q2 are equivalent
XII. Operations on Sequential Machines
338
-
states (notation: q , q2). Thus 111' is obtained from M by merging equivalent states. If no two distinct states in M are equivalent, we say that M is reduced. Equivalently M is reduced iff e: M + M r is an isomorphism. In particular, M r itself is reduced. For any go-module M , the go-module Mr is called the reduced quotient of M . In practice Mr is obtained from M by locating in M all pairs of equivalent states and merging them. For this procedure to be practical we need a decision algorithm to decide whether or not two states q, and qz of M are equivalent. Such a decision procedure (in the case of finite go-modules) will be given in Section 5. 4. Minimal gs-Machines
A gs-machine .A? = (Q, i, A) is said to be minimal if it is accessible and reduced. There are two ways of obtaining a minimal gs-machine from the given machine -,&. T h e first one is to take the accessible part .A+ and reduce it. I t is easy to see that remains accessible and thus is minimal. There result proper state-mappings .R + d&jb
+ .Adfir
The second method is to reduce =& first and then take the accessible part of Ar.There result proper state-mappings
. R + Rr + <,Rr;L *
I t is not difficult to see directly that the minimal gs-machines .dar and .&PL are isomorphic. However, we shall show more: THEOREM 4.1.
Any two minimal machines A,JR' such that J f
=f R ,
are isomorphic. T o see this we consider the partial function f = f g = 1 ~ Then f E QO. If we regard f as an initial state of the go-module M" = (Q", A"), we obtain a gs-machine Proof,
(Q", f,A") :
z*+ r*
which is reduced. Thus the accessible part of this machine is minimal. We denote this accessible part by s / g f
=
(Qf, i f , 1,)
~ .
4. Minimal gs-Machines
339
Thus, in particular, (f,t ) A r = tf so that fAr = f. T h u s the result of .I, is the given partial function f. Now let A' = (Q, i, A) be any minimal gs-machine with result f. T h e function
A: Q - f Q " defined by S(9A) =
(9, S ) A
was shown to be a proper state-mapping of go-modules
Since
iA = f
we may regard A as a state-mapping of gs-machines
A: (Q, i, A)
-
( Q o , f , 2")
Further A is injective since A' is reduced. Since .H is accessible, the image of 1 is the accessible part of ( Q " , f , 1") which is precisely d',. Thus $1:
.a+.kf
is a proper state-mapping which is bijective. Consequently A" is an isomorphism. This proves Theorem 4.1 I T h e argument given above proves much more. We note that the argument is valid without any finiteness assumptions. T h u s we could start with any initial segment-preserving partial function f (i.e., any element f E Q"). Then in general .Hfis a possibly infinite gs-machine with result f. If ./., is finite, i.e., if Qr is finite, thenf is a gsp-function. Conversely suppose that f is a gsp-function. T h e n f = f for some finite gs-machine -&". T h e minimal gs-machine .dar (or . Hra) derived from .I is then also finite. Since .dd"' .Hr it follows that A'f is finite. We thus obtain the following result which is the analog of the quotient criterion for recognizable sets (Theorem III,8.1).
-
XII. Operations on Sequential Machines
3 40
THEOREM 4.2. A n initial segment-preserving partial function f : 2" + r* is a gsp-function if and only if the family of functions
{f *slsES*}
is j n i t e
I
r*
Two partial functions f l , f i : 2" + are said to be compatible (notation: f l 11 f i ) if sfl f 0 f sf2 implies sfl = sfi. Thus
f = f 1 U f i : P +r* is again a partial function. PROPOSITION 4.3.
If f l , f 2 : Z*
+
r* are
compatible gsp-functions,
then
f =f1 uf2 also is a gsp-function. Proof. We observe that f l 11 f 2 implies f, . s 11 f2 . s for every s E 2" and further f . s = f l . s uf 2 * s
Since the families
{ f i * s I s E P} are finite for i = 1, 2, it follows that
{ f .S is finite. Thus f is a gsp-function
J S E Z * }
I
Theorem 4.1 and its proof apply equally well to n-fold gs-machines. In this case f = ( f l , . . . ,f , , ) is an n-tuple of gsp-functions. We only need to replace Qfby
Q f = UQ.,,= { f i . s l s E S * , l < i < n } z
Let . d' be an accessible gs-machine and let d"'be the corresponding minimal gs-machine. Show that there is a unique proper state-mapping p: - / l + L X 'and that this y is a surjective function. Show that this property characterizes (7'uniquely up to an isomorphism. EXERCISE 4.1.
5. Decision Problems
341
5. Decision Problems
I n constructing the reduced quotient Mr of a finite go-module M = (Q, A) it was important to be able to decide when two states q l , q2 E Q are equivalent. This decision problem and two others similar to it will be solved here. Given a go-module ill = (Q, A): L'* + and given two states q l , q2 E 0, the following notations will be used
r*
q1
-
91 q1
if q,A
=
= Qs
if
=
I1
if
q2
qa
qlA
I1
q2A
qJ.
I n the last case we say that q1 and qs are compatible.
-
THEOREM 5.1. For any two states q I , q2 of a ($finite) go-module M , the questions whether q, q 2 , q1 c q 2 , or q1 11 q2 are decidable.
Proof. We shall write q1 E q2 for either of the above three relations. For each integer p 2 0 we also define relations E, approximating E as follows. If E = -, then q1 E,, q2 holds iff ( q I , s ) A = ( q 2 ,s)A for all s E S" with 1 s 5 p . Similarly if E = c , then q1 E, q2 iff ( q l , s)A c ( q 2 ,s)A for all s E 3 with I s I 5 p . If E = 11, then q1 E, q2 signifies p. that (4, , s)A = ( q 2 ,s)A whenever (ql , s)A f (3 f ( q 2 ,s)A and I s I I W e have
E,
2
El
2
...
2
E,
3
...
3
E
and E = UE,. We first show:
(5.1) If P > 1, then q1 E,,, q2 iff q1 E l qe and qlu El, qau for all u E 2 such that qlo f rZ, f q 2 0 . We conduct the proof for E = c ,the other two cases being quite I t 1 = p 1. similar. We must prove that (ql , t ) A c ( q 2 ,t ) A if t E I*, Let t = us. T h e n (q, t)A = (4, o)A(qo,s)A for q = q1 or q = q 2 . Since ( q , , o)A = ( q 2 ,u)A and (qIo,s)A c (q20,s ) A it follows that (ql , t ) A c ( q 2 ,t)n. T h e implication in the other direction is proved similarly. From (5.1) we deduce:
+
(5.2) If E,,
=
E, , then El,,,
=
E,
I.
XII. Operations on Sequential Machines
342
From ( 5 . 2 ) it follows that:
(5.3) If E,,,
=
E,, then E
=
E,.
Next we prove:
(5.4)
Let n
= card
Q. Then E,+,
= E.
Indeed consider the properly descending chain of relations
(5.5)
E,
3
E,
=I . . .
2
Ep
and let ci be the cardinality of the graph of E i for 0 5 i 5 p . Then
n2=c,>cl>
... > c p 2 n
and thus p 5 n2 - n. Consequently if p = n2 - n, then E p = E,,, and thus E p = E. Since for any fixed p the relation E, is computable in a finite number of steps it follows from (5.4) that the relation E is computable in a finite number of steps I I t should be noted that the numerical bound ng - n was obtained using only the fact that the relations Ei are reflexive. Much finer bounds are obtained if we consider the three cases for E separately. If E = -, then E i are equivalence relations. If d i is the number of equivalence classes of Ei, then we have
l=d,
... < d p < n
and this implies p 5 n - 1. Thus we obtain En-l = E. The mod n counter of Example VIII,2.2 shows that the estimate p 5 n - 1 is best possible. If E = c , then the relations E i are reflexive and transitive. It can be shown that in (5.5) we must have p 5 2n - 2. Thus E2,-, = E in this case. If E = 11, then the relations Eiare reflexive and symmetric. If ei denotes the number of unordered pairs ( q l , q 2 ) with q1 f q2 such that q1 E q 2 , then we have
n(n- 1) =e,>e,> 2
... > e , > 0
Thus p 5 n(n - 1 ) / 2 so that En(n-1),2 = E in this case.
6. The Strong Minimization Problem
343
T he relations q1 E q2 we defined for q1 and q2 belonging to the same go-module M . If q, and q, belong to different go-modules M , and M , , then the disjoint union M of Ml and M 2 may be formed and thus q1 and q, may be viewed as belonging to the same go-module. Essentially the same argument that was used to prove (5.1) also proves: PROPOSITION 5.2. If q1 E q, and qla f (21 # q,a, then qla E q,a
I
6. The Strong Minimization Problem
Let f = ( fi,. . . ,f n ) be an n-tuple of gsp-functions f k : L'* P, 1 5 k 5 n. I n Section 4 we solved the problem of finding an n-fold, gs-machine .Asatisfying ---f
f =fa and having the smallest possible number of states. T h e solution was unique up to an isomorphism. T he situation changes radically if the equality above is replaced by the inclusion
f Cfa If df = (Qf, f , I f )is the minimal machine off, then f l , . . . ,f n are the initial states of Af. If i = (i,, . . . , in) are the initial states of A , the inclusion above becomes
fk c ik and implies
for all s E
for
fk
1 5k 5n
s c iks
L'". Since df is accessible we find that for each state
q, of
df there exists a state q of J&? such that qo c q. This observation permits us to dispense with initial states and thus reformulate the problem in terms of go-modules. We consider a fixed go-module Ma = (Po,A,) and consider all gomodules M = (Q, A) such that:
(6.1) For each q, E Qo there exists q QoAo = qA)*
E
Q such that qo
c
q (i.e.,
XII. Operations on Sequential Machines
344
In order to keep this class of go-modules reasonably small we shall also assume: (6.2)
If M‘ is obtained from M by the removal of a single edge, then (6.1) no longer holds for M , and M‘.
Clearly condition (6.2) can be arrived at by removing a number of edges from any M satisfying (6.1). If (6.1) and (6.2) hold, we shall write
We shall be interested in those solutions M = (0, A) of (6.3) for which card Q has the lowest possible value n,. Such solutions of (6.3) will be called extremal. It is clear that extremal solutions are reduced. Since M , satisfies condition (6.1) with respect to itself, it follows that M , < M where M is obtained from M , by the removal of edges. Consequently I card Qo Since we have an upper bound for n o , it is clear that the problem of determining the exact value of n, and of enumerating all the extremal solutions is a finite one. We shall give here a procedure which is a little more systematic than ordinary “trial and error.” T h e procedure is broken up into short steps and simple propositions. These will be explicitly stated and the proofs are left as cxercises for the reader. T h e procedure in question consists of a particular method for constructing a family of extremal go-modules for Mo and then of a proof that all extremals for M , are thus obtained. T h e construction of the particular family involves a good deal of trial and error. Let @‘ be a family of subsets of Q,; thus each element C E ‘&7is a subset of Q,. T h e following properties of these subsets are postulated: (6.4) T h e sets in @ are non-empty. (6.5)
T h e union of the sets in ‘8 is Q,.
(6.6) Any two elements of C (6.7)
E %
are compatible.
For each CE@ and each a~ Zthere exists C’E‘&such that Ca c C‘.
6 . The Strong Minimization Problem
3 45
I t will be shown that the lowest possible cardinality for such a family @' is exactly n, and thus we can restrict our attention to families satisfying = n, card '8
(6.8)
W e now convert '8into a right 2-module by defining C CEgand uEZas:
. IJ
for each
Because of (6.7) we can always achieve (6.10). I n fact this may involve a choice for C . 0,and thus several right S-actions on fl may be obtained. Having converted '6into a right 2-module the output
A:
cgy
z + I'"
is defined by setting
(6.1 1)
(C, I
J ) ~1
U (qn,
u)An
rl0'C
E C are compatible (C, o)A is at most one element. Further (C, a)A f @ iff (q,, IJ)A" 7 for some q, E C. This holds iff q,o f @ for some qo E C, i.e., iff Co f ~3. T h u s by (6.9) we find that (C, I J ) A f @ iff C . CT f @ as it should be. We thus obtain a go-module A2 = (C, A )
Since all q,
[actually several go-modules may thus be obtained due to the choice in (6.1O)]. I t is now easy to prove that if q, E C, then q,A, c CA, i.e., qo c C. T h u s condition (6.1) holds for M o and A!I. Consequently, by removing redundant edges in M , go-modules Ill' are obtained which are extremal for M,. This, in particular, shons that card 6 2 n,. We first show that some of the go-modules M defined above may be rejected. Indeed suppose that for each C E 6 we can find a subset C0 c C such that UC" = QO and that Coo c (C . IJ),.If, further, Cnf C for at least one C E '6 then , we say that the right 2-module 6' is shrinkable. I n this case the family Go = {C"} leads to a go-module Illn = (@, An) which is obtained from h!I by removing edges. Since condition (6.1) still holds for M , and M", me may eliminate the gomodule M . Next we show that all the go-modules extremal for M , will thus be be the obtained. Indeed let M = (Q, A) be such a go-module. Let
XII. Operations on Sequential Machines
346
family of all sets
c, = { q o
I40 E
Qo,
40
41
for all q E Q. I t is easily seen that t5' satisfies (6.5)-(6.7). If, further, any one of the sets C, is empty or if C,, = Cq2for some q l , q2 E Q with q1 # q 2 , then a family 8'satisfying (6.4)-(6.7) will be obtained satisfying card @' < no. Since this is impossible, we conclude that the sets C, are non-empty and distinct and thus card 8 = no. If we now define C, . (T = C,, whenever qa # 0, we obtain go-module (@, A ) which coincides with M except that the states q E Q are replaced by C , E @. is a shrinking of @, then If the right 2-module $3' is shrinkable and go [with the output always defined by (6.11)] also gives a go-module coinciding with M. Thus 6? may be replaced by a shrinking 8,which itself is no longer shrinkable. This shows that all the extremal go-modules for M , are obtained by the procedure described above. It is a by-product of the discussion above that if M , is an o-module (rather than a go-module), then all its extremals also are o-modules.
EXAMPLE 6.1.
Consider the o-module M , 1
2
OfO
3 Here ,Z
=
r = {a, r } . The compatibility 1 /I 2,
conditions are
2 II 3
However, 1 and 3 are incompatible. The families 8satisfying (6.4)-(6.7) and of lowest cardinality are =
For
{1,23},
8 - (12, 3},
@3
=
{12,23}
MIwe have no choice in the module structure. We must set 1*~=23,
l.t=@,
This yields the go-module
which is extremal for M,.
23
*
a = 1,
23
*
t=23
'
6 . The Strong Minimization Problem
3 47
For 8,we similarly have no choice of module structure and the results are the go-module
For 'F3the following actions are forced
However, for 12
.
(T
we have the following two choices
12.0=23
or
12-a=12
Thus two module structure on result. However, both of them are shrinkable, the first one can be shrunk to %, while the second one can be shrunk to g2.Consequently there are only two extremals for M,. EXAMPLE 6.2. Consider the o-module M
2
with Z = T =
(0,r } .
T h e compatibility relations are
1 II 2,
2 II 3,
3 /I 4,
4 II 1
There are two families of lowest cardinality satisfying (6.4)-(6.6) namely
8, = (12, 34},
@ = ', (14,23}
T h e module structures are forced in both cases and the resulting omodules are
Note that both extremals obtained are complete.
XII. Operations on Sequential Machines
348
Note that in both examples considered above the coverings 8,and LF2 of Q are partitions of Q into disjoint sets. For such a covering B‘ of Q [satisfying (6.4)-(6.7)] the following facts are clear: (i) T h e Z-module structure on ($7 is unique. (ii) T h e resulting Z-module @ is unshrinkable. (iii) If M = (@, A) is the go-module obtained, then defining p: Q, + 8 by setting gop = C whenever go E C, a state-mapping p: M , + M is obtained. Further p: Q, + $7 is a surjective function. Let M , = (Q,, A,) be a go-module in which all states are mutually incompatible. Show that M , is its own unique extremal. EXERCISE 6.1.
EXERCISE 6.2. Let M , = (Q,,, Ao) be a go-module and let go, 4,’ be a pair of distinct states which are compatible. Show that there exists a gomodule M = (Q, A ) and a state mapping p: M , + M which is a surjective function, such that q,,p = qo’p.Conclude that no < card Q,. [Hint: Keep adjoining edges to M , until the states go and 9,’ become equivalent.]
Show that if in M ,
(Q,, A,) all states are compatible, then no = 1 and there exists a morphism f: Z* + r* such that q0A, c f f o r all go E Q,. EXERCISE 6.3.
=
7. The Synthesis Problem
Let fi,
. . . ,fn: z*
r*
be length-preserving partial functions. T h e synthesis problem consists of the finding of an o-module M = (Q, A): 2 + r such that
fi c qiA for some states g l , . . . , qn in Q. Further it is required that card Q should be as small as possible. We shall solve this problem under the assumption that the partial functions f i , . . . ,fn are rational. PROPOSITION 7.1. For any length-preserving partial function f: 2% + r* the following properties are equivalent:
(i)
There exists a length-preserving and initial segment-preserving partial function g : 2* + r* such that f c g.
8. Composition of Sequential Machines
3 49
Let A = I)om f and k t be the set of all initial segments of A. There exists a length-preserving and initial segment-preserving partial function .f: V" -+ 1'" with D0m.f = '4. (iii) I f uv, uw E A (where A = Domf ), then (uv)f = zi'zl', (uw)f = u'w' with I u 1 = I u' I . (ii)
Proof, (i) -=- (ii). If g is initial segment-preserving and f c g , then necessarily A c I l o m g . Then f can be taken to be the restriction of g to A. (ii) 3 (iii). This is clear since u' = uf. (iii) 3 (ii). .f is defined by setting u' = uf I I f f satisfies (iii), then we say that f is extendable. T h e extensionfof f is called the closure off; it is uniquely defined and its domain is the set of all initial segments of the set A = Domf. PROPOSITION 7.2. Let the partial function f: V" + I'" be lengthpreserving, extendable, and rational. Then f : P 4P is an sp-function.
Proof. I n view of Theorem XI,5.2, it suffices to prove that f is rational. Let B be the graph off. Since f is length-preserving, we may regard B as a subset of (L'x1')". Sinccf is rational B is a rational subset of L ' " x P and thus by Theorem V11,6,1, B is also a rational subset of ( L ' X I ' ) " . T h u s by Kleene's Theorem B is a recognizable subset of (L'x1')". T h e set B of all initial segments of B is then, by Exercise 11,4.1, also recognizable. T h u s again by Kleene's Theorem B is rational. Since B is the graph of .f it follows that .f is rational I We now return to the synthesis problem. T h e problem clearly has no solution unless f l , . . . ,f n are extendable. Assume then that f l , , . , ,f,, are extendable. I n the synthesis problem we may then replace f l , . . . ,f I L by their closurcs.fl , . . . If, further, f l , . . . ,f,, are rational, then, by Proposition 7.2, f l , . . . , J 1are sp-functions. T h u s the problem becomes the Strong Minimization Problem considered in Section 6.
,XI.
8. Composition of Sequential Machines
Consider output modules
z-r+-n31 ' '11
XII. Operations on Sequential Machines
350 T h e composition
will now be defined as follows: If M
MM’
=
=
(Q, A), M‘
=
(Q’, A‘), then
(Q‘ x Q , 21‘)
with
If M “ : SZ
--f
0 is a third output module, then the associativity
(8.3 1
(MM”,”
=
M(M‘M“)
holds. Indeed, the associativity (AA’)A’’ we compute
((q’’,
4)a = ((4”, =
A(1‘A’‘) is easily checked. Next
QO(%
40)
(q”(q’, (4, a)A)1’, q‘(4, G)A qo)
(Q”, (q‘, 4 ) b = (4”(4‘, =
=
(I,
o)(Al’),(Q‘,Q)U)
(q”(q’, 4, .)(An’),
q ‘ k , o)J-, P)
T h e agreement of the two results shows that (q”, q‘, q)o is defined without ambiguity and this proves (8.3). Now assume that card Q = 1, i.e., the output module M has a single state. Then Q x 2’ and Z may be identified and the output 1 becomes a function A: 2’ I‘,and we may identify M with A. If we further identify Q‘x Q with Q‘, then we find that the composition --f
Z’%Q
is given by
AM‘ = (Q’, 1A‘) q’0 (41,
=
q’(aA)
o)(AA‘)= (q’, 0A)A’
If Z = r a n d 1is the identity, then the above formulas imply AM‘ = M’. Assume that card Q’ = 1. We then identify Q‘ x I’ with r so that M‘ is identified with the output A’: I’ + SZ. If we further identify Q‘ x Q
8. Composition of Sequential Machines
351
with Q, we find that the composition 2%. is given by
MA'
=
(Q, LA')
( 4 , c)(AA')= ( ( q , 0)A)A'
and with action of 2 on Q unchanged. Again if r = Q and A' is the identity, then MA' = hf. If both card Q = card Q' = 1, then M = A and M ' = A' are both functions A: Z + r a n d A': r 4Q. T h e composition M M ' then coincides with the composition Ail' of functions. T h e facts listed above imply that output modules form a category that we shall denote by OM, and that the category of finite sets with functions as morphisms, is a subcategory of OM. Definitions (8.1) and (8.2) of the action and output in M M ' may be extended as (8.1')
(Q', q)s = (4'(4, s v , 4 s )
(8.2')
(q', 4, s)(AA') = (q', (4, s)A)A'
The easy proofs that (8.1) and (8.2) imply (8.1') and (8.2') (by induction on I s I ) are omitted. Observe that in the variable free notation introduced in Section 3, equation (8.2') may be rewritten as (8.2")
k ' l
Q)(AA') = ( d ) ( 4 ' A ' )
If initial states i E Q, i' E Q' are selected, then M and M ' become sequential machines -4 and ..X'. We then convert M M ' into a sequential machine A d ' by choosing (i', i) as an initial state. There results the category SM of sequential machines. Taking ( q ' , q ) = (i', i) in (8.2') we obtain the formula for the results (8.4)
&fnn.= & f & fn
This furnishes an algebraic and constructive proof that the composition of two sp-functions is again an sp-function. This fact has already been noted earlier (Corollary XI,6.4) as a consequence of Theorem XI,6.3. In a similar manner one defines the composition of generalized output modules and generalized sequential machines. Formulas (8.1) and (8.2)
XII. Operations on Sequential Machines
352
may be used as definitions, however, since (q, a)A E r”,in the expression (q’, (q, a)A)A’, 1’ should be the extended output of .d’. A more elegant procedure is to deal entirely with extended behaviors using formulas (8.1‘) and (8.2’). One then proves by easy inductions that (8.1’) indeed converts Q‘ x Q into a right Z’*-module and that 11‘ is an extended output. Formula (8.4) remains valid since it follows from (8.2’). T h e categories obtained are denoted by GOM and GSM. I t should be noted that if card Q = 1, then the go-module M or the gs-machine is identified with the extended output 1: Z‘* + P,which is a morphism. T h u s the category of finitely generated free modules becomes a subcategory of both GOM and GSM. 9. 2-Categories
T h e category OM of output inonoids defined in Section 8 is for the moment unrelated to the categories OM(Z, r ) defined in Section 1 except for the fact that the objects of O M ( 1 , I ’ ) are morphisms in OM. T o complete the algebraic picture of the situation we need one more operation called horizontal composition. T o describe this composition it will be convenient to picture a state-mapping Q1:
M + M ~ :2 j
by the diagram
‘2-
Now given
we define
31
I’
r
9. 2-Categories
353
where q’, q are states of Ad’ and h,f.T h e verification that ip x Q“ so defined is a state-mapping is routine and is left to the reader.
To find the properties of the horizontal composition we consider the following five diagrams
(9.3)
(9.4)
(9.5)
From these diagrams we read of the following properties of the
XII. Operations on Sequential Machines
354
horizontal composition, which we leave for the reader to verify
(9.1’)
(a, x a,’) x a,’’
= ql x
(9.2‘)
11,w = a,
(9.3‘)
a,x 11,
(9.4‘)
1,x
(a,’ x a,”)
= a,
I h P = 1M.W
(a,xa,’)(wxw’)= (a,Y)X (v’w’)
(9.5‘)
T h e algebraic structure thus obtained is called a 2-category (also called a hypercategory). T h u s OM is now a 2-category. In the sequel the horizontal composition will be used only very modestly and thus the fact that OM is a 2-category remains essentially a curiosity for the time being. T h e definition of the horizontal composition given above applies equally well to sequential machines and to generalized output modules and generalized sequential machines. Thus SM, GOM, and GSM become 2-categories. Similarly, 2-categories OM’, SM’, GOM’, GSM’ can be obtained by considering only proper state-mappings. 10. Parallel Products
Given length-preserving partial functions fj:
Zj* + Ti*,
j = 1, 2
the function
f = fl xf,:
(El x &I*
-
(FI
x TZ)*
is defined as follows. Let s E (Elx Z,)*. Then we can write s = (sl, s2) where s1 E Zl*, s, E Z,*, and I s1 I = I s, I. Then
sf = ( S l f i If ,Zl
=
9
s,fA
Z, = 2, then we also define the partial function s(f1 V
f z )=
($1
7
$2)
Note that Dom(flVf,) = Domf, n Domf,. We now carry over these operations to sequential machines. Given sequential machines
Ej+rj, Jj
j = 1, 2
= (Qj, ij, lj)
10. Parallel Products
355
we define the sequential machine
d =u d l ~ Z,X ~ 2z2 :+ r l x r 2 by setting
(Qix Qz (ii > i z ) , 1)
=
9
(41 > 4 2 ) ( ~ 1 ! 0 2 )
(41 9 42 9
=
01 9
= (4101 > 4 2 a 2 )
((41>G l ) A l > (42 %)&) 1
Clearly ffl=
hlx h ,
If Zl= Z2= Z, then we also define the product
AP = -,dlv L ~z:+ rlx r2 by setting A ?
= (419
(Q, x Q 2 , (il,i 2 ) ,1') 42)a =
(QlC,
42a)
(41, 42 > a)l' = ((41, a)11, ( 4 2 9
0)12)
Clearly =iff1
V h 2
T h e two products are not independent and indeed each can be defined using the other one. Let 6: Z* + (ZxZ)* be the very fine morphism defined by ad = (a, a). Then for any Lztfl: Z + rl,dd2:Z 4r2we have (10.1)
Al v .d2= d(Jdlx A2)
Let nj:(Z,x 2,)" + Zj*, j = 1, 2, be the canonical projections. Then for any dj: Zj+Fi, j = 1,2 we have (10.2)
dlx A. = (nldl)v
(7c2d2)
There is a multitude of formal rules that the operations x and V obey with respect to themselves, each other, and the various other operations in the 2-category SM. We only note the following one: If
Zj-Tj-Qj, 45 .r5
j = 1,2
356
XII. Operations o n Sequential Machines
If further Zl = Z2= Z,then
T h e above definitions apply equally well to output modules by omitting all mention of initial states. They do not apply to generalized sequential machines and generalized output modules. EXERCISE 10.1. Tabulate the formal properties of x -product and Vproduct within the 2-category SM.
References S. Ginsburg, “An Introduction to Mathematical Machine Theory,” Addison-Wesley, Reading, Massachusetts, 1962.
This is the first treatment of sequential machines in book form, and contains a good bibliography up to 1962 and historical remarks. T h e topics covered correspond to roughly Sections XI,1-3 and XI1,l-7. I n defining a (non-complete) sequential machine Ginsburg and other authors do not assume that the two partial functions Q x Z Q and Q x 2 + I‘ have the same domain. This has no effect on the essential results, but produces considerable complications. --f
S. Ginsburg and G. F. Rose, A characterization of machine mappings, CanadianJ . Math. 18 (1966), 381-388.
Contains the main results of XI,6. M. P. Schiitzenberger, A remark on finite transducers, Information and Control 4 (1961), 185-1 96.
Contains the definition of bimachines. T h e subject is also discussed by Nivat in the reference listed in Chapter IX. G. N. Raney, Sequential functions, J . Assoc. Comput. Mach. 5 (1958), 177-180.
References
357
Contains the main substance of XII,3-4, for complete sequential machines. This is a remarkable paper since its precision and mathematical clarity are outstanding when compared with the level of writing in this subject in 1958. I t has been inexplicably ignored. Some of the concepts (the “Nerode congruence”) are usually attributed to A. Nerode, Linear automaton transformations, Proc. Amer. Muth. S o r . 9 (1958), 541544.
CHAPTER
Infinite Words
This chapter is concerned with infinite sequences of letters or digits and their interpretation as real numbers. This leads to some rather amusing contacts with topology. 1. The Sets 2~~
Given a finite alphabet 2, we shall consider the set Ev of all functions x: N - 2
Such a function is nothing but a sequence Ox, lx, . . . , nx,
. ..
of elements of L' indexed by N . Omitting the commas, we shall write such a sequence as an infinite word
(Ox)(l x ) . . . ( n x ) ,
or when it is more convenient as XOXl.
Given n
E
. .x,,. . .
N , we denote by x["] the element X [ n ~= X O X I . .
.x,-1
E
27
We call x [ " ]the initial segment of length n of x . If n
358
= 0,
then x[O1= 1.
1. The Sets
F'
359
I t will be useful to introduce the notation
whenever s' is an initial segment of s E Z", and to write s' < s whenever 5 s and s' f s. Given a sequence
s'
. . . <s,,< . . .
s,<s,<
of elements of Z", there exists a unique element x x[kl =
for all n
E
with
s,
12
=
E
.FVsuch that
I s,, 1
N . We shall write x
=
lim sn n +m
In particular, for each x
E
EVwe have x = lim ??+co
A distance function in EVmay be defined by setting, for s, t
E
P',
(s, t ) p = l / n
whenever s[nl f t [ n l ,
and setting (s, s)p
=
S[n-ll
= t[,i-ll
0. T h e usual properties of distance
are easily verified, so that ZLmay +' be regarded as a metric space. I t is important to emphasize that EVis no longer a monoid. However, given s E Z* and t E Z' the product s t E 2''' may be defined by setting st =
lim
s(P1)
n +m
Note that for a fixed s E C", the function t distance and therefore is continuous.
+st
does not increase the
XIII. Infinite Words
360 Note that givcn any integer k 2 0 each s niquely as
E
SVcan be expressed u-
s = ust
with u E P, 1 u = k , s' E 1,"I.n fact u must be sLk1. T h e element s' is called the 12-fold truncation of s and will be denoted ST^. Observe that (s,
t)e
l / ( n t- k )
implies
t d ) p i l/n
(s+,
and therefore the function tk: Z * V + EL'' is continuous. Let f: I* P be a function satisfying: --f
(1.1 ) f is initial segment-preserving. (1.2)
I s I 5 I s f for all
sE
P.
T h e n for s E 2" setting
sfv = lim(s[pzIf) n +m
a function f":
>"
+
pv
is obtained, called the prolongation off. We assert that
(1.3)
(sf", tf")p I (s, t ) e
Indeed if (s, t ) ~: l / n , then dJi1= t [ l 1 1 . Therefore ( s f v ) [ J j l = (tf")'"] by (1.2), and thus (sf", tf"') < ljn. T h e inequality (1.3) implies that f" is continuous. I n particular, every sequential machine d': S + T yields a function fg." : S L Y
-
I
]'.V
Functions obtained in this fashion will be called sequential. Let 12 2 1 be an integer. Any element s of P' yields an element s' of (2)" obtained from s by partitioning it into blocks of length k . T h i s defines a bijection (1.4)
(2L)N
S A
This bijection does not preserve the distance, however, the inequality (3,
q e < l/kn
1. The Sets
361
is equivalent to the inequality ( s ' , t')? < l / n This proves that both functions s + s' and s' (1.4) is a homeomorphism.
+
s are continuous and thus
EXERCISE 1.1. Show that .Y." is a compact topological space, i.e., each injinite sequence of elements of S.\' contains a comergent subsequence. Show given by the distance coincides with the "Cartesian that the topolog-y of .YA~ product" topology of .Y' tiewed as a product of a sequence of copies of the discrete space L.
Show that the function ,f,y': Z.' + P' can be deJined f o r any gs-machine Y : S* + IT* which is alniost positiae in the sense of Exercise XI,3.1. EXERCISE 1.2.
EXERCISE 1.3.
Given a function f : 'S f
. u:
1.y
-
andgiven u
+ l'-y
E
Sx deJne
p
by setting s(f . u) =
(I1S)fT"L'
Show that: f . 1 -f. f . (uv) = (f u ) . v. (ii) (i)
+
(iii) I f f is continuous, then so is f . 21. EXERCISE 1.4.
Call the functiotz f: .Y."
+
Pyfinitary if the family of
functions { f ~ ~ L ~ u E . Y * }
$finite. Show that f is sequential (1.5)
(sf,
iff
tf )"
f is jinitary and
5 (s, t)"
for all s, t E .Y.v, [Hint: Show that under the conditions above f is the prolongation of an initial segment- and Iengtlz-preserving function g : .Y* + f*;then show that g is sequential by the methods of XII,4.] Show that f is the prolongation of a uerjl .fine morphisni g : L* f * z$f (1.5) holds and f . ii = .f f o r all 11 E S*.
-
XIII. Infinite Words
3 62
EXERCISE 1.5. Show that f o r any function f : Ev + Pvthe following properties are equivalent:
f is jinitary and continuous. f is jinitary and there exists an integer k 2 1 such that (s, t ) < l / ( n k ) implies (sf, tf) < I / n . (iii) f = g t k where g : EV4 P is sequential and k 2 1 is an integer. (i) (ii)
+
2. Ultimately Periodic Sequences
A sequence
x: N + Z is said to be periodic if there exists an integer
+ p ) x = nx
(n
p > 0 such that nEN
for all
If we denote s = x[p1 E Zf, then x = lim sn n+m
and we shall write x=s"
A sequence x E P' is said to be ultimately periodic if there exist integers p > 0 and no 2 0 such that (n
+ p ) x = nx
for all n
2 no
Equivalently x is ultimately periodic if
x = ts" for some t
E
Z", s
E
PROPOSITION 2.1.
and only i f for each u
Zf.
The sequence x: N S, the set
--f
S is ultimately periodic
E
A,
=
is a recognizable subset of N.
m-l
=
{ n I nx
=
u}
if
3. Expansion of Real Numbers
363
Proof. Assume x is ultimately periodic and let p > 0 and no 2 0 be integers such that ( n , p ) x = nx for n 2 no. It follows that
+
(2.1)
n+pEA,onEA,
for n > n o
Thus the sets A , are ultimately periodic and thus are recognizable (Proposition V,l.l). Conversely, assume that each of the sets A, is recognizable, i.e., ultimately periodic. There exist then integers p , > 0 and nu 2 0 such that n p , E A, o n E A, for n 2 nu
+
Taking p to be least common multiple of the integers p , and no to be the largest of the integers nu we have (2.1) for all 0 E Z. Equivalently ( n p ) x = nx for n 2 no. T h u s x is ultimately periodic I
+
+ P7 be a sequential function. If x THEOREM 2.2. Let f : is ultimately periodic, then so is xf E P.
E
ZaV
r
Proof. Let JH = (0,i, A): Z + be a complete sequential machine computing f , and let x = uvw with u E Z*, v E Z+. Consider the state q = iu and let n = card Q. Among the states 9, qv, qv2, . . . , 9vu"
there must be a repetition. T h u s q d Then x f = u1vIWwhere
u1 = (i, u d ) A ,
= qd+l
for some 0 5 j < j
v1 = (iuvj, v2)A
+ 1 5 n.
I
3. Expansion of Real Numbers
For any integer h > 1 the function pk: k"
+
[0, 13
is defined by the formula m
i=o
where si is the ith digit of s E kV. Since 0 5 si 5 h - 1 we have
1
3 64
XIII. Infinite Words
Therefore n-1
si
1 kn
(1--
O l iZ =O Kif'-
T h u s the series converges and spk is a real number in the closed interval [0, 11. If x E [0, 11, s E kN and x = spk,then x is called the interpretation of s and s is called an expansion of x at the base k. If s = sOsI...s,. . . , then it will be appropriate to write
x=
.SOS1.
. .s,. . .
T h e following formal rule is useful
for all s E k*, t E k". Another way of expressing the same fact is
where Ow is the function N + k with constant value 0. I n the statements that follow we denote by [XI the integer part of the real number x.
Each real number 0 5 x 5 1 has an expansion
THEOREM 3.1.
x
= .S"SI.
. .s,. . .
with so = [ k ~ ]
(3.3)
si =
[ki+lx]
-
k[kix]
if
i >0
This expansion is unique, except when x
=
u/k"
with u, n E N ,
0 < u < k",
u not divisible by
In this case there are exactly two expansions
(3.4)
x
=
.sdOm,
x
=
.s(d - 1)(k
-
1 ) ~
k
3. Expansion of Real Numbers
365
with s E k",
d
E
k,
I sd I = n,
d .f 0 ,
(sd)vk = u.
The j r s t of these expansions satisjes (3.3). T h e first of the expansions in (3.4) is called the terminating expansion, while the second one is called the non-terminating one. Note that both of them are ultimately periodic. Proof.
From formulas (3.3) we deduce
Since 0<x--=
[knx] kn
knx - [knx] kn
1
it follows that m
- x i=o
so that indeed an expansion of x is obtained.
Suppose x has two expansions
with 0 5 d , < d < k . From (3.1) we then deduce ( d t ) p = (d,t,)p. Applying (3.1) again we obtain d
+ tp
=
d,
+ t1p
This is possible only if d , = d - 1, t p = 0, t l p = 1. Thus t = OfnJ, t , = ( k - l)", and the two expansions of x are exactly those given in (3.3). Setting ZL = (sd)?),n = I sd I we then have x = u/k" as required I A n element s E kLV is ultimately periodic the real number x = sp is rational.
THEOREM 3.2.
if
if
and only
THEOREM 3.3. If an element s E k" is periodic, then sp = p / q with p and q integers such that q is relatively prime to k . Conversely each rational number x = p l q with 0 5 p 5 q and q and k relatively prime admits a
periodic expansion.
XIII. Infinite Words
366 Proofs.
Let
I u I = a,
x = (uv")p,
Iv 1
=
b
Applying (3.1) we obtain
x=-
1 kZb
1
' (uv+-vv+-vv+ kb
ka
. . . + k i1b v v + k i b v ~ p
Thus letting i tend to infinity
Consequently x is rational. If x and obtain
= vmp, then
x=-
we may set u = A , a
=
0,
vv kb - 1
Since k and kb - 1 are relatively prime, x has the required form. Next we prove the second part of Theorem 3.3. Let
First consider the case p = q, i.e., x = 1. Then 1 = .(k - 1)" is a periodic expansion of x. Note that the other expansion of x namely . low is ultimately periodic but not periodic. We may now assume p < q, i.e., x < 1. Since [ x ] = 0, Theorem 3.1 asserts that x has an expansion
x=
.s0.91. . .s,. . .
with si
=
[ k i f l x ] - k[kiCx]
for all i E N . Since (4, K) = 1, it follows from a general theorem in number theory that k a - 1 modq for some integer a
2 1. T h u s k"
= bq
+1
3. Expansion of Real Numbers
367
for some b E N . Therefore
and thus x = vWwith v = so.. . s , _ ~ . Next assume that x = p / q < 1 is a rational number. Multiplying p and q by a suitable integer we may assume that
x=-
1 ka
(r + -
: ' I )
and since x < 1 we have r < ka. There is then u E k" such that I u and U Y = r. By what we proved earlier we have
for some v
E
I =a
k". Thus by (3.1) 1 ka
x = - [UY
+
(V")/A]
= (uv")p
EXERCISE 3.1. For any elements s, t conditions are equivalent :
(i) s p = P for some integers p , q (ii) s, t E u x for some u E Z".
E
E
I
Z*, show that the following
N , p > 0 , q > 0.
Let s = uvm. If I v I = p is smallest possible, and ;f further, assuming I v I = p , I u I is smallest possible, then we say that uv" is the minimal representation of s. Show that ;f uv" is the minimal representation of s and ;f s = u'vfm,then I u I 5 I u' 1. I f , further, I u I = I u' I, then v' E v x . [Hint: Use Exercise 3.1.1 EXERCISE 3.2.
XIII. Infinite Words
368 EXERCISE 3.3.
Given any unambiguous subset A of N and given any
k > 1 consider the element
Show that s.,~is ultimately periodic zf A is ultimately periodic. Deduce that I . .A is a rational set. Show that ;f f 2 i is the generating function of A, then 1
sA4pU,, is a rational number
sAPU, = k f A ( i )
4. Infinite Digital Computation
The function
PROPOSITION 4.1.
p k : kLV+ [0, 11
is continuous and surjective. Proof.
Theorem 3.1 implies that pk is surjective. If s, t (s, t ) e <
i.e., if the first n digits of s and t agree, then s = us',
with I u
I = n.
t
=
ut'
Then by (3.1)
I Spk
-
T h u s pk is continuous
tpa
1
1
I = __ I S I P k - t'Pk I 5 kn kTi ~
I
Consider a continuous function f: k'v + 1"
with k, 1 2 2. We shall say that f is consistent if ~ 1 ~2,
E
kN,
s1pk
implies SIfP1 =
SdP1
=
s2pk
E
k"' and
4. Infinite Digital Computation
369
This is equivalent to the existence of a function
f‘: [0,11
-
[O, 11
such that the diagram
k“ f fiv
commutes. We show that f r is continuous. Indeed, since f and p1are continuous, it follows that pi f r is continuous. Since pA. is surjective and continuous and both kLV and [0, 11 are compact metric spaces, the continuity of f is implied by a standard theorem in general topology. I n the case when f is a prolongation f = g A v of a function g satisfying (1.1) and (1.2) a more effective argument for the continuity o f f may be given. Consider the closed interval ; I
I,, with 0
=
[+-
’
&]
5 n, 1 5 i 5 kT1.T h e left end point has an expansion s1 =
tOltJ,
t
E
k”p’
while the right end point has an expansion s,
=
t(k
-
l)cu
with the same t. Further all the points in I,,,have an expansion starting with t. Consequently all the real numbers in the set I,,,f‘ will have an expansion starting out with the word tg. Since I tg I 2 n - 1 it follows that diam(I,,,f r ) 5 1 / P
If we now consider two points x,, x2 E [0, 11 such that
I x1 - xa I 5 Ilk” then either x1 and x2 are both in some interval I,,,or in the union I,, u I ) 8 ( L +ofl , two consecutive such intervals. Consequently
I Xlf7 - X 2 f ‘ I 5 2/11? This shows the uniform continuity of f’ with explicit bounds.
XIII. Infinite Words
370
A sequential machine d ' :k
---f
1 is said to be consistent if the function
j"8: kN + 1.'
is consistent. T h e continuous function
f a ' : [O, 11
-
[O, 11
thus obtained is called the real result of d&. Functions f: [0, 11 + [0, 11 which are obtainable in this fashion are called sequential for the bases
(k,1:. T h e identity function f: [0, 11 + [0, 11 and the function x + 1 - x are sequential for the bases (k,k). I n fact, f may be obtained using a very fine morphism p: k" + k". I n the first case ip = i while in the second one ip = k - 1 - i. EXAMPLE 4.1.
-
Let k = k,k, with k,, k, 2 2. T h e function (i,j ) + ik, j yields a bijection k, x k, k. Using the inverse of this bijection every s E k" may be written in the form EXAMPLE 4.2.
+
with u , ~E k, , t,,E k,. There result functions nj: kLV+ kiN,
i = 1, 2
defined by 000,.
. .0,,. . .
= tot,.
. . t J J. ..
sn, =
snz
These functions are easily seen to be sequential (and therefore also continuous). However, easy examples show that they are not consistent. PROPOSITION 4.2. I f f : [0, 11 + [0, 11 is sequential f o r the basis (k,I ) , then f maps rational numbers into rational numbers. Proof.
This follows from Theorems 2.2 and 3.2
1
Consider the function f: k-"+ k" given by sf = 0s. Show that this function is consistent and yields the function [0, 11 + [0,1] given by x xlk. Show that f is sequential. EXERCISE 4.1. --f
5. The Peano Curve
3 71
EXERCISE 4.2. Consider the truncationfunction r : kr + k-”dejined hy (is)r = s for i E k, s E k”. Show that T is consistent and yields the function x k x - [ k x ] where [ k x ] is the integral part of kx. Show that this function is not sequential. ---f
EXERCISE 4.3. Show that an almost positive cgs-machine A:k* -+ such that the triangle
k -’
“,f
P,
1“
commutes, exists zff k and 1 are multiplicatively dependent (see V , 3 ) . 5. The Peano Curve
I n 1890 Giuseppe Peano published an example of a continuous function
h : [0, 11
-
[0, I]x [0, 11
which is surjective. This is the “square-filling curve” of Peano. T w o functions f , g : [O, 11 [O, 13
-
were defined and
xh
=
(4xg)
T h e functions f and g were described by Peano in a digital manner using base 3. Actually base 9 is used for the expansions of the argument x, however, thanks to the bijection
3x3
-
9
given by
( i , j )= 3i + - j base 3 notation is used. We shall show that the functions f and g defined by Peano are sequential. We start by considering the cs-machine
3x3-3
XIII. Infinite Words
3 72
with
dJ = (2, 0, A ) Thus there are two states 0 and 1 with 0 as initial state. However, it will be convenient to regard any integer as representing the state congruent to it mod 2. We convert 2 into a right 3x3-module by setting
T h e output function
A: 2 ~ 3 x 3 - 3 is given by
where for n even for n odd
a
a.n={ 2-a T h e result f":
(3X3)LV
-
3'V
transforms
into S f N = COCl.
. .c,, . . .
given by
We show that f" is consistent. For this we must show that if s, s' E (3x 3).y represent the same real number, then so do sfVand s'f". Assume then that
( a p ,b p ) = (0, 0) ( 6 7 ,
for all
p >n
b,) f (0, 0)
(a,', bp') = (2, 2) ( a p ' ,b p ' ) = (a,, h p )
p >n for all p < n for all
5. The Peano Curve
373
T w o cases now must be considered. If b, f 0, then
Setting k
=
+ . . . + b,
b,
we have
for all m 2 n. T h u s c,,, = c,,,' for all ?n 2 n. Since also c,,, = c,' m < n it follows that s l f ~=~ sf If b,, = 0, then we must have a,, f 0 and thus
for
lv.
With k defined as above we then have C,
=
ar, . k ,
cP = 0
'
c ~ , '= (u,, -
k,
cI,' =
1) * k
2 .k
for
p >n
with c p = cp' for p < n. If k is even, then clearly sf$' is the terminating expansion while s'fv is the non-terminating expansion of the same real number. If k is odd, the formulas above yield c,, = 2 c,, =
-
a,, ,
2,
c,,' =
3
-
a,,
cl,' = 0
for
p >n
Since a,, f 0 we have c,, = c,,' - 1. T h u s in this case s'fv is the terminating expansion while sfv is the non-terminating expansion of the same number. T h u s f" is consistent and defines a continuous function
f =f':
[O, 13 -+ "1, 11
T o obtain the second coordinate g of the Peano function h, another cs-machine ~ i 3: x 3 --* 3 is defined by replacing formulas (5.1) and (5.2) by
(5.1')
(5.2')
4(a, b ) = 4 (4, a, h)A = b
*
+a (4
+ a)
T h e function
g-": (3x 3)" + 3."
XIII. Infinite Words
374
transforms s given by (5.3) into
~g" = d,d,. . . d , . . given by
T h e verification that the machine &is consistent is similar to the one above and is left to the reader. There results a continuous function g: [ 0, 13 [O, 11. We claim that the resulting function h : [0, 11 + [0, 112 given by xh = (xf,xg) is surjective. Indeed, formulas (5.4) and (5.4') are equivalent with --j
an = c, b , = dn
Since, further, a,
s c,
+
*
(b, (a0
+ . . . + b,-l),
+ . . + an)
a, = c,
*
and 6, = d , mod 2, the formulas above yield
This shows that s = a,b,a,b,. . .arrbn.. . is uniquely determined by . . and sg" = d,d,. . .d,. . . . I n fact the function
sfw = cocl.. .c,.
(3x3)"
+(
3x3)N
given by the two functions f N and g" is bijective. The two coordinates f and g of the Peano function have many remarkable properties. We first examine the function f from the point of view of differentiability. Consider any x E [0, l ] and let s given by (5.3) be an expansion of x. Choose any integer n 2 0 and let s' be the sequence obtained from s by modifying the value of a,, by a unit (for instance a,' = a, - 1 if a, > 0 and a,' = 1 if a, = 0). If y is the real number represented by s', then
If we now consider sf and s'f, we find they will differ only in the nth digit and the difference there will be *l. Thus
5. The Peano Curve
375
Consequently
Ixf-~fI - 3"+1 Ix-YI and therefore the function f is nowhere differentiable. T h e same applies to the function g. T h e two functions f and g are also known to be independent in the sense of probability theory. This means that for any two measurable subsets A and B of [0, 13 we have meas(Af--l) meas(Bg-')
=
meas(Af-l n Bg-l)
EXERCISE 5.1. Show that for a given ( y , z ) E [0, 112 the equation xh = ( y , z ) has at most four solutions. Describe those pairs ( y , z )for which there are exactly four, three, or two solutions. EXERCISE 5.2. Let
p 2 1 be an integer. Divide the interval [0, 13 into
9p equal intervals and divide the square [0, 112 into 9p equal squares by dividing the sides into 3p equal intervals. Show that h maps each of the 9p subintervals of [0, 13 onto one of the 9p subsquares of [0, 112. Join the centers of squares corresponding to adjacent intervals. Show that for p = 1 the resulting figure i s as shown in Fig.1, Draw the figures for p = 2 and p = 3.
Figure 1
EXERCISE 5.3. The surjective function h : [O, 13 + [0, 112 will produce surjectivefunctions [0, 11 + [0, l]", n > 2 by various iterations. However, one can also proceed by setting up n cs-machines
3" + 3 using a method analogous to the one in the text. Carry out these constructions for n = 3 and for a general n. Replace base 3 by any odd k > 1.
XIII. Infinite Words
376 EXERCISE 5.4. Consider the sequential machine
A: 3 ~ 2 + 2 A= (2,0,
dejined as
A)
+a b . (4 + a )
q(a, b ) = 4 (4, a, b ) l =
where for b
= 0,
1
ban={
tpb
for n even for n odd
+
b, Show that i f 3 x 2 is identz$ed with 6 using the mapping ( a , b ) + 2a the cs-machine is consistent and defines a function f: [O, 11 [O, 11. Show that this function is nowhere dzfferentiable. Replace in the above, the pair ( 3 , 2 ) by any pair of integers ( p , q ) provided p is odd. For ( p , 4 ) = ( 3 , 3 ) , the second coordinate of the Peano curve is obtained. Draw piecewise linear approximations to the functions obtained above. --f
6. The Hilbert Curve
As a sequel to Peano’s 1890 paper Hilbert published in 1891 a short note in which he proposed a different construction. Hilbert’s construction uses base 2 and is geometric. Actually, the construction is not carried out in detail but is suggested by Figs. 2-4.
Figure 2
Figure 3
Figure 4
We shall construct explicitly a sequential machine that realizes Hilbert’s construction. T h e verification that the machine does what it should is left as an exercise for the reader.
6. The Hilbert Curve
3 77
Let G be the “four group” with elements
up = P(z,
1, u,p,
$=
1 = P’
Actually G is the product Z , x 2, of two cyclic groups of order 2. T h e set 2 x 2 is converted into a right G-module by setting
( a , 0)u = (0, a )
( a , b)p = (1
-
0, 1 - a )
We shall also need the function y: 2X2+2X2
(a,b)y
=
(a, I
-0
I)
T h e cs-machine &: 2 x 2 - 2 x 2
is defined by setting &?=
g(a,b) =
1
(G, 1, A) ( a , 0 ) = (0, 0) ( a , 0 ) = (1, 1) otherwise
gu gP
if
if
g
(g, a , 0 ) l
=
( a , 0)y
Breaking up the output into its two coordinates yields two cs-machines
2x2
-,fli:
Using the bijection 2 x 2 regard L&?i as cs-machines
-
-
2,
i = 1, 2
4 given by ( a , 0 )
-di: 4 - + 2,
-
2a $- 0 , permits us to
i = 1, 2
A detailed argument is needed to prove that these machines are consistent. There result two continuous functions
-
f , g : [(A 11 which yield a function
h : [0, 11 by setting xh
=
[O, 11
[0, 11’
(xf,xg). This is the Hilbert curve.
XIII. Infinite Words
378 References
J. W. Hellerman, W. L. Duda and S. Winograd, Continuity and realizability of sequence trasformations, IEEE Trans. Electronic Computers EC-15 (1966), 560-569.
Contains the subject matter of Exercises 1.3-1.5. G. Peano, Sur une courbe qui remplit toute une aire plane, Math. Ann. 36 (1880), 157160.
A pioneering paper, remarkably written. D. Hilbert, Ueber die stetige Abbildungen einer L i n k auf ein Flachenstuck, Math. Ann.
38 (1891), 459-460.
A follow-up paper to Peano’s. H. Steinhaus, La courbe de Peano et les fonctions independantes, C . R. Acad. Sci. Paris 202 (1936), 1961-1963; also: Sur le courbe Peanienne de M. Sierpinski, Comment. Math. Helv. 9 (1937), 166-169.
Probabilistic properties of the Peano and related functions are discussed. A. R. Butz, Space filling curves and mathematical programming, Information and Control 12 (1968), 315-320; also: Convergence with Hilbert’s space filling curve, J . Comp. System Sci. 3 (1969), 128-146.
CHAPTER
XIV
Infinite Behavior of Finite Automata
In this chapter we investigate the situation when infinite words are tested by finite automata. Surprisingly there is a distinct difference between deterministic and non-deterministic automata.
1. Main Definitions and Results
Given any subset A of L'* we consider all the elements x of L'A"which have infinitely many initial segments on A. T h e subset of Z N thus obtained is called the closure of A and is denoted by 2. Thus x E A iff x = lim,,,, a, for some sequence a, < < . . . < a, < . . . of elements of A. In other words, x E 3 iff x["l E A for infinitely many indices n E N . We note some formal rules of the closure
(1.1) A u B
=
A u B. -
(1.2)
If A is a prefix, then A B
=
AB and A = 0.
Indeed, if x E E" has infinitely many initial segments in A u B , then infinitely many of them must be in A or in B. If x = limn,m anbn with ar,bn< an+,b,+l and if A is a prefix, then necessarily a , = a,,, and b, < b,, Thus setting a = a, and y = lim b,, we have x = ay and Y E
E.
Closely related to the closure follows. For any sequence x: N
A ---f
is the subset Atu of 2." defined as A n Z+ define y n = xo. . .x,,-,, and
379
XIV. Infinite Behavior of Finite Automata
380
let x = limtL+mytl. Then Au is the set of sequences x this manner. -
E
2." obtained in
-
(1.3) Aw c A+ = A". -
-
(1.4) If A is a prefix, then Am= A+ = A". (1.5) If A is a prefix, then
=
AB.,. -
Relation (1.3) is clear. T o prove (1.4) assume x E A+. Then x with y o < y, < . . . < yrL< . . . elements of A+. Let
yn = a,.
. .U k ,
=
lim y n
y,,+,= 6,. . .b,
with a , , . . . , a,, b , , . . . , bl E A + .Since ytt < y,,+,and A is a prefix, it follows that k < 1 and a , = b i for 1 5 i 5 k. Thus y,, +, E yr,A+.This Relation (1.5) is clear. shows that x E AUJ. Let = (Q, I , T ) be a 2-automaton (not necessarily deterministic) and let x E Ev. An ro-path in d with label x is defined as an element p E QLvsuch that for each n E N
Pn
rn
Pni,
is an edge in d. We define In(p) = { q I q E Q and q = p,, for infinitely many n E N } . T h u s In(p) is the set of all states through which p passes infinitely many times. T h e o-path p is called successful if
p , I~
and
In(p) n T f
0
T h e set of all labels of successful co-paths is denoted by 11 &' 11. This is a subset of z=Y. We shall regard /I JP' / I as a A-subset ignoring multiplicities. PROPOSITION 1.I. For each 2-automaton ,d
If ,d is deterministic, then
11 d Ij = I <-d I
(1.7)
Let d =((3, I, T ) and let p E Q L be ~ a successful co-path with label x E Ev. Then p, E I and p,, E T for infinitely many
Proof.
in
&*'
1. Main Definitions and Results
381
indices n E N . For each such an index n
is a successful path with label x["]. T h u s x"?] E I d 1 for infinitely many values of n and consequently x E I ,w' I. If , w ' is deterministic and x E I ,W' 1, then XI',]E 1 ,W' I for infinitely many values of n. T h u s settingp, = ix[l]for a l l j E N we obtain a successful o-path with label x. T h u s x E 11 II I C O R O L L A R Y 1.2. Let ,W' be a deterministic C-automaton and let -dC be its completion. Then (1 M' (1 = (1 < d//r 1
We shall show in Example 4.1 that for non-deterministic automata the equality 1) cd1) = 1 ,W' 1 docs not generally hold. T H E O R E M 1.3.
For any subset A of S* the following conditions are
equivalent : A is in the class Rec of all closures of recognizable sets. There exists a deterministic Zautomaton ,3=( Q , i, T ) such that A = /j ,w' 1 . (iii) A is a finite union of sets B P with B and C recognizable prefixes in S". (i) (ii)
Proof. (i) o (ii). This is a direct consequence of the equality (1.7) in Proposition 1.1. (i) o (iii). Any recognizable subset A of X" has, by IV,6.1, a representation (1.8)
A
=
B,C," u . . . u B,,C,,"
where B , , . . . , B,,, C , , . . . , C,, are recognizable prefixes. From ( l . l ) , (1.4), and (1.5) we deduce
A = B1ClW+ . . . + Bl,Cl,(U Conversely if
D
=
+ . . . + B,C,,LU
B1Clc"
where B , , . . . , B,,, C , , . , , , C,, are recognizable prefixes, then D with A defined by (1.8)
=
2
XIV. Infinite Behavior of Finite Automata
3 82
There exists another more restricted notion of a successful path than the one introduced above. For this we require an automaton (deterministic or not) &'= ((3, I , T) in which T instead of a single subset of Q is a family of such subsets. An w-path p E EVwith label x E EVis called strictly successful if
P,E I
and
In@) E T
The set of labels of all the strictly successful w-paths is denoted by
I d I. THEOREM 1.4. (Buchi-McNaughton) following conditions are equivalent :
For any subset A of 2" the
E.
A is in the Boolean closure R XB of the family There exists a deterministic Z-automaton &' = ( Q , i, T)with a family of terminal sets such that A = I d 1. (iii) There exists a 2-automaton &' = ( Q , i, T)with a famiZy of terminal sets such that A = I ,d1. (iv) There exists a C-automaton &'= (Q, i, T ) such that A = I d 1. (v) A is thejinite union of sets B C w with B- and C-recognizable subsets (i) (ii)
of C". (vi) A is thejinite union of sets BC with B- and C-recognizable subsets of Z+. T h e proof is given in Section 3 after an important auxiliary result is established in Section 2. In Example 4.1 it will be shown that the classes dealt with in Theorems 1.3 and 1.4 are distinct, i.e., that E c is not closed under Boolean operations. EXERCISE 1.1.
Show that i f B is a prejix, then A - B
EXERCISE 1.2.
Show that Acu= (A+)w =
=
A.
EXERCISE 1.3. Show that for each automaton d there exists an automaton d' with a single initial state such that 1) d 1) = 11 d'I), and that d ' can be constructed to be deterministic i f & is deterministic. Establish a similar result for I d I .
383
2. An Auxiliary Proposition 2. An Auxiliary Proposition
In preparation for the proof of Theorem 1.4 we prove: PROPOSITION 2.1. For each recognizable subset A of 2+ there exists a recognizable subset C of Z+ such that
AUI= A+C Let denote the right congruence of the set A+. Thus s2 iff s;lA+ = silA+. Let s E Z+. A factorization
Proof.
s1
N
N
s = at
of s is called a principal factorization if the following conditions are satisfied :
(2.1) a E A+, s t . (2.2) If s = a't' with a' N
(2.3) If t' 5 t and at'
-
E
A , a 5 a', and s
-
t', then a
= a'
and t
=
t'.
t', then t' = t .
Let C be the set of all those elements s of Z+ for which a principal factorization s = at exists. Clearly the principal factorization of s is unique. The proposition follows from the following three statements : (2.4)
c c Am.
(2.5) Aw c A+C.
(2.6) C is recognizable.
c.
To prove (2.4) consider x E Thus x E EVand x = limn+mc, with c, E C and c, < c,+,. Let c, = a,2t,L be the principal factorization. Then a, < a,+, and therefore x = limn+wa,. For each n, there exists p > n such that an 5 C n < a p
-
Let d = ai'a, so that a, = a,,d. Since t,, 5 d and arltn= c,, t , , it follows that u p = and d. Since up E A+ it follows that d E A+. Thus for each n we have up E a,Af for some p > n. Since a,, E A+ it follows readily that x E A w .
-
3 84
XIV. Infinite Behavior of Finite Automata
T o prove (2.5) consider
x
(2.7)
=
aOal.. .a,.
..
with
a,, E A+
Suppose for the moment that the sequence {a,,} satisfies also
a,,a,,,
(2.8)
-
for all n > 0
a,+,
Then by iteration we have (2.9 1
-
a,* . .an+, a,, t~
From the definition of the set C it then follows that there exist c,, E C such that a,. . .a,, 5 c,, I a,. . .a,+,
-
Setting c = lim c,, we have c E C and c = a 1 a 2 . ..a,,. . . . Thus x = a,c E A+C. We must now show that given (2.7), the sequence {a,,} can be chosen so that (2.8) also holds. Given integers n, m E N , define n = m if there exists an integer p 2 n, m such that
a,,. . . a p p l
(2.10) or equivalently if
-
a,,, , . .appl
-
a[~ll-la[Pl a[~nl-la[pl
(2.11)
-
-
Since is a finite equivalence relation in Z*, it follows that is a finite equivalence relation in N . Indeed let uA+ be the cardinality of Z*/and let n,. . .nl be integers with k = 1 uA+. Then for p 2 n , for all 1 5 i 5 k the congruence classes of the elements a[n+la[pl cannot be all distinct. Thus card N / - 5 nA-’. Since N / = is finite, one of the equivalence classes S of N mod must be infinite. Let k , < k, be the smallest elements in S. Assuming that the elements k, < k, < . . , < k, of S are already defined for some n > 0 define k,,,, as the smallest element of S for which (2.10) [or (2.11)] holds with n, m,p replaced by klIpl, k, , k, t l . Then setting
+
a,.
. .ako-, = d k u I
b,
=
6,
= aln-, . . . aEnpl=
we have b,,b,,+,
-
b,,,
u[kn-ll-la[knl
for all n > 0 as required.
if
n >0
2. An Auxiliary Proposition
385
I t remains to be shown that C is recognizable. T o do this we employ a general method which may be called "separation of variables." T h e essence of this method is the use of any number of disjoint alphabets El, X,,. . . each of which is in a fixed 1-1 correspondence with L'. For each subset S of Z*, X iwill denote the corresponding subset of Xi*. Given a factorization s = at of an element s E
Z*, we consider the element ZL =
T h e condition a
E
a,t,
.Zl*.Y2*c (2,u 2,)*
E
A+ then translates into
and this determines a recognizable subset of (XI u S,)". T o express the condition at t in terms of u we proceed as follows: Let ,3 = (Q, i, T ) be the minimal automaton of A+. T h e n the sets
-
[ql
= i-'g,
q6
Q
are the equivalence classes of the relation -. T h e condition at may now be written as
-
t
E
[q]
u E Z,*[ql, n ([4197+)
where p: (El u 2,)" 4 Z*is the very fine morphism which maps each letter of .XI u 1,into the corresponding letter of Z.T h u s we are lead to consider the set
D
=
u Al+[4l, n ([qlp-') f/
This is the set of elements zi = a,t, with a E A+, at Condition (2.2) may be reformulated as follows:
(2.2') If t
=
bt', ab
E
A-+-, and t
-
t ' , then t
=
-
t.
t' and b
=
We are thus led to consider factorizations
s = abt' and corresponding elements v
= a,b,t,'
E
Z,*Z,*E,* c (El u Z3u Z2)*
1.
XIV. Infinite Behavior of Finite Automata
386 The conditions
ab E A+,
b # 1,
bt‘
-
t’
determine a recognizable subset E of (Zl u 1,LJ Z,)*. Imposing condition (2.2) amounts to replacing the set D by
C
- Ey
where y : (Zl u 2, u Z2)+4 (Z, LJ Z2)* is the very fine morphism, replacing each letter of 2-, by the corresponding letter of Zl, and leaving alone the letters of Zland C,. Condition (2.3) is handled in the same manner. As a result we find that the set of all elements u = a$, corresponding to elements s = at E C given in a principal factorization is a recognizable subset F of (Zl v Z2)*.Since C = F ~itI follows that C is recognizable I 3. Proof of Theorem 1.4
T h e proof follows the following pattern (i)
(iv)
--
0 All
(ii) => (iii)
(v)
(vi) => (ii)
(i) o (ii). Let R denote the class of subsets A of Z* for which (ii) holds. We first show that G c c R. Let A E G. By Theorem 1.3, there exists a deterministic 1-automaton &’= (Q, i, T ) such that A = 11 &’ 11. Define
T={XIXcQ, X n T f @ ) and let d’ = (Q, i, T). Then I/ d 11 = I d’ I and thus A E R. To prove that K c U c R it suffices to show that R is closed under complementation and intersection. Then let A = I d I with d =(Q, i, T)be a complete (deterministic) automaton with a family T of terminal sets. Let T‘ be the complement of T viewed as a subset of 29. Then setting d’ = (Q, i, T’) we find that I &’’ I is the complement Z* - A of A. Thus 2+- A E R.
3. Proof of Theorem 1.4
387
Let A , , A , E R and let
Aj
I
=
d
I,
j
d
where dj are deterministic for j
=
j
=
( Q j , ij, Tj)
1, 2. Then
=
I dI
x Q 2 , (ii
iz), T)
A, n A, with J/ =
(Qi
9
T = ( X X Y I X E T ~ , YET^} Thus A , n A , E R. To show that R c L c B consider A = I d I with d = (Q, i, T) deterministic. We note the following formulas
A = (J I ( Q , i, T)I TET
I (Q, i, T ) I where
BT =
BT - CT
u 11 (Q, i, t ) 11
te T
CT = 11
--
=
(Q, i, Q - T )
Thus by Theorem 1.3, A E K c ” . (ii) (iii). Obvious. (iii) (v). Let A = I d I with A = (Q, i, T) deterministic. Let T E T and let t , , . . . , t, be an enumeration of the states in T. Define
BT = I
(Q, i, t n ) I
CT = I ( T , t n , ti)
I
I ( T ,t n - 1 , t,) I
Then it is easy to see that
I (Q, i, T ) I = BTC?TW and consequently
uYzl
BiCiWwhere B iand Ci are recognizable (v) =+ (iv). Let A = subsets of 2*. Without any loss we may assume that Cic Z+. Then be replacing B iby B,$( we may also assume that B i c Z+. Let 9i, normalized (not necessarily deterministic) &automata such that I gi1 = B i , I gi I = Ci for 1 5 iC n.
XIV. Infinite Behavior of Finite Automata
388
Construct the automaton &' by the scheme
-
with T = { t l , . . . , t , } as terminal set. Then JJd 11 = U BiCim= A as required. (iv) (iii). Let A = Jj &' )I with d =(Q, i, T ) . Define
T={XIXcQ, X n T f 0 } Then
-
I ( Q , i, T ) I = 11
I(
=
A
as required. (vi). This follows from Proposition 2.1. (v) (vi) * (ii). Let A = Ur=l B,C, with B , , C, recognizable subsets of S+.Since the class of sets for which (ii) holds is closed under union, it suffices to consider the case n = 1. Thus A = BC with B and C recognizable subsets of C",and with B c Z+. Let ,9?= (P ,P o , S ) , @ = (Q, 4 0 1 T ) be complete (deterministic) automata such that
I ,9I = B ,
1'8 =C
We shall consider words v in Q*, Such a word v is called simple if no letter in it is repeated. Thus there are exactly 2cardQ simple words. With ant v E Q* we associate the simple word [a]obtained from a by keeping only the leftmost appearance of any letter a appearing in v. Let v = q l . . .q,&be a simple word in Q*. Given a E Z we define
This word need not be simple and therefore we may have I [va] I < n. Let K be the largest integer 5 n such that qla, . . . , qka are distinct. This integer K will be called the index of the transition v + v o and will
3. Proof of Theorem 1.4
389
be denoted by I,,,,. Observe that 1 5 Zv,, 5 I z, I if I z, I f 0. If z, = 1 we define lu,, = 0. We now define a complete 1-automaton a’= (R, r o , T) with a family of terminal sets. T h e states are triples
where p E P, v is a simple word in Q*, and 0 5 1 5 I z’ 1 is an integer. T h e initial state is ro = ( P o , 1 , O ) T h e action of Z is defined by
( P , 2.’, 1).
=
{
lu,,)
(P.9
[7301,
(P.3
[(~a>sol, 4p)
if P O $ S if Pa E s
T o define the family of sets T we consider any integer 1 5 k 5 card Q and define
D, = { ( p , z,, I )
E
R I 1 > 0 and kth letter of
z,
is in T }
{(PI 1) E R I k I I} T k = { X l X c E,, X n D k # @} T = T , u ... uT,, n = cardQ Ek =
Q,
To conclude the proof it suffices to show that
(3.1)
I LdI = Bzc
Consider a sequence x: N + 2 and let r : R + Z be the corresponding ‘ and with r i f l == r i x i . To prove sequence with ro the initial state of a equality (3.1) we must prove:
(3.2) x E BC iff there exists an integer k such that r i E E, for all i sufficiently large, and r i E D, for infinitely many indices i E N.
c.
Let ri = (pi, v i , li). Assume that x = b-y with b E B and y E Let = j . Since B c .2+we have j > 0. I t follows that p j E S and therefore qo is a letter of vj. Consequently qoy[)ilis a letter v ; + ~ ,say the d,th letter counting from the left. Since d,, 2 d,,,, 2 dn+, 2 . . ., it follows that there exist integers k and no such that d,, = k for all n 2 no. From the definition of the action in a’it follows that I,, 2 k for all n > no. T h u s rj+, E Ek for all n > n o . Since, further, y E C it follows that
IbI
XIV. Infinite Behavior of Finite Automata
390
qoy[nlE T for infinitely many indices n 2 no. Thus y j + , , E D, for infinitely many indices n. Conversely assume that an index i , is given such that r i E Ek for all i 2 in and that y i E Dk for infinitely many indices i. Let q be the kth letter in v i , . From the description of the automaton &' it follows that there is a factorization x = a y with I a I = J, 0 < j 5 k such that p j E S and q = q,,y[iO-il. I t follows that a E A. For n 2 i, - J , qoy["1is the kth letter of vj,+,. Since infinitely many of these letters are in T it follows that y E c I Show that the construction given in the proof of (ii) applies also in the case B c 2" (rather than B c Z+)provided (vi) the initial state of A is defined as r, = ( p , , q,, 1) whenever 1 E B. EXERCISE 3.1.
4. Examples and Exercises EXAMPLE 4.1.
With C = {a, r } consider the subset
A
=
Z:"ato
of ,ZN.This is the set of all sequences x in ZNin which a appears a finite but non-zero number of times. If we consider the non-deterministic automaton
d : u , r E i ~ . t 3 r then
A
I &' I = 11 d . 1 1 =
-
Thus by Theorem 1.4,A E Rec". We shall now show that A is not in Rec. This will prove that the class Rec is not closed under Boolean operations. In fact we shall prove that there is no subset B of C" (recognizable or not) such that A = B. Indeed, assume that A = B . For any 0 E C we have sat* E A , and therefore sai? E B for infinitely many integers i. Let (s) be the smallest such n. Consider the elements so = 1,
sntl= ~ , a t ( ' n )
E
B
and let s = limn+- s,. Then s E B, but s E A since s has infinitely many a's. We now proceed to construct a deterministic automaton A?= ( R ,
4. Examples and Exercises yo,
T) such that A A
=
391
I d I. We utilize the representation
=
BC,
and apply the method given in the proof of (vi) complete deterministic automata are .g:
r
E
@:
T
E
j
q
+
L
P
S
3
3
-
C=
B = Z”O,
T*
(ii). T h e appropriate
o
0
.
T
Note that s is a non-terminal sink state; its presence is needed since 8 should be complete. From the automata R and L? the automaton a’is constructed by the method of Section 3. Only the accessible part of &’is exhibited. +
(i,1 , 0 1 3
l‘
( P , Q, 0)
This gives the following four terminal sets
XIV. Infinite Behavior of Finite Automata
392
T h e terminal sets T,', Ti', and Ti'' contribute nothing since after the states ( p ,sq, 1) or (i,sq, 2) have been reached a return to the state (i,q, 1) is impossible. T h u s T = ( T , , T 2 ) .T h e terminal set T , will yield all sequences containing exactly one (T, i.e., the set z*azw. T h e terminal set T , will yield the set ( t Q o ) ( t * a ) + t w . EXAMPLE 4.2.
Consider the deterministic automaton ,dgiven by
. C P + q 3 r with the family T consisting of the two singletons p and q. T h e n
I ,31 = P z I " This is the set of all words in Z.vin which (T appears only a finite number of times. This differs from the preceding example only by the fact that there (T had to appear at least once. EXERCISE 4.1. Show that for any subset A of S.v the following conditions are equivalent:
(i) A is an open subset of Z.+' (in the topology defined in XII1,l). (ii) A =/ B E v for some B c 1". (iii) A = BEv for some prejix H c 3.
Show that A is open and closed zff in either (ii) or (iii) B may be chosen to be jinite. EXERCISE 4.2.
Assume
A,
=3
A,
3
are open subsets of Ev and let B,,
A,
. ..
3
A,,
for all n E N
Consider the set =
(J B,Z" nsN
and brove that
...
. . . , B,, , . . . be prejixes such
= BJN
C
3
that
393
References
Use Exercises 4.1 and 4.2 to prove that a subset A of is a Gb (i.e., an intersection of a sequence of open sets) zff A = f o r some C c S*. EXERCISE 4.3.
c
References R. McNaughton, Testing and generating infinite sequences by a finite automaton, Information and Control 9 (1966), 521-530.
This paper contains the main definitions and results of this chapter, as well as references to earlier work at Biichi (1962) and Muller (1963). T h e history of the subject is neatly outlined. McNaughton did not have Proposition 2.1 and thus had to prove the implication (v) (ii) directly [rather than in steps (v) (vi) (ii)]. This put very heavy demands on the proof. T h e argument given by McNaughton is very informal and to some extent inaccurate (but repairable).
--
-
M. 0. Rabin, Automata on infinite objects and Church’s problem, Anrer. Math. Sor. Regional Conference Series in Mothenintics 13 (1972), 1-22.
Correct proofs of the implication (v) = (vi) 3 (ii) are given and are credited to Y. Choueka (unpublished). ’I’he proofs are virtually identical with those in this chapter that were found independently by M. P. Schutzenberger jointly with the author. €I. I,. Landweber, Decision problems for 0)-automata, Math. S-vstems Theory 3 (1969), 376-384.
This is the source for Exercises 4.1-4.3.
CHAPTER
xv k-Recognizable Sequences
T h e study of k-recognizable sets started in Chapter V is continued here. In addition to the notion of a k-recognizable subset A of N , the closely related notion of a k-recognizable sequence x: N + Z is introduced where 2 is a finite alphabet. 1. k-Recognizable Sequences
We shall relate the sequences x : N .Z with the notion of k-recognizable sets studied in V,3. A sequence --f
x : N+.Z
is said to be k-recognizable, where k > 1 is an integer, if for each the set A, = 0x-l = {n I nx = CT}
0E
2
is k-recognizable. An analogous definition was made in XII1,2 with “k-recognizable” replaced by “recognizable.” Proposition XI1 I,2.1 then asserted that the class of ultimately periodic sequences was obtained. EXAMPLE 1.1. Let A bc a subset of N and let x : N acteristic function, i.e., 1 if X E A nx={ if x $ A
+
2 be its char-
Then A is k-recognizable iff x is a k-recognizable sequence. 394
1. k-Recognizable Sequences
With each x E relation in N
395
P' (and with k > 1 fixed) we define the equivalence nNZm,
n,mE N
by the condition
(krn +j)x
=
(krm +j)x
for all r
E
0 < j < kr
A',
PROPOSITION 1.1. The sequence x: N Z is k-recognizable if and only if the equivalence relation mr in N is finite, i.e., if the quotient set N / w Xis finite. --f
Proof. For each u
E
2 define the equivalence relation in n, m
n N,m,
N
N
E
by the condition
(krn +j)x
= uo
(k'm
+ j)x = c
for all r
E
N , 0 < j 5 kr
Then n w Xm holds iff n w0m for all u E 2. Consequently the equivalence wZis finite iff the equivalences -o are finite for all u E 2. However, the finiteness of w , is exactly the condition for the k-recognizability of the set A, = ax-I (see Proposition V,3.3) I
A k-recognizable sequence x: jective and if for all n, m E N nx
N
= mx
--f
Z will be called generic if it is sur-
2
n
m
NZ
T h e opposite implication holds for all x E it is surjective and
nx
=
mx
-
(kn
E".Note that x is generic iff
+ j)x = ( k m + j)x
T H E O R E M 1.2. A sequence x: N i f it admits a factorization
+
for all 0 i j < k
Z is k-recognizable
if and only
N L r A Z where T is finite, y is a generic k-recognizable sequence, and
CI
is a function.
XV. k- Recognizable Sequences
3 96
Proof. Assume that such a factorization is given. Since n -u m holds iff ny = my it follows that the equivalence relation n N u m is finite and thus y is k-recognizable. Since
ax-1
=
aa-ly-1
z
uw - I
a=ya
it follows that x = y a is k-recognizable. Conversely assume that x is k-recognizable. Then the equivalence relation wZ is finite. Let T = N / w Z and let y: N + be the natural factorization function. Since n mZm implies nx = mx it follows that there is a unique function 01: r 2 such that x = ya. T h e verification that y is generic is left to the reader I
r
--f
A generic k-recognizable sequence will be called a “k-generic sequence” for short. They will be studied more intensively in the next section. EXERCISE 1.1. Given a sequence x : N + Z dejine the truncation N + Z by setting nxr = ( n + 1)” for all n E N . Show that is k-recognizable zff x is.
XI:
X I
EXERCISE 1.2.
Given sequences xl: N + Z , ,
x2: N + Z z
dejine x: N
+
nx
( n x l , nx2)
Show that x is k-recognizable
iff
=
L’,xZ2
both x1 and x2 are k-recognizable.
EXERCISE 1.3. Modify the dejinition of the equivalence relation wZ so as to apply to the case of recognizable sequences. Obtain the analogs of Proposition 1.1 and Theorem 1.2.
2. k-Generic Sequences
There are two methods (in addition to the basic definition) of describing k-generic sequences and a skillful manipulation of these descriptions can be used to prove many properties. Let x: N - 2
397
2. k-Generic Sequences
be k-generic. We convert S into a complete right k-module by setting
aj = ( k n
+ j)x
for
a
E
S, j E k
provided a = nx
Such an n exists since x is surjective and the choice of n is immaterial since nx = mx implies (kn + j ) x = ( k m j)x. If we set a. = Ox, then we find
+
We assert that S as a k-module is accessible from
(2.2)
a&"
=
go,
i.e., that
,r
Indeed, let a E Z. Since x is surjective we have a = nx for some n E N . Assume n > 0 and write n = n'k j with n' E N and 0 5j < k and let a' = n'x. Then a'j = a. Since n' < n the argument can be continued by induction. Since j is the last digit in the standard expansion of n at the base k, the same argument also proves
+
(2.3 1
0"s =
( s Y ) ~
for all s E k"
where v : k" + N is the standard interpretation defined in V,2. Conversely if S is given as a complete right k-module and a. E Z is such that (2.1) and (2.2) hold, then (2.3) can be used to define x: N 4 2. I t is easily seen that x is k-generic which yields the same k-module structure on S as the one given at the start. As an application of this module language we prove: PROPOSITION 2.1. For each k-generic sequence x: N p 2 1 szich that
an integer
(nkp)x = (nk")x for all n Proof.
E
N. We have
(nx)O = ( n k ) x and therefore (nx)Or= (nkr)x
4
S, there exists
XV.
3 98
k-Recogn izab le
Seq uences
Since the function f:Z + Z defined by uf = (TO is an element of the finite monoid of all functions Z -+ Z it must have an idempotency exponent, i.e., an integer p 2 1 such that f p = f 2 p T o introduce the next method for treating k-generic sequences we consider the morphism
(2.4)
w : Z*-+Z"
defined by
(2.51
(nx)w = (kn)x(kn
+ 1)x.. .(kn + k
-
1)x
= (X[knl)-lX[k(n+l)l
or in module notation (TW
=
u01.. .(k - 1)
T h e following properties of w are clear
For the iterates of w we then obtain u0wn =
Consequently (To
x[k"l
< (Tow < . . . < (Town < * . .
and
(2.8)
x = lim n+w
dkn] =
lim(uown) n+m
T h e fact that x is surjective implies:
(2.9) There exists an integer n 2 1 such that cown contains all the letters of Z. Conversely, given a morphism (2.4) satisfying (2.6), (2.7), and (2.9),
3. Examples and Exercises
399
formula (2.8) defines a k-generic sequence x for which ( 2 . 5 ) holds. Thus w and x mutually determine each other. T h e morphism w will be called the generator of x. As a consequence of this discussion we obtain: PROPOSITION 2.2. Each k-generic sequence x: N + 2 is also kqgeneric for all q > 1. If w is the generator of x as a k-generic sequence, then wq is the generator of x as a b-generic sequence I
3. Examples and Exercises EXAMPLE 3.1.
k
=
2, 2 = 2, o0 = 0, o w = 01,
Then
owz
= 0110,
l w = 10 oW3=
oiioiooi
T h e 2-sequence x = limOwn = 0110100110010110..
.
n-fcu
is known as the “Thue sequence.” An alternative description may be obtained as follows. Let 1: 2” + 2” be the very fine morphism defined by jn = 1 - j for j = 0, 1. Then x is defined by the conditions
ox = 0,
X[2n+11
= x[zn~(x[zn~)~
EXAMPLE 3.2. If in the example above we replace lw by 01 (instead of lo), we obtain the sequence x = 010101..
. = (0l)W
Thus x is the characteristic function of the set of all odd numbers in N . EXAMPLE 3.3. Let k > 1 and define x: N 4k by setting nx to be the first digit in the expansion of n at the base k. Thus nx = j iff n = jkp 1 with 0 5 1 < kp. Define w: k + kk by
+
Ow=Ol,..(k-1), Then x
=
lim,,,,
jw=jk
Ow” so that x is k-generic.
for
O<j
XV.
400
K- Recogn izable
Sequences
EXAMPLE 3.4. Let x : N + 2 be defined by nx = 1 iff the expansion of n at the base 3 does not contain the digit 2. Define w: 2 + 23 by
lw
=
110,
ow
=
000
Then
x
lim l w n
=
n +m
and therefore x is 3-generic. EXAMPLE 3.5.
T h e sequence x
x
=
E
2*v
0110100010
is a 2-sequence, though not a generic one. I n fact, x is the composition
with Ou
= la =
0, 2a
=
1, and
y
=
lim Own n-tm
ow
= 02,
lw
=
11,
2w
= 21
Then y
ny
=
{
0 2 1
= 0221211121
...
if n = O if n is a power of 2 otherwise
EXERCISE 3.1. Given the generator w: Z* ---+ Z, define its prolongation
--f
.Z* of a k-generic se-
quence x : N
and prove that w and wp have the same prolongations. Show that x is the unique solution of the equation XW'V
=x
4. k-Recognizable Sequences and Sequential Functions
401
S b e a sequence and let q 2 1 be an integer. EXERCISE 3.2. Let x: N Define the sequence y : N 4 23 by setting +
ny
+
(nq)x(nq 1)x.. .(nq = (x[”ql)-lx[( I 1 t l ) l Q
=
+q
-
I)x
Show that y is k-recognizable (resp. k-generic) zff x is k-recognizable (resp. k-generic ). EXERCISE 3.3. Let x: N -+ C be k-generic. Show that for each m, x contains no more than ern distinct segments of length m with c = k(card L’)2. 4. k-Recognizable Sequences a n d Sequential Functions
T h e objective here is to extend Theorem XIII,2.2 to k-recognizable sequences : THEOREM 4.1. (Cobham) Let f : 2.” FAv be a sequential function. x E 2.” is k-recognizable (k > l ) , then so is y = xf E P. --f
If
Proof.
Let .,&
=
(Q, i, A): 2 4 T
be a complete sequential machine defining f. Define z
E
Q Aby~ setting
=
T h e n from the definition off it follows that ny
=
( n x , nx)A
In the nest proposition we shall show that z is k-recognizable. Since
yy-l
= U(qz-’
n ax-l)
the union extending over all pairs (q, a) such that (4, @)A = y , it follows that yy-l is k-recognizable. T h u s y is k-recognizable 1 . be k-recognizable and let Q be a PROPOSITION 4.2. Let s: N 4 Y finite complete right Z-module. Then f o r any i E Q the sequence z: N -+ Q
XV. k-Recognizable Sequences
402 given by
is k-recognizable. Proof.
We first show that we may assume that x is generic. Indeed
let X'
A 7 4
a 7 1' --+ 1
be the factorization of x with x' generic and a a function. Then Q may be regarded as a complete S'-module by setting qa' = q(o'a). It follows that ix['I] = ix'["].Consequently x may be replaced by x'. Thus we may assume that x itself is generic. Let oo = Ox and let w : ,Z* S* be the morphism satisfying --f
as defined in Section 2. Consider the functions QXX+Z
fjl:
(4, elf,, = q(aw")
for n E N . Since this family of functions must be finite there exist integers 0 5 r < p such that f r = f,.This implies q(sw') = q(swp)
for all q E Q and s E Z*. Since
(4.1)
For each integer t and
E
N there exists an integers such that 0 5 s < p ix[il.ltll
for all n
E
N.
- ix[k~l,1 -
4. k-Recognizable Sequences a n d Sequential Functions
403
We now define the equivalence relation n = m in N by the conditions
nx
=
mx
and
(4.2)
iX[!dnn]= i X [ k h ]
for all
0 5 t
This equivalence relation is finite since the sets z' and Q are finite. T o prove that z is k-recognizable we must show that the equivalence relation -Z (defined in Section 1) is finite. This follows from the implication n =m = > n ~ ~ m which we will now prove. We must show that n = m implies
(ktn
(4.3) for all t
E
+j ) z = (Em +j ) z
N and all 0 < j < kt, or equivalently iX[lztn+jl
(4.4)
= iX[klin+j~
Since (n)x = ( m ) x and x is a generic k-sequence we have
(ktn for all 0 < j
+ j ) x = (ktm + j ) x
< kl. Consequently (4.4) reduces to i X [ k h l = iX[kbnl
By (4.1)it suffices to consider t < p , and this is precisely assumption (4.2). As an example of an application of Theorem 4.1 we prove: P ROPOSlTlON 4.3. Let
A = (u,
...
...)
be an infinite k-recognizable subset of N , and let B be a recognizable subset of N . Then the set AIB = (a, 1 n E B } is k-recognizable. Proof. Since A I ( B , u B,) = A I B , u A I B , it suffices to consider the case when B is the arithmetic progression
B=s+pN,
s , p ~ N ,p > 0
404
XV. k-Recognizable Sequences
Let x: N + 2 be the characteristic function of A. Then a,x = 1 and ix = 0 for i E N - A. Consider the sequential machine d: 2 + 2 which for s = 1, p = 3 is given by the diagram
n
and let f: 2‘” + 21” be the sequential function that it defines. Then xf is the characteristic function of A 1 B. Since by Theorem 4.1, xf is krecognizable, B is k-recognizable References A. Cobham, Uniform
t a g sequences, M a t h . Systems Theory
6 (1972), 164-192.
This is the source for all the results of this chapter, though the exposition has been modified.
CHAPTER
XVI Linear Sequential Machines
T h e notion of a linear sequential machine (also called a discrete-time linear dynainical system) is obtained from that of a complete sequential machine of Chapter XI by replacing all sets involved by modules over a cornmutative ring K and by assuming that all the functions involved in the definition are K-linear. This produces sufficient variety in the theory so as to warrant a separate discussion, which however ties in well with some of the topics treated in Chapters l r I , V I I I , XI, and XII. T h e treatment is algebraic throughout the chapter, but is particularly so in Sections 8-13. 1. Algebraic Preliminaries
Let K be a commutative ring. W e shall denote by K [ [ c ] the ] ring of all formal power series in the single variable z with coefficients in K. T h e elements of K [ [ z ] are ] formal power series
with addition and multiplication defincd in the obvious manner. ‘I’he power series k is a polynomial if k,, - 0 for all but finitely many n. ‘fhc polynomial ring K[2] is a subring of K[[:]].I n turn h7is a subring of K [ 2 ] provided each element k E K is regarded as a polynomial of degree zero. Let A be a K-module. If A is finitely generated, then we shall write [=l:K] m. If this is the case, then we shall denote by [ A : K ] the
405
XVI. Linear Sequential Machines
406
smallest integer r such that A is generated by r elements of A. If = K r , then [ A : K ] = r . If K is a field, then A is usually called a vector space and [A: K ] is simply the dimension of A over K. If A and B are K-modules, we shall denote by (A, B), the K-module of all Kmorphisms (i.e. K-linear transformations) A + B. Since the ring K is commutative, there is no major reason for distinguishing between left and right K-modules. However we shall stick to the right module notation. This has some bearing later since it determines how matrices are associated with linear transformations. Given a K-module A, consider the K-module ALvof all functions N + A , i.e. all sequences
A
a
=
(a,, a , ,
. . . , a,, , . . .)
of elements of A. It will be convenient to write a as a formal power series m
a=
C
anzn
n=o
and consequently write A[[z]] instead of A"'. With this notation it is easy to see how to convert A[[z]] into a K[[z]]-module. I t suffices to define ak by multiplication of formal power series. Thus with k and a given by (1.1) and (1.2), we have m ..
ak =
C n=O
bnzn
with
I n particular, a z = C;=, anzn+l is the right shift operator transforming the sequence a = (a",a , , . . .) into a z = (0, a,, a , , . . .). PROPOSITION 1.l.Let A and B be K-modules and
a function. The following conditions are equivalent. (i) (ii)
f is a K[[z]]-morphism f is a K[z]-morphism
1. Algebraic Preliminaries
407
(iii) f is a K-morphism and the diagram
-
commutes.
-
Proof. T h e implications (i) =>.(ii) (i) needs a proof. Let
(ii)
(iii)
=
C knzn
n=o
C
are clear, so only
m
m
k
=> (ii)
E
u=
K[[z]],
anznE A[[z]]
n=O
We must show that
(4f = (af )k Let p 2 0 be any integer. Write k m = C;I=, k,l+pzn.Then
=
1
+ mzp with 1 = C:ii
knzn and
(ak)f = (aZ+ amzP)f = ( a f ) l + (am)fzP (af)k = ( a f ) l + ( a f ) m z p I t follows that (ak)f and (af)k have the same coefficients in all degrees < p . Since p is arbitrary, it follows that (ak)f = (af)k I Let
f: A
(1.3)
-+
Wzll
be a K-morphism. If a E A , then af E B[[z]] and thus af = C bnzn. Setting af,,,= b, we obtain K-morphisms f n : A B. We shall write -+
or equivalently
(1.5)
f
E
(44Y"zIl
PROPOSITION 1.2. Any K-morphism (1.3) admits a unique extension to a K[[z]]-morphism
(1.6)
f ' : "I1
-
"31
XVI. Linear Sequential Machines
408
Proof.
Let
m -_
C
a=
anznE A[[.]]
n=O
Setting
m
af'
=
C
b,YL
2
apfq
n=o
with bn
=
p t q=n pEn,q>o
is a desired extension. The proof of uniqueness o f f ' is omitted
I
In the sequel we shall not distinguish among (1.3), (1.4), (1.5), and (1.6); we shall simply treat them as four different ways of recording the same mathematical object. Note that the conventions above embody the following identification
(1.7)
(A"z11, B"Z11)K"Zll
= (A,
B)dzIl
It is interesting to see how the composition of K[[z]]-morphisms fares under the above conventions. We have PROPOSITION 1.3.
Let
-r, B".IlL
A".ll
be K[[x]]-morphism with h
=f g .
If
then hn
=
C"z1l
2
ptq=n
fpgq
I
p >o,q 2 0
Thus composition of K[[x]]-morphisms can be expressed equivalently by multiplication of power series. 2. Linear Sequential Machines
Let &: A
+B,
A = (Q, i, A)
2. Linear Sequential Machines
409
be a complete sequential machine defined without any finiteness conditions on A, B, and Q. We shall now assume that A, B, and Q are modules over a given commutative ring K, that the functions (2.1) and (2.2) are K-morphisms (i.e. are K-linear) and that the initial state i is the element 0 of Q. Subject to these assumptions we shall say that . X is a linear sequential machine (or more precisely a K-linear sequential machine). With the assumptions above, (2.1) and (2.2) yield
qa
=
qF
(9, a>A = qff
+ aG
+ aJ
for some K-morphisms
F: Q+Q, H: Q-B,
G: A + Q
J: A-B
We may combine the functions (2.1) and (2.2) into a single function
and this leads to the notation
for a linear sequential machine. This notation will be favored in the sequel. T h e result of the linear machine is the function
which may be describcd as follows using the sequence notation. Given an input sequence
a
=
( u o , a1, . . . , a , , , . . .)
there corresponds a state sequence
XVI. Linear Sequential Machines
410
and an output sequence b
=
af
=
(b,), b , , . . . , b,, . . .)
given by the formulas
We now prove that
f
(2.5)
is a K[[z]]-morphism. T h e fact that f is a K-morphism is clear from formulas (2.4). We must show that f commutes with the shift, i.e. that (az)f = ( a f ) z . T o see this observe that if we replace a by
az
=
. . .)
(0, a,, a,, . . . , a,,
then it follows from formulas (2.4) that the state sequence is replaced by 91,
('9
' " 9
qJ19
"')
and the output sequence by
bz
(0, b,, b , , . . . , b,, . . .)
=
as required.
We now evaluate f for the special input sequence
a
=
( a , 0, . . . , 0, . . .)
T h e state sequence becomes q
=
(0, aG, aGF, . . . , aGFn-,,
. . .)
and the output sequence is
af
=
(aJ, aGH, aGFH, . . . , aGFn-lH, . . .)
T h u s in the power series representation off
2 m
f
=
fnz71
ll=O
we have
(2.7)
fo = J ,
f J ,
=
GF"-'H
for n > 0
2. Linear Sequential Machines
41 1
Observe that if Q = 0 (the trivial K-module, not the empty set!), then automatically F = 0, G = 0, and N = 0. T h e K[[z]]-morphism f : A[[z]] + B[[z]] is then the coordinate-by-coordinate extension of J : A + B. Thus with the convention of Section 1, we have f = J . T h e machine with Q = 0 will be simply denoted by J : A + B. For any linear sequential machine A: A + B as above, it will be convenient to refer to the K-morphism J : A 4B (involved in the definition of &) as the direct part of d. T h e machine A is said to be jinite if [Q:K] < 00
I f f : A[[z]] + B[[z]] is the result of a finite K-linear machine A, then we say that f is K-sequential. For any K-morphism f : A 4 B, the coordinate by coordinate extension f: A[[z]] + B[[z]] is sequential, Indeed, the requisite machine A has Q = 0, J = f. Let Qi
B
be two linear sequential machines with the same direct part J . A staterelation v: Al +A2 is given by a relation P:
Qi
+
Q,
satisfying the following conditions
(2.8) (2.9)
G2
= GlV,
PF2
41P
+ 41'P
= Fly, PH2 = Hl = (Q1+ Q1')Y'
Stated in terms of the graph # y , conditions (2.8) and (2.9) may be rewritten as follows
XVI. Linear Sequential Machines
412
This alternative form of the definition makes it clear that the inverse p-l of a state-relation also is a state-relation. It is also clear that the
composition of state-relations is a state-relation. PROPOSITION 2.1. If a state-relation cp: A,+ d2exists, then A1 and k2 haae the same result. Conversely, i f d, and k2 have the same result, there is a maximal state-relation y : Al + d2containing all others. + A2is a state-relation. Since Proof, Assume that cp: d, d2have the same direct part it suffices to show that
(2.10)
G,F,"-'H,
=
G2F,"-lH2
Aland
for all n > 0
Since these are functions it suffices to show
GaF;;l-IHZc GIF;-'Hl This follows from (2.8). Indeed,
Conversely, assume (2.10) and define y : Ql + Q2 by setting #y = {(q,, qa) I q l F , i t l l = q2FZiH2
for all i 2 O}
Conditions (2.8.2), (2.8.3), and (2.9') are then clearly satisfied. Condition (2.8.1) follows from (2.10). -+ A2is any other state-relation, and if ( q l , qz) E #p, then If q : kl it follows from (2.8.2) and (2.8.3) that q l F l i H l = q2F2'H2for all i 2 0. Thus ( q l , Q%)E # y and cp c y as required 1 Note that the maximal state-relation y also satisfies
Note also that condition (2.9) did not yet intervene. It will however be needed in Section 5. T h e state-relation p: A', +=d2 will be called a state-mapping if p: Q1 + Q2 is a partial function. If further p is a function (i.e. if Don1 cp = Ql), then we shall say that cp is a complete state-mapping.
3. The Free Case; Comparison w i t h Automata
41 3
3. The Free Case; Comparison with Automata
We shall now concentrate on the case when both K-modules ‘4 and B are finitely generated and free. Thus we may assume that
-
KP,
A
B
Kr
A K-morphism y: A B may then be viewed as a pxr-matrix of elements of K, i.e. as a single element of K P X r . A K[[z]]-morphism
-
f : A“,-]]
B“z1l
c fnz’l m
f
=
rr=l
may then be regarded as an element of K ~ ~ . ~ [ [ z i.e. ] l , as an infinite sequence of pxr-matrices. However, we shall prefer to regard f as a pxr-matrix of elements of K[[a]]. ‘The components of this matrix will be denoted by f u g for , 1 5 u S p , 1 5 v 5 r. PROPOSITION 3.1. I f f is sequential, then it is the result of a jinite machine in which the state module is free.
Proof. Let KP k” be a finite sequential machine with state module Q and data F , G, H , J . Suppose that [Q:K] = 7n. There is then a surjective K-morphism pi: KiIL 9. Since Ksf is free and y is surjective, the diagram --f
-
-
may be completed to a commutative square by some K-morphisln
F ‘ : A”” Krif.For the same reason we can find G : KP 4 Kr” so that G = G’p. Finally define fZ‘ = FZZ: k”“ + K r . T h e data F ‘ , C‘, H ’ , J yield a sequential machine .A’’: KI1+ k” with KitLas state modules. Clearly p: %,H’+ J?’ is a complete state mapping. ’Thus by Proposition 2.1, JH and -4’ have the same result I Let us now consider a linear sequential machine
.A:KT’
-
K‘
XVI. Linear Sequential Machines
414
with state module Kmand without a direct part (i.e. with J = 0). T h e data G , F and H of ~d' may thus be regarded as matrices in K of sizes p x m, m x m, and m x r . Consider an alphabet S consisting of a single letter a and define a K-a-automaton d of type ( p , Y) (see III,13 and VI,6) as follows. T h e states of JY' are (1, . . ., m } = Q', and the transition matrix is E = Fa. If we write G as a column
then each row G , E K"1 (1 5 u 5 p ) may be viewed as a K-subset of Q'. Those are the initial states. Similarly H is written as a row
. . . , H,]
H = [H,,
with each column HI,E Km(1 5 u 5 r ) . These are the terminal states. T h e behavior I d I is a matrix [A,,,]where A,,,,is the behavior of the automaton (Q', G,, H,) and is a K-subset of as. Let A,,, be the same . K-subset regarded as an element of K [ [ z ] ]Thus m
Juv =
C
auonzn
n=O
where aur,nis the value of A,,, on an. We have by Corollary VI,6.2
A,,
=
G,EsHv =
2 G,EnH,
n=o m
=
C
G,FnH,a*
n=O
and therefore
aulln= G,F"H,, Since this is the coefficient of znfl of f f L lwe , obtain
(3.1)
fuv =
Auvz
T h e above construction establishes a 1-1 correspondence between K-a-automata ,-d of type ( p , Y) and sequential machines ./& KP Kr without a direct term and with a finitely generated free state module. As a corollary of the above discussion we obtain --f
4. Duality
415
PROPOSITION 3.2. A function
viewed as a matrix j = [ fiL,,]of elements of K[[z]] is sequential if each f,L7,is K-recognizable.
if and only
For the proof we only need to observe that A,,, is K-recognizable iff is K-recognizable, and that the matrix f = [ f,,,] is K-recognizable by an automaton of type ( p , Y ) iff each j u tis, K-recognizable 1
a,,,,
We recall that the K-recognizability of j,,, E K[[z]] is equivalent with the rationality of f u r in the sense of Kleene and also with its rationality in the sense of algebra (see VII,3). We shall return to this matter in Section 9 where the questions of rationality will be studied in greater detail. 4. Duality
Given a K-module A we shall denote by A^ its dual, i.e. the K-module of all K-morphisms u : A + K. For a K-morphism p: A + B, the morphism
p: B - A is defined by setting
BQ, = 9iB for each
E
8.Clearly
if p is surjective, then 47 is injective. Also if
w?4, then 9" = p i 2 p i 1 ' If A is a K-free with a finite basis v l , . . . , v P ,then with a dual basis 8,, . . . , 8, defined by 4p =
V.V.= 1
J
{i
if if
i = j i+j
PROPOSITION 4.1. If K is noetherian and
then so is
A^ also is K-free
A^ is jnitely K-generated,
A.
-
Since A is finitely generated there exists a surjective morphism A , for some p 2 0. Then y': A^ + I?. KP is injective. Since K is noetherian and is a submodule of a finitely generated K-module, it follows that A^ itself is finitely generated 1 Proof.
p:
KP
4
a
XVI. Linear Sequential Machines
41 6
PROPOSITION 4.2.
Let Q
B
be a K-sequential machine with result
M
Then the K-sequential machine
If further K is noetherian and .X is finite, then T h e first part follows from the observation that second part follows from Proposition 4.1 I
is finite.
f,l = I?Pn-IC. T h e
T h e assumption that K is noetherian is not needed when A = K P , = K7, and Q = Km. If relative to given bases in A , B, and Q we express G, H , and F as matrices, then with respect to the dual bases in A, B, &, the morphisms I?, and P are simply the transposed matrices. Th u s each f , Lalso will be the transpose of fn, when both f n and f,l are treated as matrices.
B
e,
5. Minimization
Given a K-module B we consider the K-morphisms
-
z-l: B[[z]J B[[z]]
nn: B [ [ z ] + ] B
for
0 5n
5. Minimization by setting for b
41 7 =
xzob,,a"
c bn+p, Do
bz-1
=
bn,, = b/,
/1=0
We note the following identities
Since the operator z was called the right shift, the operator be called the lejt shift. Let
Q
z-l
should
B
be a K-sequential machine. We consider the K-morphisms
G:
A[a]
-+
Q,
Ej: Q
+
B[[z]]
defined by
(az")G= aCF"
a
E
A
all q
E
Q
for all
qR = C qF"Hztl
for
T h e machine . // is said to be accessible (the term reachable also is used) if _C is surjective. T h e machine . J is said to be reduced (the term observable also is used) is €7 is injective. If / i is both accessible and reduced, then ./2 is said to be minimal. These notions require some explanation and amplification. Let 0.l be the image of G. Clearly 0.l is the K-submodule of Q generated by the K-submodules I
AG, AGF, L4CF2, . . . , AGF", . . . We call Qzi, the accessible part of Q . Since Q;'F c AG c Q:', there results a sequential machine
B
-
0;i F;l H." : A - B A GiL J
Ql1
and since
XVI. Linear Sequential Machines
418
with F i ,Ga, H'l defined by F , G, H . T h e machine Ail is accessible and is called the accessible part of d. If d is reduced, then A is both accessible and reduced and thus is minimal. Since the inclusion Qll c Q defines a state mapping .&;14A (and the inverse of this inclusion defines a state mapping A + &:I), it follows that .Xa and d have the same result. If d is finite, i.e. if [Q:K] < 00,then it is not necessarily true that [ Q * : K ]< 00. If however K is noetherian, then [Q:K] < 00 implies [ Q " : K ]< 00. Summarizing we obtain For each K-linear sequential machine A the accessible part is an accessible machine with the same result as A. If & is reduced, then A:1 is minimal. Ifd is finite and K is noetherian, then d" is jinite I PROPOSITION 5.1.
Let R
=
Kernel
R
R, i.e. =
{q I qF"H
=
0 for all n 2 0 }
If we replace Q by p = Q I R and define F', G', H r appropriately, we obtain the reduced sequential machine
dd' =
p
Fr H r
: A+B
T h e natural factorization morphism called the reduced quotient of ,d. Q Qr defines a complete state-mapping d + d rand we have --f
PROPOSITION 5.2. For each K-linear sequential machine A, the re-
duced quotient &' is a reduced machine with the same result at d . If & is accessible, then d'is minimal. If Ji is finite, then so is d r I
We shall now consider two K-linear sequential machines Aland .A2 with the same result. By Proposition 2.1 there exist then state-relations
We conserve the notations of Section 2 and denote by state-relation.
ly
the maximal
5. Minimization
419
PROPOSITION 5.3.
Q,*
c Dom p.
Proof. From (2.8.1) it follows that AG, c Dom p. Further (2.8.2) implies that
AC,FlrEc Dom p
for all n 2 0
Condition (2.9) (used here for the first and only time!) implies that
AG,
+ AG,F + . . . + AG1Fr1c Dom p
for all n 2 0. Thus Ql* = I m _Gl c Dom p COROLLARY 5.4.
I
If Al is accessible, then Q1= Dom p I
PROPOSITION 5.5. If =A?.. is reduced, then p is a state-mapping (i.e. p: Ql + Qz is a partial function). Proof. Assume q 2 , qzrE qlp, or equivalently ( q l , q2), (ql, q Z r )E #p. From (2.8.2) and (2.8.3) we deduce
q2FziHz= qlFliHl = qztFZiHz Thus (qz - qZr)n2 = 0 and since Azis reduced, qz = qzr
I
is reduced, then p is unique THEOREM 5.6. If A, is accessible and k2 and p: Q, + Q z is a K-morphism. If, further, -,dl is minimal, then 4p is injective and if Azis minimal, then p is surjective. If both -,dl and =A?.. are minimal, then p is an isomorphism. Proof, By Proposition 5.5, p is a partial function and by Corollary 5.4, Dom p = Q,. Thus p: Q1 + Q2is a function. Since the same holds for the maximal state-relation y and since p c y , it follows that p = y. Since y satisfies [see (2.9) and (2.11)] QlY
+ QZY = + 4Z)YY (Q1
it follows that
and thus p is a K-morphism.
(QlYP =
(41+fJ
420
XVI. Linear Sequential Machines
If LK?l is minimal, then, by Proposition 5.5, p-' is a partial function and thus p is injective. If .d2is minimal, then, by Corollary 5.4, Dom ~ 1 - l= Q, and thus rp is surjective 1 C O R O L L A R Y 5.7. Two minimal K-linear sequential machines with the same result are isomorphic I
We now turn our attention to the question of existence of a minimal K-linear sequential machine. We start with an arbitrary K[[z]]-morphism
f: A"z1l
-
f = nc= O
B"z1l
m
We define the K-morphism
3: A[zI
fizzn
-
B"xl1
by setting
for all a
E
(5.1)
A. Clearly azf=
afz-1
for all a
E
A[z].
Let
Qr = I m a g e r Equation (5.1) implies Qrz-' c Q f . We now define the machine
by setting qFf = q2-I
for all q
E
Qf
co
aGr = a f =
C
af,1+lz71 for all
a
n=O
qHr
=
qn,,
for all q
Jr = f o
E
Qf
E
A
421
5. Minimization THEOREM 5.8.
..Hfisa mininzal K-linear sequential machine with result f .
Proof. Since qH, sequently, for n 2 1
=
qno, it follows that a-”H, = u” -”n,, = x,,.Con-
( , ~ ( a f i + l z L ) ) n l , - ,afn c.0
aG,F;-’H,
= aG,z-”’~’n,, = u G , ~ ~ ,= ,-,
=
k=O
and thus ./, has f as result. ‘The function G,: A[.] 0, coincides with the function f: A[,-] B [ [ z ] ]and since Q, = ImageJ it follows that G, is surjective. T h u s .,Hf is accessible. Assume q E 0,is such that qn, = 0. T h u s qFf”11, = 0 for all n 2 0. Since F/”€lf= z-”Hf = 7c,, it follows that q7cn = 0 for all n 2 0 and thus q = 0. Consequently d, is reduced I ---f
--f
COROLLARY 5.9. If K is noetherian and f : A [ [ z ] + ] B [ [ z ] ]is sequential, then d, is jinite. I
Indeed, let .dbe a finite machine with result f. Then, by Proposition 5.1, ,&:*is accessible and finite. Thus, by Proposition 5.2, kar is finite. Since -A,, -Kf is finite I EXERCISE 5.1. I n the machine A? assume that a state q,, E Q rather than the state 0 is chosen as initial state. Show that the output sequence corresponding to a single input a E A is given by
Use this observation to show that the reduced machine coincides with that considered in Chapter LYII. EXERCISE 5.2. Let
as defined here,
-dbe a K-linear machine with result
Show that if FP = 0 , then f I l = 0 for all n > p . Show that the converse also holds if ~ 6 is ? minimal.
422
XVI. Linear Sequential Machines
EXERCISE 5.3. Show that the K-morphisms characterized by the following conditions aG = aG
G, R
a n d f are completely
for all a E A
z_G = G F
qRn, = qH Fly
for all q
Q
= Rz--l
af = (a&-’
zf
E
for all
aEA
=fz-1
6. Parallel Composition
Ai =
Fi H,. ’ : A+B, Gi Ji
QL
A
Qi
Fi 0 Hi Fz H2
.A?= Qz 0
T h e K-morphisms G: A
G = [Gi, Gz]: A
--f
-+
i=l,2
:
A-B
Q and H : Q + B are given by QlxQ2,
H=
:I[
Q1xQ2-+B
Clearly, if Al and d. are finite, then so is A. If f i and fzare the rethen f i f z is the result of A. This implies sults of dland d.,
+
6. Parallel Composition PROPOSITION 6.1.
423
If
f i : A[[z]]
-
i = 1, 2
B[[z]],
are K-sequential functions, the so is f i + f2
1
The state module Q of a sequential machine comes equipped with a K-endomorphism F : Q Q. It will be convenient to regard Q as a K[z]-module by setting q z = qF. I n this sense the state module of the machine dl A, is 0, x Q 2 , a direct product of K[z]-modules. Using this notion, the construction of dl d2 may be inverted. --+
+
PROPOSITION 6.2.
+
Let -I
Q
B
be a K-sequential machine and assume that
+
is a direct product of K[z]-modules. Then d = Al A, where d, and -.d2 have state modules Q1 and Q 2 . Further, ;f d is accessible or reduced, then the same holds for dl and dz. Proof, Since Q = Q l x Q Z as a K[z]-module, the morphisms F , G, H , of the machine ~ z have f the form
A with Fi:Q i Q i , Gi: suffices to define --+
+
Q i ,Hi: Qi
B Fi Hi
-
B for i = 1, 2. Thus it Qz
Qi
B
-
If A i s accessible, then G: A[z] + Q is surjective. Since G = [G1, G2], it follows that Gi: A[z] + Qi are surjective and thus dland A. are accessible. If .Iis reduced, then f7:Q + B[[z]] is injective and the same holds for Ri: Qi B[[z]], i = 1,2. Thus dland A, are reduced 1
-
XVI. Linear Sequential Machines
424 COROLLARY 6.3.
Assume that K is noetherian. Let
-
f : "I1
mz11
be a K-sequential function and let Q f = QixQz
be a direct product decomposition of Qfas a K[z]-module.Then f = f i where f i : mz11 B"zl1
-
+f z
are K-sequential functions, such that QJ,
for i = 1, 2
Qi
I
7. Series Composition
Let
be K-sequential machines. T h e sevies composition or simply composition = Al J 2is defined as follows
A?
Qz
QI
C
F, 0 Hz H,G, F, H,J,: A + C A?= Q1 Qz
7. Series Composition
425
Clearly if .A', and -tY2 are finite, then so is T h e reader mill easily verify that this definition of composition agrees with the definition given in XIII,8 for sequential niachines. This iniplies that the result
.f: "I1
+
C",-Il
is the composition
(7.1)
A"z]]
L R"s]] & C"Z]]
of the results of A, and .A2. This can also be checked by an explicit calculation. This implies PROPOSITION 7.1.
I f f l (2nd f 2 in (7.1) are K-sequential, then so is
f =f,fi I T h e state module of A?' = d l,,ff2 is
when viewed as a K-module. Its endomorphism I: is however given by the matrix
I:= [ F z
H,G,
"J F,
T h u s viewed as K[z]-modules, Q2 is a submodule of Q while Ql is a quotient module. In other words we have an exact sequence
0 +Q2+ Q
+
0,- t o
of K[,-]-modules. This exact sequence splits when regarded as a sequence of K-modules. These remarks show how to invert the construction of
.&TI..y,. PROPOSITION 7.2.
Let
Q
be a K-sequential machine over and let
C
XVI. Linear Sequential Machines
426
be an exact sequence of K [ z ] - m o d ~ ~ l esplit s , over K. Then H . d'; /i'i where d',:A B, .//;: B + C have state modules 0, , Q2. Further, d is accessible or reduced, theii the same holds for //, and . /LL. :
~
--f
~
Proof. Since the csact sequence splits over K , we may assume that
Q = Q2XQI as a K-module. T h e K-endomorphisin F of Q then takes the form
where F,, F , are K-endomorphisms of Q Z , Q, while I,: Ql K-morphism. Explicitly, F is given by (42,
4,)F
=
(q2F2
4QIL, q , F d
I t follows that 11.1may be written as Q2
QI
C
We now consider the machines
Q, F , H ,
A;= Qi L
H , : Qlx A
-+
C
-+
0, is
a
8. T h e Case W h e n K Is a Field COROLLARY 7.3.
427
Assume that K is noethevian. Let f : A".]]
-
C".]]
be a K-sequential function and let
Be an exact sequence of K[,-]-modides split over K. Then f is the composition A".]]
5 B".]]
11,C[[z]]
wheve g and h are K-sequential and
EXERCISE 7.1.
Cavvy ouer the formalisms of XII,9 and 10 to thepres-
ent situation. 8. The Case When K I s a Field
So far finiteness assumptions have played a rather secondary role in our discussion. We shall consider questions in which finiteness is quite basic. We shall assume in this section that K is a field. Let Q be a K [ z ] module such that [ Q : K ]..: 00. Consider a direct product decomposition
p-5.0, M
(8.1)
' . . M Q,,
of Q as a K[r]-module. Assume that none of the modules Q,, . . . , Q,, is trivial and that n is largest possiblc. It follows that each Q , , . . . , Q,, is an indecomposable K[,-]-modulc, i.e. admits no direct product decomposition 0, = Q,' x 0," in which 0,' and 0,"are non-trivial. Since [Q:K] 00, it is clear that such a optimal decomposition (8.1) exists. I t is also known (this is the Remak-Krull-Schmidt theorem) that, except for the order of factors, it is unique. T h e structure of an indecoinposable K[z]-module Q is completely K[.] which is ruled out by the assumption known. Either Q [ Q : K ]-.00 or else < _
-
Q = K[zll(P")
XVI. Linear Sequential Machines
428
where p is an irreducible rnonic polynomial in K[z], u is a positive integer, and (p") is the principal ideal in K [ z ] generated by p7'. If u = 1, then the module K [ z ] / ( p )is simple, i.e. it has no K[z]-submodules except itself and zero. If u > 1, then we have in K [ x ] / ( p " ) the chain of submodules
T h e consecutive quotients are for 0 5 k
Multiplication by pa yields an isomorphism
T h u s in the composition series (8.2) all consecutive quotients are simple and are K[z]/(p).More precisely we have exact sequences of K [ z ] modules. (Pk) 0 O + - W+l) +-+-
(P")
(P")
m1
f
(P)
for all 0 5 k < u. Since K is a field, these exact sequences split over K . Let .&: A -+ B be a finite K-linear machine with state module Q. We shall say that ,k' is primary of type p if Q K [ z ] / ( p " )where u 2 1. As before p is assumed to be a monic irreducible polynomial. If u = 1, then we say that <,/Y is prime of type p. If f : '4[[z]] R [ [ z ] ]is a sequential morphism then we shall say that f is primary (or is a prime) of type p if this is true for the minimal machine .d1. A rather special situation is when QJ = 0. I n this case f is a direct morphism defined by a K-morphism A + B. Proposition 6.2 and 7.2 now yield the following
-
--f
Let Ld: A B be a jinite K-linear sequential machine with state module Q f 0. Then .A? admits a parallel decomposition THEOREM 8.1.
--f
8. The Case When K Is a Field
-
429
into primary machines. I f /i, , f o r 1 5 i 5 k , is primary of type p , with ndniits a series decomposition 0, K [ Z ] / ( ~ :then ~), I
where each M I ,, 1 5 j 5 i i , , is a prime machine of tjipe p , ,
I
7
I here is an analogous statement for sequential functions:
THEOREM 8.2.
Let f : A[[.]]
+
B[[z]] be a K-sequential function, with
Qff 0. Then f is a sun1 f
- f 1
+ . . ' t-fL
where each f l : .4[[z]] -F B[[z]] ( f o r 1 5 i 5 k) is K-sequential and primary. I f f , is primary of t-vpe p , with QJ, w K[=]/(py+) then f , is a composition
f where ench f , , , 1 5 j 5
ii,,
= j l U L. . .
f l ,
is sequential and p r i m of type p ,
I
T h e decompositions described in 'T'heorerns 8.1 and 8.2 will be called parallel-series decompositions of .8' and f into primes. l'hc particular decomposition supplied by Theorcm 8.2 is algorithmic in the sense that it corresponds directly to the standard and unique decomposition of the K[z]-module Q,. One could engage in elaborate algebraic arguments in trying to state and prove that the dccomposition given in Theorem 8.2 is the best possible. We shall be satisfied with a more modest result which we will now statc. Let f : A[[:]] + B[[z]] be a sequential K[z]-morphism, and let p E K[z] be a prime (i.e. an irreducible monic polynomial). We shall say p occurs in f if 0,has a primary component of type p . PROPOSITION 8.3. I f f = f , 4-f 2 where f i and J2 are sequential, and ; f p occurs in f , then p must also occur in either f l or f 2 .
Let f = gh zuhere g and h are sequential. I f curs in f , theti p mist also occur in either g or h. PROPOSITION 8.4.
p oc-
Both propositions will be proved below. An immediate consequence is
XVI. Linear Sequential Machines
430 COROLLARY 8.5. Let b
f=
c
fhtIL
. . .fil
1=I
where f,,for 1 5 i 5 k , 1 5 j 5 u , are prime of type p L , . Then all the primes occurring in f must be among the prinies pi, 1 T o prove Propositions 8.3 and 8.4, we consider inequalities between K[x]-modules. I,et Q and R be K[z]-modules. We shall write R Q if Q contains K[x]-submodules Q" c Q' c Q such that R w Q'/Q''. T h e relation is easily seen to be transitive. Further, as long as we deal with modules that are finite over K , it is also easy to see that R Q and Q R implies R Q.
<
<
<
f:A [ [ z ] ]+ R[[z]] be a sequential K[z]-movB a machine with result f,and state module Q. Then
PROPOSITION 8.6. Let
phisnz and df; A
Qs<
+
Q*
Proof, Let .&?ti be the accessible part of M . Then QIL is a K[zJsubmodule of Q and, by Theorem 5.3, Q, is a quotient K[z]-module of QtL.
Thus Q,
PROPOSITION 8.7. Let
be an exact sequence of K[z]-modules and let P is a prime. Then either P Q2 or P Q, .
<
<
< Q where P M
K[z]/(p)
P be a surProof, Let R be a K[x]-submodule of Q and let 91: R jective K[x]-morphism. Let R , = RB and R, = Ru-'. There results an exact sequence --f
0-
OL'
R2-
R
p'
Rl-
0
with u', p' defined by (x and p. Assume (x'p f 0. Since P contains no submodules except 0 and P, it follows that a'q is surjective and thus P Q2. If dcp = 0 , then p' is a well-defined surjective inorphism R, + P so that P < Q, I
<
COROLLARY 8.8.
p occurs in f if and only $+-K[z]/(p) < (& I
43 1
9. Rationality and Recurrence
+
Proof of Propositions 8.3 and 8.4, Since f is the result of .d',,.At,2 it follows from Proposition 8.6 that Q, QJ,\ Since p occurs in f , it follows from Corollary 8.8 that P Qf where P = K [ =] / (p ). Thus P Of, L Qf2 and Proposition 8.7 implies that P Q,, or P Q f 2 . T h u s P occurs in f i or in f.L. T h e proof of Proposition 8.4 is similar except that instead of Q,, x Qf,we hove the exact sequence
<
of2.
< <
<
&
0 + 0,--L 0 such that Q,f<
+
Qg
+
<
Q
Q I
The discussion of this section has an analog for the sequential machines treated in Chapters XI and XII. This is known as the Krohn-Rhodes theory, and will be developed in detail in Volume B. I n the case considered here, the algebraic background needed is easily available since the ring K[a] where K is a field is rather well known. For the KrohnRhodes theory, the necessary algebraic preparation concerning decompositions of semigroups will have to be developed essentially a6 initio. 9. Rationality and Recurrence
I n this section we assemble a number of algebraic facts that will be needed later. Let A be a K-module and let
a
=
f
a,Lucll
ll=o
be a formal power series with coefficients in -4, i.e. an element of A [ [ z ] ] . Generalizing the definition made in VII,3, we shall say that a is rational if there exist polynomials
qE
k"z],
p
E
A[z]
such that
aq
=
p,
q(0) = 1
We shall call q a denominator for a. If q has the stnallest possible degree then we shall say that q is a lowest denominator for a. Let r(.) = a01 -t clz"'-' . . . c,,,
+
+
be a monic polynomial of degree m in K[a]. We shall say that r is a re-
XVI. Linear Sequential Machines
432
for all but a finite number of indices t 2 0. If (9.1) holds for all t 2 0, then Y is called a complete recurrence polynomial for a. Observe that if r is a recurrence polynomial for a and (9.1) holds for t 2 s then z'r(z) is a complete recurrence polynomial for a. PROPOSITION 9.1.
is a denominator f o r a
The polynomial
E
A [ [ z ] ]if and only ;f
is a recurrence polynomial f o r a. Further, the polynomial ,"'Q(z)
is a complete recurrence polynoniirrl f o r a proaided s
20
and
s
-1 nz 2 deg(aq)
Indeed, relation (9.1) espresses the fact that the coefficient of zm+! in aq is zero. T h u s (9.1) holds whenever t 4-m 2 deg(aq) In general a rational power series a denominators. However we have
E
i l [ [ z ] ]may have several lowcst
PROPOSITION 9.2. If k ' is a jield, then each rational power series A [ [ z ] ]has a unique lowest denominator q. Further :'q(z) is thP lowest complete recurrence polynomial for a where a
E
{
+ deg(aq) - deg q
if deg(aq) < deg q otherwise
Proof. Let q be a lowest denominator for a. T h e n q and aq are relatively prime. If q' is another denominator for a, then q'(aq) = q(aq') and therefore q divides q'. Since q(0) = q'(0) = 1 it follows that either q = q' or deg q < deg q' I
10. Sequential Functions and Rationality
433
10. Sequential Functions and Rationality
Let 0 be a K-niodule such that [ Q : K ]= m and K-mouphisni. Then F s a t k f j e s a nionic polynomial
PROPOSITION 10.1.
let F : Q equation
--f
0 he
N
F"8 + C I J i " l
1
4- . . .
+
Cllk
=
0
with coeficients c , , . . . , cIlf in K . Proof. Let sl, . . . , x,,~E Q be generators of 0 as a K-module. There exist then elements a i j E K for i, j = 1, . . . , m such that
for all j
=
1, . . . , 712. Since x8 = C:"l xlA,, \vc have
for all j = 1, . . . , m , where d,, are the coordinates of the unit matrix I . Let E be the ring of all K-morphisms Q + Q. Clearly E is a K-algebra in which the identity morphism I : ,Q + Q is the unit element. We denote by L the K-subalgebra of E generated by the element F. Then L is commutative and its elements are polynomials in F with coefficients in A.' Note that F,, = I. 'The formula above may now be rewritten as
T h u s setting c . . Ia . .I
-
6 1J. .I;
we obtain in nz :< nz-matrix C in L and
From this system of homogencous equations we obtain by Cramer's rule (i.e. by building linear combinations whose coefficients are suitable minors of the matrix C)
xiICI=O
for
i-1,
...,m
XVI. Linear Sequential Machines
434
Since the elements x,, . . . , x,,, generate Q as a K-module, they a fortiori generate Q as an L-module. Consequently I C I = 0. Returning to the definition of C, we find
I a i j l - hL,F 1
(10.1)
=
0
where the determinant is calculated in the commutative ring L. Expanding this determinant yields the required monk polynomial I This is of course nothing else but the familiar Cayley-Hamilton theorem, proved here under minimal assumptions on K and Q. Equation (10.1) is the characteristic equation (also called the secular equation) of F . T H E O R E M 10.2.
Let
be a K[x]-nzorphism and let
(10.3) be the corresponding formal power series with coefficients in V = ( A , B ) , . If (10.2) is sequential, then (10.3) is rational. The converse also holds provided that [ A :K ] < 00. Proof.
Let
Q
B
be a machine with result f. Let [ Q : K ]= nz. Applying Proposition 10.1 we obtain elements c , , . . . , c,,, E K such that
for all t 2 0. Since f , , = GFi7-'Nfor n > 0, it follows that
+
for all 2 > 0. Thus p L for f.
+ . . . + c,,, is a recurrence
polynomial
10. Sequential Functions and Rationality
43 5
'I'o prove the converse assume that [ A: K ] .'
03
and t h a t f is rational.
I let
be a complete recurrence polynomial for f . Consider t h e free K-module KIJtwith base elements d,,, . . . , d,,, , and define the K-morphism
111
d,,_lL
=
C
-
c,d,,,- 1 - i
1=I
Clearly
d,,(L"' $- clL'n
+
and since d i= d,,Li for 0 5 i 5 m
L"k
(10.5)
*
-
.'
+ CJikL")= 0
1, it follows that
+ clL'"-l + . . . + C,,,L, = 0
Next define
-0 = '4 6R3 KJJ1
and observe that [ A X ] <: machine
00
implies [(2:K]< 00. Consider t h e finite
Q B Q F H : A+B - &= A G fo -I
with
( a @ d,)F = n @ diL aG ( a 6)d k ) H For 0
5i < m
~
CCfLI-1
=
a @ d,, for
O(i<m--l
1, we have
aGFiH
=
( a 0d,,)FiH = ( a @ d i ) H = afi,,
XVI. Linear Sequential Machines
436
and therefore
GFkH= f i t l
O
for
By assumption the sequence { f i , satisfies the recurrence formula given by r . From (l0.S) it follows that the G F I H also satisfy the same recurrence formula. Consequently, GH“H = f , l + l for all n 0. T h u s f is the result of A‘ I
>
Observe that in the machine . /Z constructed above we h a w
AG
+ AGF +
* ’ *
+ AGF‘”-’
0
1&
and thus the machine -,d! is accessible. T h u s Corollary 5.5 implies that the minimal machine .&”is finite, i.e. that [Q,:K] < 00. COROLLARY 10.3. Iff: A [ [ z ] -]B [ [ z ] ] is seqziential and [ A X ]< 00, then [Qf:K] < 00 and the minimal machine . H, is j n i t e I
As an application we prove T H E O R E M 10.4. Let L be a commiitatizre ring, and K a subring of L sitch that [ L X ] < 00. If the power series a = C:=p=, ajrz”E K[[z]] is ra-
tional over L, theii it also is rational over K. Proof.
Let
Q
L L+L
be a finite L-linear machine with result
(1.
Thus
a,, = l(GF”-’H)
for n > 0. Since [Q:L] i 00 and [Z,:K] .00,it follows that [ Q : K ]i 00 and thus we may view . / i as a finite K-linear machine. T h u s by Theorem 10.2, the coefficients { a , ! } satisfy a recurrence polynomial in K [ z ] .Consequently, a E K[[z]] is rational over k’ I EXERCISE 10.1. Show that K-module KIrLwith its endomorphism L, constructed in the proof of Theorem 10.2, wlieti reguircied as a K[z]-module is isomorpnic with K [ z ] l ( r )where r is the complete recitrrence polynomial (10.2).
11. Integral Closure and Entire Rings
43 7
Let
EXERCISE 10.2.
O
H
be a finite K-linerrr machine. z4ssiimirig [ A: K ] 00 show that the accessible port , of / i is finite. [Hint: Ilse Proposition 10.1 to show that Q<'= AG + AGF f . . . + ACF"' for some integer n1.1 ~
11. Integral Closure and Entire Rings
Let K be a commutativc ring and L a commutative ring containing K as a subring. For each elcincn 1 of L the following three properties are known to be equivalent :
(11.1)
I is the root
of a monic polynoinial in K [ z ]
(11.2) [ K [ l ] : K ] K and 1.
03
,<
where K[1] is the least subring of L containing
(1 1.3) l'here exists a subring L' of I, such that
K c I,',
1 E L',
[ L ' : K ] ,00
T h e implications (1 1.1) => (1 I .2) * (1 1.3) are clear. T h e implication (1 I .3) 3 (11.1) follows easily from Proposition 10.1. If conditions (11.1)-( 11.3) hold, then 1 is said to be integral over K. The elements of L that arc integral over K form a subring K L of L and
T h e ring K L is called the integral closiire of K in L. I n the rest of this section we shall assume that the ring K is entire (i.e. is a commutative ring in which u / ! = 0 implies a = 0 or 0 = 0). We donote by 0,the field of quotients of K . T h e integral closirve of K in 0,; is dcnoted by 1.We say that K is intepally closed if K = R . PROPOSITION 11.I. Let K be integrally closed and let p , q E Qli[z] be irioriic polytionzials. I f p y E K [ 2 ] ,then p , q E K [ z ] . Proof.
Let n
d e g p and let I, be an extension field of Q!; in which
7 .
p splits. Since p is monic, we h a w p(.)
= (z
-
I , ) . . . ( z - 1,J
XVI. Linear Sequential Machines
438
with I , , . . . , l,, E Z,. Since 11, . . . , I,, are also roots of the polynomial pq E K [ z ] ,it follows that I , , . . . , 1,, are integral over K. T h u s the elementary symmetric functions of I , , . . . , I,, are integral over K and consequently the Coefficients of p are integral over K. However they are in QKand since K is integrally closed, they must be in K. T h u s p E K [ z ] COROLLARY 11.2. Let K be integrally closed and let p , q E $Il;[.] be polynomials such that p ( 0 ) = q(0) = 1. Zf pq E K [ z ] , then p , q E K [ z ] .
Apply Proposition 11.1 to the nionic polynomials
fi
and @ noting that
P@=E € Let
PROPOSITION 11.3.
II E
(11.4)
Q,. The condition CI
E
R
implies (11.5)
There exists d
E
K
-
0 such that du"
E
K for all n 2 0.
If K is noetherian, then (1 1.5) inzplies (1 1.4). Proof. Assume iL E R. Then for some integer m > 0, urnis a linear combination with coefficients in K of 1, ( x , . . . , ixln-l . It follows that d Lfor any n 2 0 is a linear combination with coefficients in K of 1, (1, . . . , (x7tL 1. Let u = a/b with a, b E K and let d = bnh- l . T h e n (11.5) holds. Now assume that K is noetherian and that (1 1.5) holds. Let V = d-'K be the least K-submodule of Q, containing &I. Since (x" E V for all n 2 0, it follows that K[ix] c V . Since K is noetherian, it follows that [ K [ u ] : K< ] 00, and thus rx E R
T h e entire ring K is called completely integrally closed if conditions d E K -0, da"
E
K
U E Q ~ ;
for all n 2 0
imply a E K. Proposition 11.3 implies PROPOSITION 11.4. Each comnpletel-v integrally closed ring K is integrally closed. The converse also holds ;f K is noetherian €
12. The Main Rationality Theorems
439
12. The Main Rationality Theorems
With the preparation of Section 11 the main results concerning rationality may now be stated. THEOREM 12.1 (Kalman-Rouchaleau-Wyman) Let K be an entire noetlzerian ring, let a E K[[z]] be a formal power series rational over QK and let q E Q,[z]be its lowest denominator. Then a is rational over K and
q E R[z]. THEOREM 2.2 (Chabert) Let K be a completely integrally closed ring, let a E K[[z]] be a formal power series rational ooer QK and let q E Q,i(z) be its lowest denominator. Then a is rational over K and q E K [ z ] . T h e proofs of both theorems are deferred until the next section. If K is noetherian and integrally closed, then both theorems yield the same conclusion. In particular, if K = 2, they yield the Lemma of Fatou mentioned in VIII,4. Note the subtle difference in the conclusions of the two theorems. I n the second theorem q E K [ z ] and thus q is necessarily the lowest denominator of a . In the first case q E I[ and , thus if K is] not integrally closed q need not be in K [ z ] .T h u s the lowest denominator of a over K may have a degree higher than that of q. We shall show that this indeed takes place whenever K is not integrally closed. We now show that both theorems are, each in its own way, the best possible ones. For this assume
dEK duil E
-
K
0,
11
E PI;
for all
n
20
Consider the formal power series
Since
(1
-
ux)a
=
d
it follows that a is rational over Q,< and that q = 1 - uz is its lowest denominator. Assume that the conclusion of Theorem 12.2 holds. Then q E K[z] i.e. rx E K . T h u s K is completely integrally closed.
XVI. Linear Sequential Machines
440
Now assume that K is noetherian but not integrally closed. Choose R - K. Then by Proposition 11.3, d as above exists. Theorem 12.1 ensures that IX is rational over K . However q = 1 - uz is not in K [ z ] and thus the lowest denominator of a over K will have to have degree > 1 and will be a multiple of q.
cx
E
A D D E N D U M TO THEOREMS 12.1 AND 12.2. Both theorems remain
valid for a
E
K"[[z]].
For v = 1, the statement reduces to Theorems 12.1 and 12.2. We now assume v > 1 and proceed by induction. T h e power series a defines two power series a' E K [ [ c ] ]and a" E K"-'[[Z]], both of which are rational over &. Let q, q', q" be the lowest denominators of a, a', a". Since q'q" is a denominator of a, it follows that q divides q'q". T h u s qt = q'q" for some t E Qli[z]. Since q(0) = q'(0) = q"(0) = 1 it follows that t(0) = 1. By the inductive hypothesis q', q" E R[z]and thus qt E R[z].Corollary 11.2 now implies q E R[z] I Proof.
13. Proof of Theorems 12.1 and 12.2
We consider the formal power series M
a =
C
aizi E K [ [ z ] ]
1=U
d=
a, a ,.
a, a,
am-l a , is non-zero.
aW-1 . * . am s..
azm-2
13. Proof of Theorems 12.1 and 12.2
441
0 . Then for some 0 5 zi i m the row a , ) , . . . , ,O,i of earlier rows. We thus obtain a polynomial Indeed assunie d
=
a,,, ,,1-1 is a linear combination with coefficients in
(13.3)
+ PI."-' + . . . -t
y
PI>
such that
holds for all 0 5 t < m. However formula (13.2) implies that if (13.4) holds for any m consecutive integers then it also holds for the nest higher one. T h u s (13.4) holds for all t 2 0. Consequently (13.3) is a complete recurrence polynomial of degree zi , m , contradicting the minimality of m. For each i >_ 0, we consider the column vector
so that
We shall consider vectors
made u p of integers
For each such vector we consider the square matrix
obtained from the m x ( m
+ r)-matrix
by removing the columns with subscripts
vi=m+r-i-ji
XVI. Linear Sequential Machines
442
Note that O
... t ~ ~ l r n f r - 1
We denote by D ( j ) or by
D ( j , , . . j,) +
the determinant of the square matrix (13.5). We also allow the case Y = 0. I n this case the only vector j is ( ) = @ and clearly
D ( 0 )= d
(13.6) We also have for 0 < Y
D(0, j 2 , . . . , j,)
(13.7)
=
D ( h , . . . , j,)
and thus also
D(0, 0, . . . , 0)
(13.5) In the case 0 (13.9)
=
d
< r and 0 < j , we have the fundamental formula
mil, . .
' >
jr)
tI
=
C
( - l)kji+ip1D(j1 - 1, j ,
?
~
.
I , . . . , j i ,l i t . * . .,. , j,)
i=l
where
j^, indidates that j , is to be omitted. If j , + i - 1 > nz then
should be interpreted as zero. T o prove (13.9), we observe that the condition 0 - ' j , implies w1 m 4- Y 1 and thus the column s,,,, is present in (13.5). T h e recurrence formula (13.2) gives
u , +~ ' - c
~
,
Thus the determinant of (13.5) breaks up into the sum of m determinants. These will have a repeated column except when wz Y - 1 - u = zli for some 1 5 i 5 m, i.e, when
+
We thus obtain the sum of the determinants
13. Proof of Theorems 12.1 and 12.2
443
If we move the last column into its proper place we obtain
T h c determinant above is exactly
and this proves (13.9). From (13.6)-(13.9) it follows by an easy induction that
W’, . . . , j r ) = dP(j1, . , j r ) s
where P ( j , , . . . , j,) is a polynomial in Z [ a x , ,. . . , u,,,]. Formulas (13.6)(13.9) imply
( 13.6’)
(13.7’)
P(a)= 1 P(0, j , , . . . , j,)
=
P(0, . . . , 0)
(13.8‘)
=
Y
>0
1
replaced by P.
(13.9’) Formula (13.9) with Each mononiial of degree ten in the form
if
P ( j 2 , . . . , j,.)
Y
> 0 in a I , . . . , u,,, can uniquely be writ-
UJ
= (L,,
..’
clJ,
where
j = (jl? .. . jr) jl 5 j , 5 . . . 5 j , 5 nz 3
0
-’
T h e monomials of degree r will now be ordered using the lexicographic ordering of the vectors j . I n this way each polynomial P i n Z[rx,, . . . , u,,] has a leading term which is a non-zero multiple of a monomial of highest degree and highest in the lexicographic order. We assert
(13.10) T h e polynomial
P ( j ) = P ( j l , . . . , j,), has degree r and its leading term is
( - l)”’(Lj where I j
I = j , $- . . .
+ j,.
0 < r, 0 r‘ j ,
XVI. Linear Sequential Machines
444
T h e proof follows from formulas (13.6’)-( 13.9’) by an easy induction upon observing that the leading term of P ( j , , . . . , j,) also is the leading term of ( - l)kjlP(j2, . . . , j,) since all the remaining terms in (13.9’) either have degree < r (if j , = 1) or have degree r (if j , > l), but their leading monomial is lower in the lexicographic order since it involves ajl-.,which olj does not. As a consequence of (13.10) we obtain that the polynomials P ( j ) together with the polynomial P ( @ )= 1 generate the additive group of Z[u,, . . . , u,,~]. Since d P ( j ) = D ( j ) E K it further follows that
dZ[U,, . . . , U J c K
(13.11)
T h e proof of Theorem 12.2 is now immediate. Since E K for all t 2 0 and all i = 1, . . . , rn and since K is completely integrally closed it follows that u i E K and thus r ( z ) E K [ z ] . Since the minimal denominator q of a over QIi has the same coefficients as Y it follows also that q E K[z]. To prove Theorem 12.1 let
L
=
K[rw,, . . . , ( L s r ] , I‘ = d-’K
Then by (13.11), L c V . Since [T/:K]< 00 and K is noetherian, it follows that [ L : K ]< oc). Since rc is rational over L, it follows from Theorem 10.4 that a is rational over K . Since, by (11.3), L c R it follows that (xi E I? for i = 1, . . . , m T h e proof deserves two comments. T h e first one is that to prove (13.1 1) the signs in the formula (13.9) are completely irrelevant and could be replaced by T h e second comment is to the effect that if we call 1 j 1 = j , + . . . j , the weight of the monomial uj then the polynomials P(j) are isobaric, i.e. all the monomials in P ( j ) have weight I j I.
*. +
References
T h e theory of linear sequential machines was presented here as a chapter in algebra well integrated with the theory of automata. However its origins lie in the theory of continuous-time linear dynamical systems which in turn grew out of mathematical physics and electrical engineering. T h e transition from the continuous-time differential approach to the discrete-time algebraic approach took place roughly between 1940 and 1965.
References
445
W. Hurewicz, Filters and servo systems with pulsed data, Chapter 5, in “Theory of Servomechanisms,” M.I.1’. Itad. Lab. Series, pp. 231-261, McGraw-Hill, New York, 1947.
This article, imbedded in a technical work on a topic in electrical engineering, dramatizes the introduction of the discrete approach. R. I:. I
R. E. Kalnian, Lectures on controllability and ohservability, Proc. C.I.M.E. Summer School (I’ontecchio hlarconi, 1968) Edizioni Cremonese, Ronia, 1969.
Contains an extensive bibliography. This publication and the two preceding references are the basis for the approach used in this chapter. Y. Rouchaleau, 13. F. Wyman and R. E. Kalman, ,%lgebraicstructure of linearmathematical systems. 111, Realization theory over a commutative ring, Proc. Nut. Acad. Sci. U.S.A. 69 (1972), 3404-3406.
This is the source of Theorem 12.1 J. I,. Chabert, Anneaur de Fatou, Emszgmmeut Moth. 18 (1972), 141-144.
This is the source of Theorem 12.2. T h e proof given in the paper depends on an exercise in Bourbaki which uses Galois theory rather heavily. We have preferred a inore linear proof, differing from that of Theorem 12.1 only at its ending. T h e counsel and help given by R. E. Kalman during the preparation of this chapter are gratefully acknowledged.
This P a ge Intentionally Left Blank
Index
A Accessible linear sequential machine, 417 part of an automaton, 22 sequential machine, 3 3 3 state, 22 subset construction, 34 Action monoid of an automaton, 61 of a x-module, 3 I Algebra over K , 159 unitary, 162 Alphabet, 5 Analytic K-subset, 196 Automaton, 12 accessible, 14 accessible part of, 22 action monoid of, 61 behavior of, 14 coaccessible, 23 coaccessible part of, 23 complete, 30 completion of, 3 1 deterministic, 30 generalized, 19 1 graph of, 26 minimal, 43 normalized, 138 push-down, 286 reduced. 46
stack, 287 trim, 23 two-way, 283 of type ( P , r ) , 72 unambiguous, 147
B Base, 5, 88 maximal, 88 Behavior of an automaton, 14 of a machine, 267 Berstel’s theorem, 215 Bernoulli distribution, 223 Bijective interpretation, 115 Bimachine, 320 complete, 320 generalized, 320 result of, 321 C
Canonical projection, 241 Category, 6 composition in, 7 large, 8 morphisms in, 7 object of, 6 small, 8 ZCategory, 352
447
448
Index
Cayley-Hamilton theorem, 434 Chabert’s theorem, 439 Characteristic equation, 434 Closure, 379 Coaccessible state, part of an automaton, 23 Cobham’s theorem, 109 Coding, 117 Complete automaton, 30 minimal automaton, 47 recurrence polynomial, 432 semiring, 125 sequential machine, 298 subset, 47 Completely integrally closed ring, 438 Completion of a deterministic automaton, 3 1 Composition of linear sequential machines, 424 of relations, 2 of sequential machines, 350 Congruence in a monoid, 9 right, 60 Cross-section, 256
D Denominator, 204, 43 1 lowest, 43 1 Dense subset, 94 Deterministic automaton, 30 machine, 288 Differential, 314 Distance function, 359 Division theorem, I50 Domain of a relation, 3 Dual, 415
E Edge, 12 label of, 12 Equality theorem, 143 Equivalence relation, 8 Equivalent types, 268 Expansion of real numbers, 363
F Feller’s Tauberian theorem, 2 14 Fine morphism, 6 Free monoid, base of, 5 Function, 3 bijective, 3 generalized sequential, 299 injective, 3 linear sequential, 4 1 1 sequential, 298, 360 surjective, 3
G Generalized automaton, 191 Generating function, 196 Generic sequence, 395 Ginsburg-Rose theorem, 3 17 Graph of an automaton, 26 of a relation. 2
H Hadamard product, 197 Height, 162, 169 Hilbert curve, 376 Hurwitz product, 197
I Initial state, 12 Input alphabet, 267 code, 267 Integral closure, 437 Integrally closed ring, 43 1 Internal shuffle product, 20 Interpretation bijective, 115 Polish, 116 reversed, 115 reversed bijective, 116 Russian, 116 standard, 104 Inverse relation, 2
Index
449 K
k-recognizable sequence, 394 set, 107 K-subset, 126 K-2-automaton, 135 Kalman-Rouchaleau-Wyman 439 Kleene’s theorem, 175
Multiplication left, 34 right, 35 Multiplicative dependence, 109 Multiplicative relation, 164 Multiplicity, 120, 126 theorem.
L Left multiplication, 34 Left shift, 417 Length-preserving relation, 254 Limit theorem, 220 Linear sequential machine, 409 accessible, 4 17 direct product of, 41 1 finite, 41 1 minimal, 417 reduced, 417 result of. 409 Local set, 27 Locally finite family, 127 monoid, 170 semigroup, 170
M Machine deterministic, 288 of type a, 266 Turing, 288 Maximal base, 88 prefix, 92 Mealy machine, 299 Minimal automaton, 43 linear sequential machine, 417 sequential machine, 338 Modules, 3 1 Monoid, 3 morphism of, 4 syntactic, 62 Moore machine, 299, 3 12
N Natural factorization mapping, 9 Next-state function, 297 Non-singular subset, 188 Normalization procedure, 139 Normalized automaton, 138 Null path, 13 0
output alphabet, 267 code, 267 extended, 297 function, 297 module, 298 module, generalized, 299
P Palindrome, 56 Parallel composition, 422 Parallel product, 354 Path in an automaton, 13 label of, 13 length of, 13 successful, 14 Peano curve, 37 1 Period, 100 of an analytic function, 209 Partial function, 3 Polish interpretation, 116 Positive semiring, 125 Positive rational function, 282 Post correspondence problem, 159 Prefix, 78 maximal, 92 Primary module, 428 Proper state mapping, 39 Purely singular subset, 189 Push-down automaton, 286
450
Index
Q Quotient criterion, 55
R Rational closure, 163 expression, 167 formal power series, 204 K-subset, 163 operation, 161 relation, 236 Rationally closed subset, 161 Recognizable K-subset, 139 subset, 14 power series, 199 Recurrence formula, 205 polynomial, 432 Recurrent state, 97 Reduced automaton, 46 linear sequential machine, 417 output module, 338 Relation, 2 composition of, 2 computed by a machine, 267 domain of, 2 equivalence, 8 graph of, 2 inverse of, 2 length-preserving, 254 multiplicative, 164 positive rational, 282 rational, 236 Remak-Krull-Schmidt theorem, 427 Replacement procedure, 273 Restriction mapping, 40 Result of a bimachine, 321 linear sequential machine, 409 sequential machine, 298 Reversal of an automaton, 18 function, 18 Reversed interpretation, 115 Right congruence, 60 Right multiplication, 34 Right shift, 406 Russian interpretation, 116
S 2-module, 31 action of, 3 1 complete, 31 Schutzenberger’s theorem, 230 Semigroup, 6 Semiring. 122 complete, 125 positive, 125 Sequential machine, 296 accessible, 333 complete, 298 generalized, 299 minimal, 417 result of, 298 state-dependent, 3 12 Series composition, 425 Shuffle product, 19 internal, 20 Singleton, 127 Skolem-Mahler-Lech theorem, 206 Stack automaton, 287 Standard interpretation, 104 Standard pair representation, 105 State, 12 accessible, 22 coaccessible, 23 initial, 12 recurent, 97 terminal, 12 State-mapping of automata, 38 complete, 412 of linear sequential machines, 412 proper, 38 of sequential machines, 330 State relation, 41 1 Stem, 100 Strong minimization problem, 343 Subalgebra, 160 Subcategory, 7 full, 7 Subdivision property, 71 Submonoid, 4 Subset construction, 33 accessible, 34 Substitution, 173 Subtraction theorem, 153 Successful path, 14 Support, 127
Index
451
Syntactic monoid, 62 morphism, 62 Synthesis problem, 348
T Terminal state, 12 subset of a machine, 268 Thue sequence, 399 Trim automaton, 23 Trivial path, 13 Transducer, 273 accelerated, 276 Transition matrix, 14 Turing machine, 288 Two-way automaton, 283 Type of a machine, 266
U Ultimately periodic sequence, 362 Ultimately periodic set, 101 Unambiguous automaton, 147 rational operations, 186
relation, 1 3 1 subset, 126 Uniform distribution, 224 Unitary, 77 algebra, 162 component, 77 monoid, 80 subset, 76 Unitary-prefix decomposition, 85 Unitary-prefix monomial, 85
V Very fine morphism, 6
W Word, 5 initial segment of, 6 segment of, 5 terminal segment of, 6
z Zero in a monoid, 64
This P a ge Intentionally Left Blank