No: regular languages are not closed under countably infinite intersection. Let and putThe first term in has regular expression , where the fixed power means copies. The second term is a finite language, a finite union of single words. Their union is therefore a regular language.
If , then for each either or belongs to the second term, so . If , choose . It belongs to neither term of . ConsequentlyThe formal language is not a regular language. Indeed, for a proposed pumping length , the pumping lemma for regular languages applied to must pump a nonempty block consisting only of zeros. Repeating that block increases the number of zeros without increasing the number of ones, leaving . This contradiction proves the counterexample. Finite intersection closure does not extend to this infinite intersection of regular languages.
Every generated word satisfieswhere count occurrences of the indicated terminal symbols. To see this, follow the unique chain of occurrences in a parse tree. Each use of introduces one from , at least one from its rightmost , and possibly one further from . Each use of adds one and no . The terminating contributes neither. Hence no generated word has more symbols than symbols.
Also, for every , the word is generated: apply exactly times, choose each time, then use and all remaining .
Suppose were a regular language, and let be a pumping length from the pumping lemma for regular languages. Apply it to . Every allowed decomposition with and has for some . Pumping twice giveswhich violates the proved counting inequality and hence is not generated. This contradicts the pumping lemma for regular languages. Therefore is not a regular language. Ambiguity was not used: the obstruction is the unbounded constraint on symbol counts.
Past exam of the mathematics course of the University of Cambridge 2017 ii Paper 1 4H b Solution Created 2026-09-24 Updated 2026-10-05
Treat the fixed letters , the empty-language and empty-word symbols, and the punctuation of expressions as a finite token alphabet. In the usual syntax allowing parentheses, union, concatenation, and star, the following context-free grammar generates exactly the syntactically valid regular expressions:Structural induction proves that every generated string is an expression and that every expression has a derivation. Grammar ambiguity does not affect the context-free language assertion.
If the language of these expressions were a regular language, its intersection with the regular token language consisting of some opening parentheses, then , then some closing parentheses would be regular. That intersection is exactlyThe pumping lemma for regular languages contradicts regularity: a sufficiently long opening-parenthesis prefix forces a pumpable segment wholly within that prefix, and pumping it changes the two parenthesis counts unequally. Hence the expression syntax is context-free but not regular. This conclusion concerns the strings describing expressions, not the languages those expressions denote; it uses the usual concrete syntax with arbitrary nested parentheses.
Past exam of the mathematics course of the University of Cambridge 2017 ii Paper 2 4H a i Solution Created 2026-09-24 Updated 2026-10-05
Use . The context-free grammar generates exactly , so it is a context-free language. It is not a regular language: if is a pumping length, any allowed decomposition of has a nonempty pumped segment consisting only of 's. Pumping down leaves fewer 's than 's, contradicting the pumping lemma for regular languages. Thus is a context-free language but not a regular language.
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 3 12G a Solution Created 2026-09-24 Updated 2026-10-03
The pumping lemma for regular languages states that for every regular language there is an integer such that every with can be writtenwith
To prove it, let a deterministic finite automaton with states recognize . During the reading of the first symbols of an accepted word , the automaton visits states, including the initial state. By the pigeonhole principle, two of them agree, say with . Let be the first symbols, the next symbols, and the remaining suffix. Reading is a nonempty closed path from to itself. Traversing this path any number of times and then reading therefore reaches the same accept state. This proves all three assertions.
Past exam of the mathematics course of the University of Cambridge 2019 ii Paper 4 4H b Solution Created 2026-09-24 Updated 2026-10-03
Let be the undecidable set denoted in the question. The language satisfies the pumping lemma for regular languages with pumping length one. For any nonempty , write with , its first symbol, and the remaining suffix.
If , then for every . Otherwise for some . If the chosen first symbol lies in , pumping it preserves the same final suffix . If , then : pumping down gives , while every positive pump gives and all but its last can be absorbed into . Thus every sufficiently long word has a valid pumping decomposition.
Nevertheless, if were regular language, closure under intersection would makeregular. A finite automaton deciding this unary language would decide whether by running it on , contradicting the halting problem. ThereforeThis is a nonregular language satisfying the pumping lemma.
Past exam of the mathematics course of the University of Cambridge 2020 ii Paper 3 12F Solution Created 2026-09-24 Updated 2026-09-29
A deterministic finite automaton is a tuple with finite state set , finite input alphabet , transition function , initial state , and accepting-state set . It accepts a word when the extended transition function of a deterministic finite automaton carries to a state in . A regular language is a language accepted by some deterministic finite automaton.
The pumping lemma for regular languages says that if a regular language is accepted by an automaton with states, every accepted word of length at least has a decomposition with , , and in the language for every . Indeed, among the states visited before and after the first symbols, two are equal by the pigeonhole principle. The intervening nonempty word labels a loop, which may be traversed any number of times without changing the final accepting state.
In base two, the powers of two have representations , so their language is the regular expression and is regular.
Suppose instead that their base-ten representations formed a regular language. Apply the pumping lemma to a sufficiently long decimal power of two , and put . Pumping gives decimal integers represented by , all powers of two. A direct place-value calculation shows thatfor a constant independent of . The lengths, and hence the exponents in , tend to infinity. Dividing by givesFor large , the right side has absolute value less than one while the left side is an integer, so it must vanish. This would make a power of two equal to , impossible for by unique prime factorization. Thus the decimal powers of two are not a regular language.
Past exam of the mathematics course of the University of Cambridge 2021 ii Paper 4 4F i Solution Created 2026-09-24 Updated 2026-09-25
The pumping lemma for regular languages says that sufficiently long accepted words split as with , , and accepted for all . Applying it to pumps only zeros, so language (i) is not regular.
Past exam of the mathematics course of the University of Cambridge 2022 ii Paper 2 4I i Solution Created 2026-09-24 Updated 2026-09-25
The pumping lemma for regular languages states that if is regular, then some has the following property: every with can be written with , , and for every . Indeed, while a deterministic finite automaton with states reads the first symbols, two of the first visited states coincide; the intervening nonempty loop may be traversed any number of times.
Past exam of the mathematics course of the University of Cambridge 2023 ii Paper 3 12I ii Solution Created 2026-09-24 Updated 2026-10-03
Past exam of the mathematics course of the University of Cambridge 2026 ii Paper 3 4I b Solution Created 2026-09-24 Updated 2026-09-25
The pumping lemma for regular languages says that for some , every accepted word of length at least factors with , , and accepted for every .
The assertion is false. Use the pumping lemma for regular languages: if is a regular language, there is such that every with admits a factorization with , , and for every integer .
Suppose the stated formal language were a regular language, and take . This string has twice as many zeros as ones, so it belongs to . In every allowed factorization, the first positions are all zeros, forcing with . Pumping down with producesIt still has ones but fewer than zeros, contradicting the pumping lemma for regular languages. Thus
The assertion is false. Suppose the formal language were a regular language, and let be its constant from the pumping lemma for regular languages. ConsiderIn every decomposition with and , the pumped factor is with . Pumping down givesThis string has exactly two ones and ends in a one. If it were , each copy of would contain exactly one one, and each copy would end in a one. The first copy would consequently be , while the second would be . They have different lengths because , so they cannot be equal. This contradiction to the pumping lemma for regular languages proves
These strings are the even-length palindromes . Suppose this were a regular language, and let be its length from the pumping lemma for regular languages. The stringbelongs to the formal language, with . In any allowed decomposition , where and , the pumped block is with . Pumping it away givesThis is not a palindrome: its initial and final runs of zeros have different lengths. Hence it cannot have the form , contradicting the pumping lemma for regular languages. Therefore
Let , and suppose it were a regular language. The formal language is a regular language. By closure of regular languages under set difference,would be a regular language. But the pumping lemma for regular languages rules this out: for pumping length , every permitted pumped block in consists of zeros, and deleting it produces , with unequal counts. This contradiction provesThe closure step can also be realized by a product automaton accepting when the automaton for accepts and the automaton for rejects. If the exponents are instead required to be positive, use ; the same argument applies.
Proper-power language is not regular 2026-10-03
Over an alphabet containing , the language is not regular language. Intersecting it with the regular language gives exactlywhich fails the pumping lemma for regular languages.