Nonregularity Proofs cs 466Prasad L 10 PLemma 1

  • Slides: 16
Download presentation
Nonregularity Proofs cs 466(Prasad) L 10 PLemma 1

Nonregularity Proofs cs 466(Prasad) L 10 PLemma 1

Regular Languages: Grand Unification (Parallel Simulation) (Rabin and Scott’s work) (Collapsing graphs; Structural Induction)

Regular Languages: Grand Unification (Parallel Simulation) (Rabin and Scott’s work) (Collapsing graphs; Structural Induction) (S. Kleene’s work) (Construction) (Solving linear equations) cs 466(Prasad) L 10 PLemma 2

Role of various representations for Regular Languages • Closure under complementation. (DFAs) • Closure

Role of various representations for Regular Languages • Closure under complementation. (DFAs) • Closure under union, concatenation, and Kleene star. (NFA-ls, Regular expression. ) • Consequence: Closure under intersection by De Morgan’s Laws. • Relationship to context-free languages. (Regular Grammars. ) • Ease of specification. (Regular expression. ) • Building tokenizers/lexical analyzers. (DFAs) cs 466(Prasad) L 10 PLemma 3

Consider pairs of strings: If L were regular, then there exists a DFA M

Consider pairs of strings: If L were regular, then there exists a DFA M accepting L with the following property: cs 466(Prasad) L 10 PLemma 4

CLAIM: JUSTIFICATION: Otherwise, from the definition of DFA, which contradicts the earlier conclusion. In

CLAIM: JUSTIFICATION: Otherwise, from the definition of DFA, which contradicts the earlier conclusion. In order to satisfy the machine M must have a unique state for every i. Thus, M must have infinite number of states, if L is regular. This violates the definition of DFA. So, L must be non-regular. cs 466(Prasad) L 10 PLemma 5

Using Closure Properties • Regular languages are closed under set-intersection. L 1=bit strings with

Using Closure Properties • Regular languages are closed under set-intersection. L 1=bit strings with even parity L 2=bit strings with number of 1’s divisible by 3 L=bit strings with number of 1’s a multiple of 6 • Note that regularity is a property of a collection, and not a property of an individual string in the collection. cs 466(Prasad) L 10 PLemma 6

 • If R is a regular language and C is context-free, then may

• If R is a regular language and C is context-free, then may not be regular. • Proof: • Show that is not regular. • Proof: If L were regular, ought to be regular. However, is known to be non-regular. Hence, L cannot be regular. cs 466(Prasad) L 10 PLemma 7

DIGRESSION • If R is a regular language and C is context-free, then can

DIGRESSION • If R is a regular language and C is context-free, then can be regular. • Proof: • • • L = {/, ab, ba, aabb, abab, abba, baba, bbaa, …} a*b* = {/, a, b, aa, ab, bb, …, aabb, …} C = {/, ab, aabb, …} intersect(a*b*, C) =intersect(L, a*b*) = C union(a*b*, C) = a*b* ; union(L, C) = L cs 466(Prasad) L 10 PLemma 8

Prelude to Pumping Lemma • Is 46551 divisible by 46? • Is 46554 divisible

Prelude to Pumping Lemma • Is 46551 divisible by 46? • Is 46554 divisible by 46? • Is 46552 divisible by 46? Necessary vs sufficient condition cs 466(Prasad) L 10 PLemma 9

Pumping Lemma for Regular Languages • It is a necessary condition. – Every regular

Pumping Lemma for Regular Languages • It is a necessary condition. – Every regular language satisfies it. – If a language violates it, it is not regular. • RL => PL not PL => not RL • It is not a sufficient condition. – Not every non-regular language violates it. • not RL =>? PL or not PL (no conclusion) cs 466(Prasad) L 10 PLemma 10

Basic Idea: b q 0 a q 1 b a q 2 cs 466(Prasad)

Basic Idea: b q 0 a q 1 b a q 2 cs 466(Prasad) a a, b L 10 PLemma b q 3 11

Note, So, cs 466(Prasad) L 10 PLemma 12

Note, So, cs 466(Prasad) L 10 PLemma 12

Fundamental Observation • Given a “sufficiently” long string, the states of a DFA must

Fundamental Observation • Given a “sufficiently” long string, the states of a DFA must repeat in an accepting computation. These cycles can then be used to predict (generate) infinitely many other strings in (of) the language. Pigeon-Hole Principle cs 466(Prasad) L 10 PLemma 13

Pumping Lemma (Theorem 7. 3. 3) • Let L be a regular language that

Pumping Lemma (Theorem 7. 3. 3) • Let L be a regular language that is accepted by a DFA M with k states. Let z be any string in L with. Then z can be decomposed as uvw with cs 466(Prasad) L 10 PLemma 14

For all sufficiently long strings (z) These exists non-null prefix (uv) and substring (v)

For all sufficiently long strings (z) These exists non-null prefix (uv) and substring (v) For all repetitions of the substring (v), we get strings in the language. cs 466(Prasad) L 10 PLemma 15

Proving non-regularity • If there exists an arbitrarily long string s L, and for

Proving non-regularity • If there exists an arbitrarily long string s L, and for each decomposition s = uvw, there exists an i such that , then L is non-regular. Negation of the necessary condition: cs 466(Prasad) L 10 PLemma 16