Sunteți pe pagina 1din 2

CS310 2020

Exercise problem set 6

March 8, 2020

1. For the following languages give context-free grammars to accept them.


You must write a 2-3 line justification for each. Also, for each langauge,
give an informal and formal descriptions of a PDA accepting the language.
Since for PDA acceptance by empty stack and final state are equivalent,
you can use either definition.

(a) L1 = {w ∈ {0, 1}∗ | w contains at least four 1’s }


(b) L2 = {w ∈ {0, 1}∗ | w has odd length and middle letter is 0}
(c) L3 = {w ∈ {0, 1}∗ | number of 0’s in w is equal to number of 1’s in
w}.
(d) L4 = {0n 1m 0n | m, n ≥ 1}.

2. Consider L5 = {ai bj ck | i, j, k ≥ 0 and i = j or i = k}.


(a) Construct a PDA to accept L5 .
(b) Give a context-free grammar (CFG) that accepts L5 .
(c) Prove or disprove: L5 cannot be accepted by any DPDA.

3. (From large stack alphabet to size 2) Show that if L is accepted by a PDA


P , then there exists another PDA P 0 whose stack alphabet Γ0 has only
two symbols, i.e., |Γ0 | = 2 which also accepts L. Can you compare the
difference between sizes of P and P 0 ?
4. (From many states to one state) Consider L6 = {0n 10n | n ≥ 1}.

(a) Give a PDA with three states accepting L6 .


(b) Can you give a PDA with just one state (but maybe a larger stack
alphabet) which accepts L6 ?
(c) Generalize this argument to show why for ANY PDA P accepting
L, we can construct another PDA P 0 which has only one state which
accepts L.
5. (Acceptance by empty stack in PDA) Prove formally that PDA with accep-
tance by empty stack are expressively equivalent to PDA with acceptance
by final state. Recall that expressively equivalent means that they accept
the same set of languages. (The idea of the proof was given in class, this
exercise is to ask you to write the details formally!).

6. (Acceptance by empty stack in DPDA). A language L is said to have the


prefix property if there are no two different strings x, y ∈ L such that x is
a prefix of y.
(a) Show that {0n 1n | n ≥ 0} has the prefix property.
(b) Give an example of a regular language that does not have the prefix
proeprty.
(c) Prove that if L is accepted by a DPDA with empty stack acceptance,
then L must satisfy the prefix property.
(d) Prove the following characterization: A language L accepted by some
DPDA P with empty-stack acceptance iff (L satisfies the prefix prop-
erty AND it is accepted by some DPDA P 0 with final state accep-
tance).
As a result, we obtain that unlike for PDA, languages accepted by DPDA
with empty stack acceptance are not equivalent to languages accepted by
DPDA with final state acceptance. Further, they do not even contain all
regular languages.

S-ar putea să vă placă și