# Is this DFA correct for the language $\{w \mid w \in \{ab\}^*\}$?

Language: $\{w \mid w \in \{ab\}^*\}$

-
By the way, writing $\{w\mid w\in \{ab\}^*\}$ seems a complicated way to write $\{ab\}^*$. –  Hendrik Jan Nov 8 '12 at 2:38

It has problems in both directions: it doesn’t accept the empty word, which is in the language, and it does accept a lot of words, like $aba$ and $abb$, that aren’t in the language. The first problem is easily fixed: just make $q_0$ an acceptor state. The second requires some more significant changes. The $b$-transition from $q_3$ should go to $q_1$, the garbage state, and the $a$-transition should go to a new non-accepting state $q_4$. Can you then fill in what the two transitions from $q_4$ should be?

Alternatively, you could get rid of $q_3$ and have a $b$-transition from $q_2$ to $q_1$, using only three states altogether.

-
I see. ok..working on fixing it now. –  zeqof Nov 8 '12 at 7:15

No it is not correct, your DFA accepts all strings starting with $ab$ and it doesn't accept the empty string.

-

your DFA will only accept string which starts from ab .so to make it work make every state will be a final state.

-