220 likes | 292 Views
Nonregularity Proofs. Regular Languages: Grand Unification. (Parallel Simulation) (Rabin and Scott’s work). (Collapsing graphs; Structural Induction) (S. Kleene’s work). (Construction) (Solving linear equations). Role of various representations for Regular Languages.
E N D
Nonregularity Proofs Pumping Lemma
Regular Languages: Grand Unification (Parallel Simulation) (Rabin and Scott’s work) (Collapsing graphs; Structural Induction) (S. Kleene’s work) (Construction) (Solving linear equations) Pumping Lemma
Role of various representations for Regular Languages • Closure under complemention. (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) Pumping Lemma
Consider pairs of strings: IfL were regular,then there exists a DFA M accepting L with the following property: Pumping Lemma
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. Pumping Lemma
Using Closure Properties • Regular languages are closed under set-intersection. • Note that regularity is a property of a collection, and not a property of an individual string in the collection. L1=bit strings with even parity L2=bit strings with number of 1’s divisible by 3 L=bit strings with number of 1’s a multiple of 6 Pumping Lemma
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. Pumping Lemma
Prelude to Pumping Lemma • Is 46551 divisible by 46? • Is 46554 divisible by 46? • Is 46552 divisible by 46? Necessary vs sufficient condition Pumping Lemma
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) Pumping Lemma
Basic Idea: b a q0 a q1 b b a q2 q3 a,b Pumping Lemma
Note, So, Pumping Lemma
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 Pumping Lemma
Pumping Lemma • 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 Pumping Lemma
For all sufficiently long strings (z) There exists non-null prefix (uv) and substring (v) For all repetitions of the substring (v), we get strings in the language. Pumping Lemma
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: Pumping Lemma
Examples Applying Pumping Lemma Pumping Lemma
Proof by contradiction: • Let be accepted by a k-state DFA. • Choose • For all prefixes of length • show there exists such that • i.e., Pumping Lemma
Choose (For this specific problem happens to be independent of j, but that need not always be the case.) • is non-regular because it violates the necessary condition. Pumping Lemma
Proof : (For this example, choice of initial string is crucial.) • For this choice of s, the pumping lemma cannot generate a contradiction! • However, let instead. Pumping Lemma
For • Thus, by pumping the substring containing a’s 0 times (effectively deleting it), the number of a’s can be made smaller than the number of b’s. • So, by pumping lemma, L is non-regular. Pumping Lemma
Proof by contradiction: • If is regular, then so is , the complement of • But which is known to be non-regular. • So, cannot be regular. Pumping Lemma
Summary: Proof Techniques • Counter Examples • Constructions/Simulations • Induction Proofs • Impossibility Proofs • Proofs by Contradiction • Reduction Proofs : Closure Properties Pumping Lemma