0% found this document useful (0 votes)
3 views

Week1 Introduction Background

This document introduces key concepts in the theory of computation, focusing on automata, computability, and complexity, and their interconnections regarding the capabilities and limitations of computers. It discusses complexity theory's classification of problems based on computational difficulty, computability theory's identification of solvable versus unsolvable problems, and automata theory's mathematical models of computation. Additionally, it covers essential mathematical notions and terminology, including sets, sequences, functions, and relations, which are foundational for understanding the computational theories presented in the course.

Uploaded by

squooshy2003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Week1 Introduction Background

This document introduces key concepts in the theory of computation, focusing on automata, computability, and complexity, and their interconnections regarding the capabilities and limitations of computers. It discusses complexity theory's classification of problems based on computational difficulty, computability theory's identification of solvable versus unsolvable problems, and automata theory's mathematical models of computation. Additionally, it covers essential mathematical notions and terminology, including sets, sequences, functions, and relations, which are foundational for understanding the computational theories presented in the course.

Uploaded by

squooshy2003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

0

INTRODUCTION

We begin with an overview of those areas in the theory of computation that


we present in this course. Following that, you’ll have a chance to learn and/or
review some mathematical concepts that you will need later.

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:

What are the fundamental capabilities and limitations of computers?

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.

What makes some problems computationally hard and others easy?

This is the central question of complexity theory. Remarkably, we don’t know


the answer to it, though it has been intensively researched for over 40 years.
Later, we explore this fascinating question and some of its ramifications.
In one important achievement of complexity theory thus far, researchers have
discovered an elegant scheme for classifying problems according to their com-
putational difficulty. It is analogous to the periodic table for classifying elements
according to their chemical properties. Using this scheme, we can demonstrate
a method for giving evidence that certain problems are computationally hard,
even if we are unable to prove that they are.
You have several options when you confront a problem that appears to be
computationally hard. First, by understanding which aspect of the problem is at
the root of the difficulty, you may be able to alter it so that the problem is more
easily solvable. Second, you may be able to settle for less than a perfect solution
to the problem. In certain cases, finding solutions that only approximate the
perfect one is relatively easy. Third, some problems are hard only in the worst
case situation, but easy most of the time. Depending on the application, you may
be satisfied with a procedure that occasionally is slow but usually runs quickly.
Finally, you may consider alternative types of computation, such as randomized
computation, that can speed up certain tasks.
One applied area that has been affected directly by complexity theory is the
ancient field of cryptography. In most fields, an easy computational problem is
preferable to a hard one because easy ones are cheaper to solve. Cryptography
is unusual because it specifically requires computational problems that are hard,
rather than easy. Secret codes should be hard to break without the secret key
or password. Complexity theory has pointed cryptographers in the direction of
computationally hard problems around which they have designed revolutionary
new codes.

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

S = {7, 21, 57}

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, . . . }.

The set of integers Z is written as

{ . . . , −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

SEQUENCES AND TUPLES


A sequence of objects is a list of these objects in some order. We usually designate
a sequence by writing the list within parentheses. For example, the sequence 7,
21, 57 would be written
(7, 21, 57).
The order doesn’t matter in a set, but in a sequence it does. Hence (7, 21, 57) is
not the same as (57, 7, 21). Similarly, repetition does matter in a sequence, but
it doesn’t matter in a set. Thus (7, 7, 21, 57) is different from both of the other
sequences, whereas the set {7, 21, 57} is identical to the set {7, 7, 21, 57}.
As with sets, sequences may be finite or infinite. Finite sequences often are
called tuples. A sequence with k elements is a k-tuple. Thus (7, 21, 57) is a
3-tuple. A 2-tuple is also called an ordered pair.
Sets and sequences may appear as elements of other sets and sequences. For
example, the power set of A is the set of all subsets of A. If A is the set {0, 1},
the power set of A is the set { ∅, {0}, {1}, {0, 1} }. The set of all ordered pairs
whose elements are 0s and 1s is { (0, 0), (0, 1), (1, 0), (1, 1) }.
If A and B are two sets, the Cartesian product or cross product of A and
B, written A × B, is the set of all ordered pairs wherein the first element is a
member of A and the second element is a member of 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) }.

We can also take the Cartesian product of k sets, A1 , A2 , . . . , Ak , written


A1 × A2 × · · · × Ak . It is the set consisting of all k-tuples (a1 , a2 , . . . , ak ) where
ai ∈ Ai .

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}.

FUNCTIONS AND RELATIONS


Functions are central to mathematics. A function is an object that sets up an
input–output relationship. A function takes an input and produces an output.
In every function, the same input always produces the same output. If f is a
function whose output value is b when the input value is a, we write
f (a) = b.
A function also is called a mapping, and, if f (a) = b, we say that f maps a to b.
For example, the absolute value function abs takes a number x as input and
returns x if x is positive and −x if x is negative. Thus abs(2) = abs(−2) =
2. Addition is another example of a function, written add . The input to the
addition function is an ordered pair of numbers, and the output is the sum of
those numbers.
The set of possible inputs to the function is called its domain. The outputs
of a function come from a set called its range. The notation for saying that f is
a function with domain D and range R is
f : D−→R.
In the case of the function abs, if we are working with integers, the domain and
the range are Z, so we write abs : Z−→Z. In the case of the addition function
for integers, the domain is the set of pairs of integers Z × Z and the range is Z,
so we write add : Z × Z−→Z. Note that a function may not necessarily use all
the elements of the specified range. The function abs never takes on the value
−1 even though −1 ∈ Z. A function that does use all the elements of the range
is said to be onto the range.

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.

When the domain of a function f is A1 ×· · ·×Ak for some sets A1 , . . . , Ak , the


input to f is a k-tuple (a1 , a2 , . . . , ak ) and we call the ai the arguments to f . A
function with k arguments is called a k-ary function, and k is called the arity of
the function. If k is 1, f has a single argument and f is called a unary function.
If k is 2, f is a binary function. Certain familiar binary functions are written
in a special infix notation, with the symbol for the function placed between its
two arguments, rather than in prefix notation, with the symbol preceding. For
example, the addition function add usually is written in infix notation with the
+ symbol between its two arguments as in a + b instead of in prefix notation
add (a, b).

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

A predicate or property is a function whose range is {TRUE , FALSE }. For


example, let even be a property that is TRUE if its input is an even number and
FALSE if its input is an odd number. Thus even(4) = TRUE and even(5) =
FALSE .
A property whose domain is a set of k-tuples A × · · · × A is called a relation,
a k-ary relation, or a k-ary relation on A. A common case is a 2-ary relation,
called a binary relation. When writing an expression involving a binary rela-
tion, we customarily use infix notation. For example, “less than” is a relation
usually written with the infix operation symbol <. “Equality”, written with the
= symbol, is another familiar relation. If R is a binary relation, the statement
aRb means that aRb = TRUE . Similarly, if R is a k-ary relation, the statement
R(a1 , . . . , ak ) means that R(a1 , . . . , ak ) = TRUE.

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.

beats SCISSORS PAPER STONE


SCISSORS FALSE TRUE FALSE
PAPER FALSE FALSE TRUE
STONE TRUE FALSE FALSE

From this table we determine that SCISSORS beats PAPER is TRUE and that
PAPER beats SCISSORS is FALSE .

Sometimes describing predicates with sets instead of functions is more con-


venient. The predicate P : D−→ { TRUE, FALSE } may be written (D, S), where
S = {a ∈ D| P (a) = TRUE }, or simply S if the domain D is obvious from the
context. Hence the relation beats may be written

{(SCISSORS , PAPER ), (PAPER , STONE ), (STONE , SCISSORS )}.

A special type of binary relation, called an equivalence relation, captures the


notion of two objects being equal in some feature. A binary relation R is an
equivalence relation if R satisfies three conditions:

1. R is reflexive if for every x, xRx;


2. R is symmetric if for every x and y, xRy implies yRx; and
3. R is transitive if for every x, y, and z, xRy and yRz implies xRz.

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

The number of edges at a particular node is the degree of that node. In


Figure 0.12(a), all the nodes have degree 2. In Figure 0.12(b), all the nodes have
degree 3. No more than one edge is allowed between any two nodes. We may
allow an edge from a node to itself, called a self-loop, depending on the situation.

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

and a formal description of the graph in Figure 0.12(b) is



{1, 2, 3, 4}, {(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)} .
Graphs frequently are used to represent data. Nodes might be cities and edges
the connecting highways, or nodes might be people and edges the friendships
between them. Sometimes, for convenience, we label the nodes and/or edges of
a graph, which then is called a labeled graph. Figure 0.13 depicts a graph whose
nodes are cities and whose edges are labeled with the dollar cost of the cheapest
nonstop airfare for travel between those cities if flying nonstop between them is
possible.

FIGURE 0.13
Cheapest nonstop airfares between various cities

We say that graph G is a subgraph of graph H if the nodes of G are a subset


of the nodes of H, and the edges of G are the edges of H on the corresponding
nodes. The following figure shows a graph H and a subgraph G.

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

A path in a graph is a sequence of nodes connected by edges. A simple path


is a path that doesn’t repeat any nodes. A graph is connected if every two nodes
have a path between them. A path is a cycle if it starts and ends in the same node.
A simple cycle is one that contains at least three nodes and repeats only the first
and last nodes. A graph is a tree if it is connected and has no simple cycles, as
shown in Figure 0.15. A tree may contain a specially designated node called the
root. The nodes of degree 1 in a tree, other than the root, are called the leaves
of the tree.

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

In a directed graph, we represent an edge from i to j as a pair (i, j). The


formal description of a directed graph G is (V, E), where V is the set of nodes
and E is the set of edges. The formal description of the graph in Figure 0.16 is

{1,2,3,4,5,6}, {(1,2), (1,5), (2,1), (2,4), (5,4), (5,6), (6,1), (6,3)} .
A path in which all the arrows point in the same direction as its steps is called a
directed path. A directed graph is strongly connected if a directed path connects
every two nodes. Directed graphs are a handy way of depicting binary relations.
If R is a binary relation whose domain is D × D, a labeled graph G = (D, E)
represents R, where E = {(x, y)| xRy}.

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

STRINGS AND LANGUAGES


Strings of characters are fundamental building blocks in computer science. The
alphabet over which the strings are defined may vary with the application. For
our purposes, we define an alphabet to be any nonempty finite set. The members
of the alphabet are the symbols of the alphabet. We generally use capital Greek
letters Σ and Γ to designate alphabets and a typewriter font for symbols from an
alphabet. The following are a few examples of alphabets.

Σ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

A string over an alphabet is a finite sequence of symbols from that alphabet,


usually written next to one another and not separated by commas. If Σ1 = {0,1},
then 01001 is a string over Σ1 . If Σ2 = {a, b, c, . . . , z}, then abracadabra is a
string over Σ2 . If w is a string over Σ, the length of w, written |w|, is the number
of symbols that it contains. The string of length zero is called the empty string
and is written ε. The empty string plays the role of 0 in a number system. If w
has length n, we can write w = w1 w2 · · · wn where each wi ∈ Σ. The reverse
of w, written wR , is the string obtained by writing w in the opposite order (i.e.,
wn wn−1 · · · w1 ). String z is a substring of w if z appears consecutively within w.
For example, cad is a substring of abracadabra.
If we have string x of length m and string y of length n, the concatenation
of x and y, written xy, is the string obtained by appending y to the end of x, as
in x1 · · · xm y1 · · · yn . To concatenate a string with itself many times, we use the
superscript notation xk to mean
k
z }| {
xx · · · x .
The lexicographic order of strings is the same as the familiar dictionary order.
We’ll occasionally use a modified lexicographic order, called shortlex order or
simply string order, that is identical to lexicographic order, except that shorter
strings precede longer strings. Thus the string ordering of all strings over the
alphabet {0,1} is
(ε, 0, 1, 00, 01, 10, 11, 000, . . .).
Say that string x is a prefix of string y if a string z exists where xz = y, and that
x is a proper prefix of y if in addition x 6= y. A language is a set of strings. A
language is prefix-free if no member is a proper prefix of another member.

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

tion of two Boolean values is 1 if either of those values is 1. We summarize this


information as follows.
0∧0 =0 0∨0 =0 ¬0 = 1
0∧1 =0 0∨1 =1 ¬1 = 0
1∧0 =0 1∨0 =1
1∧1 =1 1∨1 =1
We use Boolean operations for combining simple statements into more com-
plex Boolean expressions, just as we use the arithmetic operations + and × to
construct complex arithmetic expressions. For example, if P is the Boolean value
representing the truth of the statement “the sun is shining” and Q represents the
truth of the statement “today is Monday”, we may write P ∧ Q to represent the
truth value of the statement “the sun is shining and today is Monday” and sim-
ilarly for P ∨ Q with and replaced by or. The values P and Q are called the
operands of the operation.
Several other Boolean operations occasionally appear. The exclusive or, or
XOR, operation is designated by the ⊕ symbol and is 1 if either but not both of
its two operands is 1. The equality operation, written with the symbol ↔, is 1
if both of its operands have the same value. Finally, the implication operation
is designated by the symbol → and is 0 if its first operand is 1 and its second
operand is 0; otherwise, → is 1. We summarize this information as follows.

0⊕0=0 0↔0=1 0→0=1


0⊕1=1 0↔1=0 0→1=1
1⊕0=1 1↔0=0 1→0=0
1⊕1=0 1↔1=1 1→1=1

We can establish various relationships among these operations. In fact, we


can express all Boolean operations in terms of the AND and NOT operations, as
the following identities show. The two expressions in each row are equivalent.
Each row expresses the operation in the left-hand column in terms of operations
above it and AND and NOT.
P ∨Q ¬(¬P ∧ ¬Q)
P →Q ¬P ∨ Q
P ↔Q (P → Q) ∧ (Q → P )
P ⊕Q ¬(P ↔ Q)
The distributive law for AND and OR comes in handy when we manipulate
Boolean expressions. It is similar to the distributive law for addition and multi-
plication, which states that a × (b + c) = (a × b) + (a × c). The Boolean version
comes in two forms:
• P ∧ (Q ∨ R) equals (P ∧ Q) ∨ (P ∧ R), and its dual
• P ∨ (Q ∧ R) equals (P ∨ Q) ∧ (P ∨ R).

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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy