[FrontPage] [TitleIndex] [WordIndex

Assignment 2 Solutions - Spring 2006

Problem 1 - Building DFSAs

Draw state diagrams for deterministic finite automata accepting each of the following languages:

a) aa*

http://focs.olin.edu/JFLAP/2006assignment2/1a.jpg

b) (ab)*(ba)*

http://focs.olin.edu/JFLAP/2006assignment2/1b.jpg

c) { w | w contains at least three 1s } (where w is a string over the alphabet { 0, 1 })

http://focs.olin.edu/JFLAP/2006assignment2/1c.jpg

d) { w | w doesn't contain the substring 110 } (where w is a string over the alphabet { 0, 1 })

http://focs.olin.edu/JFLAP/2006assignment2/1d.jpg

As soon as we have seen two 1's in a row (and are in state q2), any zero will mean instant death, because then we will have seen 110. In fact, state q3 could (and probably should) be eliminated from this FSA altogether, since it's actually just a part of the implied dead state.

Transition table for 1b:

a

b

q4

q1

q3

q1

/

q0

q0

q1

q3

q3

q2

/

q2

/

q3

Problem 2 - Building NDFSAs

Draw state diagrams for nondeterministic finite automata accepting each of the following languages:

a) (ab)*(ba)* U aa*

http://focs.olin.edu/JFLAP/2006assignment2/2a.jpg

b) ((ab U aab)* a*)*

http://focs.olin.edu/JFLAP/2006assignment2/2b.jpg

c) ((a*b*a*)* b*)

One way to do this problem would be to directly translate the regular expression into an equivalent machine, not worrying about what everything "meant". This would ensure that your machine was correct, because it can be visually verified that it does the same thing as the regular expression:

http://focs.olin.edu/JFLAP/2006assignment2/2c.jpg

Another way to do this problem would be to analyze and simplify the regular expression to see what sorts of strings it actually accepts. One can quickly conclude that the following FSA is also equivalent to this regular expression:

http://focs.olin.edu/JFLAP/2006assignment2/2csimple.jpg

There are standard procedures for simplifying FSAs and regular expressions into their "minimal" forms.

Transition table for 2c:

This is the transition table for the complicated 2c. I'll let you figure you the simple one. :)

a

b

lambda

q0

q0

/

q1

q1

/

q1

q2

q2

q2

/

q0, q3

q3

/

q3

/

Problem 3 - Relationship Between DFSA and NDFSA

Convert two pictured NDFSAs into DFSAs:

a)

http://focs.olin.edu/JFLAP/2006assignment2/3a.jpg

Transition table used for conversion:

a

b

e

EC

1

1,2

2

/

{1}

2

/

1

/

{2}

b)

http://focs.olin.edu/JFLAP/2006assignment2/3b.jpg

Transition table used for conversion:

a

b

e

EC

1

3

/

2

{1,2}

2

1

/

/

{2}

3

2

2,3

/

{3}

Problem 4 - Proving Properties of FSAs

Prove that every NDFSA can be converted to an equivalent one that has a single accept state.

The basic intuition of a proof for this should revolve around the fact that it is always possible to make this conversion using this process:

  1. Create a new accepting state F.
  2. Create epsilon transitions from every accepting state in the set of original accepting states.
  3. Make all of the original accepting states non-accepting.

It isn't possible to construct an NDFSA for which this described procedure isn't possible.

Problem 5 - Pumping Lemma

Use the pumping lemma to show that the language {0n 1m | n <= m } is not regular.

We will apply the pumping lemma by assuming that n=p, which means that y consists of zeros. This means that we should be able to "pump" the string by adding zeros before the start of the ones and have the string still be in the language. However, we can see that at a certain point, the number of pumped zeros will exceed m. When the number of zeros exceeds the number of ones, the string is no longer in the language. This is a contradiction, which means that this language cannot be regular.


2013-07-17 10:42