if given a language $L$ recognized by NFA $N_0$ over an alphabet $\Sigma$. Is it possible to find a general way of constructing an NFA $N_1$ that accept $L^C$ such that $L^C= \{w \in \Sigma^{*} |\mid w \notin L \}$?
Asked
Active
Viewed 716 times
1 Answers
1
Is there a general way to do it? The answer is yes: one way to do it is to find a DFA that accepts $L$ (for example with the powerset construction), make it complete (by adding a sink state), and swap final states and non-final states. The automaton is deterministic, but it is a special case of non deterministic.
Is there a polynomial time way to do it? I don't know, since the construction above can be exponential time in the number of states (because of the powerset construction).

Nathaniel
- 15,071
- 2
- 27
- 52
-
perfect! got it! – John C. Feb 22 '21 at 00:40
-
There is a polynomial time way to do it, but it's a bit complicated. Well, I think it's polynomial; not sure now that I think about it. But as a hint: Use Brzozowski derivatives. – Pseudonym Feb 22 '21 at 01:49
-
2@Pseudonym Complementing an NFA involves an exponential blowup. See here: https://cs.stackexchange.com/questions/10458/can-we-say-anything-about-the-complement-of-a-regular-language – Bader Abu Radi Feb 22 '21 at 08:33