A context-free grammar is a quadruple consisting of a finite set of nonterminal symbols, a disjoint finite alphabet of terminal symbols, a start symbol , and a finite set of productions with and . A sentence is a terminal word over an alphabet with , and the generated formal language is .
The first language is context-free. For example, the productionsgenerate exactly : each recursive production adds two s to the left and two s to the right.
The language is not context-free. Suppose it had pumping length in the pumping lemma for context-free languages, and apply the lemma to . Write with , , and for every .
Let and be the respective numbers of s and s in . If , pumping with or destroys equality of the two block lengths. Hence a valid decomposition would require . Pumping with would then produce , where . Butso is not a square number. This contradiction proves the square-count language is not context-free.
Articles by others on the same topic
There are currently no matching articles.