Universit¨at Duisburg-Essen SS 2012
Ingenieurwissenschaften / Informatik July 9, 2012
Professor: Dr. Sander Bruggink Exercise sheet 11
Teaching assistent: Jan St¨uckrath Deadline: 16 July 2012
Automaten und formale Sprachen
Exercise 32 To the complement of context free languages (6 points) The topic of this exercise is the fact that context free languages are not closed under comple- mentation. For this, let the following language be given:
L={w∈ {a, b, c}∗ |#a(w)≤#b(w) or #b(w)≤#c(w)}
(a) Give a context free grammar which generates the sublanguage L0 = {w ∈ {a, b, c}∗ |
#a(w) ≤ #b(w)} of L and explain how – based on this grammar – a grammar can be
constructed which generates L. (2 p)
(b) Give a regular languageL00, such that
L∩L00={anbmc` |n, m, `∈N∧n > m > `}
(2 p)
(Note: Remember that L= Σ∗\L is the complement of L with respect to Σ∗.)
(c) Explain why the complement ofLis not context free. For this purpose use the fact, that {anbmc`|n, m, `∈N∧n > m > `}is not context free. (2 p)
Exercise 33 Questions about closure properties of context free languages (8 points) Decide, if the following statements hold for arbitrary languages L1, L2 ⊆ Σ∗. Give either a proof or a counter example in each case. Answers without any motivation achieve no points.
(a) IfL2 is regular and L1∪L2 is context free, thenL1 is context free. (2 p)
(b) IfL1 is context free and L2 ⊆L1, then L2 is also context free. (2 p)
(c) IfL1 ∩L2 is context free, then L1 is context free or L2 is context free. (2 p)
(d) IfL1 is regular andL2 is deterministic context free, then L1\L2 is deterministic context
free. (2 p)
Exercise 34 Classification of languages (6 points)
Let the following language be given:
L={anbk|k ∈N,there exists c∈N with 0≤c≤2 andn =k·c}
(a) Give a grammar, such that L is generated by this grammar and the Chomsky type is as
high as possible. (3 p)
(b) Show thatL is not regular. (3 p)
1
The solutions to this exercise sheet must be submitted before Monday, 16 July 2012 at 16:00. Put your solutions in the letterbox labeled Automaten und formale Sprachen adja- cent to room lf, or hand them in through the online moodle-platform. If you hand in online, please upload your solutions as a single pdf-file. Your name, student number, group number and the lecture name (“Automaten und formale Sprachen”) must be clearly written on your solutions.
2