Tutorial 11
Tutorial 11
2. NFAs
Analyze the two languages below. They are two descriptions of the same
language – strings of balanced parentheses.
Language 1: The set of strings where each string w has an equal number of
zeros and ones; and any prefix of w has at least as many zeros as ones.
Language 2: The set of strings defined inductively as follows: if w is in the
set then 0w1 is also in the set; if u and v are in the set then so is uv; and the
empty string is in the set.
5. Closure Problems
a. Prove that if L1 is regular and L2 is regular then so is L1-L2 (the set of all
strings in L1 but not in L2).
b. Prove that if L is regular then Prefix(L) is regular. Prefix(L) is the set of
all strings which are a proper prefix of a string in L.
c. Prove that Regular Sets are closed under MIN. MIN(R), where R is a
regular set, is the set of all strings w in R where every proper prefix of w
is
in not in R. (Note that this is not simply the complement of PREFIX).
d. Prove that Regular Sets are NOT closed under infinite union. (A
counterexample suffices).
e. What about infinite intersection?
6. Regular Expressions
Write regular expressions for each of the following languages over the
alphabet {0,1}. Provide justification that your regular expression is correct.
a. The set of all strings in which every pair of adjacent zeros appears before
any pair of adjacent ones.
b. The set of all strings not containing 101 as a substring.
c. The set of all strings with at most one pair of consecutive zeros and
one pair of consecutive ones.
a. r(s + t) and rs + rt
b. (r*)*and r*
c. (r + s)* and r*s*
9. Final States
a. Explain why every NFA can be converted to an equivalent one that has a
single final state.
b. Give a counterexample to show that this is not true for DFA’s.
c. Extra Credit: Describe the languages that are generated from a DFA
with just one final state.
10. Problems