3

It is known that when NFA's accepting states are swapped with rejecting states, the recognized language is not complement of the original language. For some language, it may be the case that some strings that were recognized in the original NFA may still be recognized in the state-swapped NFA.

My question is, is there a language $L$ that in the original NFA a string is not recognized(rejected), but in the NFA where accepting states become rejecting states and rejecting states become accepting states the string is also rejected?

Raphael
  • 72,336
  • 29
  • 179
  • 389
Huge
  • 61
  • 3

2 Answers2

3

It depends on whether the NFA contains a path for every possible word.

If there is an input word where there is no path through the NFA at all labelled with that word, then yes, this can happen. See Hendrik Jan's answer.

On the other hand, it is often assumed that the automaton is complete: that for every possible input word, there is at least one path in the automaton labelled with that word. (For instance, this can be arranged by ensuring that for every state $q$ and every possible input letter $x \in \Sigma$, there is a transition out of $q$ labelled with $x$.) If you assume the automaton is complete, the answer is: No.

In particular, if the automaton is complete, the answer is: No, the magic of nondeterminism is that if there's any valid computation path that will end in an accept state, the string is accepted. In this case, all possible computation paths in the original NFA led to rejection (had there been any valid path the string would be accepted, so they must all reject), so in the inverted NFA, they all lead to acceptance.

Luke Mathieson
  • 18,125
  • 4
  • 55
  • 86
  • 2
    That is assuming there is a path for every word (hence Hendrik Jan's answer). – Klaus Draeger Feb 06 '15 at 13:41
  • @KlausDraeger Technically correct, but I think the whole "flip states" idea assumes the automaton to be complete, doesn't it? – Raphael Feb 06 '15 at 13:43
  • @Raphael I'm not sure if that is necessarily assumed. It is a natural condition though, and it does ensure that at least one of the NFA accepts any given word. – Klaus Draeger Feb 06 '15 at 13:47
  • 1
    On second thought, Luke, things go horribly wrong if some computations accept and others don't (the typical case): those are also accepted by the flipped automaton. We need for every input that either all or no computation accepts; only then can we flip. (cc @KlausDraeger) – Raphael Feb 06 '15 at 14:47
3

Yes, there is such a situation. A string is rejected when there is no computation for that string at all. Obviously there will be no computation after swapping accepting states.

Hendrik Jan
  • 30,578
  • 1
  • 51
  • 105
  • Technically correct, but I think the whole "flip states" idea assumes the automaton to be complete, doesn't it? – Raphael Feb 06 '15 at 13:43
  • @Raphael In my opinion the "flip states" technique assumes determinism, exactly one transition for each letter in each state. The question states what may go wrong when there are too much paths. Here is the dual, what goes wrong when there is no path. I believe these are opposite sides of the same coin. – Hendrik Jan Feb 06 '15 at 13:47
  • I don't think determinism is needed, technically. The OP will have to decide whether your answer is relevant (to them) or a pathological corner case. – Raphael Feb 06 '15 at 14:49