Document 13141451

advertisement
Examination
Formal Languages and Automata Theory
TDDA 89
(Formella Sprak oh Automatateori)
2000{01{22, 09.00 { 13.00
1. No help materials are allowed.
2. You may answer in Swedish or English.
3. Total number of redits is 33. Limits:
C
D
4.
Jour
G: 14 p, VG: 24 p.
3: 14 p, 4: 21 p, 5: 27 p.
(ontat person): Johan Lubke, tel. 2168.
GOOD LUCK !
1
Make sure that you justify your answers! Unexplained answers will be
granted 0 points. (For example, assume that you are writing a grammar for
a given language. Then you should also explain that the grammar indeed
generates the language).
1.
(2p)
Consider the following NFA .
a
4
a
3
ε
1
ε
0
a
a
a
ε
5
2
6
a
a
8
7
Using a standard method, onstrut a DFA dening the same language.
2.
Construt a minimal DFA dening the same language L as the
following DFA.
(2+2p)
b
1
a
a, b
2
3
a
b
a
b
a
7
b
4
b
a, b
5
6
a
Consider the equivalene relation RL on (thus RL ) dened
by: xRL y if and only if for all z 2 , xz 2 L i yz 2 L. What is the
index (the number of equivalene lasses) of RL ? Desribe preisely
at least one of the equivalene lasses of RL (by giving an automaton,
regular expression, et, or in words).
3.
(3p)
Provide regular expressions for the following languages
(a) All strings over f0; 1g not beginning with 01.
(b) All strings over fa; b; g with an even number of 's.
() All strings over fa; bg not ontaining ba as a substring.
2
4.
(1p) Consider the languages denoted by the following regular expressions. Give a string that belongs to one of the languages and does not
belong to the other.
(ab + a) a(b a )
5.
a(ba + a) (b a)
For eah of the following languages answer whether it is regular,
ontext-free but not regular, or not ontext-free. (You get +1 p. for
eah orret answer and -1 p. for eah inorret one, but at least 0 p.
total. Here you do not need to justify your answers.) Assume that
i; j; k; l 0.
(6+3p)
(a) The set of those strings over fa; b; g that are not aepted by
the FA from the problem 2 above and do not ontain aaa as a
substring.
(b) f ai bj j 2i j 3i g
() f ai bj ak bl j i 6= k and j = l g
(d) The image of the latter language under the homomorphism h given
by h(a) = 01; h(b) = 01.
(e) f ai bj ak bl j i 6= k or j = l g
(f) f ai bj ak bl j i < j < k < l < 9 g
Choose one from the languages above that you found non regular or
non ontext-free, and prove this fat.
6.
Any PDA M = (Q; ; ; Æ; q0 ; Z0 ; F ) denes two languages.
is the language aepted by nal state and N (M ) is the language
aepted by empty stak. Explain these two notions of aeptane.
Does there exist a language L whih is aepted by nal state (by some
PDA) but not aepted by empty stak (by any PDA)?
What is the answer to the same question if only deterministi PDA's
are onsidered?
7.
(6p) One of the following grammars is LR(0), one is not. Find out
whih. Is the other one LR(1)? Justify your answers.
(1+1+2p)
L(M )
G1
:
S
A
! bA
! j Ad
G2
:
S
A
! bA
! b j Ad
(S is the start symbol, b; and d are terminal symbols). For the grammar that is LR(0) show how the orresponding LR(0) parser aepts
3
or rejets string bbd. For eah step show the stak, the unread input
and whether the operation is \shift" or \redue".
If the non LR(0) grammar is LR(1) then show how the orresponding
LR(1) parser rejets string bddd; if it is not LR(1) then show how
this string is rejeted by the LR(0) parser for the LR(0) grammar.
8.
(2p)
Explain the notions of a reursive language and a reursively
enumerable language.
9.
(2p)
Explain what it means that a problem is deidable. Follow the
questions below.
What is the language of a problem? What is the requirement on the
language of a problem in order for the problem to be deidable?
Give an example of a problem known to be undeidable. Explain. (You
may skip a justiation of its undeidability). Desribe the language
of the problem.
4
Download