1

While studying Automata at my University, I faced the following problem from SIPSER, M textbook:

Consider D = { w | w contains an even number of as and an odd number of bs and doesn't contains the chain ab}. Draw an DFA with 5 states that recognizes D and a Regular Expression that generated D.

I tried doing the following DFA:

enter image description here

With the Regular Expression b(bb)*(aa)*

And that seemed quite right for me, but for chains that goes like baab it should be refused, but it isn't.

I couldn't find a way to fix it without adding another state to the DFA.

How can it be done?

Raphael
  • 73,212
  • 30
  • 182
  • 400
LeoColman
  • 113
  • 1
  • 5

1 Answers1

1

Here's one possible solution:

DFA for $b(bb)^*(aa)^*$

(In fact, the words $b,bb,ba,baa,bab$ show that at least five states are needed, so this is the unique minimal DFA.)

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514