TDDD65 Homework 1 – 2015

advertisement
2015-09-22
Linköpings Tekniska Högskola
Institutionen för Datavetenskap
Christer Bäckström
TDDD65 Homework 1 – 2015
Deadline: Wednesday 2015-09-30 kl. 17
You can put the solutions in the plastic holder outside my room (B 3B:461C).
You must also be present at the session on Friday 2015-10-02 for oral presentations.
1. Give a regular expression for the language L over the alphabet {0, 1} generated by the
following grammar:
S → A|B
A → CC
B → DD
C → D1
D → 1E
E → 0E|
2. Give context-free grammars that generate the following two languages:
(a) Ladd = {0m 1n 0m+n | m, n ≥ 0}
(b) Lsub = {0m 1n 0m−n | m > n ≥ 0}
3. Use the pumping lemma to prove that the following two languages are not regular:
(a) Ladd (defined above)
(b) L> = {0m 1n | m > n ≥ 0}
4. Convert the following DFA to a regular expression using the GNFA method.
0
1
q0
q1
0
0
1
1
q2
5. Convert the following two NFAs to DFAs, using the standard construction. Answer with
both transition table and state diagram for each of the resulting DFAs.
a)
0
0
q0
q1
1
0, 1, 2
1
2
q3
0, 1, 2
q2
b)
q0
q1
q2
0
1
6. Use the pumping lemma for context-free languages to show that the following language L is
not context-free.
2
L = {0n 1n | n ≥ 0}
2
Download