100 likes | 410 Views
Non-Context-Free Languages. Have seen some examples of CFLs What are not context-free languages? More importantly, how can we show that a language is not context-free?. RL Pumping Lemma Idea Review. If an infinite language is regular, then must exist loop in DFA.
E N D
Non-Context-Free Languages Have seen some examples of CFLs What are not context-free languages? More importantly, how can we show that a language is not context-free?
RL Pumping Lemma Idea Review If an infinite language is regular, then must exist loop in DFA. Can repeat loop to generate more strings.
CF Pumping Lemma Idea If an infinite language is CF, then must exist some kind of loop.
Lemma: Summary If language L is CF, then for any xL that is longer than some nL, there are two substrings of x than can be “pumped” that provides other strings in L.
Lemma: Summary What are two significant differences from RL pumping lemma? ? ? Can pump two substrings instead of one. Have bound on length of middle of string instead of the beginning. Result: Using CFL PL is more difficult than using RL PL.
Lemma: Usage Can view as game between you & adversary. • You choose/given L. • Adversary picks n. • You choose z. zL, |z|n. • Adversary picks x=uvwxy, |vwx|n, |vx|1. • You choose i such that uviwxiy L. Each choice can depend on previous ones.
Lemma: Example 1 L1 = {0k1k2k | k0} z = 0n1n2n For whatever n is picked. z = uvwxy One possible complete case analysis: • vx consist of one distinct symbol (0’s, 1’s, or 2’s). • vx together consist of two distinct symbols. • vx together consist of all three distinct symbols.
Lemma: Example 1 Case 1 L1 = {0k1k2k | k0} z = 0n1n2n For whatever n is picked. z = uvwxy • vx consist of one distinct symbol (0’s, 1’s, or 2’s). Choose i = 2 (or any i1). uviwxiy L1, since it has more of this one symbol
Chomsky Normal Form One particular CFG restriction useful in theory. Productions’ form: • A a • A B C Assume, for now: eL(G).