A language satisfies the context-free pumping lemma if there is an integer such that every with has a decompositionwithandEvery context-free language has this property, although the property by itself is not sufficient for context-freeness.
This language is not context-free. If were a pumping length, apply the lemma toBecause , the pumped region meets at most two adjacent blocks and cannot meet both zero blocks. Pumping with or changes at least one symbol count. If it changes either zero block, that block no longer agrees with the untouched zero block; if it changes only the middle block, the number of ones no longer agrees with the two zero counts. In every case the pumped word leaves the language, contradicting the lemma.
The language is context-free. A grammar with start symbol isEvery derivation adds matching symbols to the two ends and starts with a matching central pair, so it produces exactly the nonempty even palindromes .
This language is not context-free. Intersect it with the regular languageAn even palindrome in has the form , and its first half is . The required equality of the numbers of zeros and ones in forces . Hence the intersection isThis is not context-free: applying the pumping lemma to , a pumped substring of length at most cannot meet both zero blocks. Pumping therefore either destroys equality of the two zero counts or changes the middle count away from twice their common value.
Context-free languages are closed under intersection with regular languages, so a context-free would make context-free. This contradiction proves the claim.
This language is context-free. LetThe nonterminal produces exactly with . The base production for supplies one leading and one trailing zero, and each recursive production supplies one more of each. Thus produces exactly
Articles by others on the same topic
There are currently no matching articles.