Sunteți pe pagina 1din 441

Progress in Computer Science and Applied Logic

Volume 21

Editor

John C. Cherniavsky, National Science Foundation

Associate Editors

Robert Constable, Cornell University


Jean Gallier, University of Pennsylvania
Richard Platek, Cornell University
Richard Statman, Carnegie-Mellon University
Bakhadyr Khoussainov
Anil Nerode

Automata Theory
and its Applications

Springer Science+Business Media, LLC


Bakhadyr Khoussainov Anii Nerode
Department of Computer Science Department of Mathematics
The University of Auckland Cornell University
Auckland Ithaca, NY 14850
New Zealand U.S.A.

Library of Congress Cataloging-in-Publication Data

Khoussainov, Bakhadyr, 1961-


Automata theory and its applications / Bakhadyr Khoussainov, Anii Nerode.
p. cm. - (Progress in computer science and applied logic; v. 21)
Includes bibliographical references and index.
ISBN 978-1-4612-6645-7 ISBN 978-1-4612-0171-7 (eBook)
DOI 10.1007/978-1-4612-0171-7
1. Machine theory. 1. Nerode, Anii, 1932- II. Title. III. Series.

QA267.K56 2001
511.3-dc21 2001025819
CIP

AMS Subject Classifications: O3D05, 68Q05, 68Q1O, 68Q45, 68Q70, 68RI5

Printed on acid-free paper


© 2001 Springer Science+Business Media New York
Originally published by Birkhauser Boston in 2001
Softcover reprint ofthe hardcover lst edition 2001

AII rights reserved. This work may not be translated or copied in whole Of in par! without the written
permission of the publisher. except for brief excerpts in connection with reviews or scholarlyanalysis.
Use in connection with any form of information storage and retrieval, electronic adaptation, computer
software, or by similar or dis similar methodology now known or hereafter developed is forbidden.
The use of general descriptive names, trade names, trademarks, etc., in this publication, even if the
former are not especially identified, is not to be taken as a sign that such names, as understood by the
Trade Marks and Merchandise Marks Act, may accordingly be used freely by anyone.

SPIN 10776946
ISBN 978-1-4612-6645-7
Reformatted from author's files in L:\TEX 2e by John Spiegelman, Philadelphia, PA

987 6 543 2 1
Contents

Preface xi

1 Basic Notions 1
1.1 Sets ... 1
1.2 Sequences and Tuples ·.·. 5
1.3 Functions, Relations, Operations 6
1.4 Equivalence Relations. 11
1.5 Linearly Ordered Sets 14
1.6 Partially Ordered Sets 17
1.7 Graphs. 19
1.8 Induction. 24
1.9 Trees and Konig's Lemma. 27
1.10 Countable and Uncountable Sets 30
1.10.1 Countable Sets. . . · . · . 32
1.10.2 Diagonalization and Uncountable Sets. 35
1.11 Algorithms. · . · .... .. 36

2 Finite Automata 39
2.1 Two Examples . .. · . . .... 40
2.1.1 The Consumer-Producer Problem.. 40
2.1.2 A Monkey and Banana Problem. 42
2.2 Finite Automata .. · ...... 46
vi Contents

2.2.1 Definition of Finite Automata and Languages .. 46


2.2.2 Runs (Computations) of Finite Automata. 50
2.2.3 Accessibility and Recognizability. 56
2.3 Closure Properties . . . . . . . . . . . . . . . . 58
2.3.1 Union and Intersection. . . . . . . . . . . 58
2.3.2 Complementation and Nondeterminism.. 62
2.3.3 On the Exponential Blow-Up of Complementation. 66
2.3.4 Some Other Operations. 67
2.3.5 Projections of Languages. 70
2.4 The Myhill-Nerode Theorem 72
2.5 The Kleene Theorem ... 76
2.5.1 Regular Languages.. . 76
2.5.2 Regular Expressions. . 79
2.5.3 The Kleene Theorem.. 81
2.6 Generalized Finite Automata 85
2.7 The Pumping Lemma and Decidability 93
2.7.1 Basic Problems. ... 93
2.7.2 The Pumping Lemma. 93
2.7.3 Decidability. ...... 95
2.8 Relations and Finite Automata 97
2.9 Finite Automata with Equations . 101
2.9.1 Preliminaries. . . . . . . . 101
2.9.2 Properties of E-Languages .. 103
2.10 Monadic Second Order Logic of Strings 105
2.10.1 Finite Chains . . . . . . . . . . . . 105
2.10.2 The Monadic Second Order Logic of Strings. 106
2.10.3 Satisfiability. .......... 109
2.10.4 Discussion and Plan About SFS. 111
2.10.5 From Automata to Formulas. . 112
2.10.6 From Formulas to Automata. . 117

3 Biichi Automata 121


3.1 Two Examples . ................. 122
3.1.1 The Dining Philosophers Problem. . . . . 123
3.1.2 Consumer-Producer Problem Revisited .. 125
3.2 Btichi Automata . . . . . . . . . . . . . . 127
3.2.1 Basic Notions . . . . . . . . . . . . 128
3.2.2 Union, Intersection, and Projection. 139
3.3 The Btichi Theorem . . . . . . . 143
3.3.1 Auxiliary Results.. . . . . . . . 143
3.3.2 Btichi's Characterization. . . . . 147
3.4 Complementation for Btichi Automata 150
3.4.1 Basic Notations. ........ 150
Contents vii

3.4.2 Congruence~ . . . . . . . 151


3.5 The Complementation Theorem. 154
3.6 Determinism . . . . . . . . . . . 160
3.7 Miiller Automata . . . . . . . . 162
3.7.1 Motivation and Definition. 163
3.7.2 Properties of Miiller Automata .. 167
3.7.3 Sequential Rabin Automata. 170
3.8 The McNaughton Theorem 175
3.8.1 Flag Points .. . 175
3.8.2 The Theorem. . . . . 179
3.9 Decidability . . . . . . . . 184
3.10 Biichi Automata and the Successor Function 187
3.10.1 w-Strings as Structures.. . . . . . . 187
3.10.2 Monadic Second Order Formalism. 189
3.10.3 Satisfiability. . . . . . . . . . . . . 191
3.10.4 From Biichi Automata to Formulas. 194
3.10.5 From Formulas to Biichi Automata. 198
3.10.6 Decidability and Definability in SIS. 201
3.11 An Application of the McNaughton Theorem . 202

4 Games Played on Finite Graphs 209


4.1 Introduction........ 209
4.2 Finite Games . . . . . . . 210
4.2.1 Informal Description .. 210
4.2.2 Definition of Finite Games and Examples .. 212
4.2.3 Finding The Winners.. . . . . . . . . . 215
4.3 Infinite Games . . . . . . . . . . . . . . . . . 218
4.3.1 Informal Description and an Example .. 218
4.3.2 Formal Definition of Games .. 220
4.3.3 Strategies . . . . . . . . . . . . 222
4.4 Update Games and Update Networks 224
4.4.1 Update Games and Examples. 225
4.4.2 Deciding Update Networks. 226
4.5 Solving Games . . . . . . . . . . . 231
4.5.1 Forgetful Strategies. . . . . . 231
4.5.2 Constructing Forgetful Strategies. 236
4.5.3 No-Memory Forcing Strategies. 239
4.5.4 Finding Winning Forgetful Strategies. 243

5 Rabin Automata 249


5.1 Rabin Automata . . . . . . . . . . . . . . 250
5.1.1 Union, Intersection, and Projection. 259
5.2 Special Automata . . . . . . . . . . . . . 262
viii Contents

5.2.1 Basic Properties of Special Automata. . . 263


5.2.2 A Counterexample to Complementation .. 265
5.3 Game Automata . . . . 270
5.3.1 What Is a Game? 270
5.3.2 Game Automata. 272
5.3.3 Strategies . . . . . 274
5.4 Equivalence of Rabin and Game Automata . 276
5.5 Terminology: Arenas, Games, and Strategies 281
5.6 The Notion of Rank . 287
5.7 Open Games . . . . . 290
5.8 Congruence Relations 292
5.9 Sewing Theorem . . . 295
5.10 Can Mr. (E) Visit C Infinitely Often? 300
5.10.1 Determinacy Theorem for Games (n, [C), E) .. 301
5.10.2 An Example of More Complex Games. 304
5.11 The Determinacy Theorem . . . . . . . . . . . . . . 306
5.11.1 GH-Games and Last Visitation Record. . .. . 306
5.11.2 The Restricted Memory Determinacy Theorem. 308
5.12 Complementation and Decidability . . . . . . . . 318
5.12.1 Forgetful Determinacy Theorem.. . . . . . 318
5.12.2 Solution of the Complementation Problem. 319
5.12.3 Decidability. . . . . . . . . . . . . . . . . 327

6 Applications of Rabin Automata 329


6.1 Structures and Types. . . . . . . . . . 330
6.2 The Monadic Second Order Language 333
6.3 Satisfiability and Theories . . . . . . . 336
6.4 Isomorphisms . . . . . . . . . . . . . 338
6.5 Definability in T and Decidability of S2S 339
6.5.1 ~-Valued Trees as Structures . . . . 340
6.5.2 Definable Relations. . . . . . . . . 341
6.5.3 From Rabin Automata to Formulas. 343
6.5.4 From Formulas to Rabin Automata. 346
6.5.5 Definability and Decidability. 349
6.6 The Structure with (J) Successors . . . 350
6.7 Applications to Linearly Ordered Sets 354
6.7.1 Two Algebraic Facts .. . 354
6.7.2 Decidability. . . . . . . 358
6.8 Application to Unary Algebras 361
6.8.1 Unary Structures. . . . 361
6.8.2 Enveloping Algebras ... 363
6.8.3 Decidability. . . . . . . 365
6.9 Applications to Cantor's Discontinuum . 369
Contents ix

6.9.1 A Brief Excursion to Cantor's Discontinuum. . 369


6.9.2 Cantor's Discontinuum as a Topological Space. 372
6.9.3 Expressing Subsets of CD in S2S. 374
6.9.4 Decidability Results. . . . . . . . . . . . 378
6.10 Application to Boolean Algebras . . . . . . . . 382
6.10.1 A Brief Excursion into Boolean Algebras. 382
6.10.2 Ideals, Factors, and Subalgebras of Boolean Algebras. 385
6.10.3 Maximal Ideals of Boolean Algebras. . 388
6.10.4 The Stone Representation Theorem. . . 390
6.10.5 Homomorphisms of Boolean Algebras. 392
6.10.6 Decidability Results. . . . . . . . . . . 397

Bibliography 403

Index 423
Preface

The theory of finite automata on finite stings, infinite strings, and trees has had a dis-
tinguished history. First, automata were introduced to represent idealized switching
circuits augmented by unit delays. This was the period of Shannon, McCullouch
and Pitts, and Howard Aiken, ending about 1950. Then in the 1950s there was
the work of Kleene on representable events, of Myhill and Nerode on finite coset
congruence relations on strings, of Rabin and Scott on power set automata. In the
1960s, there was the work of Btichi on automata on infinite strings and the second
order theory of one successor, then Rabin's 1968 result on automata on infinite
trees and the second order theory of two successors. The latter was a mystery until
the introduction of forgetful determinacy games by Gurevich and Harrington in
1982. Each of these developments has successful and prospective applications in
computer science. They should all be part of every computer scientist's toolbox.
Suppose that we take a computer scientist's point of view. One can think
of finite automata as the mathematical representation of programs that run us-
ing fixed finite resources. Then Btichi's SIS can be thought of as a theory of
programs which run forever (like operating systems or banking systems) and are
deterministic. Finally, Rabin's S2S is a theory of programs which run forever and
are nondeterministic. Indeed many questions of verification can be decided in the
decidable theories of these automata. These automata also arise in other languages
such as temporal logic and the fL-calculus.
Suppose we take a mathematical logician 's point of view. Each of the classes
of automata discussed has a corresponding natural decidable theory. As Rabin
showed, many theories can be proved decidable by coding them into S2S. Even
xii Preface

structures coded into finite automata have proved to be very interesting; witness
the theory of automatic groups in topology and the theory of automatic structures.
But when the senior author has asked his students to learn these subjects
from available textbooks and papers on automata, they have ended up all over the
literature trying to put together a coherent exposition. The authors decided to fill
this gap with a single self-contained book.
This book is a text suitable for a one or two semester course for computer
science or mathematics majors, or for a semester graduate course or seminar. The
book introduces at the beginning the rudimentary set theory needed, which can be
skipped by most readers, advances slowly through the theory of finite automata,
and then progresses to the more advanced subjects and some of their applications.
We hope that this book will make these beautiful theories available to a larger
audience. No advanced mathematical background is required to follow the book.
Now we briefly outline the book. The book consists of a bibliography and
six chapters titled:

• Basic Notions,

• Finite Automata,

• BUchi Automata,

• Games Played on Finite Graphs,

• Rabin Automata,

• Applications of Rabin Automata.

In the first chapter we discuss some basics of rudimentary set theory needed
in the book. The chapter can be skipped by most readers.
The second chapter is devoted to finite automata. In this chapter we include
well-known theorems, The Kleene Theorem and Myhil-Nerode Theorem, which
are usually taught in beginning computer science and mathematics courses on
computations. We put some topics in this chapter that are usually not covered in
the courses. These are finite automata recognizable relations and finite automata
with equational constraints. The last section of the chapter is an application of finite
automata to logic. The section proves the decidability of the monadic second order
logic of finite strings.
The third chapter on BUchi automata contains basic results on BUchi automata
and BUchi recognizable languages. In this chapter we investigate the relationship
between BUchi automata and other types of finite state machines such as MUller
automata and sequential Rabin automata. The chapter contains many basic and
well-known results about these machines, in particular The McNaughton Theorem.
As an application ofBUchi automata we prove the result, first proved by BUchi, that
the monadic second order theory of one successor (known as SIS) is decidable.
Preface xiii

In the fourth chapter we introduce games played on hnite graphs. These


games were first studied by McNaughton in the early 1990s, inspired by the work
of Gurevich and Harrington on decidability of S2S. The purpose of this chapter is
to give a game-theoretic model for concurrent processes of infinite duration and
to familiarize the reader with game-theoretic terminology. This chapter introduces
the concept of the last visitation record, which plays an important role in proving
some fundamental results in this as well as the next chapter. We also introduce and
study update games and update networks.
The fifth chapter is devoted to Rabin automata. We present the full proof of the
complementation problem for Rabin automata by proving that the complement of
any Rabin recognizable language is Rabin recognizable. Our proof uses the game-
theoretic technique of Gurevich and Harrington. In the chapter we also discuss
automata called special automata, and show that these are weaker than Rabin
automata.
The last chapter contains a series of examples of applications of Rabin au-
tomata to mathematical theories. The chapter shows that the following theories
are decidable: monadic second order theory of n successors, the monadic second
order theory of all countable linearly ordered sets, the monadic second order the-
ory of all countable unary algebras, the theory of Boolean algebras with first order
quantifiers and quantifiers over ideals, and theories of structures related to Cantor's
discontinuum. All these were first proved by Rabin in his famous 1969 paper.
Our bibliography is relatively short, and by no means represents the full range
of papers on automata and applications of automata. Therefore, naturally many pa-
pers are not included in the bibliography as extensive and updated bibiographies
are available on the internet. We also note that there are excellent survey papers on
automata in The Handbook of Formal Languages and The Handbook ofTheoreti-
cal Computer Science that give extensive bibliographical lists of papers and books
on the subject. See for example papers by D. Perrin (Finite Automata), W. Thomas
(Languages, Automata, and Logic), and Sheng Yu (Regular Languages). In gather-
ing the bibliography our basic objective was to show the variety of applications of
automata to other areas of mathematics and computer science, e.g., algebra, concur-
rency, complexity, logic, image processing, hybrid systems, networks, probability,
programming, real time systems, topology.
All the necessary notation and definitions used in this book are introduced
in the text. Some proofs of statements (e.g., theorems, lemmas, etc.) are finished
with the box 0 sign. This usually means that there is an exercise following that
asks the reader to check the correctness of some segments of the proof.
Most parts of this book have been taught in graduate and undergraduate
courses for mathematics and computer science students at Cornell University, The
University of Wisconsin at Madison, The University of Chicago, and partially at
Auckland University in New Zealand between 1996 and 2000. We should mention
a group of logic graduate students of Cornell University between 1995 and 1999:
Jennifer Davoren, Suman Ganguli, Denis Hirschfeldt, Joe Miller, Robert Milnikel,
xiv Preface

Reed Solomon, and Walker White. Each of them contributed a number of comments
and corrections to the text of this book. Suman Ganguli, Denis Hirschfeldt, and
Joe Miller put a great effort into the notes of the course and made an enormous
number of corrections and suggestions to improve each of the chapters. We thank
Richard Shore (Cornell University), Steffen Lempp (The University of Wisconsin
at Madison), and Robert Soare (The University of Chicago) who actually attended
those graduate courses, made a number of important comments, and discussed
the content of the courses. We thank Sasha Rubin, Auckland graduate student, for
checking most of the last chapter, Elena Calude from Massey University in New
Zealand for reading and commenting on the chapter on Finite Automata. We also
thank Michael Dinneen who has been involved in work related to update games
and finite automata with equations. We thank Crisian Calude as we benefited from
his comments, suggestions and interest in this book. We acknowledge the support
of the DOD MURI program, Marsden Fund of New Zealand Royal Society, and
the University of Auckland Research Committee.
We dedicate this book to our families (parents, wives, sons, and daughters)
for their continuing support.
1
Basic Notions

1.1 Sets
Basic objects of many branches of mathematics and foundations of computer sci-
ence are sets and objects that form those sets. The theory of computations on finite
state machines (or as we could say the theory of automata) is not an exception.
We begin our discussion with an explanation of sets, their objects, constructions
that form sets from given ones and notations. We shall use all these notions and
notations throughout the book. Here is an informal definition of set.
Definition 1.1.1 A set is a collection of objects.
The objects that form the set may be of any type such as positive numbers,
rational numbers, some symbols, integers, points in two dimensional space, and
even some other sets. The objects that form the given set are called elements of
the set. We may well call these elements members of the set. There are mainly two
ways to describe sets. One way of describing a set is simply by listing its elements
inside braces. Here are some examples.
Example 1.1.1
1. The set {a, b, c, d} contains four elements: a, b, c, d.
2. The set {4, 3, 17} consists of three elements, which are 4,3, 17.
Given a set and an object we can ask ifthe object is a member ofthe set or
not. To do this we use two symbols, E and ~, which tell us if the object is a member

B. Khoussainov et al., Automata Theory and its Applications


© Birkhäuser Boston 2001
2 1. Basic Notions

of the set or not, respectively. For example, a E {a, b, c, d}, 17 tj. {a, b, c, d}. So
the symbols E and tj. represent the relationship between elements and sets and are
notations for set membership and nonmembership, respectively.
Given two sets, say A and B, we can compare them. A natural way to compare
two sets is to look at their members and see how members of one set are related
to those of the other set. We say that A is a subset of B, written A ~ B, if every
member of A is a member of B. In case A is a subset of B but B has some members
which are not in A, then we say that A is a proper subset of B, written A C B.
Assume that we are given two sets A and B. Then we say that the sets A and Bare
equal if A ~ Band B ~ A. If two sets A and B are equal we write this A = B.
Thus, in order to show that two given sets A and B are equal, one needs to prove
that every member of A is a member of B and every member of B is a member
of A.

Exercise 1.1.1 For each of the pair of sets A and B below, determine whether
A C B or Be A.

1. A = {I,2}, B = {2, 3,4}.

2. A = {a,c}, B = {c,d,a}.
3. A = {3,2,a}, B = {2,3,a}.
4. A = {4, 7, -I}, B = {7, 3, 4}.
Note that the order of the listing elements of a given set does not matter.
Thus the sets {a, b, c}, {b, a, c}, {c, b, a} are the same. We also note that repeti-
tion in the listing of elements of a given set does not matter either. So the sets
{a, b, b, a, a, c, c, c} and {a, c, b} are the same.
An important abstract notion of mathematics is the notion of infinity. A set
A is infinite if A contains infinitely many members. We cannot, naturally, write
down a list of all members of an infinite set. Instead we use ... notation to mean
that the list continues forever. A very simple first example of an infinite set is the
set of natural numbers all of whose elements are listed as follows:

0,1,2,3,4,5,6,7,8,9, ....

We use the following notation for this set: w (read as omega). So w is the set
{O, 1,2,3, ... }. Another example of an infinite set is the set of all integers, which
we denote by Z:

Z = { ... , -3, -2, -1,0,1,2,3, " .}.


The second way of describing sets consists of specifying its elements. In
other words, if we want to describe a set according to some rule or specification,
we write
{a I a has property Pl.
1.1. Sets 3

So we see that the set {n In = 2k for some natural number k} consists of all even
natural numbers. Similarly, the set {n I n is a prime natural number} consists of
all prime numbers.
Now we explain some operations on sets. Operations on sets are means to
create new sets from known ones. The most common operations on sets are the
union operation, intersection operation, and complementation operation. We
now explain these operations.
Let A be a set. Then the complement of set A, usually written as A, is the set
whose elements are those under consideration which are not members of A. Say,
for example, the objects under consideration are natural numbers. Therefore, if A
is the set of all even numbers, then the complement of A is the set of all odd natural
numbers. It is often very useful in mathematics to visually represent the concepts
defined. For the complementation operation we use a type of picture called a Venn
diagram. For example, in Figure 1.1 we represent the set A as the unshaded area.
The coml

Figure 1.1: The complement of A is the shaded area.

We now describe the intersection operation for two sets. Assume that A and
n
B are two sets. Then the intersection of these two sets written A B is obtained
by putting all elements that are members of both A and B into one single set. For
example, for sets A = {3,4, l7, b, c} and B = {a, 3, b, c, d}, the intersection of
these two sets An B is {b, c, 3}. Thus we see that A n
B consists of all elements
that are members of both A and B. A Venn diagram for the intersection operation
is represented in Figure
.---
A

Figure 1.2: The intersection of A and B is the shaded area.

Assume we have two sets: A and B. Let us now take all elements of A and all
elements of B, and then put all of these elements into one single set. This is called
the union of A and B. The union of A and B is written as A U B. For example, if
A = {3, 4, 17} and B = {a, b, c, d}, then the union AU B is {a, b, c, d, 3,4, 17}.
4 1. Basic Notions

Thus we see that A U B consists of all elements that are either members of A or
members of B. Hence, we can write A U B as follows:

AU B = {x I x is a member of Aor x is a member of B}.


A Venn diagram for the union operation of two sets is represented in Fig-
ure 1.3. The union set in Fi Ie whole shaded area.

Figure 1.3: The union of A and B is the shaded area.

n
Note that the set A B is a subset of the set A U B. This can be seen by
examining the Venn diagrams.

Exercise 1.1.2

1. The difference of A and B, written A \ B, is the set of all elements that


belong to A but not B. Draw a Venn diagram for the difference of sets A
and B.

2. The symmetric difference of two sets A and B is the set defined by

CA \ B) UCB \ A).
Draw a Venn diagram for the symmetric difference of A and B.

Now it is clear that

The last equality states that the complement of the complement of any set A is the
set A itself. One last note: the set with no elements is called the empty set. We
denote the empty set by 0. Clearly, for any set A, we must have

Exercise 1.1.3 Check the correctness of the equalities


1.2. Sequences and Tuples 5

Exercise 1.1.4 For each of the sets A and B below find AU B and A n B.
1. A = {l, 2}, B = {2, 3, 4}.
2. A = {a, c}, B = {c, d, a}.
3. A = {3,2,a}, B = {2, 3,a}.
4. A = {4, 7, -1}, B = {7, 3, 4}.

1.2 Sequences and Tuples


A sequence is obtained when we list some objects. So, for example,

1,2,3,4 and a,c,u,w and 9,8,7,4,2,3,2,2,3

are sequences. The length of the first sequence is 4, of the second is 4, and of the
last is 9. Thus, the length of the sequence is the number of elements that occur in
the sequence. Note that some elements in the sequence may occur several times.
Moreover, the order in the sequences matters which is in contrast with listing
elements of sets. Two sequences are equal if they have the same length and the
same elements occur in the same order. For example, the sequence 1,2,5,4 is not
equal to 1,2,4,5 nor to 1,2,3,5,4,4.
A sequence is infinite if its length is not finite. For example,

2,1,4,3,6,5,8,7,10,11, ...

is an infinite sequence. In order to distinguish finite sequences from infinite se-


quences, finite sequences are called tuples. Tuples are usually written within paren-
theses. So, for example,

(1,2,3,4) and (a, c, u, w) and (9,8,7,4,2,3,2,2,3)

are tuples. A tuple of length 2 is called a pair or 2-tuple, a tuple of length 3 is


called a triple or 3-tuple, and in general, a tuple of length k is called a k-tuple.
Tuples can be elements of other sets. For example, the set of all pairs formed from
two symbols a and b is {(a, a), (a, b), (b, a), (b, b)}.
Assume that A and B are given sets. In mathematics it happens quite often
that we want to form the set whose elements are pairs of the type (a, b) where a is
a member of A and b is a member of B. Here are two examples.

Example 1.2.1 Let A be {1, 2}, and let B be{1, 2, 3}. Weformtheset{(1, 1), (1, 2),
(1, 3), (2, 1), (2, 2), (2, 3)}. Geometrically, we can represent this set as the set of
points in the xy-coordinate system.
6 1. Basic Notions

Example 1.2.2 Let A be {I, 2}, and let B bew. So we canform the set {(1, 0), (2,0),
(1,1), (2, 1), (1,2), (2,2), (1,3), (2,3), ... }. Geometrically, inthexy-coordinate
system, we can represent this set as the set of points of the lines x = 1 and x = 2
whose y-coordinates are natural numbers.

These two examples naturally lead us to the following definition.

Definition 1.2.1 The cross product (or Cartesian product) of sets A and B,
written A x B, is the set of all pairs such that the first element of each pair is a
member of A, and the second element is a member of B.

We can easily generalize the cross product operation as follows. The Carte-
sian product of sets AI, ... , Ak, written Al x ... x Ak, is the set of all k-tuples
(aI, ... , ak) such that each ai is a member of Ai, i = 1, ... , k. If all Ai are equal
to the same set A, then we write Ak.

Example 1.2.3

1. If A = {a, I}, B = {a, b}, C = {(O, O)}, then


A x B x C = {(O, a, (0,0», (0, b, (0,0», (1, a, (0,0», (1, b, (0, O))}.

2. The set Z2 = {(i, j) Ii, j E Z} consists of all pairs (i, j) of integers. This
is the set of all points in the plane whose x and y coordinates are integers.

3. The set Z3 = {(i, j, k) I i, j, k E Z} consists of all triples (i, j, k) of


integers. This is the set of all points in the three dimensional space whose x,
y and z coordinates are integers. Geometrically, this is a three dimensional
grid.
Exercise 1.2.1 Find the cross products A x B, A x A, and A x B x A for the
following sets:
1. A = {I, 2}, B = {2, 3, 4}.
2. A = {a,c}, B = {c,d,a}.
3. A = w, B = {I, 2}.

4. A = {c, d}, B = 0.

1.3 Functions, Relations, Operations


As this book studies finite state machines (finite automata), the definition of each
of these machines involves in one or in another way the notion of function. So
this notion is central to the subject of this book. We also add that the notion of
function is indeed central to mathematics. Functions are studied from algebraic,
topological, algorithmic, and combinatorial points of view.
1.3. Functions, Relations, Operations 7

Informally, a function is given by some rule. The function takes an input from
a set A and according to the rule mayor may not produce an output from a set B.
No function produces two different outputs for the same input. So if a is an input
and b is the corresponding output of the function f, then we write

f(a) = b.

In this case we say that f maps a to b. Functions are sometimes called mappings.
We can collect all the outputs of the function f and form a single set. This set is
called the range of the function f. For instance, consider the function which takes
a natural number n as an input and outputs the number 2n. Then the range of this
function is the set of all even numbers. We denote the range of f by Range(f).

Exercise 1.3.1 Consider the functions defined below. Find the range of each of
the functions:

1. For any integer n, fen) = -no

2. For any natural number n, fen) = 0.


3. For any integer n, fen) = -1 ifn is odd, and fen) = 1 ifn is even.

We denote functions by letters f, g, h, .... Let f be a function. Let A be the


set from which f takes inputs. Let B be the set to which f gives outputs. We write
this as
f: A -7 B.
From the set A now we can collect all elements d such that when f is supplied
with d, f gives an output. Let us put all such elements into one set. This set is
called the domain offunction f and is denoted by Domain(f). Thus, for a function
f : A -7 B we have
Domain(f) = {x Ix E A and fex) E B}.

Similarly,

Range(f) = {y lyE Band f(x) = y for some x E A}.

Example 1.3.1 Consider the function f : Z -7 Z defined as follows. For every


integern, ifn > 0, then fen) = 1; ifn < 0, then fen) = -1. Then the domain of
f consists of all nonzero integers.

Exercise 1.3.2 Consider the functions defined below. Find the domain and the
range of each of the functions.

1. The function f : W -7 W is such that for every natural n, f outputs k only


when n = 2k where k is a natural number.
8 1. Basic Notions

2. The function f : (j) -+ Z is such that for every integer n, if n ::s 0, then
f(n) = -n; ifn > 5, then f(n) = n.

We can describe functions by using tables. Tables usually list all inputs and
outputs of functions. We give some examples.

Example 1.3.2 Consider the function f: {a,b,c,d,e} -+ {2,3,4,5,6} whose


table is given below.

x a b c d e

f(x) 3 3 3 5

The range afthisfunction is {3, 5}. The domain of this function is {a, b, c, d}.

We give another example.

Example 1.3.3 Consider the function f from {1, 2,3, 4} x {a, b, c} to {O, 1, 2}
whose table is given below.

f 1 2 3 4

a 1 1 2 2

b 2 1 1 2

c 1 2 2 1

Clearly, the range of the function is {1, 2} and the domain of the function is
{1, 2, 3, 4} x {a, b, c}.

In the last two examples the domains and ranges of the functions are finite
sets. Therefore, these functions are finite. Formally, a finite function is one whose
domain and range are finite sets. Clearly, any function with finite domain is a finite
function.
Let A and B be sets. Let f be a function whose domain is the set A, that is
Domain(f) = A, and whose range is a subset of B. Of course, there is nothing
1.3. Functions, Relations, Operations 9

in the definition of function that guarantees that the range of f coincides with the
whole set B. For example f can send all elements of A onto a given fixed element
of B. In the case when the range of f coincides with the whole set B we say that f
maps A onto B. In this case the function f is called onto function. For example
the mapping g : w -+ w given by the rule g(x) = 2x, for all x E w, does not map
the set of all natural numbers w onto w. However, g maps w onto the set {x I x E w
and x is even number}. There are other types of mappings which are of particular
interest. Among them are injections and bijections. A mapping f from A into B is
an injection if Domain (f) = A and no two elements from A are mapped into the
same element of B. For example, the function g : w -+ w above injects w into w.
Exercise 1.3.3 Show that the mapping f(x) = x 2 , x is an integer, is not an
inJection from the set of integers Z into Z.
A mapping f from A to B is a bijection if f is onto and is an injection.
Sometimes bijections are called one-to-one functions. Thus, for example the map-
ping g above from w to w is not a bijection. Informally, a bijection from A to B
sets up a one-to-one correspondence between the elements of the set A and the
elements of the set B.
Exercise 1.3.4 Let A and B be two finite sets with the same number of elements.
Show that there exists a biJection from A onto B.
We say that two functions are equal functions if the functions have the same
domain, and for every input from the domain the functions give the same output.
Thus, if we want to check whether or not two functions f and g from A into B
are equal, we need to show that f(a) = g(a) for all elements a E A and that
Domain(f) = Domain(g).
It is interesting to note that there exists a relationship between subsets of
a given set A and functions f which map the set A into the set {O, I} with
Domain(f) = A. Thus, any function f : A -+ {O, I} whose domain is A can
be associated with the set B = {x I x E A, f(x) = I}. The function f is called the
characteristic function of the set B. In turn, any subset B of A defines a function
g as follows. For every x E A, if x E B, then g(x) = 1; and if x rf. B, then
g(x) = O. Thus, the function g as defined equals the characteristic function of the
set B.
Now we begin explaining relations and predicates. Suppose we have a set A.
Let U be a subset of A. Let us take a member, say a, of the set A. For the element
a there are two possibilities with respect to the subset U: a is a member of U; a
is not a member of U. So we conclude that for every element a the fact that a is a
member of U is either true or false. This simply means that U defines in a natural
way a function f from the set A into the set {true,false} as follows:
1. If a is in U, then f(a) = true;
2. If a does not belong to U, then f(a) = false.
10 1. Basic Notions

Such a function is called a predicate. In the case of the subset U, the predicate is
unary because it states whether the fact "a belongs to U" is true or false. Predicates
can be binary. A binary predicate on set A is simply a function f which outputs
true or false for every (input) pair (a, b) from the set A. A binary relation on A is
a subset R of A 2 . Every binary predicate f defines the binary relation R f on A as
follows:
a pair (a, b) belongs to Rf if and only if f(a, b) = true.
So we see that for every pair (a, b), it is true that the pair belongs to the relation
R f if and only if the predicate f outputs true when the input is (a, b). Now let us
take a subset R of pairs of the set A. In other words, we take R to be a subset of
A2. The set R defines in a natural way the function f from the set A2 to the set
{true,false} as follows.

1. If (a, b) is in R, then f(a, b) = true;

2. If (a, b) is not a member of R, then f(a, b) = false.


We see that R defines its own predicate. Thus, we can identify predicates with
relations and relations with predicates.

Example 1.3.4 Say A = to, 1, 2}. Consider the following relation:

R = {CO, 1), (0,2), (1, 2)}.

Then the predicate defined by this relation is

1. The predicate outputs true on the pairs (0, 1), (0, 2), (1, 2).

2. The predicate outputs false on all other pairs.

Example 1.3.5 Suppose that A = {O, 1, 2}. Consider the predicate whose value is
true on pairs (0, 1), (0,2), (0,0), (1, 1), and (2, 2) and is false for all other pairs.
Then the relation R defined by this predicate is simply

R = {CO, 1), (0,2), (0,0), (1,1), (2, 2)}.

Therefore, we identify binary relations with binary predicates. We might be


interested not only in unary or binary predicates (relations) but also in predicates
that output true or false values on 3-tuples, 4-tuples, or in general, on k-tuples.
Therefore, we give the following definition.

Definition 1.3.1 A k-ary relation or k-ary predicate R, or (k-place predicate)


on set A is a subset of Ak. If a k-tuple (ai, ... , ak) belongs to R, then we say that
R(al, ... ,ak) is true. If the k-tuple (ai, ... , ak) does not belong to R, then we say
that R(al, ... , ak) is false.
1.4. Equivalence Relations 11

An example of a 3-place predicate G + on w is the graph of the addition


function +. Thus, for any triple (n, m, s) of natural numbers the predicate G+ is
true on (n, m, s) if and only if n + m = s.

Exercise 1.3.5 Let A be a set with exactly n elements. How many unary relations
does A have? How many binary relations does A have? How many k-ary relations
does A have?

Let A be a set. Then a unary operation on this set is any function f whose
domain is A and the range is a subset of A. Thus, functions f : A ~ A with
Domain(f) = A are unary operations on the set A. For example, the operation
that maps every natural number n into 5n is a unary operation on w. The function
sin(x) that maps every real number x into sin(x) is a unary operation on the set R
of all reals. A binary operation on A is any function f whose domain is A 2 and
whose range is a subset of A. Thus, functions f : A 2 ~ A with Domain(f) = A 2
are binary operations on the set A. For example, the operation that maps every pair
(n, m) of natural numbers into 5n + m is a binary operation on w. The function
y x sin(x) that maps every pair (x, y) of real numbers into y x sin (x ) is a binary
operation on the set R of all reals. In general, an n-ary operation (or equivalently
n-place operation) on a set A is a function whose domain is An and whose range
is a subset of A. Thus, an n-place operation f sends every n-tuple (a), ... , an) of
elements of the set A into some element f(a), ... , an) of A.
Every n-place operation on a set A defines in a natural wayan n + l-ary
predicate on A. Indeed, let f : An ~ A be an n-ary operation on A. Define the
relation G f, called the graph of f as follows: (a), ... , an, b) belongs to G f if
and only if f(a), ... , an) = b. Clearly, G f is an n + I-place predicate on A.

1.4 Equivalence Relations


An important class of binary predicates on a set is the class of relations called
equivalence relations. Here is a very simple example of an equivalence relation.
Consider the set w of natural numbers. We say that the natural number i is equivalent
to number j from w, written i "-' j, if i - j is a multiple of number 4. Note that
the following properties hold:

1. Each number i is equivalent to itself. This is because i - i = 0 is a multiple


of 4.

2. If i is equivalent to j then j is equivalent to i. This is of course true because


if i - j is a mUltiple of 4, then so is j - i.

3. If i is equivalent to j and j is equivalent to k then i is equivalent to k. This


is also true because i - k = (i - j) + (j - k). Note that the sum of any two
numbers which are multiples of 4 is also a multiple of 4. Hence i - k is a
multiple of 4.
12 1. Basic Notions

Thus, we see that rv is a binary relation on w, e.g., rv is the following subset


ofw 2 :
{(i, j) Ii - j is a multiple of 4}.
This subset "-' possesses the above three properties. Informally, rv identifies num-
bers i and j if i - j is a multiple of 4. Now let us take number O. Then the numbers
equivalent to 0 are
0,4, 8, 12, 16, ....
Let us take a number not in the list above, for instance 1. The numbers equivalent
to 1 are:
1,5,9,13, ....
Similarly, the numbers equivalent to 2 are

2,6, 10, 14, ....

Finally, the numbers equivalent to 3 are

3,7,11,15, ....

We denote the set of numbers equivalent to 0, 1, 2, and 3, by [0], [1], [2], [3],
respectively. We call these sets equivalence classes of the binary relation "'. Now
these classes satisfy the following two properties.

l. Every natural number is either in [0] or [1] or [2] or [3].

2. Any two distinct equivalence classes have no elements in common.

In other words, "-' defines a partition of the natural numbers. We see that the
partition consists of subsets of w such that the union of these subsets gives the set
of all natural numbers. Moreover, these subsets have no elements in common, e.g.,
they are disjoint.
Based on the example provided above we give the following important def-
inition.

Definition 1.4.1 An equivalence relation on a set A is a binary relation R on A


that satisfies the following three conditions:

l. R is reflexive e.g.,for all x E A, (x, x) E R.

2. R is symmetric e.g., for all x, YEA, if (x, y) E R, then (y, x) E R.

3. R is transitive e.g.,for all x, y, Z E A, if(x, y) E Rand (y, z) E R, then


(x,z)ER.

If(x, y) E R, then we say that x and yare R-equivalent or simply equivalent


1.4. Equivalence Relations 13

Thus,the relation""" considered above is, as we have already shown, an equiv-


alence relation on w.

Exercise 1.4.1 Let n ::: 1 be a natural number. Say that i, jEw are equivalent,
written i =n j, if i - j is a multiple ofn. Show that the relation =n is an equivalence
relation on w.

Now assume that R is an equivalence relation on set A. Our goal is to partition


the set A with respect to R as we partitioned w into [0], [1], [2], and [3] with respect
to ,...., relation. Take an element a EA. Consider the set of all elements b of A such
that a and bare R-equivalent. We denote this set by [a]. Thus, we have

[a] = {b I (a, b) E R}.

Call the set [a] an equivalence class. Let us now see what properties these equiv-
alence classes possess.
First of all note that each element a of A is in some equivalence class. Indeed,
since R is reflexive, we see that (a, a) E R. Therefore, a E [a]. This simply means
that the union of equivalence classes gives the set A. Note that this is similar to the
case that w is a union ofthe equivalence classes [0], [1], [2] and [3] in the example
discussed above.
Second, assume that we take two equivalence classes, say [a] and [b]. Our
claim is that either [a] coincides with set [b], or [a] and [b] have no elements in
common. How can we prove this claim? If [a] and [b] have indeed no elements
in common, then the claim is proved trivially. So, the only other thing that could
happen is that [a] and [b] have an element in common. Assume that [a] and [b] have
an element in common. We want to show that [a] = [b]. In order to show that two
sets [a] and [b] are the same we need to show that [b] S; [a] and [a] S; [b]. Say that
c is an element that belongs to both [a] and [b]. Then (a, c) E Rand (c, b) E R by
the definition of [a] and [b]. Now note that R is transitive. Therefore, (a, b) E R.
Therefore, b E [a], that is (b, a) E R. Now take any x E [b]. Then (x, b) E R.
Since R is transitive, we get (x, a) E R. We obtain that [b] S; [a]. Similarly,
[a] S; [b]. So we proved the claim. Thus we have proved the following facts:

1. Each element a of A belongs to some equivalence class. Hence the union of


all the equivalence classes is A.

2. Any two equivalence classes either coincide or have no elements in common.

These two statements are in exact correspondence with the statements (1) and (2)
about the equivalence relation""" discussed above.
We will need one extra notion that will be used quite often in the book.
Consider all the equivalence classes of an equivalence relation R on a set A.
Assume that the number of all the equivalence classes is finite and equals n. Then
we say that R has a finite index and the index is n. If the number of equivalence
14 1. Basic Notions

classes altogether is infinite, then we say that the index of R is infinite. More
formally, the index of the equivalence relation R is the number of its equivalence
classes. We conclude that the relation ~ discussed at the beginning of this section
has index 4.

Exercise 1.4.2 Show that the index of the relation ==n defined in Exercise 1.4.1
equals n. What are the equivalence classes of the relation ==n?

Exercise 1.4.3 Consider the set w. Let 0 = ao < al < a2 < ... be an infinite
sequence ofnatural numbers. We say that a pair (x, y) ofnatural numbers belongs
to R if and only if ai :::: x < ai+1 and ai :::: y < ai+1 for some i. Show that R is
an equivalence relation. What are the equivalence classes of this relation?

Exercise 1.4.4 Let f be a function from A into B with Domain(f). Define the
relation
Rf = {(x, y)lf(x) = f(y)}·
Show that the relation is an equivalence relation on A. What are the equivalence
classes of R ? The set R f is called the kernel of the function f.

Exercise 1.4.5 Let A be a set and R be an equivalence relation on A. Show that


there exists a function f : A -+ B such that R coincides with the kernel (see
Exercise 1.4.4) of f. (Hint: the range ofthe desiredfunction is the set ofequivalence
classes of R).

Exercise 1.4.6 Assume that R, S, T standfor "reflexive, ""symmetric, "and "tran-


sitive, " respectively. For all distinct a, b, c E {R, S, T} find a binary relation that
has property a and b but not c.

1.5 Linearly Ordered Sets


Another example of a binary relation is one that orders elements of a given set.
Such relations are called linear orderings. In order to explain linear orderings on
sets, consider the set A that consists of three elements a, b, and c. Suppose that
we are asked to put these elements in some order. Well, we could order these three
elements in six different ways. We present three of them. The first one is

a ::::1 b ::::1 c;

the second one is


b ::::2 c ::::2 a;
the third one is
c ::::3 a ::::3 b.
In the first ordering, which we denoted by :::: I, the order:::: 1 puts a as the smallest
element, puts c as the biggest element, and b is put between a and c. In the second
1.5. Linearly Ordered Sets 15

ordering, which we denoted by ::;2, the order ::;2 puts b as the smallest element,
puts a as the biggest element, and c is put between b and a. Finally, in the third
ordering, which we denoted by ::;3, the order ::;3 puts c as the smallest element,
puts b as the biggest element and a is put between c and b.

Exercise 1.5.1 Write down the other three orderings of elements a, b, and c.

Let us analyse one of these orders, say ::;2. From the point of view of ::;2, ::;2
claims that it holds the pairs

(b, b), (b, c), (b, a), (c, c), (c, a), (a, a).

This is because ::;2 orders the elements as follows:

b ::;2 b, b ::;2 c, b ::;2 a, c ::;2 c, c ::;2 a, a ::;2 a.

We conclude that the ordering ::;2 can be identified with a binary relation on the
set {a, b, c} that consists of the pairs

(b, b), (b, c), (b, a), (c, c), (c, a), (a, a).

So we can write the equality

::;2= {(b, b), (b, c), (b, a), (c, c), (c, a), (a, a)}.

Exercise 1.5.2 Identify each of the other (five) orderings of elements a, b, and c
as binary relations on the set {a, b, c}.

Now we make the following notation. For a binary relation R and pair (a, b)
we may right aRb to mean (a, b) E R. The considerations above lead us to give
the following definition.

Definition 1.5.1 Let A be a set. A binary relation::; on the set A is called linear
ordering on A if the following properties of::; hold true:

1. For all a E A, a ::; a.

2. For all a, b E A, if a ::; band b ::; a, then a = b.

3. For all a, b, c E A, ifa ::; band b ::; c, then a::; c.

4. (linear order axiom) For all a, b E A either a ::; b or b ::; a.

If::; is a linear ordering on the set A, then the set A together with the relation ::;,
that is, the pair (A, ::;) is a linearly ordered set.

Now one can give many examples oflinearly ordered sets. Here are some of
them.
16 1. Basic Notions

Example 1.5.1
1. The natural numbers w together with the natural ordering ::::, that is, (w, ::::)
is a linearly ordered set.
2. The pair (Q, ::::), where Q is the set of rational numbers (fractions) and ::::
is the natural ordering of rational numbers, is a linearly ordered set.
3. The pair (Z, ::::), where Z is the set of integer numbers and:::: is the natural
ordering on integer numbers, is a linearly ordered set.
4. The pair (R, ::::), where R is the set of all real numbers and:::: is the usual
order on R, is a linearly ordered set.
Of course, not every relation on a set A is a linear ordering of the set. For
example, any equivalence relation on A cannot be linear ordering of A unless A
contains exactly one element.
Exercise 1.5.3 Let A be a finite set. Show that there is a binary relotion :::: on A
such that (A, ::::) is a linearly ordered set.
Interestingly, one can add linearly ordered sets. Indeed, assume that we
have two linearly ordered sets LI = (LI,::::d and L2 = (L2, ::::2). Suppose that
LI n L2 = 0. Then the linearly ordered set LI + L2, called the sum ofLI and L2,
is obtained as follows.
1. The set of all elements of L I + L2 is the union L I U L2·
2. The order:::: on LI + L2 is defined as the union
::::1 U::::2 U{(a, b)la ELI, bE L2}·
Thus, according to the definition above LI + L2 = (LI U L2, ::::). An informal
explanation ofLI +L2 is as follows. The relation:::: orders the union of LI and L2
in such a way that elements of LI come first in their order and then the elements
of L2 come in their order. Thus, all elements of L I are less than all elements of
L2. It is not hard to see that LI + L2 is a linearly ordered set. Indeed, let us show
that LI + L2 satisfies all the conditions needed for :::: to be a linear ordering (see
Definition 1.5.1). Let us check the first condition. Take any a E LI U L2. If a E LI,
then a ::::1 a. If a E L2, then a ::::2 a. Hence, examining how:::: is defined, we see
that a :::: a.
Let us check the second condition. Suppose that a :::: band b :::: a. Note
that in this case if a E LI, then bELl. Similarly, if a E L2, then b E L2. Then
in the first case a ::::1 band b ::::1 a. Then it must be the case that a = b. In the
second case a ::::2 band b ::::2 a. Then it must be the case that a = b. So the second
condition holds.
We leave the reader to check the correctness of the other axioms of linearly
ordered sets for LI + L2.
1.6. Partially Ordered Sets 17

Exercise 1.5.4 Show that ~ defined for LI + L2 satisfies the following condition.
For all a, b, cELl U L2, either a ~ bar b ~ a, and if a ~ band b ~ c then
a~c
Exercise 1.5.5 Fix a natural number n > 1. Consider the =n equivalence relation
(see Exercise 1.4.1). For any number mEw, let rem) be the remainder obtained
by dividing m to n. Define the following binary relation ~n on the set w. For any
two natural numbers k and s

1. if k =n s then k ~n s if and only if k ~ s, where ~ is the natural order.

2. ifk is not =n-equivalent to s, then k ~n s ifand only ifr(k) ~ rem).

Show that (w, ~n) is a linearly ordered set.

The next exercise shows that one can multiply linearly ordered sets.

Exercise 1.5.6 Let LI = (LI, ~j) andL2 = (L2, ~, ~2) be linearly ordered sets.
Define the linearly ordered set LI x L2 as follows:

1. The elements ofLI x L2 are all pairs (a, b) such that a E LI and bE L2.

2. The relation ~ on LI x L2 is defined by the following rule. Let (ai, bl),


(a2, b2) E LI x L2. Then (ai, bj) ~ (a2, b2) if and only if either al = a2
and bl ~2 h, or al ~I a2 and al f= a2·
Show that the pair LI x L2 = (LI x L2, ~) is a linearly ordered set. This is called
the product of linearly ordered sets.

Exercise 1.5.7 A linearly ordered set (A, ~) is well-ordered iffor every non empty
subset B of A there exists abE B such that b ~ bl for all bl E B. Do the following:

1. Show that any finite linearly ordered set is well-ordered.

2. Show that (w, ~) is well-ordered.

3. Show that ifLI andL2 are well-ordered sets, then so are LI +L2 andLI x L2.

1.6 Partially Ordered Sets


Another important class of binary relations is the class of partial orderings. Linear
orderings are examples of partial orderings. Informally a partial ordering of a set
compares elements of the set. Some elements a and b may be comparable and
the others not. Hence the word "partial" is used. Before we give a definition of
partially ordered sets we present one example.
Let A = {a, b, c}. Consider all subsets of A. These are:

0, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, A.


18 l. Basic Notions

We can compare these sets using the subset relation. The empty set 0 is included
in all subsets of A. Hence, in this sense, it is the smallest set. The set A contains all
subsets of A. Hence, in this sense, A is the biggest set. Similarly, {a} is less than
{a, b} and {a, c} because {a} is included in both. Likewise, {b} is less than {b, c}
and {b, a} since {b} is included in both. The sets {a} and {b} are not comparable
because neither of them is a subset of the other. By the same reason the sets {a, b}
and {b, c} are not comparable. Let us make all these explanations more formal
now. On the set of all subsets of A consider the relation S; which consists of the
following pairs:
(X, X), (X, A), (0, X), ({a}, {a, bD, ({a}, {a, cD, ({b}, {b, cD, ({b}, {b, aD,
({c}, {c, bD, ({c}, {c, aD,
where X c A. The relation S; on subsets of A satisfies the following properties:

1. For all X, X S; X.

2. For all X and Y, if X S; Y and Y S; X, then X = Y.


3. For all X, Y, Z, if X S; Y and Y S; Z, then X S; Z.

Informally, 0 is the smallest element, {a, b, c} is the greatest element with respect
to S; relation. A set X is smaller than Y if X S; Y. There are incomparable subsets
of A, for example {a} and {b} are incomparable. Thus, we are led to the following
definition.

Definition 1.6.1 Let B be a set. A binary relation :s on the set B is called a partial
ordering on B if the following properties of:S hold:

1. For all a E B, a :s a.
2. For all a, b E B, if a :s band b :s a, then a = b.
3. For all a, b, c E B, if a :s band b :s c, then a :s c.

If:s is a partial ordering on the set B, then the set B together with the relation :S,
that is, the pair (B, :s) is a partially ordered set

Thus, one can see that this definition lacks the linear order axiom used in the
definition of the linearly ordered sets.
The example above leads us to define another important notion, the notion
of power set.

Definition 1.6.2 Let A be any set. The power set of A, denoted either by P(A) or
by 2 A , is the set whose elements are exactly all subsets of A.

Note that for any set A, 0 and A are elements of P(A). Therefore, P(A) is
not empty.
1.7. Graphs 19

Exercise 1.6.1 Write down the power set of the set {O, 1,2, 3}.

Exercise 1.6.2 Let A be a set. Show that the following are partially ordered sets.

1. The pair (A, R), where R = {(a, a)la E A}.

2. The pair (P(A), S;), where peA) is the power set of A and X S; Y if and
only if X is a subset ofY.

Exercise 1.6.3 Let A = {a, b, c}. How many partial orders are on the set A?

Exercise 1.6.4 On the set w consider the relation

R = {CO, n) ! nEw} U{(x, y) I y = k· x for some k E W}.

Show that R is a partial order on w.

Exercise 1.6.5 On the set w consider the function f(x) = 2x. Let fi(x) be the
value obtained by applying f consecutively i times to x. Thus,for example ,j5 (1) =
f(f(f(f(f(l))))) = 32, f2(7) = f(f(7» = 28. fO(x) is always x for all x.
Consider the relation

R = {en, m) In E w, mEw, and fi(n) = mforsome i}.


Show that the relation R is a partial order.

Finally, we present a few notions useful in the study of partially ordered sets.
Let (A, :s) be a partially ordered set and let B S; A. An element bo E B is minimal
if no element of B is strictly less than bo, that is for all b E B if b :s bo, then b = boo

Example 1.6.1 Let X be the set of all nonempty subsets of set Y f= 0. Consider
the partially ordered set (X, S;). The minimal elements of the partially ordered set
are exactly those subsets of Y which contain one element only.

An element ao in a partially ordered set (A, :s) is the least (or equivalently
the smallest) element if all elements of A are less than or equal to aD, that is,
ao :s a for all a E A. It is not hard to see that a partially ordered set cannot have
two distinct least elements. Indeed, if a and b are least elements, then it must be the
case that a :s band b :s a. Therefore, a must be equal to b. On the other hand, one
can give an example of a partially ordered set which has distinct minimal elements.

1.7 Graphs
The next fundamental notion needed for this book is the notion of a graph. There
are two types of graphs: directed graphs and undirected graphs. We begin our
explanation with undirected graphs.
20 1. Basic Notions

Figure 1.4: An undirected graph example.

An undirected graph contains points and some lines that connect those points.
The points are usually called nodes or vertexes. The first example of a graph is in
Figure 1.4.
In the graph presented in Figure 1.4 we have five nodes. We also have seven
lines connecting pairs of some nodes. These lines are called edges. So this graph
has seven edges. There is no sense of direction on the edges. In this graph the nodes
are the numbers 1,2, 3,4,5. If we think of the nodes as locations and the edges as
paths between locations, then for example we can travel between the nodes 1 and
4 in either direction along the edges connecting them. This graph possesses one
topological property: for any two nodes we can travel from one to the other along
the edges. For example, we can travel from 1 to 2 in many ways: we can travel
from the node 1 to the node 2 using the edge connecting them; we can travel from
1 to 2 by first going to 4, then from 4 to 3 and from 3 to 2. The graphs at which
one can travel from any node to any other node along the edges are usually called
connected graphs.
Let us consider now the second example of a graph presented in Figure 1.5.
In this graph we have nine nodes. We also have nine edges between some points.
Again there is no sense of direction on the edges. For example, we can travel
between points 2 and 3 in either direction. However, this graph is not connected.
This is because there is no way we can travel from the node 0 to the node 6.

Figure 1.5: Unconnected graph example.

As we see from the examples above, each undirected graph consists of:

1. A set of nodes, and


1.7. Graphs 21

2. A set of edges.

Now if sand s' are nodes of a graph and they are connected via an edge, then the
edge can simply be identified with the pair (s, s'). Since we can travel between s
and s' in either direction, we can also identify the edge with the pair (s', s).
Thus, the first example of an undirected graph can be explained in mathe-
matical terms as follows. The nodes of the graph are:

1, 2, 3, 4, 5,

and the edges are


(1,2), (2,1), (1, 3), (3,1), (1,4), (4,1), (1,5), (5,1), (2, 3), (3,2), (3,4), (4, 3),
(4,5), (5,4).
So we see that we can identify every undirected graph with a set S of nodes
together with a set E of edges which is a symmetric binary relation on S. So here
is a definition.

Definition 1.7.1 An undirected graph is a pair (S, E) such that S is a set ofnodes
and E is a symmetric binary relation on S. If(s, s') E E, then we say that there is
an edge between sand s'.

Exercise 1.7.1 Consider the following two undirected graphs:

and

Write down the set of nodes of each of the graphs and identify the edges of the
graphs with appropriate symmetric binary relations.

In this book the finite state machines we will study will be presented as
directed graphs. The difference between undirected and directed graphs is quite
obvious. The edges in directed graphs carry information about directions. Here we
begin with some examples. Consider the graph in Figure 1.6.
22 1. Basic Notions

Figure 1.6: A directed graph example.

In this graph we have five nodes. We also have seven lines between some
points, again called edges. So in this graph we have seven edges. But now each
edge possesses a sense of a direction. For example, there are directed edges from
°
point 4 to the node 0, from to the nodes 1,2 and 3. However, there are directed
°
edges neither from to 4 nor from 1 to 0. Here is the second example presented in
Figure 1.7.

Figure 1.7: A directed graph example.

In this graph we have nine nodes. We also have nine edges between some
nodes. Each edge is a directed edge. For example we can travel from the node 2

°
to the node 3 and from 3 to 5 via edges. We can also travel from the node to
8 by moving along the edges first from to 1 and then from 1 to 8. However,
°
we cannot travel from node 8 to any other node since there is no directed edge
outgoing from 8.
The first example (see Figure 1.6) can be explained in mathematical terms
as follows. The nodes of the graph are: 0, 1, 2, 3, 4 and the edges are
(0,1), (0,2), (0,3), (1,2), (2,3), (3,4), (4,0).
So we see that we can identify every directed graph with a set S of nodes
together with a set E which is simply a binary relation on S. So here is a definition.
Definition 1.7.2 A directed graph is a pair (S, E) such that S is a set a/nodes
and E is a binary relation on S. lies, s') E E, then we say that there is a directed
edge/rom s to s'.
A path in a graph (directed or undirected) is a sequence of nodes connected by
edges. More formally, a path is a sequencea\, ... ,ak of nodes in the graph such that
(ai, ai +1), i = 1, ... , k - 1, are all edges of the graph. Note that a path in a directed
graph should follow the directions on edges. A graph is connected if there exists
1. 7. Graphs 23

a path between any two nodes of the graph. Note that the first example (above)
of a directed graph is connected while the second is not connected. Sometimes
connected directed graphs are called strongly connected.
When we have a graph, we sometimes label edges. Such graphs are called
labeled graphs. The labeling of edges usually carries an important piece of informa-
tion. For example nodes of a graph can represent cities and edges can represent bus
routes between the cities. Let us consider an example of a labeled graph presented
in Figure 1.8.

Figure 1.8: A labeled graph example.

The graph in Figure 1.8 is a labeled directed graph. For instance, the edge
from 1 to 2 is labeled with 150. This simply can be interpreted as that the distance
(or cost of the ticket) from city 1 to city 2 equals 150. Let us consider another
example presented in Figure 1.9.

Figure 1.9: Another labeled graph example.

In this example, the graph contains four nodes 0, 1, 2 and 3, and edges (0, 1),
(1,2), (2, 3), (2, 0), (3, 0). The edges are labeled with letters a or b. One can think
of this graph as follows. The nodes represent states of a computer. Labels represent
instructions (or inputs). A directed edge from s to s' labeled with, say a, represents
the following statement. If the computer is in state s and executes the instruction
a (or reads the input a), then the computer changes its state from s to s'.
It is also interesting to note that the labeled graphs define 3-ary relations
in a natural way. Let us consider the first example of the directed graph above.
Consider the nodes 1 and 2. The edge between these nodes is labeled with 150. We
can simply code the information that there is an edge from 1 to 2 labeled with 150
as the triple:
(1, 150, 2).
24 1. Basic Notions

So the whole description of the first directed labeled graph can be presented as:

1. The set {I, 2, 3} of nodes, and

2. The set T of triples:

{(I, 150, 2), (2,80,3), (3,80,2), (3,25, I)}.

Similarly, the second directed labeled graph can be presented as:

1. The set S of nodes {O, 1,2, 3}, and

2. The set T of triples

{CO, a, 1), (1, b, 2), (2, a, 3), (2, a, 0), (3, a, O)}.

1.8 Induction
Induction plays an important role in computer science as well as in mathematics.
It is quite often that we build certain mathematical or abstract computer science
objects by using induction. By constructing the objects, we often want these objects
to satisfy certain properties. Then in order to prove that the built objects satisfy the
desired properties, we use induction. We recall the induction principle for natural
numbers.

Let P be a property on natural numbers. Assume that 0 satisfies the


property P. Suppose that for every natural number n, the fact that n
satisfies the property P always implies that n + 1 satisfies the property
P. Then all natural numbers have the property P.

This principle shows us how to check whether a given property P is true for all
natural numbers. To check this we must do the following.

• We need to show that 0 satisfies the property P. This is called the base case
of the induction.

• Assuming that n has property P we should show that n + 1 has the property P.
The assumption that n has the property P is called the induction hypothesis.
The process of checking whether or not n + 1 has the property P is called
the inductive step.

Let us consider an application of this principle. Let P be the property that states
the following:

For every natural number n, the double sum of all natural numbers
less than or equal to n is n x (n + 1).
1.8. Induction 25

In order to check whether this property holds true on all natural numbers, we
use the induction principle.
°
Base Case. Clearly, satisfies the property P because the double sum of all
°°
natural numbers less than or equal to is + 0, and equal to Ox (0 + 1).
Inductive Step. We assume that the inductive hypothesis holds true. In other
words, we suppose that P is true for the natural number n, that is, the double sum
of all natural numbers less than or equal to n is n x (n + 1). Take the number n + l.
Now we want to show that the double sum of all natural numbers less than or equal
to n + 1 is (n + 1) x (n + 2). Well, the double sum of all natural numbers less than
or equal to n + 1 equals the double sum of all natural numbers less than or equal
to n plus n + 1 plus n + 1. Since we assume, by the induction hypothesis, that the
double sum of all natural numbers less than or equal to n is n x (n + 1), we see
that the double sum of all natural numbers less than or equal to n + 1 is

n x (n + 1) + (n + 1) + (n + 1)
which in turn equals
(n + 2) + 1).
x (n
So the property P is true for the number n + l. By the induction principle the
property P holds true for all numbers n.
Exercise 1.8.1 Show, using the induction principle on natural numbers, that the
sum 2° + 21 + 22 + ... + 2n equals 2n+1 - 1 for all n.

The induction principle on natural numbers can be extended to other objects


of mathematics. Such more general induction is used in mathematics and computer
science very often. A typical and more general case of the use of induction can
informally be described as follows.
We build certain structures, let us call them objects, by stages. At the initial
stage (we call it stage 0), we pick up certain simple structures and declare them to
be objects. At any other stage we build new structures "by putting together" those
objects that we have built so far up to the current stage. Then we declare these new
structures to be objects too. Then we look at all the objects constructed at stage 0,
stage 1, stage 2, ... and put all of them into one set. Anything from the set is of
course an object that is created at certain stage s.
Now if we want to prove some properties of these built objects, then we use
induction. The induction is used in a way very similar to the induction principle
for natural numbers. Here is an informal explanation of the induction principle.
Let P be a property ofthe objects we have constructed. Assume that all
objects built at the initial stage satisfy the property P. Suppose that for
any s, the fact that all objects built at stage i, i = 0, 1, ... , s, satisfy
the property P always implies that the objects built at stage s + 1
satisfy the property P. Then all the built objects have the property P.
26 1. Basic Notions

This principle shows us how to check whether a given property P is true for all
the objects. To check this we must do the following.

• We need to show that all objects built at stage


is called the base case of the induction .
° satisfy the property P. This

• Assuming that all objects built at stages i, i = 0, ... , s, have property P, we


should show that all objects built at stage s + 1 also have the property P. The
assumption that all objects built at stage i, i = 1, ... , s, have the property P
is called the induction hypothesis. The process of checking whether or not
all objects built at stage s + 1 have the property P is called the inductive
step.

Now we give an example. We build objects called propositions by stages. The


propositions are built as follows.
Stage 0. At this stage propositions are simply symbols

PO, PI, P2, ... , Pn,

Call these propositions atomic propositions.


Stage s + 1. Suppose that ex and f3 are propositions that have been built at the
previous stages. Then

(ex V(3), (ex&f3) , (ex --+ (3), (-,ex)

are also propositions.


Thus, for example the following are propositions:

The proposition PI is defined at stage 0, the propositions (PI VP2) and (-'P3)
are defined at stage 1, and the proposition (( -'P3) V(PI &p5» is defined at stage
2. Now we give an application of the induction principle to show that certain
properties of propositions hold true.
Let us for example show that every proposition is either atomic or begins
with a left parenthesis ( and ends with a right parenthesis). We prove this claim
by the induction principle.
°
Base Case. Consider stage of the definition of propositions. If ex is a propo-
sition defined at this stage, then ex is atomic. Hence the claim we wanted to prove
is correct at the base case.
Inductive Step. Our induction hypothesis is the following. Any proposition
ex defined before the stage s + 1 is either atomic or begins with a left parenthesis
1.9. Trees and Konig's Lemma 27

( and ends with a right parenthesis). Take a proposition cx. If cx is defined before
stage s + 1, then, by the induction hypothesis, cx is either atomic or begins a left
parenthesis ( and ends with a right parenthesis). Suppose that cx is defined at stage
s + 1. Then cx is in one of the following forms:

Clearly, each of these propositions begins with a left parenthesis ( and ends with a
right parenthesis). Hence the induction step is proved.
Thus, by the induction principle, every proposition is either atomic or begins
with a left parenthesis ( and ends with a right parenthesis ).
In this book the induction principle will be used quite often, and we suggest
the reader to go through the exercises below.

Exercise 1.8.2 Prove that the power set P(A) of a set A with n elements has 2n
members.

Exercise 1.8.3 Consider the following three symbols: a, b, c. Define by stages


strings of these symbols:
Stage 1. Strings of length 1 are a, band conly.
Stage s + 1. Let u I, ... , U m be strings of length s. Then the strings of length
s + 1 are ula, ulb, UIC, ... , uma, umb, umc.
Show that for every natural number s ::: 1 the number of strings of length s
is 3s .

Exercise 1.8.4 Let cx be a proposition and x E {V, &, -+}. Show that if cx =
(CXI x CX2) and cx = (fh x fh), then CXI = fh and CX2 = fh Show that ifcx = (--'CXI)
and cx = (--,{3d, then CXI = {31.

1.9 Trees and Konig's Lemma


Let us first describe a tree informally. A tree has its root. The root is the lowest
node of the tree. Apart from the root the tree has other nodes. Each node may
branch up. Say x is a node on the tree. If x has n outgoing branches, then x has
exactly n immediate successors which x branches to. Each of these immediate
successors may also have outgoing branches. So a general picture of a tree looks
like Figure 1.10.
In this figure r is the root. The nodes of the tree are all labeled with letters
a, b, ... ,0 together with the root. So, for example a has exactly one immediate
successor which is d; b has two immediate successors which are e and /; i has
no outgoing branch so it has no immediate successors. A path in this tree is any
sequence
YO, YI, Y2,···
28 1. Basic Notions

Figure 1.10: An example of a tree.

such that YO is the root, Yl is an immediate successor of YO, and in general each
Yi+ 1 is an immediate successor of Yi. A path may terminate at a node Yj if Yj has
no outgoing branches. Thus, for example, in the tree above r, b, e, j, m is a path.
So a natural question is the following:

Can we give an exact mathematical definition of a tree?

Well, if we use our knowledge about partially ordered sets, then of course we can
give a definition to trees. Indeed, the tree above can be viewed as a partially ordered
set where x :::::: Y if the node x is "below" the node Y on the tree. In particular if
x :::::: y, then x and Y must belong to the same path. For example, in the picture
above r :::::: a, r :::::: 0, e :::::: m, c :::::: k, a :::::: h. On the other hand, e and f, d and k,
and j and 0 are incomparable. Now we give a formal definition of a tree.

Definition 1.9.1 A tree is a partially ordered set T = CT, ::::::) which has the fol-
lowing properties:

1. It has the root r which is the smallest element in T.

2. For each x E Tthesetofallpredecessorsofx{y I y::::::x}isfinite,contains


r, and is linearly ordered.

An immediate successor of x is a y dIstinct from x such that x :::::: y and


there is no element strictly between x and y. Among the trees of particular interest
are trees known as finitely branching trees. These trees appear in many areas of
mathematics and computer science since, very often, they help us to visualise and
reason about structures that occur in mathematical and computer science.
1.9. Trees and Konig's Lemma 29

Definition 1.9.2 A tree is finitely branching if every node of the tree has finitely
many immediate successors.

Above we explained the notion of path informally. Here is a formal definition


of a path through a tree.

Definition 1.9.3 A path on a tree (T, :s) is a subset X ~ T such that the following
two conditions hold:

1. The set X together with the original ordering :S, that is, the pair (X, :s), is
a linearly ordered set.

2. For any subset YeT if X ~ Y and (Y, :s) is a linearly ordered set, then
X= Y.

Thus, briefly, a path in a tree is a linearly ordered subset of the tree that cannot
be properly extended to another linearly ordered subset of T.

Exercise 1.9.1 Show that if a path on a tree is finite, then it contains a node that
has no immediate successors.

We are now ready to present a result known as Konig's Lemma. The proof of
the lemma involves reasoning that uses induction, and we ask the reader to study
it until it is well understood. It will be used later in the book. The lemma shows
us the relationship between an infinite finitely branching tree and infinite paths of
the tree. We recall that a tree or a path on a tree is infinite if it has infinitely many
nodes.

Lemma 1.9.1 (Konig's Lemma) Afinitely branching tree T = (T, :s) is infinite
if and only if it has an infinite path.
Proof. If T = (T, :s) contains an infinite path, then clearly T has infinitely
many elements. Hence T is infinite.
Suppose now that T is infinite. We want to show that T has an infinite path.
We build the desired path by stages. At each stage we put some node into the
path we build. The node will be an immediate successor of the node defined at the
previous stage.
Stage O. We put the root r into the path X we want to build. We let Xo = r.
Stage 1. Let Yl, ... , Yn be all immediate successors of xo. There must exist a
Yi, the set of all nodes above which is infinite. Otherwise, it is not hard to see that
T would be a finite tree. Let Xl be one of these Yi s that has infinitely many nodes
above itself.
Stage s + 1. Assume that the sequence Xo :s Xl :s ... :s Xs has been built.
Assume that Xl is an immediate successor of XO, and in general Xi+ I is an immediate
successor of Xi, i :s s - 1. Also assume that the set of all nodes above Xs is infinite.
30 1. Basic Notions

Now we define Xs+l as follows. Let Zl, ... , Zt be all immediate successors of Xs.
There must exist a Zi, the set of all nodes above which is infinite. Otherwise, it is
not hard to see that the set of nodes above Xs would be finite. This would contradict
the induction hypothesis that the set of nodes above Xs is infinite. Set Xs+l to be
one of these Zi s that has infinitely many nodes above itself.
Thus, we have a sequence

XO,XI,X2,·· .

of nodes that satisfy the following conditions:

1. For each Xs in the sequence the set of nodes above Xs is an infinite set.

2. The sequence is infinite.

3. Each Xs+l is an immediate successor x s , s ::: 1.

We conclude that the sequence XO, xl, X2, ... is an infinite path on the tree
T. We have proved the lemma.

Exercise 1.9.2 Give an example of an infinite tree, all paths of which are finite.

1.10 Countable and Uncountable Sets


In dealing with sets, one naturally encounters the problem of measuring the sizes
of sets. For finite sets this problem is solved easily. We just count the number of
elements of a given finite set and call the resulting number the size of the set.
Thus, two finite sets have the same size if both have the same number of elements.
However, it is not so easy to introduce the measure of infinite sets. Indeed, for an
infinite set, if we begin counting its elements then we will never finish the process
of counting. Therefore, we cannot use the idea of counting to measure the sizes of
infinite sets.
In order to measure sizes of infinite sets, let us consider the following two
sets. The first set is the set of all even natural numbers:

0, 2, 4, 6, 8, ....

The second set is the set of all odd numbers:

1,3,5,7,9, ....

These two sets are infinite and hence both are larger than any finite set. However,
intuitively, these two sets have the same size because the mapping f (2x) = 2x + 1,
where x is a natural number, is a bijection that maps the set of even numbers onto
the set of all odd numbers.
1.1 O. Countable and Uncountable Sets 31

This example suggests the idea of measuring the sizes of sets without making
any reference to counting the elements of the sets. Thus, for example two finite sets
have the same number of elements if and only if the elements of the one set can
be paired with the elements of the other set so that the pairing induces a bijective
mapping. So formally we now give the following definition.
Definition 1.10.1 We say that two sets A and B have the same size if there exists
a bijection f from A onto the set B. If A and B have the same size, then we say
that A and B are equivalent. In this case we can also say that A has the size of B.
Thus, as we saw above, the set of all even natural numbers has the same size
as the set of all odd numbers. Another example is the set of all natural numbers and
the set of all even natural numbers. They have the same size because the mapping
f(x) = 2x is a bijection from the set of natural numbers onto the set of even
numbers. Now we prove some simple facts about the sizes of sets.
Proposition 1.10.1 Let A, B, C be sets. Then the following are true:
1. A is equivalent to A.
2. If A and B are equivalent, then B and A are also equivalent.
3. If A and B are equivalent and Band C are equivalent, then A and Care
equivalent.
Proof. Clearly, A is equivalent to itself because the identity mapping, idA (x) =
x, where x E A, is a bijection from A onto A. To prove the second part, assume that
A and B are equivalent. Then there exists a bijection f from A onto B. Consider the
inverse of f, denoted by f- I , and defined by f- I (b) = a if and only if f(a) = b.
The reader can easily check that f- I is a bijection from B onto A. Hence Band
A are equivalent. In order to prove the last part, assume that g and h are bijections
from A onto B, and from B onto C, respectively. Then the composition of g and
h, denoted by gh and defined as gh(a) = g(h(a)) for alia E A, is a bijection from
A onto C. The proposition is proved.
Exercise 1.10.1 Show that the following pairs of sets have the same size:
1. The set of all positive natural numbers and the set of all negative integers.
2. The sets A = {x E w I x is a multiple ofn} and B = {x E w I m is a multiple
of m}, where nand m are fixed positive integers.
3. The set ofall natural numbers and the set ofall rational numbers (a number
is rational if it is of the form p : q, where q i= 0 and q, p are integers).
4. The sets wand w 2 .
5. The sets wand Z2.
6. The set wand the set of all finite subsets of w.
32 1. Basic Notions

1.10.1 Countable Sets. A class of sets which is of particular interest is the class
of countable sets. Informally, a countable set is one whose elements can be enu-
merated. For example, we can enumerate the set w of all natural numbers:

0,1,2,3,4, ...

in their natural order. Note that one can enumerate the elements of w in a different
way, as for example 1,0,3,2,5,4,7,6, ... is another enumeration. We can also
enumerate the set Z of all integers as follows:

0,1, -1,2, -2, 3, -3,4, -4, ....

Of course, the elements of every finite set can also be enumerated. Informally, a
countable set is one whose elements can be enumerated. Here is a formal definition.

Definition 1.10.2 A set A is countable if A is either finite or has the size of w.


As we have already seen the set of even natural numbers is countable. It
is also not hard to see that the set of integers is countable. Indeed the mapping
f(2x) = x and f(2x + 1) = -x is a bijection from the set w onto Z. Hence Z is
countable.
So, if a set A is countable, then either A is finite or we can write down a
sequence

of all elements of A so that ai i= a j for all i i= j. Indeed, countability of A implies


that there exists a bijection f from w onto A. Letting ai be f(i), where i E w, we
can list all elements of A in the sequence

so that ai i= a j for all i i= j. Conversely, if we can list all elements of an infinite


set A into the sequence

so that ai i= a j for all i i= j, then by setting f (i) = ai, where i E w, we establish


a bijection f from w onto A. This shows that A is countable.
We call any sequence

a sequence without repetition if ai i= a j for all i i= j. Now we are ready to prove


several results about countable sets.

Theorem 1.10.1 If sets A and B are countable, then so are the sets A U Band
AnB.
1.10. Countable and Uncountable Sets 33

Proof. We can assume that both A and B are infinite. Since A and Bare
countable sets we can list all elements of A and B in the following two sequences
without repetitions:

and
bo, bl, b2, b3 ....
We want to list all elements of A U B in a sequence

without repetitions. One idea is to consider the sequence

n
The problem with this sequence is that if A B =1= 0, then some ai is equal to a bj.
Therefore, this sequence may not be a sequence without repetitions. To overcome
this difficulty we "filter" the sequence

using the following process. The process proceeds by stages. At stage s, we define
Cs and ensure that the sequence

n
is without repetition so that every element of A B occurs exactly once. Infor-
mally, at even stages of the process we deal with elements of A and at odd stages
we deal with elements of B. If the element we deal with at a given stage has not
appeared in the list co, CI, ... that has been constructed so far, then the element is
put into the list. Otherwise, we go on to the next stage. Here is a formal description.
Stage O. Let Co = ao.
Stage s = 2k + 1. Consider bk. If bk has already appeared in the sequence
co, ... , Cs-I

then go on to the next stage. Otherwise, let Cs = bk.


Stage s = 2k +2. Consider ak+ I. If ak+ I has already appeared in the sequence
co, ... ,Cs-I

then go on to the next stage. Otherwise, let Cs = ak+l.


It is not hard to see that all elements of A UB appear in the sequence

Co, CJ , C2, C3, ....


34 1. Basic Notions

This sequence by construction contains no repetitions of elements.


Now we prove the second part of the theorem. We need to show that A B n
n n
is countable. If A B is finite, then A B is countable by definition. Assume
n
now that A B is infinite. We will build the sequence

co, CI, ...

n
without repetition that will contain all elements from A B. We do it by stages.
At even stages we deal with elements of A and at odd stages we deal with elements
of B.
Stage o. If aD E B, then set Co = aD. Otherwise, go to the next stage.
Stage s = 2k + 1. Suppose that we have built a finite sequence

co, CI, ... , Cts_l •

(Note that the sequence can be empty). Consider the element bk. If bk E A and bk
has not appeared in the list we have built so far, then put bk into the list by setting
Cts = bk. Otherwise, go on to the next stage.

Stage s = 2k + 2. Suppose that we have built a finite sequence


co, CI, ... , Cts_l •

Consider the element ak+l. If ak+1 E Band ak+1 has not appeared in the list we
have built so far, then put ak+1 into the list by setting Cts = ak+l. Otherwise, go
on to the next stage.
It is not hard to see that all elements of A n B appear in the sequence
co, CI, C2, C3, ....

This sequence by construction contains no repetitions of elements. The theorem is


proved.

Theorem 1.10.2 If A is a countable set, then any subset B of A is countable.

Proof. If B is finite, then B is certainly countable. Assume that B is infinite.


Since A is countable and infinite we can list all elements of A without repetition. Let

be such a list. Consider the subsequence

bo, bl,· ..

of all elements of the sequence aD, aI, a2, a3, ... that are in B. Clearly, this sub-
sequence is a sequence without repetition so that all elements of B appear in the
subsequence. Hence B is a countable set. This proves the theorem.
1.10. Countable and Uncountable Sets 35

Exercise 1.10.2 Prove by using Theorem 1.10.2 that if A and B are countable
sets, then An B is also countable.

Exercise 1.10.3 Let Ao, AI, A2, ... be a countable sequence of countable sets.
Show that the union of all these sets

is a countable set.

Exercise 1.10.4 Show that if A and B are countable sets, then A x B is also a
countable set.

Exercise 1.10.5 Let A be a countable set. Show that the set of all finite subsets of
A is a countable set.
Exercise 1.10.6 Show that the set of all rational numbers is a countable set.

1.10.2 Diagonalization and Uncountable Sets. In this subsection we show that


infinite and uncountable sets exist. This was proved by Cantor. In fact Cantor
proved that the set of all real numbers is not countable. The method of the proof is
known as the Diagonalization Method. The method and its generalizations are used
in mathematics and computer science very often. For example, in computability
theory the ideas of the diagonalization method are used to construct sets with
different properties.
In order to explain the diagonalization method, we begin with a definition of
a real number. A real number is one that has a decimal representation. Thus, all
the rational numbers and the numbers rr, e are examples of real numbers. Now we
prove that the set of all real numbers is not countable.

Theorem 1.10.3 The set R of all real numbers is uncountable.

Proof. The proof is by contradiction. We assume that the set R of all real
numbers is countable and show that this assumption leads us to a contradiction.
So, assume that the set R of all real numbers is countable. Hence we can list
all real numbers as a sequence

without repetition. Now in order to arrive at a contradiction we construct a real


number x that will be distinct from any number in the sequence. Of course, this
will constitute a contradiction since x must occur in the sequence. We explain this
in more detail.
In order to consruct a number x distinct from all real numbers, we need to
ensure that x satisfies the following requirement
36 1. Basic Notions

for every i. The number x will be constructed by stages and will be given in its
decimal representation. At stage i we ensure that x will be distinct from ri. The
number x will be a number between 0 and 1. So the integer part of x is always O.
Here now is the construction.
Stage O. At this stage we make sure that x will be distinct from roo To do this,
we take a decimal representation of ro and we let the first fractional digit Xo of
x be the smallest number distinct from the first fractional digit of roo This clearly
ensures that the x we want to construct is distinct from roo
Stage i. Assume that we have constructed the first i-I digits of x. Take ri.
At this stage we make sure that x will be distinct from ri. To do this, we take a
decimal representation of r; and we let the ith fractional digit Xi of x be the smallest
number distinct from the i th fractional digit of ri. This clearly ensures that the x
we want to construct is distinct from r; .
Now consider the number x, defined as

Clearly, x is a real number. At stage i, the construction ensures that x i= r; for


every i. Therefore, x is distinct from every ri, i E w. We also assumed that the
sequence
ro, rl, r2,···
contains all real numbers. Hence x must occur in the sequence. Say x = r; for
some i. We have a contradiction since stage i ensures that x is distinct from ri.
Therefore, the set of all reals cannot be a countable set. The theorem is proved.

Exercise 1.10.7 Let A be a countable infinite set. Show that the set of all subsets
of A is uncountable. (Hint: use the diagonalization method idea).

1.11 Algorithms
The notion of an algorithm is fundamental to modem mathematics and computer
science. In this section we give an informal explanation of algorithms. This ex-
planation will suffice to use this notion later in this book, and to show that some
problems have decision algorithms. Let us first consider several examples of known
algorithms.

Example 1.11.1 There exists an algorithm that given a natural number nEw
decides if the number is even or odd.

An example of such an algorithm is the following. Take a number n. Then


n is of the form il ... ib where il, ... , ik E {O, 1,2, ... , 9}. Read the digits of n
from left to right. If the last digit of n is either 0 or 2 or 4 or 6 or 8 then n is even.
Otherwise n is odd.
1.11. Algorithms 37

Example 1.11.2 There exists an algorithm that given two integers produces the
sum of those integers.
This is a well-known algorithm that we learn in elementary school. There is
no need to explain the algorithm.

Example 1.11.3 There exists an algorithm that given a number tells us if the
number is prime or not.
An example of such an algorithm is the following. Take a number n. For
every i = 2, ... , n - I, check by turn if n is a multiple of i. If no such i exists,
then n is a prime number. Otherwise, n is not a prime number.

Example 1.11.4 There exists an algorithm that, for any directed graph 9 whose
vertex set is {I, ... , n} and whose edge set E is a subset of {I, ... , n} x {I, ... , n},
and for some positive integer k, decides if 9 has a path of length k.
Given number k and the graph g, we note that the number of sequences of
length k (of nodes of g) is t = kn. An example of a desired algorithm is now the
following. List all sequences

of length k. For every i = 1, ... , t, check by turn if Si is a path. If no such Si exists,


then 9 does not have a path of length k. Otherwise, 9 has a path of length k.
We now informally explain algorithms. In our explanation we use double
brackets [[like this]] which refer the reader to the examples above in order to make
our explanation clear. Note that our explanation will not give us a formalization
of the notion of algorithm. The issue of formalizing the notion of algorithm will
not be discussed in this book. However, we will be using algorithms to decide
certain problems about some objects (e.g., finite automata, Rabin automata, Biichi
automata) which will be introduced later. Thus, an algorithm is a procedure that
has the following properties:
• There is a set of inputs to which the algorithm is applied. [[Thus, in Exam-
ple 1.11.1 and Example 1.11.3 the algorithms are applied to positive integers.
The algorithm in Example 1.11.2 is applied to pairs of integers. The algo-
rithm in Example 1.11.4 is applied to pairs of the type (G, k), where G is a
finite graph and k is a positive integer.]]

• The algorithm solves a problem about inputs by giving certain outputs.


[[Thus, in Example 1.11.1 the algorithm solves the problem whether or not
a given number is even. In Example 1.11.3 the algorithm solves the problem
whether or not a given number is prime. In Example 1.11.3 the algorithm
solves the problem whether or not a given graph 9 has a path oflength k. The
outputs of these algorithms are "yes" or "no" answers. In Example 1.11.2
the algorithm solves the problem of addition of integers. The outputs of this
algorithm are integers.]]
38 1. Basic Notions

• The algorithm has a finite set of instructions. ([In each ofthe examples above,
algorithms are (or can be) specified by a finite set of instructions.]]

• There is a computer (or someone) who can follow and carry out the instruc-
tions. [[In the examples above we could follow and carry out instructions
for any given input.]]

• Given an input, the algorithm applied to the input produces a computation


which goes by stages. ([Thus, for example, in Example 1.11.1 the stages
of a computation on an input n can be described as follows. Given input
n = i 1 ... ik, at stage 1 the computer reads the first digit of the input. At
stage 2 the computer reads the second digit of the input. At stage k, the
computer reads the last digit of the input. At the final stage the computer
makes a decision.]]

• Each stage of the computation does not have elements of randomness.

• There exists a possibility to memorize, calculate, and make logical decisions.

Later in this book we will study certain problems about some objects, e.g.,
finite state machines, that will be introduced in the next chapters. In many cases
we will construct algorithms that will decide the problems introduced. In other
words, we will provide algorithms that, applied to any object (of our interest), tell us
whether or not the object possesses the specifications of the problem. The problems
that can be decided by algorithms are called decidable problems. For example,
the problem whether a positive integer n is prime or not is decidable. Similarly,
the problem whether or not a given graph has a path of length k is decidable.

Exercise 1.11.1 Find algorithms that decide the following problems:

1. The problem whether a triple (a, b, c) o/integers satisfies the property a +


b = c,

2. The problem whether a graph has a cycle o/length k (a cycle o/length k in a


graph is a path ai, a2, ... , ak o/distinct elements such that the pair (ak, at)
is an edge).

3. The problem whether a graph is connected.

For each o/these algorithms tell what the inputs, outputs, and instructions are.

Now we are finally ready to begin our journey for studying the theory of
computations on finite state machines and applications.
2
Finite Automata

In this chapter we discuss basic properties of finite automata. The chapter contains
eight sections. Some sections contain exercises. In the first section we present two
examples. The goal of these examples is to give some intuition of finite automata
to the reader and to explain ideas of determinism and nondeterminism. In the
second section we define finite automata and provide many examples. We explain
how automata perform their computations on inputs. We formalize the notion of
computation (or equivalently run), introduce the notions of acceptance and finite
automata (FA) recognizable languages.
In Section 3 we investigate closure properties of FA recognizable languages.
In particular, we prove that the class of FA recognizable languages is closed under
the natural set-theoretic operations-union, intersection, and complementation.
This section also introduces the prefix, suffix, and projection operations. Another
important issue in this section concerns the relationship between deterministic and
nondeterministic automata. We show why deterministic finite automata possess
the same power as nondeterministic finite automata. In Section 4, we prove the
Myhill-Nerode Theorem. This theorem is one of the earliest results in automata
theory that gives a characterization to FA recognizable languages.
The fifth section introduces the notion of regular languages. In this section
we prove another famous result in finite automata theory, the Kleene Theorem. The
theorem shows that the class of FA recognizable languages coincides with the class
of regular languages. In the next section we consider generalized finite automata,
and prove that the generalized automata are equivalent to finite automata. The
next section, Section 7, contains and discusses some other important results. In

B. Khoussainov et al., Automata Theory and its Applications


© Birkhäuser Boston 2001
40 2. Finite Automata

this section we show that the most natural problems asked about finite automata
are decidable. Section 8 is devoted to finite automata recognizable relations. In
Section 9 we study finite automata with constraints on their computations. We call
these machines automata with algebraic constraints. Finally, in the last section we
give an application of automata theory to logic. In this section we introduce the
monadic second order logic of finite strings. We study the relationship between
this logic and finite automata. We prove the decidability of the monadic second
order theory of all finite strings. .

2.1 Two Examples


We begin by presenting two examples. The goal is to explain the ideas of finite state
machine, determinism and nondeterminism. These examples will be our stepping
stones to begin a mathematical development of automata theory-the theory of
computations with finite memory.

2.1.1 The Consumer-Producer Problem. We discuss the following very sim-


ple version of the Consumer-Producer Problem. Producer produces a product and
stores the product into a storage. The products are being produced in units. We
assume that the capacity of the storage is 3, that is, the storage can hold only 3
units of the product.
Thus, we can think that the state of the storage is determined by the number
of product units in it. The state of the storage when the storage has no products
is O. Similarly, the state of the storage when the storage has exactly i units of the
product is i. In other words, 0, 1,2, and 3 are all possible states of the storage.
Producer tries to satisfy Consumer by adding one product unit into the storage.
Consumer takes out (consumes) the product in order to satisfy himself. According
to this, we denote the action of Producer by p, and the action of Consumer by c. We
assume that Consumer and Producer cannot act simultaneously. When the storage
is full, that is when the storage is in state 3, Producer can try to add a product.
In this case, one can say that the storage fails to accept the product. We denote
this state by f(p). However, when the storage is in this state f(p), Consumer can
take out one unit of the product and change the state of the storage to 2 since the
storage after this action of Consumer will have 2 units of the product. Similarly,
when the storage is empty, that is when the storage is in state 0, Consumer can
try to take a product out. In this case, one can say that the storage fails to satisfy
Consumer. We denote this state of failing by f (c). However, when the storage in
state fCc), Producer can add one unit of the product and change the state of the
storage to 1 since the storage after this action of Producer will have one unit of the
product. Thus, we now can conclude that we have created a system which models
the interaction of Consumer and Producer. The system has six states: 0, 1, 2, 3,
f(p), and fCc). The actions of Producer and Consumer change the states of the
system according to the following rules:
2.1. Two Examples 41

• The action of Producer, that is p, changes 0 to 1; similarly, the action of


Consumer, that is c, changes 0 to f(c).

• The action p changes 1 to 2; the action c changes 1 to O.

• The action p changes 2 to 3; the action c changes 2 to 1.

• The action p changes 3 to f(p); the action c changes 3 to 2.

• The action p changes f (p) to f (p); the action c changes f (p) to 2.

• The action p changes f(c) to 1; the action c changes f(c) to f(c).

We can
p

Figure 2.1: A model representing Consumer and Producer interactions.

The model in Figure 2.1 is in fact a directed graph whose nodes represent
the states of our system. The edges of the graph are labeled with either p or c: If
there is an arrow labeled by p which goes from state s to state Sf, then this simply
means that action p of Producer changes state s to state Sf. Similarly, if there is an
arrow labeled by c which goes from state s to state Sf, then it means that action c
of Consumer changes state s to state Sf.
Now let us informally discuss the following question:
What type of behavior of Producer and Consumer would make them happy?
An answer to this question depends on how one specifies the meaning of
the word "happy." For example, an answer to this question can be that our system
should be in none of the failing states under actions of Consumer or Producer. Now
we give a more formal answer. We first assume that the initial state of the system
is O. We also say that Producer (Consumer) is happy if the system goes to neither
of the failing states under all possible actions of Producer and Consumer. This can
be formalized by saying that Producer (Consumer) is happy if the system is in
the state 1 or 2. We say that inputs to our system are finite sequences of actions
performed by Consumer and Producer. For example,
pcpp, c, ccppppppp, pcp, cpcpp, pccppcp
42 2. Finite Automata

are inputs to our system. We can show that the first, fourth, and fifth inputs make
Producer and Consumer happy while the others do not. Here is how the system
reacts, for example, to the first input. The first letter of the input is p. Thus, p sends
the initial state to 1. Now, the second symbol c sends 1 to 0. The third symbol p of
the input sends 0 again to 1. Finally, the last symbol p sends 1 to 2. In other words,
the input pcpp has produced the sequence

0,1,0,1,2.

We call the act ofthe system producing the sequence 0, 1, 0, 1, 2 a run. Sometimes,
the run is called a computation or a process of the system. Informally, one can
say that a run is a response of our system to input signals from the outside world.
Systems which are similar to the one we have just described are called de-
terministic finite automata or more generally, deterministic machines. When our
system is in any of the states 0, 1,2,3, f(p), f(c), each of the inputs p or c pro-
duces a uniquely determined state. For instance, state 1 and input p produce state
2 which is uniquely determined by 1 and p; the state 3 and input c produce state
2 which is also uniquely determined by 3 and c. Now we informally describe the
main features of our system:

• Finite number of states. The system has a finite number of states. These
states are well distinguished and describe the possible internal worlds of the
system. In the example above, these states are 0, 1,2,3, f(c) and f(p) .

• Finite number of inputs. The system is connected with its environment via
a channel which reads signals from the outside world. Each signal is a well-
distinguished symbol. For the system in the example above, these signals
are p or c. Finite sequences of signals are inputs for the system.

• Initial state. Before performing any computation the system is in its initial
state waiting for an input signal. In our example the initial state is 0.

• Determinism. When performing a computation the system is always in the


state uniquely determined by the state and the input signal given previously
to the system.

2.1.2 A Monkey and Banana Problem. We now model another example, a


version of the Monkey and Banana problem. The goal of this example is to build a
system, compare this new system with the system discussed in the previous section,
and explain the idea of nondeterminism.
Here is an informal description of the problem. A monkey stands at the door
of a room. The monkey is hungry and wants to get a banana. The banana is hanging
from the ceiling. From the floor the monkey cannot get the banana. There is a box
at the window of the room. If the box were under the banana and the monkey on
the box, then the monkey would be able to get the banana. Here is the question:
2.1. Two Examples 43

Is it possible to model and investigate the behavior of the monkey using a finite
state system?
To answer this question let us first discuss the possible states which the
monkey can enter at any time while trying to get the banana. The initial state,
denoted by sO, is determined by:

• The monkey is at the door and on the floor, or just on the floor.

• The box is at the window.

• The monkey does not have the banana.

Another state sl can be determined by:

• The monkey is at the window.

• The box is at the window.

• The monkey does not have the banana.

State s2 is determined by:

• The monkey is on the floor or on the box.

• The box is on the floor but not under the banana.

• The monkey does not have the banana.

The next state, denoted by s3, is determined by:

• The monkey is on the floor or on the box.

• The box is under the banana.

• The monkey does not have the banana.

Finally, the happy state h is the state when

• The monkey has the banana.

The monkey can potentially perform one of the following actions:

• Walk on the floor. Denote this action by w.

• Climb the box. Denote this action by c.

• Push the box. Denote this action by p.

• Grasp the banana. Denote this action by g.


44 2. Finite Automata

Thus, for example, when the monkey is in state sO, then walking does not change
the state, while grasping or pushing produces no result. However, climbing changes
state sO to state sl. If, for example, the monkey is in state s2, then pushing changes
the state to either s3 or s2. Intuitively, the monkey may push the box to a spot that
is or is not under the banana.
Thus, we now can conclude that we have created a system which models the
possible behaviors of the monkey. The system has five states:
sO, sl, s2, s3, h.
The actions of the monkey change the state of the system according to the following
rules:
• When the monkey is in state sO, then w does not change sO, g and p produce
no result, C produces sl.
• When the monkey is in state sl, then w, g, and c produce no result, while p
changes sl to s2.
• When the monkey is in state s2, then W changes s2 to s2, g produces no
result, c changes s2 to s2, and p changes s2 to either s3 or s2.
• When the monkey is in state s3, then c produces s3, p produces s3 or s2, W
produces s3, and g produces h.
A finite state system that models the Monkey and Banana problem is presented in
Figure 2.2. c
W

Figure 2.2: A model of Monkey and Banana problem.

The model is a directed graph whose nodes are the states of our system. The
edges of the graph are labeled with one of the symbols w, p, c, g. Some edges,
for example the edge from s3 into s3, have multiple labels. If there is an arrow
labeled with a which goes from state s to state Sf, then it simply means that action
a changes state s to state Sf.
2.1. Two Examples 45

Let us now consider how our system reacts when it reads an input. First of
all, we say that an input to our system is any finite sequence of actions performed
by the monkey. For example,
wcpcpg, w, wwwcppg, g, cpcppwwg, wwgpcwwcc
are inputs to our system. Consider the input is wcpcpg. Here are two possible
scenarios: (1) w sends sO to sO, c send sO to s1, p sends s1 to s2, c sends s2 to s2,
p sends s2 to s2, and finally g sends s2 to nowhere; (2) w sends sO to sO, c sends
sO to s1, p sends s1 to s2, c sends s2 to s2, p sends s2 to s3, and finally g sends s3
to h. So we have two sequences

sO, sO, s1, s2, s2, s2

and
sO, sO, s1, s2, s2, s3, h
of states. The first sequence is produced by our system that attempted to respond
to the input wcpcpg with no success. Indeed, when the system is in the last state s2
of the first sequence, the system cannot respond to the input signal g. So the whole
input cannot be read by our system if the system responds by producing the first
sequence of states. The second sequence is a run, or equivalently a computation,
of our system on input wcpcpg in the sense that the system was able to read the
whole input and respond to every signal of the input.
Now the essential difference between this system and the system in the pre-
vious section is the following. In the first system, any pair consisting of state sand
action a uniquely determines the next state of the system. This is called determin-
ism. However, the second system does not enjoy this property. For example, when
the system is in state s2, action p can change the state to either s2 or s3. Thus, in
this case the system has to make a choice: the system chooses either the state s2
or the state s3. This is called nondeterminism. However, we want to stress that the
second system still possesses a property which is called sequentiality: at any stage
of a computation, the system is in one of the possible states (which may not exist)
that are uniquely determined by the pair consisting of the input signal and the state
at the previous stage.
Guided by this example, we would like to informally explain the main features
of our system. The system in first approximation has the following properties .

• Finite number of internal states. The system has a finite number of states.
These states are well distinguished and describe the possible internal worlds
of the system. In the example above, these states are sO, s1, s2, s3, h .

• Finite number of input signals. The system interacts with its environment via
a channel which reads the signals from the outside world. For the example
above, these signals are w, c, g, p . A finite sequence of signals is an input to
the system. While reading an input, the system influences its environment,
46 2. Finite Automata

giving responses to the input. Each response to an input signal is a possible


change of state of the system.
• Sequentiality. The system is in an initial state before it begins reading an in-
put. Each state s during a computation is determined, not necessary uniquely,
by the previous state ofthe system and the input signal. This state s is chosen
nondeterministically.

2.2 Finite Automata


In this section we define finite automata, both deterministic and nondeterministic,
and provide many examples. We also explain formally how automata perform their
runs (computations) on inputs. We introduce the notions of acceptance and finite
automata (FA) recognizable languages.

2.2.1 Definition of Finite Automata and Languages. Finite automata are the
simplest mathematical abstractions of discrete sequential (deterministic) sys-
tems, such as modern computers. Based on the examples of the previous section
we will formalize the notion of sequential system. We assume that the input sig-
nals read by a sequential system are well recognized by the system, as the symbols
p and c are recognized by our model for the Consumer-Producer problem. We
assume that the number of these signals is finite, so we can list all of them, say

aI, a2, ... , an·

One can also think of this collection of symbols as a set of executable commands
by a computer system. We now form the set

and call it the input alphabet, or simply alphabet. We call the elements of the
alphabet letters or, as above, input signals. The inputs for the system are finite
sequences of input signals. Thus, an input u can be viewed as a sequence, possibly
empty,
a1 a2 ... am

of input signals, where each ai, 1 ::::; i ::::; m, belongs to b. The number of input
signals in this input is m and we call m the length of the input. We denote the
length of u by 1u I. The input of length 0 is called the empty input. We denote the
empty input by A.
Thus, we can consider the collection of all possible inputs and form the set

L* = {aW2 ... amlaI, a2, ... , am E b, mEw}.

Of course, A belongs to L* as m = 0 covers the case for the empty input. The
set L* is called the set of finite words or, as we called them above, inputs of the
alphabet L. Equivalently, we can say strings instead of saying inputs or words.
2.2. Finite Automata 47

We denote the strings of the alphabet by the letters

U,V,W, ... ,UI,VI,····

Let u and v be strings. Then the concatenation of these two strings is obtained by
writing down u followed by v. We denote the concatenation of the strings by the
symbol·. Thus for example aab . bba produces the string aabbba. For a string u
and number nEw, un represents the empty string A if n = 0, and un represents
the string obtained by writing down the string u exactly n times if n ::: 1. Thus, un
is the string obtained by concatenating u to itself exactly n times.
Definition 2.2.1 A ~-Ianguage is any subset of the set ~* ofall finite words of the
alphabet ~. Often for short we say language instead of ~-language if this does
not cause confusion.
Here are some examples of languages.
Example 2.2.1 The empty language 0 is the language containing no strings. The
language ~* is the language containing all strings.
Example 2.2.2 Any finite subset of ~* is a language called finite language.
Example 2.2.3 A subset L of ~* whose complement is a finite set is a language
called cofinite language.
When a system is performing a computation, at each time (step) of the com-
putation the system is in one of its internal states (e.g., the states sO, s1, s2, s3, and
h as in the model for the Monkey and Banana problem). The number of these states
is finite. Therefore, we can list all the internal states of the system so, Sl, ... , Sk
and form the set
S = {so, ... , skl
called the set of states of the system. Each element of S is called a state.
The sequentiality of the system suggests that if the system is in some state,
say s E S, and an input (J E ~ is being read, then the next state of the system is
one of the states completely determined by the pair (s, (J).
In order to give more intuition to the reader, in addition to the examples
considered in the previous section we give some other examples of systems. This
will help us to give a formal definition of finite automata. Consider the system
presented in Figure 2.3.
This system represented in Figure 2.3 has three states: sO, s1, and s2. The
input signals to the system are the letters a and b. The diagram in the picture totally
describes the behavior of the system: for any state s of the system (so s is either sO
or s1 or s2) and any input signal (J (so (J is either a or b), the system knows all its
next possible transitions (which may not exist). Often we call such representations
of finite state systems diagrams or transition diagrams.
We now give another example of a system presented in Figure 2.4.
48 2. Finite Automata

Figure 2.4: Another finite state system.

The system represented in Figure 2.4 has four states. This time we did not
label the states. They are simply the nodes of the labeled graph presented in the
figure. The input signals to the system are the letters a, b, and c. Again, the diagram
in the picture totally describes the behavior of the system: for any state s of the
system and any input signal a, the system knows all its next possible transitions.
We now give the following fundamental definition of this chapter.

Definition 2.2.2 A nondeterministic finite automaton, or briefly an nfa, over


alphabet E is a quadruple A = (S, /, T, F), where

1. S is a finite nonempty set called the set of states.

2. / is a subset of S called the set of initial states.

3. T c S x E x S is a nonempty set called the transition table or transition


digram.

4. F is a subset of S called the set of final states.

Thus, we can give the following formal presentation of the system A


(S, /, T, F) which models the Consumer and Producer problem:
2.2. Finite Automata 49

1. The set S of states is {O, 1,2,3, f(p), f(c)}'

2. The set of initial states is I = {o},

3. The set of final states is F = {I, 2}, and finally,

4. The transition table T is defined as follows: (f(c), c, f(c)) E T, (f(c), p,


Sl) E T, (0, p, 1) E T, (0, c, f(c)) E T, (1, p, 2) E T, (1, c, 0) E T, ... ,
(3, p, f(p)) E T, (3, c, 2) E T, (f(p), p, f(p)) E T, (f(p), c, 2) E T.

It is not hard to see that (s, a, s') belongs to T exactly when there is a directed
edge from s to s' labeled by a in the graph presentation of the system.

Exercise 2.2.1 Check the correctness of the statement above.

Exercise 2.2.2 Formally define the finite automaton that models the Monkey and
Banana problem.

Exercise 2.2.3 Formally define the transition tables for two of the finite state
systems presented in Figure 2.3 and Figure 2.4.

We would like to make the following convention. Quite often we omit the
adjective finite when we refer to nondeterministic finite automata. If it is clear from
the context we often omit the word "nondeterministic" as well.
Later we may use, when convenient, the following notation defined in the
next definition.

Definition 2.2.3 Let T be the transition table of the automaton A. Then for all
states s E S and inputs a, we set

T(s, a) = {s' E SI(s, a, s') E T}.

Note that T (s, a) is a subset of S and may well be an empty set.


The next definition is an important definition that expresses (formalizes) the
idea of determinism for sequential systems.

Definition 2.2.4 An automaton A = (S, I, T, F) is deterministic if I possesses


exactly one state, and for every s E S and every a E b there exists exactly one
s' for which (s, a, s') E T. If A is deterministic, then we often write T (s, a) = s'
each time when (s, a, s') E T.

An example of a deterministic automaton is the model constructed in our


discussion of the Consumer-Producer problem. Thus, for any deterministic finite
automaton A the following property holds. For every S E S and a E I:, the set
T (s, a) is not empty and contains exactly one state.
50 2. Finite Automata

2.2.2 Runs (Computations) of Finite Automata. Let A = (S, I, T, F) be an


automaton. The alphabet ~ represents the input signals given to the automaton A.
The set S represents possible worlds in which our computational system A lives.
The essence ofthe computations of the finite automaton A is hidden in its transition
table T. The transition table T describes transitions (or equivalently moves) in the
world S of the automaton: when the automaton is in a state S E S and input signal
is a E ~, then allowed transitions in S are only those s' E S which agree with the
transition table T, that is for which (s, a, s') E T. We call the triples (s, a, s') E T
transitions or equivalently moves of the automaton. Thus, a run (or equivalently,
a computation) can be thought as a sequence of transitions of the automaton.
Based on the above informal explanations of the definition of finite automata
and its transitions, one can define the notion of run (computation) of automaton A
on a finite sequence of input signals

where aI, ... , am E ~. In order to explain runs (computations) performed by the


automaton A, we present the following possible behavior of A. This reflects the
nature of the possible responses of A to the input u = al a2 ... am.
Stage 1. This is an initial stage. The automaton A chooses an initial state
Sl E I. If an initial state does not exist, then A fails to read the input.
Stage 2. Suppose the automaton A picked a state SI E I at the previous stage.
If there does not exist a state S2 E S for which (SI, aI, S2) E T, then A fails to
read the input. Otherwise, the automaton chooses an S2 E S which agrees with the
transition table, that is (SI, aI, S2) E T.
Stage n (n ::::; m). Suppose that the automaton A has produced the sequence

SIS2 ... Sn-I

of states. If there does not exist a state Sn E S for which (Sn-I, an-I, sn) E T,
then A fails to read the input. Otherwise, the automaton chooses an Sn E S which
agrees with the transition table, that is (Sn-I, an-I, sn) E T.
If the automaton fails at some stage n with n ::::; m, then the automaton fails
to read the whole input by just producing the sequence

SI,S2,···,Sn-l·

Otherwise, the automaton reads the whole input and produces a sequence

SIS2· .. Sm+1

called a computation, or equivalently, a run of the automaton on the input u =


ajU2 ... am.Note that the length of this sequence is m + 1. Formally, we give the
following definition.
2.2. Finite Automata 51

Definition 2.2.5 A computation or equivalently run of A on u = al ... am (from


state s) is a sequence

of states such that Sl E I (Sl = s) andforall i :s m, (Sj, aj, Sj+l) E T.


If the length of the input u is m 2: 1, then the length of any computation of A
on u is m + 1. We make, according to this observation, the following convention.
If the length of the input u is 0 (and hence u = )..), then the computation of A on
u from state S is simply the sequence S whose length is 1.
Note that A can possess several computations on the same input (give an
example). However, here is a simple but important proposition which states a
basic property of computations performed by deterministic automata.
Proposition 2.2.1 Let A = (S, I, T, F) be a deterministic automaton. Then the
automaton has a computation on any input aW2 ... am and this computation is
unique.
Proof. It is clear that A has a computation on any input. Let
SIS2·· ,Sm+1

be a computation of A on input aOal ... am. We show that this computation is


unique. Let
" ,
sl s 2", s m+1
be another computation. Then since I has only one element, SI equals For any s; .
S E S and any a E b there exists exactly one s' E S for which (s, a, s') E T.
Hence S2 is equal to s~. Continuing this, we easily see that Sj = s; for all i :s m + 1.
The proposition is proved.
As mentioned above a nondeterministic automaton can have several compu-
tations on the same input. Here we present a view on computations performed by
nondeterministic automata. Informally, the runs of a nondeterministic automaton
A on input u can be viewed as a parallel computation in which several processes
proceed simultaneously. This can be represented as a tree: the automaton A begins
its run on the root of the tree at its initial state s. The automaton reads the first signal
al of the input. Now assume that A has k nondeterministic choices tl, ... , tk to
make. Then the root of the tree has exactly k immediate successors. The automaton
A makes k copies of itself so that the ith copy of A moves to the ith immediate
successor of the root and changes its state from S to tj, etc. Thus, each edge of the
computation tree corresponds to a possible behavior of the automaton reading the
input.
To explain this view consider the nondeterministic automaton pictured in
Figure 2.5.
For the automaton in Figure 2.5 sO is the initial state, s3 is the final state, and
a, b are input symbols. Assume that baaba is an input to the automaton. Here is
how the automaton runs. The automaton picks up the initial state sO first. Then A
52 2. Finitl

Figure 2.5 : A nondeterrninsitic automaton.

reads b and remains in the same state sO. Then A reads the next input a. Now A
splits itself into two copies so that the first copy takes the state sO and the second
takes the state s1. Both copies now read the next input, which is a. The first copy
makes two copies of itself so that the first one takes the state sO and the second
takes the state sl, etc. We represent the runs of the automaton on u in Figure 2.6.

Figure 2.6: A tree representation of the runs.

Note that the tree has four paths. Three paths correspond to computations of
the automaton on the input. One path corresponds to the unsuccessful attempt by
the automaton to read the whole input.
Let A = (S, I, T, F) be an automaton. For a given input al .. . am , we are
interested in finding those computations

Sl· · ,sm+l

of the automaton A on this input which are successful, that is, for which sm+ 1 E F.
In other words, we want to know which inputs can transform, or send, an initial
state Sl E I to a final state f E F following the rules given by the transition table
T . Thus, we naturally arrive at the following definition.
2.2. Finite Automata 53

Definition 2.2.6 The automaton A accepts the finite string

if there exists a computation


sls2· .. Sm+l

of A on u such that Sm+l E F.


Here we add that acceptance of the automaton A of a given string u means
only the existence of some successful computation and that there may exist other
computations of the automaton on the same input u which are not successful. For
example, for the automaton A and the input baaba discussed above, the automaton
has three computations on the input of which only one is successful.
We often use a convenient way of representing a finite state automaton A as a
directed graph. Such a graph is usually called the transition graph (or transition
diagram) of the automaton A. The nodes of the graph are the states of the automaton
A. The edge relation E on the nodes is defined as follows. There exists an edge
connecting a node s to another node Sf if and only if (s, a, Sf) E T for some a E b.
We label this edge by all a such that (s, a, Sf) E T. Thus,

E = res, sf)l(s, a, Sf) E T for some a E b}.

We use the following conventions in drawing finite state automata as directed


labeled graphs called transition diagrams or transition graphs of automata.

1. Nonfinal states are presented by circles as below:

We sometimes can represent the states as unshaded circles as well.

2. Final states are presented as double circled nodes.

3. Transitions are presented as nodes connected with labeled directed edges as


the figure below:

The same edges can have several labels, e.g., if (s, a, t) and (s, b, t) are
transitions of an automaton, then the edge from s to t has two labels a and b.
54 2. Finite Automata

4. Finally, the initial states are presented as follows:

We now give several examples. In all examples below b = {a, b}.

Example 2.2.4 Consider the automaton in Figure 2.7.

Figure 2.7

The automaton accepts the words of the type ababab ... abaa only.

Example 2.2.5 Consider the automaton in Figure 2.8.

a a

Figure 2.8

The automaton accepts the strings of the form an bba m only, where n, mEw.

Example 2.2.6 Consider the automaton in Figure 2.9.

Figure 2.9

This automaton accepts the words of the type A, a 3 b 3 , a 3 b 3a 3 b 3 , ... only.

Exercise 2.2.4 Write down the transition tables, initial and final states, o/the FA
presented in the last three examples.
2.2. Finite Automata 55

Figure 2.10

Example 2.2.7 Consider the automaton in Figure 2.10.


This automaton accepts the empty string A. In fact, one can easily see that an
automaton A accepts the empty string A if and only if A has an initial state which
is also final.
Example 2.2.8 Let u be a word ab . .. c aflength m. The automaton which accepts
this string onl:' :n _~ __~"~ .. +~A: .. 17:~ .. _" ') 11 '1'I.:n ~,.+".-~+~ .. I.~n exactly m + 1
states. • • •• c.(l
Figure 2.11

1. ~pt?

2.

3.

4.
56 2. Finite Automata

2.2.3 Accessibility and Recognizability. The examples in the previous sections


lead us to the following notions. Let A = (S, I, T, F) be an automaton. Consider
the transition table of this automaton. Suppose that u = al ... am E 'E* is an input
and s E S is a state. Say that the input u transforms state s to a state s' if there
exists a sequence
Sl ... Sm+l
of states of the automaton A such that Sl = sand Sm+l = s' and (Si' ai, Si+l) E T
for all i ::s m. Looking at the transition graph of A, one can say that u transforms
S to s' if there exists a path in the transition graph such that the beginning of the
path is s, the end of the path is s', and the path is labeled with al ... am.
We can also define the notion of accessibility from one state to another.
Informally a state Sl is accessible from a state S if there exists a path in the transition
graph of A which goes from S to Sl. We define this more precisely using induction.
Let S E S. Let
Go(S) = {s}
and
GJ(S) = {sJ I (s,a,sJ) E Tforsomea E 'E}UGo(s).

Thus, GJ (s) is the set of all states which can be transformed from s by inputs of
length at most 1.
Suppose that G n has been defined. Let

Gn+J(s) = Gn(s) U GJ(sJ).


S) EG n (s)

Example 2.2.9 Consider the automaton over the alphabet {a, b} whose transition
graph is in Figure 2.1 ,.,

Figure 2.12

For the state sO of this automaton, we have Go(sO) = {sO}, GJ (sO) = {sO, s1},
G2(SO) = {sO, s1, s2, s4}. Similarly, Go(s4) = {s4}, GJ (s4) = {s4, s3, sO, s5}.
2.2. Finite Automata 57

Thus, for any automaton A and a state s of the automaton we have the
following increasing sequence of sets:
Gl (s) C G2(S) C ....

Consider the set


G(s) = U Gn(s).
n
Note that since S is a finite set of states, there must exist an m such that
G(s) = Gm(s).
Definition 2.2.7 Call the elements of the set G(s) accessible from sand G the
accessibility operator on A.
Having defined the notions of accessibility and transformation, we now prove
the following simple result.
Proposition 2.2.2 Let A = (S, /, T, F) be a finite automaton. For all states
s, Sl E S the state Sl is accessible from s if and only if there is an input which
transforms s to Sl.
Proof. Suppose that an input u transforms s to Sl. Let n be the length of the
input u. Then clearly, Sl E Gn(s). Hence Sl is accessible from s.
Now suppose that Sl is accessible from s. Hence there is an m such that
Sl E Gm(s). We apply induction on m. If m = 0, then clearly s = Sl, and the
empty word A transforms s to Sl. Suppose that Sl is in Gm(s) and m > O. If
s E Gm-l (s), then the induction hypothesis is applied. Otherwise, Sl E G m (s) but
not in Gm-l (s). From the definition of Gm(s), there must exist an S2 E Gm-l (s)
such that Sl E Gl (S2)' By the induction hypothesis, we can choose wand a such
that w transforms s to S2 and a transforms S2 to Sl. It follows that the word wa
transforms s to Sl. The proposition is proved.
Now, for the gi ven automaton A, we can consider all inputs u which transform
some initial state to some final state. In other words, we define the language L (A) by
L(A) = {w E b* IA accepts w}.
The language L (A) consists of all strings on which A has successful computations.
We thus arrive at the following important definition.

Definition 2.2.8 A language L C b* is finite automaton (FA) recognizable if


there exists an automaton A such that L = L(A).
We would like to investigate properties of FA recognizable languages. We are
naturally interested in whether FA recognizable languages enjoy the set-theoretic
closure properties, that is, whether the union, intersection, and complements of FA
recognizable languages are also FA recognizable. The next section takes care of
these properties.
58 2. Finite Automata

Exercise 2.2.6 Draw transition diagrams ofautomata that recognize the following
languages over the alphabet ~ = {a, b}:

1. Empty language.

2. The language ~*.

3. {w I w begins with a and ends with b}.


4. {w I wends with a}.

5. {w I w contains the string aabb}.

6. {w I w the length ofw is a multiple ofS}.

Exercise 2.2.7

1. Give an example of a nondeterministic finite automaton A with four states


over the alphabet {a, b} such that A recognizes the language L containing
exactly those w that have a at the third position from the right of w.

2. Give an example of a deterministic automaton that recognizes the language


L defined in the previous item.

2.3 Closure Properties


In this section we prove that the class of all FA recognizable languages is closed
under the set-theoretic operations of union, intersection, and complementation.
This section is also devoted to the study of interactions between nondeterministic
automata and deterministic automata. In particular this section answers the ques-
tion of whether or not nondeterministic automata are equivalent to deterministic
automata. More precisely, we prove that any language recognizable by a nonde-
terministic automaton is in fact recognizable by a deterministic automaton.

2.3.1 Union and Intersection. We begin by presenting an example. Consider


the following two ,utom
~
~'~ "
s(t b s~,
) <:,)
s2 "
:/:': -::. :>.!

and the automaton A2:


2.3. Closure Properties 59

Formally, these automata are defined as follows:

Al = ({sO, sl, s2}, {sO}, {(sO, a, sl), (sl, b, sO), (sl, a, s2)}, {s2})

and

Al = ({to, tl, t2}, {to}, {(tl, a, to), (to, b, tl), (tl, b, t2)}, ttl}).

Clearly, Al accepts the language LI of all words of the form (ab)naa, where
nEw, and A2 accepts the language L2 of all words of the form (ba)nbb, nEw.
Then, it is easy to check that the language LI U L2 is accepted by the automaton
A = (S, I, T, F) with
1. S = {sO, sl, s2} U{tO, tl, t3}.

2. I = {sO, to}.
3. T is the union of the two transition tables, namely of the transition ta-
ble {(sO, a, sl), (sl, b, sO), (sl, a, s2)} and the table {(tl, a, to), (to, b, tl),
(tl, b, t2)}.
We see that the automaton A is obtained by taking the unions of the sets of
states, initial states, final states and transition tables of Al and A2. Informally, this
can be stated by saying that we combine the two automata Al and A2 into one
automaton A as it is ""p.n in Fi CJIl'S? 11

Figure 2.13: An automaton accepting LI U L2·


The next theorem shows that this construction works in general.

Theorem 2.3.1 Let Al and A2 be automata. Then there exists an automaton A


such that L(A) = L(A)) U L(A2).
Proof. Let Al = (SI, l), TI, FI) and A2 = (S2, h T2, F2). We want to
construct an automaton A which accepts exactly all inputs accepted by either Al
or A2. One possible idea for constructing A is as follows: A should be able to
simulate both Al and A2. In other words, having an input u, the automaton A
simulates AI. If Al accepts u, then so does A. If Al does not accept u, then A
begins simulating A2. If A2 accepts u, then so does A. If A2 does not accept u,
then neither does A. Why does this idea work? Basically, the reason for this is
60 2. Finite Automata

nondeterminism. A nondeterministic automaton may have several computations


on the same input. If one of the computations is successful, then the input is
accepted. So, informally, the automaton we want to construct will have the choices
of simulating Al and simulating A2 on the same input u and hence will produce
several computations on u.
Here now is how we implement this idea. First of all we can suppose that
SI nS2 = 0. Indeed, if SI and S2 have common states, then we just rename
elements of S2, creating a new "copy" of A2. Thus, let SI n
S2 = 0. Second, we
define the automaton A = (S, T, I, F) as follows:

1. The set S of states is SI U S2.


2. The transition diagram T is TI U T2.
3. The set I of initial states is II Uh
4. The set F of final states is FI U F2.
We have to prove that L(A) = L(Ad U L(A2). Well, ifu E L(Ad U L(A2). then
u belongs to either L(Ad or L(A2). Now note that any successful computation of
either Al or A2 is in fact a successful computation of A. Hence, by the definition of
A, u belongs to L(A). On the other hand, if u E L(A), then there is a computation

Sl, S2, ... , Sm+1

of A on the input u such that Sm+ I belongs to F. This computation, since SI n S2 =


oand there are no transitions from states in SI to states in S2 as well as from states
in S2 to states in S I, must be a computation of either A I or A2. Hence, u is accepted
either by Al or by A2. The theorem is proved.
Denote the automaton A constructed in the proof of this theorem by A I E9 A2.
A somewhat similar but more refined idea works for constructing an automaton
that accepts the intersection of two FA recognizable languages.

Theorem 2.3.2 Let Al and A2 be automata. Then there is an automaton A such


that L(A) = L(AI) n
L(A2).

Proof. As in the previous theorem (Theorem 2.3.1), we assume that Al


(SI, II, TI, FI) and A2 = (S2, h T2, F2). We want to construct an automaton A
which accepts all inputs accepted by both Al and A2. A naive idea for constructing
A is very simple: A should be able to simulate both Al and A2. In other words,
having an input u, the automaton A simulates AI. If Al does not accept u, then
neither does A. Otherwise, that is when Al accepts u, the automaton A simulates
A2 on u. Then A accepts u if and only if A2 accepts u. However, we should be
careful with this idea. This type of idea worked in the previous theorem because
we were interested in the union of the languages. Here if Al has a successful
2.3. Closure Properties 61

computation on an input u, then the idea forces us to read the input the second time
to check whether or not A2 accepts u. But we know that every computation of an
automaton reads any given input just once. So we need a more sophisticated idea.
The new idea consists of noticing that we are able to track computations of
Al and A2 on any given input u simultaneously. How can we achieve this? All
we have to do is just to remember the states of each automaton when each of them
reads a given input signal and makes a transition. In other words, we need to be
able to read the transition tables of Al and A2 simultaneously. To do this we have
to be clever enough to combine both transition tables into one. Here now is how
we implement this idea. We construct the automaton A = (S, T, /, F) as follows:

1. The set S of states is SI x S2. Indeed, the motivation for this definition is
that we want A to simulate Al and A2 simultaneously. Thus, the states of A
are pairs such that the left coordinates of the pairs are from S I and the right
coordinates are from S2. Intuitively, we can now simultaneously simulate
the computations of Al on left coordinates and the computations of A2 on
right coordinates of pairs of states.

2. The set / of initial states is h x h This enables us to start computations on


Al and A2 simultaneously.

3. The transition digram T consists of all

4. The set F of final states is FI x F2.

As in the previous theorem, using the construction, we can prove that the language
n
L(A) is exactly L(A]) L(A2). D

Exercise 2.3.1 Finish the proof of the theorem above by showing that L(A) =
L(A]) n L(A2)·
We denote the automaton A constructed in the last theorem by Al x A2.
Note that the set of states of Al x A2 is the cross product SI x S2. From this point
of view the following exercise is interesting.

Exercise 2.3.2 Let Al and A2 be finite automata. Construct an automaton which


accepts the union L(A]) U L(A2) and whose set of states is SI x S2 and the
transition table is the onefor Al x A2.

Exercise 2.3.3 Consider the two automata Al and A2 presented in Figure 2.14.
Construct the automaton, using Theorem 2.3.2, that accepts the intersection
L(A]) n L(A2).
62 2. FiniteAutomata ~
b
+- b
a

Figure 2.14

2.3.2 Complementation and Nondeterminism. Our next goal is to examine


complementation of automata recognizable languages. Suppose that A is an au-
tomaton. We want to construct an automaton B that recognizes the complement
of L(A). The first approximation to finding an automaton B which accepts the
complement of L(A), that is for which L(B) = ~* \ L(A), would be to consider
the automaton AC = (S, I, T, S \ F). In other words, we want to keep the original
automaton A and declare the final states to be those which are not the final states of
the original automaton. This idea certainl y works if A is a deterministic automaton.
Indeed, we have the following.
Lemma 2.3.1 If A is a deterministic automaton, then A C = (S, I, T, S \ F)
accepts the complement of L(A), that is, L(AC ) = ~* \ L(A).
Proof. Let u be an input for A. Consider a computation

of the automaton on u. Note that this computation is unique and is also a compu-
tation of A C • Thus, A accepts u if and only if Sm+! E F. In turn, Sm+! ~ F if
and only if A C accepts u. SO A C accepts u if and only if A does not accept u. The
lemma is proved.
However, if the original automaton A is not deterministic, then this lemma
does not work. The basic reason that A C cannot be regarded as an automaton which
accepts the complement of L(A) is the following. Even if there is a computation

of A on input u such that Sm+! ~ F, this fact does not guarantee that u is not
accepted by A. There can still be some other computation of A on u which is
successful, so u can be accepted. In other words, u is not accepted by A if all
computations of A on u are unsuccessful.
The idea to overcome this difficulty is the following. First, we want to prove
that nondeterministic finite automata are equivalent to deterministic finite au-
tomata, that is, we want to show that for any nondeterministic finite automaton
2.3. Closure Properties 63

A there is a deterministic finite automaton 8 such that L(A) = L(8). Second, if


we can prove this fact, then the previous lemma does the job: indeed, if A is a
nondeterministic automaton, then we construct a deterministic automaton 8 such
that L(A) = L(8), and consider the automaton 8 c . Then, by the previous lemma,
8 c accepts the complement of L(A).
Here now is an idea of how to determinize a nondeterministic automaton
A = (S, J, T, F). We explain the idea by trying to keep track of a computation of
A. Say, for example, that A is in a state s and the input is u. Consider the transition
diagram T. Since A is nondeterministic, the first letter 0"1 of u transforms s into
several states of A. Note also that 0"1 can transform s to no state. Thus, one can think
that the transition diagram T collapses all transitions from s into one larger state
set SI. Thus, A can be in any of the states from SI after processing the input 0"1.
Assume that SI consists of tl, ... , tk. Now in order to keep track of the computation
of the automaton A, we must remember each of the states tl, ... , tk and read the
next input signal 0"2. Say 0"2 transforms tl into the set TI of states, t2 into the set T2
of states, etc. Thus, after reading the second input signal 0"2 of u, the automaton A
can be in any of the states from S2 = TI U ... U Tk. In order to continue to keep
track of the computation of A on the input u, we now must remember each of the
states from S2 and read the next input signal 0"3, etc. Clearly, SI and S2 are subsets
of the set S of all states of A. This suggests the idea that it suffices to keep track
of subsets of S in order to be able to simulate the work of A.
These observations suggest that all subsets of the set S are the states of a new
automaton. Thus, suppose that A = (S, J, T, F) is a nondeterministic automaton.
The power automaton Ad = (Sd, Jd, Td, F d ) is defined as follows:
1. The set of states Sd of Ad is {S'I s' ~ S}, that is, Sd is the set of all possible
subsets of S.

2. The set of initial states Jd is the set whose only element is J. Note that J is
a subset of S and hence a state of Ad.

3. The transition diagram Td is defined by the following rule:

CSI, 0", S2) E Td if and only if S2 = {s'13s E SI ((s, 0", s') E T)}.

4. The set Fd of all final states of Ad is {C c SIC n F =1= 0} if F =1= 0.


According to this definition, the states of the power automaton are the subsets of S.
As explained above the intuition behind the construction of the power automaton
is that the automaton Ad keeps track of the set of all states that the computations
of A could be in. We note that if the original automaton A has n states, then the
number of states of the power automaton is 2n. Thus, determinizing the original
automaton leads to an exponential blow-up in the number of states. Later, we will
show that this exponential blow-up is unavoidable.

Example 2.3.1 Consider the automaton presented in Figure 2.15.


Figure 2.15

Figure 2.15 represents the transition graph of a nondeterministic automaton


A over the alphabet {a, b} with exactly three states. The automaton accepts all
finite words over alphabet {a, b} that have an a at the second position from the
right end. The intuition in constructing A is that A guesses whether it is in the
second position from the right end of the input each time when A reads the input a.
The construction of the power automaton for A yields an automaton with
exactly eight states. In Figure 2.16 we present the transition diagram of the power
automaton Ad constructed from A. In this automaton the subsets of the states of
A are states of Ad. In particular, {sO} is the initial state and {sO, sl, s2}, {sO, s2},

oa
{sl, s2}, {s2} are all final states.

a b

{sO,sl,s2}~{sO,s2} Q
ta~ /f
{sO.slJ~ tb
ta tc
.. b../f{s2}

Ob
y
{sl} {sl, s2}

Figure 2.16: The automaton Ad obtained by determinizing A.

One can now check that automata A and Ad both accept the same language.
Also note that Ad is a deterministic automaton.
These ideas and the example suggest that the class of languages accepted
by nondeterministic automata coincides with the class of languages accepted by
deterministic automata. This is indeed correct and we prove the following theorem.
Theorem 2.3.3 Let A = (S, [, T, F) be a nondeterministic finite automaton. Then
the power automaton Ad is deterministic and L(A) = L(Ad).
Proof. The power automaton Ad is deterministic. Indeed, first of all, the set
[d of initial states contains exactly one element. This satisfies the uniqueness of
2.3. Closure Properties 65

the initial states condition of deterministic automata. Now we show that Td is


a deterministic transition table. Suppose that (SI, (J, S2), (SI, (J, S~) E Td. The
definition of Td shows that S2 = S~. Moreover, note that for all SI E Sd and
(J E b there exists S2 such that (SI, (J, S2) E Td. Hence Td is a deterministic
transition table.
Now our goal is to show that A and Ad accept the same language. Suppose
that (JI (J2 ... (Jm is accepted by A. There exists a computation Sl, S2, ... , Sm+1 of
A on the input (J!U2 ... (Jm such that Sm+1 E F. Define the sequence

of states of the automaton Ad by stages:


Stage 1. Set SI = I.
Stage 2. Set S2 to be the state such that (SI, (JO, S2) E Td.
Stage m + 1. Suppose the state Sm has been defined. Then set Sm+ I to be the
state of Ad such that (Sm, (Jm, Sm+l) E Td.
Clearly, the defined sequence

of states of Ad is a computation of Ad on (JI (J2 ... (Jm such that Sl E SI, S2 E S2,
... ,Sm+1 E Sm+l. By the definition of F d , Sm+1 is a final state of the power
automaton. Hence, the power automaton Ad accepts (JUJ2 ... (Jm.
Now we show that if a string is accepted by Ad, then the string is also
accepted by A. Let SI, S2, ... , Sm+1 be a computation of Ad on (J!U2 . .. (Jm such
that Sm+1 E Fd. Hence there exists an sm+1 E Sm+1 n F. From the definition of
the transition table Td we conclude that there exists a sequence

SI,···, Sm+1

of states of the original automaton A such that Sm+ I belongs to F n


Sm+ I, Sm E Sm
and (sm, (Jm, sm+d E T, ... , SI E SI and (SI, (JI, S2) E T and SI belongs to
I = SI. Therefore, we conclude that so, SI, ... ,Sm+1 is a successful computation
of A on (JI ... (Jm. Hence A accepts the input (J!U2 ... (Jrn. The theorem is proved.

Exercise 2.3.4 Give a formal proof of the last part of Theorem 2.3.3.

Exercise 2.3.5 Let Al and A2 be deterministicjinite automata. Consider the au-


tomata B = Al EB A2 and C = Al x A2 that recognize the union and the intersec-
tion of L(AI) and L(A2), respectively. Construct an automaton recognizing the
complements of L(B) and L(C) without using the subset construction.

Based on the theorem above, we now prove our next result.


66 2. Finite Automata

Theorem 2.3.4 For every finite automaton A there exists an automaton E such
that L(E) = ~* \ L(A).

Proof. Indeed, consider the power automaton Ad. By the previous theorem
L(A) = L(Ad ). By Lemma 2.3.1 we see that there exists a E such that L(E) =
~* \ L(A). The theorem is proved.

As a corollary, we can now combine the three theorems about union, inter-
section and complementation of FA recognizable languages and state the following
important result in finite automata theory.

Theorem 2.3.5 The set of all finite automata recognizable languages over the
alphabet ~ is closed under the operations of union, intersection, and complemen-
tation. D

The next exercise provides a method, based on inductive definition, of de-


terminizing a nondeterministic finite automaton A = (S, I, T, F). We need the
following definition. Let XeS and a E ~. Then set

T'(X,a) = {s'l (s,a,s') E Tforsomes EX}.

Exercise 2.3.6 Take a nondeterministic finite automaton A = (S, I, T, F). Con-


struct a new set S' by stages as follows.
Stage O. Set So = {I}.
Stage n + 1. Suppose that Sn has been built and is {X 1, ... , Xk}. Set
Sn+l = Sn U{T'(Xi, a) I a E ~, 1 :s i :s k}.
If Sn+l = Sn, then let S' = Sn. Otherwise go to the next stage.
Prove the following two facts.

1. There exists an n such that Sn+l = Sn.

2. Set F' = {XIX E S', X n F i= 0}. Define A' = (S', {I}, T', F'). Show
that A' is a deterministic automaton that accepts L(A).

2.3.3 On the Exponential Blow-Up of Complementation. Let A be a non-


deterministic automaton. As we see from the previous section, the exponential
blow-up in the number of states occurs when we construct an automaton which
accepts the complement of L(A). Is this unavoidable? The next theorem shows
that this is indeed an unavoidable phenomenon.

Theorem 2.3.6 For every natural number n ~ 1 there exists an automaton A with
exactly n + 1 states such that no deterministic automaton with less than 2 n states
recognizes the complement of L(A).
2.3. Closure Properties 67

Proof. Consider the set L of all words u over the alphabet b = {a, b} that
have the letter a at the nth position from the right end of u. Thus,

L = {uav I u, v E b*, Ivl = n - I}.

There exists a nondeterministic automaton A with exactly n + 1 states which


recognizes L. Indeed, let A = (S, /, T, F) be the following automaton:

1. S = {so, ... , sn}.

2. / = {so}.

3. T = {(so, a, so), (so, b, so), (so, a, Sl), (Si, CT, si+I)la E b, 1 ~ i ~ n-l}.

4. F = {sn}.

It is not hard to check that A recognizes L. Intuitively, the automaton looks at a


position in the input word, checks if that position contains a, and then checks if
the position is at distance n from the right end of the input word.
Now we show that no deterministic automaton with less than 2 n states recog-
nizes the complement of L (A). Suppose that there exists a deterministic automaton
8 = (S8, {s8}, T8, F8) with fewer than 2n states that accepts the complement
of L. Note that there are exactly 2 n words of length n. Since S8 has fewer than
2n states, there must exist two distinct words uavi and UbV2 of length n such that
these two words transform the initial state s8 to the same state. Now consider the
two words uavi u and UbV2U. Note that in the word uaVlU the letter a appears at
the nth position from the right. Hence uavi u E L. Note that the second word does
not belong to L. Hence 8 accepts UbV2U. However, by the choice of uavi and
UbV2, the words uaVlU and UbV2U transform the initial state s8 to the same state.
Hence 8 accepts uavi u since 8 accepts UbV2U. This is a contradiction. We have
proved the theorem. D
The next exercise shows that the exponential blow-up in the determinization
of nondeterministic finite automata can even occur for automata over a one-element
alphabet.

Exercise 2.3.7 For every natural number n consider the automaton An pictured
in Figure 2.17. This automaton has n disjoint cycles of length 2, 3, 5, etc., that is,
the cycle i from the left is of length Pi, where Pi is the ith prime number. Prove
that no deterministic automaton with less than PI'2 ..... Pn states accepts the
language recognized by An.

2.3.4 Some Other Operations. Now we would like to give two other examples
of operations which when applied to FA recognizable languages still produce FA
recognizable languages. Such operations are called closed with respect to the class
of FA recognizable languages.
68

Figure 2.17: Automaton An.

Let u = ao . . . am E 1;* be an input. Consider the set of all initial segments


of this input. These initial segments are:

We call these initial segments prefixes. Prefixes other than A. and u itself are called
proper prefixes.
Suppose that L I and L2 are languages. Consider the set pref (L I, L2) of all
strings which are in L I and are prefixes of words belonging to L2, that is

pref(LI, L2) = {u Iu E LI and for some string w, uw E L2}.

For example, when L I coincides with 1;*, the language pref (L I, L2) contains
precisely all inputs which are prefixes of words from L2. In this case, note that L2
is a subset of pref(LI, L2). The next theorem shows that the set of all prefixes of
an FA recognizable language is again FA recognizable.

Theorem 2.3.7 Let LI and L2 be FA recognizable languages. Then the language


pref (L I, L2) is FA recognizable.

Proof. Let Ai = (Si, Ii, Ti, Fi) be a finite automaton recognizing Li for
each i = 1,2. We can suppose that the sets of states SI and S2 have no common
states. An informal description of an automaton A which recognizes the language
pref(LI, L2) is the following. The automaton A takes a string u E 1;* as an input
and begins mimicking both the automaton Al and the automaton A2 simultane-
ously. As soon as the computation of Al on u is completed at a final state f E FI,
the automaton A continues to mimic A2 and seeks to determine whether a state
from F2 is accessible. This, in turn, suggests the idea of using the accessibility
operator of the automaton A2.
We now formally define the desired automaton A = (S, I, T, F) as follows:
2.3. Closure Properties 69

1. The set of states of A is S = SI x S2. The idea is that when A performs a


computation, A tries to mimic Al on the left and A2 on the right coordinates
of the pairs.
2. The set of initial states is II x h
3. The transition table T is the set
{( (SI, sD, a, (S2, s;)) J (SI, a, S2) E TI and (s;, a, s;) E T2}·

4. The set of final states is F = {(f, s) f E FI and G (s)


J n
F2 =1= 0}, where G
is the accessibility operator on A2. The intuition is that we accept u if some
prefix v of u is accepted by AI, and there exists some continuation of the
current computation of A2 on u that is successful.
Now we prove that the automaton A recognizes the language pref(LI, L2)'
Suppose that an input u = ao ... am belongs to L(A). Then there is a computation
(so, sb), ... , (Sm+l, s~+I)
of A on u such that (so, sb) E I and (Sm+l, s~+I) E F. Since A mimics Al on
the left coordinates of the computation, by the definition of F we see that u ELI.
n
For the accessibility operator G, we have G(s~+I) F2 =1= 0. Hence there must
n
exist a w that transforms s~+1 to a state from F2 G(s~+I)' We conclude that
uw E L2.
Now, suppose thatu E pref(LI, L2)' There is a w such that uw E L2 and
u ELI. Since u ELI, there is a computation
so,···, Sm+1
of the automaton Al such that So E hand Sm E Fl. Since uw E L2, there is a
computation
I I I
so' ... , sm+I' ... , sm+k
of A2 such that sb E 12 and Sm+k E F2. It follows that for the automaton A2, the
input w transforms s~+ I to the state s~+k' Therefore, (sm+ I , s~+ I) E F. Clearly,
(so, sb), ... , (Sm+l, s~+I)
is a computation of A on u. Hence u belongs to L(A). The theorem is proved.
Let u be an input ao ... am. The suffixes of u are all words

Let LI and L2 be languages. Similar to the consideration of pref(LI, L2), one can
also define the set of all strings which are in L I and are suffixes of words belonging
to L2, that is,
suf(LI, L2) = {uJu E LI and for some w we have wu E L2}.
We formulate the following theorem and leave the proof to the reader.
70 2. Finite Automata

Theorem 2.3.8 Let L I and L2 be FA recognizable languages. Then the language


suf (L I, L2) is FA recognizable. 0
Exercise 2.3.8 Prove Theorem 2.3.8.
The next exercise provides another more general definition of nondetermin-
istic finite automata in which transitions known as silent transitions are allowed.
Exercise 2.3.9 Let ~ be an alphabet. A nondeterministic finite automaton with
silent moves is a quadruple A = (S, J, T, F), where S, J, and F are exactly the
same as in the definition offinite automaton (see Definition 2.2.2) and T is a union
of TI and T2 such that
1. TI C S X ~ X S,
2. T2 C S X S.
Thus, if A is in state sand (s, Sf) E T, then A is allowed to silently move from s
to Sf without yet reading the next input. Do the following:
1. Define the notions of computation, acceptance, and recognizable languages
for nondeterministic automata with silent moves.
2. Prove then that for any L C ~*, the language L is FA recognizable if
and only if L is recognized by an NFA with silent moves. (Hint: Use the
accessibility operator).

2.3.5 Projections of Languages. This subsection is devoted to what is called the


projection operation on languages. The reader who is familiar with the elements of
mathematical logic has certainly noticed that the union operation corresponds to
"or" (equivalently "disjunction," denoted by v), the intersection operation corre-
sponds to "and" (equivalently "conjunction," denoted by &), and complementation
corresponds to "not" (equivalently "negation," denoted by -.). In predicate logic
there is an important symbol denoted by :3 and called the existential quantifier. Go-
ing a bit ahead, we note that the projection operation will correspond to existential
quantification.
Now let us explain the projection operation. In order to talk about projections
of languages, we need to have an alphabet ~ whose symbols are pairs of input
signals. Therefore, we suppose that our alphabet ~ is of the form

~I x ~2 = {(a, b) I a E ~I, b E ~2},

where ~ I and ~2 are also alphabets. Any word of this alphabet is a sequence which
looks like
(UI, u{) ... (um , u~).

We can naturally identify this sequence with the pair

(UI ... U m , u{ ... u~)


2.3. Closure Properties 71

oftwo words u = al ... am E bj and v = a{ ... a:n E Li. Thus, if L is a language


over b, then we can think of the elements of this language as pairs of the form
(u, v) such that u E bj, v ELi, and lui = Ivl.

Definition 2.3.1 Let L be a language over the alphabet b. We define the projec-
tions prl (L) and pr2(L) a/this language as/allows:

prl (L) = {u E bj I (u, v) E L/or some v ELi}'

and
pr2(L) = {u E bi I (v, u) E L/or some v E bj}.
Thus, pri(L) is a language over the alphabet bi, i = 1,2. In the next theo-
rem, we show that the projection operations applied to FA recognizable languages
produce FA recognizable languages.

Theorem 2.3.9 lfthe language Lover b = LI x b2 is FA recognizable, then so


is the projection pri(L)/or each i = 1,2.

Proof. Let A = (S, /, T, F) be an automaton accepting L. We construct


an automaton Al which accepts the projection prl (L). The construction of an
automaton which accepts pr2(L) is similar. Informally, the automaton AI can be
explained as follows. The automaton Al takes an input

w = ao ... a m
from bj and mimics all computations of A on all strings

over b, where each a:belongs to b2. The idea is that if A accepts one of these
strings, then AI accepts w. Formally, the automaton Al = (SI, h, TI, FI) is
defined as follows. The set of states SI of Al is S. The set h of initial states is
/. The transition diagram TI contains a triple (s, aI, Sf) if and only if there exists
a a2 E b2 such that (s, (aI, a2), Sf) is a transition of A, that is, (s, (aI, a2), Sf)
belongs to T. The set of final states FI is F.
We need to prove that L(AI) = prl (L). Suppose that u = ao ... am belongs
to L(A]). There is a computation

so,···, Sm+1

of Al on u such that Sm+1 E Fl. By the definition of AI, there is a sequence


v = a~ ... a:n in bi such that

so,···, Sm+1
72 2. Finite Automata

is a computation of A on
(u, v) = (0'0 ... O'm, O'~ ... O'~).

Since Sm+1 E F we have (u, v) E L. Hence u E prl (L).


Now suppose that u = 0'0 . . . O'm belongs to prl (L). Hence there is a v such
that (u, v) E L. We conclude that there exists a computation

So, ... , sm+1


of A on (u, v) such that Sm+1 E F. By the definition of AI,

So, ... , sm+1


is also a computation of Al on u such that Sm+1 E Fl. Hence, u E L(AI). The
theorem is proved.

2.4 The Myhill-Nerode Theorem


In this section we prove one of the early results in the theory of finite automata, the
Myhill-Nerode theorem. This theorem gives a characterization of FA recognizable
languages in terms of what are called Myhill-Nerode equivalence relations.
Suppose that A = (S, J, T, F) is an automaton. The transition table T of the
automaton defines a natural relation, denoted by "', between inputs. The relation
'" is defined as follows.
Definition 2.4.1 We say that two inputs u and v are in relation'" iffor all states
sand s' from S, the input u transforms s to s' if and only if the input v transforms
s to st.

Note that the definition of '" depends on A. Therefore, different automata


may produce different equivalence relations of the type "'. The idea behind this
definition is that the automaton A cannot distinguish the input u from the input v.
Informally, we also can say that if u and v are in relation "', then the automaton
A identifies these inputs. Here is an easy lemma. Before presenting the lemma we
recall that the index of an equivalence relation is the number of its equivalence
classes.
Lemma 2.4.1 Let A be an automaton. The relation'" is an equivalence relation
on the set of all finite words b*. Moreover, the index of the equivalence relation "'-
is finite.
Proof. The proof that'" is an equivalence relation is straightforward (sec
Exercise 2.4.1). We need to show that the index of'" is finite. Take any input u
This input defines a function fu from the set S of states to the power set P(S)
Namely, for any s E S:
fu (s) = {Sf I input u transforms s to s'}.
2.4. The Myhill-Nerode Theorem 73

Clearly, the number of functions from S to peS) is finite: say there are k such
functions. By the definition of rv, one can easily see that for all u and v the string
u is rv-equivalent to v if and only if fu = fv. Hence the number of rv-equivalence
classes does not exceed k. We conclude that the index of rv is finite. The lemma is
proved.

Exercise 2.4.1 Prove that rv is indeed an equivalence relation.

Exercise 2.4.2 Consider the automaton pictured in Figure 2.18. Define the equiv-
alence classes of the relation rv for this automaton. What is the index of the equiv-

alence relation rv? ~a


.. b .,..

J:3.' ~~
* ~~

Figure 2.18

One of the fundamental properties of the relation rv is the following simple


fact which can be easily derived:

for all inputs u, v, w, if u is rv-equi valent to v, then u w is rv-equi valent


to vw.

This property is called right invariance property of the relation rv. An instance of
this property is the following:

(*) For all u, v, w, if u rv v, then uw E L(A) if and only if vw E L(A).

This suggests the following definition. The definition characterizes equivalence


relations which are known as the Myhill-Nerode equivalence relations.

Definition 2.4.2 Let L be a language. The inputs u and v are L-equivalent iffor
all w, the input u w belongs to L if and only if the input vw belongs to L. If u and
v are L-equivalent then we denote this fact by u rvL V.

An immediate consequence of this definition is the following lemma whose


proof is straightforward.

Lemma 2.4.2 The relation rv L is an equivalence relation. 0

Exercise 2.4.3 Prove the lemma stated above.

Now we are ready to prove the Myhill-Nerode theorem.


74 2. Finite Automata

Theorem 2.4.1 (The Myhill-Nerode Theorem) A language L is FA recognizable


if and only if the Myhill-Nerode equivalence relation ~ L is offinite index and L
is a union of ~ L -equivalence classes.

Proof. Suppose that L = L(A) for some automaton A. Consider the equiv-
alence relation ~ defined by the automaton. By Lemma 2.4.1, the equivalence
relation ~ is of finite index. From (*) we get that if u and v are ~-equivalent then
u and v are L-equivalent. We conclude that every ~ L -equivalence class is a union
of ~-equivalence classes. So the index of ~ L is less than or equal to the index of
~. Hence, the equivalence relation ~L is of finite index. To see that L is a union
of ~ L -equivalence classes it suffices to note that if u ELand v ~ L u, then vEL
by the definition of ~L (since UA E L if and only if VA E L).
Now suppose that ~ L is an equivalence relation of finite index. Our goal
is to build a finite automaton A such that L = L(A). The idea for construct-
ing A is already hidden in the definition of ~ L. Indeed, if we take any input,
say aOal '" am-Wm, then ao transforms the ~L-equivalence class containing
A to the ~ L -equivalence class containing ao. Similarly, al transforms the ~ L -
equivalence class containing ao to the ~ L -equivalence class containing aOal. Con-
tinuing this reasoning, we see that am transforms the ~ L -equivalence class con-
taining ao ... am-I to the ~L-equivalence class containing ao ... am-lam. Thus,
the construction of the desired automaton A = (S, I, T, F) is the following.

1. The set S of states is the set of all ~ L -equivalence classes, that is

S = {[u] Iu E ~*},

where [u] is the ~L -equivalence class containing u.

2. The initial states set I contains only one ~ L -equivalence class, which is [A].

3. The transition table T contains ([u], a, [v]) if and only if ua ~L v.

4. The set F of all final states is {[ u] I u E L}.


We note that A is a deterministic finite automaton. Indeed, suppose that [u] E S,
and both ([u], a, [v]) and ([u], a, [w]) belong to T. Then ua ~L v and ua ~L w.
Hence, since ~ L is an equivalence relation, we get that [v] = [w]. The automaton
is finite since ~L is of finite index. Now we need to show that L = L(A). Suppose
that u = aOal ... am-Wm E L. Then u transforms the initial state [A] to the state
[u]. Since u E L, we see by the definition of F that [u] E F. Hence u E L(A).
Now suppose that u E L(A). Then the sequence

[A], [an], ... , [an ... am-d, [an ... am-l a]

is a computation of A on u. Since [u] E F, we get that u E L by the definition of


F and ~. The theorem is proved.
2.4. The Myhill-Nerode Theorem 75

We note that in the proof above, in the right to left direction, we never used
the hypothesis that L is a union of '" L equivalence classes. So as a corollary we
have the following.

Corollary 2.4.1 A language L is finite automaton recognizable if and only if '" L


is offinite index.

Exercise 2.4.4 Check the correctness of the corollary above.

Exercise 2.4.5 Give an example of an automaton A for which the relation'" L


does not coincide with the relation "', where L = L(A).

Exercise 2.4.6 Let L be an FA recognizable language over b.

1. Suppose that L is recognized by a deterministic finite automaton A with k


states. Show that the index of'" L is at most k.

2. Show that if the index of'" L is n, then there exists a deterministic finite
automaton with exactly n states recognizing L.

An interesting fact is that the construction of the automaton in the proof of


the Myhill-Nerode Theorem provides a minimal automaton in the sense defined
below.

Definition 2.4.3 A deterministic finite automaton A is minimal if the number of


states of every deterministic automaton recognizing L (A) is greater than or equal
to the number of states of A.

Exercise 2.4.7 Let L be an FA recognizable language. Consider the automaton A


constructed in the proof of the Myhill-Nerode Theorem. Show that A is minimal.

Exercise 2.4.8 We say that automata A = (S A, lA, TA, FA) and B = (SB, I B,
TB, FB) over alphabet b are isomorphic if there exists a one-to-one mapping h
from SA onto SB such that the following properties hold:

1. For all s E SA, s E FA ifand only ifh(s) E FB;

2. For all s], S2 E SA and a E b, (s" a, S2) ETA if and only if (h(s]), a,
h(s2» E TB'

3. Foralls E S" s E IA ifandonlyifh(s) E lB'

Show the following:

1. If A and B are isomorphic, then L(A) = L(B).

2. Two minimal automata recognizing the same language are isomorphic.


(Hint: Use Exercise 2.4.7.)
76 2. Finite Automata

2.5 The Kleene Theorem


In this section we show how FA recognizable languages can also be obtained by
other means. Informally, we explain a process of generating all FA automata recog-
nizable languages without any reference to finite automata. Let 1: = {ai, ... , an}
be an alphabet. We introduce three simple operations denoted by +, ., and * on
languages over 1:. We prove that the class of all languages obtained by applying
successively these operations to languages

0, {A.}, {ad, ... , {an}

is in fact the class of all FA recognizable languages. For the reader who is familiar
with the elements of universal algebra we can say more. We consider the finitely
generated algebra whose generators are

0, {A.}, {ad, ... , {an}

and whose operations are +, ., and *. Then we prove that this algebra coincides
with the algebra of all FA recognizable languages with operations +, ., and *.

2.5.1 Regular Languages. Our goal is to provide another characterization of


finite automata recognizable languages. To do this we first introduce simple opera-
tions on the languages over the alphabet 1:. Then by successively, or equivalently
inductively, applying these operations to the (most trivial) languages, which are

0, {A.}, {ad, ... , {an},

we generate more complex languages. Now we need to present these operations


and explain how to generate languages.
The first operation is denoted by . (dot). Suppose that L \, L2 are languages
over 1:. Define the language L\ . L2, called the concatenation of Ll and L2, by:

Here are several examples of this operation.


Example 2.5.1 Let L\ be {A.}. Then L\ . L2 is clearly L2.
Example 2.5.2 Let L\ be 0. Then L\ . L2 is 0.
Example 2.5.3 Let L\ = {a, b} and L2 = {ba, bbl. Then the language L\ . L2
consists o/words aba, abb, bba, bbb.

The concatenation operation makes the set of all languages a monoid, that
is for all languages L \, L2, and L3 over 1: the following equality, called the
associative law, holds:
2.5. The Kleene Theorem 77

Exercise 2.5.1 Prove the associative law for the concatenation operation.

Another operation is the union of languages LI and L2. This operation is


denoted by +. Thus, LI + L2 is by definition

Finally, the third operation is denoted by * and is called the Kleene star,
or simply the star operation. The star operation is a unary operation that can be
applied to any language L. Let L be a language. The application of * to L is denoted
by L * and is defined as

where LO = {A}, LI = L, L2 = LI . L, and L n +1 = L n . L, nEw. Thus, L


consists of all words which can be obtained by concatenating a finite number of
strings from L.
To explain the last operation, we consider several examples.

Example 2.5.4 Let L = {ab}. Then L* = {A, ab, abab, ababab, ... }.

Example 2.5.5 Let L = {a}. Then L* = {A, a, aa, aaa, aaaa, .. . }.

Example 2.5.6 Suppose that L = {a, b}. Then L* = ~*.

The last example shows that our notation for "E* is consistent with the defi-
nition of the * operation. Note that for each L the language L * contains the empty
string A.
One can easily see (prove it) that for any language L, the language L* is in
fact precisely the set

{UI . U2 . . . . . UnIUI, ... , Un E L, n ::: OJ.


Thus, in the class of all languages we have three operations: ., +, and *.
Our goal now is to explain how to generate new languages using the three
just introduced operations. In particular, we give a formal definition of what we
mean by generating languages. Informally, we proceed as follows. We begin with
the (simplest) languages

0, {A}, {ad, ... , {an}.

We then generate new languages by applying the operations ., +, and * to these


simple ones. The generating process of languages goes by stages, or equivalently
by induction. At each stage t ::: 1 of the generating process we have a class R t
which contains a finite number of languages. All languages generated before stage
t will be in the class Rt-I. In defining the languages of the class R t we use the
78 2. Finite Automata

operations ., +, and * as well as languages which have been generated before stage
t, that is the languages from the class R t -I. Here is the formal description of the
stages.
Stage O. This is the simplest stage. Just let Ro be the class of languages which
contains precisely
0, {),,}, {ad, ... , {an}.
Stage t + 1. Suppose that R t has been defined. By the induction hypothesis
Rt contains finitely many languages, say
LI, L2, ... , Lk.
Then let Rt+1 be
RtU{Lili = 1, ... ,k}U{Li·Ljli,j = 1, ... ,k}U{Li+Ljli,j = 1, ... ,k}.
This ends the description of stage t + 1.
We note that all languages from R t and all the operations +, ., and * have
been used at stage t + 1. Also note that Rt+1 contains finitely many languages.
Now it is easy to see that we have the following increasing sequence:
Ro C RI C R2 C ... C Rt C Rt+1 C ....
Therefore, we can naturally consider the union of this sequence, that is, we define
the set R by

tEW

Here now is an interesting definition.


Definition 2.5.1 A language L C I;* is regular if L is in R.
Thus, any regular language L is generated at some stage t of the process
described above. Therefore, there must exist a stage t at which L E R t .
Exercise 2.5.2 Let I; = {a, b}. Show that the/allowing languages are regular.
1. {ab n I nEw}.
2. {(ab)2n In E w}.
3. Any finite language.
4. Any cofinite language.
S. {uabv I u, W E I;*}.

6. {aub Iu E I;*}.
The goal of this section is to find a relationship between FA recognizable
languages and regular languages. To investigate this relationship, we need some
additional notions and results.
2.5. The Kleene Theorem 79

2.5.2 Regular Expressions. Regular expressions have an important role in com-


puter science applications. For example, a user may want to search for a pattern in
a text. More generally, one may want to have an analysis of a computer program by
searching for certain patterns of the program. Regular expressions are used to pro-
vide powerful methods describing such patterns. Modem programming languages
such as PERL and text editors all have features for finding patterns using regular
expressions.
The definition of regular languages suggests an idea of naming regular lan-
guages. For example, we can name the simplest regular languages
0, {)..}, {ad, ... , {an}
by the symbols e, 0, at, ... , an, respectively. Thus, the name of 0 is e, the name
of {)..} is 0, the name of {a,} is at, etc. These names are examples of regular
expressions. Our goal is to explain how to name regular languages. When this goal
is achieved, each regular expression r will determine a language denoted by L(r).
Naturally, this language L(r) will be the one whose name is r. Thus, for example
L(e) = 0, L(O)= {)..}, L(at) = {ad, ... , L(an ) = {an}.
We would now like to develop the idea of giving names to regular languages.
Regular expressions are special type of words over the new alphabet which
contains the following symbols:

Using these symbols we give an inductive definition of regular expressions. Simul-


taneously, for each regular expression r, we define the language denoted by L(r).
Basic Inductive Step. The atomic regular expressions are

Set
L(e) = 0, L(O) = {)..}, L(at) = {a,}, ... , L(an ) = {an}.
Inductive Step. Suppose that the regular expressions rj, r2, and languages
L(rj) and L(r2) have been defined. Then

(rj . r2), (rj + r2), (r,)*

are regular expressions. The languages defined by these expressions are

L(rj) . L(r2), L(rj) U L(r2), and L(rj)*,

respecti vel y.
We note that the star operation binds more strongly than other operations,
the concatenation operation· binds more strongly than +. So for instance the
expression at *. a2 +a3 is in fact a short version of the expression (((at)*· a2) +a3).
We denote the set of all regular expressions by RE.
80 2. Finite Automata

Example 2.5.7 Consider the regular expression at* . a2*' The language defined
by this expression consists of all words of the type alai such that n, mEw.

Example 2.5.8 Consider the regular expression at . a2 + a2*. This expression


defines the language
{ala2} U{a2 In E w}.

Exercise 2.5.3 Show that any of the languages below is defined by a regular ex-
pression:
1. {ab n I nEw}.
2. {(ab)2n In E w}.

3. Any finite language.

4. Any cofinite language.

5. {uabv I u, W E ~*}.

6. {aub Iu E ~*}.

Exercise 2.5.4 Show that if a regular expression r does not contain the star oper-
ation *, then L(r) is a finite language.

If L = L(r) then we say that r is a name of L. Note that if r is a name


of the language L, then the regular expressions r + e, (r + e) + e, etc. are also
names of the same language L. So if L is named by a regular expression, then L
has infinitely many names.
We can now prove the following theorem whose proof basically follows from
the definitions of regular expression and regular language.

Theorem 2.5.1 A language L is regular ifand only if L = L(r)forsome regular


expression r.

Proof. We show that if L is regular, then L = L(r) for some regular ex-
pression r. To prove this we use the inductive definition of regular languages. So
suppose that L is regular. Then L belongs to the class R of languages. By induction
on t we prove that for every language L' from R t there is a regular expression r'
such that L' = L(r'). Assume that t = O. Then clearly every L from Ro is named
by a regular expression. Suppose that all languages L I, ... , Lk from Rt are named
by regular expressions rl, ... , rb respectively. Let L E Rt+ I. Then L belongs to

If L E R t , then by the inductive assumption L is named by a regular expression.


If L = Lj for some i, then rj is a regular expression for which L = L(ri). If
L = Li . Lj, then L(ri . rj) = L. If L = Li + Lj, then L = L(ri + rj).
2.5. The Kleene Theorem 81

Suppose that L = L(r) for some r. Using the inductive definition of regular
expressions, we show that L is regular. If r is an atomic regular expression, then
clearly L is regular. Suppose that r = rj. By the induction hypothesis, L 1 = L (rl)
is regular. Hence LIE R t for some t. Hence L E Rt+ 1 by the definition of Rt+ I.
Suppose that r is either rl . r2 or rl +r2. By the induction hypothesis, the languages
LI = L(rl) and L2 = L(r2) are regular. Hence there is a t such that LI, L2 E Rt .
lt follows that L E Rt+l. This proves the theorem.

Example 2.5.9
1. The regular expression a* + a· b is a name for the language
{ab, A., a, aa, aaa, aaaa, ... }.

2. The regular expression a* . (b· b)* is a namefor the language

Exercise 2.5.5 What languages are named by the following regular expressions:
1. a*· b*.

2. (a + b) . (a· b*).
3. b + (a . b . b)*.
4. (a· b + b . a)*.
2.5.3 The Kleene Theorem. Now we are ready to prove the main theorem of
this section, The Kleene Theorem. The theorem states that regular expressions
define the class of FA recognizable languages.

Theorem 2.5.2 (The Kleene Theorem) A language L is regular if and only if L


is finite automaton recognizable.

Proof. Suppose that the language L is regular. By Theorem 2.5.1, there exists
a regular expression r such that L(r) = L. By induction on the complexity of the
regular expression r, we prove that L is finite automaton recognizable. The basic
inductive step is easy. If r is an atomic regular expression, then L(r) is one of the
following languages:

Each of these languages is obviously FA recognizable.


Suppose that r is of the form rl + r2 or rl .r2 or rj . By the induction hypothesis,
for each i there exists a deterministic finite automaton Ai = (Si, Ii, Ti, Fi) which
accepts theregularlanguage L(ri), where Ii = {so,d, i = 1,2. We set Li = L(ri).
82 2. Finite Automata

We can assume that the sets of states S I and S2 have no states in common. We need
to show that the languages L(rl + r2), L(rl . r2), and L(rj) are FA recognizable.
If r = (q + r2), then, since the class of FA recognizable languages is
closed under the union operation, the language L(rl + r2) = L(rJ) U L(r2) is FA
recognizable. So we should consider the cases when r = rl . r2 and r = rj.
Now we need the following lemma.

Lemma 2.5.1 Suppose that Al and A2 are deterministic automata accepting the
languages LI and L2, respectively. Then
1. the concatenation LI . L2 of LI and L2 is FA recognizable;
2. the language Lj is FA recognizable.
Proof of the Lemma. We prove the first part of the lemma. An informal
description of an automaton A accepting the language LI . L2 is the following.
For each u E b*, first the automaton mimics AI; then, each time a final state f
of Al is reached, A has two options: one is to begin mimicking A2; the other is
to continue mimicking Al until a final state of Al is reached again. If A begins
mimicking A2, then this corresponds to a guess of A that the rest of the string read
is in L2.
Thus, we define the automaton A by:
1. The set S of states of A is SI U S2.
2. The set of initial states of A is h.
3. The transition table T is defined as follows:
ifsESI\FI,
ifs E S2,
ifs E Fl.

4. The final states set F is

F={ if A E L2,
otherwise.

Now we check that L(rl ·r2) = L(A). Suppose than E L2. The case when A ~ L2
is treated similarly (see the exercise at the end of the theorem). We need to show
that L(A) = LI . L2. Suppose that uv E LI . L2, u E LI, V E L2. There exists
a successful computation s6 1), s?), ... , s~ll of Al on u such that s~ll E Fl. If
v = A, then s~ll E FI U F2. Hence uv E L(A). If v i= A, then there exists a
2
successful computation s6 ), s~2), ... ,sk21 of A2 on v such that sk21 E F2, where
s62) is sO,2, that is, the initial state of A2. It follows that the sequence
(I) (I) (I) (2) (2)
So ,sl , ... , sm+I' sl , ... , sk+1
2.5. The Kleene Theorem 83

is a computation of A on uv and s~~1 E F. Hence uv E L(A). We have proved


that LI . L2 c L(A).
Now suppose that u = 0'0 . . . U m E L(A). Let

so, SI, ... , Sm+1

be a computation of A on u such that Sm+ I E F. If Sm+ I E FI then by the definition


of T the sequence
SO,SI,···,Sm+1

is a computation of Al on u. Since A E L2, we have u . A E LI . L2. Suppose that


Sm+1 rt FI but Sm+1 E F2. Then there exists an i < m + 1 such that Si E FI and
Si+1 E S2.1t follows that 0'0 ... Ui-I ELI and Ui ... Um E L2. Hence u E LI . L2.
Now we prove the second part of the lemma. An informal description of an
automaton A accepting L i is as follows. For each u E I: *, the automaton A begins
mimicking AI. Then each time a final state f E FI is reached, A has two options:
one is to continue mimicking AI; the other is to assume that f is the initial state
of Al (in other words, A replaces f with the initial state of AI) and begin a new
computation of Al from the initial state. However, in order to implement this idea,
we need to be careful. We need to change Al to A;
so that no input can send
any state in A; to the initial state (see the exercise at the end of this theorem). Of
course, we want Al and A; to recognize the same language. This is quite easy to
do. Take a new state s' which does not belong to SI. This new state just copies
what the initial state SI ,0 does during computation. Thus A;
is defined as follows:

1. The set Si of states is SI U{s'}.

2. The set I{ of initial states contains s' only.


3. The transition table T' is defined as follows:

TI(s,u) if s =1= s',


T{(s, 0') = { T ( ) if S = s'.
I SI,O, 0'

4. The set F{ is defined by

FI if SI,O rt FI,
F{ ={ FI U{s'} otherwise.

To see that Al and A;


recognize the same language, one needs to notice that A;
follows the same transitions as Al does except for the fact that any computation of
A; begins from the new state s'. Thus, without loss of generality we can suppose
that for Al there is no pair s, 0' for which T(s, 0') = SI,O.
84 2. Finite Automata

Now, we are ready to construct an A which recognizes L j. The set S of states


of A is S\. The initial state of A is the same as that of A\. The transition table T
is defined as follows:

if T\(s,a) rJ. F,
otherwise.

The set of final states of A is {S\,o}. Now one can check that A accepts the language
L j. This proves the lemma.
From this lemma we conclude that the languages L(r\ . r2) and L(rj) are
FA recognizable since given L(r\) and L(r2) are FA recognizable by the induction
hypothesis.
We are now left with the proof of the other part of the theorem, that is, we
need to show that any FA recognizable language is regular. Suppose that L is an
FA recognizable language and A = (S, {so}, T, F) is a deterministic automaton
recognizing L.
Let s\, S2 be states of the automaton A, and let XeS be a subset of S.
Consider the set G(S\, S2, X) of all strings u over ~ which transform s\ to S2
such that in this transformation all proper prefixes of u transform S\ to a state in
X. Thus, u = a\ ... am E G(S\, S2, X) if and only if there exists a computation
q\, ... , qm+\ of A on u such that q\ = s\, qm+\ = S2, and q2, ... , qm are all in X.
By induction on the number of elements in the set X, we will prove that the
set G(S\, S2, X) is regular. This fact will prove that L(A) is regular since we will
have
L(A) = U G(so, t, S).
JEF
Induction Basis. Suppose that X is 0. Then the set G(S\, S2, 0) must be a
subset of ~ since G(S\, S2, 0) = {a E ~ I(s\, a, S2) E T}. Hence G(S\, S2, 0) is
regular.
Inductive Step. Assume that for all XeS with at most n elements and for
all s, s' E S the set G (s, s', X) is regular. Let Y be a subset of S possessing exactly
n + 1 elements. We set Yz = Y \ {z}. Now we define the set D as follows:

By the inductive hypothesis, the set D is regular. In order to finish the proof of the
theorem we need to show that D = G(S\, S2, Y).
By the definition of D, itis not hard to see that D S; G(S\, S2, Y). Suppose that
u E G(S\, S2, Y). If there exists a q E Y such that no proper prefix v ofu transforms
S\ to q, then u E G(S\, S2, Yq). Therefore, by the definition of D, u E D. Suppose
that u rJ. Uq E Y G (S\ , S2, Yq). There exists a proper prefix v and an s E Y such that
2.6. Generalized Finite Automata 85

v E C (Sl , s, Ys). Let v' be such that u = vv'. Then either there exists a v" such that
v' = v"w with v" E [C(s, s, Ys)]* and WE C(s, s2, Yf), or v E C(s, s2, Ys). This
proves that C(SI, S2, Y) S; D. Hence the set D = C(Sj, S2, Y). Thus, the language
L(A) coincides with U!EF C(so, f, S). Since for every f E F, C(so, f, S) is
regular, that is, C (so, f, S) is L (r!) for a regular expression r!, we conclude that
L(A) is named by a regular expression. Hence L(A) is regular. The theorem is
proved.
Exercise 2.5.6 Consider the proof of Lemma 2.5.1 provided in the Kleene Theo-
rem.
1. Finish the proof of part (2) of the lemma.
2. In the proof of the second part of the lemma, we made an assumption that
there is no transition from any state of Al to its initial state. Why is this
assumption needed?
3. Finish the proof of the lemma by considering the case A jt L2 (in showing
thefact that L(rj . r2) = L(A)).
Exercise 2.5.7 Consider the definition of set D in the proofofthe Kleene Theorem
using the set Y with n + 1 states. Now fix a q E Y. Consider the set D':

D' = (U
SEY
C(Sj, S2, Ys)) UC(Sj, q, Yq) . [C(q, q, Yq)]* . C(q, S2, Yq)).

Show that D = D'.

2.6 Generalized Finite Automata


One can generalize the notion of finite automata in many ways. One generaliza-
tion can be obtained by assuming that a machine reads an input not just once but
may move its head back and force as many times as needed. This produces the
Turing machine model of computations. This book does not touch the topic of
Turing machines and issues related to computability on these machines, which is
a very well-known area of mathematics and computer science possessing its own
beauty and problems. Another generalization of finite automata can be obtained
by providing an extra memory location for a given finite automaton. When the
automaton reads an input of length n, the memory location can store at most n
amount of information. This type of machines are called pushdown automata and
are beyond the scope of this book. In this section we explain a new type of machine
called generalized finite automata. We begin by explaining our idea of general-
ization by providing an example. Consider the automaton Al = (SI, II, Tj, Fj)
in Figure 2.19.
Let us replace the input signals a and b that label edges with regular expres-
sions a and b, respectively, and consider Figure 2.20.
86 2. Finite P <-" - < -

Figure 2.19: Automaton A I.

Figure 2.20: Automaton AI is relabeled with regular expressions.

In Figure 2.20 we have an automaton whose transition edges are labeled with
(atomic) regular expressions. So far we have not made big changes. However, this
simple observation suggests the idea of labeling the edges of the transition graphs
with regular expressions. Well, this indeed can be done easily. Here are some
examples of graphs whose edges are labeled with regular expressions.
Example 2.6.1 The following automaton presented in Figure 2.21 has three states.
The edges of this automaton are labeled with regular expressions of the alphabet
{a , b}.

Figure 2.21

Example 2.6.2 The following automaton presented in Figure 2.22 has six states.
As in the example above the edges of this automaton are labeled with regular
expressions.
We call systems represented in the last three examples generalized finite
automata. As we see, each of the generalized automata has a finite set of states,
I Finite Automata 87

Figure 2.22
Figure 2.22

some states are initial states, some states are final states. In addition, there are
edges between states so that the edges are labeled with regular expressions. Any
of these types of systems works as follows. The system reads a block of symbols
from the input and not necessarily just one input signal, then makes a transition
along an edge. The edge is labeled with a regular expression so that the block (of
symbols) is simply a string that belongs to the language described by the regular
expression. Of course such a system is nondeterministic so the system has several
ways to process the block. A sequence of blocks (of symbols) is now accepted by
the system if the processing of the sequence may cause the system to reach a final
state. Let us consider an example. Consider the system presented in Figure 2.22.
Let the input be the following sequence of block of symbols:

a b aaaa b bab.

Here the first block is WI = a, the second one is W2 = b, the third, forth and fifth
ones are W3 = aaaaa, W4 = band Ws = bab respectively. Note that each of these
blocks belongs to the language described by the regular expressions that label the
appropriate edges. Hence the sequence abaaaabbab transforms the initial state
to the final state. All these informal discussions lead us to formalize the notion of
generalized finite automata and give the following definition.

Definition 2.6.1 A nondeterministic generalized finite automaton (NGFA) over


alphabet b is a quadruple A = (S, /, T, F), where

1. S is a finite non empty set called the set of states.

2. / is a nonempty subset of S called the set of initial states.

3. T is a function that assigns (labels) to each pair (s, s') of states a regular
expression denoted by T (s, s').

4. F is a subset of S called the set of final states.

We say that a GNFAA accepts a string W E b*iffor some WI, ... , Wn E b*


we have the following properties:
88 2. Finite Automata

1. W = WI •.• W n .

2. There exists a sequence SI, S2, ... Sn+1 of states of A such that
(a) SI is an initial state,
(b) Sn+1 is a final state, and
(c) For every i, 0 :s i :s n, the word Wi belongs to L(r), where the edge
between Si-I and Si is labeled with r, that is T(s, s') = r.
The language recognized by the NGFA A is the set of all strings accepted by
A. We use the same notation:
L(A) = {w E ~* I A accepts w}.
Now we go back to our first example Al of a generalized finite automaton.
Let us take a portion of the transition graph of Al presented in Figure 2.20. This
portion of Al contains three states and is presented in Figure 2.23.

Figure 2.23: A portion of AI.

Now note that the following can be checked easily. If a string W transforms
the state sO to s2, then the string w belongs either to the language L(a) or to the
language L«a + b) . b* . a . a*). This very simple fact suggests an important idea.
We can take out the state sl in the transition graph above and we can repair the
damage by simply introducing an edge from sO to s2 and labeling the edge with
an appropriate regular expression (in our example however, we did not need to
invent a new edge: the edge already existed). Thus, we have the following diagram
presented in Figure 2.24.

(a+b)b*aa* + a

Figure 2.24
2.6. Generalized Finite Automata 89

Therefore, we now can replace our automaton Al with a new automaton A2


which is obtained by removing the state sl and relabeling edges appropriately. In
Figure 2.25 we have the transition diagram of the GNFA A2.

Figure 2.25: Automaton A2.

Exercise 2.6.1 Prove that the equality L(Aj) = L(A2) holds for the automata
Al and A2 discussed above.
Now consider the automaton A2. Take the portion of the automaton that
contains states sO and s2 presented in Figure 2.26.

(a+b)b*aa* + a

Figure 2.26: A portion of A2.

The system presented in Figure 2.26 can be replaced with one state GNFA
pictured in Figure 2.27.

Figure 2.27

Hence we can replace the automaton A2 with the automaton A3 whose tran-
sition graph is given in Figure 2.28.
Now note that the automaton A3 accepts the same language accepted by
the original automaton AI. The analysis of these examples suggests the idea that
we can reduce the number of states of any GNFA without changing the accepted
language. In fact, our goal now is to show that it is possible to reduce the number
of states to two. In order to achieve this goal, we need the following definition.
Definition 2.6.2 A GNFA A is reduced if the following properties hold:
90 2. Finite Automata

Figure 2.28: Automaton A3.

1. A has exactly one start state so.


2. There exists exactly one accepting state f not equal to the start state.
3. For any state s there is no transition either from s to So or from f to s.
4. For each pair s, s' of states not in {so, f} there exist edges from s to s' and
from s' to s.
Note that from the definition above we see that for each s rf. {so, f}, there is
a transition from s to s.
The lemma below shows that we can restrict ourselves to consider reduced
GNFAonly.
Lemma 2.6.1 For any GNFA A there exists a reduced GNFA B such that the
automata A and B accept the same language.
Proof. We give an idea of the proof and leave the details of the formal proof
to the reader. Let A be a given GNFA. We add a new start state with the transitions
to all original start states. We label all such transitions with the regular expression
O. We add a new final state with the transitions from all final states to f. We label all
such transitions with the regular expression 0 as well. This satisfies conditions (1),
(2), and (3) needed for a GNFA to be reduced. If a transition has several labels,
say the labels are rj, ... , rk, then we label the transition with a single regular
expression which is the sum rj + ... + rk. Finally, for all s, s' rf. {so, f}, if there
is no edge from s to s', then we simply add an edge from s to s' and label the edge
with e. Note that since L(e) = 0, such a transition does not change the language
accepted. This proves the lemma.
Example 2.6.3 Consider the automaton A3 constructed in Figure 2.28. A reduced
GNFA equivalent to A3 is pictured in Figure 2.29.
Exercise 2.6.2 Give a formal proof of Lemma 2.6.1.
Now we prove the following theorem.
2.6. Generalized Finite Automata 91

Figure 2.29: A reduced automaton equivalent to A3.

Theorem 2.6.1 For every GNFA A there exists a reduced GNFA B with exactly
two states such that L(A) = L(B).

Proof. To prove the theorem, we use the idea presented in the examples above
where we transformed the automaton Al to A3 so that Al and A3 accept the same
language. Here is an informal description of the proof of the theorem. Take A. We
can assume that A is reduced by the lemma above. Select a state s in A which
is neither initial state nor final state. Take the state out from the automaton. Then
repair the "damage" done by relabeling and adding some edges to the original
automaton A. These new labels rebuild any computation lost when the state s is
removed. The new automaton has now fewer states than the original automaton
and accepts the same language. Continue this procedure until two states, the initial
state and the final state, are left. The automaton thus constructed will have two
states and will then be the desired one.
Now we give a formal construction of the desired automaton. Assume that
A has exactly n states. Now proceed as follows:
1. If n = 2, then A is the desired one.
2. Suppose that n > 2. Take a state s distinct from the initial state as well as
the final state. Construct the GNFAAI = (SI, II, TI, FI) according to the
following rules:

(a) SI = S \ {s}.
(b) II = J, FI = F.
(c) For all Sl, S2 E S that are distinct from s such that T (Sl , s) = rl,
T(s, s) = r2, T(s, S2) = r3, T(sl, S2) = '4, label the edge from Sl
to S2 with the regular expression rl . r2 /3 + r4. In other words, set
TI (Sl, S2) = rl . rir3 + r4·
92 2. Finite Automata

Now the reader can check that the automaton Al is reduced and accepts the
same language accepted by A.
In order to complete the proof of the theorem, we continue the procedure
above until the two states, the initial and final states, are left. The two state au-
tomaton B thus obtained is then the desired one. The theorem is proved.

Exercise 2.6.3 Prove the theorem above in greater detail.

Exercise 2.6.4 For each of the GNFA below, construct a reduced equivalent au-
tomaton with two states:

1.

2. a

3.

4.

As a corollary, we can now derive the following theorem.

Theorem 2.6.2 A language L C b* is FA recognizable if and only if L is recog-


nized by a generalized finite automaton.

Proof. Suppose that A is recognized by a finite automaton. Then by the


Kleene theorem L(A) = L(r) for some regular expression. Consider the gen-
eralized automaton B = ({so, f}, {so}, T, (f}), where T(so, f) = r. Clearly,
L(B) = L.
Now assume that L(B) = L for some GNFA B. Then by the theorem above,
we can assume that B = (S, I, T, F) is reduced and has exactly two states So
2.7. The Pumping Lemma and Decidability 93

and f. Let rbe T(so, f). Then L = L(E) = L(r). Hence L is FA recognizable by
the Kleene theorem. The theorem is proved. 0
In the proof of this theorem, we used the Kleene theorem. In fact, Theo-
rem 2.6.1 can be used to show that every FA recognizable language is regular.
Indeed, here is the corollary.

Corollary 2.6.1 Any FA recognizable language L is regular.

Proof. Let A be a finite automaton that accepts L. By Theorem 2.6.1 there


exists a reduced two state GNFA E = (S, I, T, F) such that L(E) = L. Let So be
the initial state and f be the final state of E. Let r = T(so, f). Then L = L(r).
The corollary is proved.

2.7 The Pumping Lemma and Decidability


One of the fundamental properties of finite automata is that one can construct
algorithms for giving decision procedures to the most fundamental and natural
problems that can be asked about finite automata. In this section we present sev-
eral such problems and then describe the basic constructions which give decision
methods for solving these problems.

2.7.1 Basic Problems. Here is a list of quite natural problems that can be asked
about finite automata. A positive aspect of finite automata theory is that one can
construct algorithms for deciding these problems. This feature, that is, the decid-
ability of many problems that can be asked about finite automata, is what makes
finite automata quite attractive for potential applications in theory and practice.
This also makes automata quite different from other models of computation.
1. (Emptiness Problem) Does there exist an algorithm which, given any finite
automaton A, decides whether some u E b* is accepted by A?

2. (Equality Problem) Does there exist an algorithm which, given finite au-
tomata A and E, decides whether these automata accept the same language?

3. (Infinity Problem) Does there exist an algorithm which, given any finite au-
tomaton A, decides whether the automaton accepts infinitely many strings?
4. (Universality Problem) Does there exist an algorithm which, given any
finite automaton A, decides whether the automaton A accepts b*?
This section gives positive answers to all these questions.

2.7.2 The Pumping Lemma. One of the basic tools used in answering all the
above questions asked about finite automata is the Pumping Lemma, whose proof
is quite simple. The essence of the lemma is that any sufficiently long computation
of a finite automaton must have repeated states during the computation. The reason
94 2. Finite Automata

for this is that the automaton has a fixed finite memory, that is a finite number
of states; Hence while making long computations, the automaton will exhaust
its memory capacity. Therefore, some segments of the computation between any
two repeated states can be performed any number of times without effecting the
outcome of the computation.

Lemma 2.7.1 (The Pumping Lemma) Let A = (S, I, T, F) be afinite automa-


ton with exactly n states. For a string

0/ length greater than or equal to n, if Aaccepts u then there exists a non empty
substring v = ai ... ai+k a/the string u such that/or all t :::: 0, the automaton A
accepts the string

Proof. Suppose that the length of the input u accepted by the automaton A
is greater that or equal to n. Hence there exists a computation

of the automaton on the input u = a! ... am such that Sm+! E F. The key point
here is that at least two states in the sequence

must be the same since n is the number of states and m + 1 > n. Hence there exist
i and i + k both less than or equal to m + 1 such that Si = Si+k and k =1= O. Let s
be the sequence
Si+! ... Si+k

of states. It follows that for any integer t :::: 0 the sequence


-t
S! ... Si-!SiS Si+k+! ... Sm+!

is a computation of the automaton A on the input

where v is ai " . ai+k. This proves the lemma.


The Pumping Lemma and its proof can be applied to obtain some interesting
results. In the next section we provide examples of such applications in decision
problems about finite automata. Another type of application of this lemma is to
prove that certain languages are not FA recognizable. A typical example of this
type is an elegant proof that the language
2.7. The Pumping Lemma and Decidability 95

over the alphabet {a, b} is not FA recognizable. Let us prove this fact. Assume to
the contrary that this language L is FA recognizable. Then, of course, there exists
a finite automaton A that recognizes L. The number of states of this automaton is
finite. Let k be this number. Consider the string u = a k bk • This string satisfies the
hypothesis of The Pumping Lemma. Therefore, we can split u into three pieces
u = VI VV2 such that Iv I 2: 1 and for all t 2: 0 the string VI VI V2 is in L. Now there
are three cases to be considered.
Case 1. The string v contains as only. Then, of course, the string VI VVV2 has
more as than bs in it. By the definition of L, the string VI VVV2 is not in L. But by
The Pumping Lemma VI VVV2 is in L. This is a contradiction.
Case 2. The string V contains bs only. As in Case 1, this is again a contradic-
tion.
Case 3. The string V contains both some as and some bs. Well, then the string
VI VVV2 must have some bs before as. Then such a string is not in L by the definition
of L. But by The Pumping Lemma the string VI VVV2 is in L. Again, we have a
contradiction.
All these cases show that A cannot recognize L. Hence L is not FA recog-
nizable.
Exercise 2.7.1
1. Show that the language {anbnc n In E w} is not FA recognizable.

2. Show that the language {ww Iw E {a, b}*} is not FA recognizable.

3. Show that the language {w I w has an equal number of as and bs } is not


FA recognizable.

2.7.3 Decidability. The next theorem can be easily obtained from the proof of
The Pumping Lemma.
Theorem 2.7.1 Let A be an automaton with exactly n states. If A accepts a string,
then there exists a string V of length less than n accepted by A.

Proof. Let u be a string of the shortest possible length accepted by A. If


lui < n then we have nothing to prove. If lui 2: n then by The Pumping Lemma
there exist VI, v, V2 such that u = VI VV2, VI V2 E L(A) and Ivi > O. However,
IVI v21 < lui· This is a contradiction by the choice of u. The theorem is proved.

Theorem 2.7.2 The emptiness problem for finite automata is decidable.


Proof. An algorithm to decide the emptiness problem can be described as
follows. Take an automaton A. Let n be the number of states of the automaton.
List all strings u E h* such that the length of u is less than n. This list is finite.
By the theorem above, the automaton accepts a string if and only if the automaton
accepts one of the strings in the list. This proves the decidability of the emptiness
problem.
96 2. Finite Automata

Theorem 2.7.3 The equality problem for finite automata is decidable.

Proof. An algorithm to decide whether L(A) = L(B) for any given automata
A and B can be described as follows. Construct automata accepting the following
two languages:
L(A) \ L(B) and L(B) \ L(A).

Let Al and BI be automata recognizing these two languages, respectively. We note


that Al and BI can be constructed effectively from the automata A and B. Then,
L(A) = L(B) if and only if neither Al nor BI accepts a string. By the above
theorem, the emptiness of L(Ad and L(BI) can be effectively checked. Hence
this proves the decidability of the equality problem.

Theorem 2.7.4 The universality problem is decidable.

Proof. An algorithm to decide whether L(A) = :E* can be described as


follows. For any given automaton A, construct the automaton B which accepts
:E* \ L(A). Then L(A) = :E* if and only if L(B) = 0. This proves the decidability
of the universality problem.
We note that the algorithms provided in the proofs of the three theorems
above are not efficient. In fact there are more efficient algorithms that decide the
emptiness, equality and universality problems. The questions about efficiency of
algorithms are not discussed in this book. An interested reader can consult modern
handbooks on theoretical computer science on this and related issues.
In order to prove the decidability of the infinity problem we need a more
careful analysis of computations on automata. This analysis is similar to the proof
of The Pumping Lemma. We need the following lemma.

Lemma 2.7.2 Let A be an automaton with exactly n states. The automaton A


accepts an infinite language if and only if A accepts a string u for which n <
lui < 2n.
Proof. If A accepts a string u such that n ::; lui < 2n, then by the Pumping
Lemma L(A) is infinite. Suppose that L(A) is infinite. Then L(A) accepts words
of length greater than 2n. Take the shortest possible string u accepted by A and
lui ~ n. Ifn ::; lui < 2n, then there is nothing to prove. Assume that lui ~ 2n. We
can write u as VI V2 with IvII = n. Hence Iv21 ~ n. Using the method we used in
the proof of The Pumping Lemma, we can show that there is a word w such that
VI w is accepted by A and Iwl < n (see the exercise below). This contradicts the
choice of u. 0

Exercise 2.7.2 Give a detailed proof of the lemma above.

Theorem 2.7.5 The infinity problem is decidable.


2.8. Relations and Finite Automata 97

Proof. Let A be an automaton. In order to check whether L(A) is infinite, we


first need to list all strings v such that n :s Ivl < 2n. Among these strings we just
need to look for a string u accepted by A. By the previous lemma, if such a string
exists, then L(A) is infinite; if not then L(A) is finite. The theorem is proved.

2.8 Relations and Finite Automata


So far we have investigated finite automaton recognizable languages. These are
subsets of E*. However, one can ask the following natural question:

What does it mean to say that a set ofpairs of words, or a set of triples
of words, is recognized by a finite automaton?

This section is devoted to giving one possible answer to this question. We briefly
develop a theory of finite automata recognizing sets of pairs of words, or more
generally sets of n-tuples of words. We start with a definition.

Definition 2.8.1 A k-variable language over E is any subset of (E*)k.

Example 2.8.1 Let E be {a, b}.

1. The language {(a, w) IW E {a, b}*} is a 2-variable language.

2. The language {CUI, U2, U3) I U), U3 E E*, U2 E {a}*} is a 3-variable lan-
guage.

3. {(aa, ba), (aaaa, ab), (ba, A)} is a 2-variable language.

Thus, a k-variable language is simply a set of k-tuples of words from E*. In


particular a I-variable language is a subset of E* and hence is a language in the
sense considered in the previous sections.
Here is our convention. Suppose that the symbol <> does not belong to E.
Take k words from E*:

where i = 0, ... , k - 1.

Definition 2.8.2 The convolution

ao*···*ak-!

of the words ao, ... , ak-) is defined in the following way. If for all i, j < k
mi = m j, then the convolution is
98 2. Finite Automata

Otherwise, let m be the maximal length of the words ao, ... ,ak-I. Add to the right
end of each ai the necessary number of symbols ~ to get words of length m. Call
these new words a;, i = 0, ... , k - 1. Then the convolution of these k-tuples is
a~ * ... * a~_I.
Thus, for example if ao = ba and al = abba then ao * al is

(!) (:) (~) (~).


So we see that the convolution of the words

(Xi = 0';,0 ... , O'i,m;,

where i = 0, 1, ... , k - 1, can be considered as a word over the new alphabet

Therefore, for any k-variable language Rover 1;* we can consider the subset
c(R) s:; (1; U{<>n k obtained from R using convolution, that is,

c(R) = {ao * ... * ak-I I (ao, ... , ak-I) E R}.

Example 2.8.2 The convolution c(L) of the 2-variable language

L = {(w,a) I W E {a,b}*}

is the language

{(<>, a), (a, a), (b, a), (w, a<>lwl-l) I WE 1;*, Iwi > I}.

Exercise 2.8.1 Let 1; = {a, b}. Apply the convolution operation to the following
languages:
1. {(a n ,b2n )lnEw}.

2. {(UI, U2, U3) lUI, U3 E 1;*, U2 E {a}*}.


3. {(aa, ba), (aaaa, ab), (ba, A)}.
Now we are ready to give the basic definition of this section.

Definition 2.8.3

1. A k-variable finite automaton on 1; is afinite automaton over the alphabet


(1; U{<>})k.
2. A k-variable language R in 1;* is finite automaton (FA) recognizable ifits
convolution c(R) is recognizable by a k-variablefinite automaton.
2.8. Relations and Finite Automata 99

We give two examples.


Example 2.8.3 The 2-variable language
{(1m, Im+l) 1m 2: I}

is FA recognizable.
An automaton which recognizes this binary relation over alphabet {I} is the
following. The automaton has two states So and f with So being the initial state
and f being the final state. There is a transition from So to So labeled with (1),
and there is a transition from So into f labeled with (?). Clearly, this automaton
accepts the convolution of the given language.
Example 2.8.4 The 2-variable language

{«a)m, b m+t ) 1m, t 2: I}

is FA recognizable.

An automaton which recognizes this binary relation over alphabet {a, b} is


the following. The automaton has two states So and f with So being the initial
state and f being the final state. There is a transition from So to So labeled with
(b)' and there is a transition from So into f labeled with (Z). Finally there is a
third transition from f into f labeled with (Z). Clearly, this automaton accepts the
convolution of the given language.
We would like to explain several operations defined on the class of k-variable
FA recognizable languages. Thus, assume that LI and L2 are k-variable lan-
guages. The three well-known set-theoretic operations are defined in a natural
n
way: LI U L2 is the union operation, LI L2 is the intersection operation, and
finally LI is the complement of LI, that is LI = (~*)k \ LI. It turns out that
the projection operation applied to FA recognizable relations also produces FA
recognizable relations. I
Here is a formal definition of the projection operation. Let L be k-variable
language and i be any number between 1 and k. Then we define two (k - 1)-
variable languages as follows. The first language, denoted by =h (L), consists of all
(WI, ... , Wi-I, Wi+I,···, Wk) such that (WI, ... , Wi-I, Wi, Wi+I, ... , Wk) E L
for some Wi E ~*. Similarly, the second language, denoted by Vi (L), consists of all
(WI, ... , Wi-I, Wi+I,"" Wk) such that (WI,···, Wi-I, Wi, Wi+I, ... , Wk) E L
for all words Wi E ~*. So for example, if L is a 2-variable language over~, then
=h(L) consists of all W from ~* such that (w, u) E L for some u E ~*. Similarly,
V2(L) consists of all W E ~* such that (w, u) E L for all u E ~*.

1This allows one to consider a predicate calculus on finite automata and develop, for example, the
theory of automatic groups, or more generally, automatic structures. However, these interesting topics
are beyond the scope of this book. The interested reader is invited to look at the reference list.
100 2. Finite Automata

Example 2.8.5 Consider the 2-variable language L = {(a, w) I W E {a, b}*}


over the alphabet {a, b}. Then 31 (L) = 1:*, V2(L) = {a}, 32(L) = {a} and
VI(L) = 0.
We will make the following convention. If k = 1, then we set 31 (L) = true
if L =1= 0, VI (L) = true if L = 1:*, 31 (L) = false if L = 0, and finally
VI (L) = false if L =1= 1:*.
Now we are ready to formulate a theorem about FA recognizable k-variable
languages. The theorem allows one to introduce the calculus of finite automata
recognizable relations.
Theorem 2.8.1 Let L I and L2 be FA recognizable k-variable languages. Then the
following facts are true:
1. The languages LI U L2, LI n L2, Lj are FA recognizable.
2. The languages 3i(LI) andVi(LI) are FA recognizable.
3. The language
{(WI,.·., Wk, w) I WE 1:*, (WI,··., Wk) E Ld
is FA recognizable.
4. Let Jr : {I, ... , k} ~ {I, ... , k} be a permutation. Then the language

Llrr) = {(WI, ... , Wk) I (w rr (1),' .. ' Wrr(k) E Ld


is FA recognizable.
Proof. Part (1) follows from the fact that FA recognizable languages are
closed under the operations of union, intersection, and complementation. Part (2)
follows from the fact that a projection of an FA recognizable language is also FA
recognizable. The proofs of parts (3) and (4) are left as exercises for the reader. D
Exercise 2.8.2 Give a detailed proof of Theorem 2.8.1.
Exercise 2.8.3 Let 1: = {a, b}. Show that the following two variable languages
are finite automaton recognizable.
1. {(u, v) Ilul :s Ivl}.
2. {( u, v) I the number of as in u and the number of bs in v are even}.
3. {(u, v) I the symbol a occurs earlier in u than in v}.
Exercise 2.8.4 Let 1: = {O, 1, ... , 9}. For each natural number nEw set n(r) to
be the reverse representation of n over 1:. So for example, 120300(r) is 003021.
Show that the relation
P = {(n(r),m(r),k(r) I n+m =k}
is an FA recognizable 3-variable language.
2.9. Finite Automata with Equations 101

2.9 Finite Automata with Equations


In this section we introduce and investigate new classes of finite automata rec-
ognizable languages. Informally each class consists of all languages accepted by
finite automata whose transitions satisfy a given set of certain algebraic equations.
We will show that these classes of languages are closed under the operations of
union, intersection and complementation.
A motivation for introducing algebraic equations comes from a purely com-
putational point of view. Consider a set of tasks {a 1 , a2, ... , an} to be executed on
a computer. During a run the computer produces a sequence of states by executing
the instructions for each task. Usually each run follows some set of rules specified
by the system software or constraints inherited from the system hardware. In a typ-
ical parallel environment the run may be allowed to follow different sequences of
states to complete the set of tasks. The system may utilize the algebraic constraints
of the type ai a j = a j ai for some i and j. This allows execution of tasks ai and a j
in any order (i.e., parallel execution).
We now give a brief outline of this section. In the next subsection we intro-
duce finite automata with equational constraints, called E -automata, and provide
two simple examples. We next study the properties of the languages accepted by
E-automata, called E-languages, and show some closure properties of these lan-
guages.

2.9.1 Preliminaries. We fix a finite alphabet b and consider b *. An algebraic


equation is a pair of finite strings of b *. Thus, for example (aabba, bbaa) is an
equation of the alphabet {a, b}. We will use E to denote a fixed set of equations.
Note that the set E may be infinite.
Definition 2.9.1 An E-automaton is afinite automaton (S, I, T, F) such thatfor
all states s, s' E S and all equations (u, v) in E the string u transforms s to s' if
and only if the string v transforms s to s'.
Note that any automaton satisfying some set E of equational constraints is
considered an E-automaton. We now give two examples of E-automata.
Example 2.9.1 Let E = {(aWj, ajai) I i =1= j and ai, aj E b}. We call automata
satisfying the equations commutative. An example of a commutative automaton
over b = {a, b} is given in Figure 2.30.
Languages accepted by commutative automata are called commutative lan-
guages. We give another example of E-automata.
Example 2.9.2 Let E = {(a, bb)}. An example of a deterministic E-automaton
over b = {a, b} is given in Figure 2.31.
Thus, for set E of equations we naturally arrive the following definition.
Definition 2.9.2 An FA recognizable language L is an E-Ianguage if L is the set
of all strings in b * that are accepted by some E -automaton.
102 2. Finite Automata

Figure 2.30: A commutative automaton.

Figure 2.31

We now want to characterize the commutative languages. Consider commu-


tative automata. For a string W over ~ = {ai, a2, ... ,an} let the signature of W
be the n-tuple Cdl, d2, ... ,dn ) where di is the number of ai occurring in w. Two
strings are called signature equivalent if they have the same signature. It is easy to
check that the relation to be signature equivalent is indeed an equivalence relation
on the set of all strings over ~. A signature-closed language is a language L such
that W E L implies w' E L for all w' signature equivalent to w.

Theorem 2.9.1 Let L be an FA recognizable language. Then L is a signature-


closed language if and only if it is recognized by a commutative automaton.

Proof. First assume L is a signature-closed language. Consider a determinis-


tic automaton A that accepts L. By using the proof of the Myhill-Nerode Theorem,
we can assume that the states of A are '" L equivalence classes, where WI '" L W2
if for all z E ~*, WI . Z E L if and only if W2 . z E L. We show that M is a
commutative automaton. It suffices to show that if two strings WI and W2 have
the same signature, then WI "'L W2. Suppose WI 'fL W2. Then there exists a z
such that, without loss of generality, WI . Z ELand W2 . z ¢. L. If WI and W2 are
2.9. Finite Automata with Equations 103

signature equivalent, then also WI . Z and W2 . Z are signature equivalent. Since L


is signature-closed WI . Z E L implies W2 . Z E L. This is a contradiction. Thus we
can conclude that A is a commutative automaton.
Now assumeL is accepted by acommutativeautomatonA. Ifw = ala2 ... an
is accepted by M, then so is Wi obtained by any permutation ai, a j of symbols
occurring in w. Note that wand Wi have the same signature. Thus, L is a signature-
closed language. Thus, the theorem is proved.

Regarding our second example above, we give the reader to prove the fol-
lowing exercise.

Exercise 2.9.1 Consider E = {(a, bb)}. Say that two strings WI and W2 are
(a, bb)-equivaJent ifw2 can be obtainedfrom WI by afinite sequence of substring
replacements a with bb or bb with a. A language L is said to be (a, bb)-c1osed
if w E L implies Wi E L for each Wi that is (a, bb)-equivalent to w. Prove the
following. Let L be an FA recognizable language. Then L is (a, bb )-closed if and
only ifit is recognized by an E-automaton, where {(a, bb)} ~ E.

2.9.2 Properties of E-Languages. In this subsection we study set-theoretic


properties of E-languages. Let the alphabet b and the set of equations E be fixed
throughout this section. We first show that E-languages are closed under union
and intersection.

Lemma 2.9.1 If LI and L2 are E-languages then so are LI U L2 and LI n L2.


Proof. The proof follows the standard constructions for finite automata (see
for example Theorem 2.3.2 and Theorem 2.3.1). Let Al = (SI, II, TI, FI) and
A2 = (S2, h T2, F2) be E-automata accepting the languages LI and L2, re-
spectively. Assume that SI and S2 have no states in common. The automaton
(SI U S2, II U h TI U T2, FI U F2) accepts the union LI U L2. One also observes
that this is an E -automaton.
We now construct an E-automaton that accepts LI n L2. Consider the au-
tomaton A = (SI x S2, II x h T, FI x F2) where

Note that this automaton accepts the intersection of the two languages. To show that
this automata is an E-automaton take (u, v) E E and (Sl, S2), (s;, s~) E SI x S2.
Then for the automaton A, the following holds. The string u transforms (Sl' S2)
into (s; , s~) if and only if u transforms Sl into s; (in the transition of the automaton
AI) and v transforms S2 into s~ (in the transition of the automaton A2). Therefore,
since Al and A2 are E-automata, we conclude that the string v transforms (Sl, S2)
into (s;, s~). This shows that the constructed automaton is an E-automaton. The
lemma is proved.
104 2. Finite Automata

To show that E-languages are closed under complementation we need a


method to convert E -automata to deterministic E -automata. Again, we will show
that the standard subset construction preserves equations from E.
Recall that the determinization of an automaton A = (S, I, T, F) is an
automaton Ad = (Sd, I d , Td, F d ), where

Sd = {X IX ~ S},
Id = {l},
Td(X, a) = U T(x, a) for X E S(d) and a E ~,
XEX

Fd = {X I X E S(d) and IX n FI ~ I}.

We already know that A and Ad accept the same language.

Lemma 2.9.2 If A is an E-automaton, then so is Ad.

Proof. It suffices to check that A (d) satisfies all the equations from E. In-
deed, take (u, v) E E and X E Sd. Then for all states SEX and all s' E S, in the
transition table of the automaton A, the string u transforms s to s' if and only if v
transforms s into s'. From the definition of Td we conclude that in the transition
table of the automaton Ad, for all X, X' E Sd the string u transforms X into X' if
and only if v transforms X into X'. Hence Ad is an E-automaton. The lemma is
proved.
We can use the previous lemma to show that E-languages are closed under
complementation.

Lemma 2.9.3 If L is an E-language then so is the complement L = ~* \ L.

Proof. Since L is an E-language there exists an E-automaton A that accepts


L. By the previous lemma we can construct a deterministic E-automaton Ad =
(S, I, T, F) that also accepts L. Then the automaton (S, I, T, S \ F) is an E-
automaton and accepts L. The lemma is proved.
Thus all the above lemmas give us the following result.

Theorem 2.9.2 Let E be a set of equations of an alphabet ~. Then the class of


all languages accepted by E-automata is closed under the operations of union,
intersection and complementation. 0

We now mention that some standard closure properties of regular languages


do not hold for E -languages. Consider the concatenation of two languages L 1 . L2 =
{u . v I U E Ll and v E L2}. Take Ll = {ab, ba} and L2 = {a}, which are
both signature-closed languages. However, the concatenation language L 1 . L2 =
{aba, baa} is not a signature-closed language, and hence not commutative.
2.10. Monadic Second Order Logic of Strings 105

2.10 Monadic Second Order Logic of Strings


Computational properties of finite automata provide an excellent tool for applica-
tions. In this section we present a relatively simple application of finite automata
theory. The results we obtained in the previous sections will be applied to a decision
problem about monadic second order logic of strings. The ideas presented in this
section are very common in applications of automata theory to decision problems
in algebra, logic, and computer science. Therefore, we will try to explain these
ideas in detail. Similar, but more intricate, methods will be used later in the book.

2.10.1 Finite Chains. A convenient way to introduce the monadic second order
logic of strings is to begin by explaining structures called finite chains. These are
very simple mathematical structures that occur when we order a finite set of objects.
We begin with a definition of these structures.

Definition 2.10.1 A chain C is a pair (C, :::::) such that C is a finite set called the
domain of the chain and::::: is a linear ordering on C.

If C = (C,:::::) is a chain, then elements of the domain C are also called


elements of the chain. Note that since::::: is a linear ordering of C and the domain
is finite, the chain C has least and greatest elements.

Example 2.10.1 A typical example of a chain is the chain

Cn ={O,I, ... ,n},:::::),

where n is afixed natural number and number::::: is the linear ordering on natural
numbers. A picture of this chain is presented in Figure 2.32. In this figure, elements
are ordered from left to right.

Figure 2.32: A typical chain Cn.

The domains of chains are finite. Suppose that we are given two chains,
C = ({O, 1, 2}, :::::) and C' = ({a, b, c}, :::::'). Suppose that::::: is the natural ordering,
so we have 0 ::::: 1 ::::: 2, and :::::' orders the elements a, b, c so that a :::::' b :::::' c.
These two chains are "copies" of each other since we can map C on C' so that the
ordering is preserved. To do this we simply need to map 0 on a, 1 on band 2 on c.
Let us now generalize the above situation. Suppose that we have two chains,
say C = (C, :::::) and C' = (C', :::::'). We identify these two chains with each other if
one is a copy of the other. Formally, we have now arrived at the following important
concept.
106 2. Finite Automata

Definition 2.10.2 The chains e = (C, :::::) and e' = (C', :::::') are isomorphic if
there exists a one-to-one onto function h from C onto C', called an isomorphism,
such thatforall a, bE C, ifa ::::: b then h(a) :::::' h(b).
Exercise 2.10.1 Show that two finite chains are isomorphic if and only if their
domains have the same number of elements.
From the definitions we see that for any chain e there exists a natural number
nEw such that e is isomorphic to the chain

en = ({O, ... , n}, :::::),


presented in Example 2.10.1.

2.10.2 The Monadic Second Order Logic of Strings. Our goal can informally
be explained as follows. First, we want to express properties of chains (strings).
To express these properties we need to have a language. For us, the language will
be an important tool to talk about (express) properties of chains (strings). Second,
we want to have a procedure which for any given expression <I> of the language
tells us whether the property expressed by <I> holds for every chain (string).
In order to achieve our goal, we need to describe the language designed to
express properties of chains (strings). However, before we define our language, we
would like to understand what properties of chains we want to express. Well, we
want our language to be powerful enough to talk about
• the ordering of chains,
• minimal and maximal elements of chains,
• immediate successors of elements,
• elements that lie between two elements,
• positions of elements in the chain relative to some other elements, etc.
Having these in mind we now proceed to define the language called the second
order monadic logic of chains (strings). The symbols which we use in this logic
(language) are the following.
1. We use the symbols
x, y, z, ... ,
called individual variables, possibly with subscripts or superscripts. The
intended meaning of these variables is that they run over elements of chains.
2. We use the symbols
X,Y,Z, ... ,
called set variables, possibly with subscripts or superscripts. The intended
meaning of these variables is that they run over subsets of domains.
2.10. Monadic Second Order Logic of Strings 107

3. We use the symbol = to express equality; we use the symbol :s to express


the order relation in any chain C = (C, :s); we also use the symbol E to
express membership.
4. We use logical connectives & (and), V (or), ..., (not), --+ (if ... , then ... )
and quantifiers 3 (there exists), V (for all).
5. We also use nonlogical symbols (and), left and right parentheses.
Now, we would like to talk about properties of chains in terms of the symbols
just introduced. These properties are expressed by means of formulas. Formulas
formalize the notion of expression. We define, by induction, the formulas of our
language.
Basic Step. The expressions x EX, x :s y, x = y, X = Yare atomic
formulas, where x, yare individual variables and X and Yare set variables. 2
Inductive Step. Suppose that formulas <1>1 and <1>2 have been defined. Then
each of the following expressions are also formulas:
(<1>1&<1>2), (<1>1 V <l>2), (<1>1 --+ <1>2), (3x<l>[), (...,<1>1), (3X<I>I), (Vx<l>I), (VX<I>[),
where x is an individual variable and X is a set variable.
We explain how these formulas are read for the reader who is encountering
this type of language for the first time. The formula (<1>1 &<1>2) is read as "<I> 1 and
<1>2"; the formula (<1>1 V <1>2) is read as "<1>1 or <1>2"; the formula (<1>1 --+ <1>2) is
read as "if <I> 1 then <1>2"; the formula (3x <I> 1) is read as "there exists an element
x such that <1>1"; the formula ...,<1>1 is read as "not <1>1"; and finally the formula
(V X <I> 1) is read as "for all subsets X, <I> 1" .
In writing a formula, we usually follow our common sense without being
too formal. For example, instead of writing (((A&B)&C)&D) we simply write
A&B&C&D. The exercise below gives us information about the syntactic nature
of formulas.
Exercise 2.10.2 Using induction on constructing the formulas, prove that if
(<I>lr<l>2) is the same as (\IIlr\ll2), where r E {&, v, --+}, then <1>1 = \Ill and
<1>2 = \112.
Now let us give some examples in order to explain what properties of chains
we can express using this logic. We fix the chain Cn = ({O, ... , ... , n}, :s) given
in Example 2.10.1. We give several examples to explain the meaning of formulas
using the chain Cn.
Example 2.10.2 Consider the formula
3yVx(y :s x).
2 Readings of these formulas are natural. For example, the formulas x EX, x ~ yare read as "x
belongs to X" and "x is less than or equal to y," respectively.
108 2. Finite Automata

This formula says that there exists an element y which is less than or equal to
any other element x. In the chain Cn this formula is true because 0 is the element
which is less than or equal to any other element in Cn. We see that the logic is good
enough to express the existence of minimal elements. More generally, one can see
that since we consider finite chains only, the formula above is certainly satisfied in
any finite chain.
We write x < y to denote the formula x S y & x f= y.

Example 2.10.3 Consider the formula sex, y):

(x < y & -,3z(x < z & z < y» V(V'z(z s x) & x = y».


This formula says that either y is strictly greater than x and there is no element
z between x and y or no element is strictly greater than x and x = y. Informally, this
formula defines the "successor" function on chain Cn . It is not hard to understand
that in the chain Cn this formula is true on pairs (0, 1), (1,2), ... , (n -1, n), (n, n)
only. That is if we replace x by, say i, and y by i + 1, where i < n, then SCi, i + 1)
is satisfied in Cn. We note that instead of writing Sex, y) we can simply write
Sex) = y. Thus, S acts as the successor function as follows:
S(O) = 1, SCI) = 2, ... , Sen - 1) = n, Sen) = n.
Example 2.10.4 Consider the formula Sub(X):

3z(z E X) & V'xV'y(x E X & x s y ~ Y EX).

This formula states that X is not empty, and if x belongs to X and y is greater or
equal to x, then y must belong to X. In the chain Cn, the subsets {i, i + 1, ... , n}
satisfy the formula. In other words, if we replace X in the formula by the set
{i, ... , n}, then the Sub({i, ... , n}) is satisfied in Cn. From this example, we can
also conclude that the property "there exists a set X for which Sub(X) is true,"
expressed by the formula
3XSub(X),
is satisfied in all chains. The reader familiar with the basics of algebra or univer-
sal algebra can easily see that Sub(X) defines subalgebras of the algebra of the
successor function on finite chain Cn .
An important point about this logic is that it, in fact, talks about strings and
their properties. Indeed, any string w of length n can be associated with chain
Cn. Thus, elements of the chain can be identified with positions of the string w.
Therefore, the individual variables x, y, z, ... of the logic represent variables
running over positions of strings. The relation S in Cn represents the natural order
of positions on w. The set variables X, Y, Z, ... can be identified with variables
that run over sets of positions on strings. The least element of Cn represents the
first position in w, and the greatest element of Cn represents the last position in
2.10. Monadic Second Order Logic of Strings 109

w. The successor function S on the chain Cn represents the successive positions in


w. These are all reasons why the logic introduced is referred to as a logic of finite
strings.

2.10.3 Satisfiability. The examples considered above naturally lead us to define


the notion of satisfiability of a formula (or truth of a formula) in a given chain.
This notion is a fundamental notion of logic introduced by Tarski in a much more
general setting(see the last chapter). For our purpose, as we will see, this notion
connects the monadic second order logic we defined in the previous sections with
the class of mathematical structures we are interested in-finite chains. In other
words, the notion of satisfaction will be a bridge that connects syntax (formulas)
with semantics (chains or strings).
Thus, let C = (A, ::;) be a chain. Suppose that we assign to every individual
variable Xi an element bi E C and to every set variable Xj a set B j C C. In other
words, we have a fixed interpretation

of the variables in the chain C. Let <I> be a formula. By induction on the complexity
of <1>, we define the satisfaction of <I> in the chain C. We denote this by

without explicitly mentioning the interpretation intr, though of course, we keep


this interpretation in mind.
Basic Step. The chain C satisfies the atomic formula (Xi E X j) if in the chain
C we have bi E B j. The chain C satisfies the atomic formula (Xi ::; X j) if in the
chain C we have b i ::; b j. The chain C satisfies Xi = X j if bi = b j is true in C.
Similarly, the chain C satisfies Xi = X j if the set Bi equals B j.
Inductive Step. We consider separately each case corresponding to the in-
ductive step in the definition of formula.

1. C satisfies (<1>\ V <1>2) if the chain C satisfies either <1>\ or <1>2.


2. C satisfies (<1>\ &<1>2) if the chain C satisfies both <1>\ and <1>2.

3. C satisfies (<1>\ -+ <1>2) if the condition that C satisfies <1>\ implies that C
satisfies <1>2.

4. C satisfies (-,<1>\) if the chain C does not satisfy <1>\.

5. C satisfies (3Xi <1>\) if there exists abE C such that C satisfies the formula
<I> \ under the new interpretation intr', which is the same as intr except that
its value on Xi is b.
110 2. Finite Automata

6. C satisfies (3X i <I> I) if there exists B C C such that C satisfies the formula
<I> I under the new interpretation intr', which is the same as intr except that
its value on Xi is B.

7. C satisfies the formula (Vxi<l>[) «VXi<l>l)) if C satisfies -,(3Xi(-,<I>[))


(-'(3X i (-,<1> I)))·

For a formula <I> whose variables are among XI, ... , Xt and X I, ... , X p, we usually
write <I> (X I, ... , Xp, XI, ... , xd. We also write

if the chain satisfies this formula under the interpretation intr such that intr(xi) =
bi, intr(Xj) = Bj, where i = 1, ... , t, and j = I, ... , p.

Exercise 2.10.3 Consider the chain Cn = ({O, ... , n}, :s). Find interpretations
which make the formulas below satisfied in Cn:

1. 3yVx(y:s x).

2. VxVy(x E X & x :s y -+ y EX).

3. VxVy(x E X & x :s y -+ y EX).

4. Vx(x ~ X&x =F Sex) -+ Sex) EX).

To investigate the connections between automata and the monadic second


order logic we need the technical notion of free variable. Basically, a variable is
free in a formula <I> if the variable does not belong to the scope of a quantifier in
the formula. We formalize this explanation using induction on the complexity of a
formula.
Basic Step. For atomic formulas x EX, x :s y, x = y, and X = Y the sets
of free variables are {x, X}, {x, y}, {x, y}, and {X, Y}, respectively.
Inductive Step. Suppose that the sets of free variables FV (<I> I) and FV (<1>2)
for the formulas <I> I and <1>2 have been defined. Then

FV(<I>I r<l>2) = FV(<I>[) UFV(<I>2), FV(-,<I>I) = FV(<I>I),


FV(Qx<l>[) = FV(<I>[) \ {x}, FV(QX<I>I) = FV(<I>I) \ {X},

where r E {&, V, -+}, Q E {V, 3l. x is an individual variable, and X is a set


variable.

Exercise 2.10.4 Find all the free variables in the following formulas: 3X (x EX),
3XVY(X c Y -+ Z E y), VZ(S(x) E Z V Z = y), 3X3Y3z(S(z) = t & Set) E
y) V (X C Y)).
2.10. Monadic Second Order Logic of Strings III

Definition 2.10.3 Aformula is a sentence if it has no free variables of either sort.

Thus, by the definition of satisfiability, if we take any chain C and sentence <1>,
then <I> is either true or false in C. In other words, the truth value (satisfiability) of
<I> in chain C does not depend on interpretations of variables. Of course, <I> cannot
be true and false simultaneously in C.
Now we give an important definition of this section.

Definition 2.10.4 The monadic second order theory of strings is the set of all
sentences satisfied (true) in all chains. We denote this set of sentences by SFS.

Clearly, SFS is not the empty set. For example, for any sentence <1>, the
sentence <I> V -,<1> belongs to SFS. Nontrivial examples of sentences which belong
to SFS are 3X(Sub(X)) and 3yVx(x ::: y).

Example 2.10.5 Show that the sentences 3X(Sub(X)) and 3yVx(x ::: y) belong
to SFS.

2.10.4 Discussion and Plan About SFS. Thus, we have just defined the set SFS
of all sentences true in all finite chains. Informally, this set represents all the facts
expressed in the language of the monadic second order logic that are true in the
world of finite chains. In other words, SFS is our ideal knowledge about this class of
mathematical structures (expressed in the monadic second order logic). We would
like to have access to this ideal knowledge. Say, we are interested in statement <I>
about finite chains, where <I> is expressed in the language of the monadic second
order logic. Is it not natural to ask if <I> is in SFS? One way to check whether <I>
is true in all finite chains is simply to comprehend the statement <I> and then try to
prove or disprove that <I> is true in all finite chains. In some sense, an ideal situation
would be if we were able to provide an algorithm which checks whether or not <I>
is true in all finite chains. Then the algorithm would do the job for us: any time
we are interested in whether or not <I> is true in all finite chains, we would simply
refer to the algorithm to verify if <I> is in SFS or not. In other words, the algorithm
would provide us with access to the ideal knowledge about all finite chains. The
next sections will be devoted to showing that such an algorithm indeed exists. In
proving this we will use methods and results about finite automata discussed in the
previous sections.
Here now is an outline of how we will achieve our goal of showing that there
exists an algorithm that decides the set SFS.

• First, we show that we can reason about computations of any given finite
automaton in the language of monadic second order logic. In order to do
this, we provide an algorithm which transforms any given finite automaton
into a formula so that there is a natural relationship between computations
of the automaton and satisfiability of the formula.
112 2. Finite Automata

• Second, we show that we can reason about any given formula of the monadic
second order logic in terms of a finite automaton. In order to do this, we pro-
vide an algorithm which transforms any given formula into a finite automaton
so that there is a close relationship between satisfiability of the formula and
computations of the automaton .

• Finally, the above two steps will enable us to show that the problem of
deciding the set SFS can be reduced to the universality problem about finite
automata. We already know that the universality problem for finite automata
is decidable. Hence we will be able to decide SFS.

2.10.5 From Automata to Formulas. Our purpose now is to show that we can
transform any finite automaton to a formula so that there is a close relationship
between computations of the automaton and satisfiability of the formula.
Let A = (S, I, T, F) be a finite automaton over the alphabet b. We can find
an m ~ 2 such that the number of elements in b does not exceed the number of
elements of the set {O, l}m. Thus we can rename the elements of b by elements
of {O, l}m. Therefore, we can think of b as subset of {O, l}m. Moreover, note
that any FA recognizable language over b is also FA recognizable over {O, l}m.
Therefore, without loss of generality, we can assume that b = {O, l}m for some
natural number m.
Let C = ({co, ... , cd,::s) be a chain with Co < CI < ... < Ct. Let
BI, ... , Bm-k be subsets and bm-k+ I, ... , b m be elements of the domain C. Note
that the length of the sequence

BI, ... , Bm-k. bm-k+l, ... , bm

is m, that is, the number m for which b = {O, l}m. Any element Ci E C, i =
0, ... , t defines a symbol ai of the alphabet b as follows. The symbol ai is

C}
whereforeachj,Ej = 1 if and only ifci E Bj orc= bj. Thus, Ej =Oifandonly
if neither Ci E Bj nor Ci = bj. Therefore, any chain C = (C,::s) and sequence

BI, ... , Bm-k. bm-k+l, ... , bk

naturally define a string


aOal ... at

over the alphabet b. We denote this sequence by

word(C, BI, ... , Bm-k. bm-k+I, ... , b m ).


2.10. Monadic Second Order Logic of Strings 113

Note that the length of this string is t + 1, which is also the length of C. We give
an example. Suppose that the chain C is
({O, 1,2,3,4,5,6, 7}, :s).
Let BI = {I, 4, 7}, B2 = {a, 4}, b3 = 1 and b4 = 6. Then the string word(C, BI,
B2, b3, b4) is

The length of the string is 8. Another way of looking at this is that the i th row of the
string word(C, BI, ... , Bm-b bm-k+l, ... , bk) gives the characteristic function
of the set Bi or {bi}.
The following theorem shows that the notion of recognizability (or more
precisely, the notion of successful computation) for finite automata is expressible
in the monadic second order formalism.
Theorem 2.10.1 Let A = (S, /, T, F) be a finite automaton over b = {a, l}m.
There exists a formula <1> (X I, ... , Xm) such that for all chains C and subsets
BI, ... , Bm C C the following property holds:
A recognizes word(C, BI, ... , Bm) ifand only ifC F <1>(BI, ... , Bm).
Proof. Note that the number m of free variables in the desired formula
<1>(XI, ... , Xm) will be such that b = {a, l}m. This formula <1> (XI , ... , Xm)
will contain four subformulas. The first subformula will code each symbol of the
alphabet. The second subformula will involve set variables whose aim will be to
code the states of the automaton A. The third subformula will code the transition
table T of the automaton. Finally, the fourth subformula will code the set F of
final states. Then we will combine all these formulas into one formula and show
that the formula thus obtained is the desired formula.
We can assume that the initial state / consists of one state only. Since S is a
finite set we can also suppose that
S={O,I, ... ,p}

°
with being the initial state. Moreover, we will assume that for all s E Sand
a E b there exists an s' E S such that (s, a, s') E T. We begin our proof by
explaining some subformulas of the desired formula <1> (X I, ... , Xm).
Coding ofthe alphabet b = {a, l}m. Let a E b be of the form
114 2. Finite Automata

where each Ei E {O, I}. We define the formula <l>a (x, X), where X is X I, ... , X m,
as follows:
<l>a(X, Xl,"" Xm) = X EEl Xl& ... &x EEm X m ,

where EE is E if E = 1, and ¢ otherwise. Note that ...,(x E X) is written here as


x ¢ X. Informally, this formula codes the letter u. 3
We now note the following fact about this coding of 1;. Let C = (C, :s) be
a chain of length t + 1 and let Bl, ... , Bm be subsets of C. Then for every C E C
there must exist a u E 1; such that <l>a (c, B) holds. It follows that the formula

Vx (VaE~
<l>a(x, B»)
is satisfied in C. We also note that for each word w = Uo . .. Ut E 1;* there exists
a sequence B = Bl, ... , Bm of subsets of C such that word(C, Bl, ... , Bm) is
exactly w. Therefore, this coding induces a one-to-one correspondence between
1;* and the m-tuples of subsets of chains.

Coding of S. Let Yo, Yl, ... , Yp be set variables. The desired formula in-
volves these set variables. The intention is that each Yi represents the state i of the
automaton A. In the desired formula these set variables will be existentially quan-
tified and will talk about the existence of computations of the automaton A. We
write down the following formula and denote it by D(Y), where Y is Yo, ... , Yp:

&:~r""3z(z E Yi & Z E Yj)'


The intention is that we want to express the fact that the automaton A cannot be
in two distinct states simultaneously.
Coding of the first step of a computation. For each U E 1;, we define
another formula I¥a(x, X, Y) as follows:

Vy(x :s y) & <l>a(X, Xl, .. " Xm) ~ V (x E Yj).


(O,a,j)ET

Informally this formula expresses the fact that if U is the first input signal of an

°
input, then the next state of the automaton A is a j such that (0, u, j) E T. We
recall that represents the initial state of the automaton. We note the following
property of the formula. Suppose that we have Bl, ... , Bm C C. Consider the le~st
element, say Co, of C. As noted above, there exists a U E 1; such that <l>a(CO, B)
is satisfied in C. Take this u. Now we conclude that if the formula

3Thus, for example, when m = 2 then the letter (6) of the alphabet {G, 1}2 is coded as the formula
(x E Xl &x Ii X2).
2.10. Monadic Second Order Logic of Strings 115

is true in C, then there exists a j such that (0, a, j) E T and Co E Yj. In other
words, if Co and B\, ... , Bm code a, then we should put Co into a Yj such that
(O,a,j)ET.

Coding of transitions of A. We recall that we have the successor function


in any given chain C whose notation is S (see Example 2.10.3). This function
can be expressed in the monadic second order logic. We define another formula
<Pa,i (x, X, Y) and explain its meaning. The formula is

x E Yi & <Pa(S(x), X) & x =1= S(x) ~ V (S(x) E Yj).


(i,a,j)ET

Informally, this formula corresponds to the fact that if A is in state i, the next
input signal is a and A has not completed its computation, then the next state of
the automaton is a j such that (i, a, j) E T. The following remark concerns this
formula. Suppose that C is a chain, c E C, and B\, ... , Bm C C. Let a E b be
such that C satisfies <Pa (c, B, Y) (such a always exists, as we noted above). Then
if the formula
3Yo.·. 3Yp <Pa,i(C, B, Y)
is true, then there exists a j such that S(c) E Yj and (i, a, j) E T. Note that here
we think of c as the position in the input string which the automaton has just read.
Coding of F. Finally, the last formula we need is the formula F (x, Y) defined
as follows:
S(x) =x ~ Vx E Yj.
jEF

This formula is intended to say that if A has completed its computation, e.g., it is
at the end of the input string, then the last state of the computation is a final state.
Now we write down the desired formula cI>(X \, ... , Xm):

Our goal is to show that this formula satisfies the theorem. We need to
prove that for all chains C and subsets B\, ... , Bm C C the automaton A ac-
cepts word(C, B\, ... , Bm) if and only ifC satisfies cI>(B\, ... , Bm).
Take a chain C and subsets B\, ... , Bm of the domain of C. Suppose that C
has exactly t + 1 elements {c(O), ... , c(t)}. Consider the string

word(C, B\, ... , Bm)

which is
a(O)a(l) ... a(t).

Now let us think of this string as an input to the automaton A.


116 2. Finite Automata

Suppose that A accepts the string word(C, BI, ... , Bm). Then there exists a
computation
s(O)s(l) ... set - l)s(t)s(t + 1)
on the string
a(O)a(l) ... aCt)
such that set + 1) E F. We need to prove that

that is, we need to show that there are subsets Do, ... , Dp of the domain C such
that the interpretation Yi --* Di, i = 0, ... , p makes the formula <I>(BI, ... , Bm)
true in the chain C.
Here now is how we define each Di, i = 0, ... , p:

Di = {e(j) E Cls(j + 1) = i}.


In other words, we look at the (j+ l)th state in the computations(O)s(l) ... s(t)s(t+
1), compare it with i, and put e(j) into Di if and only if s(j + 1) = i. Figure 2.33
is a pictorial explanation of what we have done in defining the DiS.

cr(O) cr(1) cr(t-1) cr(t-1)

/\/\/
s(O) s( 1) s(2)
/
n \/\
s( t - s(t) s(t+ 1)

c(O)-c(1)- -c(t~l)--c(t)

Figure 2.33

Thus, we put e(O) into D s(1), e(l) into D s(2), ... , e(t - 1) into Ds(t), and
finally e(t) into Ds(t+I)'
Now it is not hard to see that the formula <I>(BI, ... , Bm), under this inter-
pretation of Yi, i = 0, ... , p, is satisfied in C.
Suppose that <I> (B I, ... , Bm) is satisfied in C. We want to show that A accepts
the string word(C, BI, ... , Bm). There are subsets Do, ... , Dp of C such that the
formula <I>(BI, ... , Bm) becomes satisfied in C when we interpret the variables
Yo, ... , Yp as Do, ... , Dp, respectively.
For every j ::S t, we consider the set YS{j) such that ej E Ds{j). Then, using
the definition of <I>(X) and the remarks made about the subformulas <l>a(x, X),
ilia (x, X, Y, D(Y), <l>a,i(X, X, Y), F(x, Y) (when we defined them) of the formula
<I> (X), one can check that the sequence

s(O), s(I), ... , set), s(t + 1)


2.10. Monadic Second Order Logic of Strings 117

is a computation of A on the string word(L, B], ... , Bm) such that s(t + 1) E F.
This proves the theorem. 0

Exercise 2.10.5 Finish the proof of the theorem above in greater detail.

Exercise 2.10.6 Let:E = {a, b}. Consider the following languages:

1. L] = {ab n1 abab n2 aba ... abab nk I k ::: 1, ni ::: I}.

3. L2 = {(ab)n In E w}.

For each of these languages Li, i = 1,2,3, constuct an automaton Ai and a


formula <l>i such that

1. L(A) = Li;

2. for all chains C and subsets B C C, the string word(C, B) E Li if and only
C ~ <l>i(B).
In fact, the proof of the Theorem 2.10.1 shows that we can say more about
the transformation of automata to formulas. Indeed,

Theorem 2.10.2 There exists an algorithm which, given any finite automaton A =
(S, {so}, T, F), constructs aformula <I> (X] , ... , Xm) such thatforall chainsC and
subsets B1, ... , Bm C C the following property holds:
word(C, B], ... , Bm) E L(A) iffC ~ <I>(B] , ... , Bm).

Proof. The proof follows from the fact that we could effectively write down
the formula <I> given the automaton A. D

2.10.6 From Formulas to Automata. Our goal in this subsection is to show that
we can establish the converse of Theorem 2.10.1 proved in the previous subsection.
In other words, we want to show that we can transform any formula to an automaton
so that there is a close relationship between computations of the automaton and
satisfiability of the formula. We first consider several examples.

Example 2.10.6 Consider the formula X2 E XI.

Consider the automaton A whose graph presentation is pictured in Fig-


ure 2.34.
The relationship between the automaton and the formula X2 E X 1 is the
following. For each chain C = (C, :s), subset B] C C, and element b2 E C, the
automaton A accepts the string word(C, B], b2) if and only if b2 E B].

Example 2.10.7 Consider the atomic formula X] :s X2.


118 2. Finite Automata

Figure 2.34: Automaton representing the formula X2 E X I.

Figure 2.35: Automaton representing the formula X2 :s X2.


Consider the automaton A whose graph presentation is in Figure 2.35.
The connection between the automaton in Figure 2.35 and the formula XI :s
X2 is as in the previous example, that is, for each chain C and sequence bl, b2 E
C the automaton A accepts the string word(C, bl, b2) if and only if C satisfies
bl :s b2.
Before we present the next definition, we establish some notation. From now
on, X and x denote the sequence X I, ... , Xm-k of set variables and the sequence
Xm-k+I, ... , Xm of individual variables, respectively. We use similar notations
for sequences of sets and elements in chains. For example B c A means that
BI, ... , Bm-k is a sequence of subsets of A.
Definition 2.10.5 Let <I>(X, x) be a formula and let A be an automaton over
{O, l}m. The automaton A represents <I> (X , x) ifforall chainsC = (C, :s), subsets
B c C, and elements bEe, the automaton A accepts word(C, B, b) if and only
if the chain C satisfies <I>(B, b).

The two examples above show that the formulas X2 E X I and XI :s X2 are
represented by automata.
Exercise 2.10.7 Show that the atomic formulas X = Y and X = Yare represented
by finite automata.

Lem~a 2.10.1 SUl?pose that the automata AI and A2 represent the formulas
<I> I (X, x) and <1>2 (X , x), respectively. Then there exist automata representing
<I>,(X,x)r<l>2(X, x), ....,<I>I(X,X), QXi<l>I(X,X), and QXj<l>I(X,X),
2.10. Monadic Second Order Logic of Strings 119

where r E {V, &, ~}, Q E {V, 3}, j = 1, ... , m - k, i =m- k + 1, ... , m.


Proof. Having the automata Al and A2, we can consider the automata Al EEl
A2, Al x A2, and A~, where Al EEl A2 recognizes the union of L(AI) and L(A2),
Al x A2 recognizes the intersection of L(AI) and L(A2), A~ is an automaton
which accepts the complement of L(AI) (see Theorem 2.3.1, Theorem 2.3.2 and
Theorem 2.3.4). Using the assumption that for each i = 1,2 the automaton Ai
represents <l>i (X, i), we see that the automata
Al EEl A2, Al x A2, A~
represent the formulas

( <1>1 (X, i) V<1>2 (X , i»), <1>1 (X, i) & <l>2(X, i), -,<1>1 (X, i),
respectively. We give, for example, a proof that Al EEl A2 represents the formula
(<I>I (X, i) V <l>2(X, i». Take a chain C = (C, :s), subsets 8 c C, and elements
b E C. Consider the string word(C, 8, b). Since each Ai represents <l>i(X, i),
we see that C satisfies (<I> I (8, b) V <1>2 (8, b» if and only if C satisfies either
<I> I (8, b) or <1>2(8, b) if and only if either Al accepts word(C, 8, b) or A2 accepts
word(C, 8, b) if and only if -:\1 EEl A2 accepts ~ord(C, 8, b).
Now suppose that <I> (X, i) is 3Xi<l>I(X,i). Without loss of generality,
we can assume that Xi = X I. Consider the automaton A lover the alphabet
~ = to, l}m which represents the formula <1>1 (X, i). The alphabet ~ is ~I x ~2,
where ~I = to, I} and ~2 = to, l}m-l. By the theorem on projections of FA
recognizable languages (see Theorem 2.3.9), there exists an automaton B which
accepts the projection pr2(L(Ad) of the set L(Ad. We show that B represents
3XI <1>1 (X, i). Indeed, take a chain C = (C, :s), subsets B2, ... , Bm-k C C,
and elements b E A. Consider the string word(C, B2, ... , Bm-k. b). The au-
tomaton B accepts the string word(C, B2, ... , Bm-k. b) if and only if there is
a string u E to, 1}* such that the string (u, word(C, B2, ... , Bmk , b» over the
alphabet ({O, l}m)* belongs to L(A I ). Hence the automaton B accepts the string
word(C, B2, ... , Bmk , b) if and only if there is a subset BI C C such that the au-
tomaton A accepts the string word(C, BI, B2, ... , Bm-k, b). In tum, A accepts the
string word(C, BI, B2, ... , Bm-k. b) if and only if the chain C satisfies <1>1 (8, b).
Then clearly C satisfies 3X 1 <1>1 (X I, B2, ... , Bm-k. b) if and only if C satisfies the
formula <I> 1(8, b) for some BI. Therefore, B represents the formula 3X I <1>1 (X, i).

Ve~y similarly, one can prove that there exists an automaton which represents
3x j <1>1 (B, bm-k+I, ... ,x j, ... , bm). 0

Exercise 2.10.8 Complete the proof of the theorem above in greater detail.
Lemma 2.10.2 Let <I> be an atomic formula. There exists an automaton that rep-
resents <1>.
Proof. The lemma follows directly from Examples 2.10.6 and 2.10.7 and
Exercise 2.10.7. 0
120 2. Finite Automata

Theorem 2.10.3 There exists a procedure which for every monadic second order
formula <I:> (X, i) constructs an automaton .A which represents the formula.

Proof. The proof of the theorem is by induction on the complexity of the


formula <I:> (X , i). The above lemma proves the theorem for atomic formulas, that
is, for the basic step of our induction. Lemma 2.10.1 proves the inductive step and
hence the theorem.
The next exercise connects an important notion used in logic, namely, the
notion of definability with the notion of FA recognizability. We first give a defini-
tion.

Definition 2.10.6 A language L over the alphabet 1: = {O, l}m is definable if


there exists a formula <I:>(XI, .. " Xm) such that for all W E 1:* there exists a
chain C and subsets BI, ... , Bm C C such that w = word(C, BI, ... , Bm) and
C satisfies <I:>(BI, ... , Bm) ifand only ifw E L.

Exercise 2.10.9 Show that L is definable ifand only if L is FA recognizable. (Hint:


Use Theorem 2.10.1 and Theorem 2.10.3.)

We have now prepared enough material to prove the main theorem of this
section. The theorem proves decidability of SFS

Theorem 2.10.4 The monadic second order theory ofall chains SFS is decidable.

Proof. Let IJI be a sentence. We want to check whether or not IJI belongs to
SFS. Note that satisfiability of the formula VX <I:> is equivalent to the satisfiability
of the formula ...... ::IX ...... <I:>. In turn satisfiability of any formula of the type ...... <1:> is
equi valent to the satisfiability of the formula ::I Z ...... <1:>, where Z does not occur in <1:>.
Therefore, we can assume that the sentence IJI is either of the form ::Ix <I:> (x) or of
the form ::IX <I:> (X). We prove the theorem for the case in which the sentence has a
form ::IX <I:> (X). The proof of the other case is similar.
By Theorem 2.10.3, there exists an automaton .A over the alphabet {O, I}
that represents the formula <I:> (X). Therefore, for any chain C = (C, :s) and subset
BI C L, the chain satisfies <I:>(BI) if and only if the automaton.A accepts the string
word(C, BI). Thus, there exists a subset BI C L such that C satisfies <I:>(BJ) if
and only if there exists a string of length t, where t is the number of elements
of C, accepted by .A. We can identify the alphabet 1: with the alphabet {O, l} x
{a}. Consider the projection of L(A) to the one letter alphabet {a}. Then by the
projection theorem (Theorem 2.3.9) there exists an automaton B over the alphabet
{a} such that C satisfies ::IX<I:>(X) if and only if there exists a string of length t
accepted by 13. It follows that the sentence ::IX <I:> (X) is true in all chains if and
only if B accepts all nonempty strings from {a}*. Since the universality problem
for finite automata is decidable, we conclude that SFS is decidable. The theorem
is proved.
3
Btichi Automata

Finite automata theory, studied in the previous chapter, can be viewed as a theory
that investigates problem oriented computations. Generally speaking, problem ori-
ented computations solve certain problems about data. Computer programmers as
well as users deal with problem oriented computations daily. A programmer, given
a computer program and an input, runs the program on the input, and the program
gives an output upon termination thus solving a certain problem about the input.
Therefore, for these programs, nontermination is considered to be a failure.
Interestingly, in contrast to this, there are examples of computer programs for
which termination can be considered to be failure. We use these types of systems
in our every day life as well. Take, for example, multiuser operating systems. One
would like these systems to not crash whatever users do. In fact, a distinguishing
feature of operating systems or real time systems is that they must never terminate.
Banking systems, air traffic control systems, network communication systems are
other examples of computer systems for which termination can be counted as
a failure. Therefore, for these nonterminating systems, we need other types of
theories of computations with a solid mathematical foundation.
In this chapter we investigate properties of finite state machines with unend-
ing (or equivalently, ongoing or nonterminating) computations, that is, machines
for which termination is considered to be failure. We should stress that finite state
machines with unending (onoing, nonterminating) computations were first studied
by Biichi. Biichi motivated the study ofthese machines from a purely mathematical
point of view with the goal of providing algorithms to decide some mathematical
theories, in particular certain fragments of arithmetic.

B. Khoussainov et al., Automata Theory and its Applications


© Birkhäuser Boston 2001
122 3. BUchl Automata

In this chapter we study Btichi automata, Mtiller automata, Sequential Rabin


automata, and the relationship between these models of computations. In the first
section we discuss two examples. The first example is well known in concurrency
theory and is called the dining philosophers problem. The second example is again
the Consumer-Producer problem (which we studied in the finite automata chapter)
but considered from a different point of view. These two examples will motivate us
to consider finite state systems with unending (ongoing) computations. Based on
the analysis of these two examples, in the next section we define Btichi automata.
We introduce the notions of w-Ianguage, computations (or equivalently, runs) of
Btichi automata and Btichi recognizability. The section contains examples and
proves that the class of Btichi recognizable w-Ianguages is closed under the set-
theoretic operations of union, intersection, and projection.
Section 3 gives a well-known characterization of Btichi recognizable w-
languages first found by BtichL The section also contains some natural operations
which produce Btichi recognizable languages. Section 4 and 5 are devoted to the
complementation problem. They contain some fundamental notions (such as satu-
ration, congruence, etc.) and combinatorial techniques that have become important
in applications and development of automata theory. In Section 6 we discuss prob-
lems related to determinism. We will show that deterministic Btichi automata are
not equivalent to nondeterministic Btichi automata. This contrasts the situation in
finite automata theory, where finite deterministic and nondeterministic automata
are equivalent.
In Section 7 we will continue to investigate computations on infinite inputs
defined by deterministic finite state systems. We define Mtiller automata and se-
quential Rabin automata. We will show that these two automata accept the same
class of languages. We discuss some properties and find an algebraic characteriza-
tion of Mtiller recognizable languages. Section 8 proves the famous McNaughton
theorem which states that Mtiller automata are equivalent to Btichi automata. The
proof uses important and elegant technical notions, such as the notion of flag point
introduced by Rabin. The last two sections are devoted to giving some applications
of results obtained in the previous sections. We apply them to investigate decid-
ability and definability issues in some natural fragments of the monadic second
order theory of arithmetic.

3.1 Two Examples


Two examples discussed in this section will motivate us to consider models of finite
state systems which perform unending (ongoing, nonterminating) computations.
These examples lead us to introduce new abstract concepts: infinite inputs and
infinite computations. Based on these examples we define, in the next section,
Btichi automata. We should say that the original motivation of Biichi to define his
automata was to prove decidability of some fragments of arithmetic. We will look
at this later in the chapter.
3.1. Two Examples 123

3.1.1 The Dining Philosophers Problem. We begin this section by presenting


a simple version of the known dining philosophers problem. The goal of this
example is to explain the ideas of ongoing (unending) computations and motivate
the definitions of automata working on infinite sequences of inputs. The example
is well known in concurrency theory literature.
In an old philosophy school there are three philosophers. The life of each
philosopher consists of an alternation of thinking and eating. The philosophers,
numbered by 1,2,3, live in a house and spend their time seated around a table. In
the middle of the table, there is a large bowl of noodles. Each philosopher has his
own plate on the table. There are also three chopsticks on the table, one between
each pair of plates. In order to eat each philosopher needs to use the chopsticks on
both sides of his plate. This is a source of complication since no two philosophers
can eat simultaneously. We picture this situation in Figure 3.1.

Figure 3.1: Dining Philosophers

We want to construct a finite state system which models the situation. Having
built such a system, we would like to reason about the behavior of the philosophers
by means of the system. We assume that at the beginning all three philosophers
are thinking and it is the first philosopher's turn to eat. Therefore, we represent
the initial state as a 4-tuple (t, t, t, 1). The first coordinate of this tuple represents
the state of the first philosopher; the second coordinate represents the state of the
second philosopher; the third coordinate represents the state of the third philosopher
(all are thinking now). Finally, the last coordinate tells whose signal the system is
waiting for in order to respond. This suggests that the states of the system we want
to construct are the following 4-tuples:

(t, t, t, 1), (t, t, t, 2),(t, t, t, 3), (e, t, t, 1), (e, t, t, 2), (e, t, t, 3), (t, e, t, 1),
(t, e, t, 2), (t, e, t, 3), (t, t, e, 1), (t, t, e, 2), (t, t, e, 3).
124 3. BUehl Automata

Note that since no two philosophers can eat simultaneously, there can be no state
of the form, for example (t, e, e, 1). Now we ask the following question: How
does the system change its state? The answer to this question is simple. The state
changes when one of the philosophers acts. Now each philosopher makes only two
actions: he eats or thinks. Hence we conclude that the signals given to the system
by any philosopher is either t (think) or e (eat). A signal of a philosopher may
change the current state of the system. For example, suppose that system is in state
(t, e, t, 3). This state tells us that the first and the third philosophers are thinking,
the second philosopher is eating, and the system is expecting an action of the third
philosopher. The third philosopher cannot eat since he does not have chopsticks
available since the second philosopher is using one of the needed chopsticks. Hence
the third philosopher is forced to think and the only signal he sends to the system
is t. This signal changes the state of the system to a new state (t, e, t, 1). At this
new state the first philosopher cannot eat, and the only signal t provided by the
first philosopher changes the state (t, e, t, 1) to a new state (t, e, t, 2). Now the
system waits for the signal from the second philosopher. If the signal from the
second philosopher is e, then the state (t, e, t, 2) changes to (t, e, t, 3) and hence
the system acts as it acted before. If the signal is t, then the state (t, e, t, 2) changes
to (t, t, t, 3). Below, in Figure 3.2, is a labeled graph presentation of the system
we have constructed.

(e,t,t,3) (t,e,t,l) (t,t,e,2)

t
tt ~ ~ t

et
(e,t,t,2) (t,e,t,3) (t,t,e,l)

t
t,t,t,l)
t
~(t,t,t,2)
et
(t,t,t,3

Figure 3.2: A finite state model for the Dining Philosophers problem.

The labeled graph tells us how each state of the system responds to input
signals which are either e or t. The nodes of the graph are the states of the system.
If a directed edge from some state SI to a state S2 is labeled with (J" , then this simply
means that the signal (J" changes the state SI to S2. Let us assume that the initial
state of the system is (t, t, t, 1). An important question is now the following:
What are the inputs to the system?

One possible answer to the question is that the inputs are finite strings over
the alphabet {e, t}. In this case we are essentially in the realm of finite automata.
3.1. Two Examples 125

Hence the methods and results obtained in the previous chapter can certainly be
applied to investigate computational properties of the system.
The second possible answer comes from a deeper analysis of the question
or, if one wants, from a different point of view. Assume that all philosophers want
to think and to eat as many times as they want. In particular, we want our system
to run without termination. This assumption forces us to be interested in ongoing
(unending) responses of our system to the input signals. Let us elaborate more at
this point. Say for example that a philosopher is happy if he can eat and think as
many times as he wants. Thus, the first philosopher is happy if the system enters,
for example, the states (t, t, t, 1) and (e, t, t, 3) infinitely many times. For instance,
the behavior
eftttt etttttettttt ett tttettttt ...
causes the system to visit the states (t, t, t, 1) and (e, t, t, 3) infinitely many times.
This, for example, shows that the first philosopher is happy if the other philoso-
phers always think, However under this behavior neither the second nor the third
philosopher can be happy. Note now that the behavior

et tt ett tt ettt ett tt ettt ettttettt etttt ...

makes the first and the second philosopher happy. However, the third philosopher
cannot be happy under this action since he does not have a chance to eat. But any
of the behavior

ettt et tt ett tett t ettt ettt etttettt etttetttett t ettt ...

or
ettetttettetttettettt ...
makes all the philosophers happy. In the last two patterns of behavior all philoso-
phers can think and eat as many times as they want.

Exercise 3.1.1 Find infinite sequences of signals from {e, t} such that
1. only the first and the third philosopher are happy;

2. all states of the system are visited infinitely often.

3.1.2 Consumer-Producer Problem Revisited. We briefly recall the Consumer-


Producer problem from the finite automata chapter. Producer produces products
and stores them into a storage. The capacity of the storage is 3, that is, the storage
can hold only three units of the product. The state of the storage when the storage
has exactly i units of the product is i. So 0,1,2, and 3 are possible states of the stor-
age. Producer tries to satisfy Consumer adding one product unit into the storage.
Consumer takes (consumes) the product out of the storage. We denote the action
of Producer by p, and the action of Consumer by c. We assume that Consumer and
126 3. Buehl Automata

Producer cannot make simultaneous actions. When the storage is full, that is when
the storage is in state 3, Producer can try to add a product. In this case, one can
say that the storage fails to accept the product. We denote this state by j (p). When
the storage is in this state j(p), Consumer can take out one unit of the product
and change the state of the storage to 2. Similarly, when the storage is empty, that
is, when the storage is in state 0, Consumer can try to take a product out. In this
case, one can say that the storage fails to satisfy Consumer. We denote this state
offailing by j(c). When the storage is in state j(c), Producer can add one unit of
the product and change the state of the storage to 1. So, we present the system in
Figure 3.3.

Figure 3.3

Now we need to discuss the following question:


What are the inputs to this system?
Again, if we think that inputs are finite sequences of actions of Producer and
Consumer, then we are in the realm of finite automata. A different point of view
arises when we assume that the interactions between Producer and Consumer
never end; say for example, Consumer wants to consume products as many times
as wanted, and similarly, Producer wants to produce products as many times as
requested. This point of view manifests the fact that we want our system to operate
without termination.
Thus, the assumption that the termination of interactions between Consumer
and Producer is a failure forces us to be interested in ongoing (unending) responses
of our system to input signals from {p, c}. Let us elaborate this point. Say for
example that Producer is satisfied if
1. products are produced as many times as requested;
2. Producer fails finitely many times.
Similarly, Consumer is satisfied if
1. products are consumed as many times as requested;
2. Consumer fails finitely many times.
3.2. Btiehi Automata 127

This can be expressed by saying that Consumer and Producer are satisfied if
the states 0, 1,2,3 of the system are visited infinitely often and the failing states
f(p) and f(c) are visited finitely often. Call the states 1,2,3 happy states. The
intuition behind this is the following. When the system is always in one of these
states then under any behavior of Producer or Consumer the system never enters
the failing states. Thus, for example, an analysis of the behavior

ppcpcpc .. .

shows that the states of the system under this infinite input records

0121212 ....

Therefore, Producer and Consumer are satisfied. However, the infinite sequence

ppppccccppppcccc ...

makes neither Producer nor Consumer satisfied because under this behavior the
system enters the failing states infinitely often.
Having discussed the above examples, we conclude that the inputs to finite
state systems, if we are interested in ongoing (unending) behavior of the systems,
are infinite sequences of the type

where each aj is from a finite alphabet of signals.

Exercise 3.1.2

1. Find an infinite sequence that makes Consumer satisfied and Producer un-
satisfied.

2. Find an infinite sequence that makes Producer satisfied and Consumer un-
satisfied.

3.2 Btichi Automata


In this section we define Biichi automata and provide examples. We explain how
Biichi automata perform their computations (or equivalently runs) on inputs. We
introduce the notions of acceptance and Biichi recognizable languages. We prove
some simple facts about Biichi recognizable languages. For example, we show
that Biichi recognizable languages enjoy closure properties with respect to the
set-theoretic union, intersection, and projection operations.
128 3. Biiehl Automata

3.2.1 Basic Notions. As in the previous chapters, :E is a finite alphabet

We fix this alphabet and suppress it in our further discussions unless otherwise
specified. We consider infinite sequences, or equivalently w-sequences, over the
alphabet :E. We give some examples. If :E is a one letter alphabet, say :E = {a},
then there is only one infinite sequence over :E:

aaaaaaaaaaaaaa ....

Let:E be {a, b}. Then


ababababababababab ...
and
aaabaaabaaabaaabaaabaaab ...
are examples of infinite sequences. Now we give a formal definition.

Definition 3.2.1 An infinite sequence over :E is a function a from the set w of


natural numbers to the alphabet :E. For such afunction

a:w--+:E

we can write the infinite sequence

a(O)a(1)a(2) ....

Sometimes, we can simply present an infinite sequence as

where each ai E :E. Each infinite sequence is thought to be an input to a finite state
system just as finite strings are considered to be inputs to finite automata. Thus,
we can consider the set of all infinite sequences a over the alphabet :E. In other
words, we define the set :E'" as

Sometimes we call elements of :E'" infinite inputs or strings or words. We denote


such infinite strings by the letters

a, fJ, y, ...

possibly with some indices. Note that in contrast to :E* the set :E'" is uncountable
if :E has more than one symbol.
3.2. Btichi Automata 129

Exercise 3.2.1 Show that the set ~£t) is uncountable if~ has more than one symbol.
(Hint: Use a diagonalization method discussed in Chapter 1).

As in the case of finite automata we will be interested in languages of infinite


sequences.

Definition 3.2.2 An (V-language is any subset of ~£t). Sometimes if there is no


confusion we simply say language instead of (V-language.

Here are some simple examples of (V-languages.

Example 3.2.1

1. Let aI, a2, ... , an be infinite strings. Then

and
~£t) \ {aI, a2, ... , an}

are (V-languages. The first language is called finite and the second cofinite.

2. 0 and ~£t) are (V-languages.

3. Let L c ~* be any language offinite words. Then the set

is an (V-language. One can say that this (V-language contains all infinite
strings that have initial segments from L. For instance, if L = {a, aa, aaa,
aaaa, ... }, then the above defined language consists of all infinite words
that begin with a.

Now as we did for finite automata, we define finite state machines which make
infinite (equivalently, ongoing or nonterminating) computations, or equivalently
runs. Then our goal will be to define the notions of computation and acceptance
on such machines. Here is the definition of Btichi automata.

Definition 3.2.3 A nondeterministic Biichi automaton over ~ is a quadruple


A = (S, I, T, F) such that
1. S is a finite set of states,

2. I is a subset of S called the set of initial states,

3. T c Sx ~ x S is the transition table,

4. F is a subset of S called the set offinal states.


130 3. Blichi Automata

The automaton A is deterministic if/is singleton, andfor every s E S and a E ~


there exists exactly one s' for which (s, a, s') E T. For deterministic A, we may
write T(s, a) = s' if(s, a, s') E T.

Thus, it is clear that the definition of Btichi automata does not differ from the
definition of finite automata. This may surprise the reader. However, the essential
difference is in the fact that finite automata make their computations onfinite strings
while Btichi automata make their computations on infinite strings. Before we begin
explaining computations (runs) on Btichi automata, we make some comments on
(graph) presentations of these machines. As we represented finite automata, we
similarly use a convenient way of representing Btichi automata as directed and
labeled graphs. So let A = (S, /, T, F) be a Btichi automaton. Then the nodes of
the graph representing A are the states of the automaton A. The edge relation E
on the nodes is defined as follows. There exists an edge connecting a node s to
another node s' if and only if (s, a, s') E T for some a E ~. We label this edge by
a. The initial and final states of Btichi automata are represented in the same way
as for finite automata. Thus,

E = {(s, s') I 3a E ~((s, a, s') E T)}.

In drawing such (transition) graphs we follow the same notations for states, initial
states, and final states as we did for finite automata. Here are some examples of
Btichi automata.

Example 3.2.2 The systems considered in the dining philosophers problem and
Consumer-Producer problem are examples of Biichi automata.

Example 3.2.3 Allfinite automata considered in the finite automata chapter can
be regarded as examples of Biichi automata.

Now we explain how Btichi automata perform their computations (runs) on


infinite inputs and then give a formal definition of such computations. Suppose
that A = (S, /, T, F) is a Btichi automaton. Let a be an infinite input

Informally a run of A on a is the process of recording states that follows the


transition table of the automaton A and proceeds by stages as follows.

Stage O. If no state belongs to /, then the automaton fails. Otherwise, the


automaton A chooses an initial state So E /.
Stage 1. If there does not exist Sj E S for which (so, ao, sj) E T, then the
automaton fails. Otherwise, A nondeterministically chooses a state Sj E S which
agrees with the transition table, that is so that (so, ao, sj) E T.
3.2. Btichi Automata 131

Stage k. Suppose that the automaton A has produced the sequence

SOSI ... Sk·

If there does not exist a state sk+l E S for which (Sk, ak, sk+d E T, then the
automaton fails. Otherwise, A nondeterministically chooses a state Sk+ 1 E S which
agrees with the transition table, that is so that (Sk, ak, Sk+ d E T.
If at each stage k E w, a state Sk+l has been entered, then we can consider
the sequence
SOSlS2 ...
which corresponds to the process of recording states (in concurrent programs, for
example). We call this sequence of states a run, or equivalently, a computation of
the automaton A on the input a. Here now is a formal definition of a computation
of the automaton A on a.
Definition 3.2.4 A run, or equivalently computation, of a Biichi automaton A
(from state s) on infinite input

is an infinite sequence
So Sl S2 S3 ...
of states such that So E I (so = s) andfor each i E w, (Sj, aj, Sj+l) E T.
The reader now can see that runs of Blichi automata are just like computations
on finite automata except that since inputs are infinite, the runs must be infinite
too.
We give now several examples. In all examples the alphabet is {a, b }.

Example 3.2.4 Consider the automaton whose graph presentation is given in Fig-
ure 3.4.

Figure 3.4

Suppose that the input to the Blichi automaton presented in Figure 3.4 is

aaabbbaaabbbaaabbbaaabbb ....
132 3. Biichi Automata

Then the run of this automaton on this input produces the sequence
sO sl s2 s3 s4 s5 sO sl s2 s3 s4 s5 ....
Note that this is the only run of the automaton.
Example 3.2.5 Consider the automaton whose transition graph is presented in
Figure 3.5.

Figure 3.5

Suppose that the input to the automaton in Figure 3.5 is


aaaaaaaaaa ....
Then the sequence
sO sO sO sO sO sO ...
is an example of a run of the automaton on the input.
Exercise 3.2.2 Let A be the automaton in Figure 3.5. Consider the input above,
that is, aaaaaaaa . . .. Show that A has infinitely many runs on the input.
Example 3.2.6 Consider the Biichi automaton A pictured in Figure 3.6.

a b

Figure 3.6

Let an input to this automaton be aaabbbaaaaa .... Then the sequence


sO sO sO sO sl sl sl s2 s2 s2 s2 ...
is an example of a run of A on the input.
3.2. Btiehl Automata 133

Exercise 3.2.3 Let A be the automaton in Figure 3.6.


1. How many runs does A have on input aaabbbaaaaa ... ?
2. Give an example of an input on which A has no runs.
3. Is there any input on which A has infinitely many runs.
Example 3.2.7 Consider the automaton whose transition graph is presented in
Figure 3.7.

Figure 3.7

Suppose that the input to this automaton is of the form


aaabbaaabbaaabb ....
Then it is not hard to see that the automaton possesses a run on such an input.
Exercise 3.2.4 Let A be the automaton pictured in Figure 3.7. What are the inputs
that fail to produce any computation of this automaton?
Suppose that we have an automaton A and an w-string CY. The most natural
and important question is now the following:
What does it mean that the automaton A recognizes CY ?
One can rephrase the question as follows:
What does it mean that the machine A has a successful run on CY ?
Clearly, the situation here is quite different than the one for finite automata.
For a finite automaton we simply look at the state s at which the automaton finishes
its run on a given input, and decide whether or not the automaton accepts the input
depending on if the state s is final or not. Obviously, we cannot do this for Btichi
automata since inputs are infinite strings. Generally speaking, the idea behind the
notion of successful run for Btichi automaton A = (S, I, T, F) is the following.
Since a run of a Btichi automaton is an infinite process, there are certain desirable
and undesirable events that happen continually. For example, if at some point
134 3. Biichi Automata

of the run, the automaton A enters a state from F, then this can be thought as
a desirable event. So informally, the success of the run can be determined by
whether or not certain combinations of these desirable and undesirable events
happen predominantly. Based on this quite informal explanation, in this and the
next sections we will discuss several definitions of the notion of successful run.
In this section we give one formalization, due to Btichi, of the concept of succesful
run.
Before we give Btichi's definition of successful run, we consider the next
example of an automaton and analyse the behavior of the automaton under certain
inputs. The analysis of the runs of A will lead us to the desired definition.
Example 3.2.8 Consider the Buchi automaton A in Figure 3.8.

b b

Figure 3.8

Suppose that the input to the automaton A is the sequence

ex = ababababababab ....
One of the runs rj of this automaton on ex is

sO sl sl sO sO sl sl sO sO sl sl ....

Another run r2 of the automaton on the same input is

sO sl sl s2 sl s2 sl s2 sl s2 sl ....

Suppose that we now have another input f3:

f3 = abaabaabaabaabaabaa ....
Then the automaton possesses a unique run r3 on this input, which is

sO sl sl sO sl sl sO sl sl ....

As we see, the first and third runs,

sO sl sl sO sO sl sl sO sO sl sl . .. and sO sl sl sO sl sl sO sl sl ... ,
3.2. Btichl Automata 135

have one property in common. They both enter the states sO and sl infinitely many
times. Call these states infinity states of the runs since these states appear in each
of the runs infinitely many times. The second run
sO sl sl s2 sl s2 sl s2 sl s2 sl ...
enters the states sl and s2 infinitely many times. Thus, the infinity states of the
second run are sl and s2. While in the first and third computations neither of the
infinity states is a final state, in the second computation the infinity state s2 is
a final state. So if we assume that entering a state from F is a desirable event,
then we see that in the run r2 the desirable event happens predominantly, or more
formally, infinitely often. Therefore, one can naturally suggest that the second run
is a successful one.
The above analysis of runs of Biichi automata suggests the idea to reason
about a given run r by means of states that appear in r infinitely often. This reasoning
should be related to the set of final states as follows. If we identify final states as
those which make the automaton happy, then we can reason whether the given run
r makes the automaton happy infinitely often. If yes, then the run is successful,
and otherwise not. Now we give formal definitions.
Definition 3.2.5 Suppose that

is a run of the automaton A on the infinite string ct. Then the infinity set In(r) of
the run r is the set of all states in this computation which appear infinitely often,
that is,
In(r) = {s I s appears in the run r infinitely often}.
So in the last example above, we have
In(rJ) = {sO, sl}, In(r2) = {sl, s2}, In(r3) = {sO, sl}.
Now we give Biichi's definition of successful computation.
Definition 3.2.6 A run (computation)

of A on w-string ct is successful if the infinity set In(r) has a nonempty intersec-


n
tion with the set of final states, that is if In(r) F i= 0. If A has a successful
computation on ct, then we say that A recognizes, or equivalently accepts, the
string ct.
Thus, ifr = SQSJS2 ... is a successful computation of A, then one of the states
appearing infinitely many times in r must belong to the set F of final states. Here
are several examples of Biichi automata and their successful runs. In all examples
the alphabet is {a, b}.
136 3. Btiehl Automata

Example 3.2.9 Consider the Biichi automaton whose graph presentation is in


Figure 3.9.

a b

Figure 3.9

Suppose that the input to this Btichi automaton is

abbbbbbbbb ....

Then the run of this automaton on this input produces the sequence

sO sl sl sl sl sl ....

Hence the automaton recognizes this string since the final state sl occurs infinitely
often.
Exercise 3.2.5 Let A be the automaton presented in Figure 3.9. What are the
infinite strings accepted by this automaton?

Example 3.2.10 Consider the automaton whose transition graph is presented in


Figure 3.lO.

~ct~·~~
:::::;:.

b
.:\:: '::: ...•

Figure 3.lO

Suppose that the input to this automaton is


a2b2a4b2a6b2a8 ....

The automaton possesses a successful computation on this input and hence the
automaton recognizes it.
Exercise 3.2.6 What are the inputs accepted by the automaton presented in Fig-
ure 3.lO?
3.2. Bi.iehl Automata 137

Figure 3.11

Example 3.2.11 Consider the automaton whose transition graph is presented in


Figure 3.11.
This automaton accepts for example the following infinite string:
aaabbbaaabbbaaabbb ...
Exercise 3.2.7 What are the inputs accepted by the automaton in the example
above?
Example 3.2.12 Consider the automaton whose transition graph is presented in
Figure 3.12.

Figure 3.12

It is not hard to check that this Biichi automaton accepts infinite strings of
type

where nl > 0 and ni, mi-J ~ 0 for i ~ 2.


The examples above suggest the following idea. Let A be a Biichi automaton.
We can consider the set LCA) of all infinite strings on which the automaton A
has successful computations. Thus, let us define the set LCA) to be the language
{a E b W I A accepts a}. So, we are lead to the following fundamental definition
of this chapter.
Definition 3.2.7 An w-language L C b W is Biichi recognizable if there exists
a Biichi automaton A such that the w-language L coincides with the set of all
138 3. Btichi Automata

infinite strings recognized by A, that is, if L = L(A). In this case we say that A
recognizes (or accepts) L.

Now suppose that A is a Biichi automaton. This automaton may possess


the following unpleasant feature. There could be an input signal a E ~ and a
state s E S such that (s, a, s') E T holds for no state s'. We call such Biichi
automata incomplete automata. Biichi automata which are not incomplete are
called complete Biichi automata. It turns out that this feature is inessential as long
as we are interested in the w-Ianguages recognized by Biichi automata. Here is a
technical proposition for removing this unpleasant feature of Biichi automata.

Proposition 3.2.1 For any Buchi automaton A = (S, T, I, F) there exists a com-
plete Buchi automaton A' = (S', T', I', F') such that A and A' recognize the
same w-language.

Proof. The proof is very simple. The automaton A' simulates the original
automaton A. But if s E S and a E ~ are such that (s, a, s') E T holds for no
state s', then A' continues its computation by moving to a new state f which does
not belong to S. Thus, we just need to keep the initial and final states the same,
add a new state f to the set S of states of A and extend the transition diagram T
by adding some extra transitions:

1. S' = S U{f}, where f is a new symbol.


2. T' = T U{(s, a, f) I no s' such that (s, a, s') E T} U{(f, a, f)}.

Now, one can easily see that L(A') = L(A) and A' is complete. The proposition
is proved.
From now until the end of this chapter all B iichi automata considered will be
assumed complete unless otherwise stated.

Exercise 3.2.8 In all examples below the alphabet is {O, I}. Construct Buchi au-
tomata accepting the following languages:
1. {a I the symbol 0 occurs in a exactlyonce}.
2. {a I the symbol after each 0 in a is I}.
3. {a I a contains finitely many Is}.
4. {a I after each 0 that occurs in a even or infinitely many Is occur consecu-
tively}.

5. {(01) n a I n 2: 1, a E 1;W}.

6. {a I a does not contain a string llO}.


7. {a I the symbol 0 occurs in all even positions of a}.
3.2. Btiehi Automata 139

3.2.2 Union, Intersection, and Projection. Our goal is prove that the set of
Biichi recognizable languages is closed under the operations of union (U), inter-
section (n), and projection. The proofs of these results are similar to those for
finite automata. However, of course, some care should be taken, in particular in
the case of intersection. Here is the first theorem which shows that the union of
Biichi recognizable languages is Blichi recognizable.

Theorem 3.2.1 Let Al and A2 be Buchi automata. Then there exists a Buchi
automaton A such that L(A) = L(A}) U L(A2).

Proof. Let each Ai be (Si, Ii, T;, Fi), where i = 1, 2. We can suppose that A I
and A2 have no states in common, that is SI n
S2 = 0. The idea of constructing a
Biichi automaton A which accepts L(AI) U L(A2) is similar to the finite automata
case: given an input ex, the automaton A simulates computations of Al and of A2
on ex. If one of these computations is successful, then A accepts ex, otherwise A
does not accept ex. Indeed, we define the Biichi automaton A = (S, T, I, F) as
follows:

1. The set S of states is SI U S2,


2. The transition table T is TI U T2,
3. The initial states set I is II U h
4. The final states of A are all the states from FI U F2.
Now it is not hard to show that L(A) = L(Ad U L(A2)' 0

Exercise 3.2.9 Finish the proof of the theorem.

Exercise 3.2.10 Construct a Buchi automaton that accepts the union of the fol-
lowing three languages:

1. LI = {ex I the symbol 0 occurs in ex exactly once}.


2. L2 = {ex I the symbol after each 0 in ex is I}.

3. L3 = {ex I ex contains finitely many is}.

Now we want to prove that the set of Biichi recognizable languages is closed
under intersection. The proof of this theorem is not as easy as the intersection case
for finite automata. At this stage we ask the reader to think why the proof for the
intersection case for finite automata does not work for Blichi automata. Here is the
theorem.

Theorem 3.2.2 Let Al and A2 be Buchi automata. Then there exists a Buchi
automaton A such that L(A) = L(AI) L(A2). n
140 3. Buehi Automata

Proof. One method of constructing a Biichi automaton A which accepts the


n
intersection L(Ad L(A2) is as follows. We first give an idea and then give a
formal construction.
Assume that a is an input. Let us pretend that we are the desired automaton
A that accepts the intersection of L(AI) and L(A2). How would we behave? Well,
we would proceed as follows:

1. We would begin a computation on a by simulating computations of Al and


A2 on a simultaneously. To simulate both Al and A2 is not hard since at
each stage of computation we just need to remember the current state of Al
and A2 (Note that the number of pairs of states from Al and A2 is finite).

2. Assume now that during our run on input a we noticed that Al has just gone
through a state from FI .

3. We would continue simulating Al and A2, and wait for the automaton A2
to go through a state in F2. We call this a waiting state for A2.

4. Assume that A2 has just passed through a state in F2. Then we would continue
simulating both Al and A2, forget about the previous waiting state and wait
for Al to go through a state from Fl. We call this a waiting state for AI, etc.

Now if we changed waiting states infinitely often, then we would accept a. Other-
wise we would reject a.
Can all these be done using a finite memory? Well, we only need to remember
the current state of AI, the current state of A2, and the current waiting state either
for Al or A2. This is really an informal proof, however in detail the proof goes as
follows.
Based on the informal description above, here is the definition of the au-
tomaton A = (S, I, T, F) with some explanations or comments which are written
within double brackets [[like this, and these are not a part of the construction]]:

1. The set S of states is the set of all triples of the form (SI, S2, 1), (SI, S2, 2),
and (SI, S2, 3), where SI E SI and S2 E S2. [[Clearly, the first and the second
coordinates are designed to simulate Al and A2. The last coordinate tells
whether the machine is waiting either for Al to go through a final state or
A2 to go through a final state.]]

2. The set of initial states consists of all triples (SI, S2, 1) such that SI E h
and S2 E h [[Computation begins with waiting for Al to go through a final
state.]]

3. The definition of the transition table T is the following:

(a) The triple «SI, si, 1), a, (S2, s;, 1)) belongs to T if and only if (SI, a,
si) E TI and (S2, a, s;) E T2 and si rt Fl.
3.2. Btichl Automata 141

(b) The triple «SI, s;, 1), a, (S2, s~, 2»


belongs to T if and only if (SI, a,
s;> E TI and (S2, a, s~) E T2 and s; E Fl. [[Here the last coordinate
shows the waiting state is being changed since Al visited Fl']]
(c) The triple «SI, s;, 2), a, (S2, s~, 3» belongs to T if and only if (SI, a,
s;) E TI and (S2, a, s~) E T2 and s~ E F2. [[Again note how we
changed the last coordinate since A2 visited F2.]]
(d) The triple «SI, s;, 3), a, (S2, s~, 1» belongs to T if and only if (SI, a,
s;) E TI and (S2, a, s~) E h [[Again, note how we changed the last
coordinate. ]]
(e) The triple «SI, s;, 2), a, (S2, s~, 2» belongs to T if and only if (SI, a,
s;) E TI and (S2, a, s~) E T2 and s~ rj. F2.
4. The final states are all triples of the from {(SI, S2, 3)lsl E SI, S2 E S2}.
n
Now we need to show that L(A) = L(AI) L(A2). Indeed, consider an
infinite string a. Then the automaton A accepts the string a if and only if there is
a successful computation r
(I) (2) (I) (2) (I) (2) (I) (2)
r = (so ' EO, So ), (SI ' EI, sl ), (S2 ' E2, S2 ), ... , (Sj , Ej, Sj ), ...
such that [n(e) n F -:I 0. We leave the rest of the proof to the reader. 0
Exercise 3.2.11 Finish the proof of the theorem above.
Exercise 3.2.12 Show that in the proof of the theorem above we could construct
the desired automaton whose set of states is SI x S2 x {I, 2}.
The next theorem is the projection theorem for Btichi automata recognizable
languages. As for finite automata, this theorem states that if a language L over an
alphabet ~ = ~I x ~2 is recognizable by a Btichi automaton, then the projections
of L to (V-languages to over ~I and to over ~2 are also Buchi recognizable.
Now we give formal definitions. Suppose that b = bl x b2. Let a be an
infinite string over this alphabet of the form:

(ao, a~)(al' a{)(a2, a~)(a3, a~) ....

Then the bl-projection of a is

We denote this projection by prl (a). The b2-projection pr2(a) of a is defined


similarly.
Now let L be an (V-language over b = bl x b2. We define the projections
of this language to ~I ( ~2 ):

prl (L) = {prJ (a) E ~f Ia E L} (pr2(L) = {pr2(a) E ~2 Ia E L}).

Thus, prj (L) is an (V-language over the alphabet bj, i = 1,2.


142 3. Btiehl Automata

Theorem 3.2.3 If the language Lover L: = L:I x L:2 is Ruchi recognizable, then
so are the projections prl (L) and pr2(L).

Proof. Let A = (S, I, T, F) be a Btichi automaton that accepts the language


L. ABtichi automaton A I that accepts the projection pr I (L) is informally explained
as follows. The automaton Al takes an infinite input

and simulates A on all w-strings

over the alphabet b. How can this be done? Say for example that an input to
the automaton Al is a. Say that Al is in state s which is a state of the original
automaton A. Then in order to simulate A on s, Al should be able to choose those
s' to which there are transitions via (a, a') E L: from s. The idea here is that any
transition of A can be simulated by AI. One can think of this as a "forgetting"
operation: Al "forgets" the L:2-coordinate while it nondeterministic ally guesses
it in its computation. So if A accepts one of these strings, then Al accepts a.
Otherwise, Al does not accepta. Now a formal definition of Al = (SI, II, TI, FI)
is given as follows:

1. The set 51 of states of Al is S.

2. The initial states of Al are those from I.

3. The transition digram TI contains (s, ai, s') if and only if there exists a
a2 E L:2 such that «s, (ai, a2), s') E T).

4. The final states set FI is F.

Now the reader can easily prove that the Btichi automaton Al accepts prl (L).
Similarly, there exists a Btichi automaton A2 such thatpr2(A) = L(A2). We leave
the rest of the proof to the reader.

Exercise 3.2.13 Finish the proof of the theorem above.

Exercise 3.2.14 Let L: = {a, I} x {a, I}. Construct a Ruchi automaton which
accepts the language L of all strings

over the alphabet L: such that the symbol I occurs earlier in the sequence a6a{ a~ .. .
than it does in the sequence aOaW2 ... , and, moreover, the sequence a6a{ a~ .. .
contains finitely many Is. What are the projections of L? Construct Ruchi automata
accepting the projections.
3.3. The Btichl Theorem 143

The next natural and perhaps the most important question (at this stage at
least) about Btichi automata is the following.
Is it true that the complement of every Biichi recognizable language is always a
Biichi recognizable language?
We will show in Section 3 that the answer to the question is "yes." However, it
turns out that to answer this question is not an easy task. We need to develop some
beautiful combinatorial techniques and elegant constructions.

3.3 The Blichi Theorem


The goal of this section is to give a characterization of Biichi automata recognizable
languages. This characterization is known as the Btichi characterization theorem.
The proof of this theorem involves results, methods, and notions of finite automata
theory.

3.3.1 Auxiliary Results. Our goal is to introduce two operations that produce
(V-languages. Under certain natural conditions these (V-languages are Biichi recog-
nizable. Both operations involve languages of finite words.
Let us explain the first operation. Let W be a language of finite words over
b, that is, W C b*. This language naturally defines the (V-language, denoted by
W"', which consists of all infinite strings of the form

where each Wi is a nonempty word belonging to W. This ends the definition of


the first operation that produces (V-languages. Thus, loosely speaking a string ex
belongs to W'" if and only if ex can be divided into infinitely many pieces so that
each piece is a string of W.

Example 3.3.1 Suppose that W = {ab, bal. Then the (V-language W'" contains
all (V-words of the type

where each Ei is either 1 or 2, i ::: 1.

Example 3.3.2 Let W = {a, b}. Then W'" is clearly the (V-language b'" that
contains all infinite words.

Now we will explain the second operation. Suppose that L is an (V-language


over band W is as above, a subset of b*. These two languages define the (V-
language, denoted by W L. The (V-language W L is the set of all infinite inputs of
the type wex, where W E Wand ex E L. This ends the definition of the second
operation. Thus, loosely speaking, a string ex belongs to W L if and only if some
initial finite segment of ex belongs to Wand the rest of ex belongs to L.
144 3. BUehi Automata

Example 3.3.3 Suppose that W = {ab} and L = b"'. Then

W L = {abaoaW2 ... ai ... liE w, ai E b}.

Thus, W L contains all infinite words which begin with abo


Here are now some nice theorems about these two operations which produce
w-Ianguages.

Theorem 3.3.1 Let W C b* be an FA recognizable language. Then the w-


language W'" is Biichi recognizable.
Proof. Let A = (S, {so}, T, F) be a finite automaton which recognizes the
language W. We can assume that there is no transition from any state s to the initial
state so, that is (s, a, so) E T for no s E S. (We in fact proved this statement in
the proof of Kleene's Theorem.) A Biichi automaton Al recognizing W'" can be
informally described as follows. Given an infinite input Ci, the Biichi automaton
Al simulates A. As soon as a final state f E F is reached the automaton has a
nondeterministic choice. The automaton Al either can continue simulating A or
can assume that f is the initial state of A and begin reading the rest of Ci from
the initial state of A. Based on this informal description, we define the automaton
Al = (SI, It, TI, FI) as follows:
1. The set of states SI is S.

2. The initial state of Al is so.

3. The transition table TI is defined by:

T(s, a) ifT(s,a)nF=0,
TI (s, a) =
{ T(s, a) U{so}
otherwise.

4. FI is {so}.
Now we need to prove that L(AI) = W"'. Indeed, suppose that Ci E W'" and is of
the form

where each Wi is a nonempty word belonging to W. For each Wi, the automaton
A has a computation
SO,i, Sl,i,"" Sm;,i, Sm;+l,i

such that SO,i = So and smi+l.i E F. It follows that the sequence

c = so,o,· .. , smo,o, SO,I,···, Smj,I, SO,2,···, Sm2,2,···


is a computation of Al on Ci. Clearly, this computation is a successful computation
since So E In(c). Suppose now that Ci E L(Ad. A proof of the fact that Ci E W'" is
left for the reader (see the exercise below). The theorem is proved.
3.3. The Btichi Theorem 145

Exercise 3.3.1 Finish the proof of the theorem above.

Exercise 3.3.2 Consider the following languages offinite words over the alphabet
{a, b}:

1. W = {aa, bbl.

2. W = {aa, aba}.

3. W = {w Iw contains a word abba}.

Construct Biichi automata recognizing each ofWw.

Exercise 3.3.3 Consider the proof of the theorem above. In the proof it is assumed
that there is no transitionfrom any state s to the initial state so, that is (s, a, so) E T
for no s E S. Why do we need this assumption?

Now we prove a theorem about the second operation.

Theorem 3.3.2 Let W, V c ~* be FA recognizable languages. Then the w-


language V WW is Biichi recognizable.

Proof. Suppose that the finite automaton A =


(S, {so}, T, F) accepts W C
~*.BytheabovetheoremthereexistsaBlichiautomatonAI = (Sl, {so,d, TI, FI)
which accepts the w-language WW. Suppose that the finite automaton A' = (S',
{so}', T', F') accepts the language V C ~*. We can suppose that the sets Sl and
S' have no common states.
A Blichi automaton A2 recognizing VWW can be informally described as
follows. Given an infinite input ex, the automaton A2 simulates A'. As soon as a
final state f E F' is reached the automaton either can continue simulating A' or
can assume that f is the initial state of the Blichi automaton AI. Based on this
informal description, we define A2 = (S2, h T2, F2) as follows:

1. The set S2 is Sl US'.

2. The initial state is sb.


3. The transition table T' extends TI U T' by adding the transitions of the type
(s, a, so)

such that (s, a, f) E T' and f E F'.

4. F2 is Fl.

We need to show that the Blichi automaton A2 accepts the w-language V W*.
We prove that if ex E VWw, then ex E L(A2). The proof in the opposite direction
146 3. Btiehi Automata

is left to the reader as an exercise. Suppose that a E V WW. Then there exists a
v E V and {3 E WW such that a = v{3. There exists a computation

of the automaton A' on v such that s~+ I E F'. There exists a computation

e = SQ, Sl, S2, S3, ...

of Al on (3 such that [n(e) n FI '10. From the definition of T2 it follows that the
sequence
e' = sb, s;, ... , s~, SQ, Sl, S2, S3, ...

is a computation of A2 on v{3. Moreover, this is a successful computation since


[n(e) = [n(e') and F2 = Fl. Hence v{3 E L(A2). The theorem is proved.

Exercise 3.3.4 Finish the proof of the theorem above by showing that if a is in
L(A2), then a E VWw.

Exercise 3.3.5 Let ~ = {a, b}. Construct Biichi automata recognizing WW and
VWW for the following V, W C ~*:

1. V = {A, a, aa, aaa, ... }, W = {A, b, bb, bbb, ... }.


2. V = {v I v contains an even number of as}, W = {ab, bal.
3. V = {v I v begins with a and ends with b}, W = {w Iw contains no string
of the type aaa}.

Exercise 3.3.6 Can WW be Biichi recognizable even ifW is not FA recognizable?

Exercise 3.3.7 let V, W C ~*. Fixpositive integers n, m. Considerthew-language


L that consists of all a,

such that the sequence u I, U2, ... satisfies the following properties:

1. Each Ui is either from V or W.

2. No stringsfrom W \ V occur more than m times consecutively.

3. No strings from V \ W occur more than n times consecutively.

Show that if V and Ware FA recognizable, then the language L is Biichi recog-
nizable.
3.3. The BUehl Theorem 147

3.3.2 Biichi's Characterization. Based on the theorems proved in the previous


subsection, we will prove two characterization theorems by Btichi. These theorems
explain the relationship between finite automata recognizable languages and lan-
guages accepted by Btichi automata. Here now is the first characterization theorem.

Theorem 3.3.3 An w-language L C ~'" is Biichi recognizable if and only if L is


afinite union o/the sets V W"', where V, W C ~* are FA recognizable languages.

Proof. First we show that if L is Btichi recognizable, then L can be ex-


pressed as a finite union of the sets V W"', where V, W C ~* are FA recognizable
languages. Let us give a brief idea of this part of the proof. So, suppose that
A = (S, I, T, F) is a Btichi automaton which recognizes L. Hence L = L(A).
Take an ex E L. There must exists a run

SOS]S2 .••

of A on ex such that a state s from F appears infinitely often. This suggests the idea
of dividing ex into pieces
ex = VWOW1W2 .•.
so that v transforms So to s, and each Wi transforms s to s. So v belongs to the
language V of finite strings which transform So to s and each Wi belongs to the
language W of finite strings that transform s to itself. Therefore, ex is in V W"'.
Now let us implement this idea formally.
Lets and s] be states of the Btichi automaton A. Define the language WS,Sl C
~* which consists of all strings u E ~* that transform the state s to the state SI,
that is,

WS,Sl = {u I the finite automaton (S, s, T, {sd) accepts u}.

Obviously, for all s, s] E S, the language WS,Sl is FA recognizable. If u E WS,Sl'


then we can write this fact by
S ---7u SI.

Consider the following w-language:

LJ = U WS,S' W.~,SI'
SEI,s'EF

This is a finite union of languages of the type V W"', where V and W are FA
recognizable. Hence, the w-language LJ is Btichi recognizable. We want to show
that L = L J. Indeed, suppose that ex ELI. Then for some s E I, S' E F, we
have ex E Ws ,Sl W:,',SI' Hence by the definition of W Sl ,S2' we see that there exists
a successful computation of A on ex. Therefore, ex belongs to L(A). Thus, L1 C
L(A).
148 3. Btiehl Automata

Conversely, suppose that a,

is accepted by the Biichi automaton A. There exists a run r,

r = SOSIS2 ... ,

of the automaton on the infinite input a,

n
such that In(r) F =1= 0. Let s' be in this intersection. As argued above, it follows
that there exists a v E I;* and {3 E I;w such that a = v{3, v E Wso,s' and
(3 E W~ s,s , for some So E I and s' E F. Consequently, a ELI. Therefore, we
have L(A) eLI. Thus, the w-Ianguage LI coincides with the set of all w-strings
accepted by the Biichi automaton A.
The proof of the theorem from right to left is easy. Indeed, suppose that
L is a finite union of the sets Vi wt, where Wi, l'i c I;* are FA recognizable
languages, i = 1, ... , k. Using the two theorems from the previous subsection,
we see that each of the w-Ianguages V WW is B iichi recognizable. Since the class
of Biichi recognizable languages is closed under union operation, we obtain that
the w-Ianguage
k
UViUt
i=1

is Biichi recognizable. The theorem is proved.


The notations introduced in the proof of the first characterization theorem
will be used often and are important. Therefore, in order to explicitly define this
notation, we give the following definition.

Definition 3.3.1 Let A be a Buchi automaton. Let Sl, S2 be states of A. Then WS1 ,S2
is the language of all finite words that transform Sl to S2. If u E WS,Sl' then we
write this fact by s ~ u Sl.

As we noted, the language WS1 ,S2 is FA recognizable and, of course, depends


on the automaton A and its states Sl, S2.
From the proof of the first characterization theorem one can get a stronger
characterization of Biichi recognizable languages. Thus, here is the second char-
acterization theorem.

Theorem 3.3.4 An w-language Lis Buchi recognizable ifand only if Lis afinite
union of the sets VWw, where W, V C I;* are FA recognizable languages such
that W· W C W.
3.3. The Biiehi Theorem 149

Proof. The direction from right to left follows from the previous theorem.
We prove the direction from left to right. Let A be a Biichi automaton. In the proof
of the previous theorem we have the equality

L(A) = U Ws,s' W;',s"


sEI,s'EF

Now it is easy to see that for each s E F, Ws,s . Ws,s C Ws,s' The theorem is
proved.

Another interesting corollary from the proof of Biichi's theorem is the next
result.

Proposition 3.3.1 Any nonempty Biichi recognizable language contains an ulti-


mately periodic word, that is, an w-word of the form

VWWWWWWWW ... ,

where v, W E b*.

Proof. Indeed, suppose that L = L(A) for some Btichi automaton A. Let
ex E L. There exists a sequence Wo, WI, W2, W3, ... of finite nonempty words such
that

Wo transforms an initial state So to a final state f, and each Wi transforms the state
f to itself. Hence,
WOWI WI WI WI ...

is an ultimately periodic word in L. The proposition is proved. D

Exercise 3.3.8 Represent the following languages as a finite union of languages


VW w , where each V and W is FA recognizable:

1. L = {ex I ex does not contain the word nO}.


2. L = {ex I each symbol 0 in ex is followed by exactly two Is}.

3. L = {ex I ex possesses finitely many Os}.


Exercise 3.3.9 Show that the following languages over {a, b} are not Biichi rec-
ognizable:

2. L = {ex I every finite word occurs in ex}.


150 3. Btichi Automata

3.4 Complementation for Btichi Automata


As we faced the complementation problem for finite automata, here we also en-
counter the unavoidable complementation problem for Biichi automata. In other
words, we seek an answer to the question as to whether there exists a Biichi au-
tomaton accepting exactly those (V-strings which are not accepted by a given Biichi
automaton A. Thus, is it true that the (V-language

bW \ L(A)

is Biichi recognizable? In this section we answer this question and show how to
construct a Biichi automaton that recognizes the complement of L (A). At this point
we would like to compare the complementation problem for Biichi automata with
the complementation problem for finite automata. For the case for finite automata
we were able to solve the problem by showing that deterministic finite automata
possess the same expressive power as nondeterministic finite automata. We will
show that deterministic Biichi automata are not equivalent to nondeterministic
Biichi automata. Hence the idea to use the determinization approach for solution
of the complementation problem for Biichi automata fails (unless we change the
notion of successful run). Therefore, one needs to use a different type of idea for
solution of the complementation problem for Biichi automata.
Here is an informal explanation of what we intend to do in order to prove that
the complement of a Biichi recognizable language is also Biichi recognizable. By
the characterization theorems of the previous section, an (V-language is accepted
by a Biichi automaton A if and only if the language can be presented as a finite
union of languages V WW, where W, V C b* are FA recognizable. So, in order to
show that the complement of L(A) is Biichi recognizable, we have to prove that
the (V-language b W \ L(A) can be presented as such a union. To do that we have
to find a finite number of FA recognizable sets W, V such that the language

can be expressed as a finite union of the sets V WW. The next subsection will be
devoted to finding the desired languages W, V C b*.

3.4.1 Basic Notations. Here we give several simple but important notions and
notations. They will be used in the proof of the complementation theorem. Let
a E b W • One can consider finite subwords ofthis infinite string a. Formally, these
finite subwords are of the form

a(n, m) = a(n) ... a(m - 1),

where n < m. We denote this portion of a by a(n, m) or sometimes an,m' For


example, for the word a considered below

abbbaabababababab ...
3.4. Complementation for BUehl Automata 151

a(3, 5) is ba.
We could also be interested in "tails" of a given infinite string a. Informally,
a "tail" of a is an infinite string which begins from some position of a. Formally
here is the notation:

a(n, w) = a(n)a(n + l)a(n + 2) ... ,


where n is a natural number. So a(n, w) is called a tail of a. In the example above
a(5,w) is
abababababab ....
Let W be a subset of ~*. We recall that the set of prefixes of W is the set
pref(W) defined as follows:

pref(W) = {u E ~* I uv E W for some v E ~*}.

From the theorem about the prefix operation on FA recognizable languages,


we know that if W is FA recognizable, then so is pref (W). We are already familiar
with the set WW:

{a E ~w Ia = WOW! . .. with Wi E W \ {)..} for each i E w}.

Finally, we will need the set Wwhose definition is given below:


W = {a E ~w I a(O, n) E W for infinitely many n}.

Thus, an w-string a belongs to Wif and only if infinitely many prefixes of a belong
to W.

3.4.2 Congruence "'. Suppose that A = (S, I, T, F) is a Bilchi automaton. We


fix this automaton until the end of this section. Let s, Sf be states of A. Consider
the set denoted by Ws,sF of all strings in ~* which transform the state s to the state
I

Sf entering the set F. Thus by this definition, a string u belongs to W F if and only I
s,s
if there exists a computation of the automaton A on u such that the following two
properties hold:

1. This computation begins with s and ends with Sf.

2. At least one of the states in this computation belongs to F.

For any string u from Ws,s


F I we usually write

F f
s~u S.

which extends the notation s ~u Sf. Now we define the following relation,
denoted by"', on the set ~*.
152 3. Biiehl Automata

Definition 3.4.1 Say that finite strings u and v are "'-equivalent, and denote this
by u '" v, if the following conditions are satisfied:

1. For all s, s' E S, the string u transforms the state s to s' if and only if the
string v transforms the state s to the state s', that is,

S -+u s' ifand only if s -+v s'.

2. For all s, s' E S, the string u transforms the state s to s' entering F if and
only if the string v also transforms the state s to the state s' entering F,
that is,
s -+:
s' ifand only if s -+~ s'.

Informally, the relation'" tells us that if u '" v, then by the first part of the
definition, the automaton A cannot make a distinction between u and v; more-
over, by the second part of the definition, u and v behave "in the same manner"
with respect to the set F. This relation plays an important role in the solution of
the complementation problem for Biichi automata. Therefore, we first investigate
properties of this relation. We give the following definition.

Definition 3.4.2 An equivalence relation E on b* is a congruence relation iffor


all (u, v) E E and all WE b*, we have (uw, vw) E E.

Exercise 3.4.1 Let L C b* be a language offinite words. Consider the Myhill-


Nerode equivalence relation "'L on b* (Reminder: u "'L v iffor all W E b*,
uw E L iffvW E L.) Show that "'L is a congruence relation.

Exercise 3.4.2 Consider our fixed Bilchi automaton A. Consider the relation '"
defined in Definition 3.4.1. Show that'" is an equivalence relation.

Here is the first lemma which shows that the relation '" is a congruence
relation.

Lemma 3.4.1 The relation'" is a congruence relation on b*.

Proof. One can easily check that the relation'" is an equivalence relation as
the exercise above shows. Hence we need to show that'" satisfies the conditions
required to be a congruence relation. Suppose that u '" v. The goal is to prove that
for all w, uw ""' VW. For all s, s' E S we have

S -+u s' if and only if s -+v s'

and

(**) s -+: s' if and only if s -+~ s'.


3.4. Complementation for Btichi Automata 153

Now consider uw and vw, where w E I;*. Suppose that

s ~uw
,
s.

Let Sj be such that S ~u Sj and Sj ~w s'. Then by (*) it must be the case that
S ~v Sj and Sj ~w s'. It follows that S ~vw s'. Similarly, if

S ~vw s',

then S ~uw s'. Now suppose that


F ,
S ~uw s.

Case 1. Suppose that there exists an SI such that S ~ [ SI and SI ~ w s'.


Then by (**), we have
F ,
S ~vw s.

Case 2. Suppose that Case 1 does not hold. Let SI be such that s ~ u SI and
SI ~ ~ s'. Then clearly, S ~ ~w s'. This proves the lemma.
We should stress that the congruence ~ depends on the given automaton. By
this reason we should have written ~ A instead of simply ~ since two Blichi au-
tomata Al and A2 could produce two distinct congruences. However, we suppress
the fact that ~ depends on A unless we state otherwise.

Lemma 3.4.2 The equivalence relation ~ is offinite index.

Proof. Let u E I;*. We define functions u I and U2. The function u I maps the
set S to the set 2 s and is defined by:

ul (s) = {s' I u transforms S to s'}


for all S E S. The function U2 maps S x S into 2 s and is defined by:

U2(S, s') = {p I s ~~p} s'}.

for all s, s' E S. It is easy to see that S ~[ s' if and only if U2(S, s') F "10. n
We also note that for all v E I;*, u I (s) = VI (s) if and only if for all q E S we have
S ~ u q if and only if S ~ v q. It follows that u ~ v if and only if the function
u j equals the function VI, and for all s, s' E S, U2 (s, s') n
F "I 0 if and only if
V2(S, s') nF "10. Since the number of functions from S into 2 s and from S x S
into 2 s is finite, we see that ~ is of finite index. This proves the lemma.
The next two lemmas provide important information about the equivalence
classes of~. The first lemma simply explains how the equivalence classes of the
relation "-' are being constructed. The second lemma shows that each equivalence
class is in fact FA recognizable.
154 3. BUehl Automata

Lemma 3.4.3 The "-'-equivalence class [w] containing the word w is the language
obtained by intersecting all the sets ofthe form Ws ,s', wts" 2:* \ Ws ,s' and 2:* \ Wts'
which contain the word w.

Proof. Let Tw be the intersection of all sets ofthe form Ws,s" W;s" 2:*\ Ws,s'
F , which contain the word w. We need to show that [w] = Tw.
and 2:* \ WS,s
If u "-' w, then clearly u E Tw. Hence [w] C Tw. Suppose that u E Tw.
Suppose that s ---+w s'. Then w E Ws,s'. Since u E Tw, we see that u E Ws,s' and
hence s ---+u s'. Similarly, if s ---+~ s', then s ---+[ s'. Suppose that w does
not transform s to s'. Then w E 2:* \ Ws,s'. Since u E Tw, we see that u does not
transform s to s'. Similarly, if not s ---+ ~ s', then not s ---+ [ s'. Hence [w] = T w.
The lemma is proved. D
Note. The above lemma also shows that "-' is of finite index. Indeed, for any
u E 2:* consider the following two functions:

Uj(s,s)=, {ID if wE Ws,s"


otherwise,

and
U2(S,
, {ID
s)=
ifw E wts"
otherwise.
It is not hard to see that
Uj = Wj and U2 = W2 if and only if u "-' v. The number

of functions from S2 to {D, I} x {D, I} is 4 1se . Hence "-' is of finite index.

Lemma 3.4.4 Each "-'-equivalence class [w] is an FA recognizable language.

Proof. By the previous results [w] is the intersection of all sets of the form
Ws 's',
sW , s " 2:* \ Wr. ,s' and 2:* \ Ws,s , which contain the word w. This intersection
F F
is obtained by intersecting finitely many languages. Therefore, it is sufficient to
show that all members of the intersection are FA recognizable. Clearly, the sets
of the type Ws,s' are FA recognizable. We only need to show that wts' is finite
automaton recognizable. One way to show this is the following. Set L = WsF,s,.
Consider the Myhill-Nerode equivalence "-' L. Note that each "-' L equivalence class
is a union of some "-'-equivalence classes. Hence "-' L is of finite index. From the
Myhill-Nerode theorem, we obtain that WS,s F , is finite automaton recognizable.
This proves the lemma.

Exercise 3.4.3 Show, without a reference to the Myhill-Nerode theorem, that the
language W.!;",S2 is FA recognizable using the original automaton A.

3.5 The Complementation Theorem


We begin this section by trying to explain a plan of constructing a Btichi automaton
that accepts the complement of a Btichi recognizable language. Recall that we are
3.5. The Complementation Theorem 155

given a Biichi automaton A and its language L = L(A). Consider the congruence
relation ~ defined in the previous section. We know that the equivalence classes of
~ are FA recognizable. Hence for all equivalence classes V and W, the (V-languages
VWW are Biichi recognizable. First of all we wantto prove that L(A) n
VW'" =F 0
implies VWW C L(A) for all "-'-equivalence classes V and W. Second, we would
like to show that each Of. belongs to V WW for some equivalence classes V, W.
Finally, suppose that we were able to show these two facts. Then the complement
of L(A) must be equal to the union of all VWW such that VWW and L(A) have no
strings in common.
Now we prove that the equivalence relation ~ possesses a property known
as the saturation property. Here is an appropriate definition.

Definition 3.5.1 A congruence relation E on the set ~* saturates an (V-language


L iffor all E-equivalence classes V and W, ifVW w n L i= 0, then VWW C L.
The following lemma shows that the equivalence relation ~ defined by a
given Biichi automaton A saturates the language L(A).

Lemma 3.5.1 Let L be the language recognized by a given automaton A. Then the
congruence relation ~ saturates L. In other words, for all "-'-equivalence classes
W, V, if A recognizes an (V-string from the language VW W, then A recognizes all
strings from V WW.

Proof. Let Wand V be "-'-equivalence classes. Suppose that there exists an


infinite string Of. such that

Of. = VW\W2 ... E VWWnL(A),


where v E V and each Wi E W, i = 1,2, .... Therefore, there exists a success-
ful run
r = SOs\ S2S3 ...
of the automaton A on the (V-sequence Of.. Since the run r is successful the infinity
set In(r) of this run has nonempty intersection with the set F.
From this run we obtain an infinite subsequence

of states such that the following properties hold:

1. The string v transforms So to q\.

2. For every i ::: 1 the string Wi transforms the state qi to the state qi+\.

Since In(r) n F =F 0, there exist infinitely many j from w such that


F
qi -----*Wj qi+l·
156 3. BUchl Automata

Suppose now that,B is an infinite word from V W"'. We have to prove that,B E L (A).
Since,B E VW'" there exist strings v' E V and w;
E W, where i ~ 1, such that

,B = v'wi w~w~w~ ....


Since Wand V are ~-equivalence classes, the strings Wi and w;,
i ~ 1, and v and
v' are ~-equivalent. Therefore, we obtain that v' transforms So to q], and for each
i ~ 1, the string w;
transforms the state qi to the state qi+]. Also, by the definition
of ~, the fact that

implies that
F
qj ----* Wi qj+]'
J

Therefore, there exist infinitely many j from w such that

qi ----* w; qi+]·
F

We now can conclude that there exists a run of A on the string ,B that is successful.
The lemma is proved.
Now our goal is to show that any infinite string a belongs to an w-language
V W'" for some ~-equivalence classes V and W. In order to show this we need
a deeper understanding of the relationship between inputs a and the equivalence
relation ~.

Definition 3.5.2 Let us fix an infinite word


a = a(O)a(1)a(2) ....
1. We say that a(i) is in position i a/the sequence a.
2. Two positions k and k' merge at position m if the finite words a(k, m) and
a (k', m) are ~-equivalent.
Of course, in this defini tion we assume that m > k and m > k'. In Figure 3.13
we present the definition pictorially.

a(k,m)

1 k'
a:
k
r a(k',m)
m-1t em

Figure 3.13: Positions k and k' merge at m.

Since ~ is a congruence relation, it is easy to see that the following fact holds.
3.5. The Complementation Theorem 157

Fact 3.5.1 If k and k' merge at m, then the positions k and k' merge at m' for all
m':;::m.O

Exercise 3.5.1 Check the correctness of the fact.

From the definition and the fact above we conclude that we can identify those
positions in ex that merge at some later position. More formally, the infinite string
ex defines in a natural way the following binary relation "'a on the set w.

Definition 3.5.3 Let ex be an w-word. We say that two positions k and k' are "'a-
equivalent, and denote this by k ~a k', if there exists an m such that k, k' < m and
the words ex(k, m) and ex(k', m) are ~-equivalent. Ifk and k' are ~a-equivalent,
then in order to specify a point m at which k and k' merge we write

k ~a k'(m).

The next fact shows the identifications of positions on the set w of natural
numbers via the relation ~a is indeed well defined.

Fact 3.5.2 The binary relation ~a is an equivalence relation on wand is offinite


index.

Proof. It is clear that ~a is a reflexive and symmetric relation. In order to


show transitivity of the relation ~ a assume that k] "'a k2 (m]) and k2 ~a k3 (m2)'
Let m be the maximum between m] and m2. Then using the previous fact we see
that k] ~ k3(m). Hence ~a is an equivalence relation. Now our goal is to show
that the equivalence relation ~a is of finite index. Assume that ~a is not of finite
index. Let m] < m2 < m3 < ... be an infinite sequence of numbers such that
mi and m j are not pairwise ~a-equivalent for all i f. j. Let p be the number of
~-equivalence classes of the congruence"'. Consider the positions

By the assumption and the definition of ~a, for every s > m p +], the words

ex(m], s), ... , ex(m p +], s)

are not pairwise ~-equivalent. This is a contradiction since'" is of finite index p.


Thus, the equivalence relation ~a is of finite index. This proves the fact.
Now using the fact that ~a is of finite index, we obtain the next result.

Fact 3.5.3 There exist infinitely many positions 0 < ko < k] < k2 < ... such
that all ki and kj are ~a-equivalent. 0

Exercise 3.5.2 Check the correctness of the above fact.


158 3. Buchl Automata

Now let ko, kl, k2, ... be the sequence from the previous fact. Consider the
following sequence of words:

Since ~ is of finite index, there exists an infinite subsequence

in the sequence above such that all the words in this subsequence are ~-equivalent.
Hence we have the next result, a stronger version of the previous facts.

Fact 3.5.4 There exist infinitely many positions 0 < ko < kl < k2 < ... such that
all ki and kj are ~Ol-equivalent andfor all i, j the words a(ko, ki) and a(ko, kj)
are ~-equivalent. 0

Let ko, kl, k2, ... be the sequence from the previous fact. We construct, by
steps, an infinite subsequence PO, PI, P2, ... such that for all i, j, the position Pi
merges with Pj at position Pi + 1 if i ~ j.
Step O. We set PO to be ko.
Step n + 1. Suppose that we have constructed
Po, PI,···, Pn

such that Pi ~Ol Pj(Pi+l) for all j :s i < n. There exists an m such that Pi
pj(m) for all i, j :s n. We now set Pn+1 to be the minimal ki such that m :s ki.
This ends the step. Go to the next step.
Thus we have the following result that is stronger than the previous fact.

Fact 3.5.5 There exist infinitely many positions ko < kl < k2 < ... such that the
following properties hold:

1. ko > O.

3. For all j, i such that j :s i, the positions ki and kj merge at ki+l, that is
ki ~Ol kj(ki+I). 0

Now we define the following two sets based on the sequence of the previous
fact:
v = {w Iw ~ a(O, ko)},

and
w= {w Iw ~ a(ko, kl)}.
3.5. The Complementation Theorem 159

Lemma 3.5.2 The sequence a belongs to V WW.

Proof. Consider the sequence

provided in the last fact. Note that by part 3 ofthe last facta(ki' ki+J) '" a(ko, ki+J).
But, by part 2 of the last fact a(ko, kJ) '" a(ko, ki+J). Hence a(ki' ki+l) E W. It
follows that a E V WW. For the reader we present a diagram of this reasoning in
the figure below.

a(ko, kl)

a:----t--------~-----------------L--------------~------
ko kl ki ki+l
. a(ko,ki)

Note thata(ki' ki+l) '" a(ko, ki+l) and a(ko, ki) '" a(ko, kj) for all i, j.
Thus the lemma is proved.
Now we are ready to prove the complementation theorem for Btichi automata.

Theorem 3.5.1 For any Biichi automaton A, there exists a Biichi automaton A'
which accepts exactly those w-words which are not accepted by A, that is,

L(A') = ~w \ L(A).

Proof. Consider the language L(A). Consider the congruence relation "'.
This relation is of finite index. Consider all ~-equivalence classes W, V such that
n
VWW L(A) =1= 0. By the previous two lemmas we see that

where the union is taken over all "'-equivalence classes V, W such that VWW n
L(A) =1= 0. Hence we conclude that

where the union is taken over all "'-equivalence classes V, W such that VWW n
L(A) = 0.
By the characterization theorem of Btichi recognizable sets we obtain that
there exists a Btichi automaton A' such that ~w \ L(A) = L(A'). The theorem is
proved. 0
An important conclusion is that in the proof of theorem above the automaton
that accepts the complement of L(A) can be constructed algorithmically given the
automaton A. We leave a proof of this fact to the reader in the exercise below.
160 3. Btichi Automata

Exercise 3.5.3 Show that there exists an algorithm which, given a Buchi automa-
ton A, produces a Buchi automaton A' such that L(A') = h W \ L(A).
Exercise 3.5.4 Let h be hi x h2. Consider an w-language Lover h. We define
the language VIL over hi as follows. An infinite string a E hI is in VI L if and
only iffor all fJ E h 2 we have

(a(O) , fJ(O))(a(l), fJ(l)) ... E L.

Show that if L is Buchi recognizable, then so is VI L.

3.6 l)eteruninisna
Understanding the interactions between determinism and nondeterminism is an
important issue in computer science, computability, logic and applications. There-
fore, each time a model of computation is introduced, the relationship between
determinism and nondeterminism becomes an interesting and natural topic. Au-
tomata theory is not an exception. The issue of determinism is in fact one of the
central topics in automata theory. In this section, using a characterization of w-
languages recognized by deterministic Btichi automata, we give an example of a
Btichi recognizable language which cannot be recognized by deterministic Btichi
automata. This example also shows that the class of w-Ianguages recognized by
deterministic Btichi automata is not closed under complementation. This, in some
sense a negative feature of Btichi automata, will motivate us to consider other
models of finite state machines, such as Mtiller and Rabin automata which will be
introduced later.
We again fix the alphabet h. We recall the definition of the set W, where
We h*:

W = {a E h* I there exist infinitely many n such that (a(O, n) E W)}.

It turns out that this definition is enough to characterize languages recognized by


deterministic Btichi automata and give a desired counterexample.
Let A = (S, so, T, F) be a deterministic Btichi automaton. Now let L(A) be
the w-language accepted by the Btichi automaton A. We can consider the automaton
A as a finite automaton. Consider the language W C h* accepted by the finite
automaton A. Our goal is to show that W= L(A).
We first prove that L(A) C W. Indeed, let a = a(O)a(1)a(2)a(3) ... be
an infinite input for the Btichi automaton A. We now can consider the run of the
Btichi automaton A
r = SOSI S2S3 ...
on the input (){. Note that this run is unique since A is deterministic. The Btichi
automaton A accepts the w-string

()( = a(O)a(1) ...


3.6. Determinism 161

if and only if In(r)n F =1= 0. Hence the Blichi automaton A accepts ex if and only
if there exist infinitely many prefixes of ex which transform the initial state So to a
final state from F. This sil1}ply means that ex belongs to the lan~uage W.
Now we prove that W C L(A). Let us consider the set W. Take an ex from
W. Take the computation r of A on ex. The computation is unique. By the definition
of ex there exist infinitely many prefixes of ex that belong to W. This simply means
that the infinity set In(r) of the computation intersects F. We conclude that ex is
recognized by A. Therefore, W C L(A).
Thus, we can formulate the following characterization theorem of languages
recognized by deterministic Blichi automata.

Theorem 3.6.1 A language L C ~w is recognizable by a deterministic Biichi


automaton if and only if there exists a finite automaton recognizable language
W C ~* such that L = W. 0

The next theorem shows that not all w-languages recognized by nondeter-
ministic Blichi automata are of the form W.

Theorem 3.6.2 There exists a Biichi recognizable language L which can be rec-
ognized by no deterministic Biichi automaton.

Proof. Suppose that the alphabet ~ is {a, b}. Consider the w-language L
which contains all infinite strings

ex = ex (O)ex(l)ex(2) ...
with finitely many occurrences of the input signal a. In other words, let L be

{ex E ~w I ex(n) = a for finitely many nEw}.


It follows from the definition that the language L coincides with the language

Hence by the Blichi characterization theorem, the language L is recognized by a


Blichi automaton.
Now we will show that L can be recognized by no deterministic Blichi au-
tomaton. Suppose that L is recognized by a deterministic Blichi automaton. By the
previous proposition, there exists an FA recognizable language

W c ~*

such that L coincides with W. Since b W ELand L = W, there exists a string b n1


such that b n 1 E Wand 1 ~ n 1. Since the string
162 3. Biiehl Automata

belongs to L, there must exist an n2 2: 1 such that the string bn1ab nz belongs to
W. Similarly, the infinite string

belongs to L. Henee there must exist n3 2: 1 such that the string bnlabnzabn3
belongs to W. Continuing this reasoning, we construct an w-word

where each nj 2: 1. This infinite string must belong to Wby the construction. But
this string does not belong to L by the definition of L. We have a contradiction.
The theorem is proved.

Exercise 3.6.1 Construct a Buchi automaton that recognizes ~{b}w.

Corollary 3.6.1 There exists a deterministic Buchi automaton A such that no


deterministic Buchi automaton recognizes the language ~w \ L(A).
Proof. Let L be the language constructed in the previous theorem. Consider
the alphabet ~ = {a, b}. Let V be the set of all finite words which end with a. In
other words,
V = {walw E ~*}.
The set V is recognizable by a finite deterministic automaton A. Let us consider A
as a Bi.ichi automaton. Then the deterministic Bi.ichi automaton A recognizes the
w-language V. Now the complement of V is exactly the w-language L constructed
in the previous theorem. By the theorem L cannot be recognized by a deterministic
Bi.ichi automaton. The corollary is proved.
Exercise 3.6.2 Show that the class of w-languages recognized by deterministic
Buchi automata is closed under the operations of union and intersection.

3.7 MUller Automata


A goal of this section is to introduce and study finite state deterministic machines
which make ongoing computations. We aim to show that such classes of machines
exist, and moreover, unlike Bi.ichi automata, we want to show that the comple-
mentation problem for these classes of machines has a positive solution. One can
easily find several reasons to be interested in such classes of finite state determin-
istic machines. One reason comes from finite automata theory where we showed
that nondeterministic and deterministic finite automata are equivalent. Therefore,
it is natural to ask if the same phenomenon occurs for finite state machines with
ongoing computations.
The second reason is the following. As we now know, constructing a Bi.ichi
automaton which accepts the complement of a Bi.ichi recognizable language re-
quires a nontrivial combinatorics and reasoning. So we are interested in whether
3.7. MUller Automata 163

the consideration of deterministic finite state machines makes the complementation


problem easier to solve. We will see that this will really be the case. Third, since
it turns out to be easier to solve the complementation problem for such machines,
we naturally ask whether these machines are in fact equivalent to BUchi automata.
Finally, the relationship between certain deterministic finite state machines and
BUchi automata is used to prove an unexpected result related to logic that shows
that the monadic second order theory and the weak monadic second order theory
of a natural fragment of arithmetic are equivalent. We will come to the last point
later in the final section of this chapter.
The most natural and basic idea in finding a new type of deterministic finite
state machines consists of reconsidering the notion of successful computation for
B Uchi automata. In this section we present two approaches for redefining the notion
of successful computation. The first approach belongs to MUller, who defined
deterministic finite state machines now called Muller automata, and the second
to Rabin, who defined deterministic finite state machines now called sequential
Rabin automata. This section studies MUller and sequential Rabin automata. We
will show in this section that these two classes of automata are in fact equivalent.

3.7.1 Motivation and Definition. In order to motivate the definition of MUller


automata, let us first consider the (V-language L over the alphabet {a, b} which
contains infinite strings a in which the symbol a occurs finitely often. By the
theorem of the previous section, no deterministic BUchi automaton recognizes this
(V-language L. However, let us consider the following finite state system. The
system contains two states only, say sO and s1. Suppose that sO is the initial state of
the system. Suppose that the system responds to signals a and b by the following
rules:
1. When the system is in state sO and input is a, it responds by going to state sO.

2. When the system is in state sO and input is b, it responds by going to state s1.
3. When the system is in state s1 and input is a, it responds by going to state sO.
4. When the system is in state s1 and input is b, it responds by going to state s1.
The transition graph of the system is presented in Figure 3.14.

a b

Figure 3.14
164 3. Btiehi Automata

Note that the system is deterministic. Importantly, we have not made any
commitment on final states. In particular, we have not declared what it means that
a given run of the system is successful. Let us now analyse the behavior of this
system when an input is an w-string ex such that ex possesses finitely many symbols
of a. Suppose ex is of the form
aOa! ... am_Jabbbbbbbbbb ....
In other words, suppose that a is in position m + 1 and is the last a occurring in
ex. If ex were an input to the system, then the system would produce the following
sequence of states:
sO ql ... qm sl sl 81 sl ....
Hence the infinity set of the above computation would be {sd. Suppose that ex
possesses infinitely many occurrences of a. If now ex were an input to the system,
then the system would produce the computation
r = sO pI p2 p3 ... ,

such that the infinity set/nCr) of this computation would be either {sO, sl} or {sO}.
Thus, this example suggests the following idea. If we declared the successful
computations of the system above to be exactly those whose infinity sets coincide
with {sl}, then the system would recognize the language L. Note that the sys-
tem is deterministic and no deterministic BUchi automaton accepts L. A careful
reader notices that we have made two changes in the definition of BUchi automata
with respect to the system above. The first change is that we declared the suc-
cessful computations r to be those whose infinity sets [nCr) coincide with {sJ}.
This contrasts with BUchi's definition of successful computation where we require
[nCr) n F =F 0. The second change is that in order for r to be a successful compu-
tation we require [nCr) to be a certain designated subset of the set of states. In our
example the designated subset is the set {sl}. This example shows that we could
make two changes in the definition ofBUchi automata. One change should concern
the notion of successful computation. The second change should concern the set
of final states. We are now ready to give a definition of MUller automata.
Definition 3.7.1 A Muller automaton over the alphabet ~ is a quadruple A =
(S, {so}, T, F), where
1. S is the finite set of states,
2. So E S is the initial state,
3. T is a mapping from S x ~ to S called the transition table,
4. F is a subset of peS) called the set affinal (designated) subsets.
We see that every MUller automaton is a deterministic system.
As for BUehi automata we can naturally define the notion of a computation
of the MUller automaton A = (S, {so}, T, F) on any given w-input
3.7. Muller Automata 165

Here is our stagewise definition of computation of A on (X.


Step O. The automaton A chooses the initial state so.
Step 1. The automaton A chooses the Sl E S which agrees with the transition
table, that is so that T (so, ao) = Sl.
Step k. Suppose that the sequence

SO,SI,···,sk

has been computed (defined). Then automaton A chooses the state Sk+ I E S which
agrees with the transition table, that is so that T (Sk, ak) = Sk+ I.
It follows that at each stage k E w, the state Sk+1 has been computed. Thus,
we can consider the w-sequence r of states

This sequence is called the run (computation) of A on a. Note that the computation
always exists and is unique since A is deterministic.
Now the analysis of the above example suggests the following definition of
successful runs.

Definition 3.7.2 The run (computation) r ofa Muller automaton A on an w-string


a is successful if the set of all states appearing infinitely often in the run r belongs
to F, that is if [nCr) E F.

Thus, in order for a Muller automaton A to accept an infinite string a we have


to check whether or not the infinity set [nCr) of the run r of A on a is designated
or not. If the infinity set is designated then A accepts a , otherwise not. Here is a
formal definition.

Definition 3.7.3 The Muller automaton A accepts (recognizes) an infinite string


a if the computation of A on the input a is successful.
There is an interesting intuition behind the definition of successful compu-
tation for Muller automata. Say A is a MUller automaton. We can look at each
designated subset B from F as a bag. Consider the computation r of A on a. Take
a bag B. As the computation proceeds we do the following. If the current state of
the run is s and belongs to B, then we put the state s into the bag B. Otherwise, we
go to the next step of the run and wait until the computation provides a state from
B in order to put the state into the bag. Whenever the bag B is already full (that is,
contains all the states which form the set B), then we make the bag B empty and
continue the computation. Now note that if the bag B is being emptied infinitely
often and from some point on all the states of the computation are put into B, then
the computation must be successful. Otherwise, the computation is not successful.
166 3. Biichi Automata

We keep the same notation: the set L(A) denotes the set of all w-words
accepted by the MUller automaton A.
Definition 3.7.4 An w-language L C I;w is Miiller recognizable if there exists a
Muller automaton A such that L = L(A).
Now we present an example of MUller automata and languages accepted by
these MUller automata.
Example 3.7.1 For the Muller automaton in Figure 3.15, the set F offinal sets
consists of {sO, sl}. This automaton recognizes the set of all the strings which
contain irifinitely many symbols a and b.

a b

Figure 3.15

Naturally by changing the set F of states we also change the language rec-
ognized. For instance, for the finite transition table in Figure 3.15 if F = {sO},
then the new automaton recognizes all the strings in which the symbol b occurs
finitely often. For this transition table we can also set F = {sl}. The automaton
with this final set recognizes all the strings in which the symbol a occurs finitely
often. Similarly, if we set F = {{sO}, {sO, sl}}, then the new MUller automaton
recognizes all the strings in which either both a and b occur infinitely often or b
occurs finitely often.
Exercise 3.7.1 What languages are accepted by the following Muller automata?
1. Consider the Muller automaton whose transition graph is presented in Fig-
ure3.16.

Figure 3.16

In this diagram F consists of {s2} and {sO, sl, s3}.


3.7. Mi.iller Automata 167

2. Consider the Muller automaton pictured in Figure 3.17.

Figure 3.17

In this diagram F contains {s2} and {sl} only.


3. Consider the Muller automaton in Figure 3.18.

b b

Figure 3.18

The set offinal subsets of this automaton consists of {sl, s2} and {sl}.
Thus, having discussed all the examples and exercises above, the following
somewhat philosophical questions arise naturally:
1. What is the relationship between deterministic Buchi automata and Muller
automata?
2. How powerful are Muller automata?
3. What is the relationship between Buchi and Muller automata?
We partially answered the first question in our discussion at the beginning
of this section. We proved that MUller automata may recognize languages not
recognized by deterministic BUchi automata. In the next subsection we give a full
answer to the first question. The full answers to the second and third questions will
have to wait until the next sections.

3.7.2 Properties of Miiller Automata. We want to show that the class of MUller
recognizable languages is quite rich. This is provided in the next simple theorem.
The theorem shows that the class of Muller recognizable languages contains the
class of languages accepted by deterministic BUchi automata. Moreover this inclu-
sion is proper as we know from the previous subsection.
168 3. Btiehi Automata

Theorem3.7.1 LetA = (S, {so}, T, F)beadeterministicBuchiautomaton. Then


there exists a Muller automaton A' such that L(A) = L(A').

Proof. Let A = (S, so, T, F) be a deterministic BUchi automaton. Note


that if A accepts a and r is the successful run of the automaton A on a, then
In(r) nF =1= 0. Therefore, this suggests to declare the set F of the desired Milller
automaton to contain all the subsets of S which have nonempty intersection with
F. Formally, the MUller automaton A' = (S, {sb}, T', F') is defined as follows:

1. The set S' of states is S.

2. The initial state sb is so.

3. The transition table T' is T.

4. The set :P of final subsets is

F' = {G I G n F =1= 0}.

Thus, the transition table of the Milller automaton A' coincides with the transition
table of the BUchi automaton A. Now we leave the rest of the proof to the reader
to show that L(A) = L(A'). The theorem is proved. D

Exercise 3.7.2 Finish the proof of the theorem above.

As it is expected, the next theorem shows that MUller automata recognizable


languages are closed under the set-theoretic operations of union, intersection, and
complementation. In contrast to BUchi automata, it is of course worth noting that
the complementation problem for MUller automata is solved almost immediately.
Here is the result.

Theorem 3.7.2 Let Al and A2 be Muller automata. Then

1. the complement b'" \ L(AJ} is Muller recognizable;

2. the union L(AI) U L(A2) is Muller recognizable;

3. the intersection L(AI) n L(A2) is Muller recognizable.


Proof. We begin by proving the first part of the theorem. Suppose that A =
(S, so, T, F) is a MUller automaton. Every w-string a determines a unique com-
putation rex of the MUller automaton A on the input a. Therefore, a E b'" \ L (A)
if and only if the computation rex of A on a is not successful. Hence a is not recog-
nized by A if and only if In (rex ) does not belong to F. Thus, a is not accepted by A
if and only if In (rex ) belongs to 2 s \ F. Therefore, we conclude that the w-Ianguage

b'" \ L(A)
3.7. Miiller Automata 169

is recognized by the Muller automaton (S, so, T, 2 s \ F).


We now prove the second part. Let A; be (Si, {SO,i}, T;, Fi), i = 1,2. The
idea of constructing the desired A is very similar to the one for finite automata
and Buchi automata. So, we define the Muller automaton A = (S, /, T, F) which
accepts L(AI) U L(A2) as follows:
1. The set S is SI x S2.

2. The initial state is (so, I, SO,2).

3. The transition table T is defined naturally: for all Sl E SI and S2 E S2, we


set T(a, (Sl, S2» = (TI (a, sj), T2(a, S2».
4. We define F as follows:

{(Sl, sp, ... , (Sk, s~)} E F if and only if {Sl, ... , sd E


FI or {s;, ... , s~} E F2}.

One now can prove that the Muller automaton A accepts the union of the languages
L(A) and L(A').
The proof of the last part follows now easily from the previous two parts
since we can express the intersection of two languages by means of the operations
of union and complementation. This proves the theorem. D

Exercise 3.7.3 Give a detailed proof of the second part of the theorem above.
Exercise 3.7.4 Prove that the intersection of two Muller automata recognizable
languages is Muller recognizable by directly constructing a Muller automaton that
recognizes the intersection.

In connection with the theorem above we would like to make the following
comment. We know that the class of Buchi recognizable languages is closed with
respect to the projection operation, and a proof of this fact is easy. Note that
we have not investigated the question as to whether the class of Muller automata
recognizable languages is closed under the projection operation. It turns out that it is
not so easy to prove that the class of Muller recognizable languages is closed under
the projection operation. This closure property follows from the McNaughton's
theorem which will be proved later.
We now characterize Muller recognizable sets in terms of sets of the type
W, where W c ~* is FA recognizable language. We need the following simple
definition.

Definition 3.7.5 A Boolean combination of sets AI, ... , An is a union CI U ...


U Cn, where each Ci is either Ai or the complementation of Ai, and nEw.
Here is the characterization theorem for languages recognized by Muller
automata.
170 3. Btiehl Automata

Theorem 3.7.3 (Characterization Theorem of Miiller recognizable languages)


An w-Ianguage L C I;w is Muller recognizable if and only if L is a Boolean
combination of sets of the type W, where each W C I;* is from the Boolean
combination and is FA recognizable.

Proof. Suppose that the language W C I;* is FA recognizable. By the char-


acterization theorem oflanguages recognized by deterministic BUchi automata, the
language Wis accepted by a deterministic BUchi automaton. Therefore, the lan-
guage Wis recognized by a Muller automaton which follows from Theorem 3.7.1.
From the yrevious theorem, we see that any Boolean combination of the sets of
the type W, where each W is FA recognizable, is MUller recognizable.
Suppose that the language L C I;w is recognized by a Muller automaton
A = (S, {so}, T, F). For each state q E S, we can consider a deterministic finite
automaton
Aq = (S, {so}, T, {q})
over the alphabet I;. Let Wq C I;* be the language recognized by the finite
automaton Aq. By the definition of the successful run for MUller automaton, A
accepts an w-word ex if and only if there exists a Q E F such that for every q E Q
the word ex belongs to Wq and for every PES \ Q the word ex does not belong to
Wp. Thus, one can see that the following equality holds:

L(A) = U
QEF
[(n n(n
qEQ
Wq )
qES\Q
-,Wq ) ] .

This proves the theorem.


Exercise 3.7.5 Finish the proof of the theorem by checking the correctness of the
equality above.

3.7.3 Sequential Rabin Automata. We first give a brief motivation to recon-


sider the notion of successful run for deterministic finite state machines. Assume
that we have a finite state deterministic machine A. Say that machine is reading
an infinite input and producing the sequence of states

It may well be the case that certain states of the machine might be associated with
undesirable events. We call such states negative states. Therefore, we would like
our machine A to avoid all of these negative states during the computation. This
can be thought as that the accumulation of negative phenomena during the com-
putation may lead to some undesirable results, e.g., a crash of the machine. On
the other hand, it may well be the case that certain states of the machine can be
associated with certain desirable events. We call such states positive states. There-
fore, we would like our machine A to enter at least some of these states infinitely
3.7. MUller Automata 171

often. This can be thought as that the accumulation of the positive phenomena
during the computation lead us to certain desired results, e.g., satisfaction of some
specifications. Therefore, we would like to understand those infinite sequences of
inputs that make the machine go through positive states by avoiding all negative
states. Based on this we give the following definition.

Definition 3.7.6 A sequential Rabin automaton over ~ is of the form (S, {so},
T, Q), where S, so, and T areexactlyasforMulierautomata, andQ is the collection

of pairs (Ni, Pi), called accepting pairs, such that Ni, Pi are subsets of S, i
1, ... , t.

Note we used the notation (N, P) for accepting pairs to stress that some
states during certain behavior are considered to be negative and some positive.
Let A be a sequential Rabin automaton. One can naturally define the notion
of computation for sequential Rabin automata. Since the transition table T is
deterministic, each infinite input ot produces a unique computation r. We say that
the computation r of the sequential Rabin automaton A on the input ot is successful
if there exists an i, 1 :s i :s t, such that

[nCr) n Ni =0 and [nCr) n Pi =1= 0.

If the Rabin automaton A has a successful computation on ot, then we say that ot
is accepted. Thus, informally a sequential Rabin automaton A accepts a string ot if
during the computation of A on ot certain desirable events happen predominantly
(infinitely often) while certain negative events stop happening after some time.
Now for any sequential Rabin automaton A, we can consider the set L(A) of all
w-words accepted by A.
It turns out that the computational power of MUller and sequential Rabin
automata coincide, that is, MUller and sequential Rabin automata recognize the
same w-languages. The next two theorems provide a very elegant proof of this
interesting fact. The first theorem is the easiest to prove.

Theorem 3.7.4 For any sequential Rabin automaton A = (S, {so}, T, Q) there
exists a Muller automaton A' such that L(A) = L(A' ).

Proof. Let A = (S, {so}, T, Q) be a sequential Rabin automaton. Suppose


that Q is the collection of accepting pairs

Consider the finite deterministic automaton


172 3. Btiehl Automata

Let Wi be the language accepted by this finite automaton. Consider the finite
deterministic automaton

Let W{ be the language accepted by this finite automaton. It is not hard to see that
we have the equality

n-'W{).
p

L(A) = Un,vi
i=l

By the characterization theorem of MUller recognizable languages, Theorem 3.7.3,


the (V-language L(A) is recognized by a MUller automaton. The theorem is proved.

Exercise 3.7.6 Prove the equality L(A) = U;=l (Wi n-, W{) stated in the proof
of the theorem above.

We now prove the second, a harder theorem. The theorem shows us how to
construct a sequential Rabin automaton from a given MUller automaton so that the
two automata recognize the same language.

Theorem 3.7.5 For any Muller automaton A = (S, {so}, T, F) there exists a
sequential Rabin automaton A' such that L(A) = L(A /).

Proof. Suppose that A = (S, {so}, T, F) is a MUller automaton. Consider


the set
F={QI, .. ·,Qd
of the designated subsets of the automaton A. We now try to explain the idea of
constructing a sequential Rabin automaton which accepts the language recognized
by A. A naive idea would be to consider the sequential Rabin automaton A' =
(S, {so}, T, Q), where Q is defined as

It is not hard to see that if the MUller automaton A accepts ex, then ex is accepted
by the sequential Rabin automaton A' defined above. However, if ex is accepted
by A', then it does not generally imply that ex is accepted by A (see exercises just
after the theorem).
We follow another approach. Take an infinite input ex. Consider the compu-
tation r of the MUller automaton A on ex. With each Q i, we associate a bag Bi
into which we put state s appearing in the computation r if s belongs to Q i. So
the bag Bi may grow. If the bag Bi contains all states from Qi, then we empty the
bag and wait for a state s E Qi to appear in the computation at a later stage with
the purpose of putting s into the emptied bag Bi. The point is that if ex is accepted,
then Bi is emptied infinitely often. If ex is not accepted, then for every i either

1. the bag Bi becomes a proper subset of Q i , or


3.7. MUller Automata 173

2. there is a state s E S that appears infinitely often in r and does not belong
to Qi.
Can this idea be implemented for constructing a desired Rabin sequential automa-
ton? Well, we need to have a finite amount of memory to remember the current
states in each bag Bi. In other words, we just need to know all the subsets of Qi.
We also need to know the current state of the original MUller automaton. These ob-
servations suggest that we should take the states of the Rabin sequential automaton
we want to construct to be the tuples of the type

where each Si is a subset of Qi and s is a state of A. Note that the number of such
tuples is finite. Hence we may implement the idea described above using a finite
amount of memory. This should be enough.
Now we formally define the desired Rabin sequential automaton A' =
(S', I', T', [2') as follows:
1. S' is the set 2Q\ x ... X 2 Q, x S.

2. The initial state sb is (0, ... , 0, so).


3. Suppose that s = (S], ... , St, s) E S' and a E Z:. Then T(s, a) is the state
s' = (S; , ... , S;, s') such that the following conditions hold:

(a) T(s, a) = s'.


(b) If Si = Qi, then S; = 0. If Si f=. Qi, then S; = (Si U{s'Dn Qi,
i=I, ... ,t.

4. Pi = {(S], ... ,Si, ... ,St,s) I Si = Qi}, i = 1, ... ,t.

5. Ni = {( S] , ... , Si, ... , St, s) I s It' Q i}, i = 1, ... , t.


We prove that any string accepted by the MUller automaton A is accepted by the
sequential Rabin automaton A'. We leave the reader to prove the other direction
(see Exercise 3.7.7). So assume that ex is accepted by A. Let r be the run of A
on ex. Then r is a successful run. Therefore, In(r) = Qj for some j, 1 :s j :s t.
Let r' be the run of A' on ex. Then, by the definition of Pj it must be the case
that In(r')n Pj f=. 0 (since the bag B j is emptied infinitely often). Also note that
In(r') n Nj = 0. Otherwise there would exist a state (S], ... , Sj, ... , St, s) E Nj
that appeared in the run r' infinitely often. Hence, by the definition of Nj we have
s It' Q j. Now note that the last coordinates of the states of the automaton A'
simulate the runs of the original automaton. Therefore, the projection of r' on the
last coordinate is the run of the original MUller automaton on the input ex in which
the state s It' Qj appears infinitely often. Hence A does not accept the string ex.
This contradicts the assumption that A accepts ex. The theorem is proved.
Now the following corollary is immediate.
174 3. Btiehl Automata

Corollary 3.7.1 The class oJ languages recognized by Rabin sequential automata


is closed under the operations of union, intersection, and complementation. D

Exercise 3.7.7 Finish the proofof the second part ofthe theorem above by proving
that all the strings accepted by the automaton A' constructed are also accepted by
the original Muller automaton A.

Exercise 3.7.8 Let A = (S, {so}, T, {QI,"" Qt) be a Muller automaton. Con-
sider the sequential Rabin automaton A' = (S, {so}, T, [2), where [2 is defined as

Give an example of an A such that L(A) is a proper subset of L(A').

Exercise 3.7.9 Convert each ofthe following Muller automata A into a sequential
Rabin automaton A' so that L(A) = L(A'):

1. a b

In this diagram F consists of {sl}.

2.

In this diagram F contains {s2} and {sl} only.

3.

The set offinal subsets of this automaton consists of {s2} and {sl}.
3.8. The McNaughton Theorem 175

3.8 The MeN aughton Theorem


In this section we will provide a proof of the famous result first proved by Mc-
Naughton. We will show that Milller automata recognize the same class of lan-
guages accepted by Bilchi automata. This result leads us to the following con-
clusions. First of all this result shows that in some sense Bilchi automata can be
determinized. Second, the McNaughton theorem gives another proof of the com-
plementation theorem for Bilchi automata. Finally, this result also shows that the
projection of Milller recognizable language is again Milller recognizable.
Here are a few words about how we intend to prove the theorem. We know that
a Bilchi recognizable (V-language is a finite union of (V-languages of the form V WW,
where V, Ware FA recognizable. We know that the class of Milller recognizable
languages is closed under union. Hence it is sufficient to prove that the languages
of the form V WW, where V, Ware FA recognizable, are Milller recognizable. This
will be the purpose of the next two subsections.

3.8.1 Flag Points. The goal of this subsection is to prove the following fact.
If W c I;* is an FA recognizable language and W . W c W, then WW can
be presented as W W+ for some Milller recognizable language W+ so that W+
has certain desirable properties. We note that the condition W . W c W is one
of the conditions put on W in the second Bilchi's characterization theorem. In
this subsection we also introduce the notion of flag points which is an important
technical tool in proving the McNaughton Theorem. We also note that the desired
properties of the language W+, mentioned above, will be defined using the notion
of flag points.
Let us fix a deterministic finite automaton A = (S, {so}, T, F). Consider the
language W C I;* recognized by this automaton. As the transition table T is a
function from S x I; to S, we can naturally extend T to the function, also denoted
by T, from S x I;* into S as follows. Let s E Sand W E I;*. Then there exists a
unique computation
Sl,···, Sm+l
of A on w which begins from s, that is Sl = s. Then we set T (s, w) to be equal
to Sm+l. Thus, the string w transforms the state s to the state T(s, w). We now
present a definition of flag points, the main technical notion needed to prove the
McNaughton theorem.

Definition 3.8.1 Take a E I;w. We say that the position i on a is a flag point of a
if there exists a position j < i, called an associated (with i) point, such that the
following properties hold:

1. The word a(O, j) belongs to W.

2. T(so, a(j, i)) = T(sQ, a(O, i)).

3. For all k such that j < k < i, T (sQ, a(j, k)) "I T (sQ, a(O, k)).
176 3. Biichi Automata

We present the definition in the figure below.


a(j, i)
a(O, j) E W

a(D, i)

Here T(so, a(j, i)) = T(so, a(O, i)).


Informally, a flag point is a string a(O, i) that witnesses a word a(O, j) from
°
W, where j < i, in such a way that the positions and j merge at i for the first
time after j. Here is a simple corollary which follows from the definition of a flag
point.
Lemma 3.8.1 Suppose that il and i2 are distinct flag points ofa. Then the asso-
ciated points jl and Jz, respectively, are distinct.

Proof. Suppose that i I < i2. Suppose that jl = iz. Then T (so, a(jl' i I)) =
T(so, a(O, il)) by condition 2 posed on the flag point il. On the other hand, this
cannot happen since T(so, a(h, k)) =1= T(so, a(O, k)) for all k such that h < k <
i2 by condition 3 posed on the flag point i2. This is a contradiction. The lemma is
proved.
We now define the (V-language W+ as follows.
Definition 3.8.2 W+ = {a I a has infinitely many flag points}.
Our first lemma about W+ shows that W+ is a subset of WW.
Lemma 3.8.2 The (V-language W+ is a subset of WW.

Proof. Suppose that a E W+. By the definition of W+, the word a must
have infinitely many flag points. Let

be infinite sequences of flag points and the associated points, respectively. By the
previous lemma we may assume that

jl < il < iz < i2 < 13 < i3 < ....

Now, by the definition of flag point, we have a(O, iJ) E W. We will prove the
lemma if we can show that a(ik, jk+l) E W for all k. This is easy to prove and
follows from the definition of flag point. Indeed, first of all note that

We denote the state T(so, a(O, h)) by s. Now we can make the following calcula-
tions:
3.8. The McNaughton Theorem 177

In turn

Now note that we have a(jk, ik+l) E W since a(O, jk+l) E W. In the figure below
we present a pictorial presentation of the proof for the case of jl and h

Ol(jz, i2)
Ol(h, il)
Ol(O, h)

h i] 12 i2
Ol(O, il)

Ol(h, h)

Thus, we conclude that a(jk, ik+l) E W for all k. Hence a E WW. The lemma is
proved.
Now our goal is to show that under certain natural conditions on W, W . W+
is in fact WW. One such condition is given in the next definition.

Definition 3.8.3 The language W C b* is closed if W . W C W.

Here now is the next lemma.

Lemma 3.8.3 If W is closed, then WW =W . W+.

Proof. By the previous lemma W+ C WW. Therefore, we have the inclusion


W . W+ C W . Ww = WW. Hence, we need to prove that WW C W . W+. In order
to prove this fact we borrow some ideas used in the proof of the complementation
problem for Btichi automata.
Suppose that a belongs to WW. Hence there exists a sequence

h<h<h<'"
of positions in a such that a(O, h) E Wand a(ik, jk+]) E W for all k :::: 1.
Say that the positions n, s are a-equivalent if there exists an m > n, s such that
T(so, a(n, m)) = T(so, a(s, m)). In other words, if n, s are a-equivalent, then the
initial state So cannot distinguish the strings a(n, m) and a(s, m) from each other.
We denote this relation by =a. Note that the relation is indeed an equivalence
relation. Since the set S is finite, from the definition of the equivalence relation =a
we see that =a has at most lSI number of equivalence classes. Therefore, we can
178 3. Buehi Automata

assume, if necessary going to a subsequence of the original sequence j], h, ...


and reenumerating the subsequence, that in the above sequence

j]<h<13<···

all the numbers ik, in are =a-equivalent. Importantly, since W is closed, we still
can assume that a(Jk, ik+l) E W for all k ~ 1. Note that we have

a = a(O, i])a(j], w),

where a(O, il) E W. We need to show that a(j], w) E W+. Since j] is =0'-
equivalent to Jz, there is an m such that T(so, a(j], m» = T(so, a(Jz, m». So
we can pick up the minimal such m. Note that a(jl, h) E W by the choice of
the sequence iI, h, 13, .... Hence m is a flag point for the sequence a(jl, w)
whose associated point is h. Take is such that is > m. Since W is closed, we
see that the string a(jl, is) E W. There is an ml such that T(so, a(jl, mj» =
T(so, a(js, mj). So we can pickup the minimal such mI. Note thata(jl, is) E W.
Hence ml is a flag point for the sequence a(j], w) whose associated point is is.
We continue this procedure and see that a (j] , w) possesses infinitely many flag
points. We conclude that a(j], w) belongs to W+. Hence W· W+ = Ww. The
lemma is proved.

Exercise 3.8.1 Show that the relation =0' introduced in the lemma above is indeed
an equivalence relation offinite index.

Lemma 3.8.4 The set W+ is recognizable by a Muller automaton.

Proof. We show that W+ can be presented as V for some FA recognizable


language V. By the characterization theorem of MUller recognizable languages (see
Theorem 3.7.3), this will show that W+ is recognizable by a MUller automaton.
Let us define the set V. Informally, V is the set of all finite words w which are
flag points of some infinite strings. Formally we define V as follows. The string v
belongs to V if and only if v satisfies the following conditions:

1. There exists a proper prefix VI of v such that VI E W.

2. Let v = VI V2. Then T(so, v) = T(so, V2).

3. For any proper prefix V3 of V2, it is not true that T(so, v) = T(so, V3).

It is clear that W+ = V. Indeed, a belongs to W+ if and only if a has infinitely


many flag points if and only if there exist infinitely many i such that a(O, i) E V.
Hence to complete the proof, we only need to show that V is FA recognizable.
Here is an informal explanation of a finite automaton Al accepting the lan-
guage V. Having an input v, Al simulates the original automaton A. As soon as
A reaches its final state after reading a prefix VI of v, Al has two choices to make.
3.8. The McNaughton Theorem 179

The first choice is that Al can just continue simulating A The second choice is
the following. Al can begin reading the rest of the input as a new input V2 to A
Doing this Al has to check the fact that every proper prefix V3 of V2 and the string
VI V3 distinguish the initial state of A
Below we define the automaton Al = (SI, II, TI, FJ} with comments in
double brackets [[like this]] using the informal explanation above.

1. The set SI of states is SUS x S U{f}, where f tj. S. [[The states from S are
needed to simulate A. The states from S x S are needed to simulate two copies
of A: one copy will continue to simulate A on the rest of any given input V,
the other copy will read the remaining V2 of the input from the initial state
of A. The state f is needed to detect the fact that T(so, V3) = T(so, VIV3)
and stop reading the input after VI V3 is read.]]

2. The initial state so, I is the initial state So of A I.

3. The transition table TI is defined as the union of the sets below:

(a) T [[Thus, TI can simulate the original automaton A]],


(b) {(s, a, (so, S2» I T(s, a) E F, (s, a, S2) E T} [[As soon as the au-
tomaton Al detects the fact that some initial segment VI of an input V
is in W, the automaton makes two copies of itself: the first copy con-
tinues simulating A in the remaining V2 of the input, while the second
copy begins reading the rest V2 by copying A from the initial state
of A]],
(c) {(Sl' S2), a, (si, s~» I (Sl, a, si), (S2, a, s~) E T},
(d) {((s, s), a, f) I s E S}. [[As soon as the automaton detects the fact
that T(so, V3) = T(so, VI V3), the automaton goes into the state f, the
failing state, whatever the next input signal is.]]

4. FI = {(s,s)ls E S}.[[TheautomatondetectsthefiagpointwhenT(so,vIV3)
= T(so, V3).]]
We now leave the reader to check that the automaton Al is the desired one (see
the exercise below). The lemma is proved.

Exercise 3.8.2 Finish the proof of the lemma.

3.8.2 The Theorem. Now we are ready to formulate the theorem. The proof of
the theorem is due to Rabin.

Theorem 3.8.1 For any Buchi automaton there exists a Muller automaton such
that both automata recognize the same language.
180 3. BUehl Automata

Before going into the poof we present our plan of proving this theorem. We
know from Bilchi's second characterization theorem that any Bilchi recognizable
language L is a finite union of languages of the type V WW, where V and W are
FA recognizable and W . W c W. Take V WW from this finite union. The previous
subsection showed that WW can be presented as WW+, where W+ is Milller
recognizable. So VWw equals VWW+. Hence we need to prove that (VW)W+
is Milller recognizable. This will be proved in the lemma below. The lemma is by
itself of independent interest for two reasons. First, the lemma gives an example of
a natural operation which produces (V-languages recognized by sequential Rabin
automata and hence by Milller automata. Second, the lemma is in fact a beautiful
and core part of the proof of the McNaughton theorem.

Lemma 3.8.5 Let W C b* be an FA recognizable language. Let L C b W be


recognizable by a sequential Rabin automaton. Then the (V-language W L is also
recognizable by a sequential Rabin automaton.

Since sequential Rabin automata and Milller automata are equivalent, we


obtain the following corollary.

Corollary 3.8.1 Let W C b* be an FA recognizable language. Let L C b W be


recognizable by a Muller automaton. Then the (V-language W L is Muller recog-
nizable.D

We show how this lemma and corollary imply the McNaughton theorem and
then we will give a proof the lemma.
Proof of Theorem 3.8.1. Assume that the lemma above holds. Let L be Bilchi
recognizable. Then L is a finite union of (V-languages VW W, where V and Ware
FA recognizable languages such that W . W C W. By the results of the previous
subsection, W+ is Milller recognizable and WW = W . W+ since W . W C W.
Hence L can be presented as a finite union of (V-languages VWW+, where V
and Ware FA recognizable languages and W+ is Milller recognizable. Note that
V W is FA recognizable. By the lemma and the corollary above V W W+ is Milller
recognizable. Since the class of Milller recognizable languages is closed under
union, we see that L(A) is recognizable by a Milller automaton. This proves the
theorem.
Thus, we are left with the proof of the lemma stated above.
Proof ofthe Lemma. Suppose that W is recognized by the finite deterministic
automaton A I = (S I , {so, I}, TI, FI). Let L be recognized by the sequential Rabin
automaton A2 = (S2, {SO,2}, T2, Q2), where Q2 = {(NI, PI),"" (Nt. Pr)}. We
want to construct a sequential Rabin automaton A that recognizes W L. The se-
quential Rabin automaton A will check whether or not a belongs to W L, that is,
if there exists an i such that a(O, i) E Wand a(i, (V) E L.
3.8. The McNaughton Theorem 181

Take an a E L;w. Consider a run of Al on a. 4 Since Al is deterministic, the


computation is unique. Let rl be the computation of Al on a. Note that for all
i > 0, a(O, i) E W if and only if rl (i) E Fl.
Suppose that rl (i) E Fl. Then we can consider the run (which begins from
the initial state) of A2 on aCi, w). We denote this run by ri. Hence ri (0) = sO,2.
Now note that by the definition of the acceptance of sequential Rabin automata,
a(i, w) is recognized by A2 if and only if there exists a j such that In(ri) Nj = 0 n
and In(ri) n Pj =F 0.
We now try to explain the basic idea of constructing the desired sequential
Rabin automaton A. We want to monitor all runs ri of the automaton A2 starting
at those positions i on a for which the computation rl of Al gives rl Ci) E Fl.
Potentially, there could be infinitely many positions i at which the run rl enters the
final states of AI. Hence there could be infinitely many runs ri of the automaton
A2. Can we control all these runs by using a fixed finite amount of memory?
Informally, we can indeed control all these computations because of the following.
Take a position k. Consider all the runs ri of A2 that occur before the position k is
reached, that is, we consider all ri such that a(O, i) E Wand i < k. Since the set
S2 is finite, the various computations ri, i < k, are at the position k in at most IS21
number of pairwise different states. Therefore, we conclude that if ril and r iz are
such that iI, i2 < k and these runs enter, at the position k, into same state, then we
simply identify (merge) these two runs after k and continue with just one of these
two runs. This means that at position k we need to remember at most IS21 number
of configurations and the current state of AI. We formally define the following
notion related to this discussion.

Definition 3.8.4 The computations (which beginJrom the initial state oj A2) ril
andr iz merge at the position k oJan w-inputfJ, where it, i2 < k, ifri1(k) = r i2 (k).

Now we want to implement the above explained ideas carefully in order to


construct the desired automaton A. Consider the set S2 of states of the automaton
A2. Let s be
s(0)s(1)s(2) ... s(k - 1)

a sequence of states, that is s E S*. Take the sequence

il < i2 < ... < im S k - 1,

where the members of this sequence are inductively defined as follows: i I = 0, it+ I
is the minimal i > it such that sCi) =F SCil), ... , sCi) =F sCit)' and t + 1 S k - 1.
We set

4We note that of course, A 1 is a finite automaton. However, one can naturally consider computations
of Al on infinite inputs. If one wants to be precise, then one should think of A 1 as a BUchi automaton.
182 3. Btiehl Automata

Informally, D(s) "contracts" s keeping only distinct states in the order they appear
in s. We call the sequence s a display if D(s) = s. The display operation will be
used to merge computations, as we explained above. Also note that the number of
displays is finite.
For a given sequence s we also define the number, denoted by (.-L(s), which
is the largest i such that the sequence

s(O)s(l) ... sCi)

is a display. Clearly, (.-L(s) :s lSI·


Before we give a formal definition to the desired A, we provide a stagewise
procedure whose aim is to give an explanation behind the definition of A. Basically
the procedure provides a run of the desired sequential Rabin automaton A on a
given input a. At each step of the procedure we write comments written in double
brackets [[like this]] that explain informally the intention behind each action. We
also need to extend the transition table T2. The extension naturally extends the
transition map

to the map, also denoted by T2,

as follows:

T2(S(0)s(l) ... s(k - 1), a) = T2(S(0), a) ... T2(S(k - 1), a).

Here is a description of the procedure:


Step O. Set So = So, I, So = A, (.-LO = O. Record the tuple (so, so, (.-Lo). [[The
first component of the tuple is ready to begin a computation of AI, the second
component is simply the empty display that waits for a state from FI to appear,
and the last component is the length of the display.]]
Step k + 1. Assume that at the previous stage we recorded the sequence:

so that the sequence so, ... , Sk is the computation of Al on theprefixa(O) ... a(k-
1), Sk is a display, and (.-Lk is a number less than or equal to IS21~ We define the next
tuple (Sk+ I, Sk+ I, (.-Lk+ I) as follows:

1. Sk+1 = TI (Sk, a(k)). [[So we see that the first component is simply simulat-
ing the finite automaton Al on input a.]]

2. To define the second component we have two cases:


3.8. The McNaughton Theorem 183

(a) Supposethatsk E Fl. [[Hence a (0, k) E W]]Thensk+1 = D(T2(SkSO.2,


a(k». [[D merges some of the computations of A2 if required; A2 be-
gins a computation on a(k, w).])
(b) Suppose that Sk rf- Fl. [[Hence a(O, k) rf- W.]] Then Sk+1 = D(T2(Sk,
a(k». [[D merges some of the computations of A2 ifrequired.]]

3. If Sk E FI, then /1-k+1 = /1-(T2(SkSO,2, a(k)). If Sk rf- FI, then /1-k+1 =


/1-(T2(Sk, a(k». [[Thus, /1-k+1 is the number of all distinct states to which
runs ri with i < k enter.]]

Now we begin our definition of the desired sequential Rabin automaton A =


(S, I, T, Q).
1. The set S of states of A is

{(sl,s,i) lSI E SI,D(s) =s,i:::: lSI}.

2. The initial state of A is (so, I, A, 0).

3. Using the extended T2, we define the transition table T of the desired au-
tomaton A as follows.

(a) If SI rf- FI, then

(b) Ifs, E FI,then

4. Finally, we need to define Q, the set of accepting pairs. For every k, °: : k ::::
ISI and accepting pair (Ni, Pi) from the automaton A2, we set

Pi,k = {(SI,S, j) lSI E SI and s(k) E Pd,

and
M,k = {(SI, S, j) I (SI E S, and s(k) EN;) or j < k}.

Now our goal is to show that A recognizes the language W L.


Suppose that a belongs to W L. We choose the least number i such that
a(O, i) E Wand a(i, w) E L. Let us consider the computation r of A on this
input a:
r = fo, fl, ... , fi, t;+I, ....
Note that to = (so, I, A, 0). Suppose that each state tj in this computation is of the
form (s j, s j, n j), where s j = s j (0) ... s j (k j -1) with s j (0), ... , Sj (k j - 1) E S2,
184 3. Btichi Automata

and kj < IS21. Now note that Si E FI since a(O, i) E W. Moreover, neither of
Si(O), ... , si(ki - 1) equals SO,2. Otherwise, there would be a prefix a(O, k) of
a(O, i) such that a(k, w) E L, which would contradict the choice of i. Now note
that ti+1 is
(Si+l, T2(SiSO,2, a(i)), f..L(T2(SiSO,2, a(i))).
The computation of the sequential Rabin automaton A2:

on a(i, w) is successful. Hence there exists an T such that In(r2) nP r f= 0 and


In(c2) n
Nr = 0. Moreover this run will never merge with the run

T2(Si(m), a(i)), T2(T2(si(m), a(i)), a(i + 1)), ... ,

where °: ;m ::; ki - 1. Again, otherwise it would contradict the choice of i.


Therefore, we conclude that there must exist a k ::; ki such that In(c) Pr,k f= 0 n
n
and In(c) Nr,k = 0. This proves that a is accepted by the sequential Rabin
automaton A.
Suppose that a is accepted by A. We need to show that a E W L. Let us
consider the computation r of A on a:

r = to, tl, ... , ti, ti+l, ... ,


where each tj is (s j, S j, n j) as in the notation above. There exist T, k such that
In(c) n Pr,k f= 0 and In(c) n Nr,k = 0. Take the least m such that for all j > m,
tj ~ Nr,k. It follows by the definition of Nr,k that S j (k) exists and does not belong
to Nr . The sequence
Sm(k)Sm+1 (k), sm+2(k) ...

is a computation of A2 ona(m, w) which begins fromsm(k). Hence there must exist


ani ::;msuchthata(O,i) E Wandsi(k), ... ,Sm_l(k),sm(k)isacomputationof
A2 on a(i, m) such that siCk) = SO,2. We conclude that a E WL. This proves the
lemma.

3.9 Decidability
In this section, as we did for finite automata, we will discuss certain natural prob-
lems posed about Bilchi automata. As we will see these problems are decidable.
Decidability of these problems gives a powerful tool for applications of Bilchi
automata in logic, algebra, and computer science. In the next two sections we will
discuss examples of such applications. Let us now to formulate the problems.

1. (Emptiness Problem) Does there exist an effective procedure which, given


any Bilchi automaton A, decides whether some a E }:;w is accepted by A?
3.9. Decidability 185

2. (Equality Problem) Does there exist an effective procedure which, given


Blichi automata A and B, decides whether these automata accept the same
w-Ianguage?

3. (Universality Problem) Does there exist an effective procedure which,


given any Blichi automaton A, decides whether L(A) = 1: W ?

As we see, these problems are reformulations of the questions we asked about


finite automata. However, the solutions to these problems are not as easy as for
finite automata, as some of them employ results obtained in the previous sections.
In particular, the solutions to the last two problems are based on the proof of the
complementation problem for Blichi automata. This section is devoted to giving
positive solutions to all these problems.

Theorem 3.9.1 The emptiness problem/or Biichi automata is decidable.

Proof. A basic tool for solving this problem is the transition graph represen-
tation for Blichi automata. Thus, let A = (S, J, T, F) be a Blichi automaton over
1:. By the Blichi characterization theorem of w-Ianguages the language L(A) is
equal to
u
SEI,S'EF
WS,S,W~,S'·

Hence, the set L(A) is not empty if and only if there exists a state s E F so that
the following two conditions hold:

1. There exists a finite string u which transforms some initial state So to s.

2. There exists a finite nonempty string v which transforms the state s E F into
s itself.
In other words, in order to decide if the language L(A) is empty or not, we have
to look at the transition table that represents A and do the following. We have to
find a path labeled by some u E 1:* that connects an initial state So with a final
state s, and then for each such final state s check whether or not there exists a loop
labeled with a string v E 1:* which transforms the final state s to s itself. If for
some s E F that is the case, then clearly A recognizes uvvvvv .... Otherwise, A
accepts no string. It is easy to see that one can construct an algorithm that decides
whether or not there exist a state s E F and strings u, v E 1:* that satisfy the two
properties above. The theorem is proved.

Exercise 3.9.1 Prove the theorem above in more detail.

Theorem 3.9.2 The equality problem/or Biichi automata is decidable.

Proof. To decide the equality problem for Biichi automata, we need the
following lemma.
186 3. Btiehi Automata

Lemma 3.9.1 There exists an algorithm which, given a Buchi automaton A, con-
structs a Buchi automaton A' that accepts the complement of L(A).
Proof of the Lemma. Here is a step-by-step explanation of how the desired
algorithm works.

1. Take the given Btichi automaton A.

2. Consider the equivalence relation'" introduced in Btichi's proof of the com-


plementation problem.

3. Compute the index of the equivalence relation "'.

4. Using the definition of"', for each "'-equivalence class effectively construct
a finite automaton recognizing the class.

5. For every pair of "'-equivalence classes V and W, effectively construct a


Btichi automaton recognizing the language VWW n
L(A).

6. Take all V, W equivalence classes such that VWW n L(A) = 0.


7. Construct a Btichi automaton that accepts the union of all VWW such that
VWW n L(A) = 0.
Each step of the above algorithm can be effectively carried out. The last step of
the algorithm provides the desired automaton, as follows from the proof of the
complementation problem for Btichi automata. This proves the lemma.
Now in order to prove the theorem, consider two Btichi automata Al and
A2. By the lemma above we can effectively construct two Btichi automata BI and
B2 such that BI accepts L(AI) \ L(A2) and B2 accepts L(A2) \ L(Ad. Then
L(Ad = L(A2) if and only if L(BI) = L(B2) = 0. This gives a desired proof of
the theorem.

Theorem 3.9.3 The universality problem for Buchi automata is decidable.

Proof. The decision of the universality problem is as follows. Take a Btichi


automaton A. Then L(A) = ~w if and only if ~w \ L(A) is empty. Thus we have
to simply construct the automaton C which accepts ~w \ L(A) and apply the first
theorem to C. The theorem is proved.
We now present several exercises. Solutions to these exercises require some
analysis of the transition tables of Btichi automata.

Exercise 3.9.2 Prove that there exists an effective procedure which, given any
Buchi automaton A, decides whether or not A accepts finitely many strings.
Exercise 3.9.3 Prove that there exists an effective procedure which, given any
Buchi automaton A, decides whether or not A accepts countably many strings.
3.lO. Biichi Automata and the Successor Function 187

3.10 Btichi Automata and the Successor Function


Important and natural structures that arise in computer science and mathematics
involve numbers. Perhaps, the most simple nontrivial and important mathematical
structure which involves numbers is the set of natural numbers together with the
successor function. We denote the successor function by S. The successor function
°
S works in a simplest possible way. The function sends to 1, 1 to 2, 2 to 3, etc.
In general, S sends n to n + 1. We write this as, Sen) = n + 1. We denote this
structure, that is the natural numbers together with the successor function S, by
(w, S). Let us call this structure the successor structure. Blichi was the first who
observed a close relationship between automata on infinite inputs and some natural
properties of the successor structure.
The goal of this section can be informally described as follows. We want
to express properties of the structure (w, S) using a formal language. Then we
would like to have a procedure which, given any expression cf> of the language,
tells us whether or not the property expressed by cf> holds in (w, S). To do this we
employ our results about Blichi automata. The reader has probably noticed that we
would like to investigate the relationship between the successor structure and B lichi
automata in the same manner as we studied the relationship between finite automata
and the monadic second order logic of finite strings. In this section we shall use
results about Blichi automata, their computations, computational properties and
show how these are related to algebraic and logical properties of the successor
structure.

3.10.1 w-Strings as Structures. We will show how each infinite string Ci over
b can be viewed as a mathematical structure richer than the successor structure
(w, S). Suppose that

is an w-string. Consider the structure (w, S). Take a a from b. Now this a defines
a subset Q(J" on natural numbers in the following way:
A natural number n belongs to the subset Q(J" if and only if an = a.
Let us consider an example.

Example 3.10.1 Suppose that b = {a, b, c}. Consider the word

abcabcabcabc ....

Then

Qa = {a, 3, 6, 9, ... }, Qb = {I, 4, 7, 10, ... }, Qc = {2, 5,8,11, ... }.


In this example, the string abcabcabc ... defines the structure which contains all
natural numbers, the successor function, and the sets Qa, Qb, and Qc. In other
188 3. Btiehl Automata

words, we have the following mathematical structure:

This structure is indeed richer than (w, S) just because it contains more information
about natural numbers than the structure (w, S) itself.
Now we can explain this more formally. Given an w-string ex over b =
{ai, ... , an}, we can expand (w, S) by considering the structure

(w, S, QaJ' ... , Qa n),

where each Qa contains all those natural numbers n such thatex(n) = a. We denote
this structure by (w, S\t.
There is another way to look at the structures of the type (w, S)a' We explain
this using the above example.
In the example, the alphabet is {a, b, c}. We can look at the alphabet {a, b, c}
as a subset of the alphabet {O, I}2 in such a way that

Note that any Btichi recognizable language over the alphabet {a, b, c} is also Btichi
recognizable over the alphabet {O, l}2. Therefore, as our primary interest is in
Btichi recognizable language, we can assume that b = {O, I}2. Now the w-word
abcabcabcabc ... has become

(~) (~) C) (~) (~) (i) (~) (~) (~) ....


This infinite word defines the pair (X I, X 2) of subsets on the set w of natural
numbers as follows. A natural number n belongs (does not belong) to X I if and
only if the first coordinate of the letter in the nth position of the above w-string is
I (0). Similarly, a natural number n belongs (does not belong) to X2 if and only
if the second coordinate of the letter in the nth position of the above w-string is I
(0). Hence we see that

XI = {O, 2, 3, 5, 6, 8, 9, ... }, X2 = {I, 2,4,5,7,8,10,11, ... }.


Note that the first (the second) row of the sequence

(~) (~) (~) (~) (~) (~) (~) (~) (~) ...
is simply the characteristic function of the set X I (X2). Therefore, the pair (X I, X2)
defines the sequence

(~) (~) C) (~) (~) (i) (~) (~) (~) ...


3.10. Biichi Automata and the Successor Function 189

in the following way. Take natural number n. Define the letter

as follows: if n E Xl, then El = 1; otherwise El = O. Similarly, if n E X2, then


E2 = 1; otherwise E2 = O. Now note that this letter belongs to {O, 1f and is exactly
the letter in the nth position of the w-sequence above.
Thus, informally we can conclude with the following comments about the
example. If we know Dt, then we know the structure (w, S)a. If we know (w, S)a,
we certainly know Dt. If we know Dt, we certainly know the pair (X 1, X2). If we
know the pair (X 1, X 2), then we know Dt. Roughly speaking, the three objects, Dt,
(w, S)a, and (X 1, X2), are essentially the same and possess, in the natural sense
explained above, the same information.

3.10.2 Monadic Second Order Formalism. Our goal can informally be de-
scribed as follows. First, we want to express properties of the structure (w, S). A
natural way to do this is to invent a formal language. The language for us will be
an important tool to talk about properties of (w, S) as well as structures of the type
(w, S)a. Second, we want to have a procedure which, given any expression <I> of
the language, tells us whether or not the property expressed by <I> holds in (w, S). 5
In order to achieve our goal, we explain the language called the monadic second
order logic of the successor S.
The symbols which we use in this logic (language) are the following.
1. We use the symbols
x, y, Z, ... ,

called individual variables, possibly with subscripts or superscripts. The


intended meaning of these variables is that they run over the set of natural
numbers.
2. We use the symbols
X,Y,Z, ... ,
called set variables, possibly with subscripts or superscripts. The intended
meaning of these variables is that they run over subsets of w.
3. We use symbol = to express equality; we use symbol E to express mem-
bership; we also use the symbol S whose meaning is simply the successor
function S in w.
4. We use logical connectives & (and), V (or), -. (not), --+ (if ... , then ... ),
and quantifiers :3 (there exist), V (for all).

5The reader may want to review the section on the monadic second order theory of finite strings
from the previous chapter. Then this section can be read quickly.
190 3. Biichi Automata

5. We also use nonlogical symbols ( and), left and right parentheses.

Now, we would like to talk about properties of (w, S) in terms of just intro-
duced symbols. The properties are expressed by means of certain finite strings of
the language. These strings will be called formulas. Formulas formalize the notion
of expression. We first define the notion of term. Informally, the meaning of each
term in the successor structure is a function that can be obtained from the successor
function S by composition.
Basic Step. Each variable x is a term.
Inductive Step. If t is a term, then Set) is also a term.

Exercise 3.10.1 Let x be a variable. For every nEw, define sn(x) asfollows:

Show that t is a term if and only if t = sn (x) for some variable x and number n.

We now define, by induction, formulas of our language.


Basic Step. The expressions t E X, t1 = (2, X = Y, where t1 and t2 are
terms, X and Yare set variables, are atomic formulas.
Inductive Step. Suppose that the formulas <I> 1 and <1>2 have been defined.
Then all of the following expressions are formulas:
(<1>1&<1>2), (<I>I V <1>2), (<I>I ~ <1>2), (3x<l>I), ( ..... <1>1), (3X<I>j), (Yx <I> j),
(YX<I>j),
where x is an individual variable, and X is a set variable.
We give several examples to clarify the intended meaning of formulas.

Example 3.10.2 Theformula X ~ Y is defined as

Yz(z E X ~ Z E Y).

Thus, when X and Y are thought to be A and B respectively, with A, B ~ w,


then the formula X C Y is satisfied under this interpretation of X and Y if and
only if A is indeed a subset of B.

Example 3.10.3 Consider the formula Sub(X):

Yx(x E X ~ Sex) EX).

Suppose that the interpretation of X is the set Ai:

{i,i+l,i+2, ... }.
3.10. Btichi Automata and the Successor Function 191

Then certainly, for any number n if n E Ai, then n + 1 E Ai. Hence one can say
that Ai satisfies the formula Sub(X) when X is interpreted as Ai. It is not hard to
see that a subset B of natural numbers satisfies the formula Sub(X) if and only if
B coincides with Ai for some i or B = 0.
Example 3.10.4 We define the following formula denoted by x :::; y,'

VX(Sub(X) &x E X ~ Y EX).

It is not hard to see that when we interpret x and y as numbers i and j,


respectively, under this interpretation of x and y, the formula x :::; y is true if and
only if i is less than or equal to j.

Exercise 3.10.2 Prove the statement of the example given above.


We let the expression X c Y stand for X S; Y &X i= Y.
Example 3.10.5 Theformula Fin(X) is defined as

3Z(X c Z & 3y(y rt Z) & Vx(x rt Z ~ Sex) rt Z)).

This formula defines finite subsets of w. Indeed, suppose that A is a finite subset.
Let n be the maximal element of the set A. Then if we put Z to be {O, ... , n},
then A c Z, n + 1 rt Z and for all numbers i if i rt Z, then clearly i + 1 rt Z.
Moreover, it is not hard to see that if, under the interpretation X ~ A, the formula
is satisfied, then A is finite.

Exercise 3.10.3 Consider the formula

Vy«y E X ~ S(y) rt X) & (y rt X ~ S(y) EX)).

What type of subsets X of natural numbers satisfy theformula?

3.10.3 Satisfiability. The examples given at the end of the previous subsection
naturally lead us to a formalization of the notion of satisfiability in the structure
(w, S). Suppose that to each individual variable Xi and a set variable X j an element
bi ELand a set Bi has been assigned, respectively. In other words, we have a
fixed interpretation

intr : Xi ~ bi intr: Xi ~ Bi

of the variables. By induction on the complexity of the formula <1>, we define sat-
isfiability of <I> on (w, s, :::;) under the interpretation. We need one explanation.
Consider the term Sn(x). When n = 0, SO(x) = x. If we think of x as a variable
that runs over the set of natural numbers, then SO (x) can be thought of as the
function mapping each x to itself. Suppose that n = 1. Then S 1(x) is simply S(x).
Therefore, if we think of x as a variable that runs over the set of natural numbers,
192 3. Bi.ichi Automata

then SI (x) can be thought as a function that maps each x to its immediate successor
x + 1. Similarly, the term S2(x) simply represents the function on w that maps
each x to x + 2. In general the term sm (x) represents the function on w that maps
each x to x + m. Now we are ready to explain the notion of satisfaction that relates
formulas with their meaning in the successor structure (w, S).
Basic Step.

• The structure (w, S) satisfies the atomic formula (sm (Xi) E X j) if in the
structure (w, S) we indeed have sm(bi) E Bj.

• The structure (w, S) satisfies the atomicformula sn (Xi) = sm (x j) if sn (bi) =


sm(bj).

• The structure (w, S) satisfies the atomic formula (Xi = Xj) if Bi = Bj.
Inductive Step. We consider separately each case corresponding to the in-
ductive step in the definition of formula.

1. (w, S) satisfies (<1>1 V<1>2) if (w, S) satisfies either the formula <1>1 or the
formula <1>2.

2. (w, S) satisfies (<I> 1& <1>2) if (w, S) satisfies both the formula <I> 1 and the
formula <1>2.

3. (w, S) satisfies (<I> 1 --+ <1>2) if the condition that (w, S) satisfies <I> 1 implies
that (w, S) satisfies <1>2.

4. (w, S) satisfies ..,(<I>[) if (w, S) does not satisfy <1>1.

5. (w, S) satisfies (3Xi <1>1) if there exists abE w such that (w, S) satisfies
the formula <I> 1 under the new interpretation intr' which is the same as intr
except its value on Xi is b.

6. (w, S) satisfies (3Xi<l>[) if there exists B C w such that (w, S) satisfies


the formula <I> 1 under the new interpretation intr' which is the same as intr
except its value on Xi is B.

7. (w, S) satisfies (VXi <1>1) «VXi <1>1» if and only if (w, S) satisfies -.(3Xi (..,<1>1»
(..,(3X i (..,<1>1)))·

For a formula <I> whose variables are among Xl, ... , Xt and Xl, ... , X p, we
usually write <I> (X 1, ... , X p' XI, ... , Xt). We also write

if the structure (w, S) satisfies this formula under the interpretation intr such that
intr(xi) = bi, intr(Xj) = Bj, where i = 1, ... , t, and j = 1, ... , p. We now
3.10. Btichi Automata and the Successor Function 193

suggest that the reader go through the examples of the previous subsection to better
understand the definition of satisfiability.
We now need a definition.

Definition 3.10.1 Wesaythattheformulas¢(XI, ... , X m, YI, ... , Yk)andllJ(XI,


... , X m , YI, ... , Yk) are equivalent iffor all subsets BI, ... , Bm C wand all ele-
ments bl, ... ,bk E w the structure (w, S) satisfies the formula ¢ (B I, ... , Bm , bl ,
... , bk) if and only if (w, S) satisfies IlJ(BI, ... , B m , bl, ... , bk).

The next exercise gives some examples of equivalent formulas.

Exercise 3.10.4

1. Show that the formula sn(x) E X is equivalent to the formula

3xI '" 3Xn-1 (S(x) = XI & S(XI) = X2 & ... & S(Xn_l) EX).

2. Show that the formula sn(x) = sm(y) is equivalent to the formula

3xI ... 3xn 3YI ... 3Ym(S(x) = XI & S(xJ} = X2 & ... & S(Xn_l)
= Ym & S(y) = YI & S(YI) = Y2 & ... & S(Ym-l) = Ym).

To investigate the connections between Btichi automata and the monadic


second order logic of the successor structure (w, S), we need a technical notion of
free variable. Basically, we just repeat the appropriate notion from the section on
the monadic second order logic of finite strings.
Basic Step. For atomic formulas (sn(x) E X), X = Y, X = Y, and sn(x) =
sm (Y), the set of free variables are {x, X}, {x, y}, {X, Y} and {x, y}, respectively.
Inductive Step. Suppose that the set of free variables FV (¢I) and FV «h)
for the formulas ¢I and ¢2 have been defined. Then

FV (¢I r¢2) = FV (¢I) UFV (¢2), = FV (¢I),


FV (-'¢I)
FV(Qx¢J} = FV(¢I) \ {x}, FV(QX¢I) = FV(¢I) \ {X},

where r E {&, V, --+}, Q E {V, 3l. x is an individual variable, and X is a set


variable.
A formula is a sentence if it has no free variables. Thus by the definition
of satisfiability, in the structure (w, S) any sentence ¢ is either true or false. In
other words, the truth value (satisfiability) of ¢ in (w, S) does not depend on any
interpretation of variables. Here now is a central definition of this chapter.

Definition 3.10.2 The monadic second order theory of the successor structure
(w, S) is the set of all sentences satisfiable (true) in the structure (w, S). We denote
this set of sentences by SIS.
194 3. Btiehl Automata

Our purpose is to show that the monadic second order theory of (w, S) is
decidable. In other words we will show that there exists an effective procedure
which, for any given monadic second order sentence <1>, decides whether or not
this sentence is true in the structure (w, S).

3.10.4 From Biichi Automata to Formulas. Let A = (S, {so}, T, F) be a


Btichi automaton over the alphabet ~. We can suppose that ~ = {a, l}m for
some mEw as explained in Section 3.10.1. Let BI, ... , Bm-k be subsets of w,
and bm-k+l, ... , bm be natural numbers. We sometimes denote the sequence

BI, ... , Bm-k. bm-k+l, ... , bm

by Bb. Each such sequence and natural number i E w define a symbol ai of the
alphabet ~:

where for each j, Ei = 1 if and only if i E B j or i = b j. Therefore, the sequence


Bb defines the w-string

of the alphabet ~ = {a, l}m. We denote this infinite string by

word(B, b).

The opposite is also true: any sequence aOal ... an ... from ~w defines an m-tuple
of sets (X I, ... , X m ), where for each i, 1 SiS m, and each nEw, the number n
is in Xi (not in Xi) if and only ifthe ith component of an is 1 (0). So, we see that
there is a natural one-to-one correspondence between all infinite strings from ~w
and m-tuples of subsets of w. This correspondence is clearly seen if the i th row in
the infinite strings
word(B, b)
is identified with the characteristic function of the set Bi ({bi D.
The following theorem shows that the notion of acceptance for Btichi au-
tomata is expressible in the monadic second order formalism.

Theorem 3.10.1 There exists an algorithm which, given a Buchi automaton A


over ~ = {a, l}m, constructs a formula <I> (XI , ... , X m), where XI, ... , Xm are
set variables, such that for all subsets B = B I, ... , Bm C w the following property
holds:
A accepts word(B) if and only if (w, S) satisfies <I>(B).
Proof. The proof is very similar to (even simpler than) the proof in which
we transformed finite automata into monadic second order formulas. Let A =
3.10. Biichi Automata and the Successor Function 195

(S, I, T, F) be a given Btichi automaton. We can assume that the initial state I
contains one state only. Since S is a finite set we can also suppose that

S={O,l,oo.,p}

with °
being the initial state. Let a E b be of the form

- -
where each Ei E to, I}. We define the formula <pa(x, X), where X is Xl,.··, Xm,
as follows:

where EE is E if E = 1, and ~ otherwise.


Informally, this formula codes the letter a E b. We note the following fact.
Let B1, ... , Bm ~e subsets of w. Then for every nEw there must exist a a E b
such that <Pa (n, B) holds. It follows that the formula

"Ix (V
aEI:
<pa(X, in)
is satisfied in (w, S). We also recall that for each w-word

ct = ao ... at ... E b'"

there exists a sequence i3 = B1, ... , Bm of subsets of w such that the infinite string
ctequals the string word(B1, ... , Bm).
Let Yo, Y1, ... , Yp be set variables. The desired formula involves these set
variables. The intention is that each Yi represents the state i of the automaton A.
In the desired formula these set variables will be existentially quantified. We write
down the following formula denoted by D(Y), where Y is Yo, ... , Yp:

&;;fj--.3z(z E Yi & Z E Yj).

The intention is that we want to express the fact that the automaton A cannot be
in two distinct states simultaneously.
We define another formula <Pa,i (x, X, Y) and explain its meaning. The for-
mula is
x E Yi & <pa(x, X) ~ V
(S(x) E Yj).
(i,a,j)ET
196 3. Btichi Automata

Informally, the formula corresponds to the fact that if A is in state i, the next
input signal is a, then the next state of the automaton is a j such that (i, a, j) E T.
The following note concerns this formula. Suppose that nEw and BI, ... , Bm C
w. Let a E b be such that (w, S) satisfies <l>a (n, iJ, Y). Then if the formula

3Yo· .. 3Yp (<I>a,i (n, B, Y))

were true, there would exist a j such that Sen) belongs to Yj and (i, a, j) belongs
to T.
Finally, the last formula we need is the formula F(Y) defined as

'v'x3y(x ::::; y & x =1= y & (VJEF


Y E Yj)) .

We recall from Example 3.10.4 that the ordering::::; of natural numbers is


defined in the monadic second order logic. The formula F(Y) is intended to code
the notion of successful computation.
Now we write down the desired formula <I> (X I, ... , Xm):
- -
3Yo ... Yp('v'x(D(y) & 0 E Yo & &iES,aEl; <l>a,i (x, X, Y)&F(Y)).

Note that this formula uses the symbol 0 that represents the smallest natural num-
ber. This number satisfies the formula 'v'y(x ::::; y), and therefore the expression
<I> (X I, ... , Xm) is a formula of the second order monadic logic. Now our goal is
to show that the formula <I> (X I, ... , Xm) satisfies the theorem. We need to prove
that for all subsets BI, ... , Bm C w the automaton A accepts word(.6I, ... , Bm)
if and only if (w, S) satisfies <I>(BI, ... , Bm).
Take subsets BI, ... , Bm. Consider the w-string

word(BI, ... , Bm),

which is
aOal ... at.···

Now let us assume that this string is an input to the automaton A.


Suppose that A accepts the string word(BI, ... , Bm). Therefore, there exists
a run
r = SOSI ... St-IStSt+1 ...
on the string

such that [nCr) nF =1= 0. We need to prove that

(w, S) F= <I>(BI, ... , Bm),


3.10. Btichi Automata and the Successor Function 197

that is, we need to show that there are subsets Do, ... , Dp of the domain w such
that the interpretation Yi -+ Di, i = 0, ... , p, makes the formula <1>(BI, ... , Bm)
true in w.
Here is how we define each Di, i = 0, ... , p:

Di = {j E w I Sj = i}.
In other words, we look at the j t h state in the computation

r = SOSI ... StSt+1 ... ,


compare it with i, and put the number j into Di if and only if the state S j coincides
with the state i. The formula <1> (BI, ... , Bm) under this interpretation of Yi -+ Di,
i = 0, ... , p, is satisfied by (w, S).
Now suppose that <1>(BI, ... , Bm) is satisfied in (w, S). We wantto show that
A accepts the string word(BI, ... , Bm). There are subsets Do, ... , Dp of w such
that the formula <1>(BI, ... , Bm) becomes satisfied by (w, S) when we interpret
the variables Yo, ... , Yp as Do, ... , Dp, respectively.
For every jEw, we consider the set DSj such that j E D sj . Then using the
definition of <1> (X), one can check that the sequence

so, SI,···, St, St+I,···

is a computation of A on the string word(BI, ... , Bm) such that [n(e) n F "I 0.
This proves the theorem.

Exercise 3.10.5 Show that for every Biichi automaton A over the alphabet {O, l}m
there exists aformula <1> (X I, ... , Xm) such that the following properties hold:

1. A accepts word(B) ifand only if(w, S) satisfies <1>(B).

2. The formula <1> (X 1, ... , Xm) is of the form 3YVZIIt(Z, Y, XI, ... , X m ),
where lIt is a quantifier free formula.

In relation to the theorem proved we would like to make the following com-
ment. One might say that B i.ichi automata correspond to the class of nonterminating
computer systems (e.g., operating systems, air traffic control systems, banking sys-
terns), and the monadic second order formulas represent logical specifications of the
systems. Therefore, in this terminology the theorem above states that there exists
a transformation from nonterminating operating systems to their logic specifica-
tions. The fundamental property of these specifications is in their completeness.
In other words, one can provide a procedure which transforms each logic speci-
fication (formula) to a nonterminating computer system, that is to an appropriate
Bi.ichi automaton. We will prove this in the next section.
198 3. BUehl Automata

3.10.5 From Formulas to Biichi Automata. Our goal is to show the converse
of the theorem proved in the previous subsection. In other words, given a formula
of the second order monadic logic, we want to construct a B tichi automaton whose
successful runs correspond to the interpretations of the variables that make the
formula satisfied. We first consider several examples to explain the idea.
Example 3.10.6 Consider the formula X2 E XI. We define a Biichi automaton A
whose transition table is presented in Figure 3.19.

Figure 3.19: Automaton representing the formula X2 E X I.

The connection between the automaton and the formula X2 E X I is the


following. For all subsets BI C wand numbers b2 E w, the automaton A accepts
the string word(BI, b2) if and only if b2 E BI. Indeed, first of all note that the first
row in the string word(BI, b2) corresponds to the characteristic function of the set
BI. There exists only one symbol 1 in the second row of this string at the position
b. Thus b2 E BI is detected if and only if the automaton enters the final state, and
stays in the final state forever without failing to read the next inputs.
Example 3.10.7 Consider the atomic formula S(XI) = X2. We define an automa-
ton A whose graph presentation is given in Figure 3.20.

Figure 3.20: Automaton representing the formula X2 E X I .

The connection between this automaton and the formula S(XI) = X2 is as


in the previous example, that is for all bl, b2 E w the automaton A accepts the
string word(bl' b2) if and only if (w, S) satisfies S(b]) = b2. Indeed, take two
numbers bl and b2. Consider the infinite string word(bl' b2)' The first row of this
string contains only one symbol 1 at the position bl. The second row of this string
contains only one symbol 1 at the position b2. Thus, the fact that S(bl) = b2 is
detected if and only if the automaton enters the final state, and stays in the final
state forever without failing to read the next inputs.
3.10. Biichi Automata and the Successor Function 199

Now we give a definition. However, we should make some notations. From


now on, X and x denote the sequence Xl, ... , Xm-k of set variables and the
sequence Xm-k+l, ... , Xm of individual variables, respectively. ¥je use similar
notations for sequences of sets and elements in w. For example B C A simply
means that B], ... , Bm-k is a sequence of subsets of A.

Definition 3.10.3 Let <P(X, x) be a formula and let A be a Biichi automaton


over {O, l}m. We say that the automaton A represents the formula <P(X, x), or
equivalently the formula <P (X, x) represents the automaton A iffor all subsets
B c wand elements b E w, the automaton A accepts word( B, b) if and only if
(w, S) satisfies <P(B, b).

The two examples above show that the formulas X2 E Xl and Sex]) = x2
are represented by automata. We also note that by Theorem 3.10.1 every Biichi
automaton is represented by a formula. Our goal is to show that for any formula
there exists a Biichi automaton that represents the formula.

Exercise 3.10.6 Show that the formulas Sub(X),

Vx(x E X ~ Sex) EX),

and x .:s y,
VX(Sub(X) & x E X ~ Y EX),
are representable by Biichi automata.

We now prove the following lemma.

Lemma 3.10.1 Suppose that Biichi automata A] and A2 represent the formulas
<PI (X, x) and <P2(X, x), respectively. Then there exist Biichi automata represent-
ing
- - - - -
<p] (X, x)r<p2(X, x), -,<Pl (X, x), QiXi<Pl (X, x), and QjXj<Pl (X, x),
where r E {V, &, ~}, Q E {V, 3}, i = 1, ... , m - k, j =m - k + 1, ... , m.
Proof. Given Biichi automata A] and A2, we can consider the automata
Al EB A2, Al x A2, and A'1 that accept the union L(A]) U L(A2), the inter-
section L(A]) n
L(A2), and the complement of L(Al), respectively. Using the
assumption that for each i = 1, 2 the automaton Ai represents <Pi (X, x), and us-
ing that Biichi recognizable languages are closed under union, intersection, and
complementation, we see that the automata

represent the formulas


200 3. Btichl Automata

respectively. We give, for example, a proof that Al ED A2 represents (<I>I (X, i) V


i».
<1>2 (X , Take subsets B c w, and elements b E w. Consider the w-string
word(B, b). Then, since each Ai represents <l>i (X, i), we see that (w, S) satisfies
(<I>I (B, b)V <l>2(B, b» if and only if (w, S) satisfies either <1>1 (B, b) or <l>2(B, b).
Thus, by hypothesis of the lemma, (w, S) satisfies (<I> I (B , b) V <1>2 (B, b» if and
only if either Al accepts word(B, b) or A2 accepts word(B, b). Hence, (w, S)
V
satisfies (<I>I (B, b) <l>2(B, b» if and only if Al ED A2 accepts word(B, b).
Now suppose that <I> (X, i) is 3Xi<l>I(X, i). Without loss of generality, we
can assume that Xi = X I. Consider the Blichi automaton Al over the alpha-
bet I; = {O, 1}m which represents the formula <1>1 (X, i). The alphabet I; is
I;I x I;2, where I;I = {O, I} and I;2 = {O, l}m-I. By the projection theorem
about Blichi recognizable languages (see Theorem 3.2.3), there exists an automa-
ton B which accepts the projectionpr2(L(AI» of the set L(AI). We show that B
represents 3XI <1>1 (X, i). Indeed, take subsets B2, ... , Bm-k C w, and elements
b E w. Consider the w-string word(B2, ... , Bm-k. b). Then B accepts the string
word(B2, ... , Bm-k. b) if and only if there is a string u E ({O, I})'" such that the
string (u, word(B2, ... , Bm-k. b» E ({O, l}m)'" belongs to L(Aj). Therefore, the
automaton B accepts the string word(B2, ... , Bm-k. b) if and only if there is a
BI C w such that the automaton A accepts the string word(BI, B2, ... , Bm-k. b).
Thus we conclude that (w, S) satisfies <1>1 (B, b) if and only if (w, S) satisfies
3X I <1>1 (XI, B2, ... , Bm-b b).
Similarly, on~ can prove that there exists an automaton that represents the
formulas _Qxj<l>I(B, bm-k+I, ... , Xj, ... , bm) with Q E {V', 3}, and the formula
V'X j<l>l (B, bm-k+l, ... , x j, ... , bm). The lemma is proved.
Exercise 3.10.7 Give a construction of an automaton that represents the formula
V'X I <1>1 (X I, ... , Xm) if <I> I (X I, ... , Xm) is represented by a Biichi automaton A.

Lemma 3.10.2 Let <I> be an atomic formula. There exists an automaton which
represents <1>.
Proof. The first two examples at the beginning of this subsection show that the
lemma is true for the atomic formulasx2 E X I and S(XI) = X2. The atomic formula
x = y is represented by the automaton whose transition table is in Figure 3.21.

Figure 3.21: Automaton representing the formula x = y.


The atomic formula X = Y is represented by the automaton whose graph is
given in Figure 3.22.
We ask the reader to prove that the formula sn(x) = sm(y) is presented by
a Blichi automaton (see exercise below). The lemma is proved.
3.10. Biichi Automata and the Successor Function 201

Figure 3.22: Automaton representing the formula X = Y.

Exercise 3.10.8 Prove that there exists a Buchi automaton that represents the
formula sn(x) = sm(y).

From the above lemmas we have the following theorem.

Theorem 3.10.2 There exists a procedure which for every monadic second order
formula <I> (X, x) constructs a Buchi automaton A representing the formula.

Proof. We first note that the operations of producing Btichi automata that
accept the union, intersection, complements, and projections of Btichi recogniz-
able languages can be carried out effectively. Now the proof of the theorem is by
induction on the complexity of the formula <I> (X ,x). Lemma 3.10.2 proves the the-
orem for atomic formulas, that is for the basic step of our induction. Lemma 3.10.1
proves the inductive step and hence the theorem.

3.10.6 Decidability and Definability in SIS. As a corollary of the previous


subsections, we get the following known theorem first proved by Btichi.

Theorem 3.10.3 The monadic second order theory SIS afthe successor structure
(w, S) is decidable.

Proof. Let \II be a sentence. We want to check whether or not (w, S) satisfies
\II. We can assume that \II is equivalent to a formula either of the form 3x <I> (x)
or of the form 3X<I>(X). Consider the case when the sentence \II has the form
3X <I> (X). The case when \II is of the form 3x<l> (x) is treated similarly. There exists
an automaton A representing <I> (X). We conclude that for any subset B1 C w, the
structure (w, S) satisfies <I> (B 1) if and only if the Btichi automaton A accepts the
string word(BJ). Thus, there exists a B1 C w such that (w, S) satisfies <I>(B1) if
and only if there exists a string of the form word(BJ) accepted by A. It follows
that 3X<I>(X) holds in (w, S) if and only if L(A) f= 0. Thus we have reduced the
satisfiability problem for 3X <I> (X) to the emptiness problem for a Btichi automaton
representing <I> (X). Since the emptiness problem for Btichi automata is decidable,
we see that SIS is also decidable. The theorem is proved.

It turns out that the results proved above provide not only decidability of SIS
but also talk about definability issues. Consider the set pew) of all subsets of w.
202 3. Btichl Automata

Definition 3.10.4 We say that a subset M c p(w)m is definable if there exists a


formula <I> (XI , ... , Xm) such that

M = {(BI, ... , Bm) I (w, S) F <I>(BI, ... , Bm)}·

Clearly, every definable set M naturally defines an w-Ianguage LM as

LM = {word(BI, ... , Bm) I (BI, ... , Bm) EM}.

We say that L C 1;w is definable if L = LM for some definable set Me p(w)m.


From the definitions and the theorems proved in the previous two sections we have
the following definability result.

Theorem 3.10.4 For any w-language L over the alphabet 1; the following condi-
tions are equivalent:

1. L is definable.

2. There exists a Buchi automaton A such that L = L(A). D

Exercise 3.10.9 Check the correctness of the theorem above.

3.11 An Application of the McNaughton Theorem


From the previous section we see that Buchi recognizability is equivalent to de-
finability in monadic second order logic in a certain precise sense. A natural and
somewhat informal question which arises is the following:

What is the relationship between Buchi recognizability and definability


ifwe weaken the monadic second order logic?

In this section we give one possible answer to this question. We recall that in
defining the monadic second order logic of (w, S) we used variables

X,Y,Z, ...

which are set variables. The intention for these variables is that they run over
subsets of w. We now introduce a weaker fragment of the monadic second order
logic of (w, S).
The logic is defined in exactly the same way as we defined the monadic
second order logic of (w, S) with only one exception. In this logic we again use
variables
X,Y,Z, ... ,
possibly with subscripts or superscripts, with the intention that they run over subsets
of w. However, when we quantify these set variables, then we always assume
that the set variables under the quantifiers represent finite sets. Thus, the formula
3.11. An Application of the McNaughton Theorem 203

3X <I> (X) is simply intended to say that there exists a finite subset B of natural
numbers such that <I>(B). We call this logic the weak monadic second order logic
of (w, S). Another important point here is the following. Set variables X that occur
freely in a given formula can have any interpretation as subsets, in particular infinite
subsets, of w. Let us consider several examples.

Example 3.11.1 Consider the formula: Vz(z E Y -+ Z E X). We denote this


formula by Y £ X.

This formula is a formula of the weak monadic second order logic. When X
is interpreted as an A £ wand Y is interpreted as a B £ w, the formula is true if
and only if B isa subset of A. Note that we do not require A and B to be finite
since X, Y occur free in the formula.

Example 3.11.2 Consider the formula 3Y(Y £ X).

Note that in this formula Y is in the scope of the existential quantifier. This
formula reads as follows. There exists a finite set Y which is a subset of the set (not
necessarily finite) X. Note that the formula is true under all interpretations of X.

Example 3.11.3 Consider the formula VX3Y(Y £ X).

Both variables in this formula are not free. Hence this formula states that for
all finite sets X there exists a finite set Y which is a subset of X. Note that this
sentence is true in the structure (w, S).

Exercise 3.11.1 Consider the following formula ofthe weak monadic second order
logic:

3Y(Y c X & Y =1= 0 & VYI VY2(S(yt) = Y2 & Y2 E Y -+ Yl E Y)).

What does this formula say? For which X subsets of w, is this formula true in the
structure (w, S)?

Exercise 3.11.2 Consider the formula

3Y(Y c X& Y =1= 0 & VYIVY2(S(yt) = Y2 & Yl E Y -+ Y2 E Y)).

Does there exist an X subset of w which makes this formula true in the weak second
order monadic logic? Does there exist an X subset of w which makes this formula
true in the second order monadic logic?

We now can define the set of all sentences of the weak monadic second order
logic that are true in the structure (w, S). Here is the definition.

Definition 3.11.1 Denote W SIS to be the set ofall sentences in the weak monadic
second order logic which are true in (w, S).
204 3. Btiehi Automata

Having defined the weak second order monadic logic, it is now natural to ask
how this logic is related to the monadic second order logic. To partially answer this
question, we note that there exists a formula Fin(X) considered in Example 3.10.5
of the monadic second order logic that is true if and only if X is a finite set of natural
numbers. Therefore, any formula <I> of the weak monadic second order logic can
be transformed into an equivalent formula III of the second order monadic logic.
In order to explain this we give an example. Consider the formula

in the weak monadic second order logic, where <I> (X, Y, Z 1 , Z2) contains no quan-
tifiers. Then we can transform this formula into the following formula of the second
order monadic logic:

3Y(Fin(Y) & VX(Fin(X) -+ <I>(X, Y, ZI, Z2))),

Thus, for all interpretations of variables the first formula is true in (w, S) if and
only if the second formula is true in (w, S). We leave it to the reader to prove the
following general statement which in particular shows that W SIS can be embedded
into SIS.

Exercise 3.11.3 Prove that for any formula <I> of the weak second order monadic
logic there exists a formula III of the second order monadic logic so that for all
interpretations of variables the formula <I> is true in (w, S) if and only if III is true
in (w, S).

Now our goal is to show that the power of the weak second order monadic
logic coincides with the power of the monadic second order logic. In order to make
this statement precise we give the following definition.

Definition 3.11.2 We say that a subset M c p(w)m is weakly definable if there


exists aformula <I> (X I, ... , Xm) ofthe weak second order monadiclogic such that

Now our goal will be to show that any definable set (in the monadic second
order logic, see Definition 3.10.4) is also weakly definable.
Clearly, every (weakly definable) set M c p(w)m naturally defines an w-
language LM over the alphabet {O, l}m as follows:

LM = {word(BI, ... , Bm) I (B\, ... , Bm) EM}.

We now give the following definition that singles out those languages that corre-
spond to relations definable in the weak monadic second order logic.

Definition 3.11.3 An w-language L C b W is weakly definable if L = LM for


some weakly definable set Me p(w)m.
3.11. An Application of the McNaughton Theorem 205

Here is the desired result that uses the McNaughton theorem. The result states
that the definability in the weak second order monadic logic is equivalent to the
definability in the second order monadic logic.
Theorem 3.11.1 An w-language L is definable if and only if L is weakly definable.
Proof. We have already outlined the proof that weak definability implies
definability. We refer the reader to Exercise 3.11.3, the example considered before
the exercise, and the definitions of definable and weakly definable languages in
order to formally prove this part of the theorem.
We now need to prove that any definable language is in fact weakly defin-
able. So let L be a definable language. Then there exists a BUchi automaton that
recognizes the language L. By the McNaughton theorem (see Theorem 3.8.1),
the language L is MUller recognizable. By the characterization theorem of MUller
recognizable languages (see Theorem 3.7.3), L is a finite Boolean combination of
w-Ianguag<?s of the type W, where each W is FA recognizable. If we can prove
that each W is weakly definable, then by taking the boolean combination of the
formulas (in the second order weak monadic logic) that define the language W, we
see that L ~ weakly definable. Therefore, it suffices to prove the theorem when L
is simply W, where W is an FA recognizable language.
Thus, assume that L = W, where W is an FA recognizable language. The
idea is the following. For the language W, consider a formula <I:> (X 1, ... , Xm)
of the monadic second order theory offinite strings such that W is definable (in
the monadic second order logic of strings) by formula <I:> (X 1, ... , Xm). We recall
that <I:>(Xl, ... , Xm) defines W if for any string W E ({O, l}m)* there exists a
chain C and subsets B 1, ... , Bm of the chain such that w = word(C, B 1, ... , Bm),
and W E W if and only if C satisfies <I:>(Bl, ... , Bm). Then one can obtain a for-
mula \lI (X 1, ... , Xm, y) of the weak monadic second order logic of (w, S) which
simulates <I:> (X 1, ... , Xm) in the following sense. The formula \lI (X 1, ... , X m , y)
states that for any Of E 1: W determined by the sets X I, ... , Xm (that is, Of =
word(Xl, ... , Xm» the infinite string Of uptopositiony satisfies <I:>(Xl,"" Xm).
Below we implement this idea formally.
Let A be a deterministic finite automaton recognizing W. The goal is to write
down the formula that can talk about runs of the automaton A on infinite inputs.
So assume that the initial state of A is 0 and the set S of states is {O, ... , p}. We
define the formula <I:>a (x, X), where X is Xl, ... , X m , as follows:
<I:> a (x, XI,"" Xm) =X EEl Xl& ... X EEm X m,
where for EE is E if E = 1, and ~ otherwise. Informally, this formula codes the
word a E {O, l}m. We note the following fact. Let Bl, ... , Bm be subsets of w.
Then for every nEw there must exist a a E 1: such that <l>a(n, B) holds. It follows
that the formula

Vx (V
aE~
<I:>a(X, B»)
206 3. Biichi Automata

is satisfied in (w, S). We also recall that for each w-word

a = ao ... at ... E }:;w

there exists a sequence B = BI, ... , Bm of subsets of w such that the infinite string
a equals the string word(BI, ... , Bm).
Let Yo, YI, ... , Yp be set variables. The desired formula involves these set
variables. The intention is that each Yi represents the state i of the automaton A. In
the desired formula these set variables will be existentially quantified. Since we are
dealing with the weak monadic second order logic, these variables are supposed
to run ~ver finite ~ubsets of w. We write down the following formula and denote it
by D(y), where Y is Yo, ... , Yp:

&;,.f·..,3z(z E Yi&Z E Yj).

This formula informally states that A cannot be in two distinct states at the same
time.
We define another formula Wa (x, X, Y) as follows:

Vx' [(X :oS x')&<I>a(x, XI, ... , Xm) -+ V (x E Yj)] .


(O,a,j)ET

Informally this formula expresses the fact that if a is the first input signal of an
w-input, then the next state of the automaton A is a j such that (0, a, j) E T. Since
T is a deterministic transition, we note that the state j is unique. The following
note concerns this formula. Suppose that BI, ... , Bm C w. Let a E }:; be such that
(w, S) satisfies <I> a (0, B). Then if the formula

were true (note that the variables Yo, ... , Yp are existentially quantified and hence
run over finite subsets of w), then there would exist a unique j such that S(O)
belongs to Yj and (0, a, j) belongs to T.
We define another formula <l>a,i(X, X, Y, y) and explain its meaning. The
formula is

x E Yi & <l>a(S(x), X) & x < y -+ V (S(x) E Yj)'


(i,a,j)ET

Informally, this formula codes the transition table T of A before reaching the
position y.
Finally, the last formula we need is F(y, Y), defined as
3.11. An Application of the McNaughton Theorem 207

This formula is intended to say that if A has completed its computation up to


position y, then the state of the computation just before reading y is a final state.
Now we write down the desired formula \I! (X j, . . . , Xm) in the weak second
order monadic logic of the structure (w, S):

Vx3y((x < y) & 3Y(D(Y) & VXjVX2(&iES,aEE(\I!a(Xj, X, y)


& ¢a,i(X2, g, Y, y) & F(y, Y»).

Now the reader can check that the language W is definable by this formula of
the weak monadic second logic. We note that the proof of this is quite similar to
the proof of Theorem 3.10.1 (see the exercise below). Thus, we conclude that the
language L is weakly definable. The theorem is proved.

Exercise 3.11.4 Check that the formula \I! (X j, . . . , Xm) provided at the end of
the proof of the theorem above is indeed the desired one.
4
Games Played on Finite Graphs

4.1 Introduction
In studying computations one can follow several approaches. One approach can
generally be called a computational model approach. In this approach one defines
the notion of a computational model, gives exact mathematical definition to the
notion of computation, and then studies languages recognized by these models.
For instance, this is what we did in the previous two chapters: we defined finite
automata, Blichi automata, and computations on these machines and studied lan-
guages recognized by these machines and their properties. Another approach can
generally be called an algebraic approach. In this approach one identifies compu-
tational models with finite algebras and employs known algebraic results in order
to study computations. This is an example of a fruitful interaction of two distinct
areas in which notions from the theory of computations interplay with the notions
of algebra, and lead to new ideas and concepts. This approach is not in the scope
of this book, and hence we will not discuss it.
Another approach can generally be called a logical approach. In this approach
one defines certain formal systems of logic that in some sense capture natural
classes of decision problems. We have already seen elements of this approach.
In the previous two chapters we defined monadic second order logics that, in a
certain precise sense, capture all the computations that can be carried out by finite
automata and Blichi automata. Another example of this approach, which will not
be discussed in this book, is the existential fragment of Peano axioms that captures
all the computations of Turing machines. Finally, there is also a game-theoretic

B. Khoussainov et al., Automata Theory and its Applications


© Birkhäuser Boston 2001
210 4. Games Played on Finite Graphs

approach in the study of computations. In this chapter we discuss some of these


game-theoretic approaches in order to study computations on finite state machines.
The outline of this chapter is as follows. In the next section we consider and
study finite games. We motivate the study of finite games and introduce the notion
of finite game strategy. The third section gives exact definitions of infinite games
that occur on finite graphs. In that section we also discuss some examples and define
an important notion from game theory, the notion of strategy. Section 4 defines the
notion of update network by using game-theoretic terminology. In the last section
a particular emphasis will be given to showing that we can algorithmically extract
winning strategies for the players from the specifications of the games introduced
in this chapter.

4.2 Finite Games


This section is devoted to a formalization of finite duration games with perfect
information that occur on finite graphs. In some sense the games considered in
this section can be thought as models of certain simple interactions between a
programmer and a computer. In such an interaction the goal of the programmer is
to accomplish some tasks in a finite amount of time, while the computer is viewed as
an opponent who tries to prevent the programmer from accomplishing the task. In
other words, the computer acts as a player against the programmer so that the goal
of the player is to put the programmer into a deadlock situation in a finite amount
of time. These types of interactions between the programmer and computer can be
thought of as board games. Our goal in this section is thus to formalize the notion
of games of finite duration and study such games.
This section has three subsections. In the first subsection we informally de-
scribe finite board games. This will include a motivation to give a formal definition
of finite duration games as finite games that occur on finite graphs. The second sub-
section includes some examples of finite games and provides a formalization of
finite games. In particular, the subsection defines several notions such as a play of
the game and the winner of the play. Finally, the last part of this section provides an
algorithm that finds the set of all configurations in a given finite game from which
a given player can always win. The algorithm, in fact, extracts the rules (strategies)
for the players that guarantee a win if possible.
We note that for the reader not familiar with the game-theoretic terminology,
this section is an introductory section and prepares the reader for the next sections
and the next chapter, where more sophisticated games will be investigated.

4.2.1 Informal Description. Let us first begin with an informal description of


finite duration games with perfect information. Examples of such games are tic-
tac-toe, checkers, chess and go. In any of these games usually two players play. The
players move in turn. When a player makes a move the player knows everything
relevant to the game that has occurred previously. Therefore, the game is called the
game with perfect information. Each play can be identified with afinite sequence
4.2. Finite Games 211

of moves of the players. Each play of the game and the outcome of the play are
completely determined by the moves of the players. These games can be thought
as board games. The players move certain pieces on the board and follow certain
rules of the game.
We now give an informal explanation of why we can think of finite-duration
games with perfect information as games on finite graphs. For this purpose the con-
cept of configuration plays an important role. Say we have a board game (think of
two players playing chess). Then a configuration is any state of pieces on the board
that can be considered as a fragment of a play. The configuration tells which player
moves next and describes the current standing (state) of the game. A board game, of
course, has finitely many configurations. Board games with small numbers of con-
figurations, like tic-tac-toe, for example, are not worthy of serious investigation.
This is because we know all the configurations and can find out those configura-
tions from which any of the two players wins. In games with small numbers of
configurations, one can employ exhaustive search techniques in order to find all
the configurations from which a player wins.
Board games with a large number of configurations, like chess, for example,
attract the attention of many experts in mathematics, computer science, statistics,
and many other areas of science. In such a game, the number of configurations is
large enough so that modern computers could not perform an exhaustive search to
find those configurations from which a given player always wins. For this reason,
finding the winner of the game from a given configuration requires sophisticated
arguments that involve mathematical tools, notions, and results. Suppose we have a
finite board game. The number of configurations of the game is finite. So we divide
all these configurations into two sets. The first set, we denote it by B, consists of all
configurations from which a player, say Blue, moves; the second set, we denote it by
G, consists of all configurations from which the other player, say Green, moves.
Now assume that p is a configuration from B and Blue wants to make a move
from this configuration. Potentially, the player may have several choices to make
a move. These choices are dictated by the rules of the game. The move according
to any of these choices produces a configuration from G. Let q], ... ,qn be all
possible configurations in G that can be produced by Blue from the configuration
p. Mathematically, we can express this fact by simply stating that there are directed
edges from the configuration p to configurations q], ... , qn.
The above informal analysis suggests the following idea of formalizing the
notion of a board game. Any board game 9 contains two sets of configurations,
say Band G. These sets are disjoint. The set B is the set of all configurations from
which Blue makes moves. Similarly, the set G is the set of all configurations from
which Green makes moves. In addition, there exist directed edges from configura-
tions in B to certain configurations in G, and from configurations in G to certain
configurations in B. Players make their moves by moving along the edges.
Some configurations are those which guarantee a win to Blue or Green. We
call these configurations winning configurations. Of course, a configuration which
212 4. Games Played on Finite Graphs

is a winning configuration for Blue cannot be a winning configuration for Green.


So we denote the set of winning configurations for Blue by WeB). Similarly,
W(G) is the set of winning configurations for Green. Of course, as we noted,
WeB) nW(G) = 0. If, during a play, Blue is in a winning configuration from
WeB), then the play stops and Blue is announced to be a winner of the play.
Similarly, if, during a play, Green is in a winning configuration from W(G), then
the play stops and Green is announced to be a winner of the play.
This informal description of finite board games will suffice to formally define
and study such games. This is what we will do in the next subsections.

4.2.2 Definition of Finite Games and Examples. The considerations in the


previous subsection suggest us the idea of formalizing the notion of a finite dura-
tion game with perfect information. This is done by identifying any board game
with a game played on a finite graph. Here is a formal definition.

Definition 4.2.1 A finite game, or equivalently a board game, 9 consists of the


following:

1. Two sets of nodes Band G such that B n G = 0. The nodes from Bare
positions of Blue, and the nodes from G are positions of Green.

2. Sets WeB) and W(G) such that WeB) c BUG, W(G) c BUG, and
WeB) n
W(G) = 0. The set WeB) is the set of winning positions for Blue,
and W(C) is the set of winning positions for Green.

3. The set E of directed edges between the positions such that

(a) for each b E B, there exists a directed edge from b to some g E G,


that is, (b, g) E E;
(b) for every g E G there exists a directed edge from g to some b E B,
that is, (g, b) E E.
(c) There is no edge that connects positions of the same player.

Let 9 be a game. We now formally define the notion of a play and the winner
of the play.
Any play in the game 9 game begins with a node, say qo. If qO E WeB),
then the play stops and Blue is declared to be the winner of the play. Similarly,
if qO E W(G), then the play stops and Green is declared to be the winner of the
play. Thus, any sequence

is a play of the game if qi Ii WeB) U W(G) and (qi, qi+l) E E for all i ::: n - 1.
The length of this play is finite and equals n + 1. Note that if qi, i < n, is a
position of Blue (Green) then the next position qi+l is a position of the opponent,
4.2. Finite Games 213

Green (Blue). Of course, as we have already postulated, each move qi+l must be
legitimate, that is, there must be a directed edge from qi to qi+l in the graph of
the game. Blue is the winner of the play if qn E W(B). If qn E W(G), then
Green is the winner. So potentially a play that began from a qO may never end
thus producing an infinite sequence

This happens when no qi in the sequence belongs to W(B) U W(G). We now


consider an example and analyse it.
Example 4.2.1 Consider the graph presented in Figure 4.1.

Figure 4.1: A finite game example.

In Figure 4.1 the positions of Blue are b 1, b2, b3, and b4; the positions of
Green are g 1, g2, g3, g4 and gS. Clearly, for each b E B there exists a directed
edge from b to some g E G, and for each g E G there exists a directed edge from
g to some b E B. Green and Blue can now playa game.
In order to begin a game the players should have winning nodes W(B) and
W(G). Say for example, W(B) = {bl, b2} and W(G) = {g3, g4}. Then any play
that begins from either bl or b2 stops immediately since these are Blue's winning
positions. Similarly, a play that begins from either g3 or g4 stops immediately
since these are Green's winning positions. If a play begins from g 1, then Green has
only one choice, to go to position b2. Hence the play stops and Blue wins. If a play
begins from g2, then in order not to lose Green moves to b3. Blue has two choices
from b3, to move to g3 or to g4. Hence Green is able to win from the positions
g2 and b3. Interestingly, the positions b4 and gS are winning positions for neither
Blue nor Green. Any play that begins either from b4 or gS never ends. Hence no
player wins from positions b4 and gS.
We discussed the example above in a somewhat informal way. Though we
know what it means that a player wins a given play, we have not yet defined what
214 4. Games Played on Finite Graphs

it means that the player wins the game from a given position. Informally, it is
quite clear to say that Blue wins the game from a position p if Blue can reach the
winning set W (B) no matter what Green does. Similarly, Green wins the game
from a position q if Green can reach a position in W (G) no matter how Blue acts.
However, it is not so obvious to give a formal mathematical definition of the winner
of the game from a position. To do that we need to define strategies.

Definition 4.2.2 A finite game strategy for Blue is a function f from B into G
suchthatforallb E B, (b, f(b)) E E.

Thus, if f is a finite game strategy for Blue, then Blue can follow f by moving
to f (b) each time a play is in a position b E B. Note that the move from b into
f(b) is legitimate. Thus, any play of the form

or of the form
go, bo, f(bo), bl, f(b[), ...
is one at which Blue follows f. These plays are called consistent with f. Here
now is an important definition of this section.

Definition 4.2.3 We say that Blue wins the game from a position q if Blue has a
finite game strategy f, called a winning strategy, with the following property:
any time Blue plays from q following f, Blue eventually reaches the set W(B).

Thus, from this definition we see that Blue wins the game from position q if
Blue has a finite game strategy such that any play consistent with f stops in finite
time and Blue is the winner of the play. We now assume that the reader will have
no trouble in solving the two exercises below.

Exercise 4.2.1 Define the notion of a finite game strategy and a winning strategy
for Green.

Exercise 4.2.2 Consider the graph ofthe game p resented in Fig ure 4.1. Let W (B) =
{b4, g5}, W(G) = {bI, g2}.

1. What are the positions from which Blue wins?

2. What are the positions from which Green wins?

We consider another example of a finite graph game between Blue and Green.
The graph of the game is presented in Figure 4.2.

Example 4.2.2 In the example presented in Figure 4.1, the set B = {bI, b2, b3,
b4, b5, b6} and the set G = {g 1, g2, g3, g4, g5, g6}. We assume that the winning
sets are W(B) = {b3, b4} and W(G) = {g6}.
4.2. Finite Games 215

Figure 4.2: Another example of a finite game.

The difference between this game and the game in the previous example is
the following. In this game any position is a winning position either for Blue or
for Green. In other words, for each position q, either Blue or Green wins the game
from q.
Exercise 4.2.3 Consider the example pictured in Figure 4.2 with winning sets
WeB) = {b3, b4} and W(G) = {g6}.
1. Determine all the positions from which Blue wins.
2. Determine all the positions from which Green wins.
Exercise 4.2.4 Consider the example pictured in Figure 4.2 with winning sets
WeB) = {g6} and W(G) = {b1}.
1. Determine all the positions from which Blue wins.
2. Determine all the positions from which Green wins.
3. Determine all the positions from which no player wins.

4.2.3 Finding The Winners. In this section we show how one can extract finite
game winning strategies for players. In what follows, the reader should refer to the
two examples of games considered in the previous subsection in order to easily
follow the notions introduced. Thus, assume that we are given a finite game

9 = (B, G, E, WeB), W(G»,


where Band G are the positions of Blue and Green, respectively, E is the set
of directed edges between positions, and W (B), W (G) are the set of winning
positions.
Our goal is the following. We fix a player, say Blue, and want to find all
positions in the game from which Blue wins all the plays no matter what the
216 4. Games Played on Finite Graphs

opponent, that is, Green does. We call this set of positions Blue s favorites and
denote this set by B(F). The set B(F) of Blues's favorites will be defined by
stages. At stage s, the set Bs (F) will be defined. Informally, Bs (F) will be the set
of all positions from which Blue can win any play in at most s number of moves
made by both players no matter what Green does. Then B(F) will be the union
of all sets of the type Bs (F). In our description of each stage in defining the set
Bs(F) we make our comments about each stage in double brackets [[like this]].
Such comments are not a part of the description of the stage but help the reader to
follow the idea.
Stage O. We let Bo(F) = WeB). [[Thus, if a play begins from any position
in WeB), then Blue has no need to make a move. This is because any play that
begins from a position in WeB) stops and Blue is declared to be a winner.]]
Stage s + 1. Assume that Bs(F) has been defined. By induction hypothesis,
Blue can win any play from any position in B s (F) in at most s number of moves
no matter what the opponent does. Take any position q of the game. If q E Bs(F)
then put q into B s+! (F). Assume that q ~ Bs(F). Then there are two cases.
Case 1: q E B. Then we put q into B s+ 1(F) if there exists an edge from q
to some q' E G such that q' E Bs(F). [[Thus, if q E B and is put into Bs+I, then
Blue can win any play from q in at most s + 1 moves. To do this, the first move of
Blue from q must be a q' for which q' E Bs(F).]]
Case 2: q E G. Then we put q into B s+! (F) if all edges from q lead to those
q' E B for which q' E Bs(F). [[Thus, if q E G and is put into Bs+I, then Blue can
win any play from q in at most s + 1 moves. To do this, Blue waits for the move
of Green from q. Any move of Green from q produces a position q' for which
q' E Bs(F).]]
From the comments inside the brackets in considering the two cases, we
conclude that Bs+I (F) satisfies the inductive hypothesis. In other words, Blue can
win any play from any position in Bs+I (F) in at most s + 1 moves no matter what
the opponent does. This ends the description of Stage s + 1. We now prove some
facts about the construction given.

Lemma 4.2.1 For each s, Bs(F) C Bs+I (F).


Proof. This follows from the description of Stage s + 1 before the two cases
are considered. Indeed, at Stage s + 1, if q E Bs(F), then put q into Bs+I (F). The
lemma is proved.
Thus, by the lemma we have the following sequence of sets of positions:

Bo(F) C BI (F) c B2(F) c ....


We now let
B(F) = Bo(F) U BI (F) U B2(F) U ....
4.2. Finite Games 217

Since the set of all positions in the game graph is finite, there exists a stage t + 1
such that Bt+1 (F) = Bt(F). Now we prove the following theorem that shows that
Blue wins all the plays from any given position in B(F).

Theorem 4.2.1 Consider the game Q. Then Blue can win any play that begins
from a position q if and only if q is Blue's favorite, that is, q E B (F).

Proof. Suppose that q E B(F). Then q E Bs(F) for some s. Hence, by the
description of Stage s, we see that Blue can win any play from any position in
Bs (F) in at most s moves no matter what the opponent does. More formally, we
need to define a finite game strategy f : B --+ G such that f is a winning strategy
for Blue. To define f we linearly order the set G. Say gl < g2 < ... < gk is
the ordering of all elements in G. We define f as follows. Take b E B. Assume
b E B(F). Then b E Bs+I (F) \ Bs(F) for some s. Then f(b) is the minimal gin G
(with respect to the ordering) such that (b, g) E E and g E Bs(F). Note that such
a g exists. If b fj. B(F), then f(b) is the minimal g with respect to the ordering
such that (b, g) E E. Clearly, the strategy f is a finite game strategy. Moreover it
is a winning strategy from any q E B(F).
Assume that q fj. B (F). We need to show that Blue cannot win the game from
q. We informally describe a finite game strategy for Green so that if Green follows
the strategy, then Blue wins no play from q. If q E B, then Green can do nothing
but wait for the move of Blue. We claim that any move of Blue from q produces
a q' such that q' fj. B(F). Assume the opposite. Then Blue can move from q to a
position q' such that q' E B(F). Hence for some s, q' E Bs(F). Then at stage s + 1
the position q must be put into Bs+I (F). But q fj. B(F). This is a contradiction.
Hence any move of Blue from q produces a q' such that q fj. B(F). If q E G,
then we claim that Green has a move q' from q such that q' fj. B(F). Indeed,
otherwise q would belong to B(F) which would again be a contradiction. Hence
Green moves to a position q' such that q' fj. B(F). Formally this strategy, denoted
by h, is defined as follows. We linearly order the set B. Say bl < b2 < ... < b t
is the ordering of all elements in B. Then for all g E G, if g E B(F) then h(g) is
the first element b (with respect to the ordering) for which (g, b) E E; otherwise
h(g) is the minimal bi such that bi fj. B(F) and (g, bi) E E. Clearly, h is a finite
game strategy. As we have already noted, if Green follows h, then any play from
q will never end up in B(F) and hence in W(B). The theorem is proved.
The reader can define the set G (F) of all Green's favorite positions similar
to the definition of B(F). We suggest that the reader go through the next two
exercises.

Exercise 4.2.5 Consider the game Q. Define the set G(F) and prove that Green
can win any play that begins from a position p if and only if p is Greens's favorite,
that is, p E G(F).
218 4. Games Played on Finite Graphs

Exercise 4.2.6 Consider the game g. Call the positions that are not members of
B(F) U G(F) neutral positions. Prove the following:

1. Green cannot defeat Blue from a neutral position.

2. Blue cannot defeat Green from a neutral position.

4.3 Infinite Games


In this section we study infinite games. The games we study will occur on fi-
nite graphs. This resembles finite board games considered in the previous section.
However, in contrast to finite games, plays in these new games are infinite se-
quences. The goal of this section is to informally explain these infinite games on
finite graphs, give some motivation, give formal definitions of these games, and
introduce the notion of strategy, winning strategy and the winner.

4.3.1 Informal Description and an Example. A goal of studying infinite games


on finite graphs is to model processes of infinite duration, that is, the processes for
which termination is considered to be a failure. We have already studied processes
of infinite duration in the previous chapter by introducing BUchi automata, MUller
automata and sequential Rabin automata. Infinite games can be considered as an-
other type of mathematical model that studies processes of infinite duration. We
recall some examples of such processes. Take for example a multi-user computer
system. Usually at any given time several programs are running, some are about
to finish their job, and others are about to start. A run of this system is an ongo-
ing process, ideally without termination. Computer banking systems and network
communication systems are other examples of infinite duration systems.
Let us now informally explain how a game idea can be used in reasoning about
infinite duration processes. Say we have an infinite duration system. Consider a run
of the system. In practice such systems have a finite number of states. Therefore,
the run of the system can be thought as an infinite sequence

of states. The state So is the initial state. The state Sj is a state obtained by execution
of a certain command from so, the state S2 is a state obtained by execution of a
certain command from Sj , etc. The success of this run depends on whether or not
the run satisfies certain specifications given by (or inherited from) the software
or hardware of the system. One can look at this sequence as a play between two
players. Let us call the players Blue and Green. Say Blue makes the first move by
choosing so. Then Green responses by choosing Sj, Blue moves to S2, etc. Thus,
the players produce the infinite play so, Sj, S2, . . . . The goal of one of the players,
say Blue, is to satisfy the specification, while the goal of the opponent (in this case
Green) is not to allow the specification to be satisfied.
4.3. Infinite Games 219

An informal example of a game is the running of a business. There are two


players in this game: the manager of the business and his opponent, the market. In
general, there is no point at which the manager wins, and there is no point at which
the manager loses all of the stock. So any play can be considered as an infinite
process. The manager wins the play if and only if there are infinitely many periods
at which the business makes profits, and finitely many periods when the business
shows a loss.
Thus, generally speaking, during a play there is no termination point. Instead
there are some special events that may happen continually. If some combination
of these evens happens predominantly (more formally: infinitely often) then one
player wins, otherwise the other player wins.
In order to make our explanation more formal, let us consider the following
example given by McNaughton.
Example 4.3.1 Consider the game graph represented in Figure 4.3.

Figure 4.3: An example of an infinite game.

In this example, the game is represented as a graph that can be thought as a


system with six states. Blue owns the states b 1, b2, and b3. These are the positions
from which the player makes the moves. Green owns three states gl, g2, and g3
from which Green makes the moves. An example of a play is the sequence
gl, bl, g3, b3, gl, bl, g3, b3, ....
More generally, a play that occurs in this graph is an infinite sequence so, Sl, S2, S3,
.,. so that each pair (Si, Si+l) is a directed edge of the graph for all i E w. In order
to visualize a play we describe it informally as follows. There is a placemarker.
At any time of the play of the game the placemarker is on a node which is either
owned by Blue or owned by Green. The player who owns the node always moves
the placemarker along the edges of the game graph determined by E. Again, as we
did in the previous section, we use graphs to represent games of infinite duration.
In the game presented in Figure 4.3 the special events that may happen continually
correspond to whether or not certain nodes are visited during a play. Let us assume
that those special events are the nodes b 1 and g 1. Here now is how we specify the
winning plays in terms of the special nodes. We say that Blue wins a play if either
220 4. Games Played on Finite Graphs

both of the nodes bland glare visited infinitely often or each of these nodes is
visited finitely often. Thus, for example Blue wins the play

gI, bI, g3, b3, gI, bI, g3, b3, ...

because the nodes bland g 1 both are visited infinitely often. Blue also wins the
play

gI,bI,g3,b3,gI,bI,g3,b3,g2,b2,g3,b3,g2,b2,g3,b3, ...

in which the fragment g2, b2, g3, b3 continues forever. In the play, each of the
nodes bland g 1 is visited finitely often. Hence by the definition, Blue wins the
play. Green, for instance wins the play

gI,b2,g3,b3,gI,b2,g3,b3,gI,b2,g3,b3, ...

because g 1 is visited infinitely often but b 1 is visited finitely often (in fact is never
visited in this play).

4.3.2 Formal Definition of Games. Our informal description of infinite dura-


tion games (with perfect information) and the example discussed in the previous
subsection leads us to the following definition.

Definition 4.3.1 A game 9 is a six tuple (Q, B, G, E, W, Q), where we have the
following:

1. Q is the set of nodes called positions.

2. Band G are subsets of Q such that B n


G = 0 and BUG = Q. The nodes
of B are positions of Blue, and the nodes of G are positions of Green.

3. E is a set of directed edges between Band G such that

(a) for each b E B there exists agE G such that (b, g) E E;


(b) for each g E G there exists abE B such that (g, b) E E.

4. W is a subset of Q called the set of special positions.

5. Finally, Q is a set of some subsets of W. These are called winning sets for
Blue.

Let 9 be a game. The game graph is the graph (B U G, E). Consider, for
instance, Example 4.3.1 discussed in the previous subsection. For that game Q =
{g 1, g2, g3, b 1, b2, b3}, E is the set of edges of the game graph, W is the set
{gI, bI}, and Q consists of {bI, gI} and 0.
Now let us fix a game g. All the plays of 9 occur in the game graph. In order
to visualize a play we describe it informally as follows. There is a placemarker. At
4.3. Infinite Games 221

any time of a play of the game the placemarker is on a node which is either in B or
G. If the node is in B, then it is Blue's turn to move the placemarker. If the node is
in G, then it is Green s turn to move the placemarker. The placemarker is always
moved along the edges of the game graph determined by E. An important point is
that when the placemarker is put on a position there is always a possibility to move
the placemarker in order to continue the play. This is stipulated by conditions 3a)
and 3b) of the definition of the game.
Let us now see how a play is played. Let bo be a position, say of Blue. Assume
that Blue begins its move by putting the placemarker on gO so that (bo, go) E E.
Green responds by putting the placemarker on a bl, so that (gO, bl) E E. Blue
responds by moving along an edge and puts the placemarker on a position gl , etc.
Thus the players will produce an infinite sequence:

p = bo, gO, bl, gl, ....


This sequence is called a play of the game that begins from boo We formalize the
notion of play in the next definition.

Definition 4.3.2 Let 9 be a game. A play that begins from a position q is an infinite
sequence

such that q = qO and (qi, qi+l) E E for all i E W, where E is the edge relation in
the graph of the game g.

We want to define what it means that a given player wins the game. Let p be a
play. In the play p consider the set of all nodes t that have the following properties:

1. t belongs to W, and

2. t occurs in the play p infinitely often.

We denote this set by In(p) and call it the infinity set of p. Then Blue wins the
play if In(p) E n. Otherwise Green wins the play. Thus, every play is won by one
of the players. This clearly contrasts with the situation for plays that occur on finite
games considered in the previous section.
Let us now,as an example, analyse the situation for the game 9 when W = 0.
By the definition of n, the set n is a subset of the set of all subsets of W. The set of
all subsets of W is just {0}. Hence n c {0}. We conclude that if W is an empty set,
then there are two possibilities for n, either n = 0 or n = {0}. Let us consider
each of these cases. Assume that n = 0. Consider any play p of the game g. By
the definition of In(p) we have In(p) = 0. Note that 0 ft n. Hence Green wins
any play p when n = 0. Assume that n = {0}. Consider any play p of the game
g. By the definition of In(p) we have In(p) = 0. Note that 0 E n. Hence Blue
wins any play p when n = {0}.
222 4. Garnes Played on Finite Graphs

Exercise 4.3.1 Consider the graph game in Figure 4.4.


Study the games and their winning plays for the following games that occur
on the graph presented in Figure 4.4.
1. W = fbi}, Q = {0, {bI}}.
2. W = fbi, gil, Q = {0, fbi, gI}}.

3. W = {gI, g2}, Q = {{gIl. {g2}}.


4. W = {gI, g2}, Q = {{gIl. {gI, g2}}.
5. W = {gil, Q = {{gil, 0}.

Figure 4.4

4.3.3 Strategies. As it was for finite games, the notion of a strategy for infinite
games plays an important role. This notion allows one to give a formal definition
of the winner of the game from a given position. Informally, a strategy for a player
in a given game is a rule that specifies the next move (along the edge) of the player
given the history of the preceding moves. Let us formalize this notion. Let

be a play in the game g. Then the histories of this play are

Of course there are infinitely many histories in the given game g. Thus, one can
think of a strategy as a rule that specifies the next move (along the edge) of the
player given the history of the play at the current moment. So we can consider two
sets of histories, the set H (B) that contains all histories whose last positions are
positions where Blue makes a move, and the set H(G) that contains all histories
whose last positions are positions where Green makes a move. Then a strategy for
Blue is a function f that maps H (B) into G such that for all u = qO ... qn E H (B),
(qn, feu)) E E. Similarly, a strategy for Green is a function h that maps H (G)
into B such that for all u = qo ... qn E H(G), (qn, h(u)) E E. Thus, strategies
are, in general, infinite objects since they operate on infinite sets of histories. This
is where strategies for finite games differ from strategies for infinite games.
Let f be a strategy for a player. Let q be a position in the game. Then we can
consider all the plays that begin from q which are played when the player follows
the strategy f. We call these plays consistent with f. Here now is an important
definition of the chapter.
4.3. Infinite Games 223

Definition 4.3.3 We say that the strategy f ofa player is a winning strategy from
a position q if all plays consistent with f and that begin from q are won by the
player. In this case we say that the player wins the game from q.
Let f, h be strategies such that Blue follows f and Green follows h. Consider
the play in which the first player follows the strategy f and the second player
follows the strategy h. Hence either Blue wins the play or Green wins the play. In
the former case, we say that f wins against h from position q, and in the latter
case, we say that h wins against f from q.
We now consider several examples.
Example 4.3.2 Consider the graph game pictured in Figure 4.5.

Figure 4.5

Assume that W = {g 1, g2} and r2 = {{g 1 n.


Blue wins this game. The winning strategy for Blue consists of moving
to the position g 1 all the time. The play consistent with this strategy is either
bI, gI, bI, gI, bI, gI, bI, gI, ... or gI, bI, gI, bI, gI, bI, gI, ... or g2, bI, gI,
bI, gI, bI, gI, ....
Example 4.3.3 Consider the game pictured in Figure 4.6.

Figure 4.6

In this game W = {gI, bI} and r2 = {0, {bI, gil}.


We claim that Blue wins from any position of the game. We will show this by
analyzing the game. First of all, we note that on the nodes bland b2, Blue has no
choices but move to g3. Similarly, Green has only one choice on node g3. On the
node b3, Blue has two choices: Blue can move to either g 1 or g3. If Blue always
moves to g 1 from b3, then Green wins by always moving from g 1 to b2. This is
because, in this case, the players produce the following play:
224 4. Games Played on Finite Graphs

p = b3, gl, b2, g3, b3, gl, b2, g3, b3, gl, b2, g3, ....
Clearly,ln(p) = {gl} and hence In(p) rt [l. Therefore, Green wins. Thus, in
order to win every play from position b3, Blue should follow more sophisticated
strategy. Here is a strategy for Blue on the node b3.
1. If b 1 has never been visited, then move to g2.

2. If among b 1 and g 1 the node b 1 was last visited, then move to g 1.

3. In all other, cases move to g2.


The point is that if Blue follows the strategy described above, Blue wins every play
in the game. Indeed, assume that Green never visits b 1. Well, on the node b3 Blue
always moves to g2. This means the infinity set of the play is 0. Hence Blue wins
the play. Therefore, Green is forced to move to b 1. As soon as b 1 is visited Blue
moves to g 1 from b3. Hence each visit to bl is immediately followed by a visit to
g 1. Thus, if b 1 is visited infinitely often, then g 1 is also visited infinitely often. We
conclude that the infinity set of such a play is {b 1, g I} and belongs to [l. Hence
Blue wins the play. If b 1 is visited finitely often, then, according to the strategy,
Blue never visits g 1 after b 1 is visited the last time. Therefore, in a play p in which
b 1 is visited finitely often, the infinity set is 0 and belongs to [l. So Blue wins p.
Exercise 4.3.2 Consider the game graph of the example above (Example 4.3.3).
Consider the games defined below that occur on the graph:
1. W = {gl, bd and [l = {{bd, {gd}·
2. W = {gl, bd and [l = {{bl, gd, {gd}.
3. W = {g\, g2} and [l = {0, {gl, g2}}.
4. W = {g\, b2} and [l = {{g\, b2}, 0}.
5. W = {g\, b2} and [l = {{gd, 0}.
6. W = BUG and [l = {W}.
Let q be any position on any of these games. Show that for each of these games
one of the players always wins the game from the position q.

4.4 Update Games and Update Networks


In this section we introduce the notion of update network by using the concept of
game. The section consists of two parts. In the first part we motivate and define
update games and networks. We present several examples. The second part contains
several results about update networks. In particular, we will show that there exists
an algorithm that, given any game, decides whether or not the game is an update
network.
4.4. Update Gaines and Update Networks 225

4.4.1 Update Games and Examples. In this section our goal is to show that
we can model natural communication network problems using the notion of game
introduced in the previous section. Suppose we have data stored on each node of a
network and we want to continuously update all nodes with consistent data. For in-
stance, we are interested in addressing redundancy issues in distributed databases.
Often one requirement is to share key information between all nodes of the dis-
tributed database. We can do this by having a data packet of current information
continuously go through all nodes of the network. This is essentially an infinite du-
ration game where one of the player's, say Blue's, objective is to achieve a winning
set equal to all the nodes of the network. We give an example.
Example 4.4.1 Consider the game pictured in Figure 4.7.

Figure 4.7: An update game.

Blue's objective is to update each node of the graph infinitely often. Clearly, in
this game, Blue wins the game from any position. A winning strategy is to visit the
nodes gI, ... , gk turn by turn. Now we formally define update games as follows.
Definition 4.4.1 An update game is a game Q = (Q, B, G, E, W, Q) for which
W = Q and Q = {Q}.

Thus, in an update game, Blue's objective consists of visiting every node of


the game graph infinitely often from any position. Let us consider several examples.
Exercise 4.4.1 Consider the update game in which Blue has only one position b.
Prove that Blue wins such a game if and only if for every g E G, there exists a
directed edge from b into g.
Example 4.4.2 Consider the update game pictured in Figure 4.8.
In this example Green has five positions. From each of these positions
Green has only one outgoing edge. Let us consider the sets {g4, g5, b3, b4},
{gI, g2, bI, b2}, and {bI, g3}. Call them the first cycle, the second cycle and the
third cycle, respectively. Blue can win the game by periodically visiting all the
nodes of the first cycle, then the second cycle and the third cycle, etc.
226 4. Games Played on Finite Graphs

Figure 4.8: Another update game.

Figure 4.9: Another update game.

Example 4.4.3 Consider the update game pictured in Figure 4.9.


Green can win this game by always moving to the node b2 from the node g 1
and g2. This strategy allows Green to avoid the node b 1 forever after g 1 is visited.
Motivated by these examples we now give the following definition.
Definition 4.4.2 An update game g is an update network if Blue has a winning
strategy to win the update game from any position of the game.
Thus, the first two examples above are examples of update networks while the
last example is not an update network. Sometimes we will talk about a graph game
being an update game without mentioning the winning set, since it is understood
that W = Q and n = {W}.

4.4.2 Deciding Update Networks. Now our goal is to study update games and
update networks. In particular we want to show a method in which a given update
game tells us whether or not the game is an update network. We note that we can
easily characterize those update networks with only one Blue vertex b. These are
update games such that for every g E G, there exists a directed edge from b into
g (see Exercise 4.4.1).
We begin with the following lemma. For the lemma we need the following
notion. Let 9 be an update game. We say that Green is forced from the node
g E G to move to b E B if (g, b) E E and for all b' E B if (g, b') E E, then
b = b'. In other words, (g, b) is the only edge outgoing from g.
Lemma 4.4.1 If9 is an update network, thenfor every node bE B there exists at
least one g E G from which Green is forced to move to b.
4.4. Update Games and Update Networks 227

Proof. The idea is to show that if there exists a node h that does not satisfy the
statement of the lemma, then Green can always avoid visiting h. So let us assume
that such a node exists and is h. Then Green has the following winning strategy.
For any g E G, if (g, h) E E, then move to a hi =1= b. Thus, Blue will never be able
to visit node b. This contradicts the assumption that 9 is an update network. The
lemma is proved.
For an update game 9 and any Blue node b define
Forced(b) = {g I Green is forced from g E G to move to bE B},
which denotes the set of Green that are "forced" to move to b.
Lemma 4.4.2 If 9 is an update network such that B has more than two nodes,
then for every b E B there exists a node b' =1= b and a node g E Forced(b), such
that (b ' , g), (g, b) E E.
Proof. The idea is to show that if there exists a node b that does not satisfy
the statement of the lemma, then 9 is not an update network. So let us assume
that such a node exists and is b. Consider the set Forced (b). Since 9 is an update
network, by the lemma above Forced(b) =1= 0. Then for every b' =1= b there does
not exist agE Forced(b) for which (b ' , g) E E. Thus Green wins by not moving
to b from any position not in Forced(b). Thus, 9 is not an update network. This
contradicts the assumption that 9 is an update network. The lemma is proved.
Definition 4.4.3 Given an update game g, a forced cycle is a sequence gk, bk,
... , g2, b2, gl, bl such that gi E Forced (bi), (bl, gk) E E, and bi E B.
Note that forced cycles have even length. Note that Blue can stay in any
forced cycle as long as it is needed. Hence Green has no control on any forced
cycle but stays in the cycle. We now present our penultimate ingredient that will
be used to reduce the size of a given update game.
Lemma 4.4.3 Let 9 be an update network such that B has more than one node.
Then there exists a forced cycle of length at least 4.
Proof. Take bl E B. From Lemma 4.4.2 there exists a sequence b2, gl, bl
such that h2 =1= bl, gl E Forced(bl), and (b2, gl) E E. Now for b2 we apply the
lemma again to get a sequence h3, g2, b2 such that b3 =1= b2 and g2 E Forced(b2)
and (h3, g2) E E. If h3 = bl we are done. Otherwise repeat Lemma 4.4.2 for vertex
b3. If b4 E {hI, h2} we are done. Otherwise repeat the lemma for b4. Eventually
bi E {bl, b2, ... , hi-2} since BUG is finite. The lemma is proved.
Exercise 4.4.2 Show that if an update game r does not have a forced cycle of
length at least 4, then either Blue has only one node or Qis not an update network.
We now present a method that helps us decide if an update game is an update
network.
228 4. Games Played on Finite Graphs

Lemma 4.4.4 If9 is a bipartite update game with aforced cycle of length at least
4, then we can construct a bipartite update game g' with a number of nodes less
than the nodes in 9 such that 9 is an update network if and only if g' is one.

Proof. Let C = (gk, bk, ... , g2, b2, gl, bl) be a forced cycle in 9 of length
at least 4. The idea of constructing g' is the following. We can contract the nodes
gl, ... ,gk onto one new node g. We also contract the nodes bl, ... , bk into one
new node b. Thus, in the new game the nodes g and b will be used to represent
plays that occur inside the cycle C in the original game g. Note that Green will
never be able to leave the cycle C in the game 9 because Green is forced to stay in
the cycle. Therefore, any move of Green in the cycle C will be reflected as a move
from the node g into the node b in the new game. Also if Blue decides to stay in
C, then the move of Blue in C will be reflected as a move from b into g in the new
game. We now formally construct g' as follows. In the game g', Blue positions B'
and Green positions G' are defined as follows:

B' = (B \ {bl, b2, ... , bk}) U {b} and G' = (G \ {gl, g2, ... , gk}) U {g}.

Let

E' =E\ {(gl, b[), ... , (gk, bk), (bl' gk)}


U feb, g') I g' E G' and (bi' g') E E, for some i :s k}
U reg', b) I g' E G' and (g', bi) E E, for some i :s k}
U feb', g) I b' E B' and (b', gi) E E, for some i :s k}
U feb, g), (g, b)}.

We now show that if g' is an update network, then 9 is also an update network.
We first define the natural mapping p from the nodes of 9 onto the nodes of g' by

p(v) = v if v fj C,
P (v) = g if v E C n G,
p(v)=b ifvECnB.

Then any play history of 9 is mapped, via the function p (v) = v', onto a play
history of g'. Consider a play history va, VI, ... , Vn of 9 that starts at node va. Let
f' be a winning strategy for the Survivor when the game begins at the node vb.
We use the mapping p to construct the Blue's strategy f in game 9 by considering
the following two cases.
Case 1. Assume that v~ = b. The strategy is to extend the play (in g) by
visiting all the vertices of the cycle C at least once. If f' (vb, ... , v~) = g', where
g' =1= g, we find a bi E C such that (bi' g') E E, then extend the play again with
g' as the last move. Otherwise f'(vb, ... , v~) = g and the play is extended by
picking a gk E C such that (vn, gk) E E.
4.4. Update Games and Update Networks 229

Case 2. Assume that v~ oF b. If f' (vb, ... , v~) = g' oF g, then f will also
move to g'. Otherwise g' E C and the play is extended by picking a gk E C such
that (vn, gk) E E.
It is not hard to see that f is a winning strategy for the Survivor in game 9
whenever f' is a winning strategy in g'.
We now show that if 9 is an update network, then g' is also an update
network. Take any node vb from r'. We show that there is a winning strategy for
the Survivor starting at vb. Fix any node Va such that p(va) = vb. We will keep a
v;
correspondence between positions Vi of a play on 9 with positions of a play on
g'. We now simulate the winning strategy f on 9 starting at Va. The strategy for
the initial play history vb E B' is f' (vb) = p(f (va)) except for the case vb = b
(or vb = g, which is a forced move to vi = b). In this exceptional case the Blue's
initial strategy is to move directly to any g' oF g and replace f with the strategy
starting at g'. Now let vb, vi, ... , v~ be any play history of g' that occurs after
the initial playas dictated above. We define a strategy for f' when v~ is in B' by
studying two cases.
Case 1. Assume that v~ = s. Consider the previous vertex v; = g' oF g of
the play history that is in G' and v;+! = b. Thus in the game on g, Green from g'
elects to move to some bi in C. Since with respect to the actual game played on g'
the Green has less power, we can pick, without loss of generality, that it moved to
bi where i is the smallest allowable index. The strategy f' now simulates what f
would do from bi. There are two cases again: (1) if f moves to a vertex g j on C,
then f' moves to a, or (2) if f moves to a vertex g' not on C then also f' moves
to g'. In the first instance the strategy f' forces a play that toggles between a and
s in g' until case (2) holds. (And this must happen since f is an update strategy.)
Case 2. Assume that v~ oF b. Here the strategy is simply f'(vb, ... , v~) =
p(f(va, ... , vn )). That is, the play follows the strategy f on the simulated game
history of B.
The strategy f' for Blue is an update strategy since p is a mapping from 9
onto g' (i.e., if all nodes of 9 are infinitely repeated via f then all vertices of r'
are infinitely repeated via f'). Thus, the lemma is proved.
In order to demonstrate how the lemma works we consider the following
example pictured in Figure 4.lO.
In this example we have a game g. Consider the forced cycle b4, g5, b3,
g4. The length of this cycle is 4. We contract the nodes b4, b3, and g5, g4 into
new nodes band g, respectively. Now we get the new game g' with less nodes.
Figure 4.11 is a graph representation of g'.
Now in the game g', the cycle gl, bl, g2, b2 is forced and hence we can
contract it into new nodes g' and b', and thus aplying the lemma above obtain the
game gil pictured in Figure 4.12.
Now in the game gil we can contract the forced cycle b, g', b', g into new
nodes gil and b", and thus applying the lemma above obtain the following game
gil' in Figure 4.13.
230 4. Games Played on Finite Graphs

Figure 4.10

Figure 4.11

Thus, by the lemma above the original game 9 is an update game. Now we
can conclude this section with the following theorem.

Theorem 4.4.1 There exists an algorithm that, given an update game 9, decides
whether or not the game 9 is an update network.

Proof. Let 9 be a game. If Blue has only one node, then we know how to
decide whether or not 9 is an update network. So suppose that Blue has more than
one node. If 9 does not have a forced cycle of length 2: 4, then 9 is not an update
network. Otherwise, by the lemma above we can construct a new game 91 such
that the number of nodes of 91 is less than the nodes in 9, and 9 is an update
network if and only if 91 is one. If Blue has only one node in 9 I, then we know
how to decide whether or not 9 I is an update network. So suppose that Blue has
more than one node in 91. If 9 I does not have a forced cycle of length 2: 4 then
9 I is not an update network. Hence 9 is not an update network. Otherwise, by the
lemma above we can construct a new game 92 such that the number of nodes of
92 is less than the nodes in 9 I, and 9 I is an update network if and only if 92 is
one. Thus continuing this procedure we obtain 9n such that either Blue has one
node only, or 9n has no forced cycles of length greater than 4. In either case we
can decide if 9m is an update network. This proves the theorem.
4.5. Solving Games 231

Figure 4.12

Figure 4.13

4.5 Solving Games


In the previous section we studied update games. Of course we know that not all
games are update games since in update games the set W of special nodes coincides
with the set of all nodes of the given game, and the set Q has a particular form,
that is Q = {W}. Natural questions suggested by the previous sections and all the
examples considered are the following.

1. Let Q be a game and q be a position in the game. Is it true that one of the
players can always win the game from the position q?

2. Does there exist an algorithm that, given a game Q, computes all the positions
from which a given player wins?

3. Does there exist an algorithm that, given a game Q, computes a winning


strategy (if one exists) for a given player from a given position?

Our goal in this section will be to show that we can answer all these questions
positively.

4.5.1 Forgetful Strategies. Our goal is to define strategies called forgetful


strategies and show that it suffices to restrict ourselves to the study of these strate-
gies in order to find the winner of the game from any given position. In order to
motivate the consideration of forgetful strategies we revisit one of our examples
(see Example 4.3.3).
232 4. Games Played on Finite Graphs

Figure 4.14

Example 4.5.1 Consider the game pictured in Figure 4.14.


In this game, W = {gI, bI} and Q = {0, {bI, giH.
We know that Blue wins this game. The winning strategy for Blue is defined
as follows:
1. If b 1 has never been visited, then move to g2.
2. If among bland g 1 the node b 1 was last visited, then move to g 1.
3. In all other cases move to g2.
An important feature of the strategy described in this example is the following.
The strategy depends on the nodes visited in Wand the order of the visitation. In
other words, the strategy does not have to remember all the history of the play,
and hence is allowed to forget some information about the history of the play. This
example suggests the idea of introducing the notion of strategy that depends on the
nodes visited in Wand the order of the visitation. We formalize this by introducing
the notion of the latest visitation record.
Let p be a history (position) of a play in the game g. We define the latest
visitation record of p. We denote this by lvr(p). In the game 9 we assume that
the empty sequence A is the lvr just before any play. In particular, if p is the empty
history (the play has not started yet) then the lvr of p is A. Assume that the lvr of
the proceeding position of the history p has been defined. We want to define the
lvr of the position p. If currently the placemaker is on a node outside of W, then
the lvr for the current position p is the same as it was for the preceding position.
If the placemarker currently is on some node W E Wand the lvr is

WI··· Wn

for the preceding position, then the lvr for the current position is defined as follows:
1. If no Wi equals w, i = 1, ... , n, then the sequence
WI ... WnW

is the lvr for the current position p.


4.5. Solving Games 233

2. If Wi = W for some i ~ n, then

WI··· Wi-I Wi+1 ... WnW

is the new lvr of the current position p.

Informally, the lvr keeps record of the order of visiting the set W, and if W E W
has just been visited, then lvr forgets the previous visit of w. Consider the example
above. Let p be the following play:

gl,bl,g3,b3,g2,bl,g3,b3,gl,b2,g3,b3,gl,bl, ....

This play then produces the following sequence of lvrs:

A, gl, glbl, glbl, glbl, glbl, glbl, glbl,


glbl, blgl, blgl, blgl, blgl, blgl, glbl, ....

Note that each lvr is a finite sequence of nodes from W without repetitions. There-
fore, since W is a finite set, the set of alllvrs is also a finite set. We denote the set of
all latest visitation records by Display(W). Here is a simple lemma about the lvrs.

Lemma 4.5.1 Suppose that


WIW2··· Wn
is the lvr for some play at some position. Then

1. the nodes WI, ... , Wn are pairwise distinct;

2. if Wk occurs after WI in the lvr, then Wk was last visited after WI was last
visited. 0

Exercise 4.5.1 Prove the lemma above.


We now go back to the example above (see Example 4.5.1) and describe the
winning strategy for Blue as a function that depends on the last visitation records.

1. At nodes bl and b2, move to g3.

2. At node b3, if the current lvr is either gl or blgl, then move to g2.

3. At node b3, ifthe current lvr is bl or glbl, then move to gl.

It is clear that this strategy depends on the current position of the placemarker and
the lvr at the moment. This consideration naturally leads us to the following formal
definition of strategies that depend on lvrs.

Definition 4.5.1 A forgetful strategy, or equivalently an lvr-strategy, for a play-


er in a game 9 is a function that specifies the next move (along the edge) of the
player, given the node the placemarker is currently on and the lvr for that time.
234 4. Games Played on Finite Graphs

Let f be a forgetful strategy for one of the players, say Blue. Suppose that
b E B is a current position and L is the current lvr of a play. Then, the next
move of Blue specified by f is f(b, L). Thus if Blue follows the strategy f, the
Blue moves the placemarker on the node f(b, L). We also note the following
important feature of the strategy f. The strategy f is in fact a function from
B x Display(W) into Q. Similarly, any forgetful strategy for Green is a function
from G x Display(W) into B. Since B, G, and Display(W) are all finite sets, the
number of all forgetful strategies is finite. In order to provide more examples of
forgetful winning strategies, we suggest that the reader prove the following simple
exercise.

Exercise 4.5.2 Let Q be an update network with exactly one forced cycle of length
greater than 4. Show that Blue has a winning strategy which is aforgetful strategy.

Let Q be a game. Assume that we have a play

p = qO, ql, q2, ...

in the game Q. Suppose that after n moves, the play becomes periodic, that is, for
some some k 2: 1, we have

for all i E w. Then the play p is called eventually periodic. The next theorem
shows one of the interesting properties of forgetful strategies.

Theorem 4.5.1 Assume that in the game Q, the players Blue and Green always
follow the forgetful strategies f and h, respectively. Then any play in this game is
eventually periodic.

Proof. Assume, without loss of generality, that a play p begins with a node
bo E B. Let p be the play
bo, gO, bI, gl, ....
By the hypothesis of the theorem, this play is produced when Blue and Green follow
the forgetful strategies f and h, respectively. Let L~ be the lvr at the moment when
the following fragment (history)

bo, gO,···, bn

of the play p is produced. Similarly, let L~ be the lvr at the moment when the
fragment

of the play p is produced. Consider the sequence


4.5. Solving Games 235

Informally this sequence records the play p, and at each moment of the play p we
have a record of the current lvr. Since Blue and Green follow f and h, respectively,
we have that gn = f(b n , L!) and b n+! = h(gn, L~) for all nEw. Since the set

B x Display(W) U G x Display(W)
is finite there must exist an nand k :::: 1 such that (b n , L!) = (bn+k. L:H ). Then
the following equalities hold:
gn = f(bn, L:) = f(bn+k. L:H ) = gnH·
Then note that L~ = L~+k' Hence, we have the equalities

bn+! = f(gn, L~) = f(gn+k. L~+k) = bn+!+k.


Continuing this reasoning, we see that for all j :::: n, we have bJ+k = bj and
g J+k = g j. This proves the theorem.
Now our goal is to introduce the notion of no-memory strategy. Informally,
these strategies can be identified with finite game strategies considered for finite
games. In order to introduce these strategies we analyse the next example.
Example 4.5.2 Consider the game whose graph is pictured in Figure 4.15.

Figure 4.15

In this game Blue's positions are b 1, b2, b3, and b4; Green's positions are
gl, g2, and g3. Assume that the set W is {g2, g3}. Let n be {0, W}. Thus, Blue
wins a play p if and only if either the nodes of W are visited finitely often or each
node of W is visited infinitely often.
Blue has a strategy that wins any play that begins at any of the nodes b 1, g 1,
b2. The strategy is the following. At positions bl and b2, always move to gl; at
positions b3 and b4, move to g3. When Blue follows that described strategy, the
infinity set of any play that begins from any of the nodes b 1, g 1, b2 is 0 and hence
Blue wins.
It is interesting to observe that Green has a strategy that wins any play which
begins from positions other than bl, gl, and b2. Here is a desired strategy for
Green. From g2 always move to b3; from g3 always move to b4. From gl move
to b 1. Assume that Green always follows this strategy. Consider any play p that
236 4. Games Played on Finite Graphs

begins at any of the nodes g2, b3, g3, b4. Then it is the case that in the play p
one of the nodes in W is visited infinitely often and the other finitely often. Hence
Green wins the play p.
The point of this example is that the strategies we defined for the players
depend on the current position of any given play. In other words, the strategies
care about the current position of the play with no reference to the history of the
play. Thus, the strategy for Blue is a function that maps B into G. Similarly the
strategy for Green is a function that maps G into B. These strategies do not mention
the last visitation records at all. Hence we now give the following definition.

Definition 4.5.2 A no-memory strategy for a player in a game Q is a function


that specifies the next move (along the edge) of the player given the node the
placemarker is currently on.

Thus, any no-memory strategy is either a function from B into G or a function


from G into B. Later we will make use of no-memory strategies in proving that in
any game Q that begins from a specified node q, one of the players wins any play
from q using a forgetful strategy.

Exercise 4.5.3 Consider the games below that occur on the graphs of the last two
examples (see Example 4.5.1 and Example 4.5.2):

o W = {gI, bI} and Q = {{bI}, {gI}}.


o W = {gI, bI} and Q = {{bI, gI}, {gI}}.
o W = {gl, g2} and Q = {0, {gI, g2}.

o W = {gl, b2} and Q = {{gI, b2}, 0}.

o W = {gI, b2} and Q = {{gI}, 0}.


o W = BUG and Q = {W}.

Let Q be one of these games. Let q be a position in Q. Prove the following:

1. Either Blue or Green wins the game from q.

2. The winner of the game Qfrom position q has a winning forgetful strategy.

4.5.2 Constructing Forgetful Strategies. In this subsection we provide several


methods of constructing strategies from given ones. These methods in some sense
provide a calculus of strategies. A property of these methods is that they produce
forgetful strategies when applied to forgetful strategies. Let us assume that a game
Q is given. We say that a strategy f for a player wins from a set A if the player wins
all the plays that begin from nodes in A and that are consistent with the strategy
f. Here is the first theorem.
4.5. Solving Games 237

Theorem 4.5.2 Suppose that a player of a game 9 has forgetful strategies fl and
h such that
1. II is a winning strategy that wins from Al c Q;

2. h is a winning strategy that wins from A2 C Q.

Then the player has a winning forgetful strategy 13 that wins from AI UA2.
Proof. We explain the idea of the proof informally. Then a formal proof
follows. Suppose that a node q belongs to A I and a play begins from q. Then
the player follows the strategy II. Hence the player wins the game from q by the
assumption. If the node q belongs to A2, then the player always follows the strategy
h until the play "meets" a play from some position in Al consistent with II. If
this happens, then the player "picks up" the strategy II and follows it.
Now we give a more formal proof of the theorem. Consider the set Rec(lI)
that contains a pair (L, q) if and only if the following conditions are satisfied:

1. q is a position of the player.

2. There exists a play consistent with II from a position q' E Al such that q is
reached by the play whose last visitation record is L.

We now define the strategy 13 as follows. If (L, q) E Rec(fl), then 13(L, q) =


II (L, q). Otherwise, 13(L, p) = h(L, p). We claim that if the player follows 13,
then the player wins any play from A UC. Moreover, 13 is an lvr-strategy. It is
clear that 13 is an lvr-strategy. Indeed, 13 uniquely specifies the next move (along
the edge) of the player, given the node the placemarker is currently on and the lvr
for that time. Now we will show that 13 is a winning strategy from A U C. Indeed,
assume that q E Al U A2. If q E AI, then 13 "copies" the strategy !I forever.
Since II is a winning strategy from any node in A, 13 wins all the plays from any
position in A I. Assume that q ~ A I and q E A2. Then the player begins any play
from q following h. Consider any play p from position q that is consistent with
h. There are two possible cases. In the first case the player reaches a position q'
in the play whose lvr is L such that (L, q') E Rec(!I). In this case, when such
a q' is first met, the player begins "copying" fl and hence the play will be like
a play from A I except some initial part of it. Hence the player wins the play by
the hypothesis of the theorem. If the first case does not occur, then the play from
q will be consistent with h. Hence, the player wins the play by the hypothesis of
the theorem. The theorem is proved.
An interesting corollary of the proof of this theorem is that one can replace
the hypothesis that I and g are forgetful strategies with the hypothesis that I and
g are no-memory strategies. Here is the corollary.

Corollary 4.5.1 Suppose that a player of a game 9 has no-memory strategies !I


and h such that
238 4. Games Played on Finite Graphs

1. fr is a winning strategy that wins any play from a set Ale Q;


2. h is a winning strategy that wins any play from a set A2 C Q.
Then the player has a winning no-memory strategy that wins from Al U A2. 0
The next corollary of the theorem is that we can "sew" winning forgetful
strategies (as well as no-memory strategies) that win the game from distinct posi-
tions of the game. Moreover, the "sewing" preserves the property to be lvr-strategy
(no-memory strategy). More precisely, here is the corollary.
Corollary 4.5.2 Let A C Q. Iffor each position q E A a player has a winning
forgetful strategy (no-memory strategy) from q then the player has a winning
forgetful strategy (no-memory strategy) from the set A. 0
Exercise 4.5.4 Prove the two corollaries above.

The next theorem informally states the following. Take a forgetful strategy
for a player. Collect all the positions of the game which can be visited from winning
plays that are consistent with the strategy. Then the player has a winning forget-
ful strategy that wins all the plays from the collected positions. Here now is the
theorem.
Theorem 4.5.3 Let f be a forgetful strategy for a player. Assume that the player
wins the game from a position q using the strategy f. Then there exists aforgetful
strategy fl that wins the game from any given position visited by plays from q
consistent with f.

Proof. Let ql be a position visited by some play from q that is consistent


with the strategy f. We want to construct a forgetful strategy that wins the game
from position ql. There exists a play p from q such that p is consistent with f
and p meets ql. Then the position q is reached by some portion (history) PI of
the play p. Consider L I, the lvr of this portion of the play. Consider any play that
begins from ql. Let P2 be a portion of the play from ql to s. Let L2 be the lvr of
P2. Hence we can compute L3 which is the lvr of the portion PI P2. Now we define
!3 on node s and the lvr L2 by putting

Thus, informally the player plays from the position q! as if the player were playing
from q by prefixing the imaginary prefix PI to all the plays from ql. The infinity
set of any play p consistent with fr from q! coincides with the infinity set of the
play PIP from q consistent with f. Hence the player wins p if and only if the
player wins PIP. It follows that fl is a winning forgetful strategy for the player
from position qt. From Corollary 4.5.2 we see that there is a forgetful strategy h
that wins the game from all the positions visited by plays from q consistent with
f. The theorem is proved.
4.5. Solving Games 239

Corollary 4.5.3 Let f be a no-memory strategy for a player. Assume that the
player wins the game from a position q using the strategy f. Then there exists a
no-memory strategy II that wins the game from any given position visited by plays
from q consistent with f.
Proof. Repeat the proof of the theorem above and note that the constructed
strategy II is a no-memory strategy. The corollary is proved.
Corollary 4.5.4 Let 9 be a game. Let B (F) be the set ofall positions q in the game
from which Blue has a winning forgetful strategy fq. Then the following properties
hold true:
1. Blue has a winning forgetful strategy from B(F).
2. If q] is visited by some play from q E B(F) consistent with f q, then q] E
B(F).
Proof. The proof of the first part follows from Corollary 4.5 .2. The second
part follows from the previous theorem. The corollary is proved.

4.5.3 No-Memory Forcing Strategies. In some respect this section is a relative


to Subsection 4.2.3. Assume that 9 is a game. Let R be a set of positions in 9 which
are considered to be a "good place to be in" for a player. Assume that the player
wants to reach the set R by avoiding a certain set A. So A can be considered a "bad
place to be in" for the player. We want to find a strategy for the player that allows
the player to reach R by avoiding the set A. In order to explain this situation we
present the following example.
Example 4.5.3 Consider the game graph pictured in Figure 4.16.

Figure 4.16: Blue wants to reach R = (g2, b2}.

In this example Blue has three positions and Green has four positions. Let
R = (g2, b2} be the set for Blue "to be in a good place." We wish to determine the
nodes from which Blue has a strategy to place the placemarker into the set R in one
or more moves. In this example the set of such nodes is {b2, g3, b3, g4}. We can
also consider the set of all positions in the game from which Blue has a strategy to
force the placemarker into R in 0 or more moves. Then, in this example, this set
of nodes is {g2, b2, g3, b3, g4}·
240 4. Games Played on Finite Graphs

Let 9 be a game. Let R be a subset of the set of positions in g. Let us


fix a player. We denote by N the set of all modes from which the given player
has a strategy to place the placemarker into the set R in one or more moves. We
also consider the set N' of all positions in the game from which the player has a
strategy to force the placemarker into R in 0 or more moves. Clearly, the following
relationships between R, Nand N' occurs:

R C N', N' = RUN.


Moreover, R is a subset of N if and only if N = N'. The following lemma follows
directly from the definitions of Nand N'. The lemma basically states that if R eN,
then the player can either stay in R forever or can come back to R after leaving it.

Lemma 4.5.2 If R is a subset of N, then the player has a strategy such that any
play consistent with the strategy either stays in R forever or comes back to Rafter
leaving it. 0

Exercise 4.5.5 Consider the game discussed in the previous example. Find Nand
N' and find whether or not R C N in each of the following cases:

1. R = {b2}.

2. R = {g2, b3}.

3. R = {g2, bI}.

Exercise 4.5.6 Prove the lemma above.

The examples above suggest considering those strategies that allow a given
player to reach a certain set R by avoiding some set A. Naturally, in this case the
task of the opponent would consist of either avoiding the set R or reaching the set
A. Motivated by these considerations we give the following definition.

Definition 4.5.3 Let (} be a game, q be a position, R and A be sets such that


RnA = 0. We say that a strategy h for a player is an (R, A)-forcing strategy
from q if any play consistent with h reaches the set R by avoiding the set A.
Similarly, a strategy f for a player is an (R, A)-avoiding strategy from q if any
play consistent with f either always avoids R or meets A before meeting R.

Now we prove the following theorem that shows how to construct (R, A)-
forcing strategies as well as (R, A)-avoiding strategies.

Theorem 4.5.4 Let (} be a game and fix a player of the game. Let R and A be
subsets of the game graph such that RnA = 0. Consider the set N (N') of all
nodes outside of A from which the player has a no-memory strategy to force the
placemarker into R after one (zero) or more moves while avoiding A. Then we
have the following:
4.5. Solving Games 241

1. The sets Nand N' can be constructedJrom the game Q, sets A and R.

2. From the set Q \ (A UN), the opponent has a no-memory strategy to ensure
that the placemarker either reaches A without entering R or stays Jorever
in Q \ (A U N U R) after the first move.

Proof. The proof essentially follows the proof of Theorem 4.2.1. Without
loss of generality we can assume that the player is Blue. We first construct the set
N'. To do that we define a function

that maps every subset X C Q \ A into a set Q(X) C Q \ A. So let X C Q \ A.


Then for any position q ofthe game, q is in Q(X) if and only if one of the following
conditions holds:

1. q EX.

2. q E B and there exists a q' such that q' E X and (q, q') E E.

3. q E G and for all q', if (q, q') E E then q' E X.

Thus, q E QeX) if and only if Blue can force the placemarker into X in at most
one move. Indeed, assume that q E QeX). If q E X, then by (1), the node q is
already in X. If q E Q(X) and q E B, then Blue moves into X, since by (2) there
exists a q' E X such that (q, q') E E. If q E Q(X) and q E G, then Green is
forced to move into X, since by (3) all the moves of Green enter X. Note also that
Xc Q(X).
Now we define the sequence

Ro = R, R1 = Q(R), Ri+1 = Q(R),


where i E w. Thus, Ro S; R1 S; R2 S; .. '. It is not hard to see that each Ri is a
subset of N'. This can be proved by induction on R. Indeed, Ro C R and hence
Ro eN'. Assume that Rn S; N'. Consider Rn+ 1. Blue can force the placemarker
into Rn in at most one move. Therefore, Blue can force the placemarker into X.
Thus Rn C N' for all n. We conclude that Ui Ri eN'. Let k be a number such
that Rk = Rk+1. Then Ui Ri = Rk. Now we want to show that N' = Rk. We
already noted that Rk eN'. Assume that q E Q \ (Rk U A). We claim that Blue
cannot force the placemarker into Rk by avoiding A from position q. Indeed, if
q E B, then for all q' E Q, the condition (q, q') E E implies that either q' E A or
q' ¢. Rk. Hence either q' E A or q' ¢. Rk. If q E G, then there exists a q' such that
(q, q') E E and either q' ¢. Rk or q' E A. Thus, Green can move to a q' which is
either in A or not in Rk. This shows that Blue cannot force the placemarker into
R while avoiding A when q E Q \ (Rk U A). Moreover, the strategy for Green to
accomplish the task of either avoining R or getting into A before R is reached is a
242 4. Games Played on Finite Graphs

no-memory strategy. Thus, we have shown that the set N' can be constructed. We
have also shown that from the set Q \ (A UN), the opponent has a no-memory
strategy to ensure that the placemarker either reaches A without entering R or
stays forever in Q \ (A U N U R) after the first move. So to finish the proof of the
theorem, we need to construct the set N. Well, q belongs to N' \ N if and only one
of the following two conditions holds:

1. q E G n A and there exists a q' such that (q, q') E E and q' E Q \ N'.
2. q E B nA and all edges from q go into Q \ N'.
We conclude that we can construct the set N as well. We have proved the theorem.

Corollary 4.5.5 Let 9 be a game, q a position, and R and A subsets of Q such


that A n
R = 0. Then the following two facts are true:

1. If a player has an (R, A)-forcing strategy from a position q, then the player
has a no-memory (R, A)lorcing strategy from q.

2. If a player has an (R, A)-avoiding strategy from q, then the player has a
no-memory (R, A)-avoiding strategy from q. 0

The proof of the corollary follows from the proof of the theorem and is left
to the reader as an exercise.

Exercise 4.5.7 Give a formal proof of the corollary above.

In order to further study games, their properties, and strategies, we need to


introduce the concept of subgame of a given game 9. So let 9 be a game and Q'
be a set of positions in the game. Of course we can try to consider the sub game of
9 that occurs in Q'. Well, positions of Blue that belong to Q' are still positions of
Blue. Similarly, positions of Green that belong to Q' are still positions of Green.
If ql, q2 E Q' and (ql, q2) E E, the player whose position is ql can still move to
q2 along the edge. The positions from Q' that are special in the original game 9
are still special positions. If S is a subset of Q' and is a winning set in the original
game 9, then S is still a winning set in the subgame. However, to consider such
a subgame we should be more careful. This is because for some q' E Q' all the
edges from q' may lead to positions outside of Q', Thus, we can define subgames
of 9 as follows.

Definition 4.5.4 Let 9 be a game and Q' be a subset of Q. Assume that for every
ql E Q' there exists a q2 E Q' such that (ql, q2) E E. Then Q' defines a subgame
9' of the game 9 asfollows:
1. The set of all positions of 9' is Q'.

2. Blue s positions are the set B n Q', and Green s positions are G n Q'.
4.5. Solving Games 243

3. The set of winning positions is W' = W n Q'.


4. The set E' of edges contains (ql, q2) if and only if ql, q2 E Q' and (ql, q2)
E E.

5. Finally, [2' = {S IS E [2, SeQ'}.

Here is one simple proposition that shows how one can get subgames of a
given game g.
Proposition 4.5.1 Let 9 be a subset. Let Q' be a set ofpositions in g. Assume that
a player has a strategy that keeps the placemarker in Q' forever any time when a
play begins from Q'. Then Q' determines a game g'.
Proof. We need to show that for any ql E Q' there exists a q2 such that
q2 E Q' and (ql, q2) E E. Well, if ql is a position of the player, then, since the
player can keep the placemarker in Q' , there must a move to a q2 E Q' by the player.
If ql is a position of the opponent, then, since the player keeps the placemarker
in Q' forever, all moves of the opponent from ql must lead to positions in Q'.
Otherwise, the player would not be able to keep the placemarker in Q' forever.
This proves the proposition. 0

4.5.4 Finding Winning Forgetful Strategies. This section is devoted to show-


ing that we can solve infinite games played on finite graphs. In other words, given
a game 9 = (Q, B, G, E, W, [2) and a position q of the game, we will show that
we can solve whether Blue or Green wins the game from q. In fact, we will show
that if a player wins the game from q, then the player must have a winning forgetful
strategy from q.

Definition 4.5.5 Let 9 be a game. We set B(F) to be the set of all positions from
which Blue wins the game by using aforgetful strategy. Similarly, G(F) is the set
of all positions from which Green wins the game by using a forgetful strategy.

Here now is the main theorem of this section. The theorem basically states
that we can construct the sets B(F) and B(G) from the given game. Moreover,
any position q E Q either belongs to B(F) or G(F).

Theorem 4.5.5 Let 9 = (Q, B, G, E, W, [2) be a game. Then any node q of the
game belongs to either B(F) or G(F). In other words, B(F) B(G) = 0 and n
B(F) U B(G) = Q.

Proof. We have already noted that if the set W of special positions has 0
elements, that is W = 0, then either Blue wins the game or Green wins the game
from any position. Moreover, the winner wins any play of the game. So, either
B(F) = Q or B(G) = Q. Hence when W = 0, then the theorem holds true
trivially.
244 4. Games Played on Finite Graphs

Thus, we assume that the set W has n 2: 1 number of special positions, say
WI, ••• , W n . The proof of the
theorem goes by induction on the number of positions
in Q. The games with 0 or 1 nodes do not exist. If Q has exactly two positions,
say band g, then Q has only two plays:

b g b g b g b g ... and g b g b g b g b ....

Both have the same infinity set. Therefore, either Blue wins or Green wins the
whole game from any position. Clearly, each player has one strategy only. The
strategy is a forgetful strategy, and either B(F) = Q or G(F) = Q. SO the base
of the induction holds trivially.
Suppose that the set Q has m > 2 positions. By the induction hypothesis,
the theorem holds true for any game in which the number of positions is less than
m. The idea now is to "divide" the game into several subgames to which we can
apply the induction hypothesis. Then using the winning forgetful strategies in the
subgames, we show that we can "sew" the strategies together to prove the theorem.
Consider Wi E W, i = 1, ... , m. Let Ni, B be the set of all positions without
Wi from which Blue has a forgetful strategy to keep out of Wi forever and to win the
game. Similarly, let Ni,G be the set of all positions without Wi from which Green
has a forgetful strategy to keep out of Wi forever and to win the game. Note that
Ni,B (as well as Ni,G) can be empty sets.
Now we define the set N B that consists of all positions from which Blue can
force the placemarker into Ui Ni,B. The set NG is defined similarly.

Lemma 4.5.3 The sets Ni,B, NB, and Nj,G, NG can be constructed from the
game Q.

Proof. It suffices to prove the lemma by showing how to construct the sets
Ni,B and N B. Consider the set Xi from which Green can force the placemarker
into the position Wi in 0 or more moves. We know, from Theorem 4.5 .4, that the set
Xi can be constructed from the game Q and the node Wi. We also know, from the
same theorem, that Blue can always avoid Wi from any position q E Q \ Xi. Hence
we can consider the subgame determined by the set Q \ Xi (see Proposition 4.5.1).
Now we use inductive hypothesis. We find all the positions Z in the subgame from
which Blue wins the subgame using forgetful strategies. Clearly, the win in the
subgame is also a win in the whole game. Therefore, Z C Ni,B. Now any forgetful
strategy for Blue that keeps Blue out of Wi forever and wins the game from a q must
also avoid the set Xi. Hence, M,B C Z. We conclude that Ni,B can be constructed
from the game and Wi. From Theorem 4.5.4, the set NB can also be constructed.
The lemma is proved.
We now define the set Q(Rest) = Q \ (NB U NG). The next lemma is very
similar to the statement of Exercise 4.2.6.

Lemma 4.5.4 The set Q(Rest) determines a subgame a/the game Q.


4.5. Solving Games 245

Proof. We only need to show that for any q, E Q(Rest) there exists a
q2 E Q(Rest) such that (q" q2) E E (see Definition 4.5.4). Assume that q, is
a position of Blue. Since q, rt NB, by Corollary 4.5.5, Green has a no-memory
strategy to keep any play out of NB forever after q,. Similarly, since q, rt NG,
Blue has a no-memory strategy to keep any play out of NG forever after q,. Hence
for any q2 E Q, if (q" q2) E E, then q2 rt NB. Moreover if we had q2 E NG for
all such q2, then q, would belong to NG. This is not possible. Hence there exists a
q2 such that (q" q2) E E and q2 rt NG, that is, q2 E Q(Rest). Similarly, if q, is a
position of Green, then Green can move to a q2 from q, such that q2 E Q(Rest).
This proves the lemma.
The lemma above allows us to consider a subgame (J(Rest) of the game
(J determined by the set Q(Rest). By the definition of the game (J(Rest) (see
Definition 4.5.4), if a player wins a play in (J(Rest) then the same player wins the
play in the original game (J. The next lemma shows the relationship between the
original game (J and the subgame (J(Rest).
Lemma 4.5.5 A winning strategy for a player in the subgame (J(Rest) from a
position q can be augmented to become a winning strategy in the whole game (J.
Proof. Our proof will be informal but rigorous enough. Let f be a winning
strategy in the game (J(Rest). Without loss of generality we can assume that Blue
wins the subgame (J (Rest) from q. If during a play from q, Green decides to stay in
Q(Rest) forever, then Blue wins the play using the winning strategy f. Therefore,
Green is forced to leave Q(Rest). Assume that during a play from q Green leaves
the set Q(Rest) at position q, by moving to q' rt Q(Rest). Then q' must belong
to the set N B. Therefore, Blue is able to force the placemarker into N B. From N B,
Blue forces the opponent to move to some Ni,B from which Blue wins. The lemma
is proved.
Lemma 4.5.6 Assume N B = N G = 0. Then the following two statements are
true.
1. If W E Q then Blue has a winning forgetful strategy.
2. If W f/. Q then Green has a winning forgetful strategy.
Proof. We prove the first part of the lemma. So assume that W E Q. We want
to show that Blue has a winning forgetful strategy. Note that Blue wins any play
whose infinity set is W because W E Q by assumption. So in the game (J, one of
the objectives of Blue will be to reach each Wi E W infinitely often. To do that
Blue will involve forgetful strategies. We need to give the following definition.
Definition 4.5.6 We say that Wi is designated at a given moment in a play if either
i is the smallest number such that Wi has never been visited, or if all the nodes
from W have already been visited, then Wi is the first symbol of the current last
visitation record of the play.
246 4. Games Played on Finite Graphs

The latter case of the definition basically states that the last visit of Wi by
Blue was earlier than the last visits of all other W jS.
For each Wi, consider the set Xi of all positions from which Blue can force
the placemarker into Wi in 0 or more moves. As we already mentioned, we can
certainly construct the set Xi given 0 and Wi. Consider the set
Qi =Q\ Xi.
We note that Qi determines a subgame Oi of the game O. Our claim now is that
Green wins the subgame Oi from no q E Qi. Indeed suppose, for the sake of
contradiction, that Green wins the game from a q E Qi. Note that Qi has less than
m positions. Hence we can apply the induction hypothesis. Therefore, Green has a
winning forgetful strategy, say f, in the game 0 i that allows Green to win from q.
We define a strategy h for Green in the game 0 with the purpose of showing that
h is a winning forgetful strategy for Green in the game 0 from q. Let L be an lvr.
Then we set Li to be the lvr in the game Oi obtained by omitting all the winning
nodes from L that are not in Qi. Then for all q' E Qi and all L, we set
h(q', L) = f(q', Li).
For q' ~ Qi, we set h(q', L) to be any q" for which (q', q") E E. Consider
any play that begins from q and which is consistent with h. Then the play never
leaves the set Qi. Moreover the play, by the definition of h, is consistent with f.
Hence Blue wins the play. We conclude that Green wins the whole game from q
by avoiding the node Wi. This contradicts the assumption that N G = 0. Hence we
conclude that Blue wins the game Oi from any position q E Qi.
Now we can apply the induction hypothesis to the game Oi. By the hypothesis,
Blue has a winning forgetful strategy hi that wins the game Oi from any node
q E Qi.
Now we are ready to show that Blue has a winning forgetful strategy in
the given game O. We note the following. Assume that Blue always follows the
winning forgetful strategy hi in Oi. Then Green behaves as follows. Either Green
always stays in the game Oi (Green is able to do it by avoiding the node Wi) or
decides to leave the game Oi. If Green always stays in the game Oi, then, since
Blue follows hi, Blue wins. If Green decides to leave the game Oi, then Blue forces
the placemarker into Wi as soon as Green leaves the game 0 i.
Thus, a winning strategy for Blue is defined as follows. At any time Blue's
choice will be based on the designated Wi (see Definition 4.5.6). As long as the
placemarker in Qi, Blue follows the strategy hi. But if the placemarker is outside
of Qi, then Blue forces the placemarker into the designated Wi. If Blue reaches
Wi there will be a new designated W j and Blue repeats the same behavior for W j
in place of Wi. It is not hard to see that the strategy H thus described is indeed a
winning strategy for Blue.
Now we will show that the strategy H is in fact a forgetful strategy. A formal
definition of H is as follows. Let L be an lvr. If the length of L is n, then let WL
4.5. Solving Games 247

to the first node in L; if the length of L is less than n, then let WL be the first W in
W not in L. Now define H by the following rules:
1. IfwL = Wi and q if. Qi, then H(q, L) is directed by the no-memory strategy
that forces the placemarker into Wi.

2. If <I>(L) = Wi and q E Qi, then H(q, L) = hi(q, Li), where hi is the


winning lvr-strategy in the game Qi, and Li is obtained from L by omitting
all the winning nodes that are not in Qi.

It is not hard to see that H is indeed an lvr-strategy. This proves the lemma.
Now we are about to finish the proof of the theorem. We recall that m is
the number of positions in Q. We construct NB and NG. Consider Q(Rest) =
Q\(NB U NG).1f Q(Rest) is an empty set, then B(F) = N B andG(F) = NG, and
the winning forgetful strategies can be effectively constructed. If NB = NG = 0,
then the lemma above gi ves the result. Assume now that none of the above two cases
holds. Then Q(Rest) has less than m nodes. Hence, by the induction hypothesis, we
can find the set BI (F) of Blues favorites, and the set G I (F) of Green's favorites
in Q(Rest). We know that any winning forgetful strategy from either of BI (F)
or GI (F) can be augmented to become a winning forgetful strategy in game Q.
Hence, we have the following equalities:

Thus, the theorem is proved.


As a corollary of this theorem we can get the following result.

Theorem 4.5.6 There exists an algorithm that for any game Q constructs the sets
G(F) and B(F), and hence solves the game Q.

Proof. Let It, ... , fk and hI, ... , h m be all forgetful strategies of Blue and
Green, respectively, in the game Q. Take a position q E Q. We want to find
whether or not q E B(F). By the theorem above, one of the players has a winning
forgetful strategy from q. Hence a winning strategy for the player belongs either
to {fl, ... , fkl or to {hI, ... , h m }. Given two forgetful strategies fJ and hj, we
can consider the play from q that is consistent with fi and h j. By Theorem 4.5.1,
the play must eventually become periodic. Moreover, the period of the play can
be found from fi and h j. Note that the period coincides with the infinity set of
the play. Hence we can find whether or not fi wins against h j from the position
q. Thus, q E B(F) if and only if there exists an f E {fl, ... , fkl which wins
against all h E {hI,"" h m }. Similarly, q E G(F) if and only if there exists
an h E {hI, ... , h m } which wins against all f E {fl, ... , fkl. This proves the
theorem.
5
Rabin Automata

In this section we present a powerful generalization of Biichi automata. These are


finite state machines which make their runs on infinite trees instead of infinite
words. These machines are called Rabin Automata.
The theory of Rabin automata has been an attractive area because of its
relationship with combinatorics, logic, algebra, set theory, computability theory,
complexity theory, concurrent and parallel computations, and many other areas
of mathematics and computer science. The theory of automata on infinite trees
possesses many deep and beautiful results from the point of view of mathematics
and hence provides a good ground for research. From a computer science point
of view, the theory of automata on infinite trees provides a strong mathematical
foundation for decision problems and their computational complexity. The area
also gives a mathematical foundation for the theory of concurrent and parallel
computations, program checking and verification.
This chapter consists of twelve sections. In the first section we explain labeled
trees, Rabin automata, runs of Rabin automata, and the notion of successful run.
We introduce Rabin automata recognizable languages and show that this class
of languages is closed under the operations of union, intersection and projection.
The next section, Section 2, introduces special automata. The basic result of this
section consists of showing that the class of languages accepted by special automata
is not closed with respect to the complementation operation. In Sections 3 and 4,
we introduce game automata and prove that Rabin automata and game automata
are equivalent. The next six sections, Sections 5-10, are devoted to the study
of certain types of infinite games of perfect information. The basic goal is to

B. Khoussainov et al., Automata Theory and its Applications


© Birkhäuser Boston 2001
250 5. Rabin Automata

show that these games are determined and winners have winning strategies with
certain desirable properties. The aim of introducing and studying these games is to
apply the results about these games to the complementation problem about Rabin
automata. Section 11 contains the main result of this chapter. The section introduces
games known as Gurevich-Harrington games. The main theorem states that these
games are determined and the winner has a strategy that, roughly speaking, depends
on some finite information about the past parts of the plays. Section 12 proves that
the complement of any Rabin recognizable language is again Rabin recognizable.
The section also shows that some natural problems (e.g., the emptiness problem,
the equality problem) posed for Rabin automata are decidable.

5.1 Rabin Automata


We fix ~ a finite alphabet. Let 7 be the set {O, 1}*. On the set 7 we can define two
unary operations L (left) and R (right). These operations are defined as follows:
for all u E 7, L(u) = uO and R(u) = u 1. Thus, L puts the symbol 0 at the end of
each word from 7; the operation R puts the symbol 1 at the end of each word from
7. The elements of 7 are sometimes called nodes. Thus each x E 7 is simply a
finite word over {O, I}. Hence the length of the node x is the length of the word
x. The triple (7, L, R), also denoted by 7, is called the binary tree. For u E 7,
the nodes uO and ul are called the immediate successors of u. The empty word
).. E {O, 1}* is the root of the tree. Informally, these notions are suggested by the
following picture. The lowest node is the root)... The root branches up to the left
into the node 0 and up to the right into the node 1. The node 0 branches up to 00
and 01. The node 1 branches up to 10 and 11 and so on. A pictorial presentation of
the tree 7 is given in Figure 5.1.

Figure 5.1: Tree T.


5.1. Rabin Automata 251

Thus, on the tree T we can define levels. Level 0 contains only one node, the
root A. of the tree. Level 1 contains two nodes 0 and 1. Level 2 contains 4 nodes
00, 01, 10, and 11. In general, level n contains 2n nodes. Also note that nodes of
length n belong to level n. On the binary tree T we can also define several natural
relations among its nodes. One of the relations is denoted by :S.

Definition 5.1.1 We write u :s v if there exists aWE {O, 1}* such that v = u . w.

In other words, u :s v simply means that u is a prefix of v. If u :s v and


u ~ v, then we write u < v. For example, A. is the prefix of all nodes in T. Thus
the relation :s partially orders the set of all nodes of the tree T. Sometimes, we
may say that v is above u if u :s v.
Let x be a node of T. We can consider the set {y I x :s y}. We denote this set
by T x' Clearly, T x consists of all nodes of the form x y. The set T x is also called a
tree. Note that the partial order :s does not order the nodes of T linearly. Indeed,
for example the nodes 0 and 1 are not comparable with respect to:s. Of particular
interest are the subsets of T called paths. For example, the leftmost path consists
of A., 0, 00, 000, 0000, .... We give the following formal definition.

Definition 5.1.2 A subset]( cT is a path if the following conditions hold:


1. The root belongs to ](.
2. If u E ](, then exactly one of the nodes uO or u 1 belongs to ](.
3. For all u, v E ]( either u :s v or v :s u.
Clearly, condition (3) above follows from the first two conditions.
Here we give some basic definitions and simple results concerning Rabin
automata. One of the main objects of interest will be infinite objects known as
~>trees. These objects will be inputs for Rabin automata as infinite strings were
inputs for Buchi automata. We give a definition.

Definition 5.1.3 A :E-tree or, equivalently a :E-valued tree, is a pair (v, T) such
that v is a mapping from T to :E. In this case we say that the mapping v labels the
nodes ofT. We denote the set of all :E-trees by Vb'
Example 5.1.1 Let:E be {a, b}. Consider the mapping v: T --+ :E which assigns
the symbol a to each node x of the tree. Then (v, T) is the tree all nodes of which
are labeled by symbol a. See Figure 5.2for a representation of this :E-tree.
Example 5.1.2 Let:E be {a, b}. Consider the mapping v : T --+ :E which assigns
the symbol a to each node x of even length and b to each node y of odd length.
Then (v, T) is the :E-valued tree such that the labeling of each path produces the
sequence
abababababab ....
See Figure 5.3 for a representation of this :E-tree.
252 5. Rabin Automata

a a

""/

Figure 5.2: An example of a h-tree.

Figure 5.3: An example of a h-tree.

For a h-valued tree (v, T), we set (v x , Tx) to be such that vx(y) = v(y)
for all y E Tx. We may also denote the pair (v x , Tx) by simply (v, Tx). The pair
(v, Tx) is also called a h-valued tree. The set of all h-valued trees of the type
(v, Tx), where x is fixed, is denoted by V~,x. We will mostly deal with h-valued
trees of the type (v, T) unless otherwise specified.
Our interest will be in sets of h-valued trees. We give the following definition.
Definition 5.1.4 Let h be a fixed finite alphabet. Then a language is any set of
h-valued trees.
As we studied languages accepted by finite automata, BUchi automata, and
Muller automata, in this chapter we will investigate languages accepted by Rabin
automata. To do this we now need to define the basic notion of this chapter, Rabin
5.1. Rabin Automata 253

automata. These are finite state machines that generalize Blichi automata. Their
runs (equivalently, computations) are more complicated. This makes the range of
application of Rabin automata in mathematics and computer science much wider.
Here is the definition.

Definition 5.1.5 A Rabin automaton over the alphabet ~ is quadruple A =


(S, /, M,:F) such that

1. S is a finite set of states,

2. / C S is the set of initial states,


3. M is a mapping from S x ~ to the set P(S x S), called the transition table,
and

4. F is a subset of2 s whose elements are designated subsets of S.


Let (v, T) be a ~-valued tree. Let A be a Rabin automaton. As infinite
strings are inputs for B lichi automata, ~ -valued trees are inputs for Rabin automata.
Therefore, we can sometimes call ~-valued trees inputs to Rabin automata.
Thus, take an input (v, T). We now informally describe how A makes its
runs (computations) on (v, T). The automaton A begins its run by choosing an
initial state, say so, from /. The first input signal for the automaton is v(}.). Reading
this input, the automaton makes two copies of itself. The first copy goes up to the
node 0, the other copy goes up to the node 1. The states of the first copy and the
second copy depend on the transition table M. More precisely, when reading the
first input v(}.) the automaton A nondeterministically chooses a pair (sJ, si) of
states such that this pair agrees with the transition table M, that is,

(sJ, si) E M(so, v(}.)).

The first copy of A now reads the input v(O) being in the state SJ. Similarly, the
second copy of A reads the input v(l) being in the state si. Now the first copy,
reading the input v(O), makes another two copies of itself. One copy goes up to the
node 00, the other copy goes up to the node 01. On the node 0 the automaton A
chooses a pair (S2, s~) of states such that this pair agrees with the transition table
M, that is, (S2, s~) E M(sJ, v(O)). Similarly, the automaton A reading the input
v (1) at state si ' makes another two copies of A. The one copy goes up the node 10,
the other copy goes up to the node 11. Doing this, on the node 1 the automaton A
chooses a pair (t2, t~) of states such that this pair agrees with the transition table
M, that is, (t2, t~) E M (si, v(I)), etc. We give a couple of examples.

Example 5.1.3 Let ~ = {a, b}. Let A = (S, /, M, F) be such that


1. S = {s, t},

2. / = {s},
254 5. Rabin Automata

3. F = ({t}}, and
4. M is defined as follows: M(s, a) = let, t)}, M(t, a) = let, t)}. In all other
cases M(s, 0") = 0.
Suppose that for the automaton A of this example the input is the ~-valued
tree (v, T) such that vex) = a for all x. The automaton begins its run (computation)
from s. The first input is v()..) is a. The automaton A chooses the pair (t, t) since
M(s, a) = (Ct, t)}. The first copy of A goes up to the left and reads the input
v(O) = a in state t, and the second copy of A goes up to the right and reads input
vel) = a in state t, etc. Clearly, according to the transition table, A reads each
input at any given node being in state t only. We see that the automaton A, while
performing its computation on the tree (v, T) with vex) = a for all x E T, labels
each node of the tree T with t. Thus, this run of the automaton A on the input
(v, T) is pictured in Figure 5.4.

Figure 5.4: An example of a run.

Thus, the run of the machine A can be thought of as the machine A labels
the nodes of the tree T using the transition table M.
Exercise 5.1.1 Let A be the automaton discussed in the example above. Let (v, T)
be an input such that vex) 1= afar some x. Does there exist a run of A on (v, T)?

We give another example.


Example 5.1.4 Let ~ = {a, b}. Let A = (S, I, M, F) be such that
1. S = {s,t},
2. 1= {s},
3. F = {{t}}, and
5.1. Rabin Automata 255

4. M is defined as follows: M(s, a) = {(t, t)}, M(t, b) = {(s, s)}. In all other
cases M(s, 0') = 0.
Let (u, T) be a 1;-valued tree where u labels nodes of even length with a
and odd length with b. The automaton A (of this example) begins its run from
s. The first input is u(A), which is a. The automaton reads a. The automaton A
chooses the pair (t, t) since M (s, a) = {(t, t)}. The first copy of A goes up to the
left and reads the input u(O) = b in state t, and the second copy of A goes up to
the right and reads input u (1) = a in state t, etc. In any given path the automaton
A produces the following sequence of states:
ststst ....
In other words, the automaton A, performing its computation on the tree (u, T),
labels each node x E T of even length with s and each node x E T of odd length
with t. Pictorially the run of A is presented in Figure 5.5.

Figure 5.5: An example of a run.

Exercise 5.1.2 Explain the runs of the Rabin automaton in the example above for
other type of inputs not considered in the example.
The examples considered suggest that we formalize the notion of run (com-
putation) of Rabin automata as follows.
Definition 5.1.6 A run, or equivalently computation, of the Rabin automaton A
on a 1;-tree (u, T) is a mapping
r:T-,;S
such that for all u E T, (r(uO), r(ul)) E M(r(u), u(u)) andreA) E I.
As we see from the definition, a computation of A on (u, T) can be considered
as a labeling of T with states from S so that the labeling agrees with the transition
256 5. Rabin Automata

table M and input (v, T). We now can revisit our examples above in the light of
this definition.
Example 5.1.5 Let b = {a, b}. Let A = (S, I, M, F) be such that
1.S={s,t},
2. I = {s},

3. F = ({tH, and
4. M is defined as follows: M(s, a) = {(t, t)} and M(t, a) = {(t, t)}. For all
other cases M (s, a) = 0.
Suppose that the input is the b-valued tree (v, T) such that vex) = a for all x.
Then the mapping r : T --+ S such that rCA) = sand r(x) = t for all x :f. A is a
run of A on (u, T).
Example 5.1.6 Let b = {a, b}. Let A = (S, I, M, F) be such that
1. S = {s, t},

2. I = {s},

3. F = ({tH, and
4. M is defined as follows: M(s, a) = {(t, t)} and M(t, b) = {(s, s)}. In all
other cases M(s, a) = 0.
Let (v, T) be a b -valued tree where v labels nodes of even length with a and odd
length with b. A begins its work from s. Then the mapping r : T --+ S such that
c(x) = s if x is of even length, and r(x) = t if x is of odd length is a computation.

Example 5.1.7 Let A = (S, I, M, F) be such that


1. S = {so, Sj, S2},
2. I = {so},
3. F = {{sd}' and
4. M isdefinedasfollows: M(so, a) = {(S2, Sj), (Sj, S2)}, M(so, b) = {(Sj, Sj)},
M(sj,a) = (Sj,Sj), M(s2,a) = {(S2,Sj), (Sj,S2)}, M(S2,b) = {(Sj,sj}}.
In all other cases M (s, a) = 0.
For this example we claim that A has a run which labels all but finitely many
nodes of the tree with state Sj on (v, T) if and only if there exists at most one
x E T such that vex) = b. An intuition behind this is the following. The state S2
is the guessing state. The automaton A guesses a path assuming that b occurs on
the path. If the guess is correct, then A labels the whole tree with Sj except the
finite part of the path before b is read. Otherwise, A labels the whole path with the
state S2.
5.1. Rabin Automata 257

Exercise 5.1.3 Check the correctness of the statement in the example above.

We now are ready to give a fundamental definition of this chapter. The def-
inition explains what it means for a Rabin automaton to accept a ~>valued tree
(v, T). We note that one can define the notion of acceptance in several ways. We
follow Rabin's definition of acceptance. Another type of acceptance will be studied
later.

Definition 5.1.7 The Rabin automaton A accepts, or equivalently recognizes, the


b -valued tree (v, T) if there exists a run r of A on (v, T) such that for every path
rr in T,
{s E S I r(u) = s for infinitely many u Err} E F.

Any run with such a property is called a successful run.

This definition says that if A recognizes a b-valued tree (v, T), then there
exists a run r of A on this tree with the following property. If we observe this
run restricting it on any given path of T, then the infinity set of this computation
along this path belongs to F. Note this type of acceptance resembles a MUller type
of acceptance for automata on infinite strings. We now give several examples for
explanation of the definition.

Example 5.1.8 Consider A = (S, I, M, 0). The automaton accepts no b-valued


tree.

Example 5.1.9 Consider A = ({s}, {s}, M, {{s}}) with M(s, a) = (s, s).

The automaton in this example has a run on the b-tree whose nodes are all
labeled with the symbol a only. This run labels all the nodes of the tree with state
s. Hence the infinity set of the run along any path is {s}. Therefore, the run is
successful.

Example 5.1.10 Let A = (S, I, M, F) be such that


1. S = {s, t},

2. I = {s},

3. M(s, b) = {(s, t), (t, s)}, M(t, a) = {(t, t)}, and

4. F = {{t}, {s}}.
In this example, the automaton A accepts all the b-trees, b = {a, b}, with
a path whose nodes are all labeled with b while all the other nodes not in the path
are labeled with a. The automaton begins its run at state s. The automaton, when
it is in state s, does not respond when A reads a. However, when A is in state s
and reads b, the automaton nondeterministic ally guesses the path labeled with b
and continues to run.
258 5. Rabin Automata

Exercise 5.1.4 Let ~ = {a, b}. Construct Rabin automata that recognizes the
following ~-trees:

1. All ~-valued trees.

2. All (v, T)forwhich vex) = aforalmost all x, that is, those (v, T)forwhich
the set {x I vex) = b} is finite.

3. All ~-trees (v, T) such that/or each x E T the condition vex) = a implies
that v(y) = b for some y > x.

Now we give the following definition that connects languages of ~-valued


trees with Rabin automata.

Definition 5.1.8 For a Rabin automaton A we denote by L(A) the set of all ~­
valued trees accepted by A. We say that a language LeVI: is Rabin recognizable
if there exists a Rabin automaton A such that L(A) = L.
We give two examples of Rabin recognizable languages.

Example 5.1.11 Let A = (S, I, M, F) be such that S = Is, t1, t2}, I = Is},
F = {{s, td, Is, t2}}, and M isdefinedasfollows: M(s, a) = {(t1, tJ}}, M(t1, b) =
{(s, s)}, M(s, b) = {(t2, t2)}, and M(t2, a) = {(s, s)}.
This automaton recognizes the language which contains exactly two ~-trees.
The one is the ~-valued tree (v, T) such that v labels nodes of even length with
a and odd length with b. The other is the ~-valued tree (v, T) such that v labels
nodes of even length with b and odd length with a.

Example 5.1.12 Let A = (S, I, M, F) be such that S = {so, S1, S2}, I = {so},
F = {{S1}}, and M is defined as follows:
1. M(so, a) = {(S2,S1), (S1,S2)}.
2. M(so, b) = {(S1,S1)}'

3. M(s1,a) = {(S1,St}}.

4. M(S2, a) = {(S2, st), (S1, S2)}.


5. M(S2, b) = {(S1,St}}.
It is not hard to check that the language recognized by A is the set of all
~-valued trees (u, T) such that there exists exactly one x E T such that vex) = b.

Exercise 5.1.5 Check the correctness of the last example above.

Exercise 5.1.6 Let ~ = {a, b}. Construct Rabin automata that accept the follow-
ing languages:
5.1. Rabin Automata 259

1. {(v, T) I for all x E T ifr(x) = a then r(y) = a for all y ::: x}.

2. {(v, T) I there are exactly two distinct paths ll't and ll'2 such that for all x,
vex) = a ifx E ll'j nll'2, and vex) = b otherwise}.

3. {(v, T) I there are exactly two distinct nodes x E T and YET such that
vex) = v(y) = b}.

4. {(v, T) I for all x E T, ifv(x) = a, then v(L(x)) = b}.


5. {(v, T) I for all x E T, ifv(x) = a, then v(y) = bfor some y > x}.

6. {(v, T) I each path in T either has finitely many as or finitely many bs}.
7. {(v, T) I for all x E T, either v(L(x)) = b or v(R(x)) = b}.

5.1.1 Union, Intersection, and Projection. Our goal in this section is to prove
that the set of Rabin recognizable sets is closed under the set-theoretic operations
of union (U), intersection (n), and projection. The proofs of these results use
ideas similar to the case for finite automata as well as for Btichi automata. But
we first need one simple lemma and a technical definition. We say that a Rabin
automaton A = (S, I, M, F) is complete if for all a E :E, s E S, there exists a
pair (St, S2) of states such that (St, S2) E M (s, a). A complete automaton is quite
convenient since the automaton is able to proceed (nondeterministically) with its
run in any given state and for any input a E :E. We now prove two lemmas. The
first lemma says that we can consider Rabin automata with exactly one initial state
only. The second lemma states that we can transform any Rabin automaton into an
equivalent complete Rabin automaton. We recall that two automata are equivalent
if they accept the same language.

Lemma 5.1.1 For every Rabin automaton A = (S, I, M, F) there exists a Rabin
automaton A' with only one initial state such that L(A) = L(A').

Proof. An informal idea of constructing A' is to add a new state sb not


in S which simulates all initial states of A at the first step of any computation
of A. In all other steps of computations A' should simply follow A. Here is a
formal definition. Suppose that sb ~ S. Let S' = S U{so}. Define the automaton
A' = (S', {sb}, M', F), where

M(s, a) if s =1= so,


M'(s,a) = { USEI M (s,a) if s = so.

Now it is easy to see that L(A) = L(A'). The lemma is proved.

Lemma 5.1.2 For every Rabin automaton A = (S, I, M, F) there exists a com-
plete Rabin automaton A' such that L(A) = L(A').
260 5. Rabin Automata

Proof Let s be a new state. The automaton A' = (5', I', M', F') is defined
as follows: 5' = 5 U{s}, I' = I, F' = F, and

M '( ) ={ M(t, u) if M(t, u) =1= 0,


t, u {(s, s)} if t = s or M(t, u) = 0.
Clearly, L(A) = L(A'). The lemma is proved.

Exercise 5.1.7 Check the equality L(A) = L(A') for both of the lemmas above.
In our further results we will often use these two lemmas without any refer-
ences to them. We now state the first theorem about Rabin automata.

Theorem 5.1.1 Let Al and A2 be Rabin automata. Then there exists a Rabin
automaton A such that L(A) = L(AI) U L(A2).

Proof. Let each Ai be (5i, Ii, Mi, Fi), where i = 1,2. We can suppose
that Al and A2 have no states in common, that is, 51 n
52 = 0. The idea of
constructing a Rabin automaton A which accepts L(AI) U L(A2) is similar to
the union theorem for Btichi automata. Having an input (v, T), the automaton A
mimics computations of Al and A2 on (v, T). If one of these computations is
successful, then A accepts ex, otherwise A does not accept ex. Indeed, we define
the Rabin automaton A = (5, I, M, F) as follows:

1. The set 5 of states is 51 U 52,


2. The transition table M is MI U M2,

3. The initial states set I is II U h

4. The final states of A are all the states from FI U F2.


Now it is not hard to show that L(A) = L(AI) U L(A2). 0

Exercise 5.1.8 5how that the automaton A constructed in the theorem above rec-
ognizes the union L(Ad U L(A2).

We now want to prove that the set of Rabin recognizable languages is closed
under intersection. Here is the theorem.

Theorem 5.1.2 Let Al and A2 be Rabin automata. Then there exists a Rabin
automaton A such that L(A) = L(Ad L(A2). n
Proof. The idea of constructing A is a natural one. Having an input (v, T),
A begins its run on (v, T) by mimicking computations of Al and A2 on (v, T)
simultaneously. One part of A takes control of Al and the other part of A takes
control of A2. We need to take some care when defining F. Here now is a formal
definition of A.
5.1. Rabin Automata 261

1. The set S of states is SI x S2.

2. The set I of initial states is II x h

3. The transition table M maps all pairs of the form «s, s'), u), where s E SI,
s' E S2 to the set of all pairs

«Sl, sD, (S2, s~»


such that (Sl, S2) E MI (s, u) and (s;, s~) E M2(S', u).

4. Finally, F contains all subsets G C SI x S2 such that the projection


prl (R(G)) = {s E SI I 3s'«s, s') E G)} belongs to FI and the projec-
tionpr2(G) = {s' E S2 I 3s«s, s') E G)} belongs to F2.

Now the reader can check that L(A) = L(Ad n L(A2). 0


Exercise 5.1.9 Check that the automaton A constructed in the previous theorem
recognizes the language L(AI) nL(A2).
The next theorem is the projection theorem for Rabin automata recognizable
languages. As the projection theorem for Biichi automata, this theorem states that
if a language L over an alphabet b = bl X b2 is recognizable by a Rabin
automaton, then the projections of L to the languages over bl and b2 are also
Rabin recognizable.
We now give formal definitions. Suppose that b = bl x b2. Let (v, T) be a
b-valued tree. Then the bl-projectionof(v, T) is (VI, T) such that for every u E T
there exists a U2 E b2 such that v(u) = (VI (u), U2). We denote this projection by
prl (v, T). The b2-projection pr2(v, T) of (v, T) is defined similarly.
Now let L be a language over b = bl x b2. We define the projection of this
language to bl (b2) as follows:

prl «L)) = {prl (v, T) I (v, T) E L} (pr2(L) = {pr2(v, T) I (v, T) E L}).

Thus, pri (L) is a language of bi-valued trees, i = 1,2.

Theorem 5.1.3 lfthe language L over the alphabet bl x b2 is Rabin recognizable,


then so are the projections prl (L) and pr2(L).

Proof. Let A = (S, I, M, F) be a Rabin automaton which accepts the


language L. A Rabin automaton Al accepting the projection prl (L) is infor-
mally explained as follows. The automaton Al takes an infinite input (VI, T),
where VI : T -+ bl, and mimics A on all bl x b2-valued trees (v, T), where
v(u) = (VI (u), U2) and U2 E b2. If A accepts one of these trees, then Al accepts
(VI, T). Otherwise, Al does not accept (VI, T). Thus Al runs on (VI, T) in such
a way as to simulate a run of A which forgets the right coordinates of the labels.
Now a formal definition of Al = (SI, h, MI, FI) can be described as follows:
262 5. Rabin Automata

1. The set SI of states of Al is S.

2. The initial states of Al are those from I.

3. For the transition digram MI, MI (s, u) contains (s, S') if and only if there
exists a U2 E h2 such that «s, (UI, U2), (s, S'» belongs to M.

4. The final states set FI is:F.


Now the reader can establish that the Rabin automaton Al accepts prl (L). Simi-
larly, there exists a Rabin automaton A2 such that pr2 (A) = L(A2). 0

Exercise 5.1.10 Finish the proof of the projection theorem above.

Exercise 5.1.11 Let L bea language of hi-valued trees. Let h2 beanewalphabet.


ThecylinderofL is the language over hi x h2 which consists ofall hi x h2-valued
trees whose projections to hi belong to L. Show that if L is Rabin recognizable,
then so is the cylinder of L.

The next natural question, called the complementation problem for Rabin
automata, is the following.
Is the complement of a Rabin recognizable language Rabin recognizable?
The complementation problem for Rabin automata is a difficult and core part of
automata theory on infinite trees. Michael Rabin was the first to give a positive
solution to the complementation problem. However, his proof was hard and there-
fore there has always been a great deal of interest in providing easier proofs of
the complementation problem. Usually each new proof contains new ideas and
methods. These ideas and methods have been used in automata theory on infinite
objects and applications.
Our basic goal will consist of giving a solution to the complementation prob-
lem for Rabin automata. We will base our proof of the complementation problem
on game-theoretic methods developed by Yuri Gurevich and Leo Harrington. We
discuss the complementation problem for Rabin automata later as we need some
preparation.
However for now, we concentrate on another type of acceptance condition.
In particular we investigate automata with Biichi type of acceptance condition on
infinite trees. We give a negative solution to the complementation problem for the
class of languages defined by this acceptance condition.

5.2 Special Automata


It is interesting to compare the definition of acceptance for Rabin automata with the
definition of acceptance for MUller automata. There is certainly a similarity between
these two definitions as in both cases we consider whether or not the infinity sets
of the runs are designated. We know, by the McNaughton theorem, that B iichi and
5.2. Special Automata 263

Milller automata are equivalent. This suggests the idea of considering automata
on ~-valued trees for which the acceptance condition is similar to the acceptance
condition for Bilchi automata. We call such automata special automata. The goal
of this section is to investigate properties of such automata.

5.2.1 Basic Properties of Special Automata. We begin with the definition of


special automata. These are finite state machines that make their runs on ~-trees,
where ~ is a fixed finite alphabet.

Definition 5.2.1 A special automaton over the alphabet ~ is quadruple A =


(S, I, M, F) such that

1. S is a finite set of states,

2. I C S is the set of initial states,

3. M is a mapping from S x ~ to the set P (S x S) called the transition table,


and

4. F is a subset of S called the set offinal states.

Note that special automata differ from Rabin automata only in item 4. Let now
(v, T) be a ~-tree. Take a special automaton A. Then the automaton A processes
the input (v, T) in the same way as Rabin automata. Therefore, the notion of a
run for special automata is exactly the same as for Rabin automata. We now give
a definition of what it means for a special automaton to accept a ~-valued tree
(v, T).

Definition 5.2.2 A special automaton A accepts, or equivalently recognizes, the


~-valued tree (v, T) if there exists a run r of A on (v, T) such that for every path
if in T
{s E S I r(u) = s for infinitely many u E 7r} n
F =1= 0.

This definition simply says that a special automaton A recognizes a ~-valued tree
(v, T) if there exists a run r of A on this tree with the following property. If we
observe this run restricting it on any given path of T, then the infinity set of this
computation along this path meets some of the states from F infinitely often. For
a given special automaton A, we denote by L(A) the set of all ~-valued trees
accepted by A.

Definition 5.2.3 A language L C V~ is s-recognizable if there exists a special


automaton A such that L(A) = L.

Example 5.2.1 A ~-tree (v, T) is uniform ifv(x) = v(y) for all x, y such that
Ixl = Iyl· Let A = (S, I, T, F) be a Biichi automaton. Construct a special au-
tomaton A' = (S', I', M', F') asfollows:
264 5. Rabin Automata

1. S' = s.
2. I' = I.

3. M'(s, a) = {(SI, sl)l(s, a, SI) E T}.

4. F' = F.

For the constructed special automaton A we have the following property.


For any uniform b-tree (v, T), the special automaton A' recognizes (v, T) if and
only ifthe Blichi automaton A accepts the string a v , where av(i) = v(x) such that
Ixl=i,iEW.

Exercise 5.2.1 Let b = {a, b}. For every n, consider the valuation Vn defined as
follows: Vn (x) = a ifx E {A., 0, 00, ... , on}. Vn(X) = b for all other x E T. Show
that there exists a special automaton that accepts the language {( V n , T) 1 nEw}.

Our goal is prove that the set of languages recognizable by special automata is
closed under the set-theoretic operations of union, intersection, and projection. As
we did for Rabin automata, we need one simple lemma and a technical definition.
We say that a special automaton A = (S, I, M,:F) is complete if for all a E
b, s E S, there exists a pair (SI,S2) of states such that (SI,S2) E M(s, a). A
complete automaton is quite convenient since the automaton is able to proceed
(nondeterministic ally) with its run in any given state and any input a E b. Here is
the lemma whose proof follows the proof of the similar lemmas for Rabin automata
(see Lemma 5.1.1 and Lemma 5.1.2).

Lemma 5.2.1 For every special automaton A = (S, I, M, F) there exists a spe-
cial complete automaton A' with only one initial state such that L(A) = L(A'). 0

The next exercise shows that every language accepted by a special automaton
can be accepted by a Rabin automaton.

Exercise 5.2.2 Let A = (S, I, M, F) be a special automaton. Consider the Rabin


automaton A' = (S', I', M', F'), where S' = S, I' = I, M' = M, and Q E F' if
n
and only if Q F =1= 0. Show that L(A) = L(A').

Theorem 5.2.1 If L1 and L2 are recognizable by special automata, then so are


L 1 U L2 and LIn L2·

Proof. Let Ai = (Si, Ii, Mi, Fi) be such that Li = L(Ai), where i = 1,2.
We can suppose that Al and A2 have no states in common, that is, SI n
S2 = 0.
We define the special automaton A = (S, I, M, F) as follows:

1. The set S of states is SI U S2.


2. The transition table M is MJ U M2.
5.2. Special Automata 265

3. The initial states set I is Ii U h


4. The final states of A are all the states from F, U F2.
Now it is not hard to show that L(A) = L(Al) U L(A2).
We need to prove the second part of the theorem. The construction of the
automaton that recognizes the intersection uses the ideas where we construct a
Btichi automaton that recognizes the intersection of Btichi recognizable languages.
The following special automaton A = (S, I, M, F) recognizes the intersection
Ll n L2·
1. S = S, x S2 x to, 1, 2}.

2. I = Ii x h x {I}.

3. The transition table M is defined as follows. «Sl' s; , b), (S2, s~, b» belongs
to M «s, s', a), a) if and only if the following conditions are satisfied:

(a) (S"S2) E M,(s,a) and (s;,s~) E M2(S', a).


(b) b = 1 if and only if s ¢. Fl and a = 1, or a = O.
(c) b = 2 if and only if s E F, and a = 1.
(d) b = 2 if and only if s ¢. F2 and a = 2.
(e) b = 0 if and only if s E F2 and a = 2.

4. F = S x S x to}.
We leave the reader to prove that L(A) = L, nL2. 0
Exercise 5.2.3 Finish the proof of the theorem above.
The next theorem is the projection theorem for special automata recognizable
languages. We do not present a proof of the theorem since the proof simply follows
the proof of the same theorem for the Rabin automata case.

Theorem 5.2.2 If the language L of '£, x '£2 -valued trees is recognizable by a


special automaton, then so are the projections prJ (L) and pr2(L). 0

5.2.2 A Counterexample to Complementation. We now wish to show that


the class of languages recognizable by special automata is not closed under the
operation of complementation. We will exhibit a special automaton recognizable
language L C V~ such that V~ \ L can be recognized by no special automaton.
We note that the construction of the language L resembles the construction of the
language that is recognized by a Btichi automaton but which cannot be recognized
by a deterministic Btichi automaton.
Let'£ = {a, b}. Define

L = {(v, T) I some path in T carries infinitely many a}.


266 5. Rabin Automata

We will prove that L is recognizable by a special automaton and no special au-


tomaton recognizes the complement VE \ L of L.
Proposition 5.2.1 There exists a special automaton that recognizes L.
Proof. Informally, a special automaton A we construct works as follows. By
a nondeterministic choice, A guesses a path on the tree T and on this path A picks
up a final state each time a is met. On the other parts of the tree only one final
state is computed. We now describe A = (S, I, M, F) formally. The set S of states
is {so, Sl, S2, S3}' The initial state is so. The set F of final states is {Sl' S3}' The
transition table M is defined as follows, where explanations are given in brackets
[[like this]].
1. For all a E b, M(so, a) = {(S2, sJ), (Sl' S2)}. [[In this definition, S2 is the
guessing state whose job is to run through a path which has infinitely many
as on it.]]

2. For all a E b, M (Sl' a) = {(Sl' Sl)}. [[As long as the automaton is in state
SI, then the automaton is happy.]]

3. M(S2, b) = {(S2, sJ), (S2, SI)}·


4. M(S2, a) = {(S3, sJ), (SI, S3)}' [[As the automaton reads the input a, the
automaton records it by going to state S3 and changes S3 to either SI or S2
immediately afterwards (see the next item).]]

5. For all a E b, M(S3, a) = {(SI, S2), (S2, SI)}

We leave it to the reader to prove that L(A) = L. 0

Exercise 5.2.4 Finish the proof of the proposition above by showing that the spe-
cial automaton constructed indeed recognizes L.

Now our goal will be to show that the complement of L cannot be recognized
by a special automaton. To do this we need some preparation. We recall that T y =
{yz I Z E T}.
Definition 5.2.4 Let (VI, T) and (V2, T) be b-valued trees. Then the grafting of
(V2, T) on (VI, T) at node yET is the b-tree (V3, T) such that V3(Z) = VI (z)
forz st Ty andv3(YZ) = V2(Z) for all yz E T y.
Thus, grafting of (V2, T) on (VI, T) at node YET produces a b -tree that
"copies" the valuation V2 after the node y and "copies" the valuation VI in all other
nodes. Another explanation of the grafting operation is the following. We take the
b-tree (VI, T). Forget the valuation VI at the nodes above y, and "replace" VI
with V2 at all nodes above y. Now we give an example of grafting which will later
be used in our proof that the complement of L cannot be recognized by a special
automaton.
5.2. Special Automata 267

Example 5.2.2 Consider the sequence (VI, T), (V2, T), (V3, T), ... of{a, b}-val-
ued trees such that

1. VI (A) = a and VI (x) = b for all x, x i= A;


2. (V2, T) is obtained by grafting (VI, T) on (VI, T) at each of the nodes 1kO,
1 ::: k < w;

3. In general, (Vn+l, T) is obtained by grafting (v n , T) on (VI, T) at each of


the nodes 1kO, 1 ::: k < w.

Thus, in (v I , T) the root is labeled with a, and all other nodes are labeled
with b. In (V2, T) the root, the nodes A, 10, 110, 1110, ... are labeled with a and all
other nodes with b. In general, the ~>tree (Vn+l, T) has the following properties:

1. For every x E T, if vn(x) = a, then Vn+1 (lOx), vn+1 (110x), vn+1 (11 lOx),
... are all equal to a.

2. For every YET if Vn+1 (y) = a and y = l kOx for some k > 1, then
vn(x) = a.
3. All the nodes in (v n , T) labeled by a are also labeled with a in (Vn+l, T).

Let us, for example, prove that the property (3) above holds true. The proof uses
the previous two properties. For n = 0, the statement is true clearly. Assume that
vn(x) = a. If x = A, then clearly Vn+I(A) = a. Otherwise, x = l kOy for some
k > 0 and y. Since vn(x) = a, we see that Vn-I (y) = a. Hence by the induction
hypothesis vn(y) = a. We conclude that Vn+I(X) = a. Note also that in this
example each ~-tree (Vi, T), i ~ 1, does not belong to the language L.

Exercise 5.2.5 Consider the sequence (VI, T), (V2, T), (V3, T), ... of{a, b}-val-
ued trees in the example above (see Example 5.2.2). Prove that this sequence
satisfies the first two properties stated above.

Consider a ~-valued tree (v, T). By induction on n, we define the set Dn (v)
as follows:
DI (v) = {x I vex) = a},
and

Dn+I(V) = Dn(v)n{x I the set Dn(v)nTx has infinitely many elements}.

Exercise 5.2.6 Show that for all n, ifx E Dn+1 (v) then vex) = a.
Lemma 5.2.2 For every n ~ 1, there exists a ~-tree (v, T) such that A E Dn(v).
268 5. Rabin Automata

Proof.Considerthesequence(vl, T), (V2, T), (V3, T), .. . from the example


above (see Example 5.2.2). We prove that).., E Dn(v n ) for every n. Clearly, ).., E
DI (VI) because VI ()..,) = a. Now assume that).., E D(v n ). We need to prove that
).., E Dn+I(Vn+j). Consider the sequence 10,110,1110, .... Since).., E Dn(vn ),
by the definition of Vn+1 we conclude that 1k O E Dn(Vn+I). Hence infinitely
many elements above).., belong to Dn (vn+ I)' It is also not hard to see, by using
induction, that).., E Dn(vn+j). Hence we conclude that).., E Dn+1 (Vn+I). The
lemma is proved.

Lemma 5.2.3 Let A = (S, I, M, F) be a special automaton. Suppose that for a


'£-tree (V, T) the root).., belongs to Dn+1 (v). ffr is an accepting run of A on (v, T)
such that the set {r(u) I u f= ).." u E T} has not more than n states, then there exist
x, z, YET with the following properties:

1. x < z < y.
2. r(x) = r(y), r(x) E F, and v(z) = a.
Proof. We prove the lemma by induction on n. Let n = 1. Then the cardinality
of the set {r(x)lx f= )..,} equals 1. Since).., E D2(V), there must exist x, y, z that
satisfy the statement of the lemma.
Suppose that n > 1. For every path nET, let x(n) be the first node x in n
such that r(x) E F. Since r is a successful computation the node x(n) exists for
each path n. Consider the set

E = {y I for some n, y :s x(n)}.


The set E is finite since otherwise c would not be a successful computation. Indeed,
using Konig's lemma one can show that if the set E is infinite, then there exists a
path which is a subset of E. Then the infinity set of the run r along this path would
be unsuccessful. Now note that the set

isinfinite,since)'" E Dn+l(v).Hencetheremustexistaz E Dn(v)suchthatz ~ E.


Since z E Dn(v), we have v(z) = a. Let x be such that x(n) = x, x < z, and
s = r(x). If there exists a y such that r(y) = r(x) and y > z, then the lemma is
proved. Otherwise, the state s does not belong to the set

{r(u) Iu > z}.

Now consider the '£-valued tree (v, T z) and the special automaton A' = (S, {r(z)},
M, F). Clearly, the automaton A' accepts (v, T z). Moreover, the induction hypoth-
esis for A' and (v, T z) holds. Hence, applying the hypothesis to A' and (v, T z),
we see that there exist x', Z', y' E T z with the following properties:
5.2. Special Automata 269

1. x' < z' < y'.

2. r(x') = r(y'), r(x') E F, and v(z') = a.


The lemma is proved.
Recall that we are interested in the language

L = {(v, T) I some path in T carries infinitely many a}.

Lemma 5.2.4 Let A be a special automaton and let (v, T) be a "£-tree. ffr is an
accepting run of A on (v, T) such that for some x, z, YET, x < z < y and
r(x) = r(y), r(x) E F, and v(z) = a, then A accepts a "£-tree in L.

Proof. Let y = xu. We graft (v, Tx) on (v, T) at node y. Let (vi, T) be
the resulting tree. Note that the automaton has a successful computation r! on the
resulting tree such that r(x) = r! (x) = r! (y) E F. The "£-tree (v;, T) is obtained
by grafting (v, Tx) on (vi, T) at node xuu. Continue this process inductively on
nEw so that at the nth step of the induction graft (v, T x) on (v~, T) at x un. This
defines the "£-tree (v~+!' T). Now note that lim n ---+ oo v~ (u) exists for every u E T.
In other words, for every u E T, there exists an n such that v~ (u) = v~+;< u) for
all i. Set
v'(u) = lim v~(u).
n--->OO

Consider the tree (v', T). We leave the reader to check that (v', T) is accepted by
the special automaton A (see the exercise below). We note that the tree (v', T)
constructed in the lemma above has a path n such that v' (x) = a for infinitely
many x En. Hence (v', T) E L. 0

Exercise 5.2.7 Finish the proof of the lemma above by showing that the special
automaton A accepts the tree (v', T).

We now show that the lemmas proved above give us the desired result.

Theorem 5.2.3 Consider the language

L = {(v, T) I some path in T carries infinitely many a}.


Then L is recognized by a special automaton, but there does not exist a special
automaton that recognizes the complement of the language L.

Proof. Suppose that a special automaton A accepts the language V~ \ L.


Let n be the number of states of the automaton A. Consider the tree (vn+!, T).
Note that A E Dn+1 (v). The automaton A accepts the tree (vn+!, T). Let r be
a successful run of the automaton A on (vn+!, T). By Lemma 5.2.3 there exist
x, z, YET such that x < z < y, r(x) = r(y), r(x) E F, and v(z) = a. Then we
see that Lemma 5.2.4 leads us to a contradiction. The theorem is proved.
270 5. Rabin Automata

5.3 Game Automata


In this section we prepare some machinery to solve the complementation problem
for Rabin automata. In order to handle the problem we study certain type of games.
These games are introduced by Gurevich and Harrington. Therefore, we sometimes
call these game GH-games. Our plan in this section is as follows. We first explain
the notion of game informally. Second, we explain the rules of the games. Then,
we explain strategies and what it means to win a game. Finally, we define game
automata and present some examples.

5.3.1 What Is a Game? We begin with an informal explanation of the notion of


game. Each game has two players. The name of one of the players is Automaton.
The name of the other player is Pathfinder. In order to begin the game, Automaton
is provided with a finite set S (set of states) and the other player Pathfinder is given
the set {O, I}. The game consists of plays. Automaton begins each play. Every play
between these two players occurs as shown below:
Automaton chooses Pathfinder chooses
So E S dl E {O, I}
Sl E S d2 E {O, I}
S2 E S d3 E {O, I}

Thus, Automaton begins a play by choosing a state So from S. Pathfinder responds


by choosing dl E {O, I}. Then it is Automaton's turn to respond. This goes on
forever. We cal1 the produced sequence

a play. Thus, we have informally explained the game and its plays.
Of course each game possesses rules. We now explain the rules of the games
we study. Suppose that Automaton is provided with a set S and Pathfinder is given
{O, I}. In order to begin the game, in addition to Sand {O, I}, both players should
also be provided with a b-valued tree (v, T), where b is our fixed finite alphabet.
The game does not occur if the players are not provided with a b-valued tree
(v, T). When Automaton makes its first move by choosing a state So, the player
must follow the initial rule which is simply a fixed set [ of pairs

(a, s),

where a E b, s E S. Formally, this means that the first move So of Automaton


must be such that
(v()..), so) E [,
where).. is the root of the tree T and v is the given valuation from (v, T). Note
how the payer uses the given b-tree (v, T).
5.3. Game Automata 271

During a play the players must also follow the rule of the game. The rule is
simply afixed set R of 4-tuples

(S, d, a, Sf)

such that S E S, d E {a, I}, a E 1":, Sf E S. Here now is how the rule R is
implemented when, say for example, Pathfinder and Automaton make their moves
after the first move of Automaton. Suppose that Automaton has chosen a state So
following the initial rule I. Now Pathfinder chooses a dl. Automaton responds by
taking a state Sl in such a way that the move should follow the rule R, that is,

In the next move Pathfinder chooses d2. The next move S2 of Automaton should
follow the rule R, that is,

Thus, a play following the rules is a sequence

such that (v()..) , so) E I and

for all n ::: 0. Note how the 1":-valued tree (v, T) is involved in the play. We also
note that in the play
So, dl, Sl, d1, ... , ... ,

Pathfinder produces a path on the binary tree T, while Automaton produces tran-
sitions in the state set S of the game automaton A.
Who is the Winner of a Play? Note that here we define the winner of a
play but not of the game. A definition of the winner of the game will be given
later and needs some preparation. In general, it certainly can be the case that the
winner of the game is Automaton, though some plays can be won by Pathfinder or
vice versa. Declaring the winner of a given play is defined as follows. Before the
game starts, the players should also be provided with a collection F of subsets of
S. Each set from F is called a winning condition or, equivalently, a winning set,
for Automaton. Now suppose that Automaton and Pathfinder have produced the
following play:

Consider the sequence


272 5. Rabin Automata

which is a subsequence of the play. Consider the infinity set

In(s) = {s I s appears in the subsequence infinitely often}

of this subsequence. Automaton wins the play if In(s) E F. Otherwise, Pathfinder


wins the play. Consider the following example.

Example 5.3.1 The alphabet b = {a, b}. Suppose that Automaton is provided
with the set S = {so, sIJ of states. Pathfinder is provided with {O, I}. The initial
rule I is {(a, so), (b, so)}. The rule R of the game contains thefollowing 4-tuples:

(so, d, b, so), (so, d, b, Sj), (Sj, d, b, Sj), (Sj, d, b, so),

where d E {O, I}, a E b. The set F of winning conditions is {{so, sIll. The two
players are provided with b-tree (v, T), where v(J..) = a, and vex) = b for all
nodes othar than A. Thus, we have a game determined by I, R, F, and (v, T).

In this game, the sequence

so, 0, Sj, 0, so, 0, Sj , 0, ...

is a play. In this play Pathfinder produces the leftmost path, that is A, 0, 00, 000,
0000, ... , through the binary tree T. Automaton wins this play because the infin-
ity set of the sequence of transitions produced by Automaton belongs to F. The
sequence
so, 0, so, 0, so, 0, so, 0, ...
is also a play. In this play Pathfinder again produces the leftmost path, that is
A, 0, 00, 000, 0000, ... , through the binary tree T. However, Automaton was not
clever enough to win this play because the infinity set of the sequence of transitions
produced by Automaton does not belong to F. Hence Pathfinder wins the play.

5.3.2 Game Automata. Based on the previous subsection we are now ready to
give one of the main definitions of this chapter. We define the notion of game
automata. We recall that we have a fixed alphabet 1:, tree T, and the set bV of
b-valued trees. Here is a definition.

Definition 5.3.1 A game automaton is a quadruple A = (S, I, R, F) such that


1. S is a finite set of states;

2. I is a subset ofb x S called the set of initial rules;

3. R is a subset of S x {O, I} x b x S called the set of rules;

4. F is a collection of subsets of S called winning conditions.


5.3. Game Automata 273

Thus, informally a game automaton can be understood as a collection of rules


(given by I and R) and winning conditions (given by F). Suppose now that we
have a fixed 1:-valued tree (v, T). Let A be a GH automaton. The automaton A
and the 1:-tree (v, T) determine the following game denoted rcA, v). The game
is played between the two players: Automaton and Pathfinder. Every play between
these two players occurs as follows:
Automaton chooses Pathfinder chooses
So E S d] E {a, I}
s, E S d2 E {a, I}
S2 E S d3E{O,1}

In this play Automaton chooses So E S; Pathfinder chooses d, E {a, I};


Automaton chooses s, E S; and so on in turns. Thus we have a play

We require that this sequence must follow the rules of the game given by the
automaton A. This simply means that
1. (v()..) , so) E I;

2. (sn, d n+, , v(d] ... d n+]), sn+]) E R for all n ~ 0.


Automaton wins the play sad] s] d2S2 ... if the infinity set

{s I Sn = s for infinitely many n}


belongs to F; otherwise Pathfinder wins the play.

Definition 5.3.2 Consider the game r (A, v). Any finite prefix of any play of this
game is called a position.

Clearly, Automaton makes moves in positions of even length. Pathfinder


makes moves in positions of odd length. By the definition of a play not every finite
sequence of alternating elements of Sand {a, I} is a position. Informally, when
play occurs between the players the current position of the play can be identified
with the history of the play. The position tells the player what moves have been
made up to the current moment. We end this subsection by presenting an example.

Example 5.3.2 Let A be a game automaton for which


1. S = {so, sd;

2. I = {(a, so), (b, so)};

3. R = {(s,d,a,s), (s],d,a,so), (so, l,a,s]) IdE {a, l},a E 1:,s E S};


274 5. Rabin Automata

4. :F = {{so, sd}.

Let (v, T) be such that vex) = a for all x E T. Consider the game rcA, v).
In this game
So 0 So 0 So 0 ...
is the only play that begins with So if Pathfinder always chooses O. If Pathfinder
always chooses 1, then
So 1 S\ 1 So 1 s\ 1 So 1 ...

is another example of a play. Note that

is not a position of the game.

Exercise 5.3.1 Let A be a game automaton for which S = {so, sd, I = {(a, so),
(b, so)}, R contains the following 4-tuples:

(so, d, b, so), (so, d, b, S\), (S\, d, b, sJ), (S\, d, b, so),

where d E {O, I}, a E b, andfinally:F = {{so, sll}. Consider the game rev, T),
where V(A) = a, and vex) = b for all nodes other than A. Describe plays and
positions of this game.

5.3.3 Strategies. We now explain what it means that one of the players of a
given game rcA, v) wins the game. The notion of a strategy is the crucial notion
for giving an exact mathematical definition of the winner. Informally, a strategy
for a player is a rule which the player may follow during any play. The strategy
tells the player how to move in any given position when some or all information
preceding the position is given.

Definition 5.3.3 Let rcA, v) be a game. A strategy for Automaton is a function


which to every position p of even length assigns an element of S. Similarly, a
strategy for Pathfinder is a function which to every position p of odd length
assigns an element of {O, I}.

Let us now fix a game r (A, v). Let f be a strategy for Automaton (Pathfinder)
in this game. Suppose that at any position p of even (odd) length of the game Au-
tomaton (Pathfinder) chooses the next move according to the strategy. In other
words, if p is a position of Automaton (Pathfinder), then the next move of Automa-
ton (Pathfinder) is f(p). Informally, the strategy f, looking at the history p of the
play, tells the player where to move next.
Thus we can consider the set of all plays in this game such that at any position
of any of these plays A utomaton (Pathfinder) follows the strategy f. More formally,
if Automaton follows the strategy f, then any play looks like this:
5.3. Game Automata 275

Automaton chooses Pathfinder chooses


f()...) E S dl E {a, I}
f(f()"')dJ) E S d2 E {a, I}
f(f()"')dd()"'dl)d2) E S d3 E {a, I}

Thus, any play where Automaton follows the strategy f has the form

This play is called a play consistent with f. Now assume that g is a strategy for
Pathfinder. Then, similar to above, any play where Pathfinder follows the strategy
g has the form

This play is called a play consistent with g.

Definition 5.3.4 Let r(A, v) be a game.


1. Say that f is a winning strategy for Automaton if Automaton wins all plays
consistent with the strategy f.

2. Say that g is a winning strategy for Pathfinder if Pathfinder wins all plays
consistent with the strategy g.
If one of the players has a winning strategy in the game r (A, v), then we say that
the player wins the game.

Thus, a player wins the game rcA, v) if there is a strategy for the player so
that when the player follows the strategy, the player always wins no matter what
the opponent does. In general, given a game it is not always clear whether or not
one of the players wins. It is clear from the definition that if a player wins the game,
then the opponent does not have a winning strategy. Later we will show that in the
game r (A, v) one of the players always win. We note that the winners depend on
the game automaton A and the "E-valued tree (v, T). We now give an example for
"E = {a, b}.

Example 5.3.3 Let A = (S, I, R, F) be such that S = {to, t1, t2}, I = {(a, to)},
F = {{to, til}, and R = {(to,d,b,tJ), (to,d,a,t3), (t1,d,a,t3), (tl,d,a,to),
(t1, d, a, t3), (t3, d, a, t3)ld E {a, I}, a E "E}.

Let us now, for this example, consider the valuation v, where v (x) = a if Ix I
is even and vex) = b if Ixl is odd. In the game rCA, v) Automaton has a winning
strategy f defined as follows. Let p = SOd1Sld2S2 ... Sn-Idn be a position of
Automaton. Thus, if Sn-1 = to, then f(p) = t1; if Sn-l = t1, then f(p) = to; if
Sn-l = t3, then f (p) = t3. Automaton wins any play consistent with the strategy f.
276 5. Rabin Automata

Exercise 5.3.2 Let A be a game automaton for which S = {so, sd, I = {(a, so),
(b, so)}, R contains the following 4-tuples:

(so, d, b, so), (so, d, b, Sl), (Sl, d, b, Sl), (Sl, d, b, so),

where d E {a, I}, a E b, and finally F = {{so, sd}.

1. Consider the game rev,


T), where V(A) = a, and vex) = b for all nodes
other than A. Show that Automaton wins this game.

2. Find a v' different from v (in the item above) so that Automaton wins the
game rev', A).

Thus, we note the following. Given a game automaton A, Automaton and


Pathfinder can play infinitely many games. Each of these games determined by
some b-valued tree. For some b-valued trees (v, T), Automaton may win the
game; for some b-valued trees, Pathfinder wins the game. Therefore, it is natural
to collect all the b-valued trees (v, T) for which Automaton wins the game rCA, v).
We formalize this in our next definition.

Definition 5.3.5 A game automaton A accepts a b-tree (v, T) ifAutomaton wins


the game rCA, v).

Thus, if the automaton A accepts the b-tree (v, T) then no matter which
path in T Pathfinder chooses, Automaton can always make transitions in the game
rcA, v) to satisfy a winning condition. We finish this section with the following
exercises.

Exercise 5.3.3 Let b = {a, b}. Let A = (S, I, R, F) be such that S = {ta, tb},
I = {(a, ta), (b, tb)}, F = {{ta, tb}}, and R = {(fa, d, b, tb), (tb, d, a, ta)}. Find
all the b-trees accepted by the game automaton A.

Exercise 5.3.4 Let b = {a, b}. Construct a game automaton A that accepts all
the b-trees (v, T) so that the set {x I vex) = a} is finite.

5.4 Equivalence of Rabin and Game Automata


In the previous section we defined and considered examples of game automata. In
this section we show the relationship between Rabin automata and game automata.
The goal is to prove that Rabin automata and game automata are equivalent. Thus,
let A be a game automaton. Naturally, we can define the set L(A) as follows.

Definition 5.4.1 For the game automaton A, the set L(A) is the set of all b-
valued trees (v, T) accepted by the game automaton A, that is, all (v, T) for
which Automaton wins the game rev, T). The language L(A) is called game
automaton recognizable.
5.4. Equivalence of Rabin and Game Automata 277

The next two results show that Rabin automata accept exactly the same
languages accepted by game automata. In the first theorem below we will show
how to transform a given Rabin automaton to an equivalent game automaton.
Recall that we have a fixed alphabet b.
Theorem 5.4.1 For any Rabin automaton A = (S, {so), M, :F), we can construct
a game automaton A' = (S', I', R', F') such that A and A' accept the same
b-valued trees.

Proof. In constructing the game automaton A' we would like to have the
following properties. Given a b-valued tree (v, T), we want to transform each run
of A on (v, T) into a strategy for Automaton in the game rCA', v). We also want
to be able to go from a strategy for Automaton in the game rCA', v) to a run of A
on (v, T). Moreover, we want this transformation to have the following property.
Every successful run corresponds to a winning strategy and every winning strategy
of Automaton corresponds to a successful run of the automaton A. Naturally an
important component of the proof is to show how to transform the transition table
M of the automaton A into the set R' of rules of the game automaton A'.
We begin by describing the game automaton A'. The set S' of states of A'
is S x S x S. We explain the idea behind the definition of S' by analyzing the
first moves of Automaton and Pathfinder which correspond to some run r of A on
(v, T).
Assume that (to, tj) E M (t2, a) and V(A) = a, where A is the root. Suppose
that r is a computation of A on (v, T) such that rCA) = t2 and r(AO) = to, reAl) =
tl. The beginning of the play which is intended to correspond to this fragment of the
computation must carry the information that rCA) = t2 and r(AO) = to, reAl) = tl.
Hence, basically Automaton should move by picking up the triple
(to, tl, t2)·
To this move of Automaton the opponent responds by picking up either 0 or 1 from
{O, I}. If Pathfinder chooses 0, then the next move of Automaton is the triple
(t6, t;, to),
where (t6, tD E M(to, a') with v(O) = a'. If Pathfinder chooses 1, then the next
move of Automaton is the triple
(to,t;',tj),
where (to' t;') E M(tl, a") with v(l) = al/.
The discussion above suggests defining the rules [' and R' in the following
manner. The set [' of initial rules of A' is
{(a, (to, tl, t2)) I (to, tj) E M(so, a) and t2 = so}.
The set R of rules contains a four tuple (t, d, a, t') if and only if the following
conditions are satisfied:
278 5. Rabin Automata

1. d E {O, 1), 0' E L

2. If t = (to, t1, t2) and t ' = (tb, tl,' , t~), then (tb, t;) E M (td, 0'), t~ = td, and
dE{O,l}.

We now explain the definition of R'. Assume that Automaton has chosen the
triple (to, tl , t2) during a play. This can be associated with the fact that for some run
r of A on a ~::-tree (v, t) and some node x E T we have r(x) = t2, r(xO) = to, and
r(x 1) = t1. Since r is a run it must be the case that (to, t1) E M (r(x), v(x)). Now
assume that to the move (to, t1, t2) Pathfinder responds by choosing ad E {O, I}.
If d = 0, then the next move of Automaton is the triple

where (tb, tD E M(to, 0") with v(xO) = 0". If Pathfinder chooses 1, then the next
move of Automaton is the triple

where (t~, t;') E M (tl , 0'") with v(x 1) = 0'". The set F' is defined as
F' = {X c sx S x S I pr3(X) E F},

where pr3 is the projection of X to the last coordinate.


We have to show that L(A) = L(A' ). Suppose that (v, T) is accepted by .A.
There exists a computation r of the automaton A showing that (v, T) E L(A). We
define the strategy f for Automaton in the game r(A', v). Suppose that

where i E w, is a position. Note that when i = 0, the position corresponds to A.


Define

f(sodIS1d2 ... di) = (r(d1 ... diO), r(dl ... di 1), r(dl ... di)).

Note that f(A) is (r(O), r(l), r(A)). We leave the reader to check that this strategy
is a winning strategy in the game r(A', v) (see Exercise 5.4.1 below).
Conversely, suppose that Automaton wins the game r(A', v). Let f be a
winning strategy for Automaton. We define the run r for automaton A. Put

where i ::: 0 and sodJSI ... di is a position in the game consistent with the strategy
f. Using this definition, it is not hard to see that cr is indeed a run of the automaton
A on the I:-tree (v, T). Moreover, r is a successful run. We leave the reader to
check the rest of the details of the proof. 0
5.4. Equivalence of Rabin and Game Automata 279

Exercise 5.4.1 Complete the proof of the theorem above.

The next theorem shows a method of transforming any game automaton to


an equivalent Rabin automaton.

Theorem 5.4.2 For any game automaton A = (S, I, R, F) one can construct a
Rabin automaton A' such that the automata A and A' accept the same 'L,-valued
trees.

Proof. We first explain the idea of constructing the desired Rabin automaton
A'. Let (v, T) be a 'L,-valued tree. Consider the game f(v, A). Let

be a play of the game. Then (v().,), so) E I and for all n :::: 0 we have (sn, dn+J,
v(dJ ... dn+J), sn+J) E R. An interesting observation about the play is the follow-
ing. Automaton picked up the state So not depending on the choice of dJ. Similarly,
SJ does not depend on the choice of d2 (but of course depends on So and dJ). In
general, Sn does not depend on the choice of dn+J. This play defines the following,
natural in the sense above, mapping r from the path

to the set S U{to}, where to ¢. S as follows:

This observation suggests the following construction for the desired Rabin
automaton A'. Let to ¢. S. Define the Rabin automaton A' = (S', I', M', F') as
follows:

1. S' =S x {O, I} U{to}.

2. I' = {to}.
3. The transition table M' is defined by setting:

M'(to, u) = {((s, 0), (s, 1)) I (u, s) E /}, (u E'L,),

and for all s E S, dE {O, I}

M'((s, d), u) = {((s', 0), (s', 1)) I (s, d, u, s') E R, u E 'L" dE {O, Ill.

4. The set F' consists of all G C S x {O, I} such that prJ (G) E :F.
280 5. Rabin Automata

We have to show that L(A) = L(A' ). First suppose that (v, T) is accepted
by the game automaton A. Let f be a strategy for Automaton in the game r(A, v).
Define the mapping r for the automaton A' as follows:

r().) = to, r(O) = (so, 0), r(l) = (so, I),

and in general,

where i > 1, So = f().), S1 = f(sod)), S2 = f(sod1Sld2), etc. and SOdlS1d2


... Sj-2dj-1 is a position consistent with f.
By induction on the length x of node in T, we will show that the defined
mapping r is in fact a run of A' on the input (v, T). Indeed, suppose that x = )..
Then (r(O), r(l» E M'(V().), to) since r(O) = (so, 0), r(l) = (so, I), f().) = So
and (v().), so) E I. Now suppose that x = dl ... dj. Let a = v(x), r(x) = (s, d).
Consider the position

consistent with f. By induction hypothesis, s = Sj_l. Note that

(Sj_l,dj, v(dl ... dj),sj) E Rand Sj = f(sodlsl .. . sj_Idj).

Hence using the definition of the transition table M' and the mapping r, we see
that «Sj, 0), (Sj, I» E M'«S, dj), v(x» and r(xO) = (Sj, 0), r(xl) = (si,I).
Therefore, r is a run of A' on (v, T). Clearly, r is a successful run since f is a
winning strategy.
Conversely, suppose that the Rabin automaton A' accepts the input (v, T).
Let r be a successful run of A' on (v, T). Inductively on the length of position p
of the game r(A, v), define the strategy f as follows. Suppose that p = ).. Then
f(p) = pr1 (r(O» such that M(v().), r().» E (r(O), r(I». Consider a position
p = sodlsl ... dj-ISj_1dj. In general, we set

f(sod1S1 ... dj-]Sj-Idj) =prl(r(dl . .. djO».

We leave the reader to show that f is a winning strategy for A in the game r(A, v).
We leave the reader to check the details of the rest of the proof. 0

Exercise 5.4.2 Complete the proof of the theorem above.

Corollary 5.4.1

1. Let A1 and A2 be game automata. Then the sets L(AI) n L(A2) and
L(A)) UL(A2) are recognizable by game automata.

2. Let L be a language of '2:, I x '2:,2- valued trees accepted by a game automaton.


Then the projection prj (L), i = 1, 2, is also accepted by a game automaton
5.5. Terminology: Arenas, Garnes, and Strategies 281

Proof. The proof follows from the previous two theorems and the fact that
the class of Rabin recognizable sets is closed under the operations of union, inter-
section, and projection. The corollary is proved.
We will use the next simple technical fact perhaps without explicitly men-
tioning it in our further results. The fact is easy to prove and is left as an exercise.

Exercise 5.4.3 We say that a game automaton A = (S, I, R, F) is complete if


I =1= 0 and for all s E S, (J E ~ and d E {a, I}, there exists an s' E S such that
(s, d, (J, s') E R. Show that for any game automaton A there exists a complete
game automaton A' such that L(A) = L(A').

Thus, we have shown that Rabin automata and game automata are equivalent.
Therefore, the complementation problem for Rabin automata is reduced to the
complementation problem for game automata. The next several sections will be
devoted to proving that in any of the games of the type r (A, v) one of the players
has a winning strategy with certain important properties. These properties of the
winning strategies will then allow us to solve the complementation problem.

5.5 Terminology: Arenas, Games, and Strategies


This section introduces some terminology for further investigation of games de-
fined by game automata. In order to investigate these games, we use an approach
often used in mathematics: we will consider more general games. This slight gen-
eralization will help us to make our discussions easier without directly referring
to game automata, their rules, and winning conditions. Later we will apply results
about these more general games to games defined by game automata. We now
begin introducing a terminology for these more general games.
What is an arena? The games we are interested in occur in arenas. Each
game will have two players. In order to play the game players make moves. Each
move consists of choosing a symbol from a finite alphabet. Therefore, we denote
this finite alphabet by MOVE. Consider the set MOVE* of all finite words over the
alphabet MOVE. Here is the definition of an arena.

Definition 5.5.1 A subset Q of MOVE* is an arena if the following conditions are


satisfied:

1. The empty word A belongs to Q.

2. If PI-L E Q and I-L E MOVE, then p E Q.

3. For every p E Q there exists a I-L E MOVE such that PI-L E Q.

We call elements of the arena positions.


282 5. Rabin Automata

Informally, an arena is the set of all configurations of the game. Thus, the
empty word A in the arena can be associated with the start of the game, which is the
empty configuration. Condition (2) says that if p {), is a configuration of the game,
then there must exist a configuration (which is p) from which the configuration
p{), can be obtained. The last condition tells us that no configuration is a terminal
configuration. In other words, the game can always be continued from any config-
uration. In order to connect this definition with games defined by game automata,
we give the following example.

Example 5.5.1 Let A be a complete game automaton, and (v, T) be a "2:,-tree.


Consider the game r (A, v). Then the set of all positions of this game is an arena.

We also note that the set of positions of any given arena Q has a natural
partial ordering. For two positions p, q E Q, we write p :'S q if p is a prefix of q.
Clearly, :'S is a partial ordering on Q.
What is the game? Consider an arena Q. This arena is an infinite set and
can be considered as a tree. A subset 'fI of Q is a path if the empty word A belongs
to 'fI and for any p E 'fI there exists a unique {), E MOVE such that p{), E 'fl. There
are two players, say Mr. (0) and Mr. (1). They move in turn by choosing a symbol
from MOVE, and thus produce a path. Let Path(Q) be the set of all paths in Q. In
the arena Q let us take a set W of paths. Then W determines a game. In the game
the goal of Mr. (0) is to always stay inside a path that belongs to W, while the
opponent always tries to not allow Mr. (0) to achieve this goal. Now we formally
define games.

Definition 5.5.2 Any game consists of an arena Q, a set W of paths in the arena,
and a fixed player. More precisely, a game is any triple

r = (Q, W, E),

where E E {O, I} and Mr. (0) and Mr. (1) are the players of this game. The set of
paths W is the set of winning plays for Mr. (E).

We give two examples. The first example shows that the games defined by
game automata satisfy the above definition. The second example shows that infinite
games that occur on finite graphs considered in the previous chapter can also be
considered as games defined above.

Example 5.5.2 An example ofa game is the game r (A, v), where A is a complete
game automaton and v is a "2:,-valuation ofT. In this game Mr. (E) is Automaton,
Mr. (1 - E) is Pathfinder, and W is the set of all plays

won by Automaton.
5.5. Terminology: Arenas, Games, and Strategies 283

Example 5.5.3 Consider the infinite game 9 = (Q, B, G, E, Q) that occurs on


the finite graph (Q, E). Fix a node q. Consider the game that begins from the node.
Then the arena of this game is the set of all histories of plays that begin from q.
Mr. (E) is the Blue player. The set of all winning W consists of all plays that begin
from q whose infinity set belongs to Q.

Exercise 5.5.1 Give a construction that for any given game automaton A, a valu-
ation v ofthe tree T such that vex) = v(y)forall x, YET, builds an infinite game
9 = (Q, B, G, E, Q) that occurs on a finite graph (Q, E) such that Automaton
wins the game rCA, v) ifand only Blue wins the game 9.

What is a play in this game? Let r = (Q, W, E) be a game. Every play


between the two players of this game occurs as follows. Mr. (E) chooses fLO E
MOVE such that fLO E Q; the opponent chooses fLl E MOVE such that the position
fLOM E Q; then Mr. (E) chooses fL2 E MOVE so that the position fLOfLlfL2 E Q;
the opponent chooses fL3 E MOVE such that the position fLOfLl fL2fL3 E Q; and so
on in turns. Note this goes forever because of the condition (3) put on the definition
of arena. Thus, the players produce a sequence r],

called a play. Each initial segment (each prefix) of this play belongs to the arena
Q. We can refer to this segment equally as either a history or position. If the play
r] belongs to W, then we say thatMr. (E) wins the play, otherwise Mr. (1- E) wins.
Note that these two players are symmetrical. This means the following. The game
r can be transformed into a new game on the arena Q such that for every play in
the new game Mr. (1 - E) wins this play if and only if in the old game Mr. (E)
loses it. To do this, in the game r we have to change Mr. (0) to Mr. (1), Mr. (1) to
Mr. (0), and W to Path(Q) \ W. In other words, we have to simply consider the
game
(Q, Path(Q) \ W, 1 - E),

in which Mr. (E) makes the first move. Recall that the elements of the arena Q are
called positions. By the definition of r, Mr. (E) moves in a position p if and only
if the length Ip I of p is even.
What are the strategies and who is the winner? In order to define who
wins a given game r we need to explain the notion of a strategy. This was partly
explained in the previous section. But here we will give a more general definition
allowing nondeterministic strategies.

Definition 5.5.3 A nondeterministic strategy for the player Mr. (8), 8 = 0, 1, in


the game r is a function f with the domain

{p E Q I p is a positionfor Mr. (8)}


284 5. Rabin Automata

such that lor each such p, the set I (p) is a nonempty subset 01 MOVE and lor
each f.1- E I(p) the position pf.1- belongs to Q. Iflor each position p olMr. (8) the
set I (p) contains exactly one element, then I is a deterministic strategy.

Let I and g be nondeterministic strategies for the players Mr. (E) and Mr. (I-
E), respectively. Assume now that the players play the game using these strategies.
By doing so they define the set Q (f, g) of all positions in the game that are
consistent with the strategies. We formally define the set Q (f, g) by stages.
Stage O. Put Qo (f, g) = {A}. Thus initially the root of the arena is consistent
with the strategies I and g.
Stage 2n + 1. Suppose that Q2n has been defined. These are all the positions
that can be obtained when Mr. (E) and Mr. (1 - E) make exactly n moves in the
game by following the strategies I and g, respectively. Then put

Q2n+! = {pf.1- Ip E Q2n(f, g), f.1- E I(p)}·

Stage 2n +2. Suppose that Q2n+! has been defined. These are all the positions
that can be obtained when Mr. (E) makes exactly n + 1 moves, and Mr. (I-E) makes
exactly n moves in the game by following the strategies I and g, respectively.
Then put
Q2n+2 = {pf.1- I p E Q2n+! (f, g), f.1- E g(p)}.
Now we can collect all the positions obtained when players follow the strate-
gies I and g. Formally, we define
Q(f, g) = UQn(f, g).
n

It is not hard to see that Q (f, g) is an arena. The positions in Q (f, g) are called
positions consistent with I and g. Sometimes, we say that the positions of Q (f, g)
are positions imposed by I and g. Similarly, any path belonging to Q (f, g) is
called a path consistent with I and g. Sometimes we can refer to this path as a
path imposed by I and g. Here is a simple note about Q(f, g).
Lemma 5.5.1 The set Q (f, g) is an arena. Moreover, if a strategy /J refines the
strategy I, that is iflor all p, /J (p) c I (p), then Q (f! , g) C Q (f, g).

Proof. The proof is left to the reader. 0


Exercise 5.5.2 Check the correctness 01 the lemma above.
Fix a strategy I for one of the players in the game r. Suppose now that g is
the vacuous strategy for the opponent, that is g (p) is the set of all successors of p
in the arena Q. Then the set of all positions consistent with these two strategies is
denoted by Cons(f) and is called the arena consistent with I. Each path (play) 17
in the arena Cons(f) is, by definition, a play consistent with I. We may also say
that 17 is imposed by I. Here now is the definition of the winner of the game r.
5.5. Terminology: Arenas, Games, and Strategies 285

Definition 5.5.4 Let r = (A, W, E) be a game.

1. The strategy f is winningfor player Mr. (E) if every play consistent with f
belongs to W. If Mr. (E) possesses a winning strategy, then player Mr. (E)
wins the game.
2. The strategy g is winningfor player Mr. (1 - E) if every play consistent with
g does not belong to W. IfMr. (1 - E) possesses a winning strategy, then
player Mr. (1 - E) wins the game.

In general, given a game r, we cannot always conclude that one of the


players of the game wins the game. In fact there are examples of games in which
no player wins. We, however, do not discuss the question in which games there
are winners. This is a special topic related to foundations of mathematics. But we
give the following definition in order to single out those games in which one of the
players wins.

Definition 5.5.5 We say that the game r is determined if one of the players has
a winning (nondeterministic) strategy.

In relation with this definition, we would like to give the following important
comment. Let A be a game automaton. Let (v, T) be a I:-valued tree. Consider the
game rev, A). By the definition of acceptance, A accepts (v, T) if Automaton wins
the game. Thus, if A accepts (v, T), then the game rcA, v) is determined. Our goal
will be to show that the game rCA, v) is always determined. In other words, we
will show that if A does not accept (v, T) then Pathfinder has a winning strategy
in the game rcA, v).
Now assume that r is a game. Let f and g be strategies. Consider the arena
Q (f, g) of all positions consistent with both f and g. We say that f wins against
g if any play in Q (f, g) belongs to W. Clearly, the condition f wins against g
does not imply that f is a winning strategy for Mr. (E). The condition simply states
that if Mr. (E) follows f and Mr. (1 - E) follows g, then Mr. (E) wins every play
(which is clearly consistent with f and g).
What are the residue games? Later we will often deal with the following
situation. We consider a game r and a position p of the game. We will then need
to analyse subgames of r that occur after the position p. To do this we need to
have a uniform approach that helps us to analyse sub games of r that occur after
position p.
Let C be a subset of an arena Q. Take p E Q. Define the set C p as

C p = {q I pq E C}.

One can assume that the set C p is the residue of C after the position p. Note that
the set C can in particular be the arena Q. Hence, in this case, Q p is the set of all
q E MOVE* such that pq E Q. A simple lemma is the following.
286 5. Rabin Automata

Lemma 5.5.2 For the arena Q and the position p E Q, the set Q p is also an
arena.

Proof. Indeed, the root)... belongs to Q p since p)... = p E Q. Suppose that


q E Q p . Then for some J1, E MOVE, pqJ1, E Q. Hence qJ1, E Q p for the same
J1, E MOVE. Let q E Q p . Let qI be a prefix of q. Then pqI is a prefix of pq. We
conclude that pqI E Q. Hence qI E Q p . This proves the lemma.
Let E be an equivalence relation on the arena Q. We can naturally define, for
a given p E Q, the relation

Ep = {(q, r) 1 (pq, pr) E E}.

Thus the relation Ep can be thought as a residue of Eon Q p . The next simple
lemma is the following.

Lemma 5.5.3 Let E be an equivalence relation on the arena Q. Then the relation
Ep is an equivalence relation on the arena Q p.

Proof. Indeed, (q, q) E E p for all q E Q p since (pq, pq) E E. Now if


(qI, q2) E Ep, then (pqI, pq2) E E. Then (q2, qI) E Ep since (pq2, pqI) E E.
The transitivity of Ep is proved in a similar way. The lemma is proved.
Let J be a function such that the domain Dom(f) of J is a subset of the arena
Q. For apE Q, we can define a new function Jp as a function with the domain

{q 1 pq E Dom(f)}

by setting
Jp(q) = J(pq)
for all q E Q p . Thus, for example, if J is a strategy, then Jp can be considered as
a strategy in subgames that occur after p.
Let W be a set of paths. For apE Q, we also define the set

Wp = {1]p 11] E W}.

Note that if 1] is a path in Q, then, from the definition of 1]p, we see that 1]p is a
path in Q p. Hence we conclude that Wp is a set of paths in the arena Q p'
Let r = (Q, W, €) be a game. Finally, for apE Q, we now define the game
denoted by r p as follows:

1. r p is the game (Q p , Wp , €) if p is a position for Mr. (€).


2. r pis (Q p , Path(Qp) \ Wp , 1 - €) if p is a position of Mr. (l - E). Note that
in this game the first move belongs to Mr. (1 - E).

Clearly, if p = ).. the r p coincides with r. We now give the following definition.
5.6. The Notion of Rank 287

Definition 5.5.6 The game rp defined above is the residue game of r after the
position p.

Consider a residue game r p' Let 17 be a path in the area of the game. Then
P17 is a path in the original game r. Note also 17 E Wp if and only if P17 E W.
Hence a player wins the play 17 in the game r p if and only if the same player wins
the play P17 in the game r.

5.6 The Notion of Rank


The notion of rank introduced in this section will play an important role in proving
that games defined by game automata are determined. Therefore, we will try to
present this notion in detail with some informal explanation and comments.
Let r = (Q, W, E) be a game. Consider a set CeQ. Fix 8 E {O, I}.
Suppose that F(K) is a strategy for Mr. (K), K E {O, I}. Suppose that P is a position
of Mr. (8). It can be the case that Mr. (8) wants to land in C following the strategy
F(8) after 0 or a finite number of moves from the position p. Of course, if p is
already in C, then Mr. (8) is lucky. He has already landed in C. But if the position
is not in C, then the opponent of Mr. (8), following the strategy F(1-8), may well
force Mr. (8) to keep out of C. We note that this resembles the situation for infinite
games played on finite graphs (considered in the previous chapter) where one of
the players wants to reach a certain set R in the graph during the game.
Our goal is to find out when Mr. (8) is able to land in C from the position
p no matter what the opponent does using the strategy F(I-8). This is formalized
in the notion of rank. An informal explanation of rank is the following. The rank
is a function that assigns a number to a position of the arena. If the rank function
assigns the number n to a position q, then this will mean that Mr. (8) is able to land
in the set C in at most n number of moves from q. If the rank of q is not defined,
then the opponent is able to keep Mr. (8) out of C forever. In other words, if the
rank of q is undefined, then the opponent is able force Mr. (8) not to land in C
from the position q no matter what Mr. (8) does using the strategy F(8).
In order to define the rank function, we consider the sequence
8,C R8,C R8,c
Ro ' 1 ' 2 , ...

defined below. Informally, Rg,c is the set of all positions which are already in C,
Rf'c is the set of all positions from which Mr. (8) lands in C in one or 0 moves, etc.

Definition 5.6.1 We define the set R~'c by induction on n. Set

Suppose that the sets Ro'8C 8C


, ... , Rn' have a1ready been defined. T,
hen Rn+l
8C
is
defined by cases as follows.
288 5. Rabin Automata

Case 1. Theposition p is a position ofMr. (8) and p belongs to no R?'c, where


i = 0, ... , n. In this case, the position p is in R~:;l if there exists a fL E F(8) (p)
such that the position PfL belongs to Rg'c U ... U R~'c.

Case 2. The position p is a position ofthe opponent and p belongs to no R?'c,


where i = 0, ... , n. In this case, the position p is in R~:;l iffor all fL E F(l-8) (p)
the position PIL belongs to Rg'c U··· U R~'c.

We give an intuition behind the definition above. In Case 1, if p E R~:;l'


then Mr. (8) can move to a position PfL and then can force the play to visit C in
at most n moves. In Case 2, if p E R~:;i' then all moves of Mr. (1 - 8) lead to
positions PfL from which Mr. (8) can force the play to visit C in at most n moves.
Note that the sequence Rg'c, R8 ,c, ... depends not only on 8, C, and n but
also on strategies F(O) and F(l). Therefore, if we want to explicitly mention the
use of F(O) and F(l), then we write R?,C,F(O),F(I). We now are ready to define the
rank function denoted by r.

Definition 5.6.2 For each pEn, we set rep) to be the number n such that
p E R~'c and p ~ Rg'c U··· U R~~l' Ifno such n exists, we set rep) undefined.

Thus, the domain Dom(r) of the rank function is the set

Clearly, r depends on the strategies F(O), F(l), the set C, arena n, and the player
Mr. (8). Here is the lemma that describes some essential properties of the rank
function r.

Lemma 5.6.1 For the rankfunction r defined above the following properties hold:

1. For all p E C, rep) = O.

2. For a p on which Mr. (8) makes a move, rep) = n + 1 if and only if not
r(p) :s n and there exists a fL E F(8) (p) such that rep fL) :s n.
3. For a p on which Mr. (1 - 8) makes a move, r(p) = n + 1 if and only if not
r(p) :s nand for all fL E F(l-8) (p) we have rep fL) :s n.

Proof. We prove this lemma by induction on n. It is clear that rep) = 0


if and only if p E C. Suppose the lemma is true for all positions p for which
rep) :s n. Now take a position p. Then rep) = n + 1 if and only if p E R~:;l
and p ~ Rg'c U ... U R~~l U R~'c. Now use the induction and the definition of
R~:;l to finish the proof of the lemma. We leave it to the reader to finish the proof
in detail. 0
5.6. The Notion of Rank 289

Exercise 5.6.1 Finish the proof of the lemma above.

We now give a basic technical notation. The notation simply gives a more
appropriate name to the function r defined above.

Definition 5.6.3 The function r defined above is called

(F(O), F(1), r, C, 8)-rank.


Let p be a position of the arena Q of a game r. The next lemma shows the
relationship between the functions r, r p , sets C, C p , R;'o, and R;P'o

Lemma 5.6.2 If the function r is the (F(O) , F(1), r, C, 8)-rank, then the function
rp IS. the (Fp(0) ,Fp(1) ,r p, C p, 8)-rank.

Proof. By the definition of r, the sequence


o,c RO,c RO,c
Ro ' 1 ' 2 , ...
defines the function r. It suffices to show that the sequence
RO,cp RO,c p RO,c p
o ' 1 ' 2

defines rp. In other words, we have to show that rp is the same as the (F~O), F~l),
r p, C p' 8)-rank. Letr P be the (F~O), F~l), r p, C p, 8)-rank. We need to prove that
the function r p equals the function r P • We prove this by induction on (F~O), F~l),
r p' C p' 8)-rank of positions in Q p. Thus, q E R~'CP if and only if rP(q) = 0 if
and only if q E Cpo In turn q E C p if and only if pq E C. Thus, r(pq) = 0 if
and only if rp(q) = O. Therefore, rP(q) = 0 if and only if rp(q) = O. It follows
that the basic step of the induction hypothesis holds. Suppose now, by inductive
hypothesis, that for all positions q E Q p the following are equivalent:
1. rP(q) S n.

2. rp(q) S n.
3. r(pq) S n.

4. q E
o,c p
R o'" U U RO,c
n'
p

5. pq E R~'c U .. · U R~'c.
Suppose that q E R!~r and not rp(q) S n. There are two cases. The first case
is that q is the position of Mr. (8). Then pq is a position of Mr. (8). Then there
exists a /-L E F~o\q) such that q/-L E LO,c p U··· U R~'Cp. Hence rP(q/-L) S n.1t
follows by the induction hypothesis that rp(q/-L) = r(pq/-L) S n. Hence pq/-L E
290 5. Rabin Automata

R!:;!. Therefore, rp(q) = r(pq) = n + 1. Consider the second case when q is a


position of the opponent. Then pq is also a position of the opponent. Hence for all
JL E F~!-o) (q) we have q JL E LO,c p U ... U R~'Cp. Hence for all such JL we have
rp(qJL) ::s n and by the induction hypothesis rp(q/-i) = r(pqJL) ::s n. It follows
that pq JL E R!f!. Therefore, r p (q) = r(pq) = n + 1. The lemma is proved.
Exercise 5.6.2 Let Q be an arena. Show that if A ~ B ~ Q, then for all p E Q
the following inequality holds:

(F(O), F(l), r, B, 8) - rank(p) ::s (F(O), F(l), r, A, 8) - rank(p).

5.7 Open Games


Open games are, in some respect, the simplest games played on arenas. We will
prove some basic facts about open games. Our main result in this section is a proof
that every open game is determined. In other words, we will show that in any
open game one of the players possesses a winning strategy. In our proof we use the
notion of rank. Though the proof of determinacy for open games is simple, a careful
analysis of the proof will lead us to some important notions, such as congruence
relations and strategies respecting congruence relations. These notions will be
important in proving the complementation problem for Rabin automata.
Let Q be an arena. Consider a set CeQ. Suppose that the winning set for
Mr. (E) is the set of all paths that meet the set C. In other words, define W (C) to be

W(C) = {1JI1J n C =1= 0}.

Definition 5.7.1 The game r = (Q, W(C), E) is called an open game.

For the reader familiar with topology we note the following. On the set of all
paths in Q the collection of sets of type W (C) form the base of a certain natural
topology. In this topology these sets are open sets. Hence the term open game is
used.
In the open game r = (Q, W(C), E) the goal of Mr. (E) is to reach the set
C, while the goal of the opponent is to keep out of the set C. It is not hard to show
that every open game is determined. In other words, in every open game one of
the players has a winning strategy. Here now is the determinacy theorem for open
games.

Theorem 5.7.1 (The Determinacy Theorem for Open Games) Let r = (Q,
W (C), E) be an open game. Then one of the players has a winning strategy to
win the game.

Proof. The proof is essentially based on the notion of rank introduced in the
previous section. Suppose that F(O) and F(l) are vacuous strategies. In other words,
F(8)(p) = {/-i I PJL E Q}, 8 = 0,1. Consider the rank function (F(O), F(l), r, C,
5.7. Open Games 291

E)-rank. Denote it by r. An informal explanation of why the game is determined


is as follows. We have two cases. In the first case, the rank of the root of the arena
is defined and, say, equals n. Then the moves of Mr. (E) will consist of decreasing
the ranks of the positions. One may want to call this as reducing the rank strategy.
Doing this, Mr. (E) eventually reaches the set C (in at most n moves). Hence
Mr. (E) wins. In the second case the rank of the root is not defined. So the goal of
Mr. (1 - E) will always be to avoid those moves that put the player into positions
for which the rank is defined. One may want to call this avoiding the set C strategy.
Doing this Mr. (1 - E) will always be able to keep out of C. Here now is a formal
proof.
Case 1. Suppose that the rank function r is defined on the root A of the arena.
Then the strategy f for Mr. (E) is defined as follows. Let p be a position of Mr. (E).
Then if r(p), the rank of the position p, is defined and equals n, 1 ::; n, then

f(p) = {J.L I the rank of pJ.L is less or equal to n - I}.

If r(p) is not defined, then

f(p) = {J.L I pJ.L E Q}.

Now this strategy is a winning strategy for Mr. (E). Indeed, suppose that rep), rank
of the root A, is defined and equals n. Then any play consistent with the strategy
f must meet the set C in at most n moves. This can easily be shown using an
induction on n (see the exercise after the theorem).
Case 2. Suppose that the rank function is not defined on the root A of the
arena. Then the strategy g for Mr. (1 - E) is defined as follows. Let p be a position
of Mr. (l - E). Ifthe rep), the rank of the position p is undefined, then

g(p) = {J.L I the rank of pJ.L, r(pJ.L), is undefined}.


If rep) is defined, then
g(p) = {J.L I pJ.L E Q}.

Now this strategy is a winning strategy for Mr. (1 - E). Indeed, suppose that the
rCA), the rank of the root A, is undefined. Then any play consistent with the strategy
g will never meet the set C in all possible moves by Mr. (E). We leave this easy
part of the proof to the reader as well (see the exercise below). We leave the details
of the rest of the proof to the reader. 0

Exercise 5.7.1 Give a detailed proof of the theorem above by using induction in
the definition of the rank function.

Exercise 5.7.2 Consider the open game r = (Q, W(C), E). Let p and q be posi-
tions of the same player such that Q p = Q q and C p = Cq . Show the following:
292 5. Rabin Automata

1. Mr. (8), 8 E {a, I}, wins the game r(p) = (Q p , W(C p ), E) if and only if
Mr. (8) wins the residue game r(q) = (Q q , W(Cq ), E).

2. Let f be the winning strategy in the game r defined in the open game
determinacy theorem for Mr. (8). Show that fp is a winning strategy for
Mr. (8) in game r(p) if and only if fq is a winning strategy for Mr. (8) in
game r(q).

Exercise 5.7.3 Let C be a subset of the arena Q. Fix a natural positive number n.
Define the following set Wn (C) of winning conditions for Mr. (E):

Wn(C) = {17 117 E Path(Q) and 17 has at least n elements from C}

Prove that one of the players wins the game (Q, Wn(C), E).

5.8 Congruence Relations


In this section we introduce several notions. We base the notions introduced in
this section on a careful analysis of the open games and the winning strategies for
the open games. An important concept will be the notion of congruence relation.
Informally, a congruence relation in a game "identifies" all those positions in the
game whose residue games coincide. For example, if p and q are positions of the
same player in the arena Q such that Q p = Qq, and W p = Wq , then the games r p
and r q are the same. Hence it makes sense to "identify" the positions p and q.
Consider the open game (Q, W(C), E) defined in the previous section. Let
p and q be positions of the same player. We say that these positions are equivalent
if Q p = Q q and C p = C q • Now note that this relation is indeed an equivalence
relation between the nodes of the game r. Moreover, we can say even more. If p
is equivalent to q, then the following property holds. For all r, if pr E Q, then
qr E Q, Q pr = Qqr, and Cpr = Cqr ; so pr is equivalent to qr. This observation
suggests the following definition.

Definition 5.8.1 Let E be an equivalence relation on Q. The equivalence relation


E is right invariant ifforall p, q from Q and r E MOVE*, the condition (p, q) E
E and pr E Q implies that qr E Q and (pr, qr) E E.

Here is a simple lemma about the right invariant equivalence relations.

Lemma 5.8.1 If E is a right invariant equivalence relation on Q and (p, q) E E,


then Ep = Eq.

Proof. Let (p, q) E E. We need to show that E p = Eq . Suppose that


(r, s) E Ep. Hence by the definition of Ep, the pair (pr, ps) belongs to E. Since
(p, q) E E and E is right invariant, (pr, qr) belongs to E. Similarly, the pair
(ps, qs) belongs to E. Now since (pr, ps) E E, then by transitivity (qr, qs) is in
E. It follows that (r, s) E E q . This proves the lemma.
5.8. Congruence Relations 293

We will need a stronger notion than the notion of right invariant equivalence
relation. Below is the desired one.
Definition 5.8.2 A right invariant equivalence relation E on the arena Q of the
game r is a congruence relation if for all p, q E Q, the condition (p, q) E E
implies that r p = r q' For (p, q) E E we say that p and q are congruent.

Note that for a congruence relation E, if positions p and q are congruent,


then p and q are positions of the same player.
Exercise 5.8.1 Give an example of a right equivalence relation E which is not a
congruence relation but for which the condition (p, q) E E implies that p and q
are positions of the same player.

An example of a congruence relation can be given from the open games.


Indeed, consider an open game r = (Q, W(C), E).

Definition 5.8.3 Define the following equivalence relation E in the open game
r = (Q, W (C), E). A pair (p, q) E E if and only if the following conditions are
satisfied:
1. p and q are positions of the same player.

2. Q p = Qq, andC p = Cq.


3. There is a prefix p' of p which belongs to C if and only if there is a prefix q'
of q which belongs to C.
The next proposition shows that E is a congruence relation in the open game
(Q, W(C), E).

Proposition 5.8.1 In the open game r = (Q, W(C), E) the equivalence relation
E defined above is a congruence relation of the game.

Proof. We already noted that E is a right invariant equivalence relation. We


only need to show that r p = r q' Indeed, first note that Q p = Qq. Now there are
two cases.
Case 1. There is a prefix p' of p that belongs to C; then the set W (C) p is
the set of all paths through Q p . In this case q has a prefix q' which belongs to C,
hence the set W (C)q is the set of all paths through Qq. Note that Q p = Qq. Hence
we conclude that W(C)p = W(C)q.
Case 2. No prefix of p belongs to C. Then W(C)p is the set of all paths
through Q p which meet the set C p. Since p and q are equivalent, q has no prefix
belonging to C. Since C p = Cq and Q p = Q q we see that W(C)p = W(C)q'
This proves the proposition.
Let r be an open game. Consider the congruence relation E for the game
defined in the definition above. In the proof of the determinacy theorem for open
294 5. Rabin Automata

games, we constructed the winning strategies based on the notion of rank. It turns
out that there is a deep relationship between these strategies and the congruence
relations E defined for the open games. We describe this relationship in the next
proposition.

Theorem 5.8.1 Let r = (Q, W (C), E) be an open game. Consider the congruence
relation E (see Definition 5.8.3). Then the winner of the open game r has a
winning strategy h with the following property. For all (p, q), if (p, q) E E,
then h(p) = h(q).

Proof. Suppose that Mr. (8) wins the game. Consider the winning strategy
h defined in The Open Game Determinacy Theorem (see Theorem 5.7.1). Now
suppose that (p, q) E E. Then Q p = Q q and C p = Cq . There are two cases to
consider. The first case is when Mr. (E) wins. The second case is when Mr. (1 - E)
wins. We consider the first case only and leave the proof of the second case to the
reader (see the exercise just after the proof). So, suppose that Mr. (E) wins. Then
the strategy h is defined as follows. Assume that p is a position of Mr. (E) and the
(F(O), F(1), r, C, E)-rank of p equals n, where n :::: 1, and F(O), F(1) are vacuous
strategies. Then

h(p) = {fL I the rank of PfL is less or equal to n - I}.

Since (p, q) E E, it must be the case that C p = Cq , Q p = Qq. Therefore, the


(F(O), F(1), r, C, E)-rank of the position q equals n. Again, by the definition of
h, we have

h(q) = {fL I the rank of qfL is less or equal to n - I}.

Since C~ = Cq and Q p = Qq, we conclude that h(p) = h(q). Now assume that
the (F(O , F(l), r, C, E)-rank of position p is not defined. Then

h(p) = {fL I PfL E Q}.

Again, since (p, q) E E, it follows that C p = Cq , Q p = Qq. Therefore, the


(F(O) , F(1) , r, C, E)-rank of of the position q is also undefined. Again this implies
that h (q) is undefined. The remaining part of the proof is left to the reader. 0

Exercise 5.8.2 Finish the proof of the proposition above by considering the case
when Mr. (1 - E) wins.

Exercise 5.8.3 Consider the game r = (Q, Wn(C), E) introduced in Exercise 5.7.3.
Say that p, q are E-equivalent ifQ p = Qq, C p = C q , p and q are positions of
the same player, and for all k :::: n - 1, the node p has exactly k prefixes that are
in C if and only if q has exactly k prefixes that are in C, where k :::: n - 1. Show
the following:
5.9. Sewing Theorem 295

1. E is a congruence relation.

2. The winner has a winning strategy h such that h(p) = h(q) for all (p, q)
E E.

5.9 Sewing Theorem


In the previous section, we introduced congruence relations. These are the equiv-
alence relations on games that identify those positions whose residue games co-
incide. Theorem 5.8.1 showed us an important feature of some winning strategies
for open games. These strategies behave in the same manner in the residue games
that coincide. Based on these considerations we give the following definition.

Definition 5.9.1 Let r = (n, w, E) be a game. Let E be a congruence relation


of the game. We say that a strategy f respects the congruence relation E iffor all
p, q E n the conditions (p, q) E E and p, q E Dom(f) imply that f (p) = f (g).

By the last theorem of the previous section, we see that in every open game
the winner possesses a strategy which respects a naturally defined congruence
relation. Indeed, consider the next example.

Example 5.9.1 Let E be the equivalence relation defined in Definition 5.8.3 for
the open game r(n, Wee), E). By Theorem 5.8.1, there exists a winning strategy
that respects the congruence relation E.

The next proposition shows one of the important properties of strategies re-
specting the congruence relation E in any given game r. The proposition basically
tells us that if one of the players wins the residue game r p, then the same player
wins all the residue games r q as long as q is congruent to p.

Proposition 5.9.1 Let f and g be strategies for Mr. (E) and Mr. (1 - E), respec-
tively, in the game r. Let E be a congruence relation. Assume that f and g respect
the congruence relation E. Then for all (p, q) E E, if fp wins against gp in the
game r p, then fq wins against gq in the game r q.

Proof. Note that np = nq and Wp = Wq since E is a congruence relation.


Let r be a position of Mr. (E) in the game r p' Then r is a position of Mr. (E) in
the game r q. Note that (pr, qr) E E. Hence f(pr) = f(qr). Hence we conclude
that fp (r) is the same as fq (r). If r' is a position, Mr. (1 - E) in the game r p then,
similarly, we see that gp(r') = gq(r'). Therefore, fp = fq and gp = gq. Let T/ be
a play in r p consistent with fp and gpo Since fp wins against gp, the play T/ must
r
belong to Wp. Since fp = fq, gp = gq, and r p = q , we see that T/ belongs to
Wq and is consistent with fq and gq. We have proved the proposition.
The main theorem of this section is formulated below. Roughly, the statement
of the theorem can be explained as follows. Suppose that Mr. (E) wins against
296 5. Rabin Automata

Mr. (1 - E) in the residue game r p by using a winning strategy in the game r p


so that the strategy respects a congruence relation. Let us collect all such positions
p and denote this set by D. Then the theorem states that Mr. (E) has a strategy
f such that for any p E D, the strategy fp is a winning strategy in r p, and
importantly, f respects the congruence relation. In other words, Mr. (E) wins the
opponent uniformly on the set D. So informally, the strategy f "sews" the winning
strategies of the games r p' p E D, so that fp is still a winning strategy.
Before we state the theorem we introduce and recall some notions. If r is a
game and p is a position in the game, then a r p.strategy is simply any strategy of
the residue game r p. We also recall that a strategy f' refines a strategy f if for all
p we have J'(p) C f(p). Also, we say that r is a position in a game r imposed
by strategies f and g if r belongs to a path consistent with f and g. Here is the
theorem.

Theorem 5.9.1 (Sewing Theorem) Let r = (Q, W, E) be a game. Let E be a


congruence relation of the game and let 8 = 1 - E. Suppose that p(O), p(l) are
strategies for Mr. (0) and Mr. (1) respecting E. Consider the set D = {p I Mr. (E)
has a r p-strategy refining F~E), respecting E p, and winning against F~o)}. Then
there exists a r -strategy H for Mr. (E) such that the following properties hold:
1. H refines FE.

2. H respects E.

3. For all p E Dom(F(O) , F(l), r, D, E) - rank, Hp wins against p~o).

Proof. We first give an informal explanation of the proof and show the ob-
stacles that may arise. If p is not in D, then Mr. (E) cannot force the play after
p to visit D using a strategy that refines FE. Otherwise, Mr. (E) would be able
to visit D from p, and after reaching D, say at position q, Mr. (E) would follow
the winning rq-strategy. Thus, Mr. (E) does not care about positions outside of
D and hence can use the strategy FE) outside of D. This guarantees that Mr. (E)
respects the congruence relation E outside of D. So we need to define H in such a
way that if p, qED, then H "sews" the winning r p and r q-strategies. "Sewing"
these two strategies without respecting the congruence relation E is quite easy.
n
For example, if Q p Q q = 0, then H follows the winning r p-strategy when the
player is in Q p and H follows the winning rq-strategy when the player is in Qq.
If p belongs to the play imposed by the winning r q -strategy, then H can always
follow the r q-strategy after p. If p belongs to no play imposed by the winning
r q-strategy, then H plays the winning r p-strategy after p. The "sewing" problem
becomes harder if we want to "sew" infinitely many winning r p strategies for
p E D. Indeed, it might be the case that the positions PI, P2, P3, ... are in D and
each Pi+1 is a position imposed by the winning r pj-strategy. If Mr. (E) follows
the winning r pj -strategy after Pi is reached, then it may be the case that the path
determined by the sequence PO, PI, P2, ... is not in W. So there are two problems.
5.9. Sewing Theorem 297

One problem is related to "sewing" all the winning r p-strategies for all p E D.
The second problem is related to making H respect the congruence relation E. We
now present a formal proof wherein we overcome these problems.
We order the alphabet MOVE linearly, fix this order and denote it by ::So
We extend it to a linear order (also denoted by ::s) on the set MOVE* as follows.
If the length Ip I of p is strictly less than the length Iq I of q, then p ::s q. If
Ipi = Iql, p = J-LO··· J-Li-lJ-Li .. , J-Ln and q = J-LO··· J-Li-lJ-L; ... J-L~, and J-Li ::s J-L;,
then p ::s q. 6
Now we consider the rank function (F(O), F(l), r, D, E)-rank. Let us denote
this function by r.

Claim 5.9.1 For all p, q If(p, q) E E, then rp = rq.

We give our proof of the claim. Since Qp = Qq, it suffices to prove that
Dp = Dq. Let r E Dp. It follows that pr E D. Let G be a r pr-strategy for Mr. (E)
refining F~~), respecting E pr, and winning against F~~). Since E is a congruence
relation, the following equalities hold:

Since FE and F(8) respect the congruence E and (pr, qr) E E we have the fol-
lowing equalities:
F(E) = F(E) F(8) = F(8)
pr qr' pr qr .
We conclude that the strategy G of the game r pr can be thought of as a strategy
in the game r qr. Since r pr = r qr, Mr. (E) wins the game r qr using the strategy
G. Therefore, q rED, so r E Dq. Hence, D p C Dq. Similarly, one can show that
Dq C Dp. This proves the claim.
We now need some notation. For each p from the set D we set GP to be a
strategy in the game r P which refines F~E), respects E P' and wins against F~8).
We now define the strategy H which will satisfy the theorem. Let p be a
position on which Mr. (E) moves. We consider two cases.
Case 1. Suppose that p does not belong to Dom(r). In this case, we set

H(p) = F(E)(p).

Case 2. Suppose that p belongs to Dom(r). It follows that r(p) is defined. If


rep) > 0, we set

H(p) = {J-L E MOVE I J-L E F(E)(p) and r(pJ-L) < rep)}.

If rep) = 0, that is if p E D, then we take the minimal q in D with respect to


the ordering ::s such that there exists an r E Q q with the following property. The

6Thus. the ordering::: just introduced is isomorphic to the usual ordering of the natural numbers.
298 5. Rabin Automata

element r is a position in the game r q imposed by C q and FJ8) , and (p, q r) E E.


Now set

We need to show that the function H is weII defined, that is single-valued. Here is
the needed claim.

Claim 5.9.2 The strategy H is well defined.

The proof of the claim is as folIows. We only need to check the case when
r(p) = O. Note that A is the position of Mr. (€) in the game r p and (p, pA) E E.
Hence there exists a minimal q with respect to the ordering ::s such that there exists
an r E Q q with the folIo wing property. The position r is a position in the game r q
imposed by c q and FJ8) , and (p, qr) E E. Now note that since E is a congruence
relation, and C q and F(8) respect the congruence relation E q , the definition of
H (p) does not depend on the choice of the position r. This proves the claim.
We now have to show that the strategy H defined for Mr. (€) satisfies alI the
three properties stated in the theorem.
First, it is clear that the strategy H refines F(E) because in each of the cases
of the definition of H, we have H (p) ~ pE (p).
Second, we have to show that the strategy H respects the congruence E.
Suppose that (p, q) E E. We shaII show that H(p) = H(q). Suppose that p f/.
Dom(r). It follows that A f/. Dom(rp) = Dom(rq ), and hence q f/. Dom(r).
Therefore, in this case H(p) = H(q) by the definition of H. Suppose that p E
Dom(r). Then it must be the case that q E Dom(r) since r p = r q. Similarly, if
r(p) > 0, then r(q) > O. Moreover, using that E is a congruence relation and the
definition of H, we see that

H(p) = {fL I PfL E Dom(r) & fL E F~E) & r(pfL) < r(p)}
= {fL I qfL E Dom(r) & fL E FJE) & r(qfL) < r(q)} = H(q).

Suppose now that r(p) = O. Then r(q) = 0 since r p = r q. Let q' be the minimal
element in D with respect to the introduced linear order ::s such that there exists
an r' E Qql such that r' is a position in the game imposed by F~f) and C ql ,
(q'r', q) E E, and H(q) = C ql (r). We also note that since (p, q) E E, we have to
have that (q'r', p) E E. Therefore, by the definition of H, H (p) = C ql (r). Hence,
H(p) = H(q). Thus, we have proved that H respects the congruence relation E.
We will need the next claim whose proof folIows from the definitions given
previously. We will use this claim in showing that Hp wins against F~8) if p E
Dom(r).

Claim 5.9.3 Suppose that H' is a r p-strategy for Mr. (€) which refines F~E), re-
spects E p, and wins against F~8). Let fL be a move from p according to (equiva-
5.9. Sewing Theorem 299

lently, consistent with) the strategy H' or F~8). Then H~I-' is a r PI-' -strategy which
,Ii
reJ,nes F(E)
PI-" respects E PI-" d
an "
WinS against F(8)
PI-" D

Finally, we have to show that Hp wins against F~8) if p E Dom(r). By the


definition of H, the play from p which follows H must eventually reach an s such
that ps E D.

Claim 5.9.4 For all later positions pst in any play consistent with H, the position
pst belongs to D.

Here is our proof of the claim. By induction on the length of t, we prove


that for all positions pst in the play, the position pst belongs to D. If t is A, then
PSA = ps and it is given that ps E D. Assume now that pst E D. Suppose
that pst is a position for Mr. (8), and Mr. (8) chooses /1- in this position. Then by
the above claim the position pstJ-L must belong to D. Suppose now that pst is a
position for Mr. (E). Assume that Mr. (E) moves by choosing J-L. By the definition
of H, J-L is defined as follows: take the minimal q in D with respect to :S such that
there exists an r E Q q for which r is a position in the game r q imposed by C q and
FJ8), and (pst, qr) E E; then set H(pst) = Cq(r). Assume that Mr. (E) moves
by choosing a J-L E H (ps t) = C q (r). Since (ps t, q r) E E and E is congruence,
we have (pst J-L. qr J-L) E E. Note now that C;I-' is a r qrl-' -strategy for Mr. (E) that
refines FJ~~, respects Eqrl-' and wins against FJ~~. Since (pstJ-L. qrJ-L) E E, it
follows that pstJ-L E D. This proves the claim.
Now consider the play ps J-Ll J-L2J-L3 ... consistent with the strategy H. Note
that SJ-L1J-L2J-L3 ... is then consistent with Hp and F~8). We need to prove that the
plays J-L 1/1-2J-L3 ... all belong to Wp. It is sufficient to show that ps J-L 1J-L2/1-3 ...
belongs to W. We may suppose that ps is a position for Mr. (E). The case when ps
is a position of the opponent is treated similarly (see the exercise after the proof).
Note that every position
ps J-L 1 ... J-L2n
is a position of Mr. (E) and belongs to D. Therefore, by the definition of H, for the
position ps J-L 1 ... J-L2n we define the minimal qn E D with respect to :S such that
there exists an rn E Q qn for which rn is a position in the game r qn imposed by FJ:)
andFJ~),(pSJ-Ll".J-L2n.qnrn) E E,andJ-L2n+l E Cqn(rn) = H(pSJ-Ll".J-L2n).
We now will prove the following claim.

Claim 5.9.5 For qn and qn+l the/ollowing inequality holds: qn+l :S qn.
The proof of the claim follows from the fact that qn satisfies all the conditions
defining qn+l except possibly a minimality condition with respect to the order :S.
Indeed, rnJ-L2n+l J-L2n+2 is a position in the game r qn imposed by C qn and Fq~), and
300 5. Rabin Automata

We conclude that qn+l :s qn' This proves the claim.


By the claim above there exists an m such that for all n ~ m, qn = qm' Let
q = qm' Thus, Mr. (E) follows the strategy C q after the position PS!-Ll ... !-L2m
has been reached. Hence the play PS!-Ll!-L2 ... must belong to W. Thus, we have
proved that H is indeed a winning strategy. The theorem is proved. 0

Exercise 5.9.1 Consider the proof of the theorem, where the play PS!-Ll !-L2!-L3 ... is
considered (right after the proof of Cia im 5.9.4). It is assumed that ps is a position
of Mr. (E). Finish the proof of the theorem by assuming that ps is a position of
Mr. (0).

From this theorem the next corollary follows immediately. The corollary
basically states that D = Dom(r) for the set D considered in the theorem above,
and the rank function (FeD), Fe!), r, D, E)-rank.

Corollary 5.9.1 Under the assumptions of the theorem, consider the set D = {p I
Mr. (E) has a r p-strategy refining F~E), respecting E p, and winning against F~8\
Let r be the (FeD), Fe l), r, D, E)-rank. Thenfor any position consistent with FeD)
and Fe!), the following are equivalent:

1. p E D.

2. r(p) is defined.

3. r(p) =0. D

5.10 Can Mr. (E) Visit C Infinitely Often?


This section consists of two parts. In the first part we consider the games in which
an objective of Mr. (E) consists of reaching a given fixed set C infinitely often. This
resembles the definition of successful run for special automata. The second part
gives an example of a more complex game. The goal of this example is to prepare
us for the games whose determinacy will be used to prove the complementation
theorem for Rabin automata.
Let st be an arena and let C be a subset of st. Suppose that Mr. (E) wants
to fall in C, and after each time C is visited, Mr. (E) wants to visit C again. In
turn, the opponent Mr. (l - E) wants to prevent this behavior of Mr. (E). In other
words, we would like to have a game in which the plays won by Mr. (E) are those
that meet the set C infinitely often. We can formally define such games. Consider
the set
[C] = {IJ E Path(st) I IJn C is infinite}.
Thus, the set [C] contains exactly those paths through the arena st that meet the
set C infinitely many times. Hence, the games we are interested in are of the form

(st, [C], E).


5.10. Can Mr. (€) Visit C Infinitely Often? 301

One of the goals of this section is to show that such games are determined. We also
investigate whether the winning strategies of these games have special properties,
how these strategies are related to congruence relations, and how these strategies
can be found.

5.10.1 Determinacy Theorem for Games (Q, [C], E). Before we begin study-
ing games of the type (Q, [C], E), we need to show that the games of the type
(Q, [C], E) cannot be covered by our results on open games. We first note that
each open game can certainly be considered as a game of type (Q, [C], E). We
leave this as an exercise.

Exercise 5.10.1 Prove that for any open game (Q, W (C), E) there exists a set C'
such that W(C) = [C'].

Thus, this exercise tells us that the class of open games is a subclass of
the games of the type (Q, [C], E). Now we give an example of a game of the
type (Q, [C], E) which is not an open game. Indeed, let C be a path 1]. Then
[C] = {1]}. Assume that there are infinitely many positions p in 1] such that for
some f-L E MOVE, pf-L E Q but Pf-L tt 1]. Then it is easy to show that there is
no set C' such that W(C') = [C]. In other words, the game (Q, [C], E) is not an
open game.
A useful intuition behind the set [C] is that every path in [C] can be thought
as a limit of paths from W(C). More formally, let us assume that 1] E [C]. Then
there are infinitely many prefixes Po < PI < P2 < ... of 1] such that each Pi E C.
Hence any sequence of paths 1]0, 1]1, ... such that Pi E 1]i for all i can be thought
as a sequence that converges to 1]. Note that each 1]i is in W(C).

Exercise 5.10.2 A path 1] on arena Q is isolated if there exists a position P E 1]


such that 1] does not split after the position p, that is, q E 1] for all q > p. Consider
a game (Q, [C], E). Show that if any path in [C] is isolated, then the game is an
open game.

Now we prove the following simple lemma.

Lemma 5.10.1 Let 1] be a path of the arena Q, C be a subset of Q, and q be a


node in 1]. Then 1] belongs to [C] if and only if 1]q belongs to [Cq].

Proof. Suppose that 1] E [C] and q E 1]. There exists an infinite sequence
n
ro < q < qr2 < .. , in 1] C. Therefore, ri E Cq for all i. Hence 1]q E [Cq].
Suppose that 1]q E [Cq]. There exists an infinte sequence ro < rl < r2 < .. , of
n
position in 1]q such that ri E Cq for all i. It follows that qri E C 1] for all i. The
lemma is proved.
Consider the game r = (Q, [C], E). We define the following equivalence
relation E on the arena of this game.
302 5. Rabin Automata

Definition 5.10.1 A pair (p, q) of positions from Q belongs to the relation E if


and only if the following conditions are satisfied:
1. p and q are positions of the same player.

2. Q p = Qq.

3. Cp=Cq.

The next lemma shows that the relation E defined above is in fact a congru-
ence relation of the game r.
Lemma 5.10.2 The relation E is a congruence relation.

Proof. We need to show that E is a right invariant equivalence relation with


r p = r q for all (p, q) E E. It is easy to see that E is a right invariant equivalence
relation. Assume that (p, q) E E. Then clearly, Q p = Qq. By the lemma above,
for any any I'}, I'} belongs to [C p) if and only if PI'} belongs to [C). Now assume that
I'} E [Cpl. Hence PI'} is in W. Since C p = Cq, we see that Wp S; Wq. Similarly,
Wq S; Wp. This proves the lemma.
Consider the game (Q, [C), E) and the congruence relation E of this game.
We are now ready to prove the main theorem of this subsection, the determinacy
theorem for the games of the type (Q, [C], E).

Theorem 5.10.1 In the game (Q, [C), E) one of the players has a winning strategy
respecting the congruence relation E.

Proof. We first give an idea of the proof, and then present a formal proof. We
can assume that E = O. Consider the set D of all positions p from which Mr. (1)
wins the residue game r p' If the root belongs to D, then we have nothing to prove.
Otherwise, Mr. (0) is able to do the following:
1. Mr. (0) is always able to keep out of D.

2. Mr. (0) is able to force the plays to visit C. (If not then the root would belong
to D.)
Say, q is a position such that q E C, q f= A, and Mr. (0) forced the play after
the root to reach q avoiding the set D. Then, Mr. (0) is again able to visit C
after q. Otherwise, qED and this is impossible since Mr. (0) is keeping out of
D. Of course this reasoning does not show that the desired strategies respect the
congruence relation E.
Now we formalize and refine the reasoning above, and provide a formal
proof. Without loss of generality, we assume that Mr. (E) is Mr. (0). Consider the
following set D:

D = {p E Q IMr. (1) wins the residue game r p using a strategy that respects Ep}.
5.10. Can Mr. (€) Visit C Infinitely Often? 303

Let r be the (V(O), V(I), r, D, I)-rank, where V(O) and V(l) are vacuous strategies
for Mr. (0) and Mr. (1), respectively. By the corollary to the Sewing Theorem (see
Corollary 5.9.1), we see that D is the domain of the rank function r.
If the root A of the arena Q belongs to the set D, then the theorem is true as
seen from the definition of the set D.
Suppose that A does not belong to the set D. We need to show that Mr. (0) has
a winning strategy respecting the congruence relation E. Since D is the domain of
the function r and A Ii D, Mr. (0) has a strategy F such that any play consistent
with F never meets the set D. By the determinacy theorem for open games and the
fact that the winning strategies of open games respect the appropriate congruence
relation, we can assume that F respects the congruence relation E. So we suppose
that at any position P not in D, Mr. (0) always chooses a f.-L E MOVE such that
f.-L E F (p). In other words, we can assume that the position P f.-L is not in D.
Let P E Q \ D. Consider the function r(p) which is (F, V(l), r, C \ {p}, 0)-
rank.
We now claim the following.

Claim 5.10.1 For any P E Q \ D, r(p)(p) is defined and is greater than O.

Our proof of the claim is as follows. It is clear that if r(p) (p) is defined, then
r(p)(p) > O. Hence we need to show that rP(p) is defined. If r(p)(p) were not
defined, then by the determinacy theorem for open games, Mr. (1) would have a
strategy respecting E P such that any play consistent with the strategy would never
meet C p' We recall that such a play is consistent with F. But, then p would belong
to D. This is a contradiction since we assume that any play after p E Q \ D is
consistent with F. This proves the claim.
We now define the strategy H for Mr. (0) as follows. For all p E Q \ D,
we set
H(p) = {f.-L E MOVE I r(p) > r(p)(pf.-L)}.

For all p E D, we set H(p) = {f.-Llpf.-L E Q}.

Claim 5.10.2 The strategy H is a winning strategy for Mr. (0).

In order to prove the claim let Af.-LOf.-L I f.-L2 ... be a play consistent with H.
There must exist a prefix PI of this play such that PI E C. Since r(pJ} is the
(F, V(l), r, C \ {PI}, O)-rank, there must exist a prefix P2 such that PI < P2 and
P2 E C. Continuing this, we see that the play belongs to [C]. This proves the claim.

We now only need to show that H respects E. This is almost clear. Indeed,
if (p, q) E E, then C p = C q , Q p = Qq. Hence Dom(r P) = Dom(rq). Therefore,
H(p) = H(q). Thus, we have proved the theorem.

Exercise 5.10.3 Let C be a subset of an arena Q. Take an n ~ 1. Consider the set


Wn (C) that contains all paths in Q that have at least n elements from C. Consider
304 5. Rabin Automata

the game rn(C) = (n, Wn(C), E). Give an example ofa game r = (n, [C], E)
such that Mr. (E) wins all the games r n(C) = (n, Wn(C), E) but loses the game r.

Exercise 5.10.4 (Note: This exercise is for those familiar with the notion of ordi-
nals.) Let n be an arena and C be a subset ofn. Define the sequence Co, CI, ... ,
CY' ... , where y is a countable ordinal as follows.

1. Co = C.
2. Ify = YI + 1, then

Cy = {x E C Y1 I (Vo, Vi, r, C, E)-rank(x) is defined}


If y is a limit ordinal, then

K<Y

Prove the following,'

1. There exists a countable ordinal y such that Cy = Cy+l' Denote this set by
Ker(C).

2. The player Mr. (E) wins the game (n, [C], E) if and only if Mr. (E) wins the
open game (n, W(Ker(C», E).

In connection with the last exercise we note the following. In the exercise
we gave a reduction of games of the type (n, [C], E) to open games so that the
reduction preserves the winner. This should not be confused with the statement
made at the beginning of this section that states that games of the type (n, [C], E)
are, in general, not open games.
In the next sections we will deal with games for which the winning condition
sets W for Mr. (E) are more complex than those considered in the previous sections.
We will explain these games and show why they are determined. Moreover, we
shall show that winning strategies of such games have certain nice properties
in the sense that they respect some naturally defined congruence relations. The
determinacy theorem for these more complex games will play an important role in
solving the complementation problem and in providing an algorithm to decide the
emptiness problem for Rabin automata.

5.10.2 An Example of More Complex Games. In the games of the previous


subsection, the goal of Mr. (E) consisted of visiting a certain set infinitely often. In
the example considered in this section the task of Mr. (E) will be more complex.
On the one hand, Mr. (E) will try to reach a certain set infinitely often. On the other
hand, Mr. (E) will have to avoid landing infinitely often in some other sets. So the
task of Mr. (E) is harder than those considered in the previous sections. The player
5.10. Can Mr. (E) Visit C Infinitely Often? 305

has less freedom in making the moves. A winning condition W for such a game
can be the following. Suppose that C(l) and C(2) are disjoint subsets of Q. We can
consider the set W which is defined as follows:

So W contains all plays through Q which meet C(l) infinitely often and the set
C(2) finitely often. Now consider the game (Q, W, E). In this game any play won
by Mr. (€) intersects the set C(l) infinitely often and intersects C(2) finitely often.
We now give a specific example of a game. This game has the following
properties:
1. The winning condition W of this game is of the form

2. Mr. (€) wins the subgames (Q, [C(l)], €) and (Q,Path(Q) \ [C(2)], E).

3. Mr. (€) loses the whole game (Q, W, E).


Here is how we construct such a game. Let MOVE = {ILl, IL2}, Q = {ILl, IL2}*'
Consider the game

r = (Q, [C(l)] n Path(Q) \ [C(2)], €) ,


where C(l) and C(2) are defined by induction on the length of P of positions as
follows.
1. ).. E C(2), ILl E C(1), IL2 E C(2).

2. If P is a position of Mr. (1 - €) and P E C(2), then for all q > P, q rt


C(1) U C(2).
3. If P is a position of Mr. (l - €) and P E C(l), then PILI and PIL2 belong to
C(2).

4. If P is a position of Mr. (€) and P E C(2), then PILI E C(1), PM E C(2).

This game has the desired properties listed above. Mr. (€) wins the game (Q p ,
[C~l)], €) in any position P belonging to C(1). Therefore, Mr. (€) wins the game
(Q, [C(l)], €) by making the first move to set C(l) . It is also true that Mr. (€) wins
the game (Q p , Path(Qp) \ [C~2\ €) in any position P E Q of Mr. (1 - E). Thus,
Mr. (€) wins the subgames (Q, [C(1)], €) and (Q, Path(Q) \ [C(2)], E). However,
note that
[C(l)] npath(Q) \ [C(2)] = 0.

Hence we conclude that Mr. (€) loses the game r.


306 5. Rabin Automata

5.11 The Determinacy Theorem


In this section we define games known as Gurevich-Harrington games. The goal is
to show that these games are determined, and there exist winning strategies for the
winners of these games that respect certain naturally defined congruence relations.
Existence of such strategies will be used to prove the complementation theorem
for Rabin automata. This section consists of two parts. In the first part we define
Gurevich-Harrington games, the desired congruence relations, and reintroduce
the notion of last visitation record. The second part is devoted to a proof of the
determinacy theorem for Gurevich-Harrington games.

5.11.1 GH-Games and Last Visitation Record. We now generalize the last ex-
ample of the previous section by giving a formal definition of Gurevich-Harrington
games. We recall that a Boolean combination of some sets Xl, ... , Xn is obtained
by applying the union, intersection, and the complementation operations to the
sets Xl, ... , Xn finitely many times. Here is a definition of Gurevich-Harrington
games.
Definition 5.11.1 Let Q be an arena. Fix a finite number of pairwise disjoint
subsets C(l), ... , C(k) ofQ. A Gurevich-Harrington game (or GH-game), is a
triple
(Q, W, E),
where W is a Boolean combination of the sets [C(l)], ... , [C(k)].
The exercise below shows the relationship between GH-games and games
defined by game automata.
Exercise 5.11.1 Let A be a complete game automaton and (v, T) be a "5:,-valued
tree. Show that the game rCA, v) is a GH-game.
Let r = (Q, W, €) be a GH game. One of the basic notions used in the
proof of the determinacy theorem for GH-games is the notion of the last visitation
record of a position in a play. Informally, the last visitation record of a position
p tells us in what order the sets C(l), ... , C(k) have last been visited just up to
the position p. Formally, we define this notion below. For each node p E Q we
define the last visitation record, denoted by lvr, of the node with respect to the
family C(l), ... , C(k) of sets. The definition uses induction on the length of the
position p.
Definition 5.11.2 If p is the root, then
if p rt U C(i),
lvr(p) ={ ~ ifp E C(i).

Suppose p is an immediate successor of x and lvr(x) has been defined. Then

I ( ) = { Deletei (lvr(x» . i if P E c(i) for some i, 1 :s i :s k,


vr p lvr(x) otherwlse,
.
5.11. The Determinacy Theorem 307

where Deletei (lvr(x» is the word obtained from lvr(x) by deleting i.

We give an example.

Example 5.11.1 Suppose that p = ILl IL2IL2ILI IL2ILI is a position in a game such
that A, ILl, ILl IL2IL2ILI, and ILl IL2IL2ILI IL2ILI all belong to e(1), ILl IL2IL2 belongs
to e(2), and neither ILl1L2 nor ILl IL2IL2ILI IL2 belongs to C(1) U e(2). Then

1. Ivr(A) = 1,

2. Ivr(ILI) = 1,

3. Ivr(ILI IL2) = 1,

4. Ivr(ILI IL2fL2) = 12,


5. Ivr(ILI1L21L21L1) = 21,
6. Ivr(ILIMIL21L11L2) = 21, and
7. Ivr(ILI1L21L21L11L21L]) = 21.
Now on the arena Q we define an equivalence relation E as follows. The
goal will be to show that E is a congruence relation and that one of the players of
the GH-game has a winning strategy respecting the congruence relation E.

Definition 5.11.3 Let r = (Q, W, E) be a GH-game. Suppose that the positions


p and q belong to Q. Then the pair (p, q) belongs to E if and only if the following
conditions are satisfied:

1. p and q are positions of the same player.

2. Qp = Qq.

3. For all i between 1 and k, cg) = e~i).


4. lvr(p) = lvr(q).
Thus, the pair (p, q) of positions is put into E if P and q have the same last
visitation record, p, q are positions of the same player, and the residue games after
p and after q coincide. The next lemma shows that E is a congruence relation of
the game.

Lemma 5.11.1 For any GH-game r = (Q, W, E), the relation E of this game is
a congruence relation.

Proof. It is clear that E is an equivalence relation. Let (p, q) E E. Suppose


that pr E Q. Since Q p = Q q we get that qr E Q. Since for every i E {I, ... ,k},
p ' we see t h at e(i)
e q(i) = e(i) pr = e(i) . E{I, ... , k} and '1p E Path(/"'\
qr. L et I ~Gp.)
308 5. Rabin Automata

Suppose that l1p is /LI/L2/L3 .... Then for every nEW, P/LI .. . /Ln E C(i) if
and only if q/LI .. . /Ln E C(i). Therefore, we conclude that 'f/p E Wp if and only
if 'f/ p E Wq . Hence the games r p and r q are the same. Consequently, E is a
congruence relation of the game r. The lemma is proved.

5.11.2 The Restricted Memory Determinacy Theorem. We are now ready to


formulate the basic theorem of this section. The use of this theorem will then
be the main tool in solving the complementation problem for Rabin automata.
We note that during our proof of the theorem we ask the reader to check some
simple statements as exercises. The proofs of these statements usually follow (or
copy) the proofs of some similar statements proved previously, or are immediate
consequences of the definitions introduced. These are not too crucial to understand
the idea of the proof. However, checking the statements will give the reader a
satisfaction in understanding the theorem and make the proof rigorous. We advise
the reader to recall the definition of the congruence relation E for a given GH-game
r (see Definition 5.11.3).
Theorem 5.11.1 (The Restricted Memory Determinacy Theorem) In every GH-
game r = (n, W, EO) one of the players possesses a winning strategy that respects
the congruence relation E.

Proof. The idea of the proof is easy to understand. However, it contains some
details that are important and needed to be checked. Our proof basically consists
of two parts. The first part provides an informal idea of the proof. The second part
is devoted to giving a formal proof of the theorem.
Informal idea of the proof. We use induction on the number of sets C I, ... ,
Ck. If k = 1, then Theorem 5.lD.l takes care of the proof (we will check this later).
Now suppose thatk = n + 1, and that the theorem holds true for k ~ n. We assume
that EO = 0 and that the set [Cd n··· n[Cn+d is a subset of W. Consider the set
D that consists of all positions p from which Mr. (1) wins the residue game p' r
If the root is in D, then Mr. (1) is the winner of the game and hence we are done.
Otherwise, Mr. (0) does the following.

1. Mr. (0) always plays outside of the set D.

2. Mr. (0) tries to land in each Ci turn by tum any time there is a chance to do
so. If Mr. (0) is able to achieve this objective infinitely often, then Mr. (0)
wins the game, since in this case the play meets each Ci infinitely often.
(Recall that the assumption is [Cd n··· n[Cn+d ~ W.)

3. Mr. (1) will try to keep Mr. (0) out of certain Ci. (Otherwise, by the item
above, Mr. (0) wins.) If from a position p, Mr. (1) keeps Mr. (0) out of
Ci forever, then by the induction hypothesis, one of the players wins this
subgame that avoids the set Ci . More importantly, Mr. (0) must win this
5.11. The Determinacy Theorem 309

game after p against Mr. (1). Otherwise, p would be in D. But p is consistent


with the strategy of Mr. (0) that keeps out of D. This is a contradiction.

4. Hence, either Mr. (0) is able to reach each Ci infinitely often or if Mr. (1)
plays outside of certain Ci forever after a position p, then Mr. (0) must win
the game after p against Mr. (1).

A formal proof The proof follows the lines of the idea described above.
Suppose that the winning condition set W has the following form:

W = un [C(i)]8{j,i),
j l:o:i:o:k

where each 8 (i, j) is in to, I} with notation [C] 1 = [C] and [C]o = Path(n) \ [C].
We will prove the theorem by using induction on the number of sets C(1) , ... , C(k).
Basic Step of the Induction. Suppose that k = 1. Then the GH-game either
is of the form
(0., [C], E)

or is of the form
(0., Path(n) \ [C], 1 - E).

Thus, one can see that the determinacy theorem for games of the type (0., [C], E)
(see Theorem 5.10.1) takes care of the basis of the induction when k = 1.

Exercise 5.11.2 Check that the basis of the induction is indeed correct.

Induction Step. Suppose thatthe theorem holds for all GH-games (0., W, E),
where W is a Boolean combination of sets [C(i)] with 1 ::::; i < k. Hence we
concentrate our attentionona GH-game (0., W, E), where W is aBooleancombina-
tion of the sets [C(i)] with i = 1, ... , k.

Claim 5.11.1 We may assume that W contains the set

We prove the claim. If W did not contain the set [C(1)] n··· n[C(k)], then
we would consider the game

(0., Path(n) \ W, 1 - E).

This game is certainly a GH-game since the complement of W is again a Boolean


combination of [C(1)], ... , [C(k)]. Hence we could simply change the roles of
the players. The only thing we should note for the proof of the claim now is the
following fact. If there is a path 1] that belongs to both Wand [C(1)] n[C(k)], n ...
310 5. Rabin Automata

then [C(l)] n···


[C(k)] is a subset of W. Indeed suppose that 11 belongs to Wand
[C(l)] n...[C(k)]. Hence there exists a j such that

I1E n [C(i)r\(j.i).
l::::i::::k

Therefore, all 8(i, j) appearing in this combination must be equal to 1. Hence


[C(l)] n...n[C(k)] is a subset of W. The claim is proved.

We now begin our reasoning exactly as we did in the proofs of the determinacy
theorems (see Theorem 5.7.1 and Theorem 5.10.1) in the previous sections. Without
loss of generality we assume that Mr. (E) is Mr. (0). Consider the set D defined by

D = {p E n I Mr. (1) wins the residue game rp using a strategy that respects Ep}.

Letrbethe(r, yeo), v(l), r, D, I)-rank, where yeo), v(l) are vacuous strategies.
By the corollary to the Sewing Theorem (see Corollary 5.9.1), we see that D is the
domain of the rank function r. Moreover, by the Sewing Theorem there exists a
strategy CD for Mr. (1) such that

1. CD respects the congruence relation E, and

2. For all p E D the player Mr. (1), using the strategy CD, wins the residue
game r p'

If the root A of the arena Q belongs to the set D, then the theorem is proved,
since in this case Mr. (1) wins the game using a winning strategy that respects the
congruence relation E.
Suppose that Adoes not belong to the set D. We need to show that Mr. (0) has
a winning strategy respecting the congruence relation E. Since A does not belong
to the set D, Mr. (0) has a strategy F such that any play after p ~ D consistent with
F never meets the set D. In particular, any play (after A) of the game r consistent
with F never meets the set D. From the determinacy theorem for open games, and
since the winning strategies for open games respect the appropriate congruence
relations, we can assume that F respects the congruence relation E. Therefore,
we assume that at any position p, Mr. (0) always chooses a fJ., E MOVE such that
fJ., E F(p). In other words, we suppose that Mr. (0) always follows the strategy
F. Thus, the desired winning strategy H for Mr. (0) will satisfy the following
conditions. If p E D, then H(p) = {fJ., I PfJ., E Q}. If p ~ D, then H(p) C F(p).
Since we want to use the induction hypothesis, we will consider certain
subgames of the original game r. We will then apply the induction hypothesis to
the sub games and then derive the proof of the theorem. Let us take an i, 1 ::::; i ::::; k.
There exists a strategy which forces Mr. (0) to reach the set C(i). We take this
strategy to be based on the (r, F, V(l), C(i), O)-rank function denoted by r(i).
Denote the strategy by F(i). Recall that F(i) is defined as follows. For any p E D,
5.11. The Determinacy Theorem 311

F(i)(p) = {p, I pp, E Q}. For any p E Q \ D, the set F(i)(p) is F(p) if p ¢.
Dom(r(i) or r(i)(p) = O. Finally, F(i)(p) is the set {p, I pp, E F(p) & r(i)(pp,) <
r(i) (p)} if r(i) (p) > O. Note that this strategy respects the congruence relation E.

Exercise 5.11.3 Show that F(i) respects the congruence relation.

We consider the set

Note that this set is not necessarily an arena. Since E is a congruence relation we
have the following property. For all (p, q) E E, the position p belongs to Q(i) if
and only if the position q belongs to Q(i).
Consider the strategy C(i) for Mr. (1) which allows Mr. (1) to play inside of
the set Q(i) forever if the play begins from any position p E Q(i). This strategy is
defined as follows:

c(i)( ) = { {p, E MOVE I qp, E QJ ifq ¢. Q(i),


q {p, E MOVE I qp, E Q(l)} otherwise.

By the definition of C(i), we see that for all q E Q, C(i) (q) =1= 0. It is not hard
to see that the strategy C (i) respects the congruence relation E. Also note that if
p ¢. D, then C(i)(p) c Q \ D.

Exercise 5.11.4 Check that C(i) respects the congruence relation E.

For q E Q(i), let Q(i) (q) be the arena consisting of all positions imposed
by C~). We need the following lemma which will be used to apply the induction
hypothesis.

Lemma 5.11.2 Let q E Q(i) be a position of a play in r. Consider the set


Path(Q(i)(q» of all paths in Q q consistent with the strategy C~). Then any path
rJq in Path(Q~) never meets the set di), that is rJq n C~i) = 0.
We prove the lemma. Let rJq be a path in Q q consistent with C¥). Suppose
that rJ belongs to C~i) n
rJq. Hence there exists a qro E rJ such that qrO E C(i).
Since rJq is consistent with C~), the position ro is in Q q and must belong to Q~).
Hence ro ¢. C~i). It follows that q ro ¢. C(i). This is a contradiction. The lemma is
proved.
Now for any position q E Q(i) we consider the arena Q(i) (q), and define the
set W(i) (q) of paths as follows. The set W(i)(q) is the set of all paths in the arena
Q(i)(q) that belong to Wq . Thus, we consider the game r(i)(q), which is
312 5. Rabin Automata

if q is a position of Mr. (0), and

if q is a position of Mr. (1).


Our goal is to apply the induction hypothesis to the above defined games of
the type r(i)(q). But in order to apply the induction hypothesis, we need to show
that each W(i)(q) is a Boolean combination of certain sets [C], where each C is a
subset of Q(i) (q) and the number of such sets C is less than k.

Lemma 5.11.3 Assumethat).. E Q(i). Thenthegamer(i)()..) = (Q(i)()..), W(i)()..),


E) is a GH-game.

In order to prove the lemma, we need to show that W(i) ()..) can be represented
as a Boolean combination of certain sets [C], where C C Q(i)()..).
Suppose that the set W in the original game r = (Q, W, 0) has the following
form:
W = un [C(i)]'\(j,p) ,
j l:O;p:o;k

where a(j, p) E {O, I}, [C]1 = [C] and [C]o = Path(Q) \ [C].
We set
Cj = C(j) n Q(i)()..).

Note that for every path 11 in Q(i), the path 11 belongs to [Cj] if and only if 11 belongs
to [C(J)]. Consider the Boolean combination B(j)

which is a part of the Boolean combination in the definition of W.


We define the set B(}) as follows. Consider the set [C(i)l"(J,i) in the above
combination. If a (j, i) in this combination is 1, then we set

B(}) = 0.
Otherwise, we set

We need to show that W(i)()..) = Uj B(}). This would prove the lemma.
Indeed, suppose that 11 E W(i)()..). Then 11 E W, 11 E Q(i), and by the previous
lemma 11 and C(i) have empty intersection. Since 11 E W, there must exist a j such
that 11 E B(}). Consider B(j):
5.11. The Determinacy Theorem 313

It must be the case that 8(i, j) = O. Otherwise, 11 would not belong to n(i). Hence
we see that 11 belongs to
B(j) = [Cd(J,l) n··· n[Ci_d(J,i-l) n[Ci+tJ 8(J,i+l) n··· n[Cd(J,k).

Therefore, 11 E Uj B(j) .
Suppose now that 11 E U B(j). Let j be such that 11 E B(j). Then B(j) =1= 0,
8(j, i) = 0, and
11 E [CtJ 8(J,1) n··· n[Ci_d(j,i-l) n[Ci+d(j,i+l) n··· n[Cd(j,k).

Since 11 ~ [C(i)], we see that


11 E B(j) = [C(1)]8(j,1) n··· n[C(i)]o n··· n[C(k)]8(j,k).

Hence 11 E W. It follows that 11 E W(i)p,,). The lemma is proved.


Essentially the same proof shows that the next lemma is true. We leave the
proof to the reader as an exercise.
Lemma 5.11.4 For any q E n(i), the game r(i)(q) is a CH-game. D
Exercise 5.11.5 Show that the lemma above is correct.
Claim 5.11.2 For any q E n(i), one of the players of the game r(i)(q) has a
winning strategy.
In order to prove the claim, we assume that q = ).... The case q =1= )... is
treated similarly using the previous lemma. The game r(i)()...) is a GH-game. The
set W(i)()...) is a Boolean combination of sets [CtJ, ... , [Ci-l], [Ci+tJ, .. ·, [Ck]'
Hence we can apply the induction hypothesis. We have proved the claim.
The next two lemmas show that Mr. (0) must win the game r(i) ()...). We prove
the first lemma, while the second is left as an exercise since it basically follows
the proof of the first lemma.
Lemma 5.11.5 Assume that)... E n(i). Then Mr. (0) has a winning strategy H(i)
with the following properties:
1. H(i) wins the game r(i)()...), that is, any path consistent with C(i) and H(i)
belongs to W(i) ()...).
2. H(i) respects the congruence relation E.
Here is the proof of the lemma. Suppose, to the contrary, that Mr. (1) wins
the game r(i) ()...). We will show that in this case)... E D. This will be a contradiction
to the fact that)... is not in D.
Consider the equivalence relation E(i) ()...) defined on the arena n(i) ()...) as
follows. For all p, q E n(i)()...), the pair (p, q) belongs to E(i)()...) if and only if the
following conditions are satisfied:
314 5. RabinAutomata

1. p and q are positions of the same player.

2. n~)()..) = n~)o.).

3. For all ej, where j = 1, ... , i-I, i + 1, ... , k, (ej)p = (Cj)q.


4. lvr(p) = lvr(q), wherethelvristakenwithrespecttothesetsel, ... , ei-I,
CHI, ... , ek.

We note the following simple claim.

Claim 5.11.3 For all p, q E n(i), if the pair (p, q) belongs to E, then the pair
(p, q) belongs to E(i)U.).

In order to prove the claim, suppose that (p, q) E E. Then clearly p and q
are positions of the same player. Using thefactthat cg) = e~t) for all t, 1 ::'S t ::'S k,
np = n q , and that G(i) respects E, we see that n~) = n~) and (C j) p = (C j)q for
all j = 1, ... , i-I, i + 1, ... , k. Using induction on the length of p, it is not hard
to see that if lvr(p) = lvr(q) with respect to C(l), ... , C(k), then lvr(p) = lvr(q)
with respect to the sets CI, ... , Ci-I, Ci+l, ... , Ck. This proves the claim.

Exercise 5.11.6 Show that if the equality lvr(p) = lvr(q) holds with respect to
the sets C(1), ... , C(k), then the equality lvr(p) = lvr(q) also holds with respect
to CI, ... , Ci-I, Ci+I, .. ·, Ck.

Now since Mr. (1) wins the game r (i) (A), we can use the induction hypothesis
and hence assume that Mr. (1) has a winning strategy in the game r(i)(A) which
respects the equivalence relation E(i)(A). Let g be such a strategy for Mr. (1) in
the game r(i)(A). We recall that this strategy refines the strategy G(i) in the game
r(i) (A).
Now based on the strategy g, we construct a strategy G for Mr. (1) in the
whole game r with the purpose of showing that G is a winning strategy for Mr. (1)
in the whole game which respects the congruence E. Let us linearly order the set
MOVE* as we ordered this set in the proof of the Sewing Theorem (see Theo-
rem 5.9.1). Let ::'S be the order. We define the strategy G as follows. Let p be a
position of Mr. (1). We have four cases to consider.
Case 1. Suppose that p E n(i)(A). Then we set G(p) = g(p).
Case 2. Suppose that p rt n(i)(A), no q E n(i) such that (p, q) E E, and
p rt D. Then set G(p) = {fL E MOVE I PfL En}.
Case 3. Suppose that p rt n(i)(A) and there exists an s E n(i)(A) such that
(p, s) E E. We now will use the idea from the proof of the Sewing Theorem.
Take the minimal q in n(i) (with respect to the ordering ::'S) such that for some r,
qr E n(i) and (qr, p) E E. Note that such a q exists because (SA, p) E E. We
now set G(p) = g(qr).
5.11. The Determinacy Theorem 315

Case 4. Suppose that p ~ n(i)u,.) and p E D. In this case we set G(p) =


GD(p).

Claim 5.11.4 The strategy G is well defined.


Here is our proof of the claim. We note that no position in n(i) is E equivalent
to a position in D since all positions in n(i) are consistent with F. Hence Case 3
and Case 4 do not hold simultaneously. We only need to show that G does not
depend on r in Case 3 of the definition of G. We now prove G is well defined for
Case 3. Suppose that p ~ n(i) and there exists an s E n(i) such that (p, s) E E.
Take the minimal q in n(i) (with respect to the ordering s) such that for some r,
qr E n(i) and (qr, p) E E. Let r' be such that qr' E n(i) and (qr', p) E E. It
follows that (qr, qr') E E. Hence (qr, qr') E E(i). Since g respects E(i), we see
that g(qr) = g(qr'). Hence the definition of G on p does not depend on the choice
of r. This proves the claim.
Claim 5.11.5 The strategy G respects the equivalence relation E.
We prove the claim as follows. Suppose that (p, s) E E. We need to consider
the following four cases.
Case 1. Suppose that both p and s belong to n(i). Since (p, s) E E we have
(p, s) E E(i). Hence G(p) = g(p) = g(s) = G(s).

Case 2. Suppose that for all q E n(i), (p, q) ~ E, and p ~ D. Then for
all q E n(i), (q, s) ~ E, and q ~ D. Hence by the definition of G we see that
G(p) = G(s).
Case 3. Suppose that p E n(i) and s ~ n(i). Take the minimal q in n(i) (with
respect to the ordering s) such that for some r, qr E n(i) and (qr, s) E E. Note
that (p, qr) E E as well. It follows that (p, qr) E E(i). Since g respects E(i), we
see that g(qr) = g(p) = G(s). This proves the claim.
Case 4. Suppose that p E D. Then sED. Then G(p) = GD(p) = G(s).
This proves the claim.

Claim 5.11.6 The strategy G isa winning strategy/or Mr. (1) in the whole game r.
In order to prove the claim, consider any play T/ of the game consistent with
G. Note that).. belongs to n(i)()..). We have two cases to consider.
Case 1. Suppose that T/ is consistent with g. Then the play belongs to n(i)
since g refines the strategy G i for Mr. (1) which allows Mr. (1) to play always
inside of the set n(i). Hence the play does not belong to the set W(i)()..), and
therefore is not in the winning set W. Hence Mr. (1) wins the play T/.
Case 2. Suppose that T/ is not consistent with g. Let Pll- be the first position
in T/ which does not belong to n(i) ()..). Then it must be the case that p is a position
of Mr. (0), p E n(i)()..) and Il- ~ F(p). Hence Pll- E D. It follows that T/PtL does
not belong to Wpw Therefore, T/ is not in W. The claim is proved.
316 5. RabinAutomata

From the claim above, we conclude that the root)... of the arena belongs to D.
But)... did not belong to D by the assumption of the lemma. This a contradiction.
Hence we have proved the lemma (that is, Lemma 5.11.5).
Essentially the same proof shows that the next lemma is true. We leave the
proof to the reader.

Lemma 5.11.6 For any q E n(i) = n \ Dom(r(i», Mr. (0) wins the game r~i).
Moreover Mr. (0) has a winning strategy respecting Eq in n(i) (q). 0

Exercise 5.11.7 Prove the lemma above.

From the above two lemmas, using the induction hypothesis, we see that for
every q E n(i), Mr. (0) has a winning strategy H (i ,q) in the game r (i) (q) such that
the strategy respects the equivalence relation E(i)(q). Moreover, if p, s E n(i)(q),
(p, s) E E, then H(i,q)(p) = H(i,q)(s). Since W(i)(q) = Wq n Path(n(i)(q» we
see that any play inside n(i)(q) and consistent with H(i,q) must be won by Mr. (0).
We now apply the Sewing Theorem. The strategy F l-E in the assumption of
the Sewing Theorem is now C(i). Hence we conclude that there exists a strategy
H(i) for Mr. (0) with the properties expressed in the next claim.

Claim 5.11.7 Mr. (0) possesses a strategy H(i) in the game r such that the fol-
lowing properties hold:
1. H(i) respects E.

2. Let p E n(i). Then any play from p consistent with cg) and H~i) belongs
to Wp. 0

We are now ready to informally describe a winning strategy for Mr. (0). We
recall that the set

is a subset of W. We need one definition for explaining the strategy.

Definition 5.11.4 Let p be a position of Mr. (0). Let L be the Ivr of the position.
We say that i is designated, 1 ::: i :::: k, if either i is the smallest number not in L
or all numbers between 1 and k appear in Land i is the first number of L. If i is
designated, then we also say that the set C(i) and the arena n(i) are designated.

Here now is an informal explanation of the strategy. At the beginning of any


play the number 1 is designated. Mr. (0) will try to reach the current designated
number i. The lvr of the current position will tell Mr. (0) what the designated
number is. The opponent Mr. (1) will have only two choices. The first choice is to
stay inside of n(i) forever. The second choice is to leave the set n(i). When Mr. (1)
stays inside n(i), Mr. (0) follows the strategy H(i). Hence, if Mr. (1) follows the
first choice forever, then of course, Mr. (1) does not win. As soon as Mr. (1) decides
5. 11. The Determinacy Theorem 317

to leave n U), Mr. (0) reaches the designated set C(i). When the designated set CCi)
is reached, Mr. (0) picks up the next designated number i'. Thus, ifMr. (1) stays
inside of some n(i) forever, then Mr. (0) wins; if Mr. (1) leaves each designated
arena infinitely often, then Mr. (0) is able to reach every C(i) infinitely often.
Here now is a formal definition of the winning strategy H for Mr. (0). Let p
be a position of Mr. (0). Let i be the designated number. We have the following
three cases.
Case 1. Suppose that p E Dom(r(i)) and r(i) (p) > O. Then H (p) = F(i) (p).

Case 2. Suppose that p rt Dom(r(i)), then H(p) = H(i)(p).


Case 3. r(i) (p) = O. Then H (p) = F(i') (p), where i ' is the next designated
number.
We need to show that H is a winning strategy and H respects the congruence
relation E.

Claim 5.11.8 The strategy H respects the congruence relation E.

We prove the claim. Let (p, q) E E. Assume that p is a position of Mr. (0).
Then so is q. Note that lvr(p) = lvr(q). Hence Mr. (0) has the same designated
number at the positions p and q. Note that by the definition of E, the position
p belongs to Dom(r(i)) if and only if q belongs to Dom(r(i)). Moreover, if p E
Dom(r(i)), then p and q have the same (r, F, V(1), C(i), O)-rank. Thus, if p E
Dom(r(i)), then H(p) = H(q) as the first two cases of the definition of H show.
Suppose that p rt Dom(r(i)). Then q rt Dom(r(i)). Hence p, q E n(i). Since
(p, q) E E, then (p, q) E E(i). We conclude that H(i)(p) = H(i)(q). This proves
that H (p) equals H (q). We have proved the claim.

Claim 5.11.9 The strategy H is a winning strategy.

We need to prove the claim. Suppose that an 1]

f-L 1 f-L2 f-L 3 f-L4 ...

is a play consistent with H. If 1] E [C(1)] n··· n[C(k)], then Mr. (0) wins this
play. Suppose that 1] does not belong to [C(1)] n ... n[C(k)]. There must exist a
position q E 1] such that the designated number at this position is i and all positions
in 1] after q do not belong to CU). We conclude that any move of Mr. (1) at any
position of 1] after q is consistent with the strategy G¥). Otherwise, the play 1]
would have a position p after q such that p E C(i). Therefore, the play after the
position q is consistent with the strategy HJi). We now can conclude that the play
after q must belong to Wi (q). Hence 1] must belong to W. Hence H is a winning
strategy. This proves the claim.
We have proved the Restricted Memory Determinacy Theorem.
318 5. RabinAutomata

5.12 Complementation and Decidability


Oame automata and the Restricted Memory Determinacy Theorem are the basic
ingredients used to show that the complementation problem for Rabin automata
has a positive solution. In order to give our solution to the problem, we first show
that the game rCA, v) defined by a game automaton A and a ~-valued tree (v, T)
is a OR-game. Second, we reformulate a weaker version of the Restricted Mem-
ory Determinacy theorem for the game rCA, v). We call this reformulation the
Forgetful Determinacy Theorem. Finally, we present a solution to the comple-
mentation problem. In this section we will also show that the emptiness, equality,
and universality problems for Rabin automata are decidable. These decidability
results follow from The Forgetful Determinacy Theorem as well.

5.12.1 Forgetful Determinacy Theorem. Let A = (S, J, R,:F) be a game


automaton. Let (v, T) be a ~-valued tree. Consider the game rcA, v). We show
that this game can be considered as a OR-game from the previous section. To show
this we need to specify the alphabet MOVE, the arena Q, the sets C(1), ... , C(k),
the players Mr. (0) and Mr. (1), and the set W. Rere now is how we transform the
game rCA, v) into a OR-game.

1. The alphabet MOVE is {O, 1} U S.

2. The arena Q is the set of all positions in the game rcA, v).
3. Suppose that S = (tl, ... , td. Then for each i, 1 :::: i :::: k,

C(i) = {p I p is a position in rcA, v) whose last symbol is ti}.

4. The player Automaton is Mr. (0) and the player Pathfinder is Mr. (1).

5. In order to define W consider the set F. Let Q be in F. Consider the following


set of paths in the arena Q:

WQ = n nn
ljEQ
[CCi)]
ljftQ
Path(Q) \ [C(j)].

Then Automaton wins any given play

if and only if 11 belongs to some WQ. Thus, we have the following equality

We conclude that W is a Boolean combination of sets C(i), i = 1, ... , k.


5.12. Complementation and Decidability 319

Thus, we have proved the following simple lemma.

Lemma 5.12.1 Game rcA, v) is a GH-game. D


Now we would like to prove a weaker version of the restricted determinacy
theorem for the game r(A, v). Let A be a game automaton and p be a position
in the game r (A, v). We can naturally define the latest visitation record lvr(p) of
the position p with respect to C(l), ... , C(k). We also define the Node(p) to be
the sequence of symbols appearing in even positions of p. Thus, for example, if
p = sod) s) d2S2 ... , then

Node(p) = d) d2 ....
Thus, Node(p) is a node of the binary tree T.

Definition 5.12.1 Suppose that x belongs to the binary tree T, and (v, T) is a
'L,-valued tree. The x-residue of (v, T) is the pair (w, T) such that w(y) = v(xy)
for all yET.

We are now ready to formulate and prove the forgetful determinacy theo-
rem.

Theorem 5.12.1 (The Forgetful Determinacy Theorem) Let A be a game au-


tomaton, (v, T) be a 'L,-valued tree. In the game rCA, v) one of the players has a
winning strategy f with the following properties. If p and q are positions where the
winner makes moves, the Node(p)-residue of (v, T) is the same as the Node(q)-
residue of (v, T), and lvr(p) = lvr(q), then f(p) = f(q).

Proof. The game rCA, v) is a GH-game. Therefore, we can consider the


congruence relation E on the arena Q of this game. By the Restricted Memory
Determinacy Theorem (see Theorem 5.11.1), one of the players has a winning
strategy f which respects the congruence relation E. Let p and q be positions
where the winner makes moves. Suppose that lvr(p) = lvr(q). Also suppose that
the Node(p)-residue of (v, T) is the same as the Node(q)-residue of (v, T). Then
Q p = Qq, cg) = C~i), where 1 :s i :s k. Hence from the definition of E we see
that (p, q) E E. Therefore, f (p) = f (q). The theorem is proved.

5.12.2 Solution of the Complementation Problem. This subsection is devoted


to a solution of the complementation problem for Rabin automata. The proof uses
The Forgetful Determinacy Theorem (see Theorem 5.12.1). The proof also involves
our knowledge about BUchi and MUller automata. So let us fix a game automaton
A = (S, I, R, F) with the goal of constructing a game automaton that accepts the
complement of L(A).
We provide a series of lemmas in order to prove the complementation theorem
for Rabin automata. Our first lemma is the following.
320 5. Rabin Automata

Lemma 5.12.2 Let A be a game automaton, (v, T) a b-valued tree. In the game
rcA, v) one of the players has a winning strategy f with the following properties.
/fp and q are positions where the winner makes moves, Node(p) = Node(q), and
lvr(p) = lvr(q), then f(p) = f(q)·
Proof. Note that if Node(p) = Node(q) and lvr(p) = lvr(q), then the
Node(p)-residue of (v, T) is the same as the Node(q)-residue of (v, T). Hence
the strategy f from The Forgetful Determinacy Theorem (see Theorem 5.12.1)
satisfies the statement of the lemma. The lemma is proved.
Consider the game automaton A = (S, I, R, F) and a b -valued tree (v, T).
Consider the game r (A, v). We give the following definition which is an important
notion in constructing a game automaton that accepts the complement of L(A).
Definition 5.12.2 An S-display is any word over S* which has no repeated sym-
bols. We denote the set of all S-displays by D(S).

Clearly, the lvr of any position in the game rcA, v) belongs to the set D(S).
Since the set D(S) is finite, the set of all functions from D(S) into {a, I} is finite.
We now define a new alphabet:

b' = {f I f is a function from D(S) to {a, I}}.


Consider a b'-valued tree (v', T). Thus, for any node x E T the value v'(x) is a
function from the set D(S) of all displays into the set {a, I}.
There exists a natural relationship in a certain precise sense between b'-
valued trees and the games rcA, v). We will formalize this as follows. Let (v', T)
be a b'-valued tree. Any such tree yields the strategy fv' for Pathfinder in game
rCA, v) as follows. Let p be a position of Patlifinderin the game rCA, v). Consider
the last visitation record L = lvr(p) of the position p and the node Node(p) of the
tree T. Then set
fv'(p) = v'(Node(p»(L).
Thus, given v', the move of Pathfinder at position p is found as follows. First,
find the last visitation record of p. Second, consider Node(p). Third, consider the
function v'(Node(p» which maps D(S) to {a, I}. Finally, the move is the value
of the function v'(Node(p» at lvr(p). The next lemma shows that if Pathfinder
wins the game, then Pathfinder has a winning strategy of the type fv' for some
h'-valued tree (v', T).

Lemma 5.12.3 For every b -valued tree (v, T) the following statements are equiv-
alent:
1. The game automaton A does not accept (v, T).
2. There exists a b' -valued tree that yields a winning strategy for Pathfinder
in game rcA, v).
5.12. Complementation and Decidability 321

Proof. The implication from (2) to (1) is obvious. Indeed, if Pathfinder has
a winning strategy in the game r(A, v), then the automaton A does not accept
(v, T) by the definition of acceptance for game automata.
We show that (1) implies (2). Since the automaton A does not accept the
~-tree (v, T), Pathfinder has a wining strategy in the game r(A, v). Now we
use Lemma 5.12.2. By the lemma there exists a winning strategy J such that if
p and q are positions of Pathfinder, Node(p) = Node(q), and lvr(p) = lvr(q),
then J(p) = J(q). We now construct a ~'-valued tree that yields the winning
strategy J. Let x be a node on T. Consider all positions p in game r(A, v) such
that Node(p) = x. We define the function Vi (x) from the set D(S) of all displays
to the set {O, I} as follows. If L E D(S) is such that for some p, Node(p) = x, p
is a position of Pathfinder, and L = lvr(p), then the value of Vi (x) on L is J(L).
For all other L E D(S), we put the value of Vi (x) on L to be O. Since the condition
Node(p) = Node(q) = x, and lvr(p) = lvr(q) implies that J(p) = J(q), we see
that the function v'(x) is well defined. The lemma is proved.
Thus, from the lemma above, we can conclude the following. Assume that
Pathfinder wins the game r(A, v). Then there exists a 1:' -valued tree (Vi, T) that
yields the winning strategy Jv' for Pathfinder in the game (f, v). This suggests a
look at the language L' of all ~ x ~ I-valued trees (v x Vi, T) such that Jv' is a
winning strategy. Now note that, by the lemma above, (v, T) is not accepted by
A if and only if (v, T) is a ~-projection of some tree from L'. By the projection
theorem, it will suffice to prove that L' is a Rabin recognizable language. To do this
we need deeper analysis of relationship between the game automaton A, ~-trees,
~' -trees, and strategies of the type Jv"
Now for the game automaton A = (S, J, R, F), a ~-valued tree (v, T), and
a ~' -valued tree (Vi, T), we consider the following sequences:
1. a sequence So, SI, S2, ... of states of the automaton A;
2. a sequence Lo, LI, L2, .,. of S-displays;
3. a path A, dl, d2, ... of the tree T;
4. a sequence ao, aI, a2, ... of elements from the alphabet ~; and finally,
5. a sequence a~, a{, a~, ... of elements from the alphabet ~'.

We turn our interest to the following statement about all of the sequences
given above:
Lo = So, (ao, so) E J, and for alln,dn+1 = a~(Ln), (sn, dn+l, an+l, Sn+l) E
R, and Ln+1 = Delete sn+! (Ln) . Sn+l.
We recall that Deletes(L) is the operation which deletes the symbol S from the
expression L. We denote the statement above about the sequence

(so, Lo, A, ao, a~) (SI, LI, dl, aI, a{) ...
322 5. Rabin Automata

by (*). The next lemma shows how the statement (*) and the winning strategies
fv' are related to each other.

Lemma 5.12.4 For a '£-valued tree (v, T) and a '£'-valued tree (v', T) thefol-
lowing statements are equivalent:

1. The '£'-valued tree (v', T) yields a winning strategy for Pathfinder in game
rCA, v).

2. For every sequence so, S[, S2, ... of states of the automaton A, and every
sequence Lo, L[, L2, ... of S-displays, and every path A, d[, d2, ... through
the tree T, set an = v(d[ ... d n ) and a~ = v' (d[ ... dn ) for all n. Assume
now that (*) holds for the sequence

Then the set {s Is = snfor infinitely many n} is not in:F.

Proof. We begin by proving the implication from (1) to (2). Suppose that the
'£' -valued tree (v', T) yields the winning strategy f. Suppose that the hypothesis
of part (2) together with (*) holds. Now consider the sequence

Since the assumption (*) holds, the pair (ao, so) belongs to I and for all n,
(sn, dn+[, an+l, sn+[) E R. Hence the sequence

is a play in the game rCA, v). Now note the following. For all n

f(sod[s[ '" dnsn ) = v'(d[d2 ... dn)(lvr(sod[s[ ... sn))

and

Hence the play above is consistent with the strategy f. As f is a winning strategy,
the set {s Is = Sn for infinitely many n} does not belong to:F.
We now will show the implication (2) ~ (1). Suppose that the '£'-valued
tree (v', T) yields the strategy f. Let

be a play consistent with the strategy f. Let Ln be the lvr of the position sod[ s[ d2S2
... Sn. Then the assumptions for (2) show that Pathfinder wins the play. Hence f
is a winning strategy. The lemma is proved.
5.12. Complementation and Decidability 323

In the next series of lemmas we will use our knowledge about Biichi and
Miiller automata. Consider the finite alphabet

h] = S x D(S) x {O, I} x h X h'.

We claim the following fact.


Claim 5.12.1 There exists a Ruchi automaton B] such that for any infinite word

the word fX satisfies (*) if and only if the Ruchi automaton B] accepts fX.

We prove the claim. The desired Biichi automaton B] is the following. The
set of states of B] is

S x D(S) x {A, 0, I} x h X h' UrSin},

where Sin is a new symbol. The state Sin is the initial state of B]. We define the
transition table T].
1. For the initial state Sin and an input

if and only if
(a) s =S], L = L],d =d],a =a],a' =a;,
(b) (s, a) E I,
(c) L = s, d = A.
2. For state (s, L, d, a, a') and input (S], L], a], a{) from hI,

if and only if

(a) S] = S2, L] = L2, d] = d2, a] = a2, a; = a~,


(b) (s,d],a],s]) E R,L] = DeleteS1 (L)'s],d] =a'(L).

This defines the transition table T for B].

3. We define the whole state set S x D(S) x {A, 0, I} x h X h' without the
state Sin to be the set of all final states of B].
We note that since the set of final states of B] is equal to the set of states of
B], 8] accepts fX if and only if 8] has a run on fX. We leave the reader to check
that the Biichi automaton B] constructed is indeed the desired one. 0
324 5. Rabin Automata

Exercise 5.12.1 Finish the proof above by checking that BI satisfies the claim.
We need another fact.
Claim 5.12.2 Fix a state t E S. There exists a Bilchi automaton B t such thatfor all

a = (so, Lo, A, ao, a~) (SI, LI, dI, aI, a{) ... ,
the word a is accepted by B t if and only if t = Sn occurs for infinitely many n. D

Exercise 5.12.2 Prove the claim above.


We now use the two claims above to prove the following lemma.
Lemma 5.12.5 There exists a Bilchi automaton B2 over the alphabet ~I such that
for all
a = (so, Lo, A, ao, a~), (SI, LI, dI, aI, a{), ... ,
the word a satisfies (*) and
{t I t = Sn for infinitely many n} E F
if and only if A2 accepts a.
Proof. Let Q E F. Consider the following ~l-language LQ:

where each B t , t E S, is the Buchi automata from the previous claim (Claim 5.12.2).
Clearly, by the closure properties of Buchi recognizable languages, the language
LQ is Buchi recognizable. Similarly the language

( U LQ) nL(BI),
QEF

where BI is from Claim 5.12.1, is Buchi recognizable. Hence there exists a desired
Buchi automaton B2. The lemma is proved.
Lemma 5.12.6 There exists a Milller automaton Al over the alphabet {A, 0, I} x
~ X ~f such that for all

a = (A, ao, a~)(dI' aI, a{) ...


the automaton Al accepts a if and only if the following property holds. For all
so, sI, ... E Sand Lo, LI, ... E D(S) if
(so, Lo, A, ao, a~), (SI, LI, dI, aI, a{), ...
satisfies (*), then the set {sis = Sn infinitely often} is not in F.
5.12. Complementation and Decidability 325

Proof. Consider the BUchi automaton 82 constructed in the previous lemma.


Take the projection of L(82) to the language over the alphabet {A, 0, I} x ~ X ~'.
Thus, an infinite word
(do, ao, (6)(dl, ai, a{) ...
belongs to the projection if and only if there exist so, Sl, ... E Sand Lo, LI, ... E
D(S) such that the sequence

(so, Lo, do, ao, (6)(sl, LI, dl, ai, a{) ...
satisfies (*) and {slsn = t for infinitely many n} belongs to F. The projection is
B Uchi recognizable. Hence the complement of the projection is B Uchi recognizable.
By McNaughton's theorem, the complement is recognized by a MUller automaton
AI. Now it is not hard to see that the MUller automaton Al satisfies the lemma.
We leave it to the reader to finish the proof of the rest of the lemma. D

Exercise 5.12.3 Show that the Muller automaton Al from the lemma above sat-
isfies the lemma.
Let A I = (S I, {s d, TI, F I) be the MUller automaton constructed in the
previous lemma. Based on this automaton we construct a game automaton A' =
(S', /', R', F') over the alphabet ~ x ~' as follows:
1. The set S' of states of A' is S I .
2. The initial rule /' contains all pairs (s, (a, a')) such that (Sl, (A, a, a'), s)
E TI.

3. The rule set R' contains all4-tuples (s, d, (a, a'), s') such that (s, (d, a, a'),
s') E TI.
4. The set F' is the same as the set Fl.
Note that this game automaton satisfies the following property. For any position p
of Automaton in the game r(A', v), Automaton is able to make only one unique
move from p.
Lemma 5.12.7 Let (v, T) and (v', T) be ~-valued and ~'-valued trees, respec-
tively. Consider the ~ x ~'-valued tree (v x v', T) defined naturally. Then the
following are equivalent:
1. (v', T) yields a winning strategy in r (A, v).
2. A' accepts the tree (v x v', T).
Proof. Suppose that (v', T) yields a winning strategy f in rcA, v). In order
to show that A' accepts (v x v', T), we need to prove that Automaton has a winning
strategy in the game rCA', v x v'). Let
326 5. Rabin Automata

be a position of Automaton in the game r (A', v x v'). Then there exists a unique Sn
such that (Sn-I, d n , v x v' (di ... dn ), sn) E R'. Hence the only move of Automaton
at position p consists of picking up the unique state Sn. Now let

be a play of the game. Set ao = v(Je), a~ = v'(Je), an = v(dl .. , d n ), a~ =


v'(di .. , d n ). Then from the definition of A', we see that

where n 2: 1. Hence it suffices to show that the MUller automaton Al accepts

In order to show that Al accepts ex, let us take the sequences to, tl, t2, ... E Sand
Lo, LI, L2, . .. E D(S). Suppose that (*) holds for the sequence

We now use the fact that f is a winning strategy. Since (*) holds and f is a winning
strategy, we see that the set {t Itn = t for infinitely many n} does not belong to F.
Hence ex is accepted by AI. It follows that A' accepts (v x v', T). The proof of
the implication (2) --+ (1) is similar and we leave it to the reader. The lemma is
proved. 0

Exercise 5.12.4 Prove the implication (2) --+ (1) in order to complete the proof
of the lemma above.

Now let AI! be a game automaton which accepts the projection of L(A') to
1:. We now use the lemmas proved above. The 1:-valued tree (v, T) is accepted
by AI! if and only if A' accepts (v x v', T) for some (v', T). In tum, A' accepts
(v x v', T) if and only if (v', T) yields a winning strategy for Pathfinder in game
r(A, v). The tree (v', T) yields a winning strategy in the game r(A, v) if and only
if Pathfinder wins the game r(A, v). Hence (v, T) is accepted by AI! if and only
if A does not accept (v, T). Thus, we have proved the following theorem which
gives a positive answer to the complementation problem for Rabin automata.

Theorem 5.12.2 For any Rabin automaton B there exists a Rabin automaton C
such that VE \ L(B) = L(C). 0

Here now is an algorithm that transforms given Rabin automaton B into the
Rabin automaton C such that L(C) = VE \ L(B):

1. Transform the automaton B into the equivalent game automaton A (see


Theorem 5.4.1).
5.12. Complementation and Decidability 327

2. Construct the BUchi automaton BI (see Claim 5.12.1).

3. Construct the BUchi automaton Bf (see Claim 5.12.2) for every state t of B.

4. Construct the BUchi automaton B2 (see Lemma 5.12.5).

5. Construct the Muller automaton Al (see Lemma 5.12.6).

6. Construct the game automaton A' (see the paragraph just after Lemma
5.12.6).

7. Construct the game automaton A" (see the paragraph just after Lemma
5.12.7).

8. Transform A" into the Rabin automaton C (see Theorem 5.4.2).

Hence we have the following theorem.

Theorem 5.12.3 There exists an algorithm that, given a Rabin automaton B, con-
structs a Rabin automaton C such that C accepts the language VE \L(B). 0

5.12.3 Decidability. Now it is time to turn our interest to the decidability prob-
lems about Rabin automata. We, of course, fix an alphabet h. We are interested in
finding algorithms to solve the emptiness, equality, and universality problems for
Rabin automata. We begin our discussion with the proof of the theorem that states
decidability of the emptiness problem.

Theorem 5.12.4 There exists an algorithm which, given any Rabin automaton A,
decides whether A accepts a h-valued tree.

Proof. Let A be a Rabin automaton. We transform A into a game automaton


Al = (SI, Ii, R, Fd such that L(A) = L(AI). We now claim that there exists
a game automaton A2 = (S2, h R2, F2) over the one-letter alphabet h2 = {a}
such that A2 accepts a h2-valued tree if and only if Al accepts a h-valued tree.
Note that there exists exactly one h2-valued tree (v, T), where vex) = a for all
x E T. Here is the construction of A2:

1. S2 = SI.
2. Put (s, a) in h if and only if (s, 0") E II for some 0" E h.

3. Put (s, d, a, s') into R2 if and only if (s, d, 0", s') E R for some 0" E h.

It is not hard to see that A2 is indeed a desired game automaton.


We now need the following lemma that we derive from the forgetful deter-
minacy theorem.
328 5. Rabin Automata

Lemma 5.12.8 For the game automaton A2 over the alphabet {a} consider the
game r(A2, v). Then in this game one 01 the players possesses a winning strategy
I such that if P and q are positions olthe winner and lvr(p) = lvr(q), then
I(p) = I(q)·
Proof of the Lemma. Recall that r(A2, v) is a GH-game. Consider the
congruence relation E for this game. Note that vex) = a for all x E T. Therefore,
for all positions p and q of this game, the Node(p)-residue of (v, T) is the same
as the Node(q)-residue of (v, T). We conclude that the condition lvr(p) = lvr(q)
implies, by the Forgetful Determinacy Theorem, that I(p) = I(q). This proves
the lemma.
From this lemma we see that a winning strategy in the game r(A2, v) is
among the functions that depend on the last visitation records. Hence, there exists
a winning strategy that belongs either to the set of all functions from D(S) (displays
on S) to S or to the set of all functions from D(S) to {O, I}. Let I be a function
(strategy) from the former set and let g be a function (strategy) from the latter set.
Consider the play
so, dl, Sl, d2, S2, ...
consistent with these two functions I and g. Let Pi be the ith position of Pathfinder
in this sequence. So

Consider the sequence

lvr(po), Ivr(Pl), Ivr(p2), ....

There exists an i and an m i= 0 such that Ivr(Pi) = Ivr(Pi+m)' Then it should be the
case that g(lvr(Pi)) = g(lvr(Pi+m)). Since I and g are functions that depend on
last visitation records and the above play is consistent with I and g, the play must
eventually be periodic. Hence we can compute the period and find out whether
or not the strategy I wins against g or the strategy g wins against I. The set of
all functions from D(S) (displays on S) to S or from D(S) to {O, I} is finite. One
of these functions, by the lemma above, is a winning strategy. We conclude that
playing these strategies against each other, we can algorithmically find it desired
winning strategy. Now A2 accepts (v, T) if and only if Automaton has a winning
strategy. We now leave the details of the proof to the reader. 0

Corollary 5.12.1 The equality and universality problems lor Rabin automata are
decidable.

Proof. This follows, given the solutions to the complementation and the
emptiness problems, the proofs of similar statements about Btichi automata. 0
Exercise 5.12.5 Prove the corollary above.
6
Applications of Rabin Automata

Rabin automata have applications in many areas of mathematics and computer


science. In this chapter our goal is to show how results about Rabin automata can
be applied to prove that some theories of well-studied mathematical structures are
decidable. This chapter consists of ten sections. The first four sections introduce
the notions of algebraic structure, the monadic second order logic, the truth of
formulas in algebraic structures, isomorphisms, and theories of classes of struc-
tures. Section 5 is devoted to proving that the monadic second order theory of two
successor functions, known as S2S, is decidable. In particular, the section shows
the relationship between definable relations in the monadic second order logic of
two successors and languages accepted by Rabin automata.
All of the next sections use the decidability of S2S. Section 6 proves that
the monadic second order theory of w many successor functions is decidable. In
Section 7 we prove that the monadic second order theory of countable linearly
ordered sets is decidable. Section 8 shows that the monadic second order theory
of countable unary algebras is decidable. In Section 9 we study Cantor's discon-
tinuum, and prove that the theory of Cantor's discontinuum is decidable in a logic
weaker than the monadic second order logic. We also prove that the theory of the
topological space of the real interval [0, 1] is decidable. Finally, in the last section,
we introduce and study some known properties of Boolean algebras. We prove
that the theory of all countable Boolean algebras with quantifications over ideals
is decidable.
We note that the basic results of this chapter are decidability results. The
proofs of these results involve algorithms whose correctness are based on some

B. Khoussainov et al., Automata Theory and its Applications


© Birkhäuser Boston 2001
330 6. Applications of Rabin Automata

known algebraic facts about the structures. Thus, for example, in studying the theo-
ries of linearly ordered sets, we use (and prove) the fact that any countable linearly
ordered set can be embedded into the linearly ordered set of rational numbers. In
studying theories of unary algebras, we introduce enveloping unary algebras and
use (and prove) the fact that any countable unary algebra can be embedded into
an enveloping unary algebra. In the study of Cantor's discontinuum, we prove
some topological results about the Cantor discontinuum. In the study of theories
of Boolean algebras, we use (and prove) Stone's representation theorem. We show
that elopen sets of Cantor's discontinuum form a Boolean algebra. We also use
(and prove) the fact that any countable Boolean algebra is isomorphic to a factor
of the Boolean algebra of elopen sets of Cantor's discontinuum. Thus, from this
point of view, all the decidability results of this chapter can be considered as those
obtained by exploiting the interplay between algebraic properties of structures and
algorithms. All the decidability results provided in this chapter were proved by
M. Rabin in 1969 in his famous paper "Decidability of Second-Order Theories and
Automata on Infitite Trees."

6.1 Structures and Types


The goal is to develop a language powerful enough to reason about structures that
arise in mathematics. To do this we first need to classify structures by their types.
Then we develop a language, similar to the language of the monadic second order
logic of one successor, that allows us to talk about properties of structures of the
same type. We have already had experience in developing languages, so we will
feel quite comfortable not going into much detail.
Examples of structures are linearly ordered sets, partially ordered sets, equiv-
alence relations, (w, S) and the tree (T, ro, rl). In this section we present a general
definition of a structure. At this stage we can informally say that a structure is a set
together with certain operations and relations which are defined on the set. Thus,
the tuple (w, S, :::::) is a structure that consists ofthe set w, the successor operation
S and the ordering relation::::: on w. Similarly, (Z, +, x, :::::) is also a structure that
consists of the set Z, the addition operation, the multiplication operation, and the
less than or equal to relation. For our purposes, we need to be more formal and
give an exact definition of structures.
Definition 6.1.1 A type is a sequence (which may be finite)
no Fn!
F.0 pmo pm!
' 1 ' ' ' . , 0 ' 1 ,,,.,CO,Cl,,,·,

where each Fti is called an operation symbol, each p7


j is called a relation

symbol, and each Ck is called a constant. For the operation symbol Ft i , the
natural number ni is called the arity of the operation symbol. Similarly, for the
relation symbol p7j, the natural number m j is called the arity of the relation

symbol. If the sequence above is finite then the type is called a finite type.
6.1. Structures and Types 331

In order to specify a structure of the given type, we first need to pick up a


nonempty set, say D, which will be called the domain of the structure. We also need
to associate with each operational symbol Fti an operation, denoted by Ft i ,D, on
the domain D. The arity of the operation is ni. In addition, we need to associate
with each relational symbol p7
j a relation, denoted by p7
j, D , on the domain D.

The arity of the relation is m j. Finally, we should pick up elements cp from the
domain which are associated with the constant symbols Ck. Hence, what we have
is the structure

F no,D ' Fnl,D


(D ' 0 1
pmo,D pm1,D
' ... , 0 '1
D D )
' ... ,co' C1 ' ....

A point here is that the structure we have just considered is not uniquely determined
by the type. This is because each symbol Fti, for example, can be associated with
many other operations on D. Let us now give a formal definition and then have
some examples. Of course, we have the fixed type given above.

Definition 6.1.2 A structure of the given type is the sequence

(D , F0no,D ' Fnl,D


1
pmo,D pm1,D
' ... , 0 ' 1
D D )
' ... ,co' cl ' ....

such that we have the following:

1. D is a non empty set called the domain.

2. Each Fti,D is afixed operation on the domain D. The arity of the operation
is ni.

3. Each p7 j ,D is a fixed relation on the domain D. The arity of the relation


is mj.

4. Each cp is a fixed element on the domain D called a constant.

We denote this structure by 'D.

We note that the order of operations, predicates and constants in the structure
follows the same order of the corresponding operation symbols, relation symbols
and constant symbols of the given type. Also, if it causes no confusion, we often
denote the operation (relation, constant) Fin'" D by the same symbol Fin'I as occurs
in the type. Let us now have several examples.

Example 6.1.1 Let the type be f, where f is the operation symbol of arity 1. This
is called a unary operation symbol. Some structures ofthis type are the following:

1. (w, S), where S is the successor function on w.

2. (w, x -+ x 2 ), where the function x -+ x 2 sends each number n to n 2 .


332 6. Applications of Rabin Automata

3. (Z, f), where f(i) = 2iforall i E Z.


4. (Q, f), where Q is the set of all rational numbers and f (q) =2 x q _ q2
for all q E Q.
S. Of course, the structure (w, +), where + is addition, is not a structure of
the given type because + is a binary (hence not unary) operation.
Example 6.1.2 Let the type be R, where R is a relation symbol of arity 2. Some
structures of this type are the following:
1. (w, S), where S is the ordering relation on w.

°
2. (w, mod(n», where the relation mod(n) is the equivalence relation on w
such that (x, y) E mod (n) if and only if x - y is equal to modulo n.
3. (Z, P), where (x, y) E P ifand only ifx = 2y.
4. (Q, S), where Q is the set of all rational numbers, and S is the usual
ordering relation.
S. Of course, the structure (w, +), where + is addition, is not a structure of
the given type because + is a binary operation but not a binary relation.
Example 6.1.3 Recall the structure T from the previous chapter. The domain of
the structure is {a, l}*. On T, two unary operations Land R are defined asfollows.
For all u E T, L(u) = uO and R(u) = ul. The triple ({O, l}*, L, R), denoted by
T, is the binary tree. The type of this structure is

where fl and h are unary operation symbols.


Example 6.1.4 Consider the structure (w, S, +, S, 0, 10). The type of this struc-
ture is
f, f2, R, co, CJ,
where f is a unary operation symbol, f2 is a binary operation symbol, R is a
binary relation symbol, and Co and CI are constant symbols.
Exercise 6.1.1
1. Give examples of structures of the type f2, where f2 is a binary operation
symbol.
2. Give examples of structures of the type f2, R2, where f2 is a binary oper-
ation symbol and R2 is a binary relation symbol.
3. Give examples of structures of the type Uo, UI, U2, ... , where each Ui is a
unary predicate symbol.
4. Give examples ofstructures ofthe type co, CI, ... , where each Ci isaconstant
symbol.
6.2. The Monadic Second Order Language 333

6.2 The Monadic Second Order Language


We fix the type F;o, F~l , ... , p;o, p~l , ... , co, CI, .... Let us denote this type
by r. In this section our goal is to develop the monadic second order language
of the structures of given type. Having the language, we will be able to formally
express certain properties of structures of type r and reason about the properties.
At the end of this section we will explain the reasons for the terms monadic and
second order.
In describing the language we will be quite formal since we have already used
this type oflanguage for other structures (e.g., (w, S), finite linearly ordered sets).
The symbols of the language of the monadic second order logic are the following.
1. We use the symbols
x, Y,z, ... ,
called individual variables, possibly with subscripts or superscripts. These
run over domains of the structures of type r.

2. We use the symbols


X,Y,Z, ... ,
called set variables. These run over subsets of the domains of structures of
type r.
3. We use symbols =, E, and of course the symbols from type r:
nO' Fnl
P0 I , ... , °'
pmo pml
I , ... ,CQ,CI,·· ..

4. We use logical connectives &, V, . . " -+, and quantifiers 3, V. The quantifiers
3, V can be applied to individual as well as to set variables.

5. We also use nonlogical symbols ( and), left and right parentheses.


We now define the notion of a term of the monadic second order logic.
Informally terms represent operations on the domains of structures obtained by
compositions from the basic operations of the structures.
Basic Step. Each variable x is a term. Each constant symbol C is a term.
Inductive Step. If F is an operation symbol of arity m and tl, ... ,tm are
terms, then F(tl, ... , t m ) is a term.
Thus, a string of symbols is a term if it can be shown to be a term by a finite
number of applications of the procedure above. Each term may contain variables. If
all the variables ofthe term t are among variables {xo, XI, ..• ,xn } we may denote
this by t (xo, ... , xn).
Each term defines an operation on a given structure V in a natural way. For
example, the term
334 6. Applications of Rabin Automata

is the operation Fm,D itself. The term

defines the operation G of arity 3 as follows. For all a, b, c E D, G(a, b, c) is

F 2 ,D(F"D(a), F 3 ,D(a, b, c».

We define all this more formally as follows.


Let V be a structure and t(xo, ... , x n ) be a term. The value of t(xo, ... , x n )
at n + I-tuple (ao, ... , an), denoted by t(ao, ... , an) is defined as follows:
Basic Step. If t is Xi, then t(ao, ... , an) = ai. If t is a constant c then
t(ao, ... , an) = cD.
Inductive Step. If t = F (t" ... , tm ), then

t(ao, ... , an) = FD(t,(ao, ... , an),"" tm(ao,·.·, an»·

Thus, every term t defines an operation tV on the structure 'D. Sometimes,


if there is no confusion, we may write t instead of tV.

Exercise 6.2.1 Consider the type that consists of two binary functional symbols f
and g. Consider the structure (Z, +, x) of the type. Find the value of the following
terms at specified n-tuples.
1. f(x,g(x,y»at(-I,2).

2. g(x, f(x, g(x, x))) at 5.

3. f(x, g(y, fez, u))) at (1, 2, 3, 4).

4. g(x, g(x, g(x, x))) at 3.


Exercise 6.2.2 Consider the structure (Z, S), where S is the successor function.
Let t be a term of the type of this structure. Show that there exists a nonnegative
integer n such that t (x) = x + n for all x E Z.
We now define, by induction, formulas of the language of the monadic second
order logic.
Basic Step. The expressions

t E X, t, = t2, X = Y, P(t" ... , tn ),

where t" t2, ... ,tn are terms, X and Yare set variables, and P is a predicate
symbol of arity n, are all atomic formulas.
Inductive Step. Suppose that the formulas <1>, and <1>2 have been defined.
Then
6.2. The Monadic Second Order Language 335

l. (<1>1&<1>2) is a formula,

2. (<I> 1 V <1>2) is a formula,

3. (<I>I ~ <1>2) is a formula,

4. (-0<1>1) is a formula,

5. (3x <I> I) and (3X <I> 1) are formulas,


6. (Vx<l>J) and (VX<I>I) are formulas.

Now we define the notion of a free variable in a formula. We note that for a
term t the set of free variables FV (t) is simply the set of all variables that occur
in t.
Basic Case. For atomic formulas t E X, x = y, X = Y, tl = t2, and
PCtI, ... , tn), the sets of free variables are FV(t) U{X}, {x, y}, {X, Y}, FVCtJ) U
FVCt2), and FV(tJ) U··· U FVCtn), respectively.
Inductive Step. Suppose that the sets of free variables FV (<I> I) and FV (<1>2)
for the formulas <1>1 and <1>2 have been defined. Then

FV(<I>I K <I>2) = FV(<I>J) UFV(<I>2), FV(-o<l>I) = FV(<I>I),


FV(Qx<l>l) = FV(<I>I) \ {x}, FV(QX<I>I) = FV(<I>J) \ {X},

where K E {&, V, ~}, Q E {V, 3}, x is an individual variable, and X is a set


variable.
A formula is a sentence if it has no free variables. Thus, we have defined
the language of the monadic second order logic. In summary, one can quite infor-
mally say that the language we have defined consists of the type, variables, logical
connectives, terms, formulas, and sentences.
We also need a language weaker than the language of the monadic second
order logic. This weaker language is defined exactly as the language of the monadic
second order logic but does not contain set variables, and the membership symbol
E. Thus, the formulas of this language are defined as follows. The expressions
tl = t2 and PCtl, ... , t n), where tl and t2 are terms, and P is a predicate symbol of
arity n, are all atomic formulas. Suppose, by induction, that the formulas <1>1 and
<1>2 have been defined. Then (<1>1&<1>2), (<1>1 V <1>2), (<1>1 ~ <1>2), (-o<l>J), (3x<l>l)
and (Vx <I> 1) are all formulas. We call this language the language of the first order
logic. Clearly, the language of the first order logic is contained in the language of
the monadic second order logic.
Quite informally, the first order logic is a set of statements about properties
of the elements of structures, while the second order monadic logic is a set of
statements about properties of the elements and subsets of structures. The word
order can thus be understood as follows. Elements of structures are first order
336 6. Applications of Rabin Automata

objects. Subsets and relations of structures are the second order objects. The third
order objects are sets of relations. In general, objects of order n are sets that contain
objects of order n - 1. The word monadic is used because in the monadic second
order language the second order variables are set variables only.

6.3 Satisfiability and Theories


In this section we discuss the relationship between languages and structures. The
relationship is based on the notion of satisfiability, or equivalently truth, of the
formulas under a given interpretation of variables. We assume that we have fixed
the type r. We also fix a structure V whose type is r. Suppose that to each individual
variable Xi and a set variable X j an element bi and a set B j of the domain D has
been assigned, respectively. In other words, we have a fixed interpretation

intr : Xi -+ bi intr: Xj -+ Bj

of the variables. By induction on the complexity of the formula <P, we define


satisfaction of <P on the structure V under the interpretation. We recall that any
term t can be thought as an operation tV on the domain D. Now we provide the
definition. Note that the definition assumes that the interpretation intr is given.

Definition 6.3.1
Basic Step •

• V satisfies the atomicformula (t(XI, ... , xn) E Xj) ifin V we indeed have
t V (bl, ... ,bn)EBj .

• V satisfies the atomic formula tl (XI, ... , xn) = t2(XI, ... , xm) if tP (bl'
... , bn ) = tp(bl, ... , bm).

• V satisfies the atomic formula (Xi = Xj) ifBi = Bj.

• V satisfies theatomicformula P(tl (XI,···, x m1 ), ... , tn(XI, ... , xm n )) ifit


is indeed the case that the n-tuple

belongs to the relation pV.

Inductive Step. We consider separately each case corresponding to the in-


ductive step in the definition of a formula.

• V satisfies (<PI V <P2) if V satisfies either <PI or <P2·

• V satisfies (<PI&<P2) if V satisfies both <PI and <P2.


6.3. Satisfiability and Theories 337

• D satisfies (<1> I -+ <1>2) if D does not satisfy <I> I or the condition that D
satisfies <1>1 implies that D satisfies <1>2.

• D satisfies -.(<1>J) ifD does not satisfy <1>1.

• D satisfies (3Xi <I> I) if there exists bED such that D satisfies the formula
<1>1 under the new interpretation intr' which is the same as intr except its
value on Xi is b.

• D satisfies (3Xi <I> I) if there exists B ~ D such that D satisfies the formula
<1>1 under the new interpretation intr' which is the same as intr except its
value on Xi is B.

• D satisfies (Vxi<l>l) ifD satisfies -.(3Xi(-.<I>J)).

• D satisfies VXi<l>l) ifD satisfies -.(3Xi(-.<I>I)).

From the definition we see that the satisfaction of sentences does not de-
pend on interpretations. Every sentence is either satisfied or is not satisfied in the
structure, and does not depend on intr. For a formula <I> whose variables are among
XI, ... , Xt and XI, ... , Xp, we usually write <I>(XI, ... , Xp,XI, ... ,xt).Wewrite

if the structure D satisfies this formula under the interpretation intr such that
intr(Xj) = Bj, intr(xi) = bi, where j = 1, ... , p and i = 1, ... , t.
We need a definition.

Definition 6.3.2 We say that the formulas <I> (X I, ... , X m , YI, ... , Yk) and 'lI (X I ,
... , X m , YI, ... , Yk) are equivalent in a given structure D if for all subsets BI,
... , Bm C D and all elements bl, ... , bk E D the structure D satisfies <I> (BI, ... ,
Bm, bl, ... , bk) if and only ifD satisfies 'lI (BI, ... , Bm, bl, ... , bk)'

Exercise 6.3.1 Consider the structure T = (T, L, R). Let the term tl (x) be
r(t; (x)) and the term t2(Y) be r'(t~(y)), where r, r' E {L, R}. Show that tl (x) =
(t;
t2(Y) is equivalent to the formula 3xI3YI (x) = XI & t~(Y) = YI & r(xI)
= r' (YI)) in structure T.

Definition 6.3.3 Let /C be a class ofstructures. The monadic second order theory
of /C is the set ofall sentences in the monadic second order logic satisfiable (true) in
all the structures from /C. We denote it by Th(/c). Similarly, the first order theory
of /C is the set of all sentences in the first order logic satisfiable (true) in all the
structures from /C. We denote this theory by Thl (/C).

Thus, using the definition one can talk about the monadic second order theory
of all linearly ordered sets, partially ordered sets or different types of mathematical
structures such as groups, rings, boolean algebras, etc. When the class K contains
338 6. Applications of Rabin Automata

only one structure, say V, then usually the theory of the class JC, that is, Th(JC) is
denoted by Th(V). So, one can talk about theories of the structures (Q, :5), (Z, +),
(w, S, +, x), etc.

Definition 6.3.4 The monadic second order theory of the structure T = ({O, 1}*,
L, R) of two successor functions is denoted by S2S.

Our purpose is to show that the monadic second order theory ofT is decidable.
In other words, we will show that there exists an effective procedure which, for
any given monadic second order sentence <1>, decides if this sentence is true in T
or not. Before we proceed to this task we will need one additional definition and
proposition (discussed in the next section) that will be used later.

6.4 Isomorphisms
A concept that is very often used in mathematics is the concept of identification
of structures. Informally, two structures can be identified if one is a "copy" of
the other. Thus, two structures that are identified should have the same algebraic
properties. For example, two finite linearly ordered sets that have the same number
of elements can be identified (see the section on the monadic second order theory
of strings in the finite automata chapter). We formalize the concept of identifying
structures in the following definition.

Definition 6.4.1 Let Vt and V 2 be structures of type r. A one-to-one mapping f


from the domain Dt onto the domain D2 is called an isomorphism if the map f
preserves the basic operations and relations as follows:

1. For all constants c E r, f(c D!) = C D2 . In other words, f "preserves" the


constants in Vt and V2.

2. For any n-ary operation symbol FEr, and all at, ... , an EDt, we have

In other words, the mapping f "preserves" the operations.

3. For any n-ary relation symbol PEr, and all at, ... , an EDt, pD! (at,
... , an) is true in Vt ifand only if p D2(f(at), ... , f(an» is true in V2. In
other words, the mapping f "preserves" the relations.

If f is an isomorphism between Vt and V2, then the structure Vt is called iso-


morphic to the structure V2.

It is not hard to see that isomorphic structures have the same theories. We
prove a slightly more general fact in the following proposition.
6.5. Definability in T and Decidability of S2S 339

Proposition 6.4.1 Let f be an isomorphism from the structure VI onto V2. Then
for all formulas <1> (XI , ... , X m , YI, ... , Yk), subsets BI, ... , Bm ~ DI and el-
ements bl, ... ,bk E DI, the structure VI satisfies <1>(BI, ... , Bm, bl, ... ,bk) if
and only V2 satisfies <1>(f(BI), ... , f(Bm), f(bl), ... , f(bk», where f(B) is
the image of the set B in D2 under f.
Proof. The proof can be presented by induction on the complexity of the
formula <1> (XI , ... , X m , bl,"" bk). The base case when the formula is atomic
follows directly from the definition of isomorphism. The cases when <1> is obtained
from less complex formulas <1>1 and <1>2 using logical connectives are proved
easily from the definition of satisfiability. Now assume that <1> is of the form
3X IW(X I, ... , X m , YI, ... , Yk). Suppose that VI satisfies the formula 3X IW(X I,
B2, ... , Bm , bl,"" bk)' Then for some BI C VI, the structure VI satisfies the
formula W(BI, B2 ... , Bm , bl, ... , bk). Now applying the induction hypothesis
to W(BI, B2, ... , Bm , bl, ... , bk), we see that V2 satisfies W(f(B]), f(B2), ... ,
f(Bm), f(bl),"" f(bk»' Hence V 2 satisfies 3XIW(XI, f(B2),"" f(Bm),
f(bl), ... , f(bk». The other cases are proved similarly. 0
Exercise 6.4.1 Finish the proof of the proposition.
Exercise 6.4.2 Show that the following facts are true:
1. Every structure is isomorphic to itself.
2. lfVI is isomorphic to V2, then V2 is isomorphic to VI.
3. If VI is isomorphic to V 2 and V 2 is isomorphic to V 3, then VI is isomorphic
tolh·
Exercise 6.4.3 Show that the following structures are isomorphic:
1. (ev, +) and (2ev, +), where + is the addition operation, and 2ev is the set of
all even natural numbers.

° °
2. (Q,::::) and «0, l)r, ::::), where (0, l)r is the set of all rational numbers
between and 1 not including either or 1.
Exercise 6.4.4 Show that if two structures with finite domains satisfy the same first
order sentences, then the structures are isomorphic.

6.5 Definability in T and Decidability of S2S


In this section we will concentrate on the monadic second order theory of the
structure of two successors T = (T, L, R). In particular, we will be interested
in the issue about the relationship between the monadic second order language of
T and Rabin automata. We show that the relations in T definable in the monadic
second order logic can be identified in a certain natural way with languages of
~-valued trees accepted by Rabin automata.
340 6. Applications of Rabin Automata

6.5.1 ~-Valued Trees as Structures. Let ~ be an alphabet. We will show how


~>valued trees can be viewed as mathematical structures which are, in some sense,
richer than the structure T. Suppose that (u, T) is a ~-valued tree. Take a symbol
(J' from ~. Now the symbol (J' defines a subset Qa on the tree T in the following

way. A node u E T belongs to the subset Qa if and only if u(u) = (J'. Let us
consider an example.

Example 6.5.1 Suppose that ~ = {a, b, c}. Consider a ~-valued tree (u, T)
defined as follows:

if 3n(lul = 3n),
if 3n(lul = 3n + 1),
if 3n(lul = 3n + 2).

This valuation defines the following subsets:

Qa = {u Ilul = 3n, nEw},


Qb = {u I lui = 3n + 1, nEW},
Qc = {u Ilul = 3n + 2, nEW}.
In this example, the ~-valued tree (u, T) defines the structure whose domain con-
sists of all binary strings, and whose type is determined by the successor functions
Land R, the unary relations Qa, Qb, and Qc. In other words, we have the structure

({O, 1}*, L, R, Qa, Qb, Qc).

This structure is indeed richer than T just because it contains more information
about the tree than the original structure T itself.
We explain this in a general setting. Given a ~-valued tree (u, T), with
~ = {at, ... , an}, we expand T by considering the structure

(T 2, L, R, Qa\, ... , QaJ,

where ~ = {at, ... , an}. We denote this structure by Tv. The type of Tv thus
consists of two unary operation symbols and n unary relation symbols.
There is another way to look at the structures of type Tv. We explain this
using the next example.

Example 6.5.2 The alphabet is {a, b, c}. We identify the alphabet with the subset
of the alphabet {O, l}2 in such a way that
6.5. Definability in T and Decidability of S2S 341

Now the valuation v considered in Example 6.5.1 can be expressed as

(b) if 3n(lul = 3n),

v(u) = (~) if 3n(lul = 3n + 1),

(~) if 3n(lul = 3n + 2).


Let us analyze this example in detail. The valuation v defines the pair (X I, X2)
of subsets of T as follows. A node u belongs (does not belong) to XI if and only
if the first coordinate of the letter v(u) is 1 (0). Similarly, u E T belongs (does
not belong) to X2 if and only if the second coordinate of v(u) is 1 (0). Hence we
see that
Xl = {u Ilul = 3n, nEw} U{u Ilul = 3n + 2, nEW},
X2 = {u I lui == 3n + 1, nEW} U{u Ilul = 3n + 2, nEW}.
Consider the sets X I and X2just above defined. The pair X = (X I, X2) determines
a valuation vg as follows. For all u E T,

vg(u) = (:~) ,
where Ei = 1 if and only if u E Xi. Then for every u E T, vg(u) belongs to {O, l}2
and equals v(u). Note that since

we also have vg = VI.


Thus, informally we can conclude with the following comments about the
above example. If we know v, then we know the structure Tv. If we know Tv, we
know v. If we know v, we know the pair (X I, X2). If we know the pair (X I, X2),
then we know v. Roughly speaking, the three objects, v, Tv, and (XI, X2) are
essentially the same and possess, in some respect, the same information.

6.5.2 Definable Relations. Consider the tree structure T. Let P (T) be the set
of all subsets of T. In this subsection we are interested in relations in T that can be
expressed in the monadic second order language of the structure T. We formally
define this concept in the next definition.
Definition 6.5.1 Let R be a subset of p(T)m-k x Tk. We say that R is definable
if there exists aformula cI>(BI, ... , Bm-b xm-k+l, ... , x m) such that the relation
R coincides with
342 6. Applications of Rabin Automata

Thus, R is definable if there exists a formula such that R consists of all the
tuples that make the formula true in the tree T. We consider several examples of
definable relations on T.
Our first example shows that the usual subset relation among subsets of T is
a definable relation.

Example 6.5.3 The formula X ~ Y is defined as

Vz(z E X -+ Z E Y).

Thus, when X and Yare thought to be A and B respectively, where A and Bare
subsets ofT, the formula X ~ Y is satisfied under this interpretation of X and Y
if and only if A is indeed a subset of B.
The next example shows that all the subsets that are closed with respect to
the unary operations Land R are definable. We say that AcT is algebraically
closed if L(a), R(a) E A for all a E A.

Example 6.5.4 Consider the formula Sub(X),'

Vx(x E X -+ L(x) EX & R(x) EX).

Thus, assume that we interpret X as a subset A of the tree T. Then Sub(A) is


satisfied if and only if for all elements a E A we have L (a), R (a) E A. Thus,
Sub(A) is satisfied if and only if A is algebraically closed.

We give an example of a closed set in T. Suppose A is the set of all nodes


that occur after a given node u, that is A = {a I u ::s a}. Then certainly for all a,
if a E A, then aO, a1 E A. Hence T F= Sub(A), and A is algebraically closed.
We recall that we have the naturally defined prefix relation on T. We denoted
this relation by ::S. It turns out, as the next example shows, that the prefix relation
on the nodes of the tree is also definable.

Example 6.5.5 We define the following formula denoted by x ::s y,'

VX(Sub(X) & x EX -+ Y EX).

Then for any two nodes x, y ofT, x ::s y if and only if x is a prefix of y.

Thus, we see that the partial order ::s is a definable relation on T.


In the next example, we show that the lexicographic ordering on the tree T
is definable. The lexicographic ordering :S is defined as follows. For all u, vET,
u is lexicographically less that or equal to v if u = v or u is a prefix of v or the first
symbol of v that is not equal to u is 1. Thus, if the first (from left to right) symbol
where v differs from u is 1, then u :S v.
6.5. Definability in T and Decidability of S2S 343

Example 6.5.6 We define the following formula x :s y:


x :s y V3z(L(z) :s x & R(z) :s y).

It is not hard to see a :S b is true in T if and only if a is lexicographically equal


to or less than b.

We leave the reader to prove the following exercise.


Exercise 6.5.1 Show that :S is a linear ordering on the set T.
Definability of the lexicographic ordering allows us to define finite subsets
of the binary tree T.
Example 6.5.7 Consider the following formula Finite(X):
'v'Y(Y C X&3x(x E Y) -+ 3XI3x2'v'y(y E Y -+ XI :S Y & y :S X2)).
This formula states that Finite(X) is satisfied if and only if every nonempty subset Y
of X has minimal and maximal elements with respect to the lexicographic ordering.

Exercise 6.5.2 Show that the set of all paths through the tree T is definable.
Exercise 6.5.3 Let n be a fixed positive number. Show that the set of all finite
X c T such that X has nk elements for some k and X is a subset of a path is
definable.

6.5.3 From Rabin Automata to Formulas. LetA = (S, {so}, M,.1") beaRabin
automaton over the alphabet :E. We can suppose that :E = {O, l}m forsomem E w.
Let BI, ... , Bm-k be subsets of T, and bm-k+I, ... ,bm be some elements of T.
We sometimes denote the sequence
BI, ... , Bm-k, bm-k+I, ... , b m
by Bb. Each such sequence and a node u E T define a symbol v (u) of the alpha-
bet :E:
v(u) = (EI,"" Em),
where for each j, Ej = 1 if and only if u E B j or u = b j. Thus, we have a valuation
v of the tree T. We denote this :E-valued tree by
tree(B, b).

The opposite is also true: any :E-valued tree (v, T) defines an m-tuple of sets
(X 1, ... , X m ), where for each i, 1 :s i :s m, and each u E T, u is in Xi (not in Xi)
if and only if the ith component of v(u) is 1 (0). So, we see that there is a natural
one-to-one correspondence between all :E-valued trees and m-tuples of subsets of
T. We note how we used the fact that m is fixed and is such that :E = {O, l}m.
The following theorem shows that the notion of acceptance for Rabin au-
tomata is expressible in the monadic second order formalism.
344 6. Applications of Rabin Automata

Theorem 6.5.1 There exists a procedure which, given a Rabin automaton A =


(S, M, T, F) over b = {D, l}m, constructs a formula <I> (XI , ... , X m), where
X I, ... , X m are set variables, such that for all subsets B = B I, ... , Bm C T the
following property holds:

A accepts tree(B) ifand only if(T, L, R) satisfies <I>(B).

Proof. The proof follows the ideas of the proof of the similar theorem for
BUchi automata. We can assume that the initial state I contains one state only.
Since S is a finite set we can also suppose that

S={D,I, ... ,p}

with D being the initial state. Let a E b be of the form

where each Ei E {D, I}. We define the formula <l>a(x, X), where X is XI, ... , X m,
as follows:
<l>a(X, XI, ... , Xm) = X EEl XI&'" X EEm X m ,

where EE is E if E = 1, and Ii otherwise.


Informally, this formula codes the letter a E b by saying that the value of
tree(X) at node x is a. We note the following fact. Let BI, ... , Bm be subsets of
T. Then for every u E T there must exist some a E b such that <l>a (u, B) holds.
We conclude that the formula

is satisfied in (T, ro, TJ). We also recall that for each b-valued tree (v, T) there
exists a sequence B = BI, ... , Bm of subsets of T such that tree(BI, ... , Bm) is
exactly (v, T).
Let Yo, YI, ... , Yp be set variables. The desired formula involves these set
variables. The intention is that each Yi represents the state i of the automaton A.
In the desired formula these set variables will be existentially quantified. We write
down the following formula and denote it by D(Y), where Y is Yo, ... , Yp:
6.5. Definability in T and Decidability of S2S 345

The intention is that we want to express the fact that the automaton A cannot be
in two distinct states simultaneously.
We define another formula <l>a,i (x, X, Y) and explain its meaning. The for-
mula is

v
(j,k)EM(i,a)
(L(x) E Yj & R(x) E Yk).

Informally, the formula corresponds to the fact that if A is in state i and the
next input signal is a, then the automaton splits itself into two (left and right)
copies such that the left copy is in state j and the right copy is in state k so that
(j, k) E M(i, a). The following note concerns this formula. Suppose that U E T
and B\, ... , Bm C T. Let a E ~ be such that (T, L, R) satisfies <pa(u, E, Y).
Then if the formula
3Yo··· 3Yp (<P a ,i(U, B, Y»
is true, there exists a (j, k) such that L(u) E Yj, R(u) E Yk and (j, k) E M(i, a).
Finally, the last formula we need is the formula F(Y), which states that for
any path rr, there exists a Q E F and an x E rr such that the following properties
hold:

1. Vy(y::: x --+ VjEQ Y E Yj).

2. For any j E Q and for any z ::: x if z Err, there exists a y ::: z for which
y E Yj and y Err.
It is not hard to see that the formula F is expressible in the monadic second order
logic. This formula is intended to code the notion of successful computation.
Now we write down the desired formula <P(X \, ... , Xm):

3Yo ... Yp(D(Y) & 0 E Yo & VX(&iES,aE~<l>a,i(X, X, Y) & F(Y))).

Our goal is to show that this formula satisfies the theorem. We need to prove
that for all subsets B\, ... ,Bm S; T the automaton A accepts tree(B\, ... , Bm)
if and only ifT 1= <p(B\, ... , Bm).
Take subsets B\, ... , Bm. Consider the ~-tree

Now let us assume that the ~-valued tree tree(B\, ... , Bm) is an input of the Rabin
automaton A.
Suppose that A accepts tree(B\, ... , Bm). Therefore, there exists a run

r:T--+S

such that for any path rr the set {s I rex) = s for infinitely many x Err} belongs
to F.
346 6. Applications of Rabin Automata

We need to prove that

that is, we need to show that there are subsets Do, ... , Dp on the tree T such that
the interpretation Yi --+ Di, i = 0, ... , p, makes the formula <I>(BI, ... , Bm) true
in T.
Here is how we define each Di, i = 0, ... , p:

Di = {x E T I rex) = i}.

The formula <I> (B I, ... , Bm) under this interpretation of Yi --+ Di, i = 0, ... , p,
is satisfied in T.
Now suppose that <I>(BI, ... , Bm) is satisfied in T. We want to show that A
accepts the string tree(BI, ... , Bm). There are subsets Do, ... , Dp ofT such that
the formula <I>(BI, ... , Bm) becomes satisfied in T when we interpret the variables
Yo, ... , Yp as Do, ... , D p , respectively.
For every x E T, we consider the set Dr(x) such that u E Dr(x), where
1 :s rex) :s p. Hence we have a mapping r from T into S. Now using the
definition of <t>(X), one can check that the function rex), x E T, is a run of the
automaton A on the tree tree(T, BI, ... , Bm). Moreover, the run r is a successful
run. 0

Exercise 6.5.4 Prove the theorem above in greater detail.

6.5.4 From Formulas to Rabin Automata. Our goal is to show the converse
of the theorem proved in the previous subsection. In other words, given a formula
of the second order monadic logic of the structure T, we want to construct a Rabin
automaton whose successful runs correspond to interpretations of the variables that
make the formula satisfied. We consider several examples to explain the idea.

Example 6.5.8 Consider the formula X2 E X I. We define a Rabin automaton A


over the alphabet {O, 1}2 asfollows:

1. The set of states is S = {Sg, f}.

2. Sg is the "guessing" state and is the initial state.

3. The transition diagram M is defined as:

(a) M(f, (8)) = M(f, (m = {(f, f)}.


(b) M(sg, (8)) = M(sg, (b» = {(Sg, f), (f, Sg)}.
(c) M(sg, (l)) = {(f, f)}.

4. F = {{f}}.
6.5. Definability in T and Decidability of S2S 347

The connection between the automaton and the formula X2 EX, is the following.
For all B, C T and b2 E T, the automaton A accepts the tree tree(BI, b2) if and
only ifb2 E B,. In other words, tree(BI, b2) E L(A) ifand only ifT F= (b2 E BI)'

Example 6.5.9 Consider the atomic formula ro(x,) = X2. We define an automaton
A over the alphabet {a, I}2 as follows.

1. The set of states is S = {Sg, Sl, f}.


2. Sg is the "guessing" state and is the initial state.

3. The transition digram M is defined as:

(a) M(f, (8)) = {(f, f)}.


(b) M(sg, (8)) = {(Sg, f), (f, Sg)}.
(c) M(sg, (6)) = {(s" f)}.
(d) M(s" (n) = {(f, f)}.

4. :F = {{f}}.

The connection between the automaton and theformula ro(x,) = X2 is thefollow-


ing. For all b, C T and b2 E T, the automaton A accepts the tree tree(b" b2)
if and only if L(bl) = b2· In other words, tree(b" b2) E L(A) if and only if
T F= L(bl) = b2·

Now we give a definition. The definition requires some notation. From now
on, X and x denote the sequence XI, ... , Xm-k of set variables and the sequence
Xm-k+', ... , Xm of individual variables, respectively. We use similar notations for
sequences of sets and elements in T. For example 8 c A simply means that
B" ... , Bm-k is a sequence of subsets of A.
Definition 6.5.2 Let <I>(X, x) be aformula and let A be a Rabin automaton over
{a, l}m. The automaton A represents <I> (X, x) if for all subsets 8 c T and
elements bET, the automaton A accepts tree(8, b) if and only if T satisfies
<1>(8, b).

The two examples above show that the formulas X2 EX, and L(x,) = X2
are represented by automata.

Exercise 6.5.5 Show that the following formulas are represented by Rabin au-
tomata.

1. Sub(X):

Sub(X) = Vx(x E X --+ L(x) E X & R(x) EX),


348 6. Applications of Rabin Automata

2. x .:s y:
VX(Sub(X) & x EX -+ Y EX).

3. tl (x) = t2(Y), where tl and t2 are fixed terms of the structure T.

4. t(x) E Y, where tis a fixed term.

Lemma 6.5.1 Suppose that Rabin automata Al and A2 represent the formulas
¢I (X, x) and ¢2(X, x), respectively. Then there exist Rabin automata represent-
ing
¢I (X, X)/L¢2(X, x), --'¢I (X, x), QiXi¢1 (X, x), and QjXj¢1 (X, x),
where /L E {V, &, -+}, Qj E {V, 3}, j = 1, ... , m - k, i = m - k + 1, ... , m.
Proof. Given Rabin automata Al and A2, we can consider the automata
Al EBA2, Al x A2, and Af that accept the union L(AI) U L(A2), the intersection
L(Ad n L(A2), and the complement of L(AI), respectively. Using the assump-
tion that for each i = 1,2 the automaton Ai represents ¢iCX, x), and using the
fact that Rabin recognizable languages are closed under union, intersection, and
complementation, we see that the automata

represent the formulas

respectively. This can be proved in a standard way as we did for Biichi automata.
Now suppose that ¢(X, x) is 3Xi¢1 (X, x). Without loss of generality, we
can assume that Xi = X I. Consider the Rabin automaton A lover the alphabet
b = to, l}m which represents the formula ¢I (X, x). The alphabet b is bl X
b2, where bl = to, I} and b2 = to, l}m-I. By the Projection Theorem about
Rabin recognizable languages, there exists an automaton B which accepts the
projectio~pr2(L(AI» of the set L(AI)' Then it is not hard to see that B represents
3Xl ¢I(X, x).
Similarly, one can prove that there exists an automaton which represents
3xj¢I(l"1, bm-k+I, ... , Xj,"" bm). 0

Exercise 6.5.6 Finish the proof of the lemma in greater detail.


Lemma 6.5.2 Let ¢ be an atomic formula. There exists an automaton which rep-
resents ¢.

Proof. The first two examples at the beginning of this subsection show that
the lemma is true for the atomic formulas X2 E X I and L(xI) = X2. For the other
atomic formulas see Exercise 6.5.5.0
From the above lemmas we have the following theorem.
6.5. Definability in T and Decidability of S2S 349

Theorem 6.5.2 There exists a procedure which for every monadic second order
formula <I> (X, x) constructs a Rabin automaton A representing the formula.

Proof. We first note that the operations that produce Rabin automata accept-
ing the union, intersection, complements, and projections of Rabin recognizable
languages can be carried out effectively. Now the proof of the theorem is by in-
duction on the complexity of the formula <I> (X, x). The lemma above proves the
theorem for atomic formulas, that is for the basic step of our induction. Lemma 6.5.1
of this subsection proves the inductive step and hence the theorem.

6.5.5 Definability and Decidability. Consider the set P (T) of subsets of T.


Let R be a collection of m-tuples of subsets of T. We recall that R C p(T)m is
definable if there exists a monadic second order formula <I> (X 1, ... , Xm) such that
R = {(B1, ... , Bm)IT2 F= <I>(B1,"" Bm)}. The relationship between {a, l}m-
valued trees and m-tuples of subsets of T suggests the following definition.

Definition 6.5.3 The set ReP (T)m is Rabin definable if there exists a Rabin
automaton A such that the language

LR = (tree(B) IBE R}

is accepted by the Rabin automaton A.

Thus, by this definition any set R of m-tuples of sets naturally determines


the language LR of {a, l}m-valued trees. The two theorems proved in the previous
two subsections give us the following fundamental result that connects Rabin
recognizable languages with definable relations.

Theorem 6.5.3 A set ReP (T)m is definable if and only if R is Rabin definable.

Proof. The proof is in fact provided in the previous two subsections. The-
orem 6.5.1 shows that any Rabin definable relation is definable. Similarly, The-
orem 6.5.2 shows that any definable relation is Rabin definable. The theorem is
proved.

Theorem 6.5.4 The monadic second order theory of two successors, that is S2S,
is decidable.

Proof. Let \II be a sentence. We want to check whether or not \II belongs to
S2S. We can assume that \II is equivalent to a formula either of the form 3x <I> (x)
or of the form 3X<I>(X). Consider the case when the sentence \II has the form
3X <I> (X). The case when \II is of the form 3x <I> (x) is treated similarly. There exists
a Rabin automaton A that represents <I>(X). Therefore, for all subsets B1 C T, the
structure T satisfies <I> (Bd if and only ifthe Rabin automaton A accepts tree(B1)'
Thus, there exists a B1 C T such that T satisfies <I> (Bd if and only if there exists
a tree of the form tree(B1) accepted by A. It follows that 3X<I>(X) is true in T
350 6. Applications of Rabin Automata

if and only if L(A) =f:. 0. Thus, we have reduced the satisfiability problem for
3X<l>(X) to the emptiness problem for a Rabin automaton representing <l>(X).
Since the emptiness problem for Rabin automata is decidable, we see that S2S is
also decidable. This proves the theorem.

6.6 The Structure with (j) Successors


The structure with w successors is more complex than the structure T with two
successors. Informally, the structure has infinitely many successor functions. Intu-
itively the structure with infinitely many successors has more information than the
structure T. However, we will show in this section that the structure with infinitely
many successors can be interpreted in T.
Formally, the structure with w successors, denoted by T (j), is defined as fol-
lows.

1. The domain T(j) is the set of all finite words over the infinite alphabet
{O, 1,2,3, ... }. In other words,

T(j) = {O, 1,2,3, ... }*.


2. The structure has infinitely many unary successor operations denoted by
ro, r1, r2, .... Each ri is defined as follows. For all u E T(j),

ri(u) = ui.

3. The structure contains the prefix relation S For all u, v E T(j), u .::: v if and
only if either u = v or u is a prefix of v.

4. Finally the structure contains the lexicographic ordering~. For all u, v E T(j),
u ~ v if and only if there exists a prefix Z of both u and v such that for some
i <j,ri(Z)':::uandrj(Z)':::v.

Thus, the structure T (j) we have just defined is written as:

T (j) = (T(j), ro, r1, ... , .:::, ~).

We note that unlike the case with two successors, the relations.::: and ~ belong to
the type of the structure T (j). Our goal is to show that the monadic second order
theory of the structure T (j), denoted by SwS, is decidable.
In order to show that SwS is decidable we proceed as follows.

1. We will construct a definable subset D of T.

2. By induction on i, we will construct a unary function Ii on D such that fi


is definable.
6.6. The Structure with w Successors 351

3. We will also construct two definable relations S I and ::S I on D.

4. We will then guarantee that the structure T (J) is isomorphic to the structure
(D, fo, II, ... , SI, ::Sj).

Given the fact that T is isomorphic to the structure (D, fo, II, ... , SI, ::sj), by
(J)

Proposition 6.4.1, these two structures have the same theory. Having these D,
fo, ... , ii, ... , S I, and ::S I defined, we then can show that the monadic second
order theory of T is decidable.
(J)

The lemma below shows that it suffices to construct the set D, functions ii,
relations S I and ::S I that satisfy the conditions above.

Lemma 6.6.1 [fthere exist D, ii, i E w, SI and::Sl that satisfy conditions (1),
(2), (3), and (4) stated above, then the theory SwS is decidable.

Proof. The idea is quite simple. We take any sentence <I> of the structure T (J)

and transform it into a sentence <I>(t) of the structure T. The transformation should
preserve satisfaction: <I> is satisfied in T if and only if <I>(t) is satisfied in T. Since
(J)

S2S is decidable, we then see that SwS is also decidable.


Here now is the process for the transformation of <I> into <I>(t). The process uses
the fact that the functions ii, relation S I, ::S I and the domain D are all definable.
First, we transform any term q of the language of T into the term qt by replacing
(J)

each ri occurring in q with ii. Then we have the following:

• The atomic formula q E X is transformed into the formula qt EX, where q


is a term

• The atomic formula ql = q2, where ql and q2 are terms, is transformed into
the formula qf = q~.

• The formulas x S y and x ::S y are transformed into x SlY and x ::S I Y,
respectively.

• The formula (<I>I &<I>2) is transformed into (<I>i t )&<I>~)).

• The formula (<I>I V <I>2) is transformed into (<I>it) V <I>~)).


• The formula (<I>I -+ <I>2) is transformed into (<I>i t ) -+ <I>~)).

• The formula (--.<I» is transformed into --.<I>(t).

• The formula 'v'X<I> is transformed into 'v'X(X C D -+ <I>(t)). Similarly, the


formula 'v'x<I> is transformed into 'v'x(x E D -+ <I>(t)).

• The formula 3X<I> is transformed into 3X(X C D & <I>(t)). Similarly, the
formula 3x<I> is transformed into 3x(x E D & <I>(t)).
352 6. Applications of Rabin .(Al.utomata

Now it is not hard to see that for any sentence <1>, <I> is in SwS if and only if
<1>(1) is in S2S. 0

Exercise 6.6.1 Finish the proof of the lemma in greater detail.

Now our goal is to find the set D and functions fi' i E w, that satisfy the
conditions (1), (2), (3), and (4) above.
Let D be the set

The set D contains, for example, all strings of the form 10, 110, 1110, 1n O, n > 0.

Lemma 6.6.2 The set D is definable.

Proof. Note that y E D if and only if either y = A or R(A) ~ y and there


is a proper prefix x of y such that L(x) = y and for every proper prefix XI of y if
L(xI) < y, then R(L(xd) < y. So now consider the formula ¢(y):

(y = A) v [(R(A) ~ y & 3x(x < y & L(x) = y)


& 'v'XI (L(xd < y ---+ R(L(xI)) < y)].

We leave the reader to check that y E D if and only if T satisfies ¢(y). We leave
it to the reader to check the rest of the proof.

Exercise 6.6.2 Show that the formula ¢ (y) considered in the lemma above defines
the set D.

We are now ready to define functions Ii, i E w on the set D. To define fi,
we need first to define the relations ~I and ~I. Well, the definitions of ~I and ~I
are quite easy. We say that x ~ I Y if and only if x, y E D and x ~ y, where ~ is
the prefix relation on T. Thus, ~I is simply the restriction of ~ on the set D. The
ordering ~ I is also defined to be the restriction of the original ~ to the set D.

Lemma 6.6.3 Let xED. Then the nodes x 10, x 11 0, x 1110, ... have the following
properties:

1. The nodes belong to D.

2. If y E D is distinct from x and

T F x ~I Y & 'v'z E D (x ~I Z &z ~I Y ---+ Z = x V Z = y) ,


then y = x 1 no for some n ~ 1. Moreover,
x10 ~I x110 ~I x1110 ~I ....
6.6. The Structure with w Successors 353

Proof. We leave it to the reader to prove the lemma in the exercise below. D
Exercise 6.6.3 Prove the lemma above.
For each xED, we call the elements
xlO, x110, x 1110, ...
D-immediate successors of x. Now we define the operations fo, !1, ... by induc-
tion on i.
Basic Step. fo{x) = y if and only if x, y E D and y is the smallest D-
immediate successor of x with respect to the lexicographical ordering ~ 1 such that
x ~I y.
Induction Step. Suppose that fo, ... , fi have been defined. Then fi + 1(x) =
y if and only if x, y E D and y is the smallest D-immediate successor of x with
respect to the lexicographical ordering ~ 1 such that y =1= fk (x) for all k ::: i.
Exercise 6.6.4 Let xED. Prove that fi(x) = xli+IOforali i.
The next lemma (and the exercise) shows that each function fi is definable.
Lemma 6.6.4 Each function fi, i E w, is definable.
Proof. Clearly, fo is definable because so are the set D and the relation
:::1. Assume that fo, ... , fi are definable. Then clearly fi+1 is definable since the
definition of fi+1 involves the definitions of D, fo, ... , Ji, and:::1 and ~I. This
proves the lemma.
Exercise 6.6.5 Write down, by induction, the formulas defining each of the func-
tions fi, i E w.
Lemma 6.6.5 The structure (D, fo, !1, ... , :::1, ~I) is isomorphic to the struc-
ture T (j).
Proof. We define a mapping g from T (j) on D as follows. Let u be in T(j)'
Then
u = rio('" (rin(A)) ... )
for some sequence rio, ... , ri n of the successor functions. Note that A E D. Then
we set g(u) to be
fio ( ... (fin (A)) ... ).
It is not hard to see that g is indeed an isomorphism from T (j) onto (D, fo, !1, ... ,
::: 1, ~ I)' The lemma is proved.
From these lemmas we obtain the following theorem.
Theorem 6.6.1 The theory SwS is decidable. 0
Exercise 6.6.6 Let Tn be the structure with exactly n successor functions, n > 2.
Consider SnS, the monadic second order theory ofTn. Prove that SnS is decidable.
354 6. Applications of Rabin Automata

6.7 Applications to Linearly Ordered Sets


We recall that a partially ordered set (A, :s) is linearly ordered if for all x, YEA
either x :s y or y :s x. We refer the reader to the first chapter to go through some ex-
amples of linearly ordered sets. The goal of this section is to prove that the monadic
second order theory of all countable linearly ordered sets is decidable. In order to
prove this result we need to present two simple but interesting algebraic theorems
about linearly ordered sets. The first result states that any countable linearly or-
dered set can be embedded into the linearly ordered set of rational numbers. The
second result states that two dense countable linearly ordered sets with no greatest
and smallest elements are isomorphic. The proofs of these results are not hard but
constitute a basis for the known back and forth argument constructions in model
theory and algebra. The first subsection will be devoted to proving these algebraic
facts. In the second subsection we will show that the monadic second order theory
of all (countable) linearly ordered sets is decidable.

6.7.1 Two Algebraic Facts. We begin with the following definition, important
in achieving the goal of this section. Roughly, the definition formalizes the concept
of one linearly ordered set being inside some other linearly ordered set.

Definition 6.7.1 A linearly ordered set (B, :s) is embedded into a linearly ordered
set (A, :s) if there exists a mapping f from B into A such that

1. for all x, y E B, ifx :s y, then f(x) :s fey);

2. for all distinct x, YEA, f(x) =1= fey).

Thefunction f is called an embedding of(B, :s) into (A, :s).

Example 6.7.1 Every finite linearly ordered set is embedded into (w, :s).
To see this take a finite linearly ordered set (A, :s). List all elements ao <
... < an of A in the order of A. Map each ai into i. The mapping is an embedding
of (A, :s) into (w, :s). In fact, one can show that any finite linearly ordered set can
be embedded into any infinite linearly ordered set.

Example 6.7.2 The linearly ordered set (w, :S) is embedded into (Z, :s). In turn,
(Z, :s) is embedded into (Q, :s), where Q is the set of all rational numbers.

Exercise 6.7.1 Let L be an infinite linearly ordered set. Show that allfinite linearly
ordered sets can be embedded into L.

Informally, if a linearly ordered set (B, :s) is embedded into linearly ordered
set (A, :s) then we can assume that (A, :s) is bigger than (B, :s). A natural question
arises as to whether there exists the largest (countable) linearly ordered set. The
next theorem answers the question positively.
6.7. Applications to Linearly Ordered Sets 355

Theorem 6.7.1 Any countable linearly ordered set (A,::;) can be embedded into
(Q, ::;), that is the linearly ordered set of rational numbers ordered naturally.

Proof. Since A is countable we count all elements of A without repetition:

Note that the sequence above is not necessarily in increasing order with respect
to the ordering in A. Now we build our embedding from (A, ::;) into (Q, ::;) by
stages. At each stage we define a mapping ft on at and set ft to be equal to ft-I on
all ao, ... , at-I. Thus ft will extend the previously defined mapping ft-I. We then
set f to be the mapping obtained by taking the union of all ft s. The construction
then will guarantee that f is the function that sets up an embedding from (A, ::;)
into (Q, ::;).
Stage O. We send ao to any rational number we like, say qo. So we set fo(ao)
=qo·
Stage 1. We take al. There are two cases to consider. The first case is that
ao < al. In this case we assign to al any rational number we like, say ql, which is
greater than qo. The second case is that ao > al. In this case we assign to al any
rational number we like, say ql, which is now less than qo. In either case we set
fl (al) = ql and fl (ao) = fo(ao)· Clearly, fl extends fo·

Stage t + 1. Assume that we have defined the function fr at the previous


stage. Assume that ft (ao) = qO, ... , ft (at) = qt. Let us list all elements from
tao, ... , at} in strictly increasing order with respect to the ordering::; in A:

By the inductive assumption on the function ff, we can also assume that we have
the following sequence of rational numbers in increasing order (with respect to the
ordering of rationals):

Now take at+l. We want to assign a rational number qt+1 to the element at+1 so
that for all x, yon which ft+1 is defined, x ::; y if and only if ft+1 (x) ::; ft+1 (y).
For at+1 we now have three cases.
Case 1. at+1 is greater than all qO, ... , qt. In this case we assign to at+1 any
rational number we like, say qt+ I, which is greater than all qO, ... , qt.
Case 2. at+1 is less than all qO, ... , qt. In this case we assign to at+1 any
rational number we like, say qt+ I, which is less than all qO, ... , qt.
Case 3. Assume that at+1 is between aik and aik+l for some 0 ::; k ::; t - 1.
In this case we assign to at+1 any rational number we Ii~, say qt+l, which is
356 6. Applications of Rabin Automata

between qik and qik+l . Note that such a rational number exists since between any
two distinct rational numbers there exists another one.
Now set ft+1 (at+1) = qt+1 and leave the value of ft+1 on all ao, ... , at as
before and go on to the next stage.
Thus, we have described our construction at stage t + 1. We set f to be the
union of all fts, t E w, constructed. In other words in order to compute the value
of f on an element a, we do the following. We find the stage t at which at = a.
Compute ft(at). Set f(a) to be ft(ac).
Now we leave it to the reader to check that f is indeed a desired isomorphic
embedding from (A, ~) into (Q, ~). 0

Exercise 6.7.2 Show that the mapping f constructed in the proof of the theorem
sets up an isomorphic embedding.

Exercise 6.7.3 Prove that (w, ~) cannot be embedded into (w-, ~), where w- is
the set of negative integers.

Exercise 6.7.4 Give an example of a countable linearly ordered set (A, ~) with
the following properties:

1. Any countable linearly ordered set can be embedded into (A, ~).

2. The linearly ordered set (A, ~) is not isomorphic to the linearly ordered set
(Q, ~) of rationals.

We now will prove the second fact about linearly ordered sets. The facts
basically tells us that any linearly ordered set which exhibits properties of the
rationals (Q, ~) is in fact isomorphic to the rationals. The linearly order set of the
rational numbers (Q, ~) has the following two properties:

1. (Density) For all x, y E Q if x < y, then there exists a Z E Q such that


x < Z < y.

2. The linearly ordered set (Q, ~) possesses neither a greatest nor a smallest
element, that is, for any x E Q, there exist elements y, Z E Q such that
x < y and Z < x.

Definition 6.7.2 A linearly ordered set (A, ~) is Q-like ifit is dense and possesses
neither a greatest nor a smallest element.

Now we prove our second algebraic fact about linearly ordered sets.

Theorem 6.7.2 Two countable Q-like linearly ordered sets are isomorphic. In
particular, every Q-like countable linearly ordered set is isomorphic to the linearly
ordered set of rationals (Q, ~).
6.7. Applications to Linearly Ordered Sets 357

Proof. The proof uses the idea of the proof from the previous theorem. So let
(A, :::::) and (B, :::::) be two countable Q-like linearly ordered sets. We prove that
these two are isomorphic based on the known back and forth argument, a refined
version of the proof from the previous theorem. We construct an isomorphism from
(A, :::::) onto (B, :::::) by stages. At even stages we make sure that elements of A are
being assigned to elements of B and at odd stages we make sure that elements of
B are covered by elements of A.
Since A and B are countable we count, without repetitions, all elements of
A and B:

respectively. We call the first sequence the A-list and the second sequence the
B-list. Here is the construction.
Stage O. We send ao to boo Set fo(ao) = boo
Stage 1. We take bl. There are two cases to consider. The first case is that
bo < bl. In this case we assign to bl the first number ail in the A-list which is
greater than ao. The second case is that bo > bl. In this case we assign to bl the
first ail in the A-list which is less than ao. In either case we set!J (ail) = bl. Note
that in either case the element ail exists.
Stage t + 1 = 2k. Assume that we have defined the function ft at the previous
stage. List all the elements in the domain of ft in increasing order with respect to
the ordering in A,

By the inductive assumption on function ft. we can assume that we have the
following sequence of elements in B listed in increasing order with respect to the
ordering in B,

so that ft (aio) = bio' ... , It (ai t ) = bit' The induction hypothesis also allows us
to assume that the elements ao, ... , ak-I belong to the domain of ft. Now take
the first element aiHI in the A-list which does not belong to the domain of ft. We
wantto assign an element biHI to aiHI so that for all x, yon which ft+ I is defined,
x ::::: y if and only if It+1 (x) ::::: It+1 (y). For ait+l we now have three cases.
Case 1. ait+l is greater than all aio' ... , ai t . In this case we assign to ait+l
the first element in the B-list, say bit+l' not in the range of ft greater than all
bio' ... , bit'
Case 2. ait+l is less than all aio' ... , ai t . In this case we assign to ait+l the
first element in the B-list, say biHI not in the range of ft less than all bio' ... , bit'
Case 3. Assume that ait+l is between aik and aik+l for some 1 :::: k :::: t - 1.
In this case we assign to ait+l the first element, say bit+l' in the B-list which is
between bik and bik+l'
358 6. Applications of Rabin Automata

We note that in each of the cases above the element bit+l desired exists
because (B, .::::) is a Q-like linearly ordered set. Now set ft+1 (ait+l) = bit+l and
leave the value of ft+1 on all ao, ... , air as before. Go to the next stage.
Stage t + 1 = 2k + 1. Do exactly the same as above by replacing elements
in the A-list with the elements in the B-list. Go to the next stage.
Now we set f to be the union of all fts, t E w, constructed. In other words,
in order to compute the value of f on an element a, we do the following. We find
the stage t at which the construction assigns an element b to a. Note that such a
stage t exists. Compute ft(a). Set f(a) to be ft(a).
We leave it to the reader to check that f is indeed a desired isomorphism
from (A, .::::) onto (B, .::::).0

Exercise 6.7.5 Finish the proofofthe theorem above by showing that thefunction
f constructed is indeed an isomorphism.

Exercise 6.7.6 Give examples of two uncountable Q-like linearly ordered sets
which are not isomorphic.

6.7.2 Decidability. In this part we use the two algebraic facts proved in the
previous subsection in order to show that the monadic second order theory of
countable linearly ordered sets is decidable. Here is the main theorem of this
section.

Theorem 6.7.3 The monadic second order theory ofall countable linearly ordered
sets is decidable.

Proof. We begin by explaining the idea. We show that there exists a definable
subset D of the binary tree T and a definable relation -:SD on D such that (D, '::::D)
is a linearly ordered set isomorphic to the linearly ordered set (Q, .::::) of rational
numbers. Then by the theorem about embeddings of linearly ordered sets into
(Q, -:s) (see Theorem 6.7.1), we have the following. For every linearly ordered set
(B, -:s) there exists a subset C C D such that (B,'::::) and (C, '::::D) are isomorphic.
Therefore, the set of all sentences of the monadic second order logic true in all
countable linearly ordered sets coincides with the set of all sentences that are true
in all (C, '::::D), where C C D. Hence the idea is to take any sentence F of the
monadic second order language of linearly ordered sets and transform it into a
sentence F(t) of S2S. The transformation should preserve the truth value of the
sentences. In other words, F(t) is in S2S if and only if F is true in all linearly
ordered sets.
Now we implement the idea described above. Let D be

D = {u 101 Iu E T and the string 101 occurs in u 101 just once}.


Lemma 6.7.1 The set D is definable.
6.7. Applications to Linearly Ordered Sets 359

Proof. It is easy to check that U E D if and only if there exists a v :s u such


that the following conditions are satisfied:

2. For all VI :s u it is not true that rl (ro(fJ (vd» < v.


Clearly, the statement above can be expressed in the monadic second order logic
of two successors. The lemma is proved.
We denote the formula that defines the set D in the lemma above by D(x).
Let -::5.D be the restriction of -::5. to the set D. Since -::5. and D are definable we see
that -::5.D is also a definable relation.
Lemma 6.7.2 The pair set (D, -::5.D) is isomorphic to the linearly ordered set (Q,
:s) of rational numbers.
Proof. Since -::5.D is obtained by restricting -::5. to the D and -::5. is a linear
ordering on the set of all nodes of the tree T, clearly (D, -::5.D) is a linearly ordered
set. We need to show that (D, -::5.D) is Q-like. Then by Theorem 6.7.2, the lemma
will be proved.
Let u 101 be in D. Then u 1101 and u00101 are both in D. Note that ulOl -::5.D
ull01 and uOOlOl -::5.D ulOl. We conclude that (D, :SD) has neither maximal nor
minimal elements. Now assume that uIOl -::5.D vIOl. Then for some w we have the
following: ulOl = wOullOl and vIOl = w1v21Ol. Then clearly W1V200I01 E
D. We conclude that ulOl -::5.D W1V200I01 -::5.D vIOl. Hence the linearly ordered
set (D, -::5.D) is Q-like. By Theorem 6.7.2, (D, -::5.D) is isomorphic to (Q, :s). The
lemma is proved.
Now we need to prove the theorem. Let F be a formula of the monadic
second order logic of linearly ordered sets. We transform F into the formula F(t)
by induction as follows.
Basic Step. Atomic formulas x :s y and x E X are transformed into x -::5.D y
and x E X, respectively.

Induction Step. If <I> is of the form <l>rr<l>2, where r E {v, &, -+} or <I> =
--.<1>1, then we set <I>(t) to be <I>\t)r<l>g), where r E {v, &, -+} or <I> = --.<I>\t) ,
respectively. If <I> is any of the formulas

then we transform <I> into

respectively. If <I> is any of the formulas


360 6. Applications of Rabin Automata

then we transform it into


'v'Z3x(Z ~ D --+ x E Z & <I>~t)(x», 'v'Z3X(Z ~ D --+ X ~ Z & <I>~t)(X»,
respectively. Now the reader can check that <I> is true in all countable linearly
ordered sets if and only if the transformed formula <I>(t) belongs to S2S. Thus,
we can conclude that the monadic second order theory of all countable linearly
ordered sets is decidable (see the exercise below for details). D
Exercise 6.7.7 Consider the transformation from <I> into <1>(1) in the proof above.
Prove that for every sentence <I> of the monadic order logic of linearly ordered
sets, <I> is true in all countable linearly ordered sets if and only if the transformed
formula <I>(t) belongs to S2S.
Exercise 6.7.8 Call a linearly ordered set (A, :s) well-ordered ifevery non empty
subset of A has a minimal element with respect to the ordering :So Do the following:
1. Show that (w, :s) is a well-ordered set.
2. Show that if L\ and L2 are well-ordered sets, then so are L\ x L2 and
L\ + L2. (See the first chapter for the definitions of + and· operations.)
3. Show that the monadic second order theory of all countable well-ordered
sets is decidable.
Exercise 6.7.9 A tree is a partially ordered set (A, :s) such thatfor all x E A the
set {y I y :s x l is linearly ordered with respect to the ordering :s of A. Prove that
the monadic second order theory of all finite trees is decidable.
Exercise 6.7.10 A forest is a partially ordered set (A, :s) such that there exist
pairwise disjoint subsets {Bi liEf such that
1. A = UEf Bi;

2. for each i E I, the partially ordered set (Bi, :s) is a tree;


3. for all distinct i, j E I and all x E Bi, Y E B j, the elements x and yare not
:s-comparable.
Show that the monadic second order theory of all finite forests is decidable.
Exercise 6.7.11 A partially ordered set (A, :s) is a linear atlas if there exist pair-
wise disjoint infinite subsets {Bi liEf such that
1. A=UEfBi;
2. for all i E I, (Bi, :s) is a linearly ordered set;
3. for all distinct i, j E I, all x E Bi, and y E Bj, the elements x and yare
not comparable.
Show that the monadic second order theory of all countable linear atlasses is
decidable.
6.8. Application to Unary Algebras 361

6.8 Application to Unary Algebras


In this section we consider the class of structures known as the class of unary
algebras. The section shows that the monadic second order theory of the class of
unary algebras is decidable. The proof, as in the previous two sections, consists of
two parts. First we provide some algebraic facts about unary algebras. In particular,
we show that there exists, in some sense, universal unary algebras into which all
unary algebras can be embedded. Second, based on the algebraic facts, we provide
a reduction of the monadic second order theory of unary algebras to S2S. This
reduction is more sophisticated than the ones used in the previous two sections.

6.8.1 Unary Structures. Unary algebras are simple mathematical structures that
consist of domains and unary operations on the domains. Here is a formal definition.

Definition 6.8.1 A unary algebra is a pair (A, f) consisting of a set A called the
domain and a unary operation f : A -+ A on the set A.

So we see that the language of the class of unary algebras contains just one
functional symbol of arity 1. One can give many examples of unary algebras. Here
are some of them:

1. The unary algebra (w, S) whose domain is wand the unary operation is the
successor function.

2. The unary algebra (w, x -+ x 2 ), where the unary operation maps every
number n to n 2 .

3. The unary algebra (Q, x -+ 5x), where the unary operation maps every
rational number q to 5 x q.

4. (R, sin(x)), where R is the set of all real numbers and sin(x) is the sine
function.

Our goal is to show that the set of all sentences of the monadic second order logic
which are true in all countable unary algebras is decidable.
We need to develop some terminology for unary algebras. So let (A, f) be a
unary algebra. Take an a EA. Consider the sequence:

where fD(a) = a and fk+l (a) = fUk(a)) for all k 2: 1. We call this sequence
the orbit of a. Set O(a) = {fi (a) liE w}.

Definition 6.8.2 Two elements a and b of a unary algebra (A, f) are connected
iffor some n, mEw, fn(a) = fm(b). If a and b are connected we denote it by
a "'-' b.
362 6. Applications of Rabin Automata

n
Hence a and b are equivalent if their orbits meet. Thus, if O(a) O(b) =F 0,
then a and b are connected. It is not hard to prove the following lemma.

Lemma 6.8.1 The relation ~ is an equivalence relation. 0

Exercise 6.8.1 Prove the lemma.

Definition 6.8.3 A unary algebra (B, g) is a subaJgebra of the unary algebra


(A, f) if B C A andfor all bE B, f(b) = g(b).

Thus, for example any orbit O(a) of the unary algebra (A, f) can be con-
sidered as a subalgebra of (A, f) because f(x) E O(a) for all x E O(a).
Let X C A be an ~-equivalence class of the algebra (A, f). Clearly, if
x EX, then f (x) EX. Therefore, X is closed under the unary operation f. This
allows us to consider the unary algebra (X, g), where g(x) = f(x) for all x EX.
Thus, (X, g) is a subalgebra of the original algebra (A, f). From the definition
of ~ we see that (X, g) satisfies the following property. For all x, y E X there
r
exist n, m E (V such that (x) = fm (y). This observation suggests the following
definition.

Definition 6.8.4 An algebra (A, f) is connected if for all a, b E A there exist


n, m E (V such that r(a) = fm(b).

n
Let (A, 11) and (B, h) be unary algebras such that A B = 0. Using these
two algebras we can form a new algebra (A U B, f), where f(x) = II (x) if
a E A, and f(x) = h(x) if x E B. We call this algebra the sum of (A, II) and
(B, h). Similarly, we can define the sum of infinitely many unary algebras

where Ai nA j = 0 for all i =F j. Thus, the sum is the algebra

wherefor all a E Al U A2 U A2 U A3 U"" we have f(a) = Ii (a) if a E Ai.


The next lemma shows the reason for introducing the sum of unary algebras.

Lemma 6.8.2 Every unary algebra (A, f) is a sum of connected unary algebras.

Proof. Consider the sequence AI, A2, ... of all ~-equivalence classes of the
algebra (A, f). Each Ai is closed with respect to f. Consider the restriction of f
to the set Ai. Let Ii be the restriction. Each (Ai, Ii) forms a connected algebra as
noted above. The union of all Ai s is A. Hence the sum of connected unary algebras
(Ai, Ii) is in fact the original unary algebra (A, f). The lemma is proved.
6.8. Application to Unary Algebras 363

6.8.2 Enveloping Algebras. This subsection explains enveloping algebras. In-


formally, these algebras are those that contain all connected algebras as their sub-
algebras. More formally, we begin with the following technical notion. An n-cycle
is the algebra ({O, ... , n - I}, f), where f(O) = 1, ... , f(n - 2) = n - 1,
f(n - 1) = O. An w-cycle is the algebra ({O, 1,2, ... }, S), where S is the succes-
sor function.

Definition 6.8.5 An algebra is called prime if it is isomorphic to either an n-cycle


for some nEw or the w-cycle.

The next lemma proves that every algebra contains a prime subalgebra thus
justifying the name given to prime algebras.

Lemma 6.8.3 Every unary algebra A contains a prime subalgebra.

Proof. Let a E A. Then the set {fm(a) I mEw} forms a subalgebra of


A. This subalgebra is either isomorphic to the w-cycle or contains a subalgebra
isomorphic to an n-cycle. The lemma is proved.

Definition 6.8.6 The signature of a connected algebra is n, nEW, if it contains


a prime subalgebra isomorphic to the n-cycle. Otherwise the signature is w.

The next lemmas show that the signature of any connected algebra is well
defined.

Lemma 6.8.4 The signature of every connected algebra is uniquely determined.

Proof. Let (A, f) be a connected algebra. Take an a E A. Consider the orbit


O(a) of a. If the orbit is infinite, then (A, f) contains a subalgebra isomorphic
to the w-cycle. Since (A, f) is connected, the signature of (A, f) must be w. If
the orbit is finite, then it contains a prime subalgebra isomorphic to some n-cycle.
Since A is connected any other orbit must contain the same prime subalgebra. This
proves the lemma.
Now we explain enveloping algebras. Informally, the enveloping algebra
of signature n, where n is a natural number or w, is an algebra into which any
connected algebra of the same signature can be embedded. This resembles the fact
that any linearly ordered set can be embedded into (Q, :s).

Definition 6.8.7 Let (A, f) be a prime algebra. The enveloping algebra (E, g)
of (A, f) is defined as follows. Let N be the set of all positive natural numbers.
Let N* be the set of all finite strings over N. Consider

E = A· N*.

On E we define the unary function g by the rule: g(ail ... ik) = ail ... ik-l if
k:::: 1; ifk = 0, then g(a) = f(a).
364 6. Applications of Rabin Automata

We note that each element of E is of the form ail ... ik. Note that A is
certainly a subset of E. In Figure 6.1 we present the enveloping algebra, when
A = {x, y} and f(x) = y, fey) = x. An arrow from a to b means that g(a) = b.

~4( .y~

xl x2 ........... .. yl y2 ............ .

~
xll
t
x12...... ....... x2l ............ .
~
yll y12 ............ .

Figure 6.1: An enveloping algebra.

We now need one definition in order to state some properties of enveloping


algebras.
Definition 6.8.8 We say that a unary algebra (B, h) is embedded into a unary
algebra (E, g) if there exists a mapping ¢ from B into E such that
• for all bE B, we have ¢(h(b)) = g(¢(b));
• for all bl =1= b2 in B, we have ¢(bl) =1= ¢(b2)'
The next lemma lists several properties of the enveloping algebra (E, g).
Lemma 6.8.5 The enveloping algebra (E, g) of (A, f) satisfies the following
properties:
1. The signature of(E, g) coincides with the signature of (A, f).

2. For each y E E there exist infinitely many x such that g(x) = y.


3. Let (B, h) be a connected algebra of the signature of (A, f). Then (B, h)
can be embedded into (E, g).
Proof. The proof of (1) follows from the definition of the signature. In order
to prove (2) take any element y E E. Then the unary operation g maps y 1, y2, y3,
... into y. We conclude that y has infinitely many x for which g(x) = y. We leave
it to the reader to prove the last part of the lemma. 0
Exercise 6.8.2 Finish the proof of the lemma above.
Thus, we conclude this subsection with the next results which, roughly speak-
ing, states that the sums of enveloping algebras are universal objects in the class
of all unary algebras.
Theorem 6.8.1 Every unary algebra can be embedded into a sum of enveloping
algebras.
6.8. Application to Unary Algebras 365

Proof. Let (A, f) be a unary algebra. Then we have already shown that
this algebra is a sum of connected algebras (AI, fJ), (A2, h), .... Consider the
enveloping algebra (Ei, gi) for each connected algebra (Ai, fi). Clearly, Ai C Ei
n
and (Ai, fi) is a subalgebra of (Ei, gi). Moreover, Ei Ej = 0 for all i i= j.
Also note that the mapping qi that maps each a E Ai into a itself is an embedding
of (Ai, fi) into (Ei, gi)· Hence, the algebra (A, f) is embedded into the sum of
enveloping algebras (E I , g 1), (E2, g2), .... This proves the theorem.

6.8.3 Decidability. In this subsection we use the algebraic facts proved in the
previous subsections in order to show that the monadic second order theory of all
countable unary algebras is decidable. Below is the main theorem of this section.
We note that the proof of the theorem contains some exercises whose proofs are
quite simple and follow from the definitions that will be provided.

Theorem 6.8.2 The monadic second order theory ofall countable unary algebras
is decidable.

Proof. The idea of proving the theorem is the following. We will interpret
the theory of unary algebras in SwS. We already know that SwS is interpreted in
S2S. Therefore, the theory of unary algebras will be decidable. Roughly speaking,
the interpretation of the theory of unary algebras in SwS will be done as follows.
We construct a formula F (x, y, Z) in the language of T so that the following
(V

properties hold:

1. For every subset C of T the set of pairs (x, y) for which F (x, y, C) holds
(v,

true determines a unary operation. Let us denote the unary operation by fc.

2. By (1), the structure (Dom(fc), fc) is a unary algebra.

3. The unary algebra (Dom(fc), fc) is a sum of enveloping algebras.

4. For every unary algebra (A, f) that is a sum of enveloping unary algebras,
there exists aCe T such that (Dom(fe), fe) is isomorphic to (A, f).
(V

From the results of the previous subsection we therefore can conclude the
following. Let (A, f) be a unary algebra. Then (A, f) can be embedded into a
unary algebra (E, f) which is a sum of enveloping algebras. By the assumption on
F (x, y, Z) there exists a set C C T such that the unary algebra (Dom(fc), f c) is
(V

isomorphic to (E, f). Therefore, there must exist a subset Cl of the set Dom(fe)
such that (A, f) is isomorphic to (CI, fc l ), where fCI is the restriction of fc to
the set C I. Thus, a sentence is true in all unary algebras if and only if the statement
relativized to all sets C and subsets CI of C that are subalgebras of (Dom(fe) , fe)
is true. Consequently, the existence of the formula F(x, y, Z) will allow us to
transform any sentence of the monadic second order logic of unary algebras into
a sentence of T This transformation will preserve the satisfaction properties of
(v.
366 6. Applications of Rabin Automata

formulas. We will formally show how to make this transformation at the end of the
proof. Let us now concentrate on constructing the formula F(x, y, Z).
We explain how to construct F (x, y, Z). The explanation will be clear enough
to see how to write down the formula F(x, y, Z). Let C be a subset of T w such
that the following properties hold:

1. Ciscontainedintheset{O"lOm In, m ~ 1}. Notethattheset {on Hyn In, m ~


I} is definable in the language of T w'

2. For every nEw, the set C contains at most one word of the form on 10m.

Note that there exists a formula <PI (X) in the language of T w such that <PI (C) is
true if and only if C satisfies the two properties above.

Exercise 6.8.3 Write down the formula <PI (X) whose existence is claimed above.

Now suppose that C satisfies the two conditions above. Take a natural number
n. If there exists an m such that 0" 10m E C, then let

An = {On Wi I i = 0, 1, 2, ... , m}.

If there does not exist an m such that on 10m E C, then let

Note that the sets Ao, AI, A2, ... are pairwise disjoint. Now set Bn = An' N*.
Thus x E Bn if and only if x = anil ... ik, where an E An, iI, ... , h are positive
integers and k E w. Define

Clearly, the set B(C) depends on the choice of C. Note that there exists a formula
<P2(X, Z) such that <P2(a, C) holds if and only if <PI (C) holds and a E B(C).

Exercise 6.8.4 Write down theformula <P2 (x, Z) whose existence is claimed above.

As we noted, for C that satisfies the formula <P I (X), the sets Ao, A I, ...
are pairwise disjoint. Hence the sets Bo, BI, ., . are also pairwise disjoint. The
domain of the unary algebra (Dom(fe), fe) will be the set B(C). We now need
to define the function !c on the set B(C). The idea in defining fc is that each Bn
will be an enveloping algebra, the function fe will be the predecessor function
on all elements of Bn not of the form 0" Wi. The definition of fc on on Wi will
be different depending on whether or not On 10i is in C. Here is a more formal
definition of !C. Take x in B(C). There exists an n such that x is in Bn. Then x
is of the form 0" Wi Z. Assume that z 1= A. Then !c(x) = pred(x). If z = A, then
we proceed as follows. If on Wi if- C, then f(x) = O"lOi + l ; otherwise, e.g., if
6.8. Application to Unary Algebras 367

on 10i E C, then f e (x) = on 1. In other words, f e is the function on Bn which acts


as the predecessor on all strings of the type on 10i z, where Z E N*, and makes a
cycle of length i on all strings on 1, ... , on 10i if on 10i belongs to C, or makes an
w-cycle if no on Wi belongs to C, i E w. Thus we have given a definition of the
unary algebra (B, fc). Note that this algebra depends on the choice of C and is a
sum of enveloping algebras.
Now we are ready to define the formula F(x, y, Z). The formula states that
the triple (a, b, C) satisfies the formula if and only if the following holds:
1. C satisfies the following properties:

(a) C C {onlO m ln, mEw}.


(b) For every nEw, C contains at most one word of the form On 10m.
2. The element a belongs to B(C).
3. The element b possesses the following properties:
(a) If a = on Wi z and z f A., then b = pred(a).
(b) If a = on Wi and x ¢. C, then b = ro(a).
(c) If a = on 10m and x E C, then b = on 1.

As already noted, properties 1(a), 1(b) and 2 can be defined in the monadic second
order logic of w-successors. It is also not hard to see that properties 3(a), 3(b) and
3(c) can also be expressed in this logic. Hence we can define the desired formula
F(x, y, Z).

Exercise 6.8.5 Write down the formula F (x, y, Z) whose existence is claimed
above.
Lemma 6.8.6 For any unary algebra (A, f) whichisasumofenvelopingalgebras
there exists a C such that the algebra (Dom(fe), fe) is isomorphic to (A, f).
Proof. From the definition of the formula F (x, y, Z) it is not hard to see
that there exists C C T such that the algebra (Dom(fe), fc) is isomorphic to
(J)

(A, f). D
Define the following formula AI(U, Z) using the formula F(x, y, Z):

VxVy(F(x, y, Z) --+ (x E U --+ Y E U».

Here is an interesting lemma about the formula AI(U, Z).


Lemma 6.8.7
if and only if U is closed
1. For all subsets U, C of T(J), Al (U, C) is true in T (J)
with respect to the unary operation fe, and hence (U, fe) is a subalgebra
of(DomUe), fc)·
368 6. Applications of Rabin Automata

2. For any unary algebra (A, 1) there exists U, C s:;; Tw such that (U, fc) is a
subalgebra of the unary algebra (Dom(fc), fc) and (U, fe) is isomorphic
to (A, 1).
Proof. The proof of Part (1) follows directly from the definitions of the
formula AI(U, Z), formula F(x, y, Z), and the unary algebra (Dom(fe), fc).
Part (2) follows from Lemma 6.8.6 and the fact that any unary algebra can be
embedded into a sum of enveloping unary algebras. This proves the lemma.
Let <I> be a formula of the monadic second order logic of unary algebras. We
transform <I> into the formula <I>(t) by induction as follows:
Basic Step. Atomic formulas f(x) = y and x E X are transformed into
F(x, y, Z) and x E X & Xc U, respectively.
Induction Step. If <I> is of the form <I> 1r <1>2, where r E {v, &, -+ } or <I> =
then we set <I>(t) to be <I>;t)r<l>g), where r E {v, &, -+} or <I> = -,<I>;t),
-,<1>1,
respectively. If <I> is any of the formulas
'v'x<l>l (x), 'v'X <1>1 (X)
then <I>(t) is
'v'x(x E U -+ <I>;t)(x», 'v'X(X c U -+ <I>;t)(X».

Similarly, if <I> is any of the formulas


3x <I> 1(x), 3X <1>1 (X),
then we replace <I> with
3x(x E U & <I>;t)(x», 3X(X c U & <I>;t)(X»,

respectively.
The next lemma basically states that a sentence <I> of the monadic second
order logic of unary algebras is true in all countable unary algebras if and only if
the relativization of <I> to all sets C and subsets C1 of C that are subalgebras of
(Dom(fc), fc) is true. Here is the lemma.
Lemma 6.8.8 For every sentence <I> of the monadic order logic of unary algebras,
<I> is true in all countable unary algebras if and only if the formula
'v'U'v'Z(AI(U, Z) -+ <I>(t»

belongs to SwS.
Proof. The proof follows immediately from the definitions of the formulas
F(x, y, Z), Al (U, Z) and the transformation from <I> into <I>(t). We leave the details
of the proof to the reader. 0
Exercise 6.8.6 Finish the proof of the last lemma in detail.
Thus, the lemmas above give us the proof of the theorem. 0
6.9. Applications to Cantor's Discontinuum 369

6.9 Applications to Cantor's Discontinuum


In this section we give other applications of the decidability of S2S. We introduce
and study objects related to the structure known as Cantor's discontinuum. Can-
tor's discontinuum is one of the fundamental structures often used in many areas
of mathematics and computer science (analysis, topology, geometry, Boolean al-
gebras, logic, game theory, fractals, set theory, etc.). This section begins with an
excursion into Cantor's discontinuum. Then, in the next subsections, we will prove
several decidability results about theories of structures that can be derived from
Cantor's discontinuum.

6.9.1 A Brief Excursion to Cantor's Discontinuum. We begin this section


with a known construction that produces a set called Cantor's discontinuum. Then
we will show that the set produced can be identified with the set of all paths through
the binary tree.
Let us take the interval [0, 1], the set of all real numbers between 0 and 1
including the endpoints. We construct Cantor's dis continuum by stages. At each
stage t we define the set Ct which will be a subset of [0, 1]. Then Cantor's dis-
continuum will be the set of all reals that belong to each Cr, t E w. Here is the
construction:
Stage O. We set Co = [0, 1].
Stage 1. Take the open interval (1,
~), that is the set of all reals between 1
and ~ not including the endpoints. Then Cl is the set of all reals in Co which do
not belong to the open interval (1,
~). Thus, Cl = Co \ ct,
~). Clearly, Cl C Co·
Stage 2. Consider C 1 which is the union of the two closed intervals [0, 1]
and [~, 1]. Take the middle third of each of these intervals, that is take the open
intervals (-iz, fz)
and (?r,
~) (without endpoints). Then C 2 is the set of all reals
in Cl that do not belong to (iz, fr) U(?z, fz-)' Clearly, C2 C Cl C Co.
Stage t + 1. We assume, by induction, that C t has been constructed and
C t C C t -l. Also the induction hypothesis tells us that Ct is the union of certain
closed intervals, that is,

Ct = [0, 3 L1 JU[3t~I' 3t~1 Ju··· u [3t~:_~ 1, IJ.


Thus, Ct is a disjoint union of2t closed intervals. Let It, ... , h be all the intervals
participating in the union. So k = 2t. Each 1m is of the form [3t~1 , ~;::l]. Let 1m
be the middle third of the interval 1m, that is, 1m = ( 3x3t1 , 3~t2). Then, set
C t +l = C t \ (11 U h U ... U h).
Clearly, C t+l C C t , and C t +l is a union 2t+l closed intervals. This ends this stage
of the construction.
370 6. Applications of Rabin Automata

Now we define the set C as the intersection of all CtS constructed:

Now our goal is to present some of the basic properties of the set C. We note that
the set C is not empty since the real numbers -jr, i = 0, ... , Y belongs to C t for
all t E w. Now we will show that reals in C can be identified with paths through
the binary tree T in a certain precise sense. To do this we recast the construction
of the set C.
Let us consider the first three stages of the construction of C. At stage 0 we
have one closed interval, denoted by Co. At the next stage, stage 1, the set CI is
split into two disjoint intervals 10 and h so that 10 = [0,1] and h = [~, 1]. At
the next stage, the set C2 is split into four disjoint intervals, let us denote them by
100, 10l, 110, III so that

Note that 100 and 10l are subsets of 10, and 110 and III are subsets of h.
In general, at stage t of the construction of C, the set C t is a union of 2t
closed intervals lu so that the following properties hold:

1. u E {O, 1}*.

2. The length of u is t.

3. Ifu f= v and lui = Ivl = t, then lu n Iv = 0.


4. For all u E {O, 1}*, if lui = t - 1, then luo U lui C lu.
Thus, we have the following lemma whose proof is left to the reader.

Lemma 6.9.1 The mapping u ~ lu has the following properties:

1. If lu I = t, then lu is one of the closed intervals that participates in the union


defining the set Ct. Moreover, the length of the interval lu is 3- lul .

2. Ifu:s v, then Iv is a proper subset oflu.

3. Ifu and v are not prefixes of each other, then lu n Iv = 0. 0


Exercise 6.9.1 Prove the lemma.

Now let us take an infinite string ex = ex (0) ex (1) ex(2) ... so that ex E {O, lY.v.
Consider the sequence of closed intervals:

la(O) ::) la(O)a(l) ::) la(0)a(l)a(2) ::) la(0)a(l)a(2)a(3) ::) ....


6.9. Applications to Cantor's Discontinuum 371

Since the length of the intervalIa(o,n) converges toO, wherea(O, n) = a(O) ... a(n-
1), the intersection of all these intervals is not empty and consists of exactly one
real. Denote this real by ra. Thus,

n
nEw
la(O,n) = {ra}.

We note that ra E C because ra belongs to every Ct.

Exercise 6.9.2 Prove that for all a, f3 E {a, l}w, if a =1= f3, then ra =1= rfJ·

Now let us take r E C. Then r E Ct for all t E w. Now for every t E w, let
Ut be such that r E lUI and the length of Ut is t. Note that such Ut exists and is
unique for every t. Moreover, Ut is a proper prefix of Ut+ 1. Hence we can consider
the sequence a E {a, l}w such that a(O, t) = Ut for all t. Hence r = ra. Thus,

and we conclude that we can identify the set C with the set of all infinite sequences
of the alphabet {a, l}w. Now we are ready to give the following definition.

Definition 6.9.1 Cantor's discontinuum is the set of all infinite sequences from
{a, l}w. We denote this set by CD.

Clearly, there exists a one-to-one correspondence between CD and all paths


of the tree T. Indeed, let

be an element of CD, where each ai is a member of {a, I}. Then we assign to this
element the set

where ro = Land rl = R. It is obvious that this set is a path of T. Similarly, to


any path

we assign the element

of the CD. This shows that there exists a one-to-one correspondence between sets
of paths in 72 and subsets of CD. Therefore, from now on, we identify Cantor's
dis continuum with the set of all paths through the binary tree T.
372 6. Appiications of Rabin Automata

6.9.2 Cantor's Discontinuum as a Topological Space. Certain subsets of CD


are of particular interest. These are, for example, subsets known as open subsets
of CD. One of the basic reasons to be interested in CD and its open subsets is that
they allow one to introduce the notions of limit, continuity, continuous functions,
and metrics in Cantor's discontinuum. The other reason to be interested in CD
is that some known structures of mathematics, e.g., boolean algebras, the real
numbers and many others, can be represented in CD in one or another way. The
topics concerning limits, continuity, continuous functions and metrics in Cantor's
discontinuum are beyond the scope of this book. Therefore, we will mainly deal
with the decidability of the theories of structures that can be expressed in terms of
CD and its subsets.
Let {3 be an element of CD. Assume that

We can consider the following sequence of subsets of CD:

{aoa I a E CD}, {aoaja I a E CD}, {aOaja2a I a E CD}, '" .

Each of the sets above is called an open basic set. Clearly, each of the above open
basic sets contains {3. So we give a formal definition of a basic open set.

Definition 6.9.2 Let x E {O, I}*. Then the set

Ux = {xa I a E CD}

is called a basic open set.

Thus for example, Uo and UI are two basic open sets. Uo contains all a in
CD that begin with 0; UI contains all a in CD that begin with 1.

Definition 6.9.3 A subset B C CD is open if either B = 0 or for every element


a E B there exists a basic open set U such that a E U and U C B.

We give some examples of open sets in CD.

Example 6.9.1 CD itself is an open set.

Example 6.9.2 B = Uoo U U11 is an open set. Indeed ifa E B, then a begins with
either 00 or II. In the first case a E U00 C B; in the second case a E U 11 C B.

It turns out that one can give a very nice characterization of open sets of CD.
To do this we first need a definition.

Definition 6.9.4 Let Xc {O, I}*. Then Ux = UXEX Ux '


Here now is the characterization of open sets in CD.
6.9. Applications to Cantor's Discontinuum 373

Theorem 6.9.1 Let B be a non empty subset of CD. Then the following are equiv-
alent:
1. B is an open set.
2. B is a union of basic open sets.
3. B = Ux for some X c {a, 1}*.
Proof. We prove the direction from (1) to (2). Let B be an open set. Then
for every element a E B there exists a basic open set U (a) such that a E U (a)
and U(a) c B. Clearly, B = UaEB U(a). Hence (2) is proved.
We now prove the direction from (2) to (3). Let B be a union of basic open
sets. Take an element a E B. Then there exists a basic open set Ux such that
Ux c B and a E B. Let A = Xo :s Xl :s x2 :s ... :s Xn be all prefixes of x.
Among these prefixes take the Xi such that UXi c B but UXi _\ yC B. Denote this
Xi by x(a). Now set
X = {x(a)la E B}.
We claim that U X = B. Indeed if f3 is in U x, then f3 E Ux(a) for some a E B. Since
Ux(a) C B, we conclude that f3 E B. Ifa E B, then clearly a E Ux(a) C Ux. This
proves the direction from (2) to (3).
We now prove the direction from (3) to (1). So let B = U x. Then

Take an a E B. Then there exists ayE X such that a E Uy . From the definition
of U x we see that U y c B and a is contained in the basic open set U y' Thus, the
theorem is proved.
Theorem 6.9.2
1. The union of any collection of open sets is an open set.
2. The intersection of any finite number of open sets is an open set.
Proof. We prove the first part of the theorem. Let Bi, i E I, be a collection
of open sets indexed by I. Let B be Ui EI Bi. Take any a E B. Then there exists
an i such that a E Bi. Since Bi is an open set, there exists a basic open set Ux such
that a E U x and U x C Bi. Hence Ux C B. Hence B is an open set.
We prove the second part of the theorem. Let Bl and B2 be open sets. Consider
Bl n B2· Let a E Bl n B2· Then there exist two basic open sets UX \ C Bl and
UX2 C B2 such that a E UX \ and a E UX2 • Then it must be the case that either
UX \ C UX2 or UX2 C UX \ ' Hence either UX \ or UX2 is a subset of Bl n B2. Hence
the intersection of Bl and B2 is an open set. In order to show that the intersection of
any finite number of open sets is an open set, one can use induction on the number
of open sets. The theorem is proved.
374 6. Applications of Rabin Automata

Exercise 6.9.3 Let Bi, i E I, be a collection of open sets indexed by I. Let Xi C


{a, 1}* be such that Bi = VXi. Set X = Ui Xi· Prove that the equality UiEI Vi =
Vx holds.
Exercise 6.9.4 Let Vx and Vy be open sets. Consider the set X n Y. Is it true
n
that the equality V X V y = V X n y holds?
Another important notion concerning the subsets of CD is the notion of a
closed set. Here is the definition.
Definition 6.9.5 A set B C CD is closed if CD \ B is an open set.
Thus, every closed set in CD is of the form CD \ V x, for some subset X
of {a, 1}*. We now formulate the theorem about closed sets that is dual to Theo-
rem 6.9.2 about open sets. We leave the proof to the reader.
Theorem 6.9.3
1. The intersection of any collection of closed sets is a closed set.
2. The union of a finite number of closed sets is a closed set. D
Exercise 6.9.5 Prove the theorem above.

6.9.3 Expressing Subsets of CD in S2S. We wish to define subsets of CD in the


monadic second order theory of two successors. The problem of expressing subsets
of CD in this logic is the following. Each element of CD is a path on the binary
tree. Hence the path is already a subset of the binary tree. Thus, subsets of CD are
sets containing subsets of the binary tree. Thus, from this point of view, subsets of
CD are third order objects of the tree T (elements of T are the first order objects,
subsets of T are the second order objects). We know that the monadic second order
logic of the binary tree does not include variables for third order objects. Hence,
on its face, the logic is not powerful enough to talk about third order objects, e.g.,
sets of subsets. In order to overcome this problem we use an indirect way of coding
subsets of CD into the monadic second order logic of the binary tree T with two
successors.
As an example of such an indirect coding we show how we can define closed
subsets of CD in the monadic second order theory of T. Consider the formula

Xc Y & Path(X).

We denote this formula by cl(X, Y). This formula states that X is a path and X is
a subset of Y. Let A be a subset of T. Then we can consider the set

{a I a is a path on T and is a subset of A}.

In other words, this set consists of all paths a which make the formula cl(a, A)
true in T. Note that this set depends on A. Hence, the formula cl(X, Y) defines the
6.9. Applications to Cantor's Discontinuum 375

mapping fel from the set of all subset of T into the set of subsets of CD as follows.
For all AcT, let
fel(A) = {aiT F cl(a, A)}.
Thus, to every AcT the function fel assigns the set of all paths a that satisfy the
formula
a C A & Path(a).
Since each path a is identified with an element of CD, we see that the collection
of all a that are subsets of A is a subset of CD. The next theorem gives us an
interesting property about the formula cl (X, Y) and the associated map fel. Brief! y,
the theorem states that fel ranges over all closed subsets of CD.

Theorem 6.9.4 For every subset A ofT, the set fel(A) is closed. Moreover, for
every closed set C C CD, there is a subset AcT such that fel(A) = C.

Proof. We prove the first part of the theorem. Let A be a subset of T and
let a denote a path in T. Consider the set fel (A). Then a E fel (A) if and only if
every yEa belongs to A. Hence a rJ. fel(A) if and only if for some YET and
f3 E {O, 1yv we have a = yf3 and y rJ. A. Thus, consider the set X = T \ A. Then,
as we have already shown, the following equality holds:

CD \ fel(A) = Ux·
Note that Ux is a set of paths in T, and hence a subset of CD. By Theorem 6.9.1,
the set Ux is open and hence fel(A) is closed.
Now we prove the second part of the theorem. Assume that C C CD is a
closed set. Let A be the set of all x E T such that x belongs to some path a E C.
In other words,
A = Ua.
Cl'EC

Then, we claim that C = fel(A). If a E C, then a C A. Therefore, the formula


cl (A, a) is true. Hence a E fel (A). Assume now that a E fel (A). We want to show
that a E C. If a rJ. C, then, since the complement of C is open, there exists ayE T
such that a E U y C CD \ C. Hence y rJ. A. However, by assumption a E fd(A)
and therefore cl (A, a) is satisfied. In particular a C A and hence YEA. This is a
contradiction. We conclude that a E C. The theorem is proved.
Apart from open and closed subsets of CD, there are many other classes of
subsets that have attracted the attention of mathematicians and computer scientists.
For example, subsets known as Borel sets are well known. These sets have been
studied in logic, set theory, game theory, and in some areas of computer science.
Borel sets define a certain natural hierarchy on complexity of subsets of CD from a
topological point of view. The most simple or accessible Borel sets which belong to
the lowest level of the hierarchy are open sets and closed sets. Each next level of sets
376 6. Applications of Rabin Automata

in the hierarchy is then defined by taking infinite countable unions, intersections


and complements of those sets that belong to the lower level in the hierarchy.
Here we will not discuss the Borel sets and their hierarchy as they are not in the
scope of this book. However, we will consider Borel sets that are obtained by using
countable unions of closed subsets of CD. Such sets are known as Fa-sets. Here
is a formal definition.

Definition 6.9.6 A subset S is called an Fa-set ifit is a countable union of closed


subsets of CD.

It turns out that it is possible to express Fa-sets in terms of the monadic


second order logic of the structure T of two successors. The idea is similar to the
one where we expressed closed subsets by means of the formula cl (X, Y).
Let Finite(X) be the formula, defined in Example 6.5.7, such that for all
ACT, F(A) is true if and only if A is a finite subset of T. We now define the

n
formula Fa(X, Y) as
Path(X) & Finite(X Y).

This formula states that X is a path and the intersection of X with Y is a finite set.
Let A be a subset of T. Then we can consider the set

{a I a is a path on T and the set a nA is finite}.


In other words the above set contains all paths a which make the formula Fa (a, A)
true in T. Hence, the formula Fa (X, Y) defines the mapping fa from the set of all
subsets of T into the set of subsets of CD as follows. For all AcT, let

fa(A) = {a IT F= Fa (a, A)}.


Thus, to every AcT the function fa assigns the set of all paths a that satisfy the
formula
Finite(a n
A) & Path(a).

Since each path a is identified with an element of CD, we see that the collection of
all a that have finite intersection with A is a subset of CD. The next theorem gives
us an interesting property about the formula Fa (X, Y) and the associated map fa.
Briefly, the theorem states that fa ranges over all Fa-subsets of CD.

Theorem 6.9.5 For every AcT, the set fa (A) is an Fa-set. Moreover, for every
Fa-set C C CD, there exists a subset AcT such that fa (A) = C.

Proof. Let us prove the first part of the theorem. Suppose that a E fa (A).
n
Then a is a path and the number of elements in A a is finite, say n. For every
number m consider the set

Pm = {,B I ,B is a path and,B n A has at most m elements}.


6.9. Applications to Cantor's Discontinuum 377

In particular, ot E Pn . It is not hard to see that fa(A) = UnEw Pn . We claim that


each Pn is a closed set. Indeed, consider the set

Xn = {x E TI x has more than n prefixes belonging to A}.

Clearly, UXn is an open set. Moreover, the CD\ UXn = Pn for all n. Hence each Pn
is closed. Therefore, fa (A) is an Fa-set. This proves the first part of the theorem.
Now we prove the second part of the theorem. So assume that C C CD is an
Fa-set. Then there exists a sequence Po, PI, P2, ... of closed sets such that

C = Po U PI U P2 U ....
We can assume that Po ~ PI ~ P2 ~ P3 ~ ... ~ CD (see Theorem 6.9.3).
Now let
An = U ot.
etEPn

Note that Ai ~ Ai+1 for all i E w. Moreover, from the proof of the previous
theorem we conclude that the equality

holds for all nEw.


Now we want to find a set AcT for which fa(A) = C. Take a path f3 not
in C. Then the path f3 is not in Pn for every n. This implies that An f3 is a finiten
set for every n. Indeed, by the definition of An, if X E An, then any prefix of x is
in An. Therefore, if the set An n
f3 were an infinite set, then f3 C An and therefore
f3 would belong to Pn . This is a contradiction to the choice of f3. Now, using that
f3 ¢ C, we define the sequence

xo(f3), XI(f3), X2(f3), ...

of elements in T by stages as follows.


Stage O. xo(f3) is the minimal element x with respect to the prefix ordering
~ in T such that x E f3 and x ¢ Ao.
Stage s + 1. Suppose that xo(f3), ... ,xs (f3) have been defined. Then xs+I (f3)
is the minimal element x with respect to the prefix ordering S in T such that x E f3,
x s (f3) < x, and x ¢ As+I.
Thus, we have defined the infinite sequencexo(f3), Xl (f3), X2(f3), ... of nodes
of the tree T. Note that for all m ~ 1 and y > Xm (f3) we have y ¢ Am. Also note
that no such y could be of the form Xm (f3') for some f3' i= f3 and f3' ¢ C. Now we
define the set B as
B = {x s (f3) 1 f3 ¢ C, SEW}.
378 6. Applications of Rabin Automata

We now claim that the equality fa (B) = C holds. To prove this suppose that
f3 Ii C. Then xs(f3) n B n
=1= 0 for all s. Hence the intersection f3 B has infinitely
many elements. Therefore, f3 Ii fa (B). We conclude that fa(B) c C.
Assume that a E C. Then a C An for some n. Therefore, since Am C Am+l
for all m, a C An+k for all k E OJ. Hence for a f3 that does not belong to C, if
xm(f3) E a, then 0 :s m < n. Now we claim that the set an B has at most n
elements. This will establish that a E fa (B). So assume that f3o, ... , f3n are such
that all f3o, ... , f3n are not in C, and xmo(f3o), ... , xmn (f3n) are pairwise distinct
elements that belong to a. Then, as we noted above, each mi must be less than n.
Hence for some distinct i, j :s n, we should have mi = mj. Let m = mi. This
implies that Xm (f3i) E a and Xm (f3 j) Ea. Hence the nodes Xm (f3i) and Xm (f3 j)
are comparable with respect to the prefix order:s. Say Xm (f3i) < xm(f3j). But, as
noted above, this cannot happen. The theorem is thus proved.

6.9.4 Decidability Results. In this subsection we prove several decidability re-


sults about some structures and formal languages that can be derived from Cantor's
discontinuum. One of the natural structures that can be derived from CD is the
structure
(CD, :::S),
where for all a, f3 E CD, we have a :::S f3 if and only if a = f3 or there exists w,
a finite prefix of both a and f3, such that wO E a and wI E f3. Intuitively, this
is the natural left to right ordering of all paths through the binary tree. Clearly,
(CD, :::S) is a linearly ordered set. We now define the language L appropriate to
(CD, :::s). The language is defined in the usual way but with some modifications.
The language contains individual variables x, y, z, ... , that are intended to run
over elements of CD, the symbol :::S representing the order on CD, logical connec-
tives &, V, -', -+, and set variables of two types. The first type of set variables are
Cl, C2, C3, ... and range over closed subsets of CD; the second type of set vari-
ables are Dl, D2, D3, ... and range over Fa-subsets of CD. The language contains
quantifiers 3, V that can be applied to the individual as well as to the set variables
of both types. The language also has the symbol E for representing membership.
The formulas and sentences of this language L are defined in the natural way. We
leave the definition of formulas to the reader.

Definition 6.9.7 Denote the set ofall sentences of the language L true in (CD, :::S)
by Th(CD). Call it the theory of Cantor's discontinuum.

Here is our first decidability result.

Theorem 6.9.6 The theory Th(CD) of Cantor 's discontinuum is decidable.

Proof. The idea of the proof of the theorem is quite simple. We need to
transform formulas of the language L into the formulas of the monadic second
order theory of two successors. The transformation of a formula <t> to a formula <t>(t)
6.9. Applications to Cantor's Discontinuum 379

should naturally preserve their satisfaction in (CD, ::s) and (T, L, R), respectively.
We recall from the previous section that we have the formula cl(X, Y) which is
X C Y & Path(X). This defines all the closed sets of CD. We also have the formula
Fa (X, Y) which is Finite(X n Y) & Path(X). This defines all the Fa-subsets of
CD. We now transform <I> into <I>(t) by induction on the complexity of <1>. If <I> is
of the form Xi :::: Xj, then <I>(t) is

(Path(Bi) & Path(Bj)) v (3x(L(x) E Bi &R(x) E Bj)).

If <I> is of the form Xi E C j or xi E D j, then <I>(t) is

Path(Bi) & cl(Bi, Cj) or Path(Bi) & Fa(Bi, Cj),

respectively. If <I> is of the form <I> I r <1>2, where r E {v, &, ~ } or <I> = -,<1> I, then
we set <I>(t) to be <I>~t)r<l>g), where r E {v, &, ~} or <I> = -'<I>~I), respectively.
If <I> is any of the formulas

VXi <1>1 (Xi), VCi<1>1 (Ci), VDi <1>1 (Di),

then <I> (t) is

Similarly, if <I> is any of the formulas

3Xi<l>I(Xi), 3Ci<1>1 (Ci), 3Di<l>I(Di),

then we replace <I> with


",(I) D
3 Bi(Path ( Bi) & <1>1 (Bi)), 3Ci(<I>1 (Ci)), 3Di('VI ( i)),
(t) (t)

respectively. Now the reader can check that for all sentences <1>, we have <I> E
Th(CD) if and only if <I>(t) E S2S. The theorem is proved.

We now consider another natural structure that can be obtained from Cantor's
discontinuum. Consider the set Ma of all Fa-sets. Let DI, D2 be elements of Ma.
Hence DI and D2 are of the form:

DIpl u pl u pi u . .. and
= D2 = P[ u pi u Pt u ... ,
where each p/' p? is a closed set. Then

DI U D2 = pl u P[ u pl u pi u··· and DI n D2 = U (p/ n pJ).


i,j?: I

Hence the set Ma of all Fa-sets is closed under the operations of union and inter-
section. We also know that the set Me that consists of all closed sets is closed under
380 6. Applications of Rabin Automata

the operations of finite union and intersection (see Theorem 6.9.3). Therefore, it is
quite natural to consider the structure

A= (Ma, U' n, Me).


Thus, the domain of A consists of all Fa -sets. The type of the structure consists of
two binary operations U and n, and one unary relation Me. Now we can consider
the first order theory Thl (A) of this structure, that is the set of all sentences of the
first order logic that are true in the structure A. It turns out that the following result
can be easily derived from the previous theorem.

Theorem 6.9.7 Consider the structure A = (Ma, U, n, Me). The first order
theory Thl (A) afthis structure is decidable.

Proof. Assume that XO, XI, ... are variables of the first order logic of the
structure A. We associate the variables Xi with the variables Di of the language L
ofthe structure (CD, ~). Now the union and intersection operations of Fa-sets of
CD are definable in the language L. Similarly, the union and intersection operations
of closed sets are definable in the language L. Hence we can replace the atomic
n
formulas Xi U Xj = Xk and Xi Xj = Xk with the formulas Di U D j = Dk and
n
Di D j = Dk of the language L, respectively. We can also replace the quantifiers
3Xi and VXi with 3Di and VDi, respectively. Also, if a sentence of the first order
theory of A contains the formula Me(xi) so that Xi is quantified with 3Xi, then
this is replaced by 3Ci. For example, the sentence VXi3xj(Xi = xj&Me(xi» is
replaced with VDi3Cj(Di = Cj). Hence we can transform any sentence <t> of the
first order logic of the structure A into a sentence <t>(t) of the language L. Moreover,
<t> E Thl (A) if and only if <t>(t) E Th(CD). This proves the theorem. 0

Exercise 6.9.6 Give aformal definition of the transformation af<t> into <t>(t) used
in the proof afthe theorem.

The next result concerns the interval [0, 1] of real numbers, the natural order
:s on this interval, and the topology on this interval. The topology of this interval is
defined by closed subsets of [0, 1] and Fa-subsets of [0, 1]. For completeness we
recall the following definitions. A subset U c [0, 1] is open if for any X E U there
exists a real number E > 0 such that (x - E, X + E) cU. A set U S; [0, 1] is closed
if[O, 1] \ U is open. A countable union of closed subsets of [0, 1] is an Fa-set. Now
consider the language L defined for (CD, ~). The language L can be considered as
a language of the structure [0, 1] where the binary relation of L is interpreted as the
natural order :s on reals, variables Co, C I, ... are interpreted as closed subsets of
[0, 1], and the variables Do, DI, ... are interpreted as Fa-subsets of [0, 1]. Our goal
is to show that the theory Th([O, 1]) of the structure ([0, 1], :s) in the language Lis
decidable. It is noteworthy that the structure ([0, 1], :s) together with the topology
of its closed sets as well as Fa-sets is among one of the fundamental structures that
6.9. Applications to Cantor's Discontinuum 381

arise in mathematics, especially in analysis and topology. It turns out that we can
prove the decidability of Th([O, 1]) by again using Cantors' discontinuum.
Consider CD. Let a = a(O)a(l) ... be in CD. With a we can associate the
real number r(a) defined as follows:
r(a) = a(O) + a(l) + ... + a(n) + ....
2 22 2n +!
Note that the mapping a ---+ r(a) is onto, since for every r E [0, 1] there exists an
a such that r = r(a). However, this mapping is not one-to-one because for some
r there exist exactly two distinct a and f3 such that r = r(a) = rfJ). Indeed take
u E T and consider a = u 1000000 ... and f3 = uOll1111 .... Then r(a) = r(fJ).
This suggests the following. Say that a and f3 in CD are ~-equivalent if there exists
a u E T such that a = u 1000000 ... and f3 = uO 111111 . . .. The relation "-' is
indeed an equivalence relation. Now we can consider the set CD~ consisting of
all "-'-equivalence classes. Note that the mapping a ---+ r(a) induces a one-to-one
function a~ ---+ [0, 1] from CD~ onto [0, 1], where a~ is the "-'-class that contains
a. Also note that the ::s relation on CD induces a linear order, also denoted by ::S,
on the set CD~. The reader can now prove the following lemma.
Lemma 6.9.2 The mapping a~ ---+ r(a) from CD~ onto [0,1] satisfies thefollow-
ing properties:
1. For all a, f3 E CD, the real numbers r (a) and r (fJ) are equal if and only if a
is "-'-equivalent to f3.
2. For all a, f3 E CD, a~ ::s f3~ if and only ifr(a) ::; r(fJ).
Moreover, the mapping a ---+ r(a) from CD onto [0, 1] satisfies the following
properties:
1. For all C C CD, C is closed if and only if its image under the mapping is
closed.
2. For all D C CD, C is an Fa -set if and only if its image under the mapping
is an Fa-set. 0
Exercise 6.9.7 Prove the lemma above.
Following is the theorem stating that the theory Th([O, 1]) of the topological
structure ([0, 1], :::) in the language L is decidable.
Theorem 6.9.8 The theory Th([O, 1]) is decidable.
Proof. In the proof we use the ideas of the proof of Theorem 6.9.6. First of
all we note that the equivalence relation "-' on the tree T is definable in S2S. By
induction on the complexity of formulas, we transform formulas of the language
L into the formulas of the monadic second order theory of two successors. If <I> is
ofthe form Xi ::: Xj, then <I>(t) is
382 6. Applications of Rabin Automata

(Path(Bi) & Path(Bj»


& 3Bs3Bk(3x(L(x) E Bs &R(x) E Bk & Bi rv Bs & Bj rv Bk».

If 4> is of the form Xi = Xj, then the formula 4>(t) is (Path(Bi) & Path(B j) & Bi rv
Bj). If the formula 4> is of the form Xi E Cj or Xi E Dj, then the formula
4>(f) is (Path(Bj) & 3Bk(Bk rv Bi & cl(Bk, Cj» or (Path(Bi) & 3Bk(Bi rv
Bk & Fa(Bk, Cj», respectively. If 4> is of the form 4>1.4>2, where. E {v, &, --*}
or 4> = -,4>1, then we set 4>(f) to be 4>~f).4>g), where. E {v, &, --*} or 4> =
-'4>~f), respectively. Now by using the induction on the complexity of formu-
las, we continue as follows. If the formula 4> is any of the formulas VXi 4>1 (Xi),
VCi4>1 (Ci), VDi4>1 (Di), then 4>(1) is VBi(3Bj(Bi rv Bj &Path(Bj) & 4>~f)(Bj»,
VCi (4)~f) (Ci », 'v' Di (4)~t) (Di», respectively. Similarly, if 4> is any of the formulas
3Xi 4>1 (Xi), 3Ci4>1 (Ci), 3Di 4>1 (Di), then 4>(t) is 3Bi3Bj(Bi rv B j & Path(Bj) &
4>~f) (Bj», 3Ci (4)~t\Ci))' 3D; (4)~f) (Di», respectively. Now the reader can check
that for all sentences 4>, we have 4> E Th([O, 1]) if and only if 4>(1) E S2S. The
theorem is proved. D

Exercise 6.9.8 Prove the theorem above in detail.

6.10 Application to Boolean Algebras


In this final section of the chapter we show that a certain formal theory of the class
of all Boolean algebras is decidable. The proof follows the ideas of the proofs from
the previous sections. We first obtain certain fundamental algebraic facts about
Boolean algebras. Then using the algebraic facts we obtain decidability results
by transforming statements about Boolean algebras to formulas of the monadic
second order theory of two successors.

6.10.1 A Brief Excursion into Boolean Algebras. In this section we study


structures called Boolean algebras. The results of this section will mostly be about
countable Boolean algebras though the results can be generalized to uncountable
Boolean algebras as well. Boolean algebras are fundamental systems that arise in
many areas of mathematics. In general Boolean algebras can be thought as systems
(or collections) of sets that are closed under the operations of union, intersection,
and complementation. As we have seen, the classes of FA recognizable languages,
Blichi recognizable languages, and Rabin recognizable languages are closed under
these operations. In this part of this section we study some of the basic properties
of these systems from the algebraic point of view. Here is a definition of Boolean
algebras.

Definition 6.10.1 A Boolean algebra is a structure

13 = (B, v, /\, -, 0, 1),


6.10. Application to Boolean Algebras 383

where v, 1\ are binary operations, - is a unary operation, and 0, 1 are constants,


such that for all a, b, c E B the following properties hold:
1. a vb = b Va, a 1\ b = b 1\ a (commutativity),
2. a V (b V = (a V b) V c, a 1\ (b 1\ c) = (a 1\ b) 1\ c (associativity),
c)

3. a V (b 1\ c) = (a V b) 1\ (a V c), a 1\ (bv c) = (a I\b) V (a I\c)(distributivity),

4. a vb = a 1\ b, a Ab = a V b (De Morgan's Law),

5. a Va = a, a V 0 = a, a V 1 = 1,

6. a 1\ a = a, a 1\ 0 = 0, a 1\ 1 = a,

7. a =a,
8. a V a = 1, a 1\ a = O.
Often the operations V, 1\ and-are called the union, intersection, and comple-
mentation operations, respectively. We now give examples of Boolean algebras.

Example 6.10.1 Let A be a set. Consider the set peA) of all subsets of A. Then
(P(A), U, n, -,0, A) is a Boolean algebra.

° ° = 0, ° V 1 = 1V ° = 1,
1 V 1 = 0, 0 1\ 0 = 0, 0 1\ 1 = 1 1\
Boolean algebra.
°=
Example 6.10.2 Consider the set {a, 1}. Set V
0, 1 1\ 1 = 1, 6 = 1, I = 0. This defines a

Example 6.10.3 Let BI and B2 be Boolean algebras. Consider the Cartesian


product BI x B2. Define 1\, V, and- operations on BI x B2 asfollows: (a, b) 1\
(c, d) = (a 1\ c, b 1\ d), (a, b) V (c, d) = (a V c, b V d), (;;:b) = (a, b). Then we
have the Boolean algebra denoted by BI x B2. Note that 0 and 1 in this Boolean
algebra are (0,0) and (1, 1), respectively.

The first example is important since we will later show that we can operate
with 1\, V and - operations as the intersection, union and the complementation
operation on a certain collection of sets. We single out such Boolean algebras in
the following definition.

Definition 6.10.2 A Boolean algebra of subsets is a family X of subsets of a set


A such that X contains 0, A, and is closed under the set-theoretic operations of
union, intersection, and complementation.
Thus, if B is a Boolean algebra of subsets, then there exists a collection X of
subsets of a set A such that B = (X, u, n, \,
0, A). For example, for any subset
C of a set A, the set {C, A \ C, 0, A} is a Boolean algebra of subsets.
We now present several properties of Boolean algebras. Let B be a Boolean
algebra. Then - is a unary operation on B such that for all bl 'I b2, we have
384 6. Applications of Rabin Automata

b l =1= b2,0 = 1 and i = O. Indeed, if bl = b2, then by property (7) we have


b l = b = b2 = b2. Hence bl =1= b2 implies that b l =1= b2. To show that i = 0, we
use the identities a 1\ 1 = a and a 1\ a = 0 that hold for all a. Indeed, set a = 1.
Then i = i 1\ 1 = O. Similarly, we see that 0 = 1. From now on, the element a
will be called the complement of a.
Let 13 be a Boolean algebra. Define the binary relation ::s on the domain of
13 as follows. For a, bE B, a ::s b if a 1\ b = a. Here is the next lemma showing
that ::s is a partial ordering with several interesting properties.

Lemma 6.10.1 The relation ::s has the following properties:


1. ::s is a partial ordering. Moreover, for all b E B, we have 0 ::s b ::s 1.
2. For all a, bE B, a ::s b ifand only ifa vb = b.

3. For all a, b, x E B, ifx ::s a and x ::s b, then x ::s a 1\ b.

4. For all a, b, x E B, ifx 2: a and x 2: b, then x 2: a V b.

Proof. We prove (1). Clearly, a ::s a for all a because a 1\ a = a by the


axioms of the Boolean algebras. Also, if a ::s band b ::s a, then a 1\ b = a and
b 1\ a = b. Since 1\ is commutative, we have a = b. Assume that a ::s band b ::s c.
Then a 1\ c = (a 1\ b) 1\ c = a 1\ (b 1\ c) = a 1\ b = a. Hence a ::s c. Therefore, ::s
is a partial ordering. The rest of Property (1) follows from the axioms of Boolean
algebras.
We now prove (2). Assume that a vb = b. Then using the axioms for Boolean
algebras we getthe following: a = av(bl\b) = (avb)l\(avb) = bl\(avb) =
(b 1\ a) V (b 1\ b) = b 1\ a. Hence a ::s b. Similarly, one can show that if a 1\ b = a
then a vb = b.
Now we prove property (3). Assume that x ::s a and x ::s b. Then x 1\ a = x
and x 1\ b = x. Then from the axioms for Boolean algebras we obtain the following:
x 1\ (a 1\ b) = (x 1\ a) 1\ b = x 1\ b = x. Hence x ::s a 1\ b. The proof of Property
(4) is similar. The lemma is proved.

£xercise 6.10.1 Prove that a ::s b if and only if b ::s a.


Definition 6.10.3 Let (B, ::s) be a partially ordered set. Then the inf of two el-
ements a, b E B, denoted by inf(a, b), is an element c such that for all x E B
the condition x ::s a and x ::s b implies x ::s c. Similarly, the sup of two elements
a, b E B, denoted by sup(a, b) is an element c such thatforall x E B the condition
x 2: a and x 2: b implies x 2: c. The partially ordered set (B, ::s) is a lattice iffor
all a, b E B sup(a, b) and inf(a, b) exist.

Thus for a Boolean algebra 13, as the lemma above shows, the partially ordered
set (B, ::s) is a lattice. Also, note that any linearly ordered set is a lattice. Of course,
there are partially ordered sets which are not lattices.
6.10. Application to Boolean Algebras 385

Exercise 6.10.2 A lattice (B, ~) is a Boolean lattice if the following properties


hold:

1. There exist two elements 0 and 1 such that 0 ~ b ~ 1 for all b E B.

2. For all a, b, c E B we have sup(a, inf(b, c)) = inf(sup(a, b), sup (a , c))
and inf(a, sup(b, c)) = sup(inf(a, b), inf(a, c)).

3. For all a E B there exists some b E B such that sup(a, b) = 1 and


inf(a, b) = O. In this case a and b are complements of each other.
Show the following:

1. If B is a Boolean algebra, then (B, ~) is a Boolean lattice.

2. If(B,~) is a Boolean lattice, then for every a E B there exists exactly one
complement b of a. Denote the complement of a bya. Show that if (B, ~) is
a Boolean lattice, then (B, sup, inf, -,0,1) is a Boolean algebra.

The next exercise provides a method of constructing Boolean algebras from


linearly ordered sets.

Exercise 6.10.3 Let (L, ~) be a linearly ordered set with a minimal element. A
half interval is any of the sets

[a, b) = {x ELI a ~ x < b}, [a, (0) = {x ELI a ~ x},

where a, bEL. Thus, for example 0 and L are half intervals. Consider the set B L
ofall finite unions ofhalf intervals of the linearly ordered set (L, ~). Prove that BL
forms a Boolean algebra under the set-theoretic operations of union, intersection,
and complementation. This algebra is called the algebra of intervals of (L, ~).

6.10.2 Ideals, Factors, and Sub algebras of Boolean Algebras. In the theory
of Boolean algebras an important concept is the notion of an ideal. Ideals can be
used to build new Boolean algebras from a given one. Here is a definition of ideals.

Definition 6.10.4 A set I C B ofa Boolean algebra B is an ideal if the following


properties hold:

1. 0 E I.
2. For all x E I and y E B, ify ~ x, then y E I.

3. For all x, y E I, x V Y E I.

Clearly, {OJ and B are ideals of any Boolean algebra B. These are called
trivial ideals. Nontrivial ideals are called proper ideals. Here are some examples
of nontrivial ideals.
386 6. Applications of Rabin Automata

Example 6.10.4 Consider the power set peA). Fix X C A. Consider the set I (X)
defined as {V I V ~ X}. Then I(X) is an ideal of the Boolean algebra peA) of
all subsets of the set A.
Example 6.10.5 Consider the power set P (A). Consider the set Fin( A) ofall finite
subsets of A. Then Fin(A) is an ideal of peA).
It turns out that every element b E B of a Boolean algebra 6 defines an ideal.
Indeed, consider the set I (a) = {x I x s: a}. Then this set is an ideal and is called
the principal ideal generated by a.
Exercise 6.10.4 Show that I (a) = {x I x s: a} is an ideal of 6.
Let I be an ideal of a Boolean algebra 6. We can identify the elements a, b
of 6 modulo I as follows: a '"""/ b if and only if (a \ b) V (b \ a) E I, where a \ b
is called the difference of a from b and equals a /\ b. Thus informally, a '""" / b
means that a and b cannot be distinguished if we do not count those parts of a and
b which are in I. It turns out that the relation'""" / has some nice algebraic properties
needed to build new Boolean algebras.
Lemma 6.10.2 Let I be an ideal of a Boolean algebra 6. Then'""" / has the fol-
lowing properties:
1. The relation'""" / is an equivalence relation.

2. For all ai, a2, bl, b2 E B, ijal '"""/ a2 and bl '"""/ b2, then

(al V bI) '"""/ (a2 V b2), (al /\ bl) '"""/ (a2 /\ b2), and di '"""/ bl.

Proof. We prove the first part. It is clear that'""" / is a reflexive and symmetric
relation. Assume that a '"""/ band b '"""/ c. Consider a \ c. Then we have the
following:
a\ c = a /\ c = (a /\ c) /\ (b V b) = (a /\ c /\ b) V (a /\ c /\ b)
s: (c /\ b) V (a /\ b) = (b \ c) V (a \ b).

Since b \ c and a \ b are in I, and I is an ideal, we have (b \ c) V (a \ b) E I. Again


using the fact that I is an ideal we conclude that the inequality a \c s: (b \c) V (a \b)
implies that a \ c E I. One can prove in a similar manner that c \ a E I. Hence
a '"""/ c. We have proved the first part of the lemma.
Now we prove the second part of the lemma. Let us show that (al V bl) '""" /
(a2 V b2)' Consider (al V bl) \ (a2 V b2)' Then
(al V bl) \ (a2 V b2) = (al V bl) /\ (a2vb2) = (al V bl) /\ a2 /\ b2
= (al /\ a2 /\ b2) V (bl /\ a2 /\ b2) s: (al \ a2) V (bl \ b2)'
Hence (al V bl) \ (a2 V b2) E I. Similarly, (a2 V b2) \ (al V bl)' Therefore,
(al V bl) '"""/ (a2 V b2). We leave it to the reader to prove the rest of the lemma. D
6.10. Application to Boolean Algebras 387

Exercise 6.10.5 Finish the proof of the lemma above.


For an ideal I of a Boolean algebra 5, consider the set BI that consists of all
"-'I-equivalence classes. Thus, BI = {al I a E B}, whereal is the "-'I-equivalence
class containing a. Define v, /\, and-operations on BI as
a/vbl=(avb)/, al/\bl=(a/\b)/, ii[=al.
The second part of the lemma above shows that these operations are well defined,
that is, are independent of representatives of the "-' I-equivalence classes. Now it is
not hard to see that the structure (B I, v, /\, -, 0/, 11) is a Boolean algebra. We
denote it by 51. The algebra 51 is called the factor algebra of 5 by the ideal I.
Exercise 6.10.6 Consider the Boolean algebra peA), where A is an infinite set.
Consider the ideal Fin = {X I X C A and X isfinite}. Consider thefactoralgebra
5 of P (A) with respect to Fin. Show that for all x E B, ifx i= 0, then there exists an
infinitesequencexl,x2, .. . ofdistinct elements such that x ~ Xl ~ x2 ~ x3 ~""
Let 5 be a Boolean algebra. Consider a subset C c B. It can be the case that C
is closed under the operations of the Boolean algebra 5. For example, C = {O, I}
is such that the operations v, /\, and - applied to elements of C again produce
elements of C. In this case we say that C is a subalgebra of 5. A formal definition
is as follows.
Definition 6.10.5 A Boolean subalgebra of 5 is a non empty subset C of B such
that for all a, bE C we have a V b, a /\ b, a E C.
Note that if C is a subalgebra of 5, then for any C E C, c V c, c /\ C E C.
Hence any subalgebra contains 0 and 1 of the original Boolean algebra 5.
Theorem 6.10.1 Let A be a subset of a Boolean algebra 5. Then there exists a
minimal, with respect to the set-theoretic inclusion, Boolean subalgebra C of 5
that contains A. Moreover, any element x E C can be written in the form

X = Vaifili /\ ... /\ ai (.
,
Ei,fi
, I
,
i::9

where s ~ 1, each ai,) is in A, Ei,} E {a, I}, and aO = ii, a l = a.


Proof. The proof is quite easy. Note that the intersection of any collection of
Boolean subalgebras of 5 is again a Boolean subalgebra. Thus, we can consider all
the Boolean subalgebras that contain A. Then the intersection C of these Boolean
algebras is a Boolean algebra. The Boolean subalgebra C (whose domain is the set
C) is the minimal one with respect to the set-theoretic inclusion. Now note that
any Boolean subalgebra that contains A also contains the elements of the form
X = Vi9 ad /\ ... /\ a i ,;/ ' where s ~ 1 and ai,} E A. Moreover the reader can
Ej 1 fit·

check that the set of all elements of this type forms a Boolean subalgebra. Hence
this proves the last part of the theorem. 0
388 6. Appiications of Rabin Automata

Exercise 6.10.7 Give a proof of the theorem above in greater detail.

Let A be the subset of a Boolean algebra B. Consider the minimal subalgebra


C that contains A. In this case we say that A generates the Boolean algebra C. Hence
we have the following result which follows from the theorem above.

Corollary 6.10.1 Let A be a subset of a Boolean algebra A. Then A generates a


Boolean subalgebra C if and only if every element x ofC can be written in the form

x = Vad €il
/\ ... /\ ai,li
tj,t;
'
i'S;s

where s ::: 1 and ai,j E A. 0

6.10.3 Maximal Ideals of Boolean Algebras. One of our goals is to show that
we can treat elements of a given Boolean algebra as subsets of a certain set. In
order to achieve the goal we need to better understand ideals of Boolean algebras.
In this part of the section we study maximal ideals.

Definition 6.10.6 An ideal I of a Boolean algebra B is maximal if I is a proper


ideal and every proper ideal 1 that contains I coincides with I.

To give an example of a maximal ideal we define another important notion.

Definition 6.10.7 An element a ofa Boolean algebra B is called an atom if a i= 0


and, for all b E B, if 0 ~ b ~ a, then either b = 0 or b = a.

We leave the reader to prove the following exercise.

Exercise 6.10.8 For an element a of a Boolean algebra the following properties


are equivalent:
1. a is an atom.

2. For all b E B, if b /\ a i= 0, then a ~ b.

3. For all b,c E B, ifa = b V c and b /\ c = 0, then either a = bora = c.


Here now is an example of a maximal ideal.

Example 6.10.6 Let a be an element ofa Boolean algebra such that a is an atom.
Then the principal ideal I (a) generated by a is maximal.

Indeed, assume that 1 is a proper ideal containing I (a) and bEl \ I (a) .
Note tha~vb E l,a i= a vb and~ a vb. Since 1 is p!£per, we have a vb i= 1.
Hence a vb i= O. We also have a V b ~ a and a i= a V b. This contradicts the
fact that a is an atom.
Let B be a countable Boolean algebra. Take a subset X C B. We say that X
is consistent if for all positive nEw and all bl, ... ,bn E X we have bl V b2 V
6.10. Application to Boolean Algebras 389

... V b n i= 1. Thus for example, any singleton set {b} with b i= 1 is consistent.
Also note that if X is consistent, then X does not contain 1.

Lemma 6.10.3 Let X be a consistent set of a Boolean algebra 8. Then for every
bE B either X U{b} or X U{b} is a consistent set.

Proof. Assume that both X U{b} as well as X U{b} are inconsistent sets.
Then there exist Xl, ... , x n , Yl, ... , Ym all in X such that

Xl V x2 V ... V Xn vb =1 and Yl V Y2 V ... V Ym vb = 1.


Let X = Xl V X2 V ... V Xn and Y = Yl V Y2 V ... V Ym' Then

X V Y = (x V y) v (b /\ b) = «X v y) v b) /\ «x v y) v b) = 1.
This is a contradiction to the fact that X is consistent. The lemma is proved.
Now our goal is to give a construction that puts every consistent set X into a
maximal ideal. The construction is explained in the proof of the following theorem.

Theorem 6.10.2 Let X be a consistent set of a countable Boolean algebra. Then


there exists a maximal ideall such that X c 1.

Proof. Since 8 is a countable Boolean algebra, we can consider the sequence


without repetition

of all elements of B. Now we construct an ideal I that contains X by stages. At


stage s of the construction we will put one of the elements b s or bs into the set that
is being constructed. Here is the construction:
Stage O. Consider the element boo By the lemma above either X U {bo} or
XU {bo} is consistent. If X U {bo} is consistent, then set Xo = XU {bo}. Otherwise,
set Xo = X U {bo}.
Stage s + 1. Assume that Xs has been constructed and is consistent by the
induction hypothesis. Consider the element bs+l. By the lemma above either Xs U
{bs+l} or Xs U {bs+l} is consistent. If Xs U {bs+l} is consistent, then set Xs+l =
Xs U {bs+l}. Otherwise, set Xs+l = Xs U {bs+il.
Now we define I = USEW Xs. Now note that I is a consistent set. Otherwise,
some Xs would be inconsistent. Also note that for every b E B either bEl or
bEl, because b = bs for some s, and at stage seither b or its complement is
put into 1. Now we show that I is a proper ideal. Since I is consistent, 1 does
not belong to 1. Also note that 0 E 1. Let X Eland Y S X. We need to show
that Y E 1. If Y rJ. l, then y E 1. Now consider X v y. Since Y S X we have
X v y = (x V y) V Y = 1. Hence I is inconsistent. Therefore, Y E 1. Now assume

that x, Y E 1. We need to show that x v Y E 1. If not, then x V Y E 1. Then


390 6. Applications of Rabin Automata

x V Y V x V y = 1. Hence I is inconsistent. Therefore, x V y E I. Thus, I is an


ideal.
We need to show that I is a maximal ideal. Assume that I is not maximal.
Let J be a proper ideal that contains I such that b E J \ I for some b. Then bEl.
Hence b E J. Therefore, b V b E J. Hence J is not proper. This contradicts the
assumption that I is not maximal. Hence we have shown that I is a maximal ideal
that contains X. The theorem is proved.

Corollary 6.10.2 For any countable Boolean algebra B and any b "I- 1 in B there
exists a maximal ideal that contains b. 0

Corollary 6.10.3 For any countable Boolean algebra B and any b "I- 0 in B there
exists a maximal ideal that does not contain b.

Proof. Take b. Then b "I- 1. By the previous corollary there exists a maximal
ideal that contains b. The ideal clearly does not contain b. The corollary is proved.

Corollary 6.10.4 A proper ideal of a countable Boolean algebra I is maximal if


and only iffor all b E B either bEl or bEl.

Proof. Let I be a proper maximal ideal. If for some b neither bEl nor
bEl, then either I U{b} or I U{b} is consistent. Hence we can construct a proper
ideal containing I. This contradicts the assumption that I is maximal. Assume that
for all b E B either b E B or b E B but I is not a maximal ideal. Let J be a
proper maximal ideal containing I such that a E I \ J for some a. Then a E I.
Hence a V a = 1. This contradicts the assumption that J is proper. The corollary
is proved.

Exercise 6.10.9 Let B be a Boolean algebra. A subset FeB is a filter if the


following properties hold:

1. 1 E I.

2. For all x E I and y E B, ify ~ x, then y E I.

3. Forallx,YEI,xI\YEI.

Prove the following:

1. F is a filter if and only if the set F= {i Ix E F} is an ideal.

2. Every proper filter is contained in a maximal filter.

6.10.4 The Stone Representation Theorem. In this section we prove one of the
fundamental results about Boolean algebras. The result basically tells us that we
can think of the operations of a Boolean algebra as the set-theoretic operations of
union, intersection and complementation on some family of subsets of a certain
6.10. Application to Boolean Algebras 391

set. Hence all the set-theoretic laws that hold for the set-theoretic operations also
hold for the operations that define Boolean algebras. Recall our assumption that
Boolean algebras are countable. We add that the Stone theorem holds for uncount-
able Boolean algebras as well.
Let B be a Boolean algebra. We can consider the set of all maximal ideals of
the Boolean algebra B. Let us denote this set by I (B). Our goal will be to show
that the Boolean algebra B can be viewed as a family of subsets of I (B) closed
under the set-theoretic operations of union, intersection and complementation. In
order to do this we need to associate with each element b of the Boolean algebra
a subset of I (B). So let us take any element b E B. Consider the set R(b) of all
ideals that do not contain b. Thus,

R(b) = {I I I is a maximal ideal of Band b Ii I}.


Clearly, R(b) C I (B). Thus we have a mapping R from the Boolean algebra B into
the set of all subsets of I (B). Now we will study several properties ofthe mapping
R : B ~ P(I (B», where we recall that peA) is the power set of the set A. The
following lemma follows immediately from the definition of the mapping R.

Lemma 6.10.4 For R, we have R(I) = I (B) and R(O) = 0. 0


Lemma6.10.S For all a, bE B, ifa =F b, then R(a) =F R(b).

Proof. Note that either a 1: b or b 1: a since a f=. b. We can suppose that


a 1: b (otherwise we would change the roles of a and b). Consider a 1\ b. If
a 1\ b = 0, then
a = a 1\ 1= a 1\ (b V b) = (a 1\ b) V (a 1\ b) = a 1\ b.

Hencea ~ b. This is a contradiction to the assumption that a 1: b. Hence a I\b =F O.


By Corollary 6.10.3, we can take a maximal ideal I that does not contain a 1\ b.
Hence a Ii I and b Ii I. Therefore, bEl. We conclude that I E R(a) and
I Ii R(b). Therefore, R(a) =F R(b). The lemma is proved.

Lemma 6.10.6 For all a, b E B we have the equalities

R(a V b) = R(a) U R(b) and R(a 1\ b) = R(a) n R(b).


Proof. We prove the equality R(a V b) = R(a) U R(b). The other equality
can be proved in a similar manner. Thus, assume that I E R(a V b). We need to
show that either I E R(a) or I E R(b). If neither I E R(a) nor I E R(b), then
a E I and bEl. Hence a V bEl. This is a contradiction. Therefore, either
I E R(a) or I E R(b). Assume that! E R(a). We need to show that! E RCa V b).
We can suppose that I E R(a). Then a Ii I. Consider a V b. If a vb E I, then
a E I by the definition of ideal. Hence a V b Ii l. Therefore, I E R(a V b). The
lemma is proved. 0
392 6. Applications of Rabin Automata

Exercise 6.10.10 Prove the equality R(a /\ b) = R(a) n R(b).


Lemma 6.10.7 For all a E B, the equality [(8) \ R(a) = R(a) holds.

Proof. In order to prove the equality assume that [ ~ R(a). Then a E [.


Since [ is maximal, a ~ [. Hence [ E R(a). Now assume that [ E R(a). Then
a ~ [. Therefore, a E [ since [ is maximal. Hence [ ~ R (a). The lemma is
proved.
Thus, the last four lemmas show that the set {R(a) I a E B} is closed
under the set-theoretic operations of union, intersection, and complementation.
Moreover, [(8),0 E {R(a) I a E B}. Hence, we conclude that the structure

({R(a) I a E B}, U, n, \,0, [(8))

is a Boolean algebra. The lemmas also guarantee that the mapping R is an iso-
morphism from the Boolean algebra 8 onto the Boolean algebra ({R(a) I a E
B}, u, n, \,
0, [(8)). Note that {R(a) I a E B} is a family of subsets of [(8).
Here now is the theorem called Stone's representation theorem.

Theorem 6.10.3 Any countable Boolean algebra is isomorphic to a Boolean al-


gebra of subsets.

Proof. Take a Boolean algebra 8. Then the mapping a ~ R(a) is an iso-


morphism from 8 onto ({R(a) I a E B}, U, n, \,
0, [(8)), which follows from
the lemmas above. The theorem is proved.
This theorem allows us to use some set-theoretic terminology about elements
of Boolean algebras. For example, for elements a, b of a Boolean algebra one can
say that a is a subset of b to mean a S b. Similarly, we can say that a and b are
pairwise disjoint to mean that a /\ b = O.

Exercise 6.10.11 Let A be a subset ofa Boolean algebra 8. Show that the minimal
Boolean subalgebra of 8 containing A is finite if A is finite.

Exercise 6.10.12 Prove that any finite algebra 8 is generated by its atoms. More-
over show that any element b E B can be presented as a finite union of atoms of
8.

Exercise 6.10.13 A Boolean algebra 8 is atomic if for every b E B there exists


an atom a such that a S b. Let A be the set ofall atoms of 8. Show that any atomic
Boolean algebra 8 is isomorphic to the Boolean algebra P(A) of all subsets of A.

6.10.5 Homomorphisms of Boolean Algebras. Throughout this section, all


Boolean algebras are assumed to be countable unless otherwise stated. Let A and
8 be Boolean algebras. We say that the mapping h : A ~ B is a homomorphism
if h(O) = 0, h(l) = 1, and for all a, b E A we have h(a v b) = h(a) v h(b),
6.10. Application to Boolean Algebras 393

h(a 1\ b) = h(a) 1\ h(b), and h(a) = h(a). Clearly, if a homomorphism h is onto


and a one-to-one mapping then h is an isomorphism. A homomorphism h is called
an embedding if hex) f. hey) for x f. y.

Example 6.10.7 Let I be an ideal of a Boolean algebra B. Then the mapping


h : b -* bl that maps every bE B to the ~/-equivalence class bl containing b is
a homomorphism from B onto the factor algebra B I.

The next theorem shows that the example above is, in a certain sense, a
canonical way of constructing homomorphisms of Boolean algebras.

Theorem 6.10.4 Let h be a homomorphism from a Boolean algebra B onto a


Boolean algebra A. Consider the set I = {b E B I h(a) = O}. Then I is an ideal
and the factor algebra B I is isomorphic to A.

Proof. We prove that I is an ideal. Clearly, 0 E I. Let x be in I and y .:::: x.


Then y 1\ x = x. Therefore, hex) = hey 1\ x) = hey) 1\ hex) = 01\ hex) = O.
Hence y E I. Take now two elements x, y from I. Thenh(x V y) = hex) V hey) =
o V 0 = O. Hence x V y E I. We conclude that I is an ideal.
Let us consider the factor Boolean algebra B I. We define the mapping g from
B I into A with the goal of showing that B I is isomorphic to A. Take any element
bl E BI. Define g(bl) = h(b). The function g that maps each bl into h(b) is well
defined because it does not depend on the representatives of the ~ I-equivalence
class containing b. Using the fact that h is a homomorphism from B onto A, we
see that g is also a homomorphism from B I into A. We need to show that g is a
one-to-one mapping. Letbl f. al.Assumethatg(bl) = g(al)' Thenh(a) = h(b).
Hence h(a \ b) = h(b \ a) = O. Therefore, a \ b, b \ a E I. Hence al = hI. This
is a contradiction to the assumption that al f. bl. Therefore, h is an isomorphism.
The theorem is proved.
We now give some conditions that allow us to build homomorphisms and
isomorphisms between Boolean algebras. The following definition gives a useful
condition for constructing homomorphisms.

Definition 6.10.8 Let A and B be Boolean algebras. A set H C A x B is a


homomorphism condition from A into B if H has thefollowing properties:

1. (0,0), (1, 1) E H.

2. If (x, y) E H and x = 0, then y = O.


3. If(x, y) E Hand Xl .:::: x, then there exists Yl such that Yl .:::: y, (Xl, Yl) E H
and(x\xl,Y\Yl) E H.

We now prove that any homomorphism condition from A into B allows one
to construct a homomorphism from A into B.
394 6. Applications of Rabin Automata

Theorem 6.10.5 Let H be a homomorphism condition from a Boolean algebra


A into a Boolean algebra 13. Then there exists a homomorphism h from A into 13
with the following property: for all a E A, if there exist pairwise disjoint elements
aI, ... , an such that Viai = a, then (ai, h(ai» E H.

Proof. Since A is countable we can list all elements of A into a sequence


ao, aI, a2, ... without repetition. We construct a homomorphism h by stages. The
construction uses the homomorphism condition H. At stage s + 1 of the construction
we will have a finite Boolean subalgebra As+I of A and a homomorphism hs+1 :
As+ I ~ 13 constructed. These will satisfy the following conditions:

1. For all s, As C As+I.

2. For all s, hs C hs+l, hence the homomorphism hs+1 extends h s .

3. For all s, the element as belongs to As+ I.

4. For all s and a E As the pair (a, hs(a)) belongs to H.

Note that condition (3) guarantees that h = Us hs is a map from A into B.


Conditions (2) and (3) guarantee that h is a homomorphism from A into 13. Here
now is the construction.
Stage 0. We set Ao = {O, 1}, ho(O) = 0, and ho(1) = 1. Clearly, ho is a
homomorphism from Ao into 13.
Stage s + 1. Consider the Boolean algebra As generated at the previous stage.
Let ao, ... , ak be the set of all atoms of As. These atoms generate As. By the
induction hypothesis we have (ao, hs(ao», ... , (ab hs(ak» E H. We construct
As+I as follows. Take the element as. For each i E {a, ... , k}, form the elements
d2i = ai /\ as and d2i+ 1 = ai /\ as· Since (ai, hs (ai» E Hand d2i :s ai, there must
exist a b2i such that b2i :s hs(ai), (d2i' b2i) E Hand (d2i+l, hs(ai) \ b2i) E H.
We set b2i+1 = hs(ai) \ hi. Now set As+I to be the Boolean algebra generated by
elements do, ... ,d2k+1. Clearly, As C As+I. Moreover the elements do, ... , d2k+1
are atoms of the Boolean algebra As+ I. Thus, we have constructed the subalgebra
As+I. Note that as E As+I because as = do v d2 V ... V d2k. Now we need to
define the homomorphism hs+ I. Take any element a E As+ I. There must exist a
finite set K C {a, 1, ... , 2k+ I} such that a = V jEK dj. Set hs+1 (a) = V jEK b j.
It is not hard to see that hs C hs+l.
Now we set h = Us h s . As noted above h is a homomorphism from A into
13. The theorem is proved.
The homomorphism condition H from A into 13 does not guarantee that there
exists a homomorphism from A onto 13. However, we can add an extra condition on
H that will suffice to build a homomorphism from A onto 13. We give the following
definition.
6.10. Application to Boolean Algebras 395

Definition 6.10.9 A homomorphism condition H from A into B is called an epi-


morphism condition from A onto B if for all (x, Y) E Hand b .:s y there exists
an a E A such that a .:s x, (a, b) E H and (x \ a, y \ b) E H.

Now we prove the following theorem that, given epimorphism condition H


from A into B, builds a homomorphism from A onto B.

Theorem 6.10.6 Let H be an epimorphism condition from a Boolean algebra A


into a Boolean algebra B. Then there exists a homomorphism h from A onto B
with the following property: for all a E A if there exist pairwise disjoint elements
a!, ... , an such that Viai = a, then (ai, h(ai)) E H.

Proof. The proof is very similar to the proof of the previous theorem. We
sketch the proof and leave the details to the reader. Since A and B are countable
we can list all elements of A and B into the sequences

respectively. We construct a homomorphism h from A onto B by stages. At stage


0, we set Ao = to, I}, ho(O) = 0, and ho(1) = 1. Clearly, ho is a homomorphism
from Ao into B. At stage s + 1, we will have a finite Boolean subalgebra As+!
of A and a homomorphism hs+! : A s+! -+ B constructed. These will satisfy the
following conditions:

1. For all s, As C A s+!'

2. For all s, hs C h s+!, hence hs+! extends h s .

3. For all s = 2k + 1, the element as belongs to A2s+!.


4. For all s = 2k + 2, the element bs belongs to h s (A2s+s)'
5. For all s and a E As the pair (a, hs(a)) belongs to H.

All these conditions guarantee that the mapping h = Us hs is a homomorphism


from A onto B.
The construction of hs at stage s is very similar to the construction of the
homomorphism in the proof of the previous theorem. The only modification is that
at each odd stage s = 2k + 1, the construction makes sure that ak is put into the
domain of the function h s ; at each even stage s = 2k + 2 ,the construction guaran-
tees that bk is put into the range of the function hs . At odd stages the construction
can be carried out successfully because H is an epimorphism condition. The rest
of the proof is left to the reader. 0

Exercise 6.10.14 Finish the proof of the theorem.


396 6. Applications of Rabin Automata

We now give an application of the theorems above. A Boolean algebra B is


atomless if B contains no atoms. An example of an atomless Boolean algebra is
the following. Consider the power set pew). Let F be the ideal of the Boolean
algebra P(w) that consists of all finite subsets of w. Consider the algebra obtained
by factoring pew) by the ideal F. Then the factor algebra is an atomless Boolean
algebra. Note that this Boolean algebra is uncountable.

Exercise 6.10.15 Show that the Boolean algebra of intervals (see Exercise 6.10.3)
of the linearly ordered set [0, 1] is an atomless Boolean algebra.

Exercise 6.10.16 Give an example of a countable atomless Boolean algebra.

Corollary 6.10.5 If B is an atomless Boolean algebra, then for any Boolean al-
gebra A, there exists a homomorphism from B onto A.

Proof. Define the set E C A x B as

E = {(a, b) I a E A, bE B, if a = 0, then b = O}.


It is not hard to see that E is an epimorphism condition. The corollary is proved.

Definition 6.10.10 A homomorphism condition H from A into B is an embedding


condition if the condition (x, 0) E H implies that x = O.

Corollary 6.10.6 If H is an embedding condition from A into B, then there exists


a homomorphism from A into B such that h is a one-to-one mapping.

Proof. Since H is a homomorphism condition by Theorem 6.10.5 we can


construct a homomorphism h from A into B. We need to show that the constructed
h is in fact an embedding. If h is not an embedding, then there exists a stage s + 1
such that hs+l (a) = hs+l (b) for some distinct a, bE A s+!' Hence hs+! (a \ b) =
hs+! (a) \hs+!(b) = O. Note that a \b E A s+!, and we can assume that a \b =1= O.
Then hs+! (a \ b) =1= 0 by the construction of hs+! and the fact that H is an
embedding condition. This is a contradiction. The corollary is proved. D

Definition 6.10.11 A homomorphism condition H from A into B is a isomorphism


condition if H is an epimorphism and embedding condition.

Corollary 6.10.7 If I is an isomorphism conditionfrom A into B, then there exists


an isomorphism from A onto B.

Proof. The proof follows from Theorem 6.10.6 and the corollary above. D

Corollary 6.10.8 Any two atomless Boolean algebras are isomorphic.

Proof. Let A and B be atomless Boolean algebras. Consider the set

H = {CO, 0), (1, I)} U{(a, b) I a E A, bE B, a ft to, I}, b ft to, I}}.


6.10. Application to Boolean Algebras 397

It is not hard to check that I is an isomorphism condition from A into B. The


corollary is proved.
Corollary 6.10.9 Let B be an atomless Boolean algebra. For any algebra A there
exists an ideal I of B such that the factor algebra B I is isomorphic to A.
Proof. By Corollary 6.10.5 there exists a homomorphism h from B onto A.
Consider the ideal I = {b I h(b) = O}. Then by Theorem 6.10.5, the factor algebra
B I is isomorphic to A. The corollary is proved.
Corollary 6.10.10 Let h be a homomorphism from a Boolean algebra B onto
A. There exists a Boolean subalgebra C of B that is isomorphic to the Boolean
algebra A.
Proof. Consider the set

H = feb, a) I h(b) = a and a = 0 if and only if b = O}.


It is not hard to see that H is an embedding condition. Hence A can be embedded
into B.

Corollary 6.10.11 Let B be an atomless Boolean algebra. For any algebra A


there exists a Boolean subalgebra C of B such that C and A are isomorphic.
Proof. By Corollary 6.10.5 there exists a homomorphism h from B onto A.
By the previous corollary there exists a Boolean subalgebra C of B such that C and
A are isomorphic. The corollary is proved.
The exercise below can be proved by finding appropriate isomorphism con-
ditions.

Exercise 6.10.17 Let A be a Boolean subalgebra ofa Boolean algebra B. Assume


that the following conditions hold:
1. Foranya E A there exists afinite set Aa ofatomsofB such that a = V cEAaC.

2. A has infinitely many atoms.


3. B is generated by the set A and all atoms of B.
Show that A and B are isomorphic.

6.10.6 Decidability Results. In this section we will show that the theory of all
countable Boolean algebras with variables that run over ideals is decidable. We will
give an exact definition of this theory, and prove that the theory can be reduced to
S2S. In our proof we use our knowledge from the previous section about Cantor's
discontinuum CD, structures related to CD, and decidability of theories of these
structures. Our interest will be in special types of open sets on CD. Here is a
definition of these sets.
398 6. Applications of Rabin Automata

Definition 6.10.12 A set U S; CD is elopen if U and the complement of U are


open sets.
Thus, we see that U is a elopen set if and only if U and the complement of
U are elosed sets. For any v E {a, I}* the set Uv = {va I a E {a, l}W} is a elopen
set. Therefore, all basic open sets of CD are elopen sets. Recall that the sets of the
type Ux, where Xc {a, I}* and Ux = UVEX Uv , range over all open subsets of
CD. Also, note that CD itself and 0 are elopen sets.

Lemma 6.10.8 An open set U is clopen if and only if there exists a finite set
Xc {a, I}* such that U = Ux.

Proof. Assume that there exists a finite set X C {a, I}* such that U = Ux.
Note that if v ::: W, where u, v E {a, I}*, then U w C U v ' Therefore, we can assume
that for no pair v, W E X do we have v ::: w. Let k = max{lvll v E X}. Consider
the set Y C {a, I}* defined as

Y = {v Ilul = k and no prefix ofu is in X}.


Note that Y =F 0. It is easy to check that the complement of U is Uy. Hence Uy is
open. Therefore, U x is a elopen set.
Now assume that U is a elopen set. We need to show that for some finite set
X we have U = Ux. Take an element a E U. Then there exists a basic open set
Ux such that Ux C U and a E Ux. Let Xl S x2 S ... S Xn be all prefixes of x.
Among these prefixes take the Xi such that UXj C U but UXj _1 ct. U. Denote this
Xi by x(a). Now set

X = {x(a) I a E U}.
We elaim that X is a finite set. Assume X is not a finite set. Consider the set
X' = {y I y ::: x(a) for some X E X}. Then X' is an infinite finitely branching
tree. By Konig's lemma X' has an infinite path, say f3. Clearly, no element of f3
belongs to X'. By the definition of f3 for any x E f3 there exists an a E {a, l}w
such that xa E U. Note also that f3 t/. U. Now the complement of U is an open
set. Hence there exists an x such that Ux C CD \ U and f3 E UX' But as we noted,
xa E U for some a E {a, I}w. Contradiction. We conelude that X is a finite set.
Moreover, U = Ux. The lemma is proved.
Definition 6.10.13 The set BCD is the set of all clopen sets of CD.
The next lemma shows that the set of all elopen sets is an atomless Boolean
algebra.

Lemma 6.10.9 The set BCD ofall clopen sets of CD forms an atom less countable
Boolean algebra.

Proof. Since every elopen set is of the form Ux for some finite X C {a, I}*,
we see that the set of all elopen sets is countable. Clearly, the union, intersection
6.10. Application to Boolean Algebras 399

and the complements of clopen sets are clopen sets. Also 0 and CD are clopen sets.
Hence all the set of all clopen sets is a Boolean algebra. We need to show that the
Boolean algebra BCD of all clopen sets is atomless. Let U be a clopen set. Then
U = Ux for some finite X. We can assume that for no pair v, W E X do we have
v ~ w. Let y E to, l}* be such that some proper prefix x of y is in X. Then U y
is a proper subset of Ux, and Uy is clopen. Hence BCD is an atomless Boolean
algebra. The lemma is proved.

Lemma 6.10.10 For any ideal/of BCD the set V = UUEI U is an open set.
Moreover, for any open set U in CD the set {V E BCD I V C U} is an ideal.

Proof. For any ideal/, the set V = Uu EI U is clearly an open set. The second
part of the lemma can be easily checked using the definition of ideal. The lemma
is proved.
Now we define the language LBA of all Boolean algebras. The language LB
contains individual variables x, y, z, ... , that are intended to run over elements
of Boolean algebras, the operation symbols v, /\, - for representing the Boolean
operations, constant symbols 0 and 1, logical connectives &, V, -', ~, and set
variables /1, h, /3, ... that are intended to run over ideals of Boolean algebras.
The language contains quantifiers 3, 'V that can be applied to the individual as
well as to the set variables. The language also has the symbol E for representing
membership. Formulas and sentences of this language are defined in a natural way.
Now we give the following definition.

Definition 6.10.14 The theory of Boolean algebras Th(RA) in the language LBA
is the set of all sentences of the language that are true in all countable Boolean
algebras.

Our goal is to show that the theory Th(BA) is decidable. In order to show
that Th(BA) is decidable we need to recall the structure (CD, :::::). In this structure,
for all ex, f3 E CD, we have ex :s f3 if and only if there exists a w that is a
finite prefix of both ex and f3 such that wO E ex and wI E f3. The language L
corresponding to the structure (CD, :::::) contains individual variables x, y, z, ... ,
that are intended to run over elements of CD, the symbol::::: representing the order
on CD, logical connectives &, V, -', ~, and set variables of two types. The first
type of set variables are C 1, C2, C3, ... and range over closed subsets of CD; the
second type of set variables are Dl, D2, D3, ... and range over F -subsets of
(T

CD. The language contains quantifiers 3, 'V that can be applied to the individual
as well as to the set variables of both types. The language also has symbols E for
representing membership. Theorem 6.9.6 states that the theory Th(CD) of Cantor's
discontinuum in this language L is decidable.
Here now is our last theorem of this chapter.

Theorem 6.10.7 The theory Th(BA) of all Boolean algebras is decidable.


400 6. Applications of Rabin Automata

Proof. The proof is basically a corollary of Theorem 6.9.6. Indeed, consider


the language L of the structure (CD, :::5). Consider the formula clopen(C) of the
language L which is

where (<1> *+ \II) stands for (<1> -* \II)&(\II -* <1». Note that CI and C2 are
variables for closed sets. Hence a set C S; CD makes the formula true if and
only if C is a clopen set. Note that the operations of union U, intersection n, and
complementation - for clopen sets are all definable in the language L. Consider the
formula openeD) defined as follows:

VX(X E D -* 3C(C c D & clopen(C) & x E C).

Note that the variable D is a variable that runs over Fa-subsets of CD. A subset
D of CD satisfies the formula if and only if D is an open set of CD. Thus, the
Boolean algebra BCD of clopen subsets of CD (see Lemma 6.10.9) is definable
in the language L. Moreover, by Lemma 6.10.10, the open sets of CD can be
associated with the ideals of the Boolean algebra BCD. Now consider the Boolean
algebra BCD of clopen subsets of CD. There exists a formula ~ (I, Ci, Cj) in the
language L such that for all subsets X, Y, Z C CD, formula'" (X, Y, Z) is true
in CD if and only if X is open, Y and Z are c10pen subsets of CD and Y "'x Z.
Recall that "'x is the equivalence relation in the Boolean algebra BCD defined by
the ideal X.
Now by induction on the complexity offormulas we transform every formula
<1> of the language LRA into the formula <1>(t). The transformation will be such that
for all sentences <1>, the sentence <1> is true in all Boolean algebras if and only if <1> (I l
is true in (CD, :::5). Take an atomic formula t = q, where t, q are terms. Replace
all variables Xi occurring in t = q with variables Ci, the operation symbols v, /\,
and - with U, n, and -, respectively. Note that C = CD \ C for all c10pen sets C
of CD. Let t' and q' be the resulting expressions. Then the transformed formula is
VD(open(D) -*'" (D, t', q')).
Take an atomic formula tEl. In the term ( replace variables Xi with variables
Ci, replace the symbols v, /\ and -, with U, n, and -, respectively. Let (' be the
resulting expression. Now replace ( E I with the formula (open(D) & (' S; D).
If <1> is of the form <1>1 r<1>2, where r E {v, &, -*} or <1> = .....,<1>1, then we set
<1>(1) to be <1>\ll r <1>gl, where r E {v, &, -*} or <1> = .....,<1>~t), respectively.
If <1> is any of theformulas VXi <1> I (Xi), VIj <1>1 (lj), then <1>(t) is

and
6.10. Application to Boolean Algebras 401

respectively. Similarly, if <I> is any ofthe formulas 3Xi <1>1 (Xi), 3Ij <1>1 (lj), then we
replace <I> with

and
3Dj(open(Dj) & <I>~t)(Dj»,

respectively. Now the reader can check that for all sentences <1>, we have <I> E
Th(BA) if and only if <l>t E S2S. The theorem is proved.
Bibliography

Automata and Concurrency


[1] M. Abadi, L. Lamport, and P. Wolper, Realizable and unrealizable concurrent
program specifications, in Proceedings ofthe 16th International Colloquium
on Automata, Languages, and Programming, Lecture Notes in Computer
Science 372, Springer-Verlag, Berlin, New York, Heidelberg, 1989, 1-17.

[2] B H. Barnes, A programmer's view of automata, ACM Comput. Surveys,


4-4 (1972), 221-239.

[3] F. Bracho and M. Droste, From domains to automata with concurrency


in Proceendings of the 20th International Colloquium on Automata, Lan-
guages, and Programming, Lecture Notes in Computer Science 700,
Springer-Verlag, Berlin, New York, Heidelberg, 1993, 669-681.

[4] M. Droste and D. Kuske, Automata with concurrency relations, in Proceed-


ings ofWASAC, 1995, 119-139.

[5] D. Drusinsky and D. Harel, On the power of bounded concurrency I: Finite


automata 1. Assoc. Comput. Mach., 41-3 (1994),517-539.

[6] M. Hennessy and R. Milner, On observing nondeterminism and concur-


rency, in J. W. de Bakker and J. van Leeuwen, eds., Proceedings of the
7th International Colloqium on Automata, Languages, and Programming,
404 Bibliography

Lecture Notes in Computer Science 85, Springer-Verlag, Berlin, New York,


Heidelberg, 1980,299-309.

[7] Y. Hirshfeld and F. Moller, Decidability results in automata and process


theory, in F. Moller and G Birtwistle, eds., Logics for Concurrency, Lec-
ture Notes in Computer Science 1043, Springer-Verlag, Berlin, New York,
Heidelberg, 1996, 102-148.

[8] T. Hirst and D. Harel, On the power of bounded concurrency II: Pushdown
automata,l. Assoc. Comput. Mach., 41-3 (1994),540-554.

[9] Z. Manna and A. Pnueli, Specification and verification of concurrent pro-


grams by forall-automata, in Conference Record of the 14th Annual ACM
Symposium on Principles of Programming Languages, ACM, New York,
1987, 1-12.

[10] R. McNaughton, Infinite games played on finite graphs, Ann. Pure Appl.
Logic, 65 (1993), 149-184.

[11] F. Moller and G Birtwistle, eds., Logics for Concurrency: Structure Ver-
sus Automata, Lecture Notes in Computer Science 1043, Springer-Verlag,
Berlin, New York, Heidelberg, 1996.

[12] A. Nerode, and A. Yakhnis, and V. Yakhnis, Concurrent programs as strate-


gies in games, in LFROMCS: Logic from Computer Science: Proceedings
of a Workshop Held November 13-17, 1989, Springer-Verlag, Berlin, New
York, Heidelberg, 1992.

[13] D. Park, Concurrency and automata on infinite sequences, in Theoretical


Computer Science: 5th GI Conference, Lecture Notes in Computer Sci-
ence 104, Springer-Verlag, Berlin, New York, Heidelberg, 1981, 167-183.

[14] A. Pnueli, Linear and branching structures in the semantics and logics of
reactive systems, in Proceedings of the 12th International Colloquium on
Automata, Languages, and Programming, Lecture Notes in Computer Sci-
ence 194, Springer-Verlag, Berlin, New York, Heidelberg, 1985, 15-32.

[15] L. Priese, Automata and concurrency, Theoret. Comput. Sci., 25-3 (1983),
221-265.

[16] H. J. Schneider, Automata theory: What is it used for?, SIGACTN: Newsletter


oftheACM Special Interest Group on Automata and Computability Theory,
7 (1975).

[17] E. W. Stark, On the relations computable by a class of concurrent automata,


in Conference Record of the 17th Annual ACM Symposium on Principles of
Programming Languages, ACM, New York, 1990,329-340.
Bibliography 405

[18] M. Y. Vardi, Verification of concurrent programs: The automata-theoretic


framework, in Proceedings ofthe Symposium on Logic in Computer Science,
IEEE Computer Society Press, Los Alamitos, CA, 1987, 167-176.

[19] M. Y. Vardi, Verification of concurrent programs: The automata-theoretic


framework, Ann. Pure Appl. Logic, 51-1-2 (1991), 79-98.

[20] M. Y. Vardi,Alternating Automata and Program Verification, Lecture Notes


in Computer Science 1000, Springer-Verlag, Berlin, New York, Heidelberg,
1995,471--485.
[21] M. Y. Vardi and P. Wolper, Reasoning about infinite computations, Inform.
and Comput., 115-1 (1994), 1-37.

Automata and Programming


[22] M. Abadi, L. Lamport, and P. Wolper, Realizable and unrealizable concurrent
program specifications, in Proceedings ofthe 16th International Colloquium
on Automata, Languages, and Programming, Lecture Notes in Computer
Science 372, Springer-Verlag, Berlin, New York, Heidelberg, 1989, 1-17.

[23] B. H. Barnes, A programmer's view of automata, ACM Comput. Surveys,


4-4 (1972),221-239.

[24] D. A. Basin and N. Klarlund, Hardware verification using monadic second-


order logic, in Proceedings of the 7th International Conference on Com-
puter Aided Verification, Lecture Notes in Computer Science 939, Springer-
Verlag, Berlin, New York, Heidelberg, 1995,31-41.

[25] J. M. Champarnaud, A programming language for symbolic computation of


regular languages, automata and semigroups, in Proceedings of the 9th An-
nual Symposium on Theoretical Aspects ofComputer Science, Lecture Notes
in Computer Science 577, Springer-Verlag, Berlin, New York, Heidelberg,
1992,605-606.

[26] R. Hojati, V. Singhal, and R. K. Brayton, Edge-StreetIEdge-Rabin Automata


Environment for Formal Verification Using Language Containment, SRC
Report, University of California at Berkeley, Berkeley, CA, 1993.

[27] D. E. Knuth and R. H. Bigelow, Programming language for automata, J. As-


soc. Comput. Mach., 14-4 (1967), 615-635.

[28] Z. Manna and A. Pnueli, Specification and verification of concurrent pro-


grams by forall-automata, in Conference Record of the 14th Annual ACM
Symposium on Principles of Programming Languages, ACM, New York,
1987,1-12.
406 Bibliography

[29] A. Pnueli, Linear and branching structures in the semantics and logics of
reactive systems, in Proceedings of the 12th International Colloquium on
Automata, Languages, and Programming, Lecture Notes in Computer Sci-
ence 194, Springer-Verlag, Berlin, New York, Heidelberg, 1985, 15-32.
[30] W. Thomas and H. Lescow, Logical specification of infinite computations,
in J. W. de Bakker, W.-P. de Roever, and G. Rozenberg, eds., A Decade
of Concurrency: Reflections and Perspectives, Lecture Notes in Computer
Science 803, Springer-Verlag, Berlin, New York, Heidelberg, 1993,583-
621.
[31] M. Y. Vardi, Verification of concurrent programs: The automata-theoretic
framework, in Proceedings ofthe Symposium on Logic in Computer Science,
IEEE Computer Society Press, Los Alamitos, CA, 1987, 167-176.
[32] M. Y. Vardi, Invited talk: Automata theory for database theoreticians, Pro-
ceedings of the 8thACM SIGACT-SIGMOD-SIGART Symposium on Prin-
ciples of Database Systems (PODS '89), ACM, New York, 1989,83-92.
[33] M. Y. Vardi, Verification of concurrent programs: The automata-theoretic
framework, Ann. Pure Appl. Logic, 51-1-2 (1991), 79-98.
[34] M. Y. Vardi, Automata theory for database theoreticians, in J. D. Ullman,
ed., Theoretical Studies in Computer Science, Academic Press, New York,
1992, 153-180.
[35] M. Y. Vardi, Alternating Automata and Program Verification, Lecture Notes
in Computer Science 1000, Springer-Verlag, Berlin, New York, Heidelberg,
1995,471-485.
[36] M. Vardi and P. Wolper, An automata-theoretic approach to automatic pro-
gram verification, in Proceedings of the Symposium on Logic in Computer
Science, IEEE Computer Society Press, Los Alamitos, CA, 1986,322-331.

Automata, Logic, and Games


[37] A. Arnold and D. Niwi'nski, Fixed-point characterization ofBlichi automata
on infinite trees, J. Inform. Process. Cybernet., 26 (1990), 453-461.
[38] A. Arnold and D. Niwi'nski, Fixed point characterization of weak monadic
logic definable sets of trees, in M. Nivat and A. Podelski, eds., Tree Automata
and Languages, Elsevier, New York, Amsterdam, 1992, 159-188.
[39] D. A. Basin and N. Klarlund, Hardware verification using monadic second-
order logic, in Proceedings of the 7th International Conference on Com-
puter Aided Verification, Lecture Notes in Computer Science 939, Springer-
Verlag, Berlin, New York, Heidelberg, 1995,31-41.
Bibliography 407

[40] 1. R. BUchi, Weak second-order logic and finite automata, Z. Math. Logik
Grundlag. Math., 5 (1960), 62-66.
[41] 1. R. BUchi, Weak second-order arithmetic and finite automata, Z. Math.
Logik Grundlag. Math., 6 (1960), 66-92.
[42] 1. R. BUchi, On a decision method in restricted second-order arithmetic, in
Proceedings ofthe 1960 International Congress for the Logic, Methodology,
and Philosophy of Science, Stanford University Press, Stanford, CA, 1962.
[43] 1. R. BUchi, Using determinancy of games to eliminate quantifiers, in Pro-
ceedings of the 1977 International Conference on Fundamentals of Com-
putation Theory, Lecture Notes in Computer Science 56, Springer-Verlag,
Berlin, New York, Heidelberg, 1977,367-378.

[44] 1. R. BUchi. State-strategies for games in Fao n G&a 1. Symb. Logic, Vol.
48 (1983),1171-1198.
[45] 1. R. BUchi and L. H. Landweber, Solving sequential conditions by finite-
state strategies, Trans. Amer. Math. Soc., 138 (1969), 295-311.

[46] 1. R. BUchi and 1. B. Wright, Mathematical Theory of Automata, course


notes, University of Michigan at Ann Arbor, Ann Arbor, MI, 1960.

[47] A. W. Burks and H. Wang, The logic of automata: Part I, J. Assoc. Comput.
Mach., 4-2 (1957),193-218.
[48] A. W. Burks and H. Wang, The logic of automata: Part II, J. Assoc. Comput.
Mach., 4-3 (1957), 279-297.

[49] P. E. Caines, R. Greiner, and S. Wang, Dynamical logic observers for finite
automata, in Proceeding of the 27th IEEE Conference on Decision and
Control, IEEE Computer Society Press, Los Alamitos, CA, 1988,226-233.
[50] A. Church, Logic, arithmetic, and automata, in Proceedings of the Interna-
tional Congress of Mathematicians, 1962,23-35.

[51] E. Clarke and E. A. Emerson, Design and synthesis of synchronization


skeletons using branching-time temporal logic, in Proceedings, Workshop
on Logic of Programs, Lecture Notes in Computer Science 131, Springer-
Verlag, Berlin, New York, Heidelberg, 1981.

[52] A. Cobham, On the base-dependence of sets of numbers recognizable by


finite automata, Math. Systems Theory, 3-2 (1969),186-192.

[53] H. Comon, Sequentiality, second order monadic logic and tree automata, in
Proceedings of the 10th IEEE Symposium on Logic in Computer Science,
IEEE Computer Society Press, Los Alamitos, CA, 1995,508-517
408 Bibliography

[54] H. Comon, D. Kozen, H. Seidl, and M. Y. Vardi, eds., Applications of


Tree Automata in Rewriting, Logic, and Programming, Dagstuhl-Seminar-
Report 193, SchloB Dagstuhl, Wadern, Germany, 1997.
[55] M. Dam, Fixpoints of Btichi automata, in International Conference on the
Foundations of Software Technology and Theoretical Computer Science,
Lecture Notes in Computer Science, Springer-Verlag, Berlin, New York,
Heidelberg, 1992,39-50.
[56] M. Dauchet, Rewriting and tree automata, in H. Comon and J. P. Jouan-
naud, eds., Term Rewriting: French Spring School of Theoretical Computer
Science, Lecture Notes in Computer Science 909, Springer-Verlag, Berlin,
New York, Heidelberg, 1993,95-113.
[57] M. J. Dinneen and B. Khoussainov, Update games and update networks,
in Proceedings of the 10th Australasian Workshop on Combinatorial Algo-
rithms (AWOCA '99), Curtin University of Technology, Perth, 1999,7-18.
[58] 1. Elgaard, N. Klarlund, and A. Moller, MONA l.x: New techniques for
W S 1Sand W S2S, Proceedings of the 10th International Conference on
Computer Aided Verification, Lecture Notes in Computer Science 1427,
Springer-Verlag, Berlin, New York, Heidelberg, 1998,516-520.
[59] C. C. Elgot and M. O. Rabin, Decidability and undecidability of extensions
of second (first) order theory of (generalized) successor, J. Symbolic Logic,
31-2 (1966), 169-181.
[60] E. A. Emerson, Automated temporal reasoning about reactive systems, in
Logicsfor Concurrency: Structure Versus Automata, Lecture Notes in Com-
puter Science 1043, Springer-Verlag, Berlin, New York, Heidelberg, 1996,
41-101.
[61] E. A. Emerson and C. S. Jutla, The complexity of tree automata and log-
ics of programs, in Proceedings of the 20th Annual IEEE Symposium on
the Foundations of Computer Science, IEEE Computer Society Press, Los
Alamitos, CA, 1988,328-337.
[62] E. A. Emerson and C. S. Jutla, Tree automata, fL-calculus and determinacy, in
Proceedings of the 32nd IEEE Symposium on the Foundations of Computer
Science, IEEE Computer Society Press, Los Alamitos, CA, 1991,368-377.
[63] E. A. Emerson and C. Jutla, Complexity of tree automata and modal logics
of programs, SIAM J. Comput., 29-1 (2000), 132-158.
[64] G File, Tree automata and logic programs, in Proceedings on the 2nd Sym-
posium on Theoretical Aspects of Computer Science, Lecture Notes in Com-
puter Science 182, Springer-Verlag, Berlin, New York, Heidelberg, 1985,
119-130.
Bibliography 409

[65] Y. Gurevich and L. Harrington, Trees, automata, and games, in Proceedings


of the 14th A CM Symposium on the Theory of Computing, ACM, New York,
1982,60-65.

[66] J. L. Jensen, M. E. Jorgensen, N. Klarlund, and M. I. Schwartzbach, Auto-


matic verification of pointer programs using monadic second-order logic,
in Proceedings of the ACM SIGPLAN '97 Conference on Programming
Language Design and Implementation (PLDl), ACM, New York, 1997,
226-236.

[67] N. Klarlund and D. Kozen, Rabin measures and their applications to fairness
and automata theory, in Proceedings of the 6th Symposium on Logic in
Computer Science, IEEE Computer Society Press, Los Alamitos, CA, 1991,
256-265.

[68] S. C. Kleene, Representation of events in nerve nets and finite automata, in


C. E. Shannon and 1. McCarthy, eds., Automata Studies, Princeton Univer-
sity Press, Princeton, NJ, 1956,3-41.

[69] R. E. Ladner, Application of model theoretic games to discrete linear orders


and finite automata, Inform. and Control, 33 (1977), 281-303.

[70] R. McNaughton, Infinite games played on finite graphs, Ann. Pure Appl.
Logic, 65 (1993), 149-184.

[71] C. Michaux and R. Villemaire, Presburger arithmetic and recognizability


of natural numbers by automata: New proofs of Cobham's and Semenov's
theorems, Ann. Pure Appl. Logic, 77 (1996), 251-277.

[72] F. Moller, Logics for concurrency: Structure versus automata,ACM Comput.


Surveys, 28-4es (1996).

[73] D. E. Muller, A. Saoudi, and P. E. Schupp, Alternating automata, the


weak monadic theory of trees and its complexity, Theoret. Comput. Sci.,
97-2 (1992), 233-244.

[74] D. E. Muller, A. Saoudi, and P. E. Schupp, Weak alternating automata give a


simple explanation of why most temporal and dynamic logics are decidable
in exponential time, Proceedings of the 3rd Annual Symposium on Logic in
Computer Science, IEEE Computer Society Press, Los Alamitos, CA, 1988,
422-427.

[75] A. Nerode, Linear automata transformations, Proc. Amer. Math. Soc.,


9 (1958), 541-544.
410 Bibliography

[76] A. Pnueli, Linear and branching structures in the semantics and logics of
reactive systems, in Proceedings of 12th International Colloquium on Au-
tomata, Languages, and Programming, Lecture Notes in Computer Sci-
ence 194, Springer-Verlag, Berlin, New York, Heidelberg, 1985, 15-32.
[77] M. O. Rabin, Decidability of second-order theories and automata on infitite
trees, Trans. Amer. Math. Soc., 141 (1969), 1-35.
[78] M. O. Rabin, Weakly definable relations and special automata, in Y. Bar-
Hilel, ed., Proceedings of the Symposium on Mathematical Logic and the
Foundations of Set Theory, North-Holland, Amsterdam, 1970, 1-23.
[79] M. O. Rabin, Automata on Infinite Objects and Church's Problem, AMS,
Providence, 1972.
[80] M. O. Rabin, Decidable theories, in Handbook ofMathematical Logic, Stud-
ies in Logic and the Foundations of Mathematics 90, North-Holland, Am-
sterdam, 1977,595-629.

[81] M. O. Rabin andD. Scott, Finite automata and their decision problems, IBM
1. Res. Develop., 3 (1959), 114-125.

[82] S. Safra and M. Y. Vardi, On (V-automata and temporal logic, in Proceedings


of the 21st ACM Symposium on the Theory of Computing, ACM, New York,
1989.
[83] A. P. Sistla, M. Y. Vardi, and P. Wolper, The complementation problem for
Biichi automata with applications to temporal logic, Theoret. Comput. Sci.,
49-2-3 (1987), 217-237.
[84] H. Straubing, Finite Automata, Formal Logic, and Circuit Complexity,
Birkhauser, Boston, 1994.
[85] R. S. Streett and E. A. Emerson, An automata theoretic decision procedure
for the propositional JL-calculus, Inform. and Control, 81 (1989),249-264.
[86] J. W. Thatcher and J. B. Wright, Generalized finite automata theory with
an application to a decision problem of second-order logic, Math. System
Theory, 2 (1968), 57-81.
[87] W. Thomas, Languages, Automata, and Logic, Handbook of Formal Lan-
guages 3, Springer-Verlag, Berlin, New York, Heidelberg, 1997.
[88] W. Thomas and H. Lescow, Logical specification of infinite computations,
in J. W. de Bakker, W.-P. de Roever, and G Rozenberg, eds., A Decade
of Concurrency: Reflections and Perspectives, Lecture Notes in Com-
puter Science 803, Springer-Verlag, Berlin, New York, Heidelberg, 1993,
583-621.
Bibliography 411

[89] B. A. Trakhtenbrot, Finite automata and the logic of monadic predicates,


Dokl. Akad. Nauk CCCP, 140 (1961),326-329 (in Russian).

[90] M. Y. Vardi and P. Wolper, Automata-theoretic techniques for modal logic


of programs, J. Comput. System Sci., 32 (1986),183-221.

[91] M. Y. Vardi and P. Wolper, Reasoning about infinite computations, Inform.


and Comput., 115-1 (1994), 1-37.

[92] A. Yakhnis and V. Yakhnis, Gurevich-Harrington's games defined by finite


automata, Ann. Pure Appl. Logic, 62 (1993), 265-294.

Automata, Algebra, and Natural Numbers


[93] A. Boudet and H. Comon, Diophantine equations, Presburger arithmetic
and finite automata, in H. Kirchner, ed., Proceedings of the Colloquium on
Trees in Algebra and Programming (CAAP '96), Lecture Notes in Computer
Science, Springer-Verlag, Berlin, New York, Heidelberg, 1996.

[94] J. R. Biichi (D. Siefkes, ed.), Finite Automata, Their Algebras and Gram-
mars: Towards a Theory of Formal Expressions, Springer-Verlag, Berlin,
New York, Heidelberg, 1988.

[95] A. Cobham, On the base-dependence of sets of numbers recognizable by


finite automata, Math. Systems Theory, 3-2 (1969),186-192.

[96] M. Chrobak, Finite automata and unary languages, Theoret. Comput. Sci.,
47-2 (1986),149-158.

[97] M. J. Dinneen and B. Khoussainov, Automata with equational constraints,


in Proceedings of the Australasian Workshop on Constraint Programming
and Applications (CPA-99), University of New South Wales Sydney, 1999,
42-51.

[98] S. Eilenberg, Automata, Languages, and Machines, Vol. A, Academic Press,


New York, 1974.

[99] S. Eilenberg, Automata, Languages, and Machines, Vol. C, Academic Press,


New York, 1978.

[100] S. Eilenberg, C. C. Elgot, and J. C. Shepherdson, Sets recognized by n-tape


automata, J. Algebra, 13 (1969), 447-464.

[101] S. Eilenberg and J. B. Wright, Automata in general algebra, Inform. and


Control, 11 (1967),452-470.
412 Bibliography

[102] A. C. Fleck, Isomorphism groups of automata, 1. Assoc. Comput. Mach.,


9-4 (1962), 469-476.
[103] F. Gecseg and M. Steinby, Tree Automata, Akademiai Kiad6, Budapest,
1984.
[104] J. W. Grzymala-Busse, On the endomorphisms of finite automata, Math.
Systems Theory, 4-4 (1970), 373-384.
[105] J. Hartmanis and H. Shank, On the recognition of primes by automata,
1. Assoc. Comput. Mach., 15-3 (1968), 382-389.
[106] J. Hartmanis and H. Shank, Two memory bounds for the recognition of
primes by automata, Math. Systems Theory, 3-2 (1969), 125-129.
[107] O. H. Ibarra, S. K. Sahni, and C. E. Kim, Finite automata with mutliplication,
Theoret. Comput. Sci., 2-3 (1976),271-294.
[108] B. Khoussainov and A. Nerode, Automatic presentations of structures, Pro-
ceedings of the International Workshop on Logic and Computational Com-
plexity, Indianapolis, 1994.
[l09] D. Kozen, On Kleene algebras and closed semirings, in B. Rovan, ed.,
Mathematical Foundations of Computer Science, Lecture Notes in Com-
puter Science 452, Springer-Verlag, Berlin, New York, Heidelberg, 1990,
26-47.
[110] D. Kozen, Partial Automata and Finitely Generated Congruences: An Ex-
tension of Nerode s Theorem, Technical Report DAIMI PB-400, Computer
Science Department, Aarhus University, Aarhus, Denmark, 1992.
[111] D. Kozen, On the Myhill-Nerode theorem for trees, Bull. European Assoc.
Theoret. Comput. Sci., 47 (1992),170---173.
[112] D. Kozen, A completeness theorem for Kleene algebras and the algebra of
regular events, Inform. and Comput., 110 (1994), 366-390.
[113] D. Kozen, Automata and Computability, Springer-Verlag, Berlin, New York,
Heidelberg, 1997.
[114] D. Kozen and F. Smith, Kleene Algebra with Tests: Completeness and De-
cidability, Technical Report TR96-1582, Cornell University, Ithaca, NY,
1996.
[115] K. Lodaya and P. Weil, Series-parallel posets: Algebra, automata and lan-
guages, in M. Morvan, C. Meinel, and D. Krob, eds., Proceedings of the
Symposium on Theoretical Aspects of Computer Science (Paris 1998), Lec-
ture Notes in Computer Science 1373, Springer-Verlag, Berlin, New York,
Heidelberg, 1998,555-565.
Bibliography 413

[116] Y-F. Lin, On input semigroups of automata, Math. Systems Theory, 4-


1 (1970),35-39.

[117] A. R. Meyer and C. Thompson, Remarks on algebraic decomposition of


automata, Math. Systems Theory, 3-2 (1969), 110-118.

[118] A. Nerode, Linear automata transformations, Proc. Amer. Math. Soc.,


9 (1958), 541-544.

[119] H. E. Pickett, Note concerning the algebraic theory of automata, 1. Assoc.


Comput. Mach., 14-2 (1967), 382-388.

[120] G Ricci, Cascades of tree-automata and computations in universal algebras,


Math. Systems Theory, 7-3 (1973),201-218.

[121] W. Thatcher and J. B. Wright, Generalized finite automata with an appli-


cation to a decision problem of second order logic, Math. Systems Theory,
2 (1968), 57-82.

[122] K. Uemura, Semi groups and automorphism groups of strongly connected


automata, Math. Systems Theory, 8-1 (1974),8-14.

[123] F. W. Vaandrager, On the relationship between process algebra and in-


put/output automata, in Proceedings of the 1991 Symposium on Logic in
Computer Science, IEEE Computer Society Press, Los Alamitos, CA, 1991,
387-398.

[124] P. Weil, Groups, codes and unambiguous automata, in Proceeding of the


2nd Symposium of Theoretical Aspects of Computer Science, Lecture Notes
in Computer Science 182, Springer-Verlag, Berlin, New York, Heidelberg,
1985,351-362.

[125] H. P. Zeiger, Yet another proof of the cascade decomposition theorem for
finite automata, Math. Systems Theory, 1-3 (1967), 225-228.

Automata, Decidability, and Complexity


[126] J. R. Btichi, On a decision method in restricted second-order arithmetic, in
Proceedings ofthe 1960 International Congress for the Logic, Methodology,
and Philosophy of Science, Stanford University Press, Stanford, CA, 1962.

[127] S. Cho and D. T. Huynh, The parallel complexity of finite-state automata


problems, Inform. and Comput., 97-1 (1992), 1-22.

[128] K. Culik and J. Karhumaki, Finite automata computing real functions, SIAM
1. Comput., 23-4 (1994), 789-814.
414 Bibliography

[129] C. Dwork and L. Stockmeyer, A time complexity gap for two-way proba-
bilistic finite-state automata, SIAM J. Comput., 19-6 (1990), 1011-1023.

[130] C. C. Elgot and M. O. Rabin, Decidability and undecidability of extensions


of second (first) order theory of (generalized) successor, J. Symbolic Logic,
31-2 (1966), 169-181.

[l31] E. A. Emerson and C. S. Jutia, The complexity of tree automata and log-
ics of programs, in Proceedings of the 20th Annual IEEE Symposium on
the Foundations of Computer Science, IEEE Computer Society Press, Los
Alamitos, CA, 1988328-337.

[132] E. A. Emerson and C. Jutia, Complexity of tree automata and modal logics
of programs, SIAM J. Comput., 29-1 (2000), l32-158.

[l33] R. Freivalds, Complexity of probabilistic versus deterministic automata,


in Baltic Computer Science: Selected Papers, Lecture Notes in Com-
puter Science 502, Springer-Verlag, Berlin, New York, Heidelberg, 1991,
565-613.

[134] J. Friedman, A decision procedure for computations of finite automata, J. As-


soc. Comput. Mach., 9-3 (1962), 315-323.

[135] E. Grandjean, A nontrivial lower bound for an NP problem on automata,


SIAM 1. Comput., 19-3 (1990), 438-451.

[136] J. Hartmanis, On the complexity of undecidable problems in automata the-


ory, J. Assoc. Comput. Mach., 16-1 (1969), 160-167.

[137] J. E. Hopcroft and J. D. Ullman, Decidable and undecidable questions about


automata, J. Assoc. Comput. Mach., 15-2 (1968), 317-324.

[l38] D. Kozen, Automata and Computability, Springer-Verlag, New York, 1997.

[l39] R. Kurshan, Complementing deterministic Blichi automata in polynomial


time, J. Comput. System Sci., 35 (1987), 59-71.

[140] O. Kupferman and M. Y. Vardi, Weak alternating automata and tree au-
tomata emptiness, in Proceedings of the 1998 Symposium of the Theory of
Computing, ACM, New York, 1998,224-233

[141] L. H. Landweber, Decision problems for omega-automata, Math. Systems


Theory, 3-4 (1969), 376-384.

[142] R. McNaughton, Infinite games played on finite graphs, Ann. Pure Appl.
Logic, 65 (1993), 149-184.
Bibliography 415

[143] D. E. Muller, A. Saoudi, and P. E. Schupp, Alternating automata, the weak


monadic theory of the tree and its complexity, in L. Kott, ed., Proceed-
ings of the 13th International Colloquium on Automata, Languages, and
Programming, Lecture Notes in Computer Science 226, Springer-Verlag,
Berlin, New York, Heidelberg, 1986,275-283.

[144] M. O. Rabin and D. Scott, Finite automata and their decision problems, IBM
1. Res. Develop., 3 (1959), 114-125.

[145] M. O. Rabin, Decidability of second-order theories and automata on infitite


trees, Trans. Amer. Math. Soc., 141 (1969),1-35.

[146] M. O. Rabin, Complexity of computations, Comm. Assoc. Comput. Mach.,


20 (1977),625-633.

[147] S. Safra, On the complexity of omega-automata, in Proceedings of the 29th


Annual IEEE Symposium on the Foundations of Computer Science, IEEE
Computer Society Press, Los Alamitos, CA, 1988,319-327.

[148] S. Safra, Complexity ofAutomata on Infinite Objects, Ph.D. thesis, Weizman


Institute of Science, Rehovot, Israel, 1989.

[149] H. Seidl, Deciding equivalence of finite tree automata, SIAM 1. Comput.,


19 (1990), 424-437.

[150] S. K. Shulka, H. Hunt, D. J. Rosenkrantz, and R. E. Stearns, On the com-


plexity of relational problems for finite state processes, in Proceedings of
the International Conference on Automata, Languages, and Programming,
Lecture Notes in Computer Science 623, Springer-Verlag, Berlin, New York,
Heidelberg, 1995.

[151] J. Stern. Complexity of some problems from the theory of automata. Infor-
mation Computation, 66 (1985), 163-176.

[152] L. Stockrneyer, The Complexity of Decision Problems in Automata Ttheory


and Logic, Technical Report MAC-TR-133, Project MAC, MIT, Cambridge,
MA,1974.

[153] R. S. Streett and E. A. Emerson, An automata theoretic decision procedure


for the propositionallL-calculus, Inform. and Control, 81 (1989),249-264.

[154] M. Veanes, On Computational Complexity of Basic Decision Problems of


Finite Tree Automata, UPMAIL Technical Report 133, Computing Science
Department, Uppsala University, Uppsala, Sweden, 1997.
416 Bibiiography

Automata, Probability, and Topology


[155] N. Abe and M. Warmuth, On the computational complexity of approximating
distributions by probability automata, Mach. Learning, 9 (1992), 205-260.

[156] R. Barua, The Hausdorff-Kuratowski hierarchy of omega-regular languages


and a hierarchy of Muller automata, Theoret. Comput. Sci., 96-2 (1992),
345-360.

[157] M. Blum and W. 1. Sakoda, On the capability of finite automata in 2 and 3


dimensional space, in Proceedings of the 18th Annual IEEE Symposium on
the Foundations of Computer Science, IEEE Computer Society Press, Los
Alamitos, CA, 1977, 147-161.

[158] J. Cliff, On possibilistic automata, in F. Pichler and R. M. Diaz, eds., Com-


puter Aided Systems Theory: EUROCAST'93, Springer-Verlag, Berlin, New
York, Heidelberg, 1994,231-242.

[159] A. Condon, L. Hellerstein, S. Pottle, and A. Wigderson, On the power of


finite automata with both nondeterministic and probabilistic states, SIAM 1.
Comput., 27-3 (1998), 739-762.

[160] A. Condon and R. Ladner, Probabilistic game automata (preliminary ver-


sion), in A. L. Selman, ed., Structure in Complexity Theory, Lecture Notes
in Computer Science 223, Springer-Verlag, Berlin, New York, Heidelberg,
1986, 144-162.

[161] H. Edelsbrunner, L. J. Guibas, J. Pach, R. Pollack, R. Seidel, and M. Sharir,


Arrangements of curves in the plane: Combinatorics, topology, and algo-
rithms, in Proceedings of the 15th International Colloquium on Automata,
Languages and Programming, Springer-Verlag, Berlin, New York, Heidel-
berg, 1988,214-229.

[162] C. Dwork and L. Stockmeyer, A time complexity gap for two-way proba-
bilistic finite-state automata, SIAM 1. Comput., 19-6 (1990), 1011-1023.

[163] C. Dwork and L. Stockmeyer, On the power of2-way probabilistic finite state
automata, in Proceedings ofthe 30th Annual Symposium on the Foundations
of Computer Science, IEEE Computer Society Press, Los Alamitos, CA,
1989,480-485.

[164] R. Freivalds, Complexity of probabilistic versus deterministic automata,


in Baltic Computer Science: Selected Papers, Lecture Notes in Com-
puter Science 502, Springer-Verlag, Berlin, New York, Heidelberg, 1991,
565--613.
Bibliography 417

[165] S. Kannan and A. C. Yao, Program checkers for probability generation,


in Proceedings of the International Colloquium on Automata, Languages,
and Programming, Springer-Verlag, Berlin, New York, Heidelberg, 1991,
163-173.

[166] L. 1. Kohout, Automata and topology, in E. Mamdani and B. R. Gaines, eds.,


Discrete Systems and Fuzzy Reasoning, Academic Press, London, 1976.

[167] M. O. Rabin, Probabilistic automata, Inform. and Control, 6 (1963), 230-


245.

[168] A. Requicha and R. Tilove, Mathematical foundations of constructive solid


geometry: General topology of closed regular sets, in Automata, Languages,
and Programming: Production Automation Project, March '78, University
of Rochester, Rochester, NY, 1978.

[169] W.-G. Tzeng. A polynomial-time algorithm for the equivalence of proba-


bilistic automata, SIAM 1. Comput., 21-2 (1992),216-227.

Automata and Hybrid Systems


[170] R. Alur and D. L. Dill, Automata for modeling real-time systems, in M. S. Pa-
terson, ed., Proceedings ofthe 1990 International Colloquium on Automata,
Languages, and Programming, Lecture Notes in Computer Science 443,
Springer-Verlag, Berlin, New York, Heidelberg, 1990,322-335.

[171] R. Alur, C. Courcoubetis, D. Dill, N. Halbwachs, and H. Wong Toi, An im-


plementation of three algorithms for timing verification based on automata
emptiness, in Proceedings of the 13th IEEE Real-Time Systems Symposium,
IEEE Computer Society Press, Los Alamitos, CA, 1992, 157-166.

[172] R. Alur, C. Courcoubetis, N. Halbwachs, T. A. Henzinger, P.-H. Ho,


X. Nicollin, A. Olivero, 1. Sifakis, and S. Yovine, Hybrid automata: An al-
gorithmic approach to the specification and verification of hybrid systems,
Theoret. Comput. Sci., 138 (1995), 3-34.

[173] M. Archer and C. Heitmeyer, Verifying hybrid systems modeled as timed


automata: A case study, in O. Maler, ed., Proceedings of the International
Workshop on Hybrid and Real-Time Systems (HART '97), Lecture Notes in
Computer Science 1201, Springer-Verlag, Berlin, New York, Heidelberg,
1997, 171-185.

[174] E. R. Cury, B. H. Krogh, and T. Niinomi, Synthesis of supervisory controllers


for hybrid systems based on approximating automata, IEEE Trans. Automat.
Control, Special Issue on Hybrid Systems, 43-4 (1998), 564-568.
418 Bibiiography

[175] R. Grossman and R. Larson, Viewing hybrid systems as products of con-


trol systems and automata, in Proceedings of the 31st IEEE Conference on
Decision and Control, IEEE Computer Society Press, Los Alamitos, CA,
1992,2953-2955.

[176] T. A. Henzinger, The theory of hybrid automata, in Proceedings of the 11th


Annual Symposium on Logic in Computer Science, IEEE Computer Society
Press, Los Alamitos, CA, 1996,278-292.

[177] N. Lynch, R. Segala, F. Vaandrager, and H. B. Weinberg, Hybrid 110 au-


tomata, in Hybrid Systems III, Lecture Notes in Computer Science 1066,
Springer-Verlag, Berlin, New York, Heidelberg, 1996,496-510.

[178] O. Maler, A. Pnueli, and Z. Sifakis, On the synthesis of discrete controllers


for timed systems, in E. W. Mayr and C. Puech, eds., Proceedings ofthe 1995
Symposium on Theoretical Aspects of Computer Science, Lecture Notes in
Computer Science, Springer-Verlag, Berlin, New York, Heidelberg, 1995,
229-242.

[179] A. Nerode and W. Kohn, Models for hybrid systems: Automata, topologies
controllability, observability, in Hybrid Systems, Lecture Notes in Com-
puter Science 736, Springer-Verlag, Berlin, New York, Heidelberg, 1993,
317-356.

[180] A. Nerode, 1. B. Remmel, and A. Yakhnis, Hybrid systems games: Extrac-


tion of control automata with small topologies, in P. Antsaklis, W. Kohn,
A. Nerode, and S. Sastry, eds., Hybrid Systems IV, Lecture Notes in Com-
puter Science 1273, Springer-Verlag, Berlin, New York, Heidelberg, 1997,
248-293.

[181] A. Nerode and A. Yakhnis, Control A utomata and Fixed Points ofSet-Valued
Operators for Discrete Sensing Hybrid Systems, Technical Report 93-105,
Mathematical Sciences Institute, Cornell University, Ithaca, NY, 1993.

[182] A. Rabinovich and B. A. Trakhtenbrot, From finite automata to hybri~ sys-


tems, in Fundamentals of Computation Theory, Lecture Notes in Com-
puter Science 1279, Springer-Verlag, Berlin, New York, Heidelberg, 1997,
411--422.

[183] J. G Thistle, On the control of systems modelled as deterministic Ra-


bin automata, Discrete Event Dynamic Systems Theory Appl., 5 (1995),
357-381.
Bibliography 419

Automata and Image Processing


[184] K. Culik and S. Dube, Affine automata and related techniques for generation
of complex images, Theoret. Comput. Sci., 116-2 (1993), 373-398.

[185] K. Culik and J. Kari, Image compression using weighted finite automata,
Comput. and Graph., 17 (1993), 305-3l3.
[186] K. Culik and J. Kari, Finite state transformation of images, Comput. and
Graph., 34 (1997),151-166.
[187] Y. Lin and H. C. Yen, An (V-automata approach to the compression ofbi-Ievel
images, in Computing: The Australiasian Theory Symposium (CATS 2000),
Australian National University, Canberra, 2000, 29-43

[188] A. Rosenfeld, Cellular architectures: From automata to hardware, in L. Uhr,


ed., Multicomputers and Image Processing Algorithms and Programs, Aca-
demic Press, New York, 1982,253-260.

[189] A. Safir and B. Zavidovique, On the synthesis of specific image processing


automata from emulation results, in Proceedings of IEEE EURO ASIC, Gre-
noble, France, 1989, 104--115.

[190] A. N. Shah, Pebble automata on arrays, Comput. Graph. Image Process.,


1974,236-246.

[191] B. Zavidovique, C. Fortunel, G Qu'enot, A. Safir, J. S'erot, and F. Verdier,


Automatic synthesis of vision automata, in M. A. Bayoumi, ed., VLSI De-
sign Methodologies for Digital Signal Processing Architectures, Kluwer
Academic Publishers, Dordrecht, the Netherlands, 1994.

Automata and Networks


[192] P. C. Bressloff and J. Stark, Neural networks, learning automata and iterated
function systems, in A. J. Crilly, R. A. Earnshaw, and H. Jones, eds., Fractals
and Chaos , Springer-Verlag, Berlin, New York, Heidelberg, 1991, 145-164.

[193] R. W. Brockett, Dynamical systems and their associated automata, in


R. Menniken, and U. Helmke, and J. Saurer, eds., Systems and Networks:
Mathematical Theory and Applications, Akademie Verlag, Berlin, 1994.

[194] J. A. Brzozowski and E. Leiss, On equations for regular languages, finite


automata, and sequential networks, Theoret. Comput. Sci., 10 (1980), 19-35.

[195] A. Cleeremans, D. Servan-Schreiber, and J. L. McClelland, Finite state


automata and simple recurrent networks, Neural Comput., 1-3 (1989),
372-381.
420 Bibliography

[196] P. Frasconi, M. Gori, M. Maggini, and G Soda, Representation of finite


state automata in recurrent radial basis function networks, Mach. Learning,
23 (1996), 5-32.

[197] C. L. Giles, C. B. Miller, D. Chen, H. H. Chen, G Z. Sun, and Y. C. Lee,


Learning and extracted finite state automata with second-order recurrent
neural networks, Neural Comput., 4-3 (1992), 393-405.

[198] E. Goles and S. Martinez, Neural and Automata Networks, Kluwer Aca-
demic Publishers, Dordrecht, the Netherlands, 1990.

[199] E. Madelaine and D. Vergamini, Auto: A verification tool for distributed


systems using reduction of finite automata networks, in S. Vuong, ed., For-
mal Description Techniques II, North-HollandlElsevier Science Publishers,
Amsterdam, Dordrecht, 1989,61-66.

[200] P. Manolios and R. Fanelli, First-order recurrent neural networks and deter-
ministic finite state automata Neural Comput., 6 (1994), 1155-1173.

[201] O. V. Nedzelnitsky Jr. and K. S. Narendra, Nonstationary models ofiearning


automata routing in data communication networks, IEEE Trans. Systems
Man Cybernet., 17-6 (1987),1004-1015.

[202] I. Noda and M. Nagao, A learning method for recurrent neural networks
based on minimization of finite automata, Proceedings of the International
Joint Conference on Neural Networks, Vol. 1, IEEE Computer Society Press,
Los Alamitos, CA, 1992,27-32.

[203] C. W. Omlin and C. L. Giles, Constructing deterministic finite-state automata


in recurrent neural networks, J. Assoc. Comput. Mach., 43 (1996), 937-972.

[204] C. Omlin, K. Thornber, and C. Giles, Fuzzy finite-state automata can be


deterministically encoded into recurrent neural networks, IEEE Trans. Fuzzy
Systems, 6-1 (1998),76-89.

[205] P. Quinton, The systematic design of systolic arrays, in F. Fogelman,


Y. Robert, and M. Tschuente, eds., Automata Networks in Computer Sci-
ence, Manchester University Press, Manchester, UK, 1987,229-260.

[206] A. Rosenfeld, Networks of automata: Some applications, IEEE Trans. Sys-


tems Man Cybernet., 5 (1975), 380--383.

[207] P. Rosenstiehl, 1. R. Fiksel, and A. Holliger, Intelligent graphs: Networks


of finite automata capable of solving graph problems, in R. C. Read, ed.,
Graph Theory and Computing, Academic Press, New York, 1972, 219-265.
Bibliography 421

[208] R. L. Watrous and G M. Kuhn, Induction of finite-state automata using


second-order recurrent networks, in J. Moody, S. J. Hanson, and R. P. Lipp-
mann, eds., Advances in Neural Information Processing Systems, Vol. 4,
Academic Press, New York, 1992,306-316.
Index

(F(O) , F(1), r, C, a)-rank, 289 Q(i)(q),311


2 A ,18 Q(f, g), 284
C p ,285 Qp,286
Dn(v),267 ~-tree, 251
Fa-set, 376 a(n, m), 150
L(A), 57,88, 137 E,1
P(A),18 AC,62
Q-like linear orders, 356 A d ,63
R~'c, 287 Al EI1 A2, 60
S-display, 320 Ii, 1
T(s,a),49 w,2
Ux ,372 w-language, 129
VWW+, 180 pre/(LI, L2), 68
Vb ,251 CD,371
WL,143 Cons (f), 284
W+,176 Display, 233
WW,143 Node(p),319
W p ,286 lvr, 232, 233, 306
WF
s,s
/,151 of position, 232
Z,2 lV,151
r(i)(q),311 aRb,15
r p' 287 c(R),98
Q(f, g), 284 /p,286
424 Index

k-ary predicate, 10 associated points, 176


k-ary relation, 10 associative law, 76
k-place predicate, 10 atom, 388
n-ary operation, 11 atomic formulas, 190
n-place operation, 11 atomless Boolean algebra, 396
ra ,371 automata
S -+u Sl, 148 E,101
S -+~ Sf,151 k-variable,98
t(ao, ... ,an ),334 commutative, 101
t(xo, ... , xn), 333 complete, l38
R,11 deterministic, 49
deterministic BUchi, l30, 162,
acceptance 164
by BUchi automata, l35 game, 272
by finite automata, 53 generalized, 87
by game automata, 276 generalized and reduced, 89
by generalized finite automata, MUller, 164, 323
87 minimal, 75
by MUller automata, 165 nondeterministic BUchi, 129
by Rabin automata, 257 nondeterministic finite, 48
by sequential Rabin automata, Rabin, 253
171 representing a formula, 199
by special automata, 263 representing formulas, 118,347
accepting pair, 171 sequential Rabin, 171
accessibility, 56 special, 263
accessibility operator, 57 with silent moves, 70
adding linearly ordered sets, 16
algebra B(F),243
Boolean, 382 back and forth argument, 357
Boolean BCD, 399 basic open sets, 372
connected, 362 bijective function, 9
enveloping, 363 binary operation, 11
factor, 387 binary predicate, 10
of intervals, 385 board game, 211, 212
of subsets, 383 Boolean combination, 169,306
prime, 363
unary, 361 calculus of strategies, 236
algebraic equation, 101 Cantor, 35
algorithm, 36,117,194 Cantor's discontinuum, 369, 371
alphabet, 46 Cartesian product, 6
MOVE, 281 chain, 105
arena, 281 characteristic function, 9
arity,330 closed set, 374
Index 425

coding of final states, 115 empty input, 46


coding of state set, 114 enveloping algebra, 363
coding of the alphabet, 113 epimorphism condition, 395
Coding of the transitions of automata, equal
115 sequences, 5
complementation problem, 150, 262 sets, 2
for Rabin automata, 262,319 equality of functions, 9
for special automata, 265 Equality Problem, 93, 185
composition of functions, 31 equivalence class, 13
computation, 50, 51, 129, 131,255 equivalence relation, 12
of Bilchi automata, l30 equivalence relation =", 177
successful by Bilchi, 135 equivalent sets, 31
successful by Rabin, 257 exponential blow-up, 63, 66, 67
configuration, 211
winning, 212 filter, 390
congruence relation, 152,293 finite automaton, 48
~, 152 finite automaton (FA) recognizable,
for GH-games, 307 57
connected elements, 361 finite function, 8
connective, 107 finite game, 212
constant, 330 finite words, 46
Consumer-Producer Problem, 40 flag point, 175
convolution, 97, 98 forced cycle, 227
cross product, 6 forest, 360
formula, 107, 111,334
decidable problems, 38 atomic, 107
dense linear orders, 356 equivalent to, 337
determinism, 42, 45 formulas, 190
determinize, 63 function, 7
Diagonalization Method, 35 f p ,286
diagram, 47 f(],,376
Venn,3 fe!,375
display, 182 graph of, 11
domain, 105,331 kernel of, 14
domains of functions, 7 rank,288
successor, 108, 187
edge, 20,22
element, 1 G(F),243
embedding, 354 game,220,270, 282
embedding condition, 396 determined, 285
embeddings of algebras, 364 finite, 212
Emptiness Problem, 93, 184 infinite, 218, 220
for Rabin automata, 327 open, 290
426 Index

position of, 220 isomorphism condition, 396


residue, 287
update, 225 Konig's Lemma, 29
game r(A, v), 273 Kleene star, 77
game automaton, 272
game graph, 220 language, 47, 252
GH-game, 306 w,129
grafting, 266 k-variable,97
graph, 21 s-recognizable, 263
connected, 22 BUchi recognizable, 137
directed, 21, 22 closed, 177
labeled, 23 commutative, 101
strongly connected, 23 definable, 120
Gurevich-Harrington game, 306 determined by regular expres-
sion,79
history, 222, 228, 283 finite automata recognizable, 57
homomorphism, 392 MUller recognizable, 166
homomorphism condition, 393 of the second order monadic logic,
106
ideal, 385 Rabin recognizable, 258
maximal, 388 recognized by game automaton,
proper, 385 276
immediate successor, 28, 250 regular, 78
index, 14 second order monadic, 333
induction, 24 signature-closed, 102
base case, 24 latest visitation record, 232
hypothesis, 24 lattice, 384
step, 24 Boolean, 385
induction:principle, 24 length
inf,384 of a sequence, 5
infinite input, 128 linear order axiom, 15
infinite string, 128 linear ordering, 15
Infinity Problem, 93 linearly ordered set, 15
infinity set, 135,272 logic, 106, 189
initial rule, 270 first order, 335
injective function, 9 of strings, 106
input, 46 second order monadic, 106, 189
signals, 46 second order monadic of strings,
input signal, 46 111
integers, 2 weak second order monadic, 203
interpretation, 109, 191,336
inverse of functions, 31 Muller automaton, 164
isomorphism, 106, 338 mappings, 7
Index 427

member, 1 consistent with strategies, 284


merge consistent with strategy, 214, 222,
of runs, 181 275
merge at m, 156, 176 eventually periodic, 234
Monkey and Banana problem, 42 from position q, 221
moves, 50 history, 222
winning, 282
negative states, 170 players
network, 224 Automaton, 270
update, 224, 226 Pathfinder, 270
nfa,48 point
nodes, 20, 250 associated with flag point, 175
nondeterminism, 45 flag, 175
position, 212, 220, 273, 281
one-to-one function, 9 consistent with strategies, 284
onto function, 9 imposed by strategies, 284
open set, 372 neutral, 218
operation special, 220
L,250 positions
R,250 of arena, 281
closed, 67 positi ve states, 170
complementation, 3 power automaton, 63
concatenation, 76 power set, 18
concatenation of languages, 76 predecessor, 28
concatenation of strings, 47 predicate, 10
convolution, 98 prefix, 68
difference, 4 products of linearly ordered sets, 17
intersection, 3 projection, 71
Kleene star, 77 proper subset, 2
prefix, 68 proposition, 26
projection, 71, 99 Pumping Lemma, 93, 94
symmetric difference, 4
union, 3 quantifier, 333
operation symbol, 330
orbit, 361 Rabin automaton, 253
range of function, 7
partial ordering, 18 rank, 287
partition, 12 rank function, 288
path, 22, 27, 29, 251 real number, 35
consistent with strategies, 284 reflexive relation, 12
imposed by strategies, 284 Regular expression, 79
placemarker,219 regular expression
play, 212, 221, 270, 283 atomic, 79
428 Index

relation, 10 linearly ordered Q-like, 356


"',72 of natural numbers, 2
"'L, 73, 75 of states, 47,48
definable, 202, 341 of winning plays, 282
equivalence, 12 open, 372
equivalence "'a, 157 partially ordered, 18
FA recognizable, 100 power set, 18
linear order, 15 winning for a game, 220
Myhill-Nerodeequivalence,73 SFS,111
partial order, 18 signature of an algebra, 363
prefix ::S, 251 sizes of sets, 31
Rabin definable, 349 special automaton, 263
right invariant, 292 state, 47
weakly definable, 204 strategy, 214, 222
relation symbol, 330 (R, A)-avoiding, 240
right invariance, 73 (R, A)-forcing, 240
root, 27, 28 deterministic, 284
rule, 271 for infinite games, 222
run, 50, 51,129, 131,255 for Automaton, 274
of a finite automaton, 51 for Pathfinder, 274
of Biichi automata, 130, 131 forgetful, 231, 233, 243
of Rabin automata, 255 no-memory, 236, 237
successful, 165 nondeterministic, 283
successful by Rabin, 257 of finite game, 214
respecting congruence, 295
satisfiability, 109, 191 vacuous, 284
saturation property, 155 winning,214,217,223,275,285
sentence, 111, 193,335 winning from a set, 236
sequence, 5 string, 46
w,128 infinite, 128
infinite, 5, 128 structure, 331
sequences without repetition, 32 (CD, ~), 378
sequential Rabin automaton, 171 subalgebra, 362
sequentiality, 46 Boolean, 387
set, 1 minimal, 388
clopen,398 subgame, 242
closed with respect to, 342 subset, 2
consistent, 388 designated, 164,253
countable, 32 successful
designated, 316 run by finite automaton, 52
empty, 4 successor, 27
infinite, 2 successor structure, 187
infinity, 221 suffix, 69
Index 429

sum of algebras, 362 forgetful determinacy, 319


sup, 384 intersection, 168,260
symmetric relation, 12 Kleene,81
Muller's characterization, 169
term, 190,333 McNaughton, 175, 179
The dining philosophers problem, 123
Myhill-Nerode, 72, 73
The Kleene Theorem, 81
on prefix operation, 68
the monadic second order logic, 106
projection, 142
theorem
about decidability of SIS, 201 projection for FA recognizable
about decidability of S2S, 349 languages, 71
about decidability of SFS, 120 projection for Rabin recogniz-
about deciding update networks, able languages, 261
230 restricted memory determinacy,
about equivalence of SIS and 308
WSlS,205 Sewing, 296
Buchi's characterization, 143 Stone representation, 392
characterization of open sets, 372 the first Buchi 's characterization,
complementation, 154, 168 147
complementation for Rabin au- the second Buchi's characteri-
tomata,326 zation,148
determinacyforgames(Q, [C], E), union, 168,260
302 theory
determinacy for open games, 290
SIS, 193
determinization, 64
S2S,338
for complementation of Buchi
recognizable languages, 159 SwS,350
for complementation of FA rec- SnS,353
ognizable languages, 66 WSlS,203
for complementation of Rabin Th([O, 1]),381
recognizable languages, 326 Th(RA),399
for intersection of Buchi recog- Th(CD),378
nizable languages, 139 SFS,111
for intersection of FA recogniz- of a class, 337
able languages, 60 of Cantor's discontinuum, 378
for intersection of Rabin recog-
transform, 56
nizable languages, 260
transition, 50
for union ofBuchi recognizable
languages, 139 transition diagram, 47, 53
for union ofFArecognizable lan- transition digram, 48
guages,59 transition graph, 53
for union of Rabin recognizable transition table, 48
languages, 260 transitive relation, 12
430 Index

tree, 27, 28, 251 variables


~-tree (v, T), 251 free, 110, 193, 335
T,250 individual, 106, 189,333
Tw,350 set, 106, 189, 333
tree(B, b), 343 vertexes, 20
finitely branching, 29
infinite, 29
yielding a strategy, 320 W(C),290
truth of a formula, 109 well-ordered set, 17
tuples, 5 winner, 214
type, 330 winner of the play, 212
finite, 330 winning condition, 271
winning conditions, 272
ultimately periodic word, 149 winning position, 212
unary algebra, 361 word
unary operation, 11 word(B, b), 194
unary predicate, 10 finite, 46
undirected graph, 21 finite word(C, B, b), 113
Universality Problem, 93, 185 infinite, 128
Progress in Computer Science and Applied Logic

PCS 1 Mathematics for the Analysis of Algorithms, 3rd Edition


Daniel H. Greene & Donald E. Knuth

PCS 2 Applied Probability-Computer Science: The Interface, Volume I


Edited by Ralph L. Disney & Teunis J. Ott

PCS 3 Applied Probability-Computer Science: The Interface, Volume II


Edited by Ralph L. Disney & Teunis J. Ott

PCS 4 Notes on Introductory Combinatorics


George P6lya, Robert E. Tarjan, & Donald R. Woods

PCS 5 The Evolution of Programs


Nachum Dershowitz

PCS 6 Lecture Notes on Bucket Algorithms


Luc Devroye

PCS 7 Real-Time Control of Walking


Marc D. Donner

PCS 8 Logic for Computer Scientists


Uwe SchOning

PCS 9 Feasible Mathematics


Edited by Samuel R. Buss & Philip J. Scott

PCS 10 Graph-Based Proof Procedures for Hom Clauses


Stan Raatz

PCS 11 A Proof Theory of General Unification


Wayne Snyder

PCS 12 Logical Methods: In Honor of Anil Nerode's Sixtieth Birthday


Edited by John E. Crossley, Jeffrey B. Remmel, Richard A. Shore,
& Moss E. Sweedler
PCS 13 Feasible Mathematics II
Edited by P. Clote & J.B. Remmel

PCS 14 Learning and Geometry: Computational Approaches


Edited by David W. Kueker & Carl H. Smith

PCS 15 Symbolic Rewriting Techniques


Manuel Bronstein, Johannes Grabmeier,
& Volker Weispfenning

PCS 16 Bounded Queries in Recursion Theory


William l. Gasarch & Georgia A. Martin

PCS 17 Number Theoretic Methods in Cryptography:


Complexity lower bounds
l. Shparlinski

PCS 18 Interpolating Cubic Splines


Gary D. Knott

PCS 19 An Introduction to Quantum Computing Algorithms


Arthur O. Pittenger

PCS 20 Cryptography and Computational Number Theory:


Workshop in Singapore, 1999
Edited by K.-Y. Lam, l. Shpariinski, H. Wang, & c. Xing

PCS 21 Automata Theory and its Applications


Bakhadyr Khoussainov and Ani! Nerode

S-ar putea să vă placă și