Languages and acceptance
Today, we are going to return to the idea behind a solution space, which consisted of all of the sequences of legal moves that brought our puzzles into a "winning configuration". Just like how sequences of legal moves get abstracted to words, solution spaces are abstracted to languages.
The "winning configurations" of automata are the accepting states: in the definition of an automaton \(\mathcal A = (Q, A, \delta, F)\), these are the states \(x \in F \subseteq Q\). So the "solution space" of an automaton is, so to speak, the sequences of input letters that transition whichever state you start from to an accepting state.
A common turn of phrase you will see written is the statement "\(x\) accepts the language \(L\)". What this means is that \(L = \mathcal L(\mathcal A, x)\).
The second mistake is to say that a state \(x \in Q\) accepts a language \(L \subseteq A^*\) if every \(w \in L\) is accepted by \(x\). This is equivalent to saying that \(\mathcal L(\mathcal A, x) \subseteq L\), not \(\mathcal L(\mathcal A, x) = L\)! The terminology "\(x\) decides \(L\)" is really a lot clearer, but the standard literature usually uses the word "accept". Not sure why. 🙄
Notation. Given two sets \(X\) and \(Y\), we are going to write \(X \setminus Y\) for the set of elements of \(X\) that are not in \(Y\). Formally, \( X \setminus Y = \{x \in X \mid x \notin Y\} \). The set \(X \setminus Y\) is the complement of \(Y\) in \(X\).
- \(L_1 = \{a, aa, aaa\}\)
- \(L_2 = \{w \in A^* \mid \text{\(w\) ends with \(b\)}\}\)
- \(L_3 = \{w \in A^* \mid \text{\(w\) has an even number of \(a\)'s}\}\)
- \(L_4 = \{w \in A^* \mid \text{\(w\) has \(3k+1\) many \(a\)'s for some \(k \ge 0\)}\}\)
- \(L_5 = \{w \in A^* \mid \text{\(w\) either has \(3k+1\) or \(3k + 2\) many \(a\)'s for some \(k \ge 0\)}\}\)
- \(L_6 = A^* \setminus L_2\)
Common descriptions of languages
In the Let 'em Cook problem, we saw some descriptions of languages of the form \[ L = \{w \in A^* \mid \textit{(something that has to be true about \(w\))}\} \] As you have probably gathered so far, the sentence to the right of the \(\mid\) tells you explicitly when a particular \(w \in A^*\) is in \(L\) or not. This method of defining sets is called set comprehension, because you are giving a comprehensive description of which elements are in the set. Set comprehension is the most common way of describing sets of things in general, and it will come up frequently in this course.
Later, we will see a more compact notation for writing down languages.
States as literal programs
Returning to the idea that states of automata are programs, we can implement an automaton reading a string of input letters in any programming language rather easily. Working from the code back to an automaton isn't always as easy.
-
Run the program and test out which of the following strings are accepted/rejected (type "quit" to stop the program):
- \(1\)
- \(010\)
- \(\varepsilon\)
- \(011011\)
- Write down a transition table for \(\mathcal A\) and draw a state diagram of \(\mathcal A\).
- Which state does the program correspond to?
- Using set comprehension, describe the language accepted by this state.