For sets , many-one reducibility means there is a total computable function such that
Turing reducibility means that a Turing machine with oracle computes the indicator function , halting on every input. A many-one reduction supplies a Turing reduction by computing and making one membership query, so implies .
The Friedberg–Muchnik theorem states that there are computably enumerable sets with and . We prove this by a finite-injury priority construction. Fix an effective enumeration of the oracle Turing functionals and arrange the requirements in the order
A requirement owns a private witness, a success flag and a priority restraint on its oracle set. All witnesses ever chosen are distinct. An witness is reserved outside , and only may enumerate that number into ; an witness is treated symmetrically. A priority restraint forbids lower-priority requirements from adding numbers less than to the specified oracle set. Initializing a requirement abandons its witness, clears its success flag and sets its priority restraint to zero; enumeration into or is never undone.
At stage consider the first requirements and serve the highest-priority one requiring attention. An unsuccessful requirement requires attention if it has no witness, or its current witness has a stage- oracle computation with output zero, found within steps. If there is no such requirement, do nothing. When a requirement with no witness is served, choose a fresh number larger than , all previously chosen witnesses and all current higher-priority priority restraints. When an with a witness and observed computation is served, enumerate into , mark it successful, and restrain below the use of that computation. The use is one more than the largest queried oracle position, or zero if there were no queries. An acts in exactly the same way with interchanged. After either kind of service, initialize every currently assigned lower-priority requirement; the remaining lower priorities are already in their initial state.
This is an effective stage construction with finite sets , and , are computably enumerable. Every enumeration respects all higher-priority priority restraints: its private witness was selected above them, and any later service to a higher-priority requirement would have initialized it before it could act. We do not need to restrain a computation whose output is nonzero; a persistent nonzero output already disagrees with an unenumerated witness.
We verify the finite injury assertion by induction along the priority order. After the last service to requirements above a fixed requirement , the requirement is never initialized again. It can be served at most twice thereafter, once to choose its final witness and once to diagonalize. Whenever it needs attention it is eventually served, since the higher-priority requirements have ceased acting and each later stage considers a longer initial segment. Thus has a final witness and makes only finitely many actions; this proves the induction and justifies the assumed last service above it.
For a final witness , if the diagonalization occurs then , while preservation of a restrained oracle computation applies: its zero computation is preserved permanently because higher priorities no longer act and lower priorities respect the priority restraint. Thus . If it never occurs, then . Were , that convergent computation would use finitely many oracle answers. Because increases to , those finitely many answers eventually stabilize, and a sufficiently late stage would discover the zero computation and cause diagonalization. This contradicts its never occurring. So in this case is undefined or nonzero and again disagrees with . The identical argument verifies every .
All the requirements hold, proving the theorem. Both sets are noncomputable: a computable set is Turing reducible to every oracle. Moreover, every computably enumerable set is Turing reducible to the diagonal halting set , and neither nor can have its Turing degree, since that would make it compute the other set. Hence
This also gives many-one incomparability and answers the existence of intermediate computably enumerable Turing degrees.
We use untyped lambda calculus and normal-order beta reduction. The Church numeral for is . A lambda term represents a partial function if on numeral inputs it has the correct numeral normal form exactly when the function is defined. We use a lambda simulation of a Turing machine; this also ensures that undefined computations do not accidentally produce an output through an ignored argument.
First all total primitive recursive functions are lambda-definable. The initial functions of recursion theory are represented by
Composition is obtained by substitution of representing terms. For primitive recursion use Church pairs:
If represent the total functions in and , define
After iterations the pair has components . Thus the Church numeral executes exactly the required recursion steps. Since these functions are total on numeral inputs, substitution for composition causes no undefined-argument issue.
Now fix a deterministic Turing machine computing the given partial computable function. Encode a configuration by its finite control state and two natural numbers for the tape portions on the two sides of the head, allowing blank bits beyond the finite nonblank tape. For the two-stack encoding of a Turing tape with a binary alphabet, let have the immediately-left cell as its low bit and have the current cell as its low bit. Reading and removing a bit use remainder and quotient by two. If the machine writes , the updates are
The new state is obtained from a finite transition table. These operations, the initial configuration, the halting test, and output decoding are total primitive recursive functions on configuration codes. For instance parity alternates by primitive recursion, and the quotient by two satisfies , . A fixed finite alphabet can be handled by the same stack construction in a larger base. Choose a standard delimited input and output convention, for example unary words in a finite tape alphabet with a distinct blank symbol. Initialization is primitive recursive. On a halting configuration the output is a finite word; decoding can be implemented by a bounded scan of the encoded tape, with a default output for malformed words. This is total primitive recursive and introduces no additional unbounded search. Use nested Church pairs to carry the three fields, and the preceding primitive recursive representations to obtain lambda terms .
Represent Church Booleans by and . A Church numeral zero test is . Use a numerical test equal to zero on halting configurations and one otherwise; applying this zero test gives the required Boolean halting test. With the fixed-point combinator
put
Normal-order reduction evaluates the halting test on the current configuration. If it is true, it selects the output branch without evaluating the recursive branch. Otherwise it advances the configuration and repeats. Induction on the number of machine steps shows that a computation halting with output makes reduce to .
If the machine never halts, the normal-order beta reduction repeatedly takes the recursive branch. Each individual configuration transition and test terminates, but there is always another required transition; hence the reduction never reaches a normal form. The normal-order normalization theorem says that a lambda term with a beta-normal form is normalized by normal-order beta reduction. Therefore in the nonhalting case there is no numeral normal form at all. We have proved
Confluence of beta reduction ensures uniqueness of the resulting numeral. This handles genuinely partial computations. Simply composing terms for partial subcomputations would need extra care, because lambda reduction can discard an unevaluated argument.
We give a finite semigroup presentation using the convention that is blank, the tape is unbounded in both directions, and a transition writes and moves in direction . The Turing machine is deterministic, and the halting state has no outgoing transition. A finite configuration is encoded by
with the head scanning the first symbol of ; if is empty, it scans an implicit blank. Unrepresented cells beyond the boundary markers are blank. An additional generator records completed halting and erasure.
The generators of the semigroup are . Its relations have the following finite families. For every right-moving transition, include
For every left-moving transition and every tape symbol , include
If stationary moves are part of the chosen machine model, include for each such move. Include the boundary-padding relations, for every state ,
They supply a blank immediately to the left of the head when needed, or at the right boundary when the current scanned cell was implicit. Finally include
Writing for this displayed list, the answer is the explicit finite semigroup presentation
All relations are between nonempty words; no group inverses or empty-word generator are used. The transition families are finite because the transition table and alphabet are finite, and the padding and erasure families are visibly finite. The declared head convention determines which side of a tape symbol carries a state letter.
If the Turing machine halts on , follow its computation from . A transition at an already represented cell is one of the corresponding relations. At a boundary, first insert the required blank using a padding relation. Thus the computation gives a finite equality derivation to . Replace by , erase the symbols of using , and erase both boundary markers. This proves in the semigroup.
For the converse, equality in a presented semigroup means a finite sequence of contextual replacements using defining relations in either direction. In any derivation from to , consider the first occurrence of the special symbol . Before it occurs, the erasure relations cannot be used in either direction. Each word therefore still has exactly two markers , exactly one state letter, and the form . Both directions of a transition relation join configurations linked by one actual machine step; both directions of a boundary-padding relation merely change how much blank tape is represented.
The first occurrence of must come from in the forward direction. Hence the initial configuration is connected, by transitions in either direction and harmless padding, to a configuration in state . For a deterministic Turing machine, the property of eventually reaching is invariant along each transition edge: if is a step, then halts if and only if halts, since that step is the unique next step of and is not already in the halting state. The same property is unchanged by padding. A finite path of these edges to therefore shows that the initial configuration halts.
Consequently
The invariance argument is necessary because equality in a semigroup presentation allows reversed transitions as well as forward computation steps.
For (1)(a), a primitive recursive function is obtained by a finite construction from the zero function, successor function and projection functions, using function composition in recursion theory and primitive recursion. The recursion rule, with parameters , is
Here have already been constructed. All these functions are total on nonnegative integers: the initial functions are total, composition preserves totality, and ordinary mathematical induction proves totality of each recursion.
For (1)(b), use a shifted hyperoperation sequence, beginning with addition. Define
and, for each fixed , define
The first three members are therefore addition, multiplication and exponentiation:
The exponentiation convention includes , hence . The next member iterates exponentiation, with ; there is no need for an exceptional domain restriction at .
For (1)(c), is a primitive recursive function by its displayed recursion. If is a primitive recursive function, then
are primitive recursive functions, using constants, projection functions and function composition in recursion theory. Primitive recursion applied to gives . Mathematical induction on the fixed rank proves every member of the sequence is primitive recursive. This does not assert that the joint three-variable evaluator is a primitive recursive function.
For (2), as written, the answer is no: the empty set is semidecidable, whereas a total computable function from to always has a nonempty range. This is the only obstruction. To prove the stronger useful statement, suppose is a nonempty computably enumerable set and choose . Fix a Turing machine which halts exactly on the inputs in . Its bounded halting predicate
is primitive recursive: encode configurations arithmetically, iterate its total single-step operation times by primitive recursion, and check the halt state. A halted configuration is kept fixed. This is a bounded simulation, not unbounded waiting.
Fix a primitive recursive pairing function with primitive recursive inverse coordinate functions. For example, the Cantor pairing function has inverses obtained by bounded minimization. Define
The two coordinate functions, the bounded predicate, and the finite case distinction are primitive recursive functions, so is a primitive recursive function. Its values always lie in . Conversely, if , its computation halts within some finite , and . Thus
The range need not be a computable set; deciding whether a value occurs anywhere in this total enumeration is an unbounded search.
Fix an effective numbering of Turing machines and use the diagonal halting set
It is computably enumerable: dovetail all the computations and output each index when its computation halts. It is not a recursive set. Otherwise a machine could, on input , loop if the alleged decider says and halt otherwise. Applying this machine to its own index contradicts either answer. Hence is computably enumerable but not a recursive set.
The machine characterization is computation by a Turing machine: the machine halts with exactly on inputs in the domain of a partial function and does not halt elsewhere. The syntactic characterization is the least class containing the initial functions of recursion theory and closed under composition of partial functions, primitive recursion and unbounded minimization. Such functions are the partial recursive functions, equivalently the partial computable functions.
For clarity, composition here is strict: is defined only when every inner value is defined and is defined on the resulting tuple. Likewise primitive recursion requires all preceding recursive values. The partial minimization is defined when such a exists and all earlier values are defined and nonzero; an undefined earlier value blocks the search.
A lambda-definable partial function is represented by a closed untyped lambda calculus term satisfying
On an input outside its domain there must be no Church numeral beta-equivalent to the result. A stronger representation can be arranged: undefined inputs have no head normal form.
Here are the components for proving that every partial recursive function is lambda-definable. Zero and projections are immediate; lambda definition of the successor function uses . Church Booleans encode a conditional by , with and . Put
Iteration takes to for , proving that encodes the predecessor function and that correctly tests zero.
Use a fixed-point combinator and the strict sequencing operation
For any numeral , reduces to . If the first argument has no head normal form, neither does the whole expression. Thus composition is implemented by nesting on every inner result before applying the outer representing term. This guard is important: an unguarded projection could discard an undefined inner computation.
For lambda definition of primitive recursion, with already represented by , take
The tuple notation abbreviates successive abstractions and applications. On numeral inputs, induction on proves the required recursion equations, including strict propagation of undefined preceding values. The beta reduction follows the selected conditional branch only.
For lambda definition of unbounded minimization, use
This searches in increasing order. An undefined value blocks the zero test; an infinite sequence of nonzero values continues forever; the first zero returns its numeral. Under normal-order beta reduction, both failure cases have no head normal form. Structural induction on partial-recursive declarations now supplies the stronger representation claimed above.
Conversely, beta reduction is an effective operation on finitely encoded lambda terms. Enumerate all finite reduction sequences from , stopping when a result is a Church numeral in beta-normal form. If , the Church-Rosser theorem gives a reduction to that numeral. It also makes the output unique. The enumeration therefore computes exactly the represented partial function; by the equivalence of the first two characterizations it is partial recursive. Hence
A Turing machine has a finite control, an unbounded tape divided into cells over a finite tape alphabet including a blank symbol, and a head that reads one cell at a time. For a deterministic Turing machine, the current state and scanned symbol determine the replacement symbol, a head move one cell left or right, and the next state. The input occupies finitely many cells initially; all other cells are blank. Distinguished halting states report acceptance or rejection.
A formal language is a decidable language if some Turing machine halts on every input string, accepting exactly the members and rejecting all nonmembers:
Halting on the nonmembers is part of the requirement; a machine that merely runs forever on some nonmembers need not decide the formal language.
Cancel one unary symbol from each block at each round. Mark the first, middle and last delimiters by , respectively; use for a cancelled symbol in the left block and for one in the right block. These are extra tape symbols of the Turing machine, all distinct from and blank. No numerical counter is needed in the finite control.
Starting on the first zero, replace it by , scan right through the first block of ones to replace the next zero by , then scan right through the second block and replace its terminal zero by . Move left to . If the initial head is on a blank immediately before the first zero, first move right to that zero. The cancellation loop always starts with the head at :
  • Move right past the symbols. If the next symbol is , all right-hand ones have been cancelled; enter the successful cleanup below.
  • Otherwise that symbol is . Replace it by , move left past right-block symbols to , and continue left past any symbols.
  • If the next symbol is , replace it by . Move right past the symbols back to and repeat the loop.
  • If instead the next symbol is , the left block is exhausted while the right block still needed a cancellation. Enter the zero-result cleanup below.
After completed rounds, the invariant is
It holds initially with , and each completed round changes exactly one remaining in each block into the corresponding marker. This proves the cancellation count and preserves the locations of all delimiters.
For successful cleanup, the right block is entirely symbols. From , sweep right, erasing all symbols and finally , then move left across the erased blanks back to the still-present . Erase and continue left, erasing each , until reaching either the last surviving or . Move one cell right and write the new terminal zero there. Move left through the surviving ones to , replace by , and halt. The remaining nonblank tape is exactly
For example, represents and becomes , representing three.
For zero-result cleanup, the head has reached . Sweep right, erasing everything through while retaining ; after erasing , move left across the blanks to . Replace by , write a second zero in the next cell, and halt. Thus if the machine returns . If , successful cleanup also leaves . With this explicit choice of behaviour,
Each sweep seeks a retained delimiter or an end marker a finite distance away. Each completed round removes one right-block ; after at most completed rounds either cleanup or left-block exhaustion occurs. The stated scans, writes and single-cell moves are implementable by finitely many states, so this is an implementation-level Turing machine construction. The output represents zero; a negative integer cannot be represented in the unsigned unary numeral system specified here.
The halting problem asks, given the encoding of a Turing machine and an input string, whether that machine eventually halts on that input. Its formal language is
Suppose a Turing machine decided this formal language. Construct another Turing machine that, on an input encoding , runs on . If answers that halts on its own encoding, enters an infinite loop. If answers that does not halt, halts. Handling malformed encodings by immediate rejection makes well-defined on arbitrary strings.
Now run on its own encoding. If says that halts, the construction makes loop; if says that does not halt, the construction makes halt. Either answer contradicts the assumed correctness of . Therefore
The contradiction concerns a decider that must give a correct terminating answer for every encoded machine and input. Simulating does detect a halt when one occurs, but cannot in general certify that a running computation will continue forever.
Pi-1 formula Created 2026-09-24 Updated 2026-11-05
A Pi-1 formula in the arithmetical hierarchy has the form , with a decidable predicate; several universal number quantifiers can be combined by coding tuples. In a formal arithmetic presentation, the matrix is taken to have bounded quantifiers, with equivalent computable-predicate normal forms obtained by coding computations.
For example, the assertion that a fixed Turing machine never halts is , where checks that it has not halted in its first steps. A false such assertion has a finite counterexample, while a true one need not have a finite computational certificate. Negating a Pi-1 formula gives a Sigma-1 formula.
Give a nonhalting Turing machine computation halting time infinity. The formal language of pairs satisfying the displayed inequality is a co-recursively enumerable language but is not a recursively enumerable language. A violation has a finite witness: has halted on some input after moves while has not halted by that time. For the other direction, reduce non-halting by making simulate a fixed computation on every input and making run forever. The pair satisfies domination exactly when the fixed computation never halts. The convention is essential to this many-one reduction.
Probabilistic Turing machine Created 2026-09-24 Updated 2026-10-06
A probabilistic Turing machine is a Turing machine whose transitions may depend on independent random bits.
Recursive language Created 2026-10-05 Updated 2026-10-06
A formal language is decidable if a Turing machine halts on every input and correctly determines membership. Equivalently its encoded words form a recursive set. A computably enumerable language requires only a machine that eventually accepts every member; it may run forever on nonmembers.
A finite deterministic Turing machine can be represented by a finite semigroup presentation whose generators are tape symbols, state symbols, a boundary marker , and an accept symbol . Defining equalities replace the local scanned symbol and state according to machine instructions, with separate boundary cases for implicit blanks. Only terminal-state equalities erase tape letters and then replace by . A derivation from an initial description to must encounter a terminal state before its first erasure. Simulation equalities preserve halting membership in either direction: for a deterministic transition , halts if and only if halts. Thus reverse use of defining equalities cannot create a false halting certificate. Boundary and erasure rules require explicit checking for every chosen encoding.
A Turing machine with one read-write tape. Every multitape Turing machine can be simulated by a single-tape Turing machine, using delimited tape portions and marked head positions. The simulation preserves the accepted formal language and whether a computation halts, while possibly increasing time complexity.
Singleton-language problem for Turing machines Created 2026-10-31 Updated 2026-11-05
It is undecidable whether a Turing machine recognizes a formal language containing exactly one word. Reduce the halting problem by a Turing machine that rejects every nonempty input and, on the empty word, simulates a fixed computation and accepts if that computation halts. Its recognized formal language is a singleton exactly when the fixed computation halts.
Space complexity Created 2026-09-24 Updated 2026-11-05
The space complexity of an algorithm measures the maximum working storage used during its computation as a function of encoded input length. A machine-level definition must state which storage counts. In a common Turing machine convention, a read-only input tape and a write-only output tape are excluded, while visited work-tape cells are counted.
For example, count the ones in a binary string of length by scanning once and retaining a binary counter. Its value ranges from zero to , requiring bits for the counter. Keeping a separate copy of the full input would instead require bits. The computation can therefore use much less working storage than the amount of data it examines.
The maximum concerns simultaneously retained storage, not the total amount allocated and later reused over time. Bit complexity and a unit-cost model also need care here: treating an arbitrarily large integer as one storage cell can hide its growing representation size.
Theoretical computer science Created 2026-09-24 Updated 2026-11-05
Theoretical computer science studies computation through mathematical models, algorithms and proofs. Computability theory asks which problems admit algorithms at all; computational complexity theory asks what resources solving them requires. Automata theory, mathematical logic and formal languages describe machines and representations. For example, a finite-state automaton recognizes a language using finitely many states, while a Turing machine provides a more general model with unbounded working storage. Separating a problem's specification from a particular implementation makes it possible to prove both algorithmic upper bounds and impossibility results.
Turing machine Created 2026-09-24 Updated 2026-11-05
A Turing machine is a model of computation with finite control, a tape of cells and a head scanning one cell at a time. An instruction of a Turing machine uses the current state and scanned symbol to determine a new state, a written symbol and a head movement. The finite transition rules form the machine's description; the tape supplies storage without a fixed global bound.
In a standard input convention, a finite word occupies part of an otherwise blank tape. A Turing machine configuration records the state, head position and tape contents, so the next-configuration relation determines each computation step. A machine can accept, reject or continue indefinitely. Recognizing a formal language permits nontermination on some nonmembers; deciding it requires an answer on every input.
The separation between a finite rule table and unbounded reusable storage makes the model useful for proving general statements about algorithms. Alan Turing's 1936 paper introduced this style of machine to analyze effective calculation; its original examples produce successive digits of numbers.[ref] Multitape Turing machines change the storage organization and possible step counts while retaining the same computability power.