WA1 Sols PDF
WA1 Sols PDF
WA1 Sols PDF
1. Write regular expressions for the following languages over the alphabet Σ = {a, b}:
a∗ (ba∗ ba∗ )∗
a∗ b∗
2. Draw DFAs for each of the languages from question 1. None of your DFAs may contain more than 4
states.
(a)
(b)
(c)
3. Consider the following non-deterministic finite automaton (NFA) over the alphabet Σ = {0, 1}.
Give a one-sentence description of the language recognized by the NFA. Write a regular expression for
this language.
• The NFA recognizes all strings that contain two 0’s separated by a substring whose length is a
multiple of 3.
• A regular expression for this language is (0 + 1)∗ 0((0 + 1)(0 + 1)(0 + 1))∗ 0(0 + 1)∗ .
4. Let Σm = {a1 , . . . , am } be an alphabet containing m elements, for some integer m ≥ 1. Let Lm be the
following language:
Construct a DFA for the language L2 that has at most 6 states. Also construct an NFA for the
language L3 that has at most 7 states.
Aside: Non-deterministic finite automata (NFAs) are no more powerful than DFAs in terms of the
languages that they can describe. However, NFAs can be exponentially more succinct than DFAs, as
this problem demonstrates. For the language Lm , there exists an NFA of size at most 2m + 1 while any
DFA must have size at least 2m . Note that the DFA for the language L3 is not as easy to construct as
the NFA for the language L3 .
• (ab)*a+
• b*a?