Week1 Introduction Background
Week1 Introduction Background
INTRODUCTION
0.1
AUTOMATA, COMPUTABILITY, AND COMPLEXITY
This book focuses on three traditionally central areas of the theory of computa-
tion: automata, computability, and complexity. They are linked by the question:
This question goes back to the 1930s when mathematical logicians first began
to explore the meaning of computation. Technological advances since that time
have greatly increased our ability to compute and have brought this question out
of the realm of theory into the world of practical concern.
In each of the three areas—automata, computability, and complexity—this
question is interpreted differently, and the answers vary according to the in-
terpretation. Following this introductory chapter, we explore each area in a
1
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the
eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional
content at any time if subsequent rights restrictions require it.
2 CHAPTER 0 / INTRODUCTION
separate part of this book. Here, we introduce these parts in reverse order be-
cause by starting from the end you can better understand the reason for the
beginning.
COMPLEXITY THEORY
Computer problems come in different varieties; some are easy, and some are
hard. For example, the sorting problem is an easy one. Say that you need to
arrange a list of numbers in ascending order. Even a small computer can sort
a million numbers rather quickly. Compare that to a scheduling problem. Say
that you must find a schedule of classes for the entire university to satisfy some
reasonable constraints, such as that no two classes take place in the same room
at the same time. The scheduling problem seems to be much harder than the
sorting problem. If you have just a thousand classes, finding the best schedule
may require centuries, even with a supercomputer.
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the
eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional
content at any time if subsequent rights restrictions require it.
0.2 MATHEMATICAL NOTIONS AND TERMINOLOGY 3
COMPUTABILITY THEORY
During the first half of the twentieth century, mathematicians such as Kurt
Gödel, Alan Turing, and Alonzo Church discovered that certain basic problems
cannot be solved by computers. One example of this phenomenon is the prob-
lem of determining whether a mathematical statement is true or false. This task
is the bread and butter of mathematicians. It seems like a natural for solution
by computer because it lies strictly within the realm of mathematics. But no
computer algorithm can perform this task.
Among the consequences of this profound result was the development of ideas
concerning theoretical models of computers that eventually would help lead to
the construction of actual computers.
The theories of computability and complexity are closely related. In com-
plexity theory, the objective is to classify problems as easy ones and hard ones;
whereas in computability theory, the classification of problems is by those that
are solvable and those that are not. Computability theory introduces several of
the concepts used in complexity theory.
AUTOMATA THEORY
Automata theory deals with the definitions and properties of mathematical mod-
els of computation. These models play a role in several applied areas of computer
science. One model, called the finite automaton, is used in text processing, com-
pilers, and hardware design. Another model, called the context-free grammar, is
used in programming languages and artificial intelligence.
Automata theory is an excellent place to begin the study of the theory of
computation. The theories of computability and complexity require a precise
definition of a computer. Automata theory allows practice with formal definitions
of computation as it introduces concepts relevant to other nontheoretical areas
of computer science.
0.2
MATHEMATICAL NOTIONS AND TERMINOLOGY
As in any mathematical subject, we begin with a discussion of the basic mathe-
matical objects, tools, and notation that we expect to use.
SETS
A set is a group of objects represented as a unit. Sets may contain any type of
object, including numbers, symbols, and even other sets. The objects in a set are
called its elements or members. Sets may be described formally in several ways.
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the
eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional
content at any time if subsequent rights restrictions require it.
4 CHAPTER 0 / INTRODUCTION
One way is by listing a set’s elements inside braces. Thus the set
contains the elements 7, 21, and 57. The symbols ∈ and 6∈ denote set member-
ship and nonmembership. We write 7 ∈ {7, 21, 57} and 8 6∈ {7, 21, 57}. For two
sets A and B, we say that A is a subset of B, written A ⊆ B, if every member of
A also is a member of B. We say that A is a proper subset of B, written A ( B,
if A is a subset of B and not equal to B.
The order of describing a set doesn’t matter, nor does repetition of its mem-
bers. We get the same set S by writing {57, 7, 7, 7, 21}. If we do want to take the
number of occurrences of members into account, we call the group a multiset
instead of a set. Thus {7} and {7, 7} are different as multisets but identical as
sets. An infinite set contains infinitely many elements. We cannot write a list of
all the elements of an infinite set, so we sometimes use the “. . .” notation to mean
“continue the sequence forever.” Thus we write the set of natural numbers N
as
{1, 2, 3, . . . }.
{ . . . , −2, −1, 0, 1, 2, . . . }.
The set with zero members is called the empty set and is written ∅. A set with
one member is sometimes called a singleton set, and a set with two members is
called an unordered pair.
When we want to describe a set containing elements according to some rule,
we write {n| rule about n}. Thus {n| n = m2 for some m ∈ N } means the set of
perfect squares.
If we have two sets A and B, the union of A and B, written A∪B, is the set we
get by combining all the elements in A and B into a single set. The intersection
of A and B, written A ∩ B, is the set of elements that are in both A and B. The
complement of A, written A, is the set of all elements under consideration that
are not in A.
As is often the case in mathematics, a picture helps clarify a concept. For sets,
we use a type of picture called a Venn diagram. It represents sets as regions
enclosed by circular lines. Let the set START-t be the set of all English words
that start with the letter “t”. For example, in the figure, the circle represents the
set START-t. Several members of this set are represented as points inside the
circle.
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the
eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional
content at any time if subsequent rights restrictions require it.
0.2 MATHEMATICAL NOTIONS AND TERMINOLOGY 5
FIGURE 0.1
Venn diagram for the set of English words starting with “t”
Similarly, we represent the set END -z of English words that end with “z” in
the following figure.
FIGURE 0.2
Venn diagram for the set of English words ending with “z”
To represent both sets in the same Venn diagram, we must draw them so that
they overlap, indicating that they share some elements, as shown in the following
figure. For example, the word topaz is in both sets. The figure also contains a
circle for the set START-j. It doesn’t overlap the circle for START-t because no
word lies in both sets.
FIGURE 0.3
Overlapping circles indicate common elements
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the
eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional
content at any time if subsequent rights restrictions require it.
6 CHAPTER 0 / INTRODUCTION
The next two Venn diagrams depict the union and intersection of sets A
and B.
FIGURE 0.4
Diagrams for (a) A ∪ B and (b) A ∩ B
EXAMPLE 0.5
If A = {1, 2} and B = {x, y, z},
A × B = { (1, x), (1, y), (1, z), (2, x), (2, y), (2, z) }.
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the
eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional
content at any time if subsequent rights restrictions require it.
0.2 MATHEMATICAL NOTIONS AND TERMINOLOGY 7
EXAMPLE 0.6
If A and B are as in Example 0.5,
A × B × A = (1, x, 1), (1, x, 2), (1, y, 1), (1, y, 2), (1, z, 1), (1, z, 2),
(2, x, 1), (2, x, 2), (2, y, 1), (2, y, 2), (2, z, 1), (2, z, 2) .
If we have the Cartesian product of a set with itself, we use the shorthand
k
z }| {
A × A × · · · × A = Ak .
EXAMPLE 0.7
2
The set N equals N × N . It consists of all ordered pairs of natural numbers.
We also may write it as {(i, j)| i, j ≥ 1}.
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the
eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional
content at any time if subsequent rights restrictions require it.
8 CHAPTER 0 / INTRODUCTION
We may describe a specific function in several ways. One way is with a pro-
cedure for computing an output from a specified input. Another way is with a
table that lists all possible inputs and gives the output for each input.
EXAMPLE 0.8
Consider the function f : {0, 1, 2, 3, 4}−→ {0, 1, 2, 3, 4}.
n f (n)
0 1
1 2
2 3
3 4
4 0
This function adds 1 to its input and then outputs the result modulo 5. A number
modulo m is the remainder after division by m. For example, the minute hand
on a clock face counts modulo 60. When we do modular arithmetic, we define
Zm = {0, 1, 2, . . . , m − 1}. With this notation, the aforementioned function f
has the form f : Z5 −→ Z5 .
EXAMPLE 0.9
Sometimes a two-dimensional table is used if the domain of the function is the
Cartesian product of two sets. Here is another function, g : Z4 × Z4 −→Z4 . The
entry at the row labeled i and the column labeled j in the table is the value of
g(i, j).
g 0 1 2 3
0 0 1 2 3
1 1 2 3 0
2 2 3 0 1
3 3 0 1 2
The function g is the addition function modulo 4.
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the
eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional
content at any time if subsequent rights restrictions require it.
0.2 MATHEMATICAL NOTIONS AND TERMINOLOGY 9
EXAMPLE 0.10
In a children’s game called Scissors–Paper–Stone, the two players simultaneously
select a member of the set {SCISSORS, PAPER , STONE } and indicate their selec-
tions with hand signals. If the two selections are the same, the game starts over.
If the selections differ, one player wins, according to the relation beats.
From this table we determine that SCISSORS beats PAPER is TRUE and that
PAPER beats SCISSORS is FALSE .
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the
eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional
content at any time if subsequent rights restrictions require it.
10 CHAPTER 0 / INTRODUCTION
EXAMPLE 0.11
Define an equivalence relation on the natural numbers, written ≡7 . For i, j ∈ N ,
say that i ≡7 j, if i−j is a multiple of 7. This is an equivalence relation because it
satisfies the three conditions. First, it is reflexive, as i − i = 0, which is a multiple
of 7. Second, it is symmetric, as i − j is a multiple of 7 if j − i is a multiple of 7.
Third, it is transitive, as whenever i − j is a multiple of 7 and j − k is a multiple
of 7, then i − k = (i − j) + (j − k) is the sum of two multiples of 7 and hence a
multiple of 7, too.
GRAPHS
An undirected graph, or simply a graph, is a set of points with lines connecting
some of the points. The points are called nodes or vertices, and the lines are
called edges, as shown in the following figure.
FIGURE 0.12
Examples of graphs
In a graph G that contains nodes i and j, the pair (i, j) represents the edge that
connects i and j. The order of i and j doesn’t matter in an undirected graph,
so the pairs (i, j) and (j, i) represent the same edge. Sometimes we describe
undirected edges with unordered pairs using set notation as in {i, j}. If V is the
set of nodes of G and E is the set of edges, we say G = (V, E). We can describe
a graph with a diagram or more formally by specifying V and E. For example, a
formal description of the graph in Figure 0.12(a) is
{1, 2, 3, 4, 5}, {(1, 2), (2, 3), (3, 4), (4, 5), (5, 1)} ,
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the
eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional
content at any time if subsequent rights restrictions require it.
0.2 MATHEMATICAL NOTIONS AND TERMINOLOGY 11
FIGURE 0.13
Cheapest nonstop airfares between various cities
FIGURE 0.14
Graph G (shown darker) is a subgraph of H
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the
eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional
content at any time if subsequent rights restrictions require it.
12 CHAPTER 0 / INTRODUCTION
FIGURE 0.15
(a) A path in a graph, (b) a cycle in a graph, and (c) a tree
A directed graph has arrows instead of lines, as shown in the following figure.
The number of arrows pointing from a particular node is the outdegree of that
node, and the number of arrows pointing to a particular node is the indegree.
FIGURE 0.16
A directed graph
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the
eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional
content at any time if subsequent rights restrictions require it.
0.2 MATHEMATICAL NOTIONS AND TERMINOLOGY 13
EXAMPLE 0.17
The directed graph shown here represents the relation given in Example 0.10.
FIGURE 0.18
The graph of the relation beats
Σ1 = {0,1}
Σ2 = {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z}
Γ = {0, 1, x, y, z}
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the
eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional
content at any time if subsequent rights restrictions require it.
14 CHAPTER 0 / INTRODUCTION
BOOLEAN LOGIC
Boolean logic is a mathematical system built around the two values TRUE and
FALSE . Though originally conceived of as pure mathematics, this system is now
considered to be the foundation of digital electronics and computer design. The
values TRUE and FALSE are called the Boolean values and are often represented
by the values 1 and 0. We use Boolean values in situations with two possibilities,
such as a wire that may have a high or a low voltage, a proposition that may be
true or false, or a question that may be answered yes or no.
We can manipulate Boolean values with the Boolean operations. The sim-
plest Boolean operation is the negation or NOT operation, designated with the
symbol ¬. The negation of a Boolean value is the opposite value. Thus ¬0 = 1
and ¬1 = 0. We designate the conjunction or AND operation with the sym-
bol ∧. The conjunction of two Boolean values is 1 if both of those values are 1.
The disjunction or OR operation is designated with the symbol ∨. The disjunc-
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the
eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional
content at any time if subsequent rights restrictions require it.
0.2 MATHEMATICAL NOTIONS AND TERMINOLOGY 15
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the
eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional
content at any time if subsequent rights restrictions require it.