Documente Academic
Documente Profesional
Documente Cultură
Volume 21
Editor
Associate Editors
Automata Theory
and its Applications
QA267.K56 2001
511.3-dc21 2001025819
CIP
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
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,
• 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
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
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.
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:
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
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
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:
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
CA \ B) UCB \ A).
Draw a Venn diagram for the symmetric difference of A and B.
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.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}.
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, ...
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.
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
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.
4. A = {c, d}, B = 0.
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:
Similarly,
Exercise 1.3.2 Consider the functions defined below. Find the domain and the
range of each of the functions.
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.
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}.
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. The predicate outputs true on the pairs (0, 1), (0, 2), (1, 2).
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
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.
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.
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.
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.
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:
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.
a ::::1 b ::::1 c;
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).
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).
::;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:
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
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.
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:
3. Show that ifLI andL2 are well-ordered sets, then so are LI +L2 andLI x L2.
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.
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.
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.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
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
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.
As we see from the examples above, each undirected graph consists of:
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,
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'.
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
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.
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.
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.
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:
{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.
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.
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.
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.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.
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:
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:
Definition 1.9.2 A tree is finitely branching if every node of the tree has finitely
many immediate successors.
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,·· .
1. For each Xs in the sequence the set of nodes above Xs is an infinite set.
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.
0, 2, 4, 6, 8, ....
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:
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.
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
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
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
(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.
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, ....
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.
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
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
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.
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
• 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.]]
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.
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
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. .
We can
p
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.
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.
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
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
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
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
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
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
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
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.
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.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
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
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.
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
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
Figure 2.7
The automaton accepts the words of the type ababab ... abaa only.
a a
Figure 2.8
The automaton accepts the strings of the form an bba m only, where n, mEw.
Figure 2.9
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
1. ~pt?
2.
3.
4.
56 2. Finite Automata
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
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 ....
Exercise 2.2.6 Draw transition diagrams ofautomata that recognize the following
languages over the alphabet ~ = {a, b}:
1. Empty language.
Exercise 2.2.7
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
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.
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.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
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
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.
CSI, 0", S2) E Td if and only if S2 = {s'13s E SI ((s, 0", s') E T)}.
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}
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
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
Exercise 2.3.4 Give a formal proof of the last part of Theorem 2.3.3.
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
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).
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,
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}.
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
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
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.
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
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
where ~ I and ~2 are also alphabets. Any word of this alphabet is a sequence which
looks like
(UI, u{) ... (um , u~).
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:
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.
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
so,···, Sm+1
72 2. Finite Automata
is a computation of A on
(u, v) = (0'0 ... O'm, O'~ ... O'~).
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.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-
J:3.' ~~
* ~~
Figure 2.18
This property is called right invariance property of the relation rv. An instance of
this property is the following:
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.
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.
S = {[u] Iu E ~*},
2. The initial states set I contains only one ~ L -equivalence class, which is [A].
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.
2. Show that if the index of'" L is n, then there exists a deterministic finite
automaton with exactly n states recognizing L.
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:
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'
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
and whose operations are +, ., and *. Then we prove that this algebra coincides
with the algebra of all FA recognizable languages with operations +, ., and *.
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.
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
Example 2.5.4 Let L = {ab}. Then L* = {A, ab, abab, ababab, ... }.
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
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
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
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
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.
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}.
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.
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
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, ... }.
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.
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:
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.
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
FI if SI,O rt FI,
F{ ={ FI U{s'} otherwise.
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)).
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.
3. T is a function that assigns (labels) to each pair (s, s') of states a regular
expression denoted by T (s, s').
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.
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
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
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
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.4 For each of the GNFA below, construct a reduced equivalent au-
tomaton with two states:
1.
2. a
3.
4.
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.
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.
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
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.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. 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).
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.
2. The language {CUI, U2, U3) I U), U3 E E*, U2 E {a}*} is a 3-variable lan-
guage.
where i = 0, ... , k - 1.
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
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,
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}.
Definition 2.8.3
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
is FA recognizable.
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
Figure 2.31
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.
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
Sd = {X IX ~ S},
Id = {l},
Td(X, a) = U T(x, a) for X E S(d) and a E ~,
XEX
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.
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.
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.
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
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
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.
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
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
3. C satisfies (<1>\ -+ <1>2) if the condition that C satisfies <1>\ implies that C
satisfies <1>2.
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.
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).
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
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
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
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 ,
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:
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.
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
which is
a(O)a(l) ... a(t).
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:
/\/\/
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
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.
3. L2 = {(ab)n In E w}.
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.
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
( <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.
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.
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.
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
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
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;
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
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
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.
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 ....
a:w--+:E
a(O)a(1)a(2) ....
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
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).
Example 3.2.1
and
~£t) \ {aI, a2, ... , an}
are (V-languages. The first language is called finite and the second cofinite.
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.
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,
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.
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
a b
Figure 3.6
Figure 3.7
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
ex = ababababababab ....
One of the runs rj of this automaton on ex is
sO sl sl sO sO sl sl sO sO sl sl ....
sO sl sl s2 sl s2 sl s2 sl s2 sl ....
f3 = abaabaabaabaabaabaa ....
Then the automaton possesses a unique run r3 on this input, which is
sO sl sl sO sl sl sO sl sl ....
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)
a b
Figure 3.9
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?
~ct~·~~
:::::;:.
b
.:\:: '::: ...•
Figure 3.lO
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
Figure 3.12
It is not hard to check that this Biichi automaton accepts infinite strings of
type
infinite strings recognized by A, that is, if L = L(A). In this case we say that A
recognizes (or accepts) L.
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:
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}.
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:
Exercise 3.2.10 Construct a Buchi automaton that accepts the union of the fol-
lowing three languages:
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
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.]]
(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
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).
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:
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).
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.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.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
Example 3.3.1 Suppose that W = {ab, bal. Then the (V-language W'" contains
all (V-words of the type
Example 3.3.2 Let W = {a, b}. Then W'" is clearly the (V-language b'" that
contains all infinite words.
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
Exercise 3.3.2 Consider the following languages offinite words over the alphabet
{a, b}:
1. W = {aa, bbl.
2. W = {aa, aba}.
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?
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
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, ...
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 ~*:
such that the sequence u I, U2, ... satisfies the following properties:
Show that if V and Ware FA recognizable, then the language L is Biichi recog-
nizable.
3.3. The BUehl Theorem 147
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,
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
r = SOSIS2 ... ,
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
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.
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
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.
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 ...
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
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:
Thus, an w-string a belongs to Wif and only if infinitely many prefixes of a belong
to W.
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:
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,
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.
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.
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
and
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',
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.
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:
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:
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
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.
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.
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.
2. For every i ::: 1 the string Wi transforms the state qi to the state qi+\.
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
implies that
F
qj ----* Wi qj+]'
J
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 ~.
a(k,m)
1 k'
a:
k
r a(k',m)
m-1t em
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
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.
By the assumption and the definition of ~a, for every s > m p +], the words
Fact 3.5.3 There exist infinitely many positions 0 < ko < k] < k2 < ... such
that all ki and kj are ~a-equivalent. 0
Now let ko, kl, k2, ... be the sequence from the previous fact. Consider the
following sequence of words:
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
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
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*:
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.
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
W c ~*
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.
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
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.
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
Figure 3.17
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
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
b'" \ L(A)
3.7. Miiller Automata 169
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.
L(A) = U
QEF
[(n n(n
qEQ
Wq )
qES\Q
-,Wq ) ] .
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
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' ).
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
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 /).
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
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.
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
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
2.
3.
The set offinal subsets of this automaton consists of {s2} and {sl}.
3.8. The McNaughton Theorem 175
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:
3. For all k such that j < k < i, T (sQ, a(j, k)) "I T (sQ, a(O, k)).
176 3. Biichi Automata
a(D, i)
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
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.
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
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
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.
3. For any proper prefix V3 of V2, it is not true that T(so, v) = T(so, V3).
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.]]
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.
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.
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
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).
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
as follows:
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.]]
3. Using the extended T2, we define the transition table T of the desired au-
tomaton A as follows.
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
and
M,k = {(SI, S, j) I (SI E S, and s(k) EN;) or j < k}.
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:
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.
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:
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.
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.
4. Using the definition of"', for each "'-equivalence class effectively construct
a finite automaton recognizing the class.
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.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.
abcabcabcabc ....
Then
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
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
(~) (~) (~) (~) (~) (~) (~) (~) (~) ...
is simply the characteristic function of the set X I (X2). Therefore, the pair (X I, X2)
defines the sequence
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, ... ,
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
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.
Yz(z E X ~ Z E Y).
{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,'
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.
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 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.
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.
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.
Exercise 3.10.4
3xI '" 3Xn-1 (S(x) = XI & S(XI) = X2 & ... & S(Xn_l) EX).
3xI ... 3xn 3YI ... 3Ym(S(x) = XI & S(xJ} = X2 & ... & S(Xn_l)
= Ym & S(y) = YI & S(YI) = Y2 & ... & S(Ym-l) = Ym).
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).
by Bb. Each such sequence and natural number i E w define a symbol ai of the
alphabet ~:
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.
(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:
"Ix (V
aEI:
<pa(X, in)
is satisfied in (w, S). We also recall that for each w-word
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:
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
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
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
which is
aOal ... at.···
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
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:
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.
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.
and x .:s y,
VX(Sub(X) & x E X ~ Y EX),
are representable by Biichi automata.
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
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.
Exercise 3.10.8 Prove that there exists a Buchi automaton that represents the
formula sn(x) = sm(y).
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.
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
Theorem 3.10.4 For any w-language L over the alphabet 1; the following condi-
tions are equivalent:
1. L is definable.
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.
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.
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.
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:
What does this formula say? For which X subsets of w, is this formula true in the
structure (w, S)?
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:
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.
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:
We now give the following definition that singles out those languages that corre-
spond to relations definable in the weak monadic second order logic.
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
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:
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:
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
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
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
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
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.
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
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}.
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
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
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.
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:
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
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
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).
Definition 4.3.1 A game 9 is a six tuple (Q, B, G, E, W, Q), where we have the
following:
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:
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
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
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
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
Figure 4.6
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.
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.
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}.
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
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
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?
Our goal in this section will be to show that we can answer all these questions
positively.
Figure 4.14
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
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, ....
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.
2. if Wk occurs after WI in the lvr, then Wk was last visited after WI was last
visited. 0
2. At node b3, if the current lvr is either gl or blgl, then move to g2.
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.
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.
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
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
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.
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):
2. The winner of the game Qfrom position q has a winning forgetful strategy.
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;
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:
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.
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.
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.
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
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}.
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.
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
1. q EX.
2. q E B and there exists a q' such that q' E X and (q, q') E E.
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
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.
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.
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
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
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:
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.
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.
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:
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
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.
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.
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
""/
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.
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.
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.
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)?
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.
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.
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.
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.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.
2. I = {s},
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:
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.
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}}.
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}.
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').
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
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:
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
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
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.
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.
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.
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).
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.
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.
4. F' = F.
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.
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:
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:
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.
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.]]
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
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
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
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
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
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.
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),
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,
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:
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:
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).
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.
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;
Definition 5.3.2 Consider the game r (A, v). Any finite prefix of any play of this
game is called a position.
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 ...
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:
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.
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
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
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:
2. Find a v' different from v (in the item above) so that Automaton wins the
game rev', A).
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.
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
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},
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
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
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:
2. I' = {to}.
3. The transition table M' is defined by setting:
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:
and in general,
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
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
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.
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.
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.
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.
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
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.
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.
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
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).
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.
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.
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.
{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
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:
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.
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.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.
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:
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.
We now give a basic technical notation. The notation simply gives a more
appropriate name to the function r defined above.
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.
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
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
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
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):
Prove that one of the players wins the game (Q, Wn(C), E).
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.
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.
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.
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
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
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.
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.
2. H respects E.
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.
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).
6Thus. the ordering::: just introduced is isomorphic to the usual ordering of the natural numbers.
298 5. Rabin Automata
We need to show that the function H is weII defined, that is single-valued. Here is
the needed claim.
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
Claim 5.9.4 For all later positions pst in any play consistent with H, the position
pst belongs to D.
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
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
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).
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
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.
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.
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)}.
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.
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
K<Y
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.
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).
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.
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).
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,
2. Qp = Qq.
Lemma 5.11.1 For any GH-game r = (Q, W, E), the relation E of this game is
a congruence relation.
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.
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.
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
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.
We prove the claim. If W did not contain the set [C(1)] n··· n[C(k)], then
we would consider the game
I1E n [C(i)r\(j.i).
l::::i::::k
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
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.
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:
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.
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.
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)
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).
2. n~)()..) = n~)o.).
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 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
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
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.
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).
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.
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
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,
4. The player Automaton is Mr. (0) and the player Pathfinder is Mr. (1).
WQ = n nn
ljEQ
[CCi)]
ljftQ
Path(Q) \ [C(j)].
if and only if 11 belongs to some WQ. Thus, we have the following equality
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.
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:
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
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
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
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
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
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
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
(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
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):
3. Construct the BUchi automaton Bf (see Claim 5.12.2) for every state t of B.
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).
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.
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.
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
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
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."
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
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
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.
2. Each Fti,D is afixed operation on the domain D. The arity of the operation
is ni.
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:
°
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
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.
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).
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,
4. (-0<1>1) is a formula,
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
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.
intr : Xi -+ bi intr: Xj -+ Bj
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).
• 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 (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.
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.
2. For any n-ary operation symbol FEr, and all at, ... , an EDt, we have
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.
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.
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 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
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
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
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.
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.
Then for any two nodes x, y ofT, x ::s y if and only if x is a prefix of y.
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
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
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 ,
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:
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):
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
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
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.
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.
4. :F = {{f}}.
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):
2. x .:s y:
VX(Sub(X) & x EX -+ Y EX).
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
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
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.
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}
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.
1. The domain T(j) is the set of all finite words over the infinite alphabet
{O, 1,2,3, ... }. In other words,
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.
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.
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)
• 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 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
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.
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:
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.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
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.
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·
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:
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
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
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.
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.
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
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
The next lemma proves that every algebra contains a prime subalgebra thus
justifying the name given to prime algebras.
The next lemmas show that the signature of any connected algebra is well
defined.
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 ............ .
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.
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:
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
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
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):
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».
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
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.
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:
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}.
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.
be an element of CD, where each ai is a member of {a, I}. Then we assign to this
element the set
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
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.
Ux = {xa I a E CD}
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.
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.
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
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
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
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
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
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
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.
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.
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
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
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
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
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
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
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
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.
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
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)).
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.
Exercise 6.10.3 Let (L, ~) be a linearly ordered set with a minimal element. A
half interval is any of the sets
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.
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).
X = Vaifili /\ ... /\ ai (.
,
Ei,fi
, I
,
i::9
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
x = Vad €il
/\ ... /\ ai,li
tj,t;
'
i'S;s
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.
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
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.
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.
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.
1. 1 E I.
3. Forallx,YEI,xI\YEI.
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,
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.
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.
The next theorem shows that the example above is, in a certain sense, a
canonical way of constructing homomorphisms of Boolean algebras.
1. (0,0), (1, 1) 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
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
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.
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. The proof follows from Theorem 6.10.6 and the corollary above. D
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
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
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.
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:
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
[8] T. Hirst and D. Harel, On the power of bounded concurrency II: Pushdown
automata,l. Assoc. Comput. Mach., 41-3 (1994),540-554.
[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.
[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.
[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.
[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.
[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.
[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
[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.
[70] R. McNaughton, Infinite games played on finite graphs, Ann. Pure Appl.
Logic, 65 (1993), 149-184.
[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.
[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.
[96] M. Chrobak, Finite automata and unary languages, Theoret. Comput. Sci.,
47-2 (1986),149-158.
[125] H. P. Zeiger, Yet another proof of the cascade decomposition theorem for
finite automata, Math. Systems Theory, 1-3 (1967), 225-228.
[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.
[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.
[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
[142] R. McNaughton, Infinite games played on finite graphs, Ann. Pure Appl.
Logic, 65 (1993), 149-184.
Bibliography 415
[144] M. O. Rabin and D. Scott, Finite automata and their decision problems, IBM
1. Res. Develop., 3 (1959), 114-125.
[151] J. Stern. Complexity of some problems from the theory of automata. Infor-
mation Computation, 66 (1985), 163-176.
[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.
[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.
[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.
[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
[198] E. Goles and S. Martinez, Neural and Automata Networks, Kluwer Aca-
demic Publishers, Dordrecht, the Netherlands, 1990.
[200] P. Manolios and R. Fanelli, First-order recurrent neural networks and deter-
ministic finite state automata Neural Comput., 6 (1994), 1155-1173.
[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.