50 likes | 199 Views
Homework 6. due 12/21. 1 Pumping lemma for CFL. 1.1 Show that the language L 1 = { xx {0,1}* | x {0,1}* } is not context free. Instances of L 1 include 0101, 110110 etc, but do not include 00110 and 0111.
E N D
Homework 6 due 12/21
1 Pumping lemma for CFL 1.1 Show that the language L1 = { xx {0,1}* | x {0,1}* } is not context free. Instances of L1 include 0101, 110110 etc, but do not include 00110 and 0111. 1.2 Show that the language L2 = { xy {0,1}* | x {0,1}* and y is the 1's complement of x.} is not context free. Instances of L3 include 0110, 110001 etc, but do not include 0101, 010 and 0111.
2. Context free grammar composition • Given two grammar : • G1: S bS | Ab A a | BA | SB B bA | bB • G2: T Tb | aTC C aC | bT 2.1 Find a CFG G3 such that L(G3) = L(G1) L(G2). 2.2 Find a CFG G4 such that L(G4) = { xy | x L(G1)*, y L(G2) }. • Notes • you can reuse production rules and symbols in G1 and G2. • You need not study the specific detail of G1 and G2, as studied in the lecture, there is a systematic method to compose both grammars directly from the general definition of two input CFGs.
3. CYK algorithm 3. Given the grammar G in Chomsky normal form • S AB ABB | a B AB | b | AA 3.1 Apply the CYK algorithm on the input string aabba to determine if it is in L(G) by completing the following table. 3.2 Is aabba a member of L(G) ? why ? 3.3 Is this grammar ambiguous ? why ?
4 Parse trees and derivations • Given the following grammar : • S AB | e A aB B Sb 4.1 Find a left-most derivation for the string aabbbb 4.2 Find a right-most derivation for the string aabbbb. 4.3 Find a parse tree for aabbbb.