Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
20 views2 pages

03 Strings and Languages

PDFs from a custom course on Theory of automata as a part of Computer science program.

Uploaded by

rayyanghn
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)
20 views2 pages

03 Strings and Languages

PDFs from a custom course on Theory of automata as a part of Computer science program.

Uploaded by

rayyanghn
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/ 2

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.

You might also like