Past exam of the mathematics course of the University of Cambridge 2017 ii Paper 4 4H b Solution Created 2026-09-24 Updated 2026-10-05
Let be the diagonal halting set, which is undecidable. The pumping argument below actually holds for every subset ; nonregularity needs the stated convention, or at least a set of exponents whose unary language is nonregular.
The pumping lemma for regular languages holds with pumping length one. For an accepted nonempty word, pump its first symbol. A word containing only s remains in even if that symbol is deleted. If there is a zero and a nonempty prefix before its last zero, pumping the first symbol leaves the last zero and its following ones unchanged. If the word is , pumping its initial zero produces ; this is accepted for , and for it belongs to . In every case the pumped substring is nonempty and lies in the first position.
If were a regular language, closure under intersection would makeregular. A finite-state automaton for this intersection would decide membership of in the diagonal halting set by reading , a contradiction. Thus satisfies the pumping lemma but is not regular, under the usual meaning of . If were arbitrary, the printed conclusion would be false, for example for .
Past exam of the mathematics course of the University of Cambridge 2018 ii Paper 1 4G a Solution Created 2026-09-24 Updated 2026-10-03
The pumping lemma for context-free languages states that every context-free language has a pumping length such that every with can be writtenwith , , and for every integer .
Past exam of the mathematics course of the University of Cambridge 2018 ii Paper 1 4G b iii Solution Created 2026-09-24 Updated 2026-10-03
This language is not context-free. Let be a proposed pumping length and choose with . In any pumping decomposition of the unary word , pumping once more increases its length by an integer with . Butso the pumped length is not a power of three, contrary to the pumping lemma for context-free languages. This is also an instance of the fact that a unary context-free language is regular, whereas the powers of three are not ultimately periodic.
Past exam of the mathematics course of the University of Cambridge 2019 ii Paper 4 4H a i Solution Created 2026-09-24 Updated 2026-10-03
LetIntersect it with the regular languageEvery word of contains exactly two copies of . If it is a proper power, its exponent must therefore be two and its root must contain one . HenceThis language is not regular: if were a pumping length, pumping any nonempty substring among the first copies of in would change only its first -block. Since regular languages are closed under intersection,This is the proper-power language is not regular.
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.