FL 2020 21 Apr
FL 2020 21 Apr
FL 2020 21 Apr
Problem 1 [11 points] Decide which of the following statements is TRUE and which is FALSE.
Answering just TRUE or FALSE does not give marks, you MUST give a brief explanation of your
answer to receive marks.
(a) Construct the Regular Expression that generates the language over the alphabet Σ = {x, y, z}
constituted by all strings in which each x is immediately preceded or immediately followed (or both)
by y. E.g., zzyxxyyzzyxyzxy ∈ L(A), while zzyxxz 6∈ L(A), zzyxxxy 6∈ L(A). [3 Pt.]
(b) Construct the Deterministic Finite Automaton (DFA) over the alphabet Σ = {a, b, c} which
accepts the language of all words that begin with a sequence of one or more a’s and end with the
letter b. For example, the DFA must accept abacb and aaacbbab, but not cab. [3 Pt.]
(c) Construct a Context Free Grammar for the language L over the alphabet {a, b, c, d} such that
L = {an bm cm d2n | n ≥ 0 and m > 0}. E.g., bc ∈ L, bbcc ∈ L, aabbccdddd ∈ L, while abc 6∈ L,
add ∈
/ L, abcd ∈
/ L. [4 Pt.]
Problem 3 [4 points] From NFA to DFA. Consider the following NFA AN over {a, b}:
a a
(a) Construct a DFA AD such that L(AD ) =
b b L(AN ). Show only the transition table. The
b q3
(ii)
a
b algorithm you have followed to construct AD
q0 q1 q2
b should become evident in your construction.
(b) Show all possible sequences of states of the
Exercise 3.15. (o65)
NFA, AN , that are traversed when the input is
Convert the following NFA to a DFA.
the string abaa, and say whether the string is
a,b
accepted.
a,b
a a a
start 0 1 2 3
Problem 4 [4 points] From -NFA to NFA. Consider the following ε-NFA A over {0, 1}:
(a) Show the -closure of each state.
1,ε 0 1
ε 0,1 (b) Construct an NFA, AN , such that L(AN ) = L(A ). Show
A B
C only the transition table. The algorithm you have followed
0 0, ε
to construct AN should become evident in your construc-
0,ε tion.
D
1
Problem 5 [4 points] Given the following context free grammar G = {S, A, B, C}, {a, b}, P, S , where
P consists of the following productions:
S −→ B | BaBb | AbB B −→ Bb | AC |
A −→ Ab | AC C −→ AC | CB | Ba
Apply the sequence of steps that are necessary to simplify the context free grammar and convert it into
a Clean-up Form.