Quantcast
Channel: Complexity of NFA cofiniteness - Theoretical Computer Science Stack Exchange
Viewing all articles
Browse latest Browse all 3

Answer by Emil Jeřábek for Complexity of NFA cofiniteness

$
0
0

Since the other answer makes it sound as if it were not obvious, let me point out that the problem is computable in PSPACE. First, we observe:

Lemma. For any NFA $A$ with $n$ states, the following are equivalent:

  1. $L(A)$ is infinite.
  2. $A$ accepts a word of length $\ge n$.
  3. There is an accepting run of $A$ that goes through some state twice.

Either condition 2 or 3 can be checked in NL.

Proof: 1 → 2 is obvious. 2 → 3: An accepting run of length $\ge n$ (hence with $\ge n+1$ states, including the starting and final states) must repeat some state by the pigeonhole principle. 3 → 1: We can repeat the part of the accepting run between two occurrences of the same state as many times as we want, yielding arbitrary long accepted words.

Corollary. Cofiniteness for NFA can be checked in $\mathrm{coNPSPACE=PSPACE}$.

Proof: Determinize the automaton using the powerset construction, flip accepting and rejecting states, and apply the Lemma to the result. It is not necessary to construct the whole powerset automaton in advance—we can just guess transitions on the fly, storing only a representation of the current state (i.e., a subset of the original automaton), hence the needed space is only $O(n)$ (for a nondeterministic algorithm).


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles



Latest Images