We already showed that the DFA-decidable languages are closed under union:
If \(L_1 = L(D_1)\) and \(L_2 = L(D_2)\), then we can construct \(D\) such that \(L(D) = L_1 \cup L_2\).
Formally:
What about intersection?
Theorem: the DFA-decidable languages are closed under intersection:
If \(L_1 = L(D_1)\) and \(L_2 = L(D_2)\), then we can construct \(D\) such that \(L(D) = L_1 \color{red} \cap \color{black} L_2\).
Formally:
Just update the accept states!
Theorem: the DFA-decidable languages are closed under intersection:
If \(L_1 = L(D_1)\) and \(L_2 = L(D_2)\), then we can construct \(D\) such that \(L(D) = L_1 \color{red} \cap \color{black} L_2\).
Under which of the following operations are DFA-decidable languages closed?
If \(L_1\) and \(L_2\) are DFA-decidable, then \(L_1 \cup L_2\) is DFA-decidable.
\[ L_1, L_2 \text{ DFA-decidable} \; \Longrightarrow \; L_1 \cup L_2 \text{ DFA-decidable} \]
But if \(L_1 \cup L_2\) is DFA-decidable, then \(L_1\) and \(L_2\) are not necessarily DFA-decidable.
\[ L_1, L_2 \text{ DFA-decidable} \cancel{\Longleftarrow} L_1 \cup L_2 \text{ DFA-decidable} \]
Let’s survey our progress on proving closure properties for DFA-decidable languages.
Let’s consider the concatenation of
\(L_1 = \setbuild{w \in \{0, 1\}^*}{ \#_1(w) \equiv 1 \mod 2}\), and \(L_2 = \setbuild{w \in \{0, 1\}^*}{ \#_1(w) \equiv 1 \mod 3}\)
If we immediately “jump” from odd to \(q_0\) by redirecting the transition \(\texttt{even} \stackrel{1}{\to} \texttt{odd}\) into \(\texttt{even} \stackrel{1}{\to} \texttt{q_0}\), then the string \(1111 = 111 \circ 1\) is rejected despite \(111 \in L_1\) and \(1 \in L_2\).
The same “splitting” difficulty is encountered for Kleene star.
The more convenient and flexible NFA model makes it simple 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 that DFA-decidable languages are closed under concatenation and Kleene star.
First: how can we simplify the union construction with NFAs?
\(L(D_1) = \setbuild{a^n}{n \equiv 2 \mod 3}\)
\(L(D_2) = \setbuild{a^n}{n \equiv 1 \mod 5 \; \text{ or } \; n \equiv 4 \mod 5}\)
Just create a new start state and add \(\emptystring\)-transitions to the start states of \(D_1\) and \(D_2\).
Let’s consider the concatenation of
\(L_1 = \setbuild{w \in \{0, 1\}^*}{ \#_1(w) \equiv 1 \mod 2}\), and \(L_2 = \setbuild{w \in \{0, 1\}^*}{ \#_1(w) \equiv 1 \mod 3}\)
Let’s consider the concatenation of
\(L(N_1) = \setbuild{w \in \{0, 1\}^*}{ \texttt{int}(w, 2) \not \equiv 2 \mod 3 }\), and \(L(N_2) = \setbuild{w \in \{0, 1\}^*}{ \texttt{int}(w, 2) \equiv 2 \mod 3}\)
Here \(\texttt{int}(w, 2)\) is the integer value of \(w\) in base 2.
Let’s consider the star of: \(L(N_1) = \setbuild{w \in \{\string{a, b}\}^*}{ w \text{ has an odd number of } \string{b} \text{s followed by an } \string{a}}\)
\[ \string{b (b b)^* a} \]