Let’s consider naïvely attempting concatenation for these two DFAs:
\(D_1\) \(D_2\)
If we immediately “jump” from even to q0 by redirecting the transition \(\texttt{even} \stackrel{1}{\to} \texttt{odd}\) instead to \(\texttt{even} \stackrel{1}{\to} \texttt{q0}\), then \(1111 = 111 \circ 1\) is rejected despite \(111 \in L(D_1)\) and \(1 \in L(D_2)\).
We don’t know when to transition to q0, and even if we did, we don’t know how to avoid doing it the very first time we encounter a state with a transition to q0.
The same “where and how to split?” difficulty is encountered for Kleene star.
The ability of an NFA to “guess” makes it simpler to construct a machine deciding the concatenation and Kleene star of languages.
Once we demonstrate how to convert an NFA to a DFA, this will prove (indirectly) that DFA-decidable languages are closed under concatenation and Kleene star.
First: how can we simplify the union construction with NFAs?
Create a new start state with \(\emptystring\)-transitions to the old start states.
Note if the two NFAs respectively have \(n\) states and \(m\) states, this has \(n + m + 1\) states, compared to \(nm\) states for the product construction.
What’s a string the new NFA accepts that it should reject?
The NFA accepts \(111\) despite \(111 \notin L(D_1) \circ L(D_2)\).
We make all states of the left NFA rejecting, so that we only accept strings \(xy\), such that \(x\) is accepted by the left NFA and \(y\) is accepted by the right NFA.
Consider the star of \(L(N) = \setbuild{x \in \{\string{a, b}\}^*}{ x \text{ has an odd number of } \string{b} \text{'s followed by an } \string{a}}\).
What’s a string the new NFA accepts that it should reject?
This accepts \(\string{bb}\) even though \(\string{bb} \notin L(N)^*\).
Since transitions enter q0, making it accepting alters the original NFA’s behavior.
Consider the star of \(L(N) = \setbuild{x \in \{\string{a, b}\}^*}{ x \text{ has an odd number of } \string{b} \text{'s followed by an } \string{a}}\).
The new start state \(s\) can only be reached by \(\emptystring\), so making it accepting does not alter the original NFA’s behavior on any positive-length string.
Theorem: the NFA-decidable languages are closed under union:
If \(A = L(N_1)\) and \(B = L(N_2)\), then we can construct \(N\) such that \(L(N) = A \cup B\).
Proof:
Alternatively: the set of transitions \(\Delta\) for \(N\) is the union \(\fragment{\Delta_1} \fragment{\cup \Delta_2} \fragment{\cup \{s \stackrel{\emptystring}{\rightarrow} s_1, s \stackrel{\emptystring}{\rightarrow} s_2 \}.}\)
Theorem: the NFA-decidable languages are closed under union:
If \(A = L(N_1)\) and \(B = L(N_2)\), then we can construct \(N\) such that \(L(N) = A \cup B\).
Proof:
Theorem: the NFA-decidable languages are closed under concatenation:
If \(A = L(N_1)\) and \(B = L(N_2)\), then we can construct \(N\) such that \(L(N) = A \circ B\).
Proof:
Alternatively, for all \(q \in Q\) and \(a \in \Sigma_\emptystring\), \[ \Delta(q, a) = \begin{cases} \Delta_1(q, a) & \text{if } (q, a) \in Q_1 \times \Sigma_\emptystring \setminus F_1 \times \{\varepsilon\} \\ \Delta_2(q, a) & \text{if } q \in Q_2 \\ \Delta_1(q, a) \cup \{s_2\} & \text{if } q \in F_1 \text{ and } a = \emptystring \end{cases} \]
Theorem: the NFA-decidable languages are closed under concatenation:
If \(A = L(N_1)\) and \(B = L(N_2)\), then we can construct \(N\) such that \(L(N) = A \circ B\).
Proof:
Theorem: the NFA-decidable languages are closed under concatenation:
If \(A = L(N_1)\) and \(B = L(N_2)\), then we can construct \(N\) such that \(L(N) = A \circ B\).
Proof:
Theorem: The NFA-decidable languages are closed under Kleene star:
If \(A = L(N_1)\), then we can construct \(N\) such that \(L(N) = A^*\).
\(N_1\) \(N\)
Proof:
Let \(N_1 = (Q_1, \Sigma, \Delta_1, s_1, F_1)\) and construct
\(N = (Q, \Sigma, \Delta, s, F)\):
Alternatively, for all \(q \in Q\) and \(a \in \Sigma_\emptystring\), \[ \Delta(q, a) = \begin{cases} \Delta_1(q, a) & \text{if } (q, a) \in Q_1 \times \Sigma_\emptystring \setminus F_1 \times \{\varepsilon\} \\ \Delta_1(q, a) \cup \{s_1\} & \text{if } q \in F_1 \text{ and } a = \emptystring \\ \{s_1\} & \text{if } q = s \text{ and } a = \emptystring \\ \emptyset & \text{if } q = s \text{ and } a \ne \emptystring \end{cases} \]
Theorem: The NFA-decidable languages are closed under Kleene star:
If \(A = L(N_1)\), then we can construct \(N\) such that \(L(N) = A^*\). (proof of \(A^* \subseteq L(N)\))
Theorem: The NFA-decidable languages are closed under Kleene star:
If \(A = L(N_1)\), then we can construct \(N\) such that \(L(N) = A^*\). (proof of \(L(N) \subseteq A^*\))