What is the Pumping Lemma in Layman's terms?

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

    In laymans terms, I think you have it almost right. It's a proof technique (two actually) for proving that a language is NOT in a certain class.

    Fer example, consider a regular language (regexp, automata, etc) with an infinite number of strings in it. At a certain point, as starblue said, you run out of memory because the string is too long for the automaton. This means that there has to be a chunk of the string that the automaton can't tell how many copies of it you have (you're in a loop). So, any number of copies of that substring in the middle of the string, and you still are in the language.

    This means that if you have a language that does NOT have this property, ie, there is a sufficiently long string with NO substring that you can repeat any number of times and still be in the language, then the language isn't regular.

提交回复
热议问题