AQA 7517, section 4.4.4.6
So far we have looked at problems that can be solved, even if some take far too long. But there is a more serious limit: some problems cannot be solved by any algorithm at all.
Computable problems
A problem is computable if there exists an algorithm that solves it, that is, one that always gives the correct answer in a finite number of steps.
Most everyday problems are computable: adding numbers, sorting a list, finding the shortest route, searching text. Computable problems can be tractable (solved quickly) or intractable (solved, but only slowly).
Non-computable problems
A problem is non-computable if no algorithm can solve it, however much time, memory or processing power is available. This is not about speed. It's about whether a solution is possible at all.
The best-known example is the halting problem (4.4.4.7): deciding whether any given program will eventually stop or run forever.
Intractable and non-computable: the difference
These two ideas are easy to confuse.
| Intractable | Non-computable | |
|---|---|---|
| Does an algorithm exist? | Yes | No |
| Can it be solved in principle? | Yes | No |
| Problem | It takes too long (worse than polynomial) | It is impossible whatever the resources |
| Example | Travelling salesperson with many cities | The halting problem |
| A faster computer... | still wouldn't help much for large | would make no difference at all |
So an intractable problem is hard in practice, while a non-computable problem is impossible in principle.
How do we know a problem is non-computable?
Mathematicians such as Alan Turing and Alonzo Church showed in the 1930s that there are well-defined problems that no algorithm can solve. Turing did this by studying an abstract model of computation, the Turing machine (4.4.5.1), and proving results about what it can and cannot do.
Importantly, this doesn't mean that nobody has found the algorithm yet. It's proved that none exists.
Why does it matter?
- It tells us that computers have limits. They can't do everything, however fast they become.
- It stops us wasting effort searching for an algorithm that cannot exist.
- It shows that, for example, no program can perfectly decide, for every program, whether it will ever stop, so there can't be a perfect tool to catch all infinite loops.
Worked example
Task: classify each problem as computable but tractable, computable but intractable, or non-computable.
- Sorting numbers. Computable, and tractable: merge sort runs in .
- Checking every possible route for 40 cities to find the shortest. Computable (just try them all) but intractable: routes is far too many.
- Deciding whether an arbitrary program will halt for a given input. Non-computable: it has been proved that no algorithm can solve it for every program.
Exam tip: don't mix up the two. Non-computable means that no algorithm exists, which is unrelated to how long it would take. Intractable means an algorithm does exist but is too slow to be practical.
Check yourself
What is a non-computable problem?
A problem that cannot be solved by any algorithm, however much time and computing power is available.
What is the difference between an intractable problem and a non-computable problem?
An intractable problem has an algorithm, but it takes too long to be practical. A non-computable problem has no algorithm at all.
Give an example of a non-computable problem
The halting problem: determining whether any given program will eventually stop for a given input.
Would a much faster computer help to solve a non-computable problem?
No. The problem has no algorithm, so speed makes no difference.