ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Theory of Automata
    DC-222
    Progress0 / 25 topics
    Topics
    1. Finite State Models2. Language definitions preliminaries3. Regular expressions/Regular languages4. Finite automata (FAs)5. Transition graphs (TGs)6. NFAs7. Kleene's theorem8. Transducers (automata with output)9. Pumping lemma and non-regular language10. Grammars and PDA11. CFGs12. Derivations, derivation trees and ambiguity13. Simplifying CFLs14. Normal form grammars and parsing15. Decidability16. Context sensitive languages17. Grammars and linear bounded automata (LBA)18. Chomsky's hierarchy of grammars19. Turing Machines Theory20. Turing machines21. Post machine22. Variations on TM23. TM encoding24. Universal Turing Machine25. Defining Computers by TMs
    DC-222›Pumping lemma and non-regular language
    Theory of AutomataTopic 9 of 25

    Pumping lemma and non-regular language

    11 minread
    1,786words
    Intermediatelevel

    Pumping Lemma and Non-Regular Languages

    The Pumping Lemma is a fundamental tool in the theory of formal languages, particularly in proving that certain languages are non-regular. It provides a necessary property that all regular languages must satisfy. The Pumping Lemma for regular languages is often used to demonstrate that a given language is not regular by showing that it fails to satisfy this property.

    Pumping Lemma for Regular Languages

    The Pumping Lemma states that for any regular language LLL, there exists a constant ppp (called the pumping length) such that any string sss in LLL that has a length greater than or equal to ppp can be split into three parts, s=xyzs = xyzs=xyz, satisfying the following conditions:

    1. Length of y: ∣y∣>0|y| > 0∣y∣>0, meaning yyy is non-empty.
    2. Length of x and y: ∣xy∣≤p|xy| \leq p∣xy∣≤p, meaning the length of the combined string xyxyxy is at most ppp, which ensures that xxx and yyy are within the first ppp characters of sss.
    3. Pumping Condition: For all i≥0i \geq 0i≥0, the string xyizxy^i zxyiz is also in the language LLL. This means that repeating (pumping) the portion yyy any number of times (including zero) results in a string that still belongs to the language LLL.

    In other words, if LLL is a regular language, for any sufficiently long string s∈Ls \in Ls∈L, we can decompose sss into three parts xxx, yyy, and zzz such that the middle part yyy can be "pumped" (repeated any number of times) and the resulting strings will still belong to the language.

    Pumping Lemma Formal Statement

    Let LLL be a regular language. Then there exists a constant ppp (the pumping length) such that for any string s∈Ls \in Ls∈L with ∣s∣≥p|s| \geq p∣s∣≥p, we can write sss as:

    s=xyzs = xyzs=xyz

    where:

    • ∣xy∣≤p|xy| \leq p∣xy∣≤p,
    • ∣y∣>0|y| > 0∣y∣>0,
    • For all i≥0i \geq 0i≥0, xyiz∈Lxy^i z \in Lxyiz∈L.

    Using the Pumping Lemma to Prove a Language is Non-Regular

    To prove that a language LLL is non-regular, we can use the pumping lemma to derive a contradiction. Here's how the process works:

    1. Assume that LLL is regular.
    2. By the pumping lemma, there exists a pumping length ppp for LLL.
    3. Choose a string s∈Ls \in Ls∈L such that ∣s∣≥p|s| \geq p∣s∣≥p.
    4. Decompose sss into three parts s=xyzs = xyzs=xyz, where:
      • ∣xy∣≤p|xy| \leq p∣xy∣≤p,
      • ∣y∣>0|y| > 0∣y∣>0,
      • For all i≥0i \geq 0i≥0, xyiz∈Lxy^i z \in Lxyiz∈L.
    5. Analyze what happens when the string is pumped, particularly for different values of iii. If for any iii, the resulting string xyizxy^i zxyiz does not belong to LLL, then we have a contradiction.
    6. Conclusion: Since we reached a contradiction, our original assumption that LLL is regular must be false. Therefore, LLL is non-regular.

    Example: Using the Pumping Lemma to Prove a Language is Non-Regular

    Consider the language L={anbn∣n≥0}L = \{ a^n b^n | n \geq 0 \}L={anbn∣n≥0}, which consists of strings of the form anbna^n b^nanbn where the number of aaa's is equal to the number of bbb's.

    We want to prove that LLL is non-regular using the pumping lemma.

    Step 1: Assume LLL is Regular

    Assume that LLL is regular. Then, by the pumping lemma, there exists a pumping length ppp such that any string s∈Ls \in Ls∈L of length at least ppp can be split into three parts s=xyzs = xyzs=xyz such that:

    • ∣xy∣≤p|xy| \leq p∣xy∣≤p,
    • ∣y∣>0|y| > 0∣y∣>0,
    • For all i≥0i \geq 0i≥0, xyiz∈Lxy^i z \in Lxyiz∈L.

    Step 2: Choose a String s∈Ls \in Ls∈L

    Let’s choose the string s=apbps = a^p b^ps=apbp. Clearly, s∈Ls \in Ls∈L because it has ppp aaa's followed by ppp bbb's.

    Step 3: Decompose the String s=xyzs = xyzs=xyz

    According to the pumping lemma, we can decompose s=apbps = a^p b^ps=apbp into parts xxx, yyy, and zzz such that:

    • ∣xy∣≤p|xy| \leq p∣xy∣≤p,
    • ∣y∣>0|y| > 0∣y∣>0,
    • xyiz∈Lxy^i z \in Lxyiz∈L for all i≥0i \geq 0i≥0.

    Since ∣xy∣≤p|xy| \leq p∣xy∣≤p, both xxx and yyy must consist only of aaa's. So, x=akx = a^kx=ak and y=amy = a^my=am for some kkk and mmm, where m>0m > 0m>0 (since ∣y∣>0|y| > 0∣y∣>0).

    Thus, the decomposition is:

    s=akambp=ak+mbp.s = a^k a^m b^p = a^{k+m} b^p.s=akambp=ak+mbp.

    Step 4: Pump the String

    Now, pump the middle part yyy (the part consisting of aaa's):

    • For i=2i = 2i=2, we get the string xy2z=aka2mbp=ak+2mbpxy^2 z = a^k a^{2m} b^p = a^{k+2m} b^pxy2z=aka2mbp=ak+2mbp.
    • This string is not in LLL because the number of aaa's and bbb's is no longer equal.

    Thus, we have a contradiction, as the string xy2zxy^2 zxy2z does not belong to LLL, which contradicts the pumping lemma.

    Step 5: Conclusion

    Since we have reached a contradiction, our assumption that LLL is regular must be false. Therefore, the language L={anbn∣n≥0}L = \{ a^n b^n | n \geq 0 \}L={anbn∣n≥0} is non-regular.

    Non-Regular Languages

    A non-regular language is a language that cannot be recognized by any finite automaton. These languages do not satisfy the pumping lemma for regular languages, and therefore, they cannot be described by regular expressions, finite automata, or DFAs. Some classic examples of non-regular languages include:

    1. L={anbn∣n≥0}L = \{ a^n b^n | n \geq 0 \}L={anbn∣n≥0}: As shown above, this language is non-regular.
    2. L={w∣w contains the same number of a’s as b’s}L = \{ w \mid w \text{ contains the same number of a's as b's} \}L={w∣w contains the same number of a’s as b’s}: This language involves counting, which is not possible with a finite state machine.
    3. L={anbncn∣n≥0}L = \{ a^n b^n c^n | n \geq 0 \}L={anbncn∣n≥0}: This language requires counting three different symbols, which finite automata cannot handle.

    Conclusion

    The Pumping Lemma is a powerful tool for proving that certain languages are non-regular. It essentially shows that for regular languages, there is a property that all sufficiently long strings must have, which involves repeating parts of the string. If a language fails to meet this property, it cannot be regular. The pumping lemma is used to derive contradictions by showing that no matter how you decompose a string in a non-regular language, pumping it will lead to a string that is not in the language, thereby proving that the language is non-regular.

    Previous topic 8
    Transducers (automata with output)
    Next topic 10
    Grammars and PDA

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time11 min
      Word count1,786
      Code examples0
      DifficultyIntermediate