Past exam of the mathematics course of the University of Cambridge 2020 ii Paper 3 4F ii Solution Created 2026-09-24 Updated 2026-09-29
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.