Professional Documents
Culture Documents
Dmbs U1
Dmbs U1
2 Marks
1. Obtain DFAs to accept strings of a’s and b’s having exactly one a.
2. Obtain a DFA to accept strings of a’s and b’s having even number of a’s and b’s
3. Draw a DFA to accept string of 0’s and 1’s ending with the string 011
4. Give a simple verbal characterization of the following language: (0 + 1)*0(0 + 1)(0 + 1).
5. What strings are accepted by the automaton below? Give a verbal or set
characterization of the language.
aa,bb,abb,baa,abbaaaaaaa,baabbbbb etc
Strings containing aa or bb as a substring.
6. Find a regular language without that cannot be the language accepted by any DFA
with only one accept state. Justify your answer.
{a, aa} Need one accept state for each string.
{a,aa,aaa}
a*
(a + )(b+(a + ))*
6. Construct a DFA for the set of all strings over {a, b, c} that begin with a, contain
exactly two b’s and end with c.
A abaS
B babS
Construct a DFA M such that L(M) = L(G). Each transition arrow should have a one symbol
label.
8. Construct a minimal DFA for {w {0, 1, …,9}* | w corresponds to the decimal encoding, without
leading 0’s, of an odd natural number.} Also construct a regular grammar for the language.
Grammar: S dgtA | odd
A 0A | dgtA | odd
odd 1 | 3 | 5 | 7 | 9
dgt 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
(aaa)*(aab+abb+)(bbb)*
As you should suspect, the language is not regular. The pumping lemma can be
used to prove this. Choose w = ambm+2 where m is the integer from the pumping
lemma. Then, w can be written as w = xyz such that |xy| m and |y| 1. This
means that y contains only a’s. If |y| = k, then pumping down using i = 0 gives us
w0 = am-kbm+2. Since k 1, there are at least three more b’s than a’s so that w 0 is
not in L and thus L is not regular.
12. Convert the NFA below to a DFA. Be sure to follow the algorithm shown in class.
Epsilon closure (q0) then Mov()
Note: on a test you will be expected to show all work i.e. show the tables used to find
the minimum DFA.
14. Find a regular grammar corresponding to the following DFA:
S aA |
A aA |bB |b
B bB | aA |
15. Given the DFA below construct a regular expression that represents the language accepted by the
machine. Use state elimination.
Then, the corresponding regular expression is b*a(b + a+b)*. Note aa* = a+.
16. Determine if the following statement is always, sometimes or never true. If your
answer is always or never, justify the answer. If the answer is sometimes, give
two examples—one for which the statement is true and one for which it is false.
2S = { Ǿ,{a},{b},{c},{a,b},{a,c},{b,c},{a,b,c}}.
L+ denotes Positive closure --- Language does not include empty words.
19. Construct a regular expression for the language which accepts all strings with at least
2+2–√=pq2+2=pq,
Therefore
2–√=p−2qq2=p−2qq
and
2q2=(p−2q)22q2=(p−2q)2.
Then the right-hand side is even, and hence p−2qp−2q is even. Therefore, pp is even, and can be
written as p=2kp=2k. Therefore the previous equation is written
2q2=(2k−2q)22q2=(2k−2q)2
or
2q2=4(k−q)22q2=4(k−q)2
or
q2=2(k−q)2q2=2(k−q)2.
Now we see that qq is even, but we have assumed that pp and qq are coprime. This is
impossible, and the incorrect step were to assume that 2+2–√2+2 is rational. Hence, it
must be irrational.
21.
22.
23.
24.
25.
(sign) ::= + | –
(digit) ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
Big Questions
5. Prove by using Pumping lemma that the following language is not regular.