Canonical residual automaton 2026-10-06
The canonical residual automaton of a regular language has its distinct left quotients of a formal language as states, initial state , accepting states those containing the empty word, and letter transition . It is a complete minimal deterministic finite automaton; every other complete minimal deterministic finite automaton for that language is isomorphic to it.
Concatenation Created 2026-10-14 Updated 2026-10-20
Concatenation joins two strings end to end, retaining the order of their symbols. For example, joining and gives . It has the associative property: joining or gives the same word over an alphabet. The empty word is its identity element. All finite words over an alphabet with this binary operation form a free monoid.
Deterministic finite automaton Created 2026-09-24 Updated 2026-10-14
A deterministic finite automaton has exactly one automaton transition for every automaton state and input symbol. Formally, a DFA is a tuple : is a nonempty finite set of automaton states, a finite alphabet, a function, the initial automaton state, and the accepting automaton states. Its unique path on a word accepts if it ends in after consuming the entire input. Visiting earlier does not suffice.
For a concrete binary divisibility automaton, recognize the words whose values in the binary numeral system are divisible by three. Choose , , , and . Each automaton state names the congruence class of the integer read so far. Appending a binary digit changes its value to , so the automaton transition isThe modular arithmetic therefore needs only three automaton states, whatever the input length. The full function is , , , , , and .
A three-state DFA for binary digits representing integers divisible by three, with accepted and rejected traces
. Details. For , the successive automaton states are , so the word is accepted. For , they are , so it is rejected. Leading zeros are allowed: they leave the initial automaton state unchanged. We explicitly assign value zero to the empty word, which is accepted because the initial automaton state is accepting. This is a convention for a formal language, rather than a claim that ordinary written numerals include a blank numeral.
The generator checks every word of up to eight binary digits, comparing the final automaton state with the integer value modulo three. Each length includes all words, preserving leading zeros as distinct inputs:
All 511 checks agree. They are useful for catching a reversed arrow or mistaken label, but the reason the DFA works at every length is its invariant: after reading any word of value , its automaton state is . The update preserves that statement by mathematical induction. Through the extended transition function of a deterministic finite automaton, this becomes .
Empty language 2026-10-05
The formal language containing no words over an alphabet. It differs from the language containing only the empty word, which is a multiplicative identity for concatenation of formal languages.
Free monoid Created 2026-10-03 Updated 2026-10-14
The free monoid on an alphabet consists of all finite words over an alphabet, including the empty word , with concatenation as its binary operation. Distinct strings represent distinct elements: there are no imposed equalities between different sequences of letters. The empty word is its identity element, and concatenation has the associative property.[ref]
For , the elements begin . Both and give the same word , but , so this monoid is not commutative. The length of a word over an alphabet obeys ; it is a monoid homomorphism to the nonnegative integers with addition. A nonempty word has no inverse element, since joining it to any other word cannot decrease its length to zero.
The defining benefit of being free is that letters can stand for arbitrary elements of another monoid. Choose a value for each letter ; then , with , is the unique monoid homomorphism extending those choices. Associativity and the identity element make this evaluation consistent for every finite word. For example, interpreting the letters as self-maps evaluates a word as a composed transformation; interpreting them as nonnegative counts evaluates it by addition.
Identity element Created 2026-09-24 Updated 2026-10-14
An identity element for a binary operation satisfies for every element of the underlying set. It is a two-sided identity: merely satisfying one of the two equations is insufficient. It is unique when it exists, since two candidates satisfy . This uniqueness does not require the associative property.
Zero is the identity element for addition of integers, one for multiplication of integers, and the identity function for function composition of self-maps. The empty word is the identity element for concatenation. An associative operation with an identity element makes a monoid; inverse elements are an additional requirement for a group.
Length of a word over an alphabet 2026-10-14
The length of a word over an alphabet is the number of symbol positions in that finite string, counting repetitions. Thus and for the empty word. Concatenation satisfies . This differs from the word length of a group element, which minimizes over representing words using a chosen generating set of a group.
Monoid Created 2026-09-28 Updated 2026-10-14
A monoid is a semigroup with a two-sided identity element : for every element . Associativity handles the grouping of a nonempty sequence; the identity element also supplies the result for an empty sequence. This makes the same rules apply to combining zero, one, or many contributions. [ref].
The nonnegative integers with addition form a commutative monoid, with identity element zero. They do not form a group: a positive integer has no additive inverse in that set. All words over an alphabet with concatenation form a free monoid, whose identity element is the empty word. The full transformation monoid consists of all self-maps of a set, with function composition and the identity function.
These examples explain why monoids are useful: accumulation needs an operation and a starting value, but it need not be reversible. Adding counts, joining strings, and composing transformations all share the same grouping and identity laws. Requiring every element to have an inverse element gives a group, a stronger structure suitable for reversible operations.
Nondeterministic finite automaton Created 2026-09-24 Updated 2026-10-14
A nondeterministic finite automaton allows a set of possible destinations for each automaton state and input symbol. Without the extra moves permitted in an Epsilon-NFA, replace the DFA function by , where is the power set. A word is accepted when at least one path consumes all its symbols and ends in an accepting automaton state. These choices express existential quantification, not probability: no chance of choosing a particular path is assigned. One successful path suffices even if other paths fail.
Consider a three-state NFA accepting exactly the words of binary digits ending in . Its initial automaton state loops on both and ; it also has an automaton transition , followed by . Only is accepting, and all unlisted automaton transitions are absent. Staying at skips an arbitrary beginning; leaving it guesses that the current zero starts the final two symbols.
The word accepts along . The word accepts along . The word rejects: a path reaching after cannot consume the remaining zero, while the other paths end outside . Thus finding somewhere is insufficient; it must occur at the end.
To simulate the NFA deterministically, retain the set of all currently possible automaton states. The powerset construction updates by taking the union of the destinations of its members. Here only , , and are reachable, although the full power set has eight members. Reading gives , which rejects. In general, an -state NFA yields a DFA with at most automaton states. Nondeterminism can simplify a description, while the powerset construction keeps the memory finite.
The second generator checks all 511 words of up to eight binary digits against the direct test of whether their final two symbols are . Exactly 127 accept, and only the three listed sets of automaton states occur. In particular, the empty word rejects for this NFA.
Michael O. Rabin and Dana Scott's 1959 paper studied finite-state machines as recognizers with finite internal memory. Its section 5 defines NFAs through successful paths, and theorem 11 proves their equivalence to DFAs by the powerset construction. This gives a historical source for the distinction between many possible paths and greater recognition power: [ref]
https://www.cs.cmu.edu/~lblum/flac/Handouts_pdf/rs.pdf. Rabin and Scott, Finite Automata and Their Decision Problems, pp. 120–121
. 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 2014 iii Paper 21 2 i Solution Created 2026-10-03 Updated 2026-10-06
The minimal deterministic finite automaton is unique up to an isomorphism preserving the initial state, transitions and accepting states. We use complete deterministic finite automata over the fixed alphabet; the PDF's abbreviation FDA has this meaning. State names themselves cannot be unique.
For words , introduce the Myhill-Nerode equivalenceIt is an equivalence relation, and appending the same letter to equivalent words preserves it: a suffix after is the suffix after . Since is a regular language, take any recognizing deterministic finite automaton. Words reaching the same state are equivalent, since every further suffix gives the same computation. Thus has finite index.
The canonical residual automaton has one state for each class, initial state , transition , and accepting states those with . These choices are well-defined by Myhill-Nerode equivalence. Induction on the input length shows that reading reaches , so the deterministic finite automaton recognizes , and all its states are accessible states of a deterministic finite automaton. The same state can be described by the left quotient of a formal languageTwo states are different precisely when some suffix distinguishes their acceptance behavior.
Every recognizing deterministic finite automaton has at least as many states as there are classes: pick a representative from each class; two different representatives cannot reach the same state. The canonical residual automaton attains this bound, and therefore is a minimal deterministic finite automaton.
For uniqueness, let be any minimal deterministic finite automaton. All its states are accessible, since removing inaccessible states leaves a complete recognizing deterministic finite automaton with fewer states. Map a state reached by to . This is well-defined because two words reaching the same state are equivalent. It is surjective because every class has a representative. Both sets have the minimal number of states, so it is a bijection. It preserves the initial state and transitions by construction, and preserves accepting states by taking the empty word as the suffix. This is the required isomorphism with the canonical residual automaton, provingThe empty word is included throughout, and empty or universal regular languages have the corresponding one-state complete deterministic finite automata.
Past exam of the mathematics course of the University of Cambridge 2014 iii Paper 21 5 i Solution Created 2026-10-03 Updated 2026-10-06
A well-quasi-ordering is a reflexive transitive relation for which every infinite sequence has with . A bad sequence has no such pair. The labelled version of Kruskal's tree theorem says that finite rooted trees labelled in any well-quasi-ordering are themselves well-quasi-ordered by label-monotone tree embedding.
More explicitly, an embedding is an injective map of vertices preserving lowest common ancestors, and satisfying at every vertex. The root need not map to the host root. This is a homeomorphic embedding of a rooted tree: an edge can map to a longer path, but distinct branches must separate at the image of their common ancestor. We shall prove the stronger version in which every vertex's children are linearly ordered and embeddings respect that ordering. Forgetting the child order gives the stated result for unordered rooted trees.
We first establish the two well-quasi-ordering facts used in the proof. Every infinite sequence in a well-quasi-ordering has an infinite nondecreasing subsequence. Indeed, color an index pair according to whether . The infinite two-color Ramsey theorem gives a homogeneous infinite set; the negative color would be a bad sequence, so the positive color gives the required subsequence. It follows that the componentwise product of two well-quasi-orderings is a well-quasi-ordering: first extract a nondecreasing subsequence in one coordinate, then find a good pair in the other.
Next prove Higman lemma: finite words over a well-quasi-ordering , ordered by subsequence embedding with coordinatewise increase of letters, are a well-quasi-ordering. Suppose not, and choose a minimal bad sequence by making the length of minimal among all choices admitting an infinite bad continuation of the already fixed prefix. No word is the empty word, since that embeds in every later word. Write with . Extract indices for which . ConsiderIt cannot be a bad sequence, since its first replacement is shorter than the minimal choice . But a good pair within the original prefix is impossible. A prefix word embedding into would embed into , contradicting the original bad sequence. And embedding into would, after appending the ordered last letters, embed into , also impossible. This contradiction proves Higman lemma, including words of arbitrary finite length.
Now suppose there is a bad sequence of finite ordered labelled rooted trees. Choose a minimal bad sequence by minimizing the number of vertices of , subject to the fixed prefix having an infinite bad continuation. Existence of a least possible size uses ordinary well-ordering of the natural numbers; after selecting such a tree retain a bad continuation to make the next choice.
Let be the collection of all proper rooted subtrees of all , with inherited labels and child ordering. These are the subtrees rooted at vertices other than the root, and each embeds into its containing tree. We claim is a well-quasi-ordering under the same label-monotone tree embedding.
Otherwise choose a bad sequence from , and choose for each a containing tree . The indices are unbounded in every tail: finitely many containing trees have only finitely many rooted subtrees, and an infinite bad sequence cannot repeatedly use one of these, since it embeds into itself. Passing to a subsequence, arrange . The spliced sequenceis bad. A good pair within either piece is already excluded. A comparison , where , would compose with to give , contradicting the original bad sequence. But is smaller than , contradicting the minimal choice at that position. This proves the claim about .
Describe by its root label and its finite ordered list of child subtrees. Every entry of lies in . By Higman lemma, is a well-quasi-ordering; hence so is . There exist with and an increasing injection matching the child subtrees in to child subtrees in , each by an embedding. Map root to root and combine these child embeddings. Different matched children lie in different target branches, so their paths meet exactly at the target root; within each branch the chosen embedding already preserves lowest common ancestors. The resulting map is a label-monotone tree embedding , a contradiction. ThereforeThe empty labelled tree, if included by convention, embeds into every tree and causes no exception. A common stronger formulation requires the source root to map to the target root. It also follows: the theorem just proved makes all labelled child subtrees a well-quasi-ordering, and the product then provides a good pair with roots explicitly matched, by the same final assembly. Internal child roots may map further down their matched branches. This must not be confused with edge-to-edge embedding, for which the theorem is false in general.
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 120 1 c Solution Created 2026-10-03 Updated 2026-10-06
Part (a)(i), applied to and , guarantees an accepted output of length at most . Its padded convolution of words has at most columns. Thus the dynamic programming search in part (b) reaches an accepting layer by this bound.
Each layer has at most twice the fixed number of states of , and each record has at most outgoing choices. These are constants for the fixed automatic structure for a group. Storing a pointer and a symbol takes constant time; copying whole partial output strings at every step would unnecessarily spoil this bound. Reconstruction also takes at most steps. Therefore automatic multiplication has linear time and bounded length increase:For nonempty inputs this is the requested time complexity. The additive merely includes the constant work on the empty word.
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 120 1 d Solution Created 2026-10-03 Updated 2026-10-14
The regular language is nonempty because it represents every element of the group. Find any accepted word using breadth-first search in its finite-state automaton. If is the empty word, it already represents the identity.
Otherwise begin with and repeatedly apply the linear-time multiplication in an automatic structure to the lettersThese letters belong to by symmetry of the alphabet. All intermediate words lie in , and the final word representsHence an identity representative can be constructed effectively:This is a finite preliminary computation depending only on the fixed automatic structure for a group; it uses no test for whether an arbitrary word represents the identity.
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 120 1 e Solution Created 2026-10-03 Updated 2026-10-06
Write the input word over an alphabet as . Starting with , obtain from by linear-time multiplication in an automatic structure with . Mathematical induction givesThe time complexity of step is at most a constant times . Summing the costs givesThe automatic structure for a group, and are fixed, so the required representative isFor the empty word, return in constant time.
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 120 1 f Solution Created 2026-10-03 Updated 2026-10-06
Construct as above, and run the equality group multiplier automaton on . Both inputs belong to , soThe final finite-state automaton run takes time. The word problem for a group is therefore decidable in quadratic time:The empty word is accepted immediately. Comparing and as literal strings would be incorrect, since an automatic structure for a group need not give unique representatives.
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 120 2 Solution Created 2026-10-03 Updated 2026-10-06
For a finite position , let be the cylinder set of infinite plays extending . Because the factors have the discrete topology, these cylinder sets form a basis for the product topology. PutMembership in means that I has already secured the outcome, regardless of future moves. Since is an open set, a play belongs to exactly when one of its prefixes belongs to .
Build the winning-position attractor in an infinite game by transfinite recursion. Start with , use unions at limit ordinals, and setThis sequence is increasing: the defining operation is order-preserving, and . It stabilizes at some ordinal. Indeed, if it strictly increased at every successor stage below the successor cardinal number of , choosing one newly added position per stage would inject that larger cardinal into . Denote the stable set by . This constructs the needed fixed point directly, without an appeal to an unstated fixed-point theorem.
Every position in has a least entry ordinal, its rank. Rank zero means membership in . A positive rank is a successor : at an I-position some extension belongs to , while at a II-position every extension does. If the empty word belongs to , I always chooses an extension of smaller rank until is reached. II's choices also decrease rank before that happens. There is no infinite strictly decreasing sequence of ordinals, so some finite prefix lies in . This is a winning strategy in an infinite game for I.
If the empty word is outside , the fixed point equation says that every extension of an I-position outside is still outside , and that a II-position outside has at least one extension outside . II chooses such an extension. Every resulting prefix avoids , hence the whole play avoids by openness. This is a winning strategy in an infinite game for II.
The choices can be made simultaneously by fixing a well-order of , as allowed by the usual axiom of choice. The argument does not assume that is countable. Every such open game is determined:
Past exam of the mathematics course of the University of Cambridge 2017 ii Paper 3 4H a Solution Created 2026-09-24 Updated 2026-10-05
In strict Chomsky normal form, every production of a context-free grammar is or , with nonterminal symbols and a terminal symbol. Such a derivation cannot produce the empty word: it starts with one nonterminal symbol, and every step either increases the symbol count or replaces one symbol by one symbol. The context-free language , generated by , is therefore not generated by any strict CNF grammar.
The convention matters: extended Chomsky normal form permits with excluded from right-hand sides. Under that convention every context-free language has such a grammar, so the requested example would not exist.
Past exam of the mathematics course of the University of Cambridge 2017 ii Paper 4 4H a Solution Created 2026-09-24 Updated 2026-10-05
Use state elimination for finite automata on a generalized finite automaton, whose directed edges are labelled by regular expressions. Add a fresh initial state with an -edge to the old initial state and a fresh final state with -edges from all old accepting states. Every missing edge has label , the empty language; parallel edges are merged by union. The label denotes the language containing just the empty word.
When eliminating a state , replace the label on each surviving edge byHere juxtaposition means concatenation of formal languages, and the Kleene star allows zero or more traversals of the loop at . Then delete and its incident edges. Eliminate every original state; the remaining label is a regular expression for exactly the accepted formal language. The update accounts for paths avoiding and paths entering , looping there any number of times, and leaving it.
Past exam of the mathematics course of the University of Cambridge 2018 ii Paper 3 4G a Solution Created 2026-09-24 Updated 2026-10-03
A context-free grammar is in Chomsky normal form when every production rule has one of the formswhere are nonterminal symbols and is a terminal symbol. If the language contains the empty word, one may additionally permit , with the start symbol absent from all right-hand sides.

