Universit¨at Duisburg-Essen SS 2012 Ingenieurwissenschaften / Informatik April 26, 2012
Professor: Dr. Sander Bruggink Exercise sheet 2
Teaching assistent: Jan St¨uckrath Deadline: 30 April 2012
Automaten und formale Sprachen
Exercise 4 Grammar and Chomsky hierarchy (6 points) Let be Σ ={a, b}. Classify the following grammars with respect to the Chomsky hierarchy and specify the language, which is created by the grammar:
(a) LetG1 = ({S, X},Σ, P, S), where P is defined as follows:
S →aba|aXSa Xa→aX Xb→bb
(2 p)
(b) LetG2 = ({S, A, B, C, D, X, Y, Z},Σ, P, S), where P is defined as follows:
S →Ab|Xa |a C→Db Y →b|Zb
A→Ba D→a Z →b
B →Ca X →b |Y b
(2 p)
(c) LetG3 = ({S, A, B, C},Σ, P, S), where P is defined as follows:
S →aA|B |C B →aB |a
A→Sb C→Cb |b
(2 p)
Exercise 5 Word problem (6 points)
Check by means of the algorithm for the word problem, which was presented in the lecture, whether the following words are contained in the language of the particular grammar:
(a) LetG1 = ({S, T, U},{a, b}, P, S), where P is defined as follows:
S →ε |aT b U b →bb
aT →U b |aT U T U →aT |ab
Decide, whether the word aaabb is part of the language L(G1) or not. (3 p)
(b) LetG2 = ({S, A},{a, b}, P, S), where P is defined as follows:
S→ε|ab|abA|aAb|aAbA A→ab|abA|aAb|aAbA
Decide, whether the word abbbba is part of the language L(G2) or not. (3 p)
1
Exercise 6 Finite automata (8 points) Let Σ = {a, b, c}. Give a deterministic finite automaton for each of the following languages.
The DFA must accept exactly the given language:
(a) L1 ={w∈Σ∗ |w begins with ccc} (2 p)
(b) L2 ={w∈Σ∗ |w contains at most two a’s} (2 p)
(c) L3 ={(caab)m |m∈N0} (2 p)
(d) L4 ={ca, aca, caca} (2 p)
The solutions to this exercise sheet must be submitted before Monday, 30 April 2012 at 16:00. Put your solutions in the letterbox labeled Automaten und formale Sprachen adjacent to room lf, or hand them in through the online moodle-platform. Your name, student number, group number and the lecture name (“Automaten und formale Sprachen”) must be clearly written on your solutions.
2