What is the Pumping Lemma in Layman's terms?

前端 未结 9 1225
时光取名叫无心
时光取名叫无心 2021-01-29 18:47

I saw this question, and was curious as to what the pumping lemma was (Wikipedia didn\'t help much).

I understand that it\'s basically a theoretical p

9条回答
  •  生来不讨喜
    2021-01-29 19:36

    For example, take this language L = anbn.

    Now try to visualize finite automaton for the above language for some n's.

    if n = 1, the string w = ab. Here we can make a finite automaton with out looping if n = 2, the string w = a2b2. Here we can make a finite automaton with out looping

    if n = p, the string w = apbp. Essentially a finite automaton can be assumed with 3 stages. First stage, it takes a series of inputs and enter second stage. Similarly from stage 2 to stage 3. Let us call these stages as x, y and z.

    There are some observations

    1. Definitely x will contain 'a' and z will contain 'b'.
    2. Now we have to be clear about y:
      • case a: y may contain 'a' only
      • case b: y may contain 'b' only
      • case c: y may contain a combination of 'a' and 'b'

    So the finite automaton states for stage y should be able to take inputs 'a' and 'b' and also it should not take more a's and b's which cannot be countable.

    1. If stage y is taking only one 'a' and one 'b', then there are two states required
    2. If it is taking two 'a' and one 'b', three states are required with out loops and so on....

    So the design of stage y is purely infinite. We can only make it finite by putting some loops and if we put loops, the finite automaton can accept languages beyond L = anbn. So for this language we can't construct a finite automaton. Hence it is not regular.

提交回复
热议问题