I am new to the topic of finite automata and transition graphs. I had a quiz that asked that if there is a two-state TG that accepts all strings from {a,b}* that are not in EVEN-EVEN (language that have an even number of a's and even number of b's). Please explain if this is possible.
-
can you explain what even-even is? Is this the language of all strings where the numbers of a's and b's are both even numbers? – Patrick87 Nov 01 '21 at 19:55
-
Yes, Even-Even and Odd-Odd are well-discussed languages in automata. I guess it is obvious for anyone that has some basic knowledge of the subject. Nevertheless, I have mentioned it in the question for people who don't know about it. – Ibrahim Nov 02 '21 at 22:05
-
@Ibrahim Welcome to Stack Overflow. You might want to delete this question and ask it on https://cs.stackexchange.com/ instead, but check the help pages there first. – Progman Nov 03 '21 at 20:57
1 Answers
We can use the Myhill-Nerode theorem to show there are no two-state deterministic finite automata for this language. We can start checking strings in increasing lexicographical order and see whether each is distinguishable from the strings that came before it. If we find three mutually distinguishable strings, we're done.
The empty string is the first and is vacuously distinct from all others before it (none). We can call the state in a minimal DFA for this q0 and its equivalence class [e]. This state is not accepting since the empty string is in even/even. The strings that come after this to get a string not in even/even are precisely the strings not in even/even.
The string a is the next string and is distinguishable from the empty string since its state must be accepting. Call its state q1 and its equivalence class [a]. The strings that can come after this to get to a string not in even/even are the strings not in odd/even.
The string b is the next string and is distinguishable from both of the other two; the strings that can follow this to get a string not in even/even are the strings not in even/odd. This means we'd need a third state, call it q3, in a minimal DFA for this language. So, a minimal DFA must have at least three states.
As for whether there's an NFA with two states for this language (not even/even): probably not. We don't have a problem with determinism per se, but rather with how much we have to remember. With two states we can only remember whether what we've seen so far is accepted or not. We cannot have remembered anything else that can help us going forward. aaabbb and abb are distinguishable with respect to our language but not only w.r.t. membership, since both aaabbb and abb are in the language.

- 27,682
- 3
- 38
- 73