Problem Set 4 Solution

$29.99 $18.99

Problem 1. (10 points) Convert the following CFG into a PDA using the conversion discussed in class (Lemma 2.21 in the textbook): 𝐸𝐸 β†’ 𝐸𝐸 + 𝑇𝑇 | 𝑇𝑇 𝑇𝑇 β†’ 𝑇𝑇 Γ— 𝐹𝐹 | 𝐹𝐹 𝐹𝐹 β†’ (𝐸𝐸) | π‘Žπ‘Ž Problem 2. (10 points) For each of the following languages, either give a CFG…

You’ll get a: .Β zip file solution

 

Β 
Categorys:
Tags:

Description

Rate this product

Problem 1. (10 points) Convert the following CFG into a PDA using the conversion discussed in
class (Lemma 2.21 in the textbook):
𝐸𝐸 β†’ 𝐸𝐸 + 𝑇𝑇 | 𝑇𝑇
𝑇𝑇 β†’ 𝑇𝑇 Γ— 𝐹𝐹 | 𝐹𝐹
𝐹𝐹 β†’ (𝐸𝐸) | π‘Žπ‘Ž
Problem 2. (10 points) For each of the following languages, either give a CFG generating it, or a
high-level description of a PDA that recognizes it:
a) The complement of {π‘Žπ‘Žπ‘›π‘›π‘π‘π‘›π‘› | 𝑛𝑛 β‰₯ 0}
b) {π‘₯π‘₯1#π‘₯π‘₯2# β‹― π‘₯π‘₯π‘˜π‘˜ |π‘˜π‘˜ β‰₯ 1, π‘’π‘’π‘’π‘’π‘’π‘’β„Ž π‘₯π‘₯𝑖𝑖 ∈ {π‘Žπ‘Ž, 𝑏𝑏}βˆ— π‘Žπ‘Žπ‘Žπ‘Žπ‘Žπ‘Ž 𝑓𝑓𝑓𝑓𝑓𝑓 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 𝑖𝑖,𝑗𝑗 π‘₯π‘₯𝑖𝑖 = π‘₯π‘₯𝑗𝑗
𝑅𝑅}
Problem 3. (10 points) Let 𝐢𝐢 be a context-free language, and 𝑅𝑅 be a regular language. Show
that the language 𝐢𝐢 ∩ 𝑅𝑅 is context free. Start with a PDA (𝑄𝑄, Ξ£, Ξ“, 𝛿𝛿, π‘žπ‘žπ‘ π‘ π‘ π‘ π‘ π‘ π‘ π‘ π‘ π‘ , 𝐹𝐹) for 𝐢𝐢 and a DFA
�𝑄𝑄′
, Ξ£β€²
, 𝛿𝛿′
, π‘žπ‘žβ€²
𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠, 𝐹𝐹′
οΏ½ for 𝑅𝑅, then describe a PDA for 𝐢𝐢 ∩ 𝑅𝑅. Your description may be informal
and high-level (i.e. you don’t need to define detailed transitions), but must be precise.
Problem 4. (10points) Use the result of Problem 3 to prove that the language
𝐿𝐿 = {𝑀𝑀 ∈ {π‘Žπ‘Ž, 𝑏𝑏, 𝑐𝑐}βˆ—: 𝑀𝑀 has equal numbers of π‘Žπ‘Žβ€²
𝑠𝑠, 𝑏𝑏′
𝑠𝑠, and 𝑐𝑐′
𝑠𝑠} is not context free.
You may assume that the language {π‘Žπ‘Žπ‘›π‘›π‘π‘π‘›π‘›π‘π‘π‘›π‘›: 𝑛𝑛 β‰₯ 0} is not context free.
(Hint: design a regular expression 𝑅𝑅 such that 𝐿𝐿 ∩ 𝑅𝑅 is not context free.)