110 likes | 226 Views
Non-Regular Languages. All finite languages are regular. { a } { abaabb , b , baabbbbb , bb } So, only infinite languages are interesting for this discussion. a 1. a 2. a m-1. a m. q 0. q 1. q m-1. q m. …. Lemma: Idea. Any DFA has finite number of states. Let n = |Q|.
E N D
Non-Regular Languages All finite languages are regular. {a} {abaabb,b,baabbbbb,bb} So, only infinite languages are interesting for this discussion.
a1 a2 am-1 am q0 q1 qm-1 qm … Lemma: Idea Any DFA has finite number of states. Let n = |Q|. Consider any accepted input x=a1…am, such that m > n. DFA follows a path of states q0…qm: This state numbering has nothing to do with state names in Q. May repeat states in this path.
… ak aj+1 a1 aj ak+1 am q0 qj=qk qm … … Idea Since |x| > n, path must contain at least one loop. Consider any one such loop. Break string & path: before, during, & after loop. In fact, must exist loop such that k<n. Given other inputs, could loop an arbitrary number of times. (a1…aj)(aj+1…ak)*(ak+1…am) also accepted.
Lemma: Summary If language L is regular, then for any xL that is longer than |Q|, there is a substring of x than can be “pumped” that provides other strings in L. Not claiming that pumping x gives all sufficiently long strings in L. For that, would need to look at all loops in all strings.
Lemma: Formal Statement If L is a regular language, then n such that n is lower bound of #states in DFA. if xL and |x|n, x is a sufficiently long string. strings u,v,w such that x=uvw, u,v,w are a way to split up x. |uv| n, Looping not necessary in 1st part. |v| 1, The piece we loop on isn’t e. uviw L, i0
Lemma: Usage How to use lemma to prove some L isn’t regular? Lemma describes a property of regular languages. Use proof by contradiction: If L doesn't have this property, it isn't regular.
Lemma: Usage Can view as game between you & adversary. Your goal is to prove L non-regular. • You choose/given L. • Adversary picks n. • You choose x. xL, |x|n. • Adversary picks u,v,w. x=uvw, |uv|n, |v|1. • You choose i such that uviw L. Each choice can depend on previous ones.
Lemma: Example 1 L1 = {0k1k | k0} x = 0n1n For whatever n is picked. x = uvw u & v contain only 0’s. Since |uv|n. Pick i=2. uv2w contains more 0’s than 1’s, since |v|1. uv2w L1.
Lemma: Lessons • Choice of x is important. • Different x’s may lead to different proofs, or none being possible. • RLs can “match up” parts of strings only in limited ways. • In particular, can’t do the unbounded counting needed in previous examples.
Lemma: Non-example L = {(01)i | i0} L is regular: L = (01)*. I.e., for any x, there is some split u,v,w that allows pumping.
Lemma: Limitations Lemma is of the form “If L regular, then a certain property holds.” Some non-RLs also have this property! Stronger versions of the lemma exist. • This version is usually sufficient. • This version is the most common.