The Structure of \(\mathsf{Fin}\)
So far, we have seen that if a language is totally deterministically finitely recognizable, deterministically finitely recognizable, or finitely recognizable, then it is all three. That is, \[ \mathsf{TDFin} = \mathsf{DFin} = \mathsf{Fin} \] This has a ton of very interesting consequences for the structure of \(\mathsf{Fin}\). In particular, \(\mathsf{Fin}\) is closed under a number of common set-operations.
Complements
Remember that for any two sets \(X\) and \(Y\), \[ Y \setminus X = \{y \in Y \mid \text{\(y\) is not in \(X\)}\} \] So, in particular, for a language \(L \subseteq A\), \(A^* \setminus L\) is the language consisting of all words that are not in \(L\). This language, \(A^*\setminus L\), is the complement of the language \(L\).
- Is \(\mathcal A\) deterministic or total?
- What language is accepted by the state \(x_0\)?
- Now flip the states, set \(F = \{x_0\}\) instead. Now what language is accepted by the state \(x_0\)?
- Draw a state diagram for \(\mathcal A\).
- Is \(\mathcal A\) total or deterministic?
- What language \(L\) does \(x_0\) accept?
- Play the same trick as in Flip the Switch 1 and 2 to make \(x_0\) accept \(A^* \setminus L\). Did it work? What language does \(x_0\) accept now?
- What makes the trick work?
Unions and Intersections
It's also true that \(\mathsf{Fin}\) is closed under unions and intersections. We are going to show the first statement together, and you are going to show the second. It helps to see a few examples of this in action.
You should take pictures of the automata you build in Union of Constants to reflect on later.
- \(L_1 = \{a^n \in A^* \mid n \in \mathbb N\}\)
- \(L_2 = \{b^n \in A^* \mid n \in \mathbb N\}\)
- \(L_3 = L_1 \cup L_2\)
- \(L_4 = \{(ab)^n \in A^* \mid n \in \mathbb N\}\)
- \(L_5 = L_1 \cup L_4\)
There is something funky going on in these examples; you might have missed it. If you did the Union of Constants exercise right, then you might know what I am referring to when I say that \(2 \times 2 = 4\) and \(2 \times 3 = 6\). This is not a coincidence!
The Product Constructions
When you are confronted with two finitely recognizable languages \(L_1\) and \(L_2\) and you want to combine them in some way to make a new finitely recognizable language, your best bet is to combine some automata and states that accept \(L_1\) and \(L_2\) individually. This is a different flavour of automaton construction than determinization, since the input is two automata instead of one.
One way to combine finitely recognizable languages is by taking their union. To show that the union is finitely recognizable, we can use an automaton construction that combines two automata called the union-product construction.
- \(Q_1 \times Q_2\) is the Cartesian product of \(Q_1\) and \(Q_2\), which is the set of pairs \((x, y)\) where \(x \in Q_1\) and \(y \in Q_2\).
- \(\delta^\times\) is the transition relation defined by the following: \[ (x_1, y_1) \xrightarrow{a}_{\delta^\times} (x_1, y_2) \text{ if and only if } x_1 \xrightarrow{a}_{\delta_1} x_2 \text{ and } y_1 \xrightarrow{a}_{\delta_2} y_2 \] In other words, in \(\mathcal A_1 \oplus \mathcal A_2\), states travel together.
- \(F^\oplus = \{(x, y) \in Q_1 \times Q_2 \mid x \in F_1 \text{ or }y \in F_2\}\), i.e., a pair \((x, y)\) accepts if one of \(x\) or \(y\) accepts.
- \((x_1, y_1) \xrightarrow{a} (x_2, y_1)\), because \(x_1 \xrightarrow{a} x_2\) in \(\mathcal A_1\) and \(y_1 \xrightarrow{a} y_1\) in \(\mathcal A_2\)
- \((x_1, y_1) \xrightarrow{b} (x_1, y_2)\), because \(x_1 \xrightarrow{b} x_1\) in \(\mathcal A_1\) and \(y_1 \xrightarrow{b} y_2\) in \(\mathcal A_2\)
- \((x_1, y_2) \xrightarrow{a} (x_2, y_1)\), because \(x_1 \xrightarrow{a} x_2\) in \(\mathcal A_1\) and \(y_2 \xrightarrow{a} y_1\) in \(\mathcal A_2\)
- \((x_1, y_2) \xrightarrow{b} (x_1, y_1)\), because \(x_1 \xrightarrow{b} x_1\) in \(\mathcal A_1\) and \(y_2 \xrightarrow{b} y_1\) in \(\mathcal A_2\)
Importantly, the union-product of two total deterministic automata is a total deterministic automaton, by construction. Every pair of states has exactly one out-going transition for each letter \(a \in A\), because every state in \(\mathcal A_1\) or \(\mathcal A_2\) has exactly one outgoing transition for each letter.
The significance of the union-product construction is that it allows us to prove that \(\mathsf{Fin}\) is closed under unions, in the following sense.
So let's prove the claim. We need to show two things: (1) that \(\mathcal L(\mathcal A, (x, y)) \subseteq L_1 \cup L_2\), and (2) that \(\mathcal L(\mathcal A, (x, y)) \supseteq L_1 \cup L_2\).
To see (1), let \(w \in \mathcal L(\mathcal A, (x,y))\). Write \(w = b_0 b_1 \cdots b_{n-1}\). Then there is a path \[ (x, y) \xrightarrow{b_0} (x_1, y_1) \xrightarrow{b_1} \cdots \xrightarrow{b_{n-1}} (x_{n}, y_{n}) \] and either \(x_n \in F_1\) or \(y_n \in F_2\). By definition, this means that we have found two paths through \(\mathcal A_1\) and \(\mathcal A_2\): \[\begin{gathered} x \xrightarrow{b_0} x_1 \xrightarrow{b_1} x_2 \xrightarrow{b_2} \cdots \xrightarrow{b_{n-1}} x_n \qquad \text{in \(\mathcal A_1\)}\\ y \xrightarrow{b_0} y_1 \xrightarrow{b_1} y_2 \xrightarrow{b_2} \cdots \xrightarrow{b_{n-1}} y_n \qquad \text{in \(\mathcal A_2\)} \end{gathered}\] If \(x_n \in F_1\), the first path tells us that \(w \in L_1\). If \(y_n \in F_2\), then the second path tells us that \(w \in L_2\). It follows that \(w \in L_1 \cup L_2\).
To see (2), let \(w \in L_1 \cup L_2\). Then either \(w \in L_1\) or \(w \in L_2\). The rest of the proof is the same in either case, so let's just assume that \(w \in L_1\) for now. Again, let \(w = b_0b_1\cdots b_{n-1}\). Since \(L_1 = \mathcal L(\mathcal A, x)\), \(w \in L_1\) means that there is a path \[ x \xrightarrow{b_0} x_1 \xrightarrow{b_1} x_2 \xrightarrow{b_2} \cdots \xrightarrow{b_{n-1}} x_n \] in \(\mathcal A_1\) such that \(x_n \in F_1\).
Now here is where we need that \(\mathcal A_1\) and \(\mathcal A_2\) are total and deterministic: since \(\mathcal A_2\) is total and deterministic, we can form a path, \[ y \xrightarrow{b_0} y_1 \xrightarrow{b_1} y_2 \xrightarrow{b_2} \cdots \xrightarrow{b_{n-1}} y_n \] in \(\mathcal A_2\) (recall that there is always an outgoing transition because of totality). It doesn't matter which path we choose, we just need to know it exists, because it tells us there is a path \[ (x, y) \xrightarrow{b_0} (x_1, y_1) \xrightarrow{b_1} \cdots \xrightarrow{b_{n-1}} (x_{n}, y_{n}) \] Since \(x_n \in F_1\), \((x_n, y_n) \in F^\oplus\), and therefore \(w = b_0b_1 \cdots b_{n-1} \in \mathcal L(\mathcal A, (x,y))\). It follows that \(L_1 \cup L_2 \subseteq \mathcal L(A, (x, y))\).
Since we have shown both that \(\mathcal L(\mathcal A, (x, y)) \subseteq L_1 \cup L_2\) and that \(\mathcal L(\mathcal A, (x, y)) \supseteq L_1 \cup L_2\), we have proven the Claim. Since the Claim implies the Closure Under Union Theorem, we are done.
The title of this subsection is The Product Constructions, plural. There are indeed two, and I bet you can find the other one.
- \(L_1 = \{a^nb^m \in A^* \mid n,m \in \mathbb N\}\)
- \(L_2 = \{b^na^m \in A^* \mid n,m \in \mathbb N\}\)
- \(L_3 = L_1 \cap L_2\)
- \(L_4 = \{a^nb(ba)^m \in A^* \mid n,m \in \mathbb N\}\)
- \(L_5 = L_1 \cap L_4\)