Search code examples
automatadfa

How Can I Tell if a DFA Accepts an Empty String?


I'm working on a question that asks me to build an DFA for a specific language. I understand all of it, but I'm unsure as to whether or not an empty string should be accepted right away (in this case, the initial state should also be a final state).

I'm given the alphabet E = {0, 1} and I must make a DFA to accept all strings of this alphabet with no more than four 1s. In the case that it does accept an empty string, I know that I should just make my initial state a final state, but I'm not sure how to know if it should accept an empty string or not. How can I know if a DFA should accept an empty string or not based on the given alphabet?

My assumption would be that it does not, as the empty string is not a part of the alphabet E.


Solution

  • The empty string is a sequence of symbols from the alphabet with length zero. The empty string is never a symbol in the alphabet. Your language - the language of all strings over {0, 1} with no more than four 1s - includes the empty string, since the empty string contains fewer than four 1s. Therefore, your DFA must accept the empty string to accept the language. As you have already observed, to accept the empty string, the initial state must also be a final/accepting state.