For DFAs, NFAs how can you show $L(D) = \overline {L(D')}$ or $L(N) = \overline {L(N')}$?

64 Views Asked by At

Sorry if the title doesn't completely explain the question but I couldn't find a way to fit it all in there. I am having some trouble with the following question:

Image

In particular, I do not know how to prove or disprove these two, and I've have been unable to find counterexamples. How would you guys go about proving these two?

1

There are 1 best solutions below

2
On BEST ANSWER

In the case of DFAs it's true; but for NFAs it's not in general true.

For DFAs Given $D$ and $D'$, that $L(D) = \overline {L(D')}$ follows easily from the definitions of the objects involved. In a little more detail, though:

The transition function $\delta$ has domain $Q \times \Sigma$, but it's easily extended to a function $\delta^{*}\colon Q \times \Sigma^{*} \to Q$ defined not just for letters but for all strings. $\delta^{*}(q, \sigma)$ is the state that $D$ will be in on input $\sigma$. $\delta^{*}$ is defined by induction on the length of strings $\sigma$. For $q \in Q, c \in \Sigma$: $$ \begin{align} \delta^{*}(q, \varepsilon) &= q \\ \delta^{*}(q, \sigma c) &= \delta(\delta^{*}(q, \sigma), c) \\ \end{align} $$ It's easy to see that a string $\sigma \in L(D)$ iff (if and only if) $\delta^{*}(s, \sigma) \in F$, where $s$ is the start state and $F$ the set of accepting states.

Given the definition of $D'$, its transition function is the same as that for $D$, so its extended transition function $\delta^{*}$ is the same too. A string $\sigma \in L(D')$ iff $D'$ accepts $\sigma$, iff $\delta^{*}(s, \sigma) \in Q \setminus F$, iff $\delta^{*}(s, \sigma) \notin F$, iff $\sigma \notin L(D)$. That is, the languages of $D, D'$ are complements of each other.

For NFAs, however, here's a counterexample $N = (Q, \Sigma, \Delta, s, F)$: $Q = \{q_0, q_1, q_2\}$, $\Sigma = \{a\}$, $s = q_0$, $F = \{q_1\}$; the transitions $\Delta$ are as follows: $$ (q_0, a) \to q_1 \\ (q_0, a) \to q_2 \\ (q_1, a) \to q_2 \\ (q_2, a) \to q_2 \\ $$ Thus, $L(N) = \{a\}$. In $N$, there are 2 paths on input $a$: one to state $q_1$ (accepting) and another to $q_2$ (non-accepting). In state $q_2$, any further letters in an input string remain in that non-accepting state, so strings longer than 1 are not accepted; in state $q_1$, any further letters in an input string transition on the first letter to $q_2$ then remain there, so again strings longer than 1 aren't accepted. The empty string is not accepted because $q_0$ isn't an accepting state.

If we obtain $N'$ from $N$ by switching the accepting states to the complement $\{q_0, q_2\}$, then $L(N') = \Sigma^{*}$, which also contains the string $a$.