The pumping lemma for context-free languages states that for every context-free language there is a pumping length such that every with can be written
with
This language is context-free. It is the language of even-length palindromes over , generated by the context-free grammar
Every derivation adds matching outer symbols, and removing the matching first and last symbols gives the converse induction.
This language is not context-free. Suppose it had pumping length , and choose a prime . Apply the pumping lemma to . Let and be the total numbers of zeros and ones in the pumped pieces and . If , pumping with produces unequal block lengths and leaves the language. If , then forces . Pumping with produces equal block lengths
which are composite. Every possible pumping decomposition fails, proving the equal prime block language is not context-free.
The equations and are equivalent to
for nonnegative integers . Hence the language is
which is the nested two-pair count language generated by
It is therefore context-free.
Take context-free grammars for and rename their nonterminals so that they are disjoint. If their start symbols are , add a new start symbol and the production
All productions remain context-free. A derivation from produces a word from followed by a word from , and every such concatenation has a derivation. Thus the new grammar generates , proving closure of context-free languages under concatenation.

Articles by others on the same topic (0)

There are currently no matching articles.