Use Turing machines with a two-way read-only input tape, bounded by endmarkers, and a fixed finite number of read-write work tapes over a fixed finite alphabet. Work-tape cells count towards space complexity; the read-only input does not. For input length , use to include the small-length cases.
, or L, is the class of formal languages decided by a deterministic such machine using at most work-tape cells for some fixed constant . It must halt on every input and accept exactly the members.
, or NL, is the class of formal languages accepted by a Nondeterministic Turing machine with the same work-space bound on every computation branch. An input is accepted if and only if at least one branch accepts. One may require all branches to halt: the configuration graph has only a polynomial number of vertices, so a logarithmic space counter can stop any branch that has taken more steps than that bound. If an accepting computation exists, one exists with no repeated Turing machine configuration, so this convention does not change the complexity class.
In standard space complexity notation,
A logspace transducer is a deterministic Turing machine with a read-only input tape, read-write work space, and a write-only output tape. It emits symbols successively and cannot reread the output; that output is not charged as working memory. For a total function it must halt on every input. A logspace-computable function is a total function whose output is produced by such a logspace transducer on input .
A logspace many-one reduction is a logspace-computable function such thatfor every string . The logarithmic space bound permits a polynomial-length output, even when that output does not fit in work space. Indeed, a halting logspace transducer cannot repeat its state, input-head position and work-tape contents and head positions: the unreadable output cannot affect its subsequent behaviour. There are only a polynomial number of such internal Turing machine configurations, hence a polynomial bound on the number of steps and output symbols.
To prove a formal language is NL-complete, first give an NL acceptance procedure for . Then show every has a logspace many-one reduction to . Alternatively, reduce one already NL-complete formal language to , using transitivity of logspace many-one reductions.
Transitivity requires logspace composition by recomputation, rather than storing the intermediate output. To compose with , simulate the logspace transducer for with a virtual input . Retain its virtual input-head position in bits. Whenever it asks for a symbol, rerun the logspace transducer for from the beginning and count its output symbols until that position is reached. Since is polynomial in , the simulated work space and all output-position counters are . Repeated runs reuse their storage. This proves closure under composition and explains why the hardness argument works.
For polynomial-time many-one reductions, an unconditional example is the empty language:A procedure that rejects every input decides it in constant time, so it belongs to P and hence NP. It is not NP-hard: the nonempty formal language belongs to NP, but no many-one reduction can satisfyThe right-hand side is always false. Thus the hardness condition fails without assuming . Giving an ordinary nontrivial problem in P would not establish the requested separation unconditionally, because that would require excluding the possibility .
A nondeterministic finite automaton, allowing the epsilon transitions used in this paper, is a tupleHere is a nonempty finite set of automaton states, is a finite alphabet, is the power set of , is the initial automaton state, and is the set of accepting automaton states. The symbol denotes the empty word. Membership permits an automaton transition from to consuming when , or consuming nothing when .
The recognized formal language isThe label of a graph path is the concatenation of its labels with all occurrences of omitted. Thus acceptance requires consuming the entire input word; a single successful choice of automaton transitions suffices. A path of length zero is allowed, so the empty word is accepted whenever , or an accepting automaton state is reachable by epsilon transitions. If epsilon transitions are excluded from the definition of a nondeterministic finite automaton, the displayed version is called an Epsilon-NFA.
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.
A nondeterministic pushdown automaton is a tupleHere is a nonempty finite set of control states, a finite input alphabet, a finite stack alphabet, the initial control state, the initial stack symbol, and the final control states. The notation requires each transition to have only finitely many choices. Since the domain is finite, the whole transition specification is finite.
A pushdown automaton configuration is , recording the control state, unread input word, and stack contents. Write the top of the stack on the left. For , the one-step relation isAn epsilon transition instead hasThus a move replaces the top stack symbol by the word , whose leftmost symbol becomes the new top. It consumes one input symbol or no input symbol. Under this convention there is no move from an empty stack.
For acceptance by final state, the recognized formal language isHere allows any finite number of moves, including zero. The entire input must have been consumed; the final stack need not be empty. Acceptance requires at least one such run of the nondeterministic pushdown automaton.
A context-free grammar is an ambiguous grammar if some word in its generated formal language has two distinct parse trees. Equivalently, that word has two distinct leftmost derivations from the start nonterminal symbol. A leftmost derivation always expands the leftmost remaining nonterminal symbol.
Two arbitrary grammar derivations of the same word do not by themselves prove ambiguity: expanding independent nonterminal symbols in a different order can describe the same parse tree. Requiring distinct parse trees, or distinct leftmost derivations, avoids that issue.
Fix a deterministic, single-tape Turing machine with tape cells indexed by the integers. A precise definition is the tupleHere is a nonempty finite set of control states, a finite tape alphabet with a designated blank symbol , the input alphabet, the initial control state, and distinct halting control states. The transition function is total on the displayed domain. The Turing machine instruction means to write over the scanned , enter control state , and move the head one cell in direction .
A Turing machine configuration is , where , is the head position, and is the tape-content function, equal to outside a finite set. Its next-configuration relation isif , with for and for , andThere is no successor to either halting Turing machine configuration.
For input , the initial Turing machine configuration is , where for and is blank elsewhere. In particular, the initial tape for the empty word is entirely blank. The recognized formal language isThe relation permits any finite number of transitions. An input outside may reach the rejecting control state or run forever; recognition does not require halting on every input.
The formal language is not a regular language. Let denote it and consider the infinitely many prefixesFor any , append the word . Then , whereas : the latter word has occurrences of and occurrences of , and every word of has equal numbers of those two symbols.
Thus and are not Myhill-Nerode equivalent. There are infinitely many Myhill-Nerode equivalence classes, so the Myhill-Nerode theorem rules out a finite-state automaton recognizing . Equivalently, if two such prefixes left a deterministic finite automaton in the same automaton state, appending could not distinguish their acceptance, giving the same contradiction.
The formal language is a regular language. A regular expression for it isThe first Kleene star independently chooses copies of the word , and the second independently chooses copies of . Their concatenation produces exactly the required words. Either count may be zero, including both counts zero, which gives the empty word. By Kleene theorem, the regular expression establishes regularity.
The formal language is not a context-free language. Suppose otherwise, and let be a pumping length from the pumping lemma for context-free languages. ChooseThis word belongs to the formal language, since its middle exponent is the product of the two outer exponents. The pumping lemma for context-free languages would givewith in the formal language for every integer .
Let be the respective numbers of symbols in the two pumped pieces together. The window cannot contain both an and a : it would have to contain the entire middle block of length , plus at least those two outer symbols, exceeding . HencePump once extra, taking . The resulting symbol counts are , , and . A necessary condition for membership, regardless of whether the block order survives, iswhere was used.
If , then , contradicting that equality. If , thenagain contradicting it. Thus every permissible decomposition fails at . This contradicts the pumping lemma for context-free languages and proves the claim. The obstruction is the multiplicative block-count language: a bounded local change cannot preserve the product constraint.
The formal language is a context-free language. A context-free grammar with start nonterminal symbol isThe production rule for nests one on the left and one on the right on each recursive use, so generates exactly for . Similarly, generates exactly for . The start production rule concatenates these words, yieldingConversely, every choice of nonnegative integers is achieved by using the recursive production rules exactly times before their epsilon productions. Hence this context-free grammar generates precisely the required formal language, including all cases where either count is zero.
The problem is undecidable. Reduce the halting problem to it. Given a Turing machine and input word , construct a Turing machine over with the following behavior on input :
- If , reject.
- If , simulate on the fixed word . If that simulation ever halts, whether accepting or rejecting, accept ; otherwise continue the simulation forever.
This is an effective construction: are fixed data stored in the description of . Its recognized formal language isTherefore accepts exactly one input word if and only if halts on . A supposed decision procedure for the singleton-language problem for Turing machines, applied to the constructed , would decide the halting problem. The standard undecidability of the halting problem excludes that possibility.
The problem is decidable. We need exactly one accepted word, even if that word has several accepting runs in the nondeterministic finite automaton.
First convert the input nondeterministic finite automaton to an equivalent deterministic finite automaton using the subset construction, taking epsilon closure where necessary. In the finite transition directed graph of , test whether an accepting automaton state is reachable from the initial automaton state. This is the standard finite automaton emptiness test. If none is reachable, the recognized formal language is empty, so answer no.
Otherwise retain a graph path to an accepting automaton state and read its labels to obtain one accepted word . If the initial automaton state is accepting, may be the empty word. Build a complete deterministic finite automaton for the singleton formal language : it tracks the matching prefix of , accepts only after exactly its full length, and enters a rejecting sink on a mismatch or any extra input symbol.
Complement that complete deterministic finite automaton by exchanging accepting and rejecting automaton states. Form its product with , accepting exactly when the coordinate accepts and the other coordinate accepts. This product recognizesApply the finite automaton emptiness test again. Answer yes if and only if this difference is empty. The first test guarantees that belongs to ; the second guarantees there is no different accepted word. All constructions have finitely many automaton states and all reachability tests terminate. This gives a singleton-language test for finite automata.
Past exam of the logic and set theory course of the University of Oxford 2008 A 1 c b Solution 2026-10-31
Not a logical formula of this language. Logical disjunction is not one of its permitted logical connectives. Even though the displayed expression has an ordinary interpretation in a larger propositional language, membership in the specified formal language is a syntactic question. A logically equivalent logical formula using only negation and logical implication would have to be written with those symbols instead.
Past exam of the mathematics course of the University of Cambridge 2003 iii Paper 5 4 iii Solution Created 2026-10-03 Updated 2026-10-14
First construct the bounded-difference automaton. Fix as above, enlarging it if necessary. Its states are the finitely many elements , together with a reject state and finite flags recording when padding has started on each tape. The initial state is . Read the pair of words synchronously, padding their ends with a symbol representing the identity. If the current prefixes represent , the difference state is . A letter pair updates it byReject if the new difference lies outside ; padding must occur only in the final suffix of a tape. The accepting state for the generator is . Induction on the prefix length proves that the machine accepts exactly the padded pairs whose prefix differences stay bounded by and whose final difference is . In particular it correctly recognizes multiplication by for any pair of the chosen combing representatives with adjacent endpoints. Taking accepting state gives the equality machine.
If the combing formal language is regular, take the product with its two word acceptors. These are the usual group multiplier automata, accepting exactly with . From a known representative , a finite-state automaton search with its first tape fixed finds a representative of : existence is guaranteed, so the breadth-first search terminates. Equality is tested by the identity multiplier. Starting with a representative of , repeat these operations over the generators, identifying equal vertices, to build any prescribed finite-radius region of the Cayley graph and all its generator-labelled edges. Iterating multiplication over an input word and testing equality with the identity gives a word problem algorithm.
A bare geometric combing does not imply that is a regular language. Nor can a finite-state automaton recognize the indicated endpoint relation on all words without any restriction: in , which has its usual geodesic synchronous combing, fixing the second word to would make the multiplier for recognize precisely the first words equal to the identity. Intersecting those words with gives , a nonregular language: pumping the initial block changes its exponent without changing the inverse block, contradicting acceptance of precisely the equal exponents. Thus the literal unrestricted-pair request is false; the machines above recognize bounded fellow-travelling pairs, or full representative-pair relations under the additional automatic-language hypothesis.
Nevertheless the final decidability assertion is true for a synchronous combable group, without a regular-language assumption. Here is a terminating filling bound, avoiding any assumption that the given combing is computable. Let be the number of words of length at most over . A horizontal row of the diagram in part (ii) is encoded by its ordered rung words, so there are at most possible row types. If two rows have the same word tuple, delete the band between them and identify corresponding labelled rungs. This preserves the outside boundary and leaves a valid diagram of the same short relators. Equivalently, the first column is always at , so identical rung tuples describe the same vertex configuration. Repeatedly remove such bands. At most distinct rows remain, with at most short-relator cells per layer.
This finite-state row shortening of a combing diagram gives the recursive bound . For the given finite group presentation, every short identity in the finite set has some fixed diagram over its defining relators. Let bound their areas. Replacing each short face by its fixed diagram givesPart 3(ii) now supplies a terminating word decider. This also constructs finite Cayley graph regions for a nonregular combing: enumerate words of bounded length, use the decider on to identify vertices, and use it on to determine the generator edges. The finite ball and transition table of the bounded-difference machines can consequently be computed. The constants depend on a fixed combing and are not a uniform procedure certifying combability of an arbitrary input group presentation. Every finite group presentation of this synchronous combable group has solvable word problem, by the presentation-invariance proof in Q3.
Past exam of the mathematics course of the University of Cambridge 2003 iii Paper 5 4 i Solution Created 2026-10-03 Updated 2026-10-14
Work with a finite symmetric alphabet . If , its path starts at , visits at integer time , travels at unit speed along the intervening generator edges, and stays at its endpoint for .
Two such paths synchronously -fellow travel ifAn asynchronous version permits increasing time reparametrizations. Checking all integer times suffices after a bounded enlargement of for the edge interiors.
A combing of a group chooses a representative word for every , with empty. A synchronous combing has a uniform constant such that representatives with adjacent endpoints satisfy the synchronous fellow-traveller property. A group admitting this is a synchronous combable group. The formal language need not be regular or computable. A regular language of representatives satisfying the synchronous condition instead gives an automatic group. This distinction is relevant to the finite-state automata request in part (iii); the present argument uses the synchronous meaning throughout. The definitions and distinction are also made explicitly in Combings of Groups and the Grammar of Reparameterization, Section 1.
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 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.