Davey - Myhill-Nerode Theorem.pptx

advertisement
Myhill-Nerode Theorem
By: Cody Davey
But First A Recap!
● The Pumping Lemma
o
o
o
A tool to show that certain languages are non
regular
There exists strings x, y, z in the form xynz for
n=123...
The pumping lemma can sometimes run into issues
due to its negative applications
Myhill-Nerode Introduction
● An alternative method to the pumping
lemma
o
Constructive approach - shows that a language is
regular
● Proven by John Myhill and Anil Nerode at
the University of Chicago in 1958
Society
● Each state creates a society of a certain
class of strings
o
Note: Strings are not just accepted words
● Two strings belong to the society of a state
if they trace a path from a start to that
state
A Society
● In this example, both strings ‘ab’ and ‘ba’ belong to the society of state
x3
X1
-
x3
x2
A Society Cont.
● If strings x and y are in the same society,
then for all other strings z, either both xz
and yz are accepted or rejected.
Theorem
● Given a language L, we shall say that any two strings x
and y are in the same class if for all possible strings z
either both xz and yz are in L or both are not
o The language L divides the set of all possible
strings into separate (mutually exclusive classes)
o If L is regular, the number of classes L creates is
finite
o If the number of classes L creates is finite, then L
is regular
Theorem Part 1 - A closer look at classes
● No string is in two different classes and every string is
in some class
o If S is in a class with X and S is also in a class with
Y, then X and Y must be in the same class
Theorem Part 2
● If we assume L is regular, then there is some FA that
accepts L and therefore has a finite number of states
which creates a finite division of all strings into
finitely many societies
o Two different states might define societies that are
actually in the same class
o Number of classes is no more than the number of
societies
Theorem Part 2 cont.
b
X1
-
x3 +
x2
b
Theorem Part 3
● So, how do we go from “L creates finitely many
classes” to “these are the classes”
o We can’t!
● So instead we will go from “these are the classes” to
“here is the FA”
Theorem Part 3 cont.
● Let the classes be C1, C2, …., Cn, where C1
is the class containing ᴧ
● We then show how to draw the edges
between them and how to assign start and
final states
Theorem Part 3 Observations
● The start state will be C1 since ᴧ starts and
ends in the start state
● If a class contains one word in L, then all
the strings in the class are words in L.
o
Proof: Let w be in class C7 and a word in L, and let
s be any other string in C7. Then letting z = ᴧ, we
know that both wᴧ and sᴧ are either in L or not
Draw the Edges!
● If x and y are in a class, say C2 then for all
strings z, both xz and yz are in L or not.
o
This means that xa and ya must be in the same
class because both xaz and yaz must be in L or not
Example
● Consider the language of all words that end in a.
● There are actually two classes:
o C1 = all strings that don’t end in a, the start state
o C2 = all strings that end in a, and is a final state
C1-
Example cont.
● We know that if we add an a to any string in
C1 or C2 every resultant string is in C2, so we
draw an a-edge from these classes to C2
a
a
C1-
C2+
Example cont.
● Next we draw the b-edges
a
C1-
a
C2+
b
Another (brief) Example
● Consider the FA EVEN-EVEN
o There are four classes, and therefore states
o C1 = EVEN-EVEN
o C2 = even a’s and odd b’s
o C3 = odd a’s and even b’s
o C4 = odd a’s and odd b’s
Non-regular example
● Consider the language anbn
we can observe that the strings a, aa, aaa,
aaaa,..., are all in different classes because for
each m only am is turned into a word in L by z = bm
o C1 = a
o C2 = aa
o C3 = aaa
o C4 = aaaa
o And this goes forever because each one requires a
different string z to be accepted
o
Final Note
● It is important to remember that this is only
an alternative to the pumping lemma, not a
replacement. There are going to be cases
where one is a better choice over the
other.
Bibliography
● Nichols, Warren D., and Robert G. Underwood.
“Algebraic Myhill-Nerode Theorems.” Theoretical
Computer science (2010): 448-57. ScienceDirect.
WEb. 16 Mar. 2015.
● Cohen, Daniel I. A. Introduction to Computer Theory.
New York: Wiley, 1986. Print.
Download