Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 20 1 Solution Created 2026-10-03 Updated 2026-10-07
Fix a finite alphabet . A regular expression is built recursively from , , and the letters , using union, concatenation, and Kleene star. Its interpretation is a formal language: the basic expressions denote , , and , while , , and denote , , and all finite concatenations of members of , including the empty concatenation. In particular, and are different expressions with different meanings.
Kleene theorem identifies exactly the languages described by regular expressions with those recognized by finite-state automata. Start with a deterministic finite automaton (DFA) having states , initial state , accepting set , and transition function . Let describe paths from to whose internal states lie among . At stage zero use the union of letters labelling direct transitions from to , with added if ; use if there are no such possibilities. Define the finite-state path expressions recursively byA path either avoids internally or decomposes at its visits to : an initial piece into , any number of return pieces at , and a final piece out. Each piece has no internal occurrence of . This proves the recursion by induction, including paths with or , where empty pieces are permitted. Thusis a regular expression for the DFA's accepted formal language. An empty accepting set gives the expression . This is the path form of state elimination for finite automata.
A nondeterministic finite automaton (NFA) replaces a single successor state by a set of possible successors. It accepts if there exists an accepting run with and . Rejection means that no accepting run exists, rather than that some run rejects. For an Epsilon-NFA, transitions labelled consume no symbol; acceptance means a path whose non-epsilon labels spell . In particular, acceptance of the empty word is tested using the epsilon closure of the initial state.
The same Kleene theorem holds for nondeterministic finite automata. For an NFA without epsilon transitions, the powerset construction has state set , initial state , transition on letter , and accepting subsets meeting . Induction on word length shows that its state is exactly the set of possible current NFA states. For an Epsilon-NFA, start from , where is epsilon closure, and useThis subset construction with epsilon transitions preserves the accepted formal language and gives a DFA with at most states. The already proved direction of Kleene theorem therefore gives a regular expression for every NFA language.
For the converse, recursively construct an Epsilon-NFA with a designated initial state and final state for a regular expression. Use two states with no connecting path for , one epsilon edge for , and one edge labelled for . Keep component state sets disjoint. Union uses a fresh initial state with epsilon edges into both components, and epsilon edges from their finals to a fresh final. Concatenation joins the first final to the second initial by an epsilon edge. For Kleene star, use fresh initial and final states, an epsilon edge directly between them for zero iterations, an edge into the old initial, and epsilon edges from the old final both back to the old initial and out to the new final. Each construction has exactly the intended union, concatenation, or iteration semantics. Induction on the regular expression proves correctness; the subset construction with epsilon transitions then gives a DFA. This proves both directions of Kleene theorem.
Past exam of the mathematics course of the University of Cambridge 2014 iii Paper 21 2 ii Solution Created 2026-10-03 Updated 2026-10-06
Yes: regular languages are closed under the shuffle of formal languages. The construction must allow letters common to both alphabets to be assigned to either input word.
Take complete deterministic finite automata recognizing . Construct a nondeterministic finite automaton on over . Its initial state is and its accepting states form . On a letter , its possible moves from areBoth moves are allowed when belongs to both alphabets. They may coincide; that causes no difficulty.
For every run, record whether each move updated the first or the second coordinate. The letters assigned to each coordinate, in their original order, form two words . The final coordinate states are exactly the states reached by reading in . Thus an accepting run expresses the input as an interleaving of a word of and a word of .
Conversely, given such an interleaving, assign each input position to the word from which it came. The corresponding choices of transitions form a run ending in . This proves equality between the recognized formal language and the shuffle of formal languages, in both directions. No assumption of disjoint alphabets is needed. If one contributing word is the empty word, no move need update that coordinate; the initial pair is accepting exactly when both empty words are accepted.
Apply the powerset construction to this nondeterministic finite automaton to obtain a deterministic finite automaton. In particular,
Past exam of the mathematics course of the University of Cambridge 2021 ii Paper 2 4F Solution Created 2026-09-23 Updated 2026-09-25
For a deterministic finite automaton the extended transition function of a deterministic finite automaton is recursivelyThe accepted language isFor a nondeterministic finite automaton, is the set of all states reachable from while reading ; recursively,Thus
Shuffle of formal languages 2026-10-06
The shuffle of two formal languages consists of words whose positions can be partitioned into two subsequences, each preserving its order, with the two resulting words belonging to the respective languages. For regular languages, a product-state nondeterministic finite automaton advances exactly one coordinate for each letter. Common letters allow either choice; the powerset construction proves closure.