100 likes | 126 Views
Learn about the Pumping Lemma to prove languages are not regular, identifying key properties of regular languages, implications for finite automata, formal definitions, practical application, and examples.
E N D
CS310 Pumping Lemma Sections:1.4 page 77 September 27, 2006
Quick Review • DFA to Regular Expression • DFA -> GNFA -> Reduce to 2 state GNFA • Regular Expression R4 (R1(R2)*R3) U R4 R3 R1 Rip this out! R2
Non-Regular Languages • Languages that cannot be represented by a finite automaton B = { 0n1n | n >= 0 } What makes this hard (impossible) for an NFA to represent? ►hint: What does the F stand for in NFA? How do we prove a language is not regular? Intuition may be wrong; which is not regular? C = { w | w has an equal number of 0s and 1s} D = { w | w has an equal number of occurrences of 01 and 10 as substrings }
Pumping Lemma • We can use the Pumping Lemma to show that a language is not regular • All regular languages have a particular property • For strings over a certain length (the pumping length, p) there must be some repetition within the string • F stands for Finite number of states • If a language does not have this property: not regular • Not represented by a FA
Pumping Lemma (Informal) • All regular languages are represented by an FA • The result of pushing a string of length n through a FA is a sequence of (n+1) states • If (n+1) > number of states in FA, there must be some repetition: must visit the same state twice • p = number of states in FA Pumping: The length of the string could be ‘pumped’ up by repeating the cycle, and the string would still be accepted. repetition
Pumping Lemma (Formally) y z x • DFA: M= ( Q, ∑, δ , q0, F) If |Q| = p and s є L(M) and |s| >= p then there exists at least one state that was visited twice within the first p input symbols (p input symbols takes you through p+1 states) s = xyz
Pumping Lemma (Formally) y z x • If A is a regular language, then there is a number p where, if s is any string in A of length at least p, then s may be divided into three pieces, s = xyz, satisfying the following conditions: • i >= 0, xyiz є L(M) • |y| > 0 • |xy| <= p s = xyz (x, z may be ε)
Pumping Lemma In Action • Find a string, s є L, |s| >= p, that cannot be pumped to show language L is not regular. • Proof by contradiction • Find a string that exhibits the “essence” of nonregularity • L = { w | w contains equal number of 0s and 1s } let s = 0p1p where p is the pumping length s є L, |s| >= p, so we can write s = xyz • What does this imply about y? • Is xy2z є L? • Is xy0z є L?
Pumping Lemma in Action • L = { w | w contains equal number of 0s and 1s } What if we chose the string (01)p? Can that be pumped? x = y = z =
Practice • L = { ww | w є {0, 1}* } What string should we chose? what does ww mean? Can that be pumped?