Determining whether a nondeterministic finite automaton accepts every possible string

772 Views Asked by At

Given an NFA, is there a way to determine whether it accepts all strings constructed from its alphabet, without having to iterate over the infinite set of possible strings?

1

There are 1 best solutions below

0
templatetypedef On

Sure! Here's one algorithm:

  1. Run the subset construction to turn the NFA into a DFA.
  2. Minimize the DFA using a DFA minimization algorithm.
  3. Check whether the DFA consists of a single state that's accepting. If so, the original NFA accepts everything. If not, there's at least one string the NFA doesn't accept.

There may be a faster algorithm than this (step (1) could take time exponential in the size of the input NFA), but this shows that there is indeed some algorithm for solving this problem.