3

I'm thinking so, because the upper bound would be the 2^n, and given that these are both finite machines, the intersection for both the n-state NFA and the DFA with 2^n or less states will be valid.

Am I wrong here?

John
  • 31
  • 2

2 Answers2

1

You're right. 2^n is an upper limit, so the generated DFA can't have more states than that limit. But it's the worst-case scenario. In most common scenarios there's less states than that in the resulting DFA. Sometimes it could be even less than in the original NFA.

But as far as I know, the algorithm to predict how many states the resulting DFA will actually have, doesn't exist yet. So if you'll find it, please let me know ;)

SasQ
  • 14,009
  • 7
  • 43
  • 43
  • What do you mean by predict? You can compute the minimal DFA and report the number of states! – Dan Jan 26 '13 at 15:35
  • 2
    Yes. But you will know the minimal number of states only AFTER you convert from NFA to DFA (which could explode the number of states up to 2^n) and then minimize the resulting DFA. You cannot know the number of states of this result up front, BEFORE you actually do the algorithm. As far as I know, such a way to predict the number of states up front doesn't exist. But if you know better, please tell us. – SasQ Jan 30 '13 at 08:33
1

That is correct. As you probably already know, both DFAs and NFAs only accept regular languages. That means that they are equal in the languages they can accept. Also, the most primitive way of transforming a NFA to a DFA is with subset construction (also called powerset construction), where you simply create a state in the DFA for every combination of states in the NFA. This is called the powerset of states, which could at most be 2^n.

But, as mentioned by @SasQ that is the worst case scenario. Typically you will not end up with that many states if you use Hopcroft's algorithm or Brozowski's algorithm.

Nico Huysamen
  • 10,217
  • 9
  • 62
  • 88