automatafinite-automataautomata-theory

DFA creation and minimization


Task: Draw an DFA that accepts words from the alphabet {0,1} where the last character is not repeated anywhere else in the word. (example: words 0, 1, 00001, 111110, ε are in the language of this NFA, while words 010, 111, 0010, 101 are not).

I think I got the DFA right but I can't minimize it because I have a trap state which I can't get rid of whatever I do. Any advices or tips?enter image description here


Solution

  • Your DFA is correct (except the initial state q0 should be accepting since the empty string is in the language). It is also minimal; we can show that the sets of strings that lead to each state are all distinguishable w.r.t. the language according to the Myhill-Nerode indistinguishability relation.

    Therefore, your DFA is minimal. You can show this by attempting to run a minimization algorithm and noting that no states get removed.

    Note: it depends on your definitions but it is a normal (and I would say preferred) definition of DFAs that they define all transitions, which means that dead (or as you call them, trap) states are required to be shown. Minimization algorithms probably don't remove them, but you can remove them if you like (though I'd call the resulting automaton nondeterministic since deterministic behavior is not specified for some transitions).