Homework 1 Problems
Homework 1 Problems
Homework 1 Problems
September 29, 2015 Timothy Johnson
(b) The set of all strings with three consecutive 0s (not necessarily at the end).
1
2. Exercise 2.2.5 on pages 53-54 of Hopcroft et al.
Give DFAs accepting the following languages over the alphabet {0, 1}.
(a) The set of all strings such that any block of five consecutive symbols contains at least
two 0s.
(Im going to interpret this to mean that there exists a block of five consecutive symbols
containing at least two 0s.)
2
(b) The set of all strings whose tenth symbol from the left end is a 1.
3
(c) The set of strings that either begin or end (or both) with 01.
(d) The set of strings such that the number of 0s is divisible by five, and the number of 1s
is divisible by 3.
4
(a) Show by induction on n that for all n 0, (q, an ) = q, where an is the string consisting
of n as.
Base case: n = 0
(q, ) = q, by definition.
Induction step: Assume that (q, ak ) = q.
5
The table for the equivalent DFA using the subset construction is:
0 1
{p} {q, s} {q}
{q, s} {r} {p, q, r}
{q} {r} {q, r}
{r} {s} {p}
{p, q, r} {q, r, s} {p, q, r}
{q, r} {r, s} {p, q, r}
{s} {p}
{q, r, s} {r, s} {p, q, r}
{r, s} {s} {p}
This DFA is drawn below:
6
5. Exercise 2.3.4 on pages 66-67 of Hopcroft et al.
Give nondeterministic finite automata to accept the following languages. Try to take advan-
tage of nondeterminism as much as possible.
(a) The set of strings over alphabet {0, 1, . . . , 9} such that the final digit has appeared before.
7
(b) The set of strings over alphabet {0, 1, . . . , 9} such that the final digit has not appeared
before.
(c) The set of strings of 0s and 1s such that there are two 0s separated by a number of
positions that is a multiple of 4. Note that 0 is an allowable multiple of 4.