What is the Pumping Lemma in Layman's terms?

前端 未结 9 1229
时光取名叫无心
时光取名叫无心 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:28

    The simple pumping lemma is the one for regular languages, which are the sets of strings described by finite automata, among other things. The main characteristic of a finite automation is that it only has a finite amount of memory, described by its states.

    Now suppose you have a string, which is recognized by a finite automaton, and which is long enough to "exceed" the memory of the automation, i.e. in which states must repeat. Then there is a substring where the state of the automaton at the beginning of the substring is the same as the state at the end of the substring. Since reading the substring doesn't change the state it may be removed or duplicated an arbitrary number of times, without the automaton being the wiser. So these modified strings must also be accepted.

    There is also a somewhat more complicated pumping lemma for context-free languages, where you can remove/insert what may intuitively be viewed as matching parentheses at two places in the string.

提交回复
热议问题