# NFA/DFA for $L= \{a^n b^n a | n\ge0\}$

I have made two DFA’s for $$L= \{a^n b^n a | n\ge0\}$$.

First one has several states. The second one is accepting an empty string also.

Somebody please guide me the correct one.

Zulfi.

Since FSM's can't count identical sequences, I don't think both of your answers would be correct. You can take a look here, (pumping lemma) to prove why $$L= \{a^nb^n | n \ge 0 \}$$ is not regular, thus you can't write a FSM for it. Also a good example here shows the proof. On the other hand it would be different if you are meaning $$a^*b^*a$$ which can be written as a FSM.
• Yeah but $a^*b^*a$ is different than $a^nb^na$. If you want the first one it's easy we can write it. Dec 1 '19 at 1:41