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

RegularLanguage-TOC Sipser

RegularLanguage-TOC

Uploaded by

alexkhan656
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

RegularLanguage-TOC Sipser

RegularLanguage-TOC

Uploaded by

alexkhan656
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

44 CHAPTER 1 / REGULAR LANGUAGES

FIGURE 1.22
Accepts strings containing 001

THE REGULAR OPERATIONS


In the preceding two sections, we introduced and defined finite automata and
regular languages. We now begin to investigate their properties. Doing so will
help develop a toolbox of techniques for designing automata to recognize partic-
ular languages. The toolbox also will include ways of proving that certain other
languages are nonregular (i.e., beyond the capability of finite automata).
In arithmetic, the basic objects are numbers and the tools are operations for
manipulating them, such as + and ×. In the theory of computation, the ob-
jects are languages and the tools include operations specifically designed for
manipulating them. We define three operations on languages, called the reg-
ular operations, and use them to study properties of the regular languages.

DEFINITION 1.23
Let A and B be languages. We define the regular operations union,
concatenation, and star as follows:
• Union: A ∪ B = {x| x ∈ A or x ∈ B}.
• Concatenation: A ◦ B = {xy| x ∈ A and y ∈ B}.
• Star: A∗ = {x1 x2 . . . xk | k ≥ 0 and each xi ∈ A}.

You are already familiar with the union operation. It simply takes all the
strings in both A and B and lumps them together into one language.
The concatenation operation is a little trickier. It attaches a string from A
in front of a string from B in all possible ways to get the strings in the new
language.
The star operation is a bit different from the other two because it applies to
a single language rather than to two different languages. That is, the star oper-
ation is a unary operation instead of a binary operation. It works by attaching
any number of strings in A together to get a string in the new language. Because

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.
1.1 FINITE AUTOMATA 45

“any number” includes 0 as a possibility, the empty string ε is always a member


of A∗ , no matter what A is.

EXAMPLE 1.24
Let the alphabet Σ be the standard 26 letters {a, b, . . . , z}. If A = {good, bad}
and B = {boy, girl}, then
A ∪ B = {good, bad, boy, girl},
A ◦ B = {goodboy, goodgirl, badboy, badgirl}, and
A∗ = {ε, good, bad, goodgood, goodbad, badgood, badbad,
goodgoodgood, goodgoodbad, goodbadgood, goodbadbad, . . . }.

Let N = {1, 2, 3, . . . } be the set of natural numbers. When we say that N


is closed under multiplication, we mean that for any x and y in N , the product
x × y also is in N . In contrast, N is not closed under division, as 1 and 2 are
in N but 1/2 is not. Generally speaking, a collection of objects is closed under
some operation if applying that operation to members of the collection returns
an object still in the collection. We show that the collection of regular languages
is closed under all three of the regular operations. In Section 1.3, we show that
these are useful tools for manipulating regular languages and understanding the
power of finite automata. We begin with the union operation.

THEOREM 1.25
The class of regular languages is closed under the union operation.

In other words, if A1 and A2 are regular languages, so is A1 ∪ A2 .

PROOF IDEA We have regular languages A1 and A2 and want to show that
A1 ∪ A2 also is regular. Because A1 and A2 are regular, we know that some finite
automaton M1 recognizes A1 and some finite automaton M2 recognizes A2 . To
prove that A1 ∪ A2 is regular, we demonstrate a finite automaton, call it M , that
recognizes A1 ∪ A2 .
This is a proof by construction. We construct M from M1 and M2 . Machine
M must accept its input exactly when either M1 or M2 would accept it in order
to recognize the union language. It works by simulating both M1 and M2 and
accepting if either of the simulations accept.
How can we make machine M simulate M1 and M2 ? Perhaps it first simulates
M1 on the input and then simulates M2 on the input. But we must be careful
here! Once the symbols of the input have been read and used to simulate M1 ,
we can’t “rewind the input tape” to try the simulation on M2 . We need another
approach.

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.
46 CHAPTER 1 / REGULAR LANGUAGES

Pretend that you are M . As the input symbols arrive one by one, you simulate
both M1 and M2 simultaneously. That way, only one pass through the input is
necessary. But can you keep track of both simulations with finite memory? All
you need to remember is the state that each machine would be in if it had read
up to this point in the input. Therefore, you need to remember a pair of states.
How many possible pairs are there? If M1 has k1 states and M2 has k2 states, the
number of pairs of states, one from M1 and the other from M2 , is the product
k1 × k2 . This product will be the number of states in M , one for each pair. The
transitions of M go from pair to pair, updating the current state for both M1 and
M2 . The accept states of M are those pairs wherein either M1 or M2 is in an
accept state.

PROOF
Let M1 recognize A1 , where M1 = (Q1 , Σ, δ1 , q1 , F1 ), and
M2 recognize A2 , where M2 = (Q2 , Σ, δ2 , q2 , F2 ).

Construct M to recognize A1 ∪ A2 , where M = (Q, Σ, δ, q0 , F ).


1. Q = {(r1 , r2 )| r1 ∈ Q1 and r2 ∈ Q2 }.
This set is the Cartesian product of sets Q1 and Q2 and is written Q1 × Q2 .
It is the set of all pairs of states, the first from Q1 and the second from Q2 .
2. Σ, the alphabet, is the same as in M1 and M2 . In this theorem and in all
subsequent similar theorems, we assume for simplicity that both M1 and
M2 have the same input alphabet Σ. The theorem remains true if they
have different alphabets, Σ1 and Σ2 . We would then modify the proof to
let Σ = Σ1 ∪ Σ2 .
3. δ, the transition function, is defined as follows. For each (r1 , r2 ) ∈ Q and
each a ∈ Σ, let
 
δ (r1 , r2 ), a = δ1 (r1 , a), δ2 (r2 , a) .
Hence δ gets a state of M (which actually is a pair of states from M1 and
M2 ), together with an input symbol, and returns M ’s next state.
4. q0 is the pair (q1 , q2 ).
5. F is the set of pairs in which either member is an accept state of M1 or M2 .
We can write it as
F = {(r1 , r2 )| r1 ∈ F1 or r2 ∈ F2 }.
This expression is the same as F = (F1 × Q2 ) ∪ (Q1 × F2 ). (Note that it is
not the same as F = F1 × F2 . What would that give us instead?3)

3 This expression would define M ’s accept states to be those for which both members of
the pair are accept states. In this case, M would accept a string only if both M1 and M2
accept it, so the resulting language would be the intersection and not the union. In fact,
this result proves that the class of regular languages is closed under intersection.

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.
1.2 NONDETERMINISM 47

This concludes the construction of the finite automaton M that recognizes


the union of A1 and A2 . This construction is fairly simple, and thus its correct-
ness is evident from the strategy described in the proof idea. More complicated
constructions require additional discussion to prove correctness. A formal cor-
rectness proof for a construction of this type usually proceeds by induction. For
an example of a construction proved correct, see the proof of Theorem 1.54.
Most of the constructions that you will encounter in this course are fairly simple
and so do not require a formal correctness proof.

We have just shown that the union of two regular languages is regular, thereby
proving that the class of regular languages is closed under the union operation.
We now turn to the concatenation operation and attempt to show that the class
of regular languages is closed under that operation, too.

THEOREM 1.26
The class of regular languages is closed under the concatenation operation.

In other words, if A1 and A2 are regular languages then so is A1 ◦ A2 .

To prove this theorem, let’s try something along the lines of the proof of the
union case. As before, we can start with finite automata M1 and M2 recognizing
the regular languages A1 and A2 . But now, instead of constructing automaton
M to accept its input if either M1 or M2 accept, it must accept if its input can
be broken into two pieces, where M1 accepts the first piece and M2 accepts the
second piece. The problem is that M doesn’t know where to break its input
(i.e., where the first part ends and the second begins). To solve this problem, we
introduce a new technique called nondeterminism.

1.2
NONDETERMINISM
Nondeterminism is a useful concept that has had great impact on the theory of
computation. So far in our discussion, every step of a computation follows in a
unique way from the preceding step. When the machine is in a given state and
reads the next input symbol, we know what the next state will be—it is deter-
mined. We call this deterministic computation. In a nondeterministic machine,
several choices may exist for the next state at any point.
Nondeterminism is a generalization of determinism, so every deterministic
finite automaton is automatically a nondeterministic finite automaton. As Fig-
ure 1.27 shows, nondeterministic finite automata may have additional features.

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