Theory of Computation · Decidability and Undecidability
Computability of Functions
Overview
Computability is a property of functions: a function is computable when some algorithm (equivalently, some Turing machine) computes it.
It is nearly identical to decidability, which is stated for yes/no problems rather than for functions, and the two terms are sometimes used interchangeably.
Key concepts
- Computability: the property of a function.
It is closely related to decidability; the two concepts are nearly identical and are sometimes used interchangeably, with only a minor difference: computability is stated for functions, while decidability is stated for problems (whose answer is yes/no). - Function: a rule that, given an input, computes some output. Example: ; given , the function computes the value.
- Computable function: a function is computable if there exists an algorithm (equivalently, a Turing machine) that computes it.
- Algorithm (in this context): a Turing machine that halts. So "there exists an algorithm" is the same as "there exists a Turing machine which halts".
- Domain: the set from which inputs are picked. The domain is very important: once it is fixed, the requirement is that for all inputs from the domain the Turing machine must halt with the output on the tape.
Only then is the function computable. - Functions need not be arithmetic formulas: a function can also be a task such as sorting — all the numbers are given on the tape, and the Turing machine must sort them and keep them in ascending order.
This is also a function: it takes a set of natural numbers and produces a set of natural numbers, so both domain and range are the natural numbers.
How it works
- An algorithm here means a Turing machine that halts; "there exists an algorithm" is the same as "there exists a Turing machine which halts".
- Turing-machine formulation of computing a function:
- The input is written on the tape of the Turing machine.
- The machine processes it and produces the output on the same tape.
- The machine halts for every input given.
- Formal definition of computability: take a function defined on a domain.
If there is a Turing machine which, given any input from the domain on its tape, produces the output on the tape and definitely halts for every input chosen from the domain, then the function is called computable. - The domain is very important: once the domain is fixed, the requirement is that for all inputs from the domain the Turing machine must halt with the output on the tape. Only then is the function computable.
- A function can be any input–output task, not only an arithmetic formula: for sorting, the Turing machine must sort all the numbers given on the tape into ascending order; if it can solve that function for all inputs from the domain and definitely halts, the function is computable.
Formulas
- — example function: given , it computes .
- Computability condition: there exists a Turing machine such that for every input in the domain, started with on its tape writes the output on the tape and halts.
Worked examples
Example 1:
- Domain: the set of all numbers / set of all integers (as stated for this example).
- Range: a subset of the positive integers.
- Meaning: given , the function computes .
- The function is computable if a Turing machine exists which, with on its tape, writes on the tape and halts, for every in the domain.
Example 2: Sorting a set of natural numbers
- Input: a set of natural numbers placed on the tape.
- Output: the same numbers arranged in ascending order on the tape.
- Domain = natural numbers; range = natural numbers.
- The function is computable if a Turing machine sorts every input from the domain and halts.
Comparison
| Concept | Stated for | Answer type |
|---|---|---|
| Computability | functions | output value computed by an algorithm |
| Decidability | problems | yes/no |
The two concepts are nearly identical and are sometimes used interchangeably, with only this minor difference.
Revision summary
- Computability is defined for functions; decidability is defined for problems (yes/no answers).
- A function is computable if there exists an algorithm (a halting Turing machine) that computes it.
- Turing-machine view: input on the tape → output on the same tape → machine halts.
- The domain must be fixed, and the machine must halt for every input from the domain — halting on all domain inputs is essential to the definition.
- A function can be any input–output task (e.g., sorting), not only an arithmetic formula; domain and range can both be the natural numbers.
- "There exists an algorithm" means "there exists a Turing machine which halts" — halting is part of the requirement, not optional.
Previous-year exam insights
- A total function f: A* → B* is computable iff its graph language = { x#f(x) : x in A* } is recursive (decidable);
for total f, being merely r.e. is already equivalent (search for y with x#y in ).
For a partial function, f is partial computable iff is r.e.
Asked inGATE 2017 - If f is a computable total function then its graph language is recursive, hence also r.e.
Conversely, if f is total and is r.e., then f is computable (dovetail over candidate y until x#y is accepted); for a partial function, f is partial computable iff is r.e., while a recursive is sufficient but not necessary.
Asked inGATE 2017 - A partial function is computable (Turing-computable) if some TM halts with the correct output on exactly the inputs in the function's domain and diverges elsewhere; totality (halting on all inputs) is a separate, stronger requirement.
Asked inGATE 2017 - The set of computable functions is countable while the set of all functions from N to N is uncountable, so non-computable functions exist (e.g., the halting-problem-related function).
- Standard undecidability facts to pair with computability: the halting problem is r.e. but not recursive, and its complement is not r.e.; a language is recursive iff both it and its complement are r.e.
(Post's theorem). - Rice's theorem: every non-trivial semantic property of r.e. languages (equivalently, of the function computed by a TM) is undecidable; only trivial properties (always true or always false) are decidable.