A machine's halting times admit a total computable function as a bound on all inputs in its domain if and only if that domain is a computable set. A bound decides the domain by finite simulation; conversely, a domain decider allows returning zero outside the domain and the exactly simulated halting time inside it. In particular every machine computing a total computable function has an exact computable running-time function, while nontotal machines may or may not have total bounds.
Computable colouring 2026-10-07
A colouring is computable when an algorithm sorts the finite input subset, computes its colour and terminates. Its colour classes are uniformly computable sets. The distinction between existence of an infinite homogeneous set for a colouring and effective construction of one is a basic phenomenon in computability theory.
Homogeneous set for a colouring Created 2026-10-07 Updated 2026-10-14
For a colouring of the -element subsets of a set , a subset is homogeneous if all its -element subsets receive the same colour. The infinite Ramsey theorem for r-sets guarantees an infinite homogeneous subset when , is positive and the number of colours is finite. This does not guarantee a computable set when the colouring is computable.
A partial computable function is the function computed by a finite program, with an undefined value when its computation never terminates. A total computable function terminates on every input. Fix an effective enumeration of the partial computable functions, with a universal partial computable function . Composition, primitive recursion and unbounded minimization give a machine-independent description of this class. Unbounded minimization is allowed to diverge. The S-m-n theorem permits parameters in a program to be specialized effectively: an algorithm described uniformly in has an index obtained computably from .
The halting set is computably enumerable: simulate all computations in parallel and enumerate each index whose diagonal computation terminates. It is not a computable set. Otherwise the program which terminates exactly when the proposed decision procedure says its own diagonal computation does not terminate gives a contradiction. There is also no effective enumeration consisting exactly of all total computable functions: from such an enumeration the total computable function differs from every listed function. Thus the effective enumeration of partial programs cannot be replaced by a decidable catalogue of total ones.
For the Rice theorem, let be a nontrivial property of partial computable functions, depending on the computed function rather than the program text. First suppose the nowhere-defined function is not in , and choose a program computing some . Uniformly in , define a program which, on input , first waits for to terminate and then runs the computation of . The S-m-n theorem gives a computable index map , and
Consequently a decision procedure for membership in would decide the halting set. If the nowhere-defined function belongs to , apply the same argument to its complement. Every nontrivial extensional property of partial computable functions has an undecidable index set. Syntactic properties of program descriptions are outside this assertion, and the theorem concerns unrestricted program indices, not merely an assumed list of terminating programs.
Here is an explicit Jockusch triple coloring computing the halting set. Choose computable increasing finite stages with union . For , put
This is a computable colouring. An infinite monochromatic set cannot have color : fix its first element and choose two later elements beyond the stage at which stabilizes. Their triple has color .
Suppose is infinite and homogeneous of color . To decide whether using , find with , and then with . For every above , homogeneity gives . Such are unbounded, so . Testing therefore decides . Hence every homogeneous set computes the halting set, and there is no infinite recursive monochromatic set. The infinity qualification is essential: finite homogeneous sets are recursive.
The printed arrow is a partial-function arrow. Thus the central objects are partial computable functions , with total computable functions as the special case in which every input has an output. Here includes zero; changing this convention by a computable shift changes none of the results. A program computing must halt with output exactly on its domain, and run forever elsewhere. A finite program is a function in intension, whereas its possibly partial input-output map is a function in extension; many programs have the same extension.
A precise machine model is a register machine with finitely many instructions to increment a register, decrement it conditionally, jump, and halt. Registers hold natural numbers. A Turing machine instead uses a finite transition table, a finite alphabet and an unbounded tape. These models simulate one another: encode the finite nonblank tape, state and head position as numbers for the register simulation; conversely represent each register by a finite tape block and implement its increment and decrement by finite scans. Tuple inputs can be encoded by a primitive recursive pairing function. The equivalence of these formal models is a mathematical result. Their identification with every informal effective procedure is the Church–Turing thesis, rather than an additional mathematical theorem about an already formal notion.
There is also an algebraic description. Begin with zero, successor and projections, close under composition of partial functions and primitive recursion, and then under unbounded minimization. The primitive recursion scheme is
Applied within the primitive recursive class it produces only total functions, by mathematical induction on . Unbounded minimization searches for the first zero of ; its output is defined only if that search reaches such a zero with every preceding necessary computation defined. Composition is likewise strict about the intermediate values it requires. These schemes compile into machine programs using finite subroutines, loops and an unbounded search loop.
For the converse, encode a machine's finite configurations and finite computation histories using Gödel numbering. Testing that a history starts with the specified input, that every adjacent pair follows the transition table, and that its final configuration halts is primitive recursive: all the tests are bounded by the finite code. Extracting the final output is primitive recursive too. For a suitable checking predicate and output decoder this proves the Kleene normal form theorem:
The symbol means equality of values and of definedness. A halting computation has a passing history code and every passing history has its actual output; a nonhalting computation has none. This proves that the partial recursive and machine-computable functions coincide, including their domains of divergence.
Finite programs can be effectively listed. Simulating the program with index gives a universal partial computable function . Fixing some inputs is effective syntactically: prepend instructions writing those constants and then call the original program. This proves the S-m-n theorem in this machine presentation. In particular, reductions that construct a program from numerical parameters really do produce its index effectively.
The primitive recursive functions are a proper subclass of the total computable functions. Enumerate all valid unary primitive recursive descriptions, interpreting invalid descriptions as zero. Evaluating any fixed valid description terminates by structural induction. Thus the diagonal map is total and computable, but cannot be one of the enumerated primitive recursive maps, since . This is a total computable diagonal over primitive recursive syntax. The evaluator can terminate on every particular description without itself being primitive recursive.
In contrast, one cannot effectively enumerate exactly the programs for all total computable functions. If such an infinite enumeration were available, wait for its th program and run it on , then add one. Totality makes this another total computable function, while its diagonal disagrees with every listed function. Equivalently, there is no total computable universal evaluator listing precisely all total computable maps.
The halting problem is undecidable. If decided whether program halts on , construct a program which halts on input exactly when says that it does not halt. Taking to be 's own index gives a contradiction. The halting relation is nevertheless computably enumerable, since finite halting histories can be searched for.
More generally, a set is computably enumerable exactly when it is the domain of a partial computable function. From an enumeration, halt on when appears; in the other direction use dovetailing over all inputs of a partial program to enumerate its halting inputs. A set is a computable set exactly when both it and its complement are computably enumerable: dovetail the two searches and return the answer from the one that succeeds. Neither a semidecision procedure nor an unbounded search supplies a uniform negative answer.
Finally, the Rice theorem explains the scope of this obstruction. Let be a nontrivial property of the extension of a partial computable program. Choose a partial computable whose -status differs from that of the nowhere-defined function. Given a program and input , effectively form the program which, on , first waits for to halt and then computes . If never halts its extension is nowhere defined; otherwise its extension is . A decision procedure for would therefore decide the halting problem. Effective descriptions allow universal simulation and positive verification, but not a decision procedure for every semantic property or for termination.
Take and fix a standard effective enumeration of the unary partial computable functions by program texts. Write
The diagonal halting set is not a computable set: a supposed decision procedure would give a program that halts on input exactly when , contradicting its own index. Each is finite and uniformly decidable by bounded simulation of a computation, and with union .
For , define the computable colouring
This is a two-part decidable set partition on three-element subsets: sort the three inputs and perform the two finite simulations. Here . The halting-stage colouring of triples cannot have an infinite homogeneous set for a colouring of colour . Indeed, fix its least element . The finitely many bits of eventually stabilize. Choose two later elements of the putative homogeneous set for a colouring beyond that stabilization stage; the corresponding triple has colour .
Now suppose is an infinite homogeneous set for a colouring of colour . Its membership oracle computes : to decide whether , search for with , and return whether . For every above , homogeneity gives . Since is unbounded, taking such arbitrarily large proves that this common finite set is . Thus
If were a computable set, the displayed Turing reduction would decide , a contradiction. The displayed decidable two-colouring has no infinite decidable homogeneous set.
For the second construction, let be the finite binary strings, with coordinates starting at , and define the computable binary tree
Membership is decided by finitely many tests using bounded simulation of a computation. It is a binary tree of finite strings: if a string satisfies the tests, each prefix satisfies its shorter and fewer tests. The infinite paths through a binary tree are exactly
This set is nonempty: at a coordinate whose diagonal computation halts with a binary value choose the other value, and choose either bit elsewhere. This is an existence argument, not a proposed computable decision procedure for convergence. No member is a total computable function. If were a total binary-valued function, the condition at would say . Thus each member is a binary diagonally noncomputable function.
Moreover, has no isolated point. There are arbitrarily large indices of programs that never halt: for example, distinct program texts with successively more unused instructions followed by an infinite loop provide infinitely many such indices in the usual syntactic program coding. At every one of these coordinates the bit is unrestricted. Given any and any prefix length , change its bit at one such index and leave all other bits unchanged. The resulting different path still belongs to and has the same length- prefix. Since a path space is closed in Cantor space, is decidable, is nonempty and perfect, and no infinite path is computable.
There is a definition issue with the adjective “perfect”. The preceding conclusion uses perfect path space, allowing finite dead ends in the decidable presentation. If “perfect tree” instead requires every node to have two incompatible extensions in the tree, the requested combination is impossible. Such a nonempty tree has no terminal nodes. Starting at the empty string, test the two immediate successors and choose the first that belongs to the tree; one always exists. This constructs a total computable function whose successive prefixes remain in the tree. Thus computable pruned binary trees have computable paths. Our necessarily has dead ends; its subtree consisting only of prefixes of infinite paths is perfect in the pruned sense but is not decidable. The construction therefore supplies the intended perfect closed path space and also resolves the stronger, inconsistent interpretation.
Let enumerate all computably enumerable sets, with finite uniformly computable approximations increasing to . For example, take and
We construct a simple set by meeting the requirements : if is infinite, then . Begin with no enumerated elements and all requirements unmarked. At stage , process in this order. For an unmarked , if there is an with , enumerate the least such into and mark permanently. All membership tests at a stage are finite, and marking requires no test for eventual infinitude. The sparse-witness construction of a simple set therefore gives a computably enumerable set ; it is semidecidable by simulating this enumeration and halting when the input appears.
Each requirement enumerates at most one element. If an element in is enumerated by , then , so . At most elements of that interval can therefore enter , even if some requirements choose the same element. Consequently
The complement of a set is infinite.
If is infinite, it contains some , and that element eventually belongs to at a stage with . If has already acted, it already placed an element of in . Otherwise it acts by this stage and does so now. Thus every infinite semidecidable set meets . Equivalently, its infinite complement of a set is an immune set. The constructed is semidecidable, coinfinite, and meets every infinite semidecidable set.
As a useful check on the construction, cannot be a computable set. If it were, its infinite complement of a set would also be a computably enumerable set disjoint from , contradicting the property just proved. The argument requires neither deciding which are infinite nor protecting a prechosen infinite list of omitted numbers; the numerical witness bound provides all the required room.
Fix an effective enumeration of partial computable functions, implemented by deterministic machines, and put
These are disjoint computably enumerable sets. To see that they are recursively inseparable sets, suppose a computable set contains and avoids . Its indicator function has some index . If , then , contradicting that output. If , then , contradicting . Thus neither output is possible.
Let be a nonstandard model of Peano arithmetic. A recursive presentation of a structure here means a presentation on in which its arithmetic operations are total computable functions; equality of presentation codes is ordinary equality. Write for the element represented by the standard numeral . The presentation codes of are fixed constants, so is a total computable function obtained by repeated addition. Presentation codes and the arithmetic values they name must be kept distinct.
Use bounded simulation of a computation predicates saying that machine , on input , has halted by time with output . We can choose these as primitive recursive predicates represented in Peano arithmetic. Determinism and induction on the computation length give, provably in Peano arithmetic, monotonicity in and
A genuine standard halting computation has a finite certificate which Peano arithmetic verifies. Consequently, if or , the corresponding holds in for some standard .
Choose a nonstandard element of . It exceeds every standard numeral. Let be the th prime number, starting with . Peano arithmetic proves the prime-divisibility coding of a finite set needed here: for each , an element can be formed as the product of precisely those with for which holds. Formally,
This is an internally finite product, not a claim that its externally observed index set is finite. Its existence follows by mathematical induction on the cutoff: start with , multiply by the next distinct prime number when its predicate holds, and otherwise retain the product. Unique prime factorization ensures that earlier divisibility decisions are preserved. The standard prime enumeration and these finite-product constructions are provably total in Peano arithmetic.
Define the external subset . If , its standard halting time is below , and monotonicity gives , so . If , its output-one certificate and the provable incompatibility above exclude , so . Hence separates and .
Finally is a computable set. Given standard , compute the ordinary integer and its numeral in the presentation. Enumerate all presentation codes , and for each test the finitely many standard remainders for
Each test is decidable using the assumed total computable functions. The division theorem of Peano arithmetic guarantees a quotient and a remainder below the standard numeral . Every element below that numeral is one of , so the search terminates; the remainder is unique. Return yes exactly when . This makes a computable set, contradicting the recursively inseparable sets construction. Therefore
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.
A many-one reduction is a total computable function such that
A Turing reduction is an oracle machine which, with membership oracle , halts on every input and computes the indicator function . It may make finitely many adaptive queries on each input. A many-one reduction gives a Turing reduction by a single query, but Turing reducibility allows more general procedures.
The Friedberg–Muchnik theorem states that there are computably enumerable sets with incomparable Turing degrees:
Here is a finite-injury priority construction proving it. Effectively enumerate all Turing functionals . Arrange the requirements in the priority order
Equality would require the Turing functional to be total and give the correct bit at every input; one disagreement or one undefined input defeats it.
Start with and enumerate elements without ever removing them. A strategy has a private witness, a flag recording whether it has acted, and a restraint on its oracle. Every new witness is larger than every previously assigned witness and every current higher-priority restraint. Retired witnesses are never reused. The only possible enumeration of a witness is by its owner, so an unacted witness remains outside its target set.
The strategy for chooses a witness and waits for a stage at which the bounded simulation gives
On seeing this, put into , declare the strategy acted, and impose restraint on , where is the oracle use: one more than the largest queried number, or zero if there were no queries. Initialize every lower-priority strategy, discarding its current witness, acted flag and restraint. An acted strategy does nothing further until initialized. The strategy for is identical with interchanged. Waiting specifically for zero is enough: if the eventual output is nonzero while the witness stays out, it already disagrees with the target indicator function.
For a completely effective schedule, at stage visit the first strategies in priority order. Assign an unassigned witness when visited. Simulate each unacted strategy's computation for at most steps with the current finite oracle. If some strategy can act, perform the first such action and end the stage; otherwise end after all visits. All steps are finite and algorithmic, so the limiting are computably enumerable sets.
Every lower-priority enumeration respects higher-priority restraints. When its witness was chosen it lay above these restraints. Any subsequent action of a higher-priority strategy would have initialized it, so its current witness remains safe to enumerate. The initialization of all lower strategies also removes their obsolete restraints before they can obstruct a legitimate higher-priority action.
We verify finite injury by mathematical induction on priority. The first strategy is never injured and acts at most once. If all predecessors of a strategy act finitely often, there is a last stage when a higher-priority action initializes it. It is subsequently visited, chooses its permanent witness, and acts at most once. Thus it too acts finitely often and all its lower-priority strategies suffer only finitely many injuries. The scheduling cannot starve a fixed strategy: after the finitely many higher-priority actions, all sufficiently large stages visit it.
Consider the final uninjured with witness . If it acts, then permanently, and every later lower-priority enumeration into respects its restraint. No later higher-priority action occurs. The preserved computation is therefore
If it never acts, . Were , the final computation on would halt with zero and have finite oracle use. The finitely many oracle bits it queries eventually stabilize, and a sufficiently late bounded stage simulation would see exactly this zero computation. The strategy would then act, a contradiction. Hence holds in this case too. The same reasoning proves every .
All possible Turing reductions in both directions are excluded. This proves the Friedberg–Muchnik theorem; in particular both constructed Turing degrees are noncomputable, since a computable set is Turing reducible to every oracle.
Fix an effective enumeration of unary partial computable functions. The diagonal halting set is
It is a computably enumerable set: on input , simulate and accept if that computation halts.
Suppose were a computable set. A program could then halt on input exactly when the decider says . Let be its own index. If , the program does not halt, while if , it halts. Both alternatives contradict the definition of . Thus is computably enumerable but not computable.
Let be the diagonal halting set and put
If were a computably enumerable set, then would many-one reduce to , making the complement of computably enumerable. Together with the computable enumerability of , that would make a computable set, a contradiction.
Moreover
If this complement were computably enumerable, would again make computably enumerable. Thus neither nor its complement is computably enumerable.
Rice theorem says that every nontrivial extensional property of programs computing partial functions is undecidable. Equivalently, a nontrivial index set cannot be a computable set.
Let be such an index set. Replacing by its complement if necessary, assume that the nowhere-defined function has no index in . Since the property is nontrivial, choose an index . If membership in were decidable, we could decide the diagonal halting problem as follows. For each , define
By the S-m-n theorem, a total computable function produces an index for . If diverges, then is nowhere defined and . If it halts, then and extensionality gives . A decider for would therefore decide whether halts, a contradiction. Hence is undecidable.
No. The property
is an index set: it depends only on the domain of the partial function computed, not on the syntax of its program. It is nontrivial. For example, an index whose domain is a singleton belongs to , whereas an index whose domain has two elements does not. The Rice theorem therefore shows that is not a computable set, so no algorithm can decide the requested property for arbitrary .
Invoking the Church–Turing thesis, this also rules out any effective procedure in the informal sense, because such a procedure would be represented by a computable function.
Recursive presentation of a structure Created 2026-10-06 Updated 2026-10-14
A recursive presentation identifies the domain of a countable structure with a computable set, with its basic operations given by total computable functions and its basic relations decidable. In a fixed finite signature this makes evaluation of atomic formulas effective. A countable structure may have a recursive presentation of a structure only for some choices of presentation, or none at all.