You are on page 1of 3

Fall 2023: Theory of Automata Assignment 3 BCS-5J

Design a Push-down Automata (PDA) for the following language?

𝐿𝐿 = {𝑐𝑐 𝑧𝑧 𝑎𝑎𝑖𝑖 𝑏𝑏 𝑗𝑗 𝑐𝑐 𝑧𝑧 , where 𝑖𝑖, 𝑗𝑗, 𝑧𝑧 ≥ 0 and 𝑖𝑖 ≠ 𝑗𝑗}

Also provide a CFG for the language.

Note: 𝑖𝑖 and 𝑗𝑗 cannot be 0 at the same time but they can be 0 alternatively.

Show using the pumping lemma that the language

𝐿𝐿 = {𝑥𝑥 ∈ {𝑎𝑎, 𝑏𝑏}∗ | 𝑛𝑛𝑎𝑎 (𝑥𝑥) < 𝑛𝑛𝑏𝑏 (𝑥𝑥) < 2𝑛𝑛𝑎𝑎 (𝑥𝑥)}

is not regular.

Here, 𝑛𝑛𝑎𝑎 (𝑥𝑥) denotes the number of a’s in x and 𝑛𝑛𝑏𝑏 (𝑥𝑥) denotes the number of
b’s in x.

In both parts below, the productions in a CFG 𝐺𝐺 are given. In each part, find a
string 𝑥𝑥 ∈ {𝑎𝑎, 𝑏𝑏}∗ with 𝑛𝑛𝑎𝑎 (𝑥𝑥) = 𝑛𝑛𝑏𝑏 (𝑥𝑥) that is not in 𝐿𝐿(𝐺𝐺).

a. 𝑆𝑆 → 𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 | 𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 | Λ

b. 𝑆𝑆 → 𝑎𝑎𝑎𝑎𝑎𝑎 | 𝑏𝑏𝑏𝑏𝑏𝑏 | 𝑎𝑎𝑎𝑎𝑎𝑎 | 𝑏𝑏𝑏𝑏𝑏𝑏 | 𝑆𝑆𝑆𝑆𝑆𝑆 | 𝑆𝑆𝑆𝑆𝑆𝑆 | Λ

Find context-free grammars generating each of the languages below.

a. {𝑎𝑎𝑖𝑖 𝑏𝑏 𝑗𝑗 | 𝑖𝑖 ≤ 𝑗𝑗 ≤ 2𝑖𝑖}

b. �𝑎𝑎𝑖𝑖 𝑏𝑏 𝑗𝑗 𝑐𝑐 𝑘𝑘 � 𝑖𝑖 ≠ 𝑗𝑗 + 𝑘𝑘}

Consider the context-free grammar with productions

𝑆𝑆 → 𝐴𝐴𝐴𝐴

𝐴𝐴 → 𝑎𝑎𝑎𝑎 | Λ

𝐵𝐵 → 𝑎𝑎𝑎𝑎 | 𝑏𝑏𝑏𝑏 | Λ

Due Date: Tuesday, Oct. 24 or before


Note: You may work in groups of Two.
Fall 2023: Theory of Automata Assignment 3 BCS-5J

Every derivation of a string in this grammar must begin with the production
𝑆𝑆 → 𝐴𝐴𝐴𝐴. Clearly, any string derivable from 𝐴𝐴 has only one derivation from 𝐴𝐴,
and likewise for 𝐵𝐵. Therefore, the grammar is unambiguous. True or false? Why?

Give transition tables for PDAs accepting each of the following languages.

a. The language of all the odd-length strings over {𝑎𝑎, 𝑏𝑏} with middle
symbol 𝑎𝑎.

b. {𝑎𝑎𝑛𝑛 𝑥𝑥 | 𝑛𝑛 ≥ 0, 𝑥𝑥 ∈ {𝑎𝑎, 𝑏𝑏}∗ and |𝑥𝑥| ≤ 𝑛𝑛}.

c. {𝑎𝑎𝑖𝑖 𝑏𝑏 𝑗𝑗 𝑐𝑐 𝑘𝑘 | 𝑖𝑖, 𝑗𝑗, 𝑘𝑘 ≥ 0 and 𝑗𝑗 = 𝑖𝑖 or 𝑗𝑗 = 𝑘𝑘}.

Give transition diagrams for PDAs accepting each of the following languages.

a. {𝑥𝑥 ∈ {𝑎𝑎, 𝑏𝑏}∗ |𝑛𝑛𝑎𝑎 (𝑥𝑥) < 𝑛𝑛𝑏𝑏 (𝑥𝑥)}

b. {𝑥𝑥 ∈ {𝑎𝑎, 𝑏𝑏}∗ |𝑛𝑛𝑎𝑎 (𝑥𝑥) ≠ 𝑛𝑛𝑏𝑏 (𝑥𝑥)}

c. {𝑥𝑥 ∈ {𝑎𝑎, 𝑏𝑏}∗ |𝑛𝑛𝑎𝑎 (𝑥𝑥) = 2𝑛𝑛𝑏𝑏 (𝑥𝑥)}

d. {𝑎𝑎𝑛𝑛 𝑏𝑏 𝑛𝑛+𝑚𝑚 𝑎𝑎𝑚𝑚 | 𝑛𝑛, 𝑚𝑚 ≥ 0}

e. {𝑎𝑎𝑛𝑛 𝑏𝑏 𝑚𝑚 𝑎𝑎𝑝𝑝 | 𝑛𝑛 = 2𝑚𝑚 + 𝑝𝑝}

In all the three cases below, a transition table is given for a PDA with initial state
𝑞𝑞0 and accepting state 𝑞𝑞2 for first two PDAs and 𝑞𝑞3 for the third PDA. Describe
in each case the language that is accepted.

Due Date: Tuesday, Oct. 24 or before


Note: You may work in groups of Two.
Fall 2023: Theory of Automata Assignment 3 BCS-5J

Due Date: Tuesday, Oct. 24 or before


Note: You may work in groups of Two.

You might also like