Universal Algorithms and Uncomputability
Chapter overview: Universal computation allows one mechanism to simulate arbitrary encoded computations. Diagonalization and related arguments show that some well-defined problems cannot be solved by any algorithm.
7.1 Universal Algorithm
Introduction / Definition
A universal algorithm is a general procedure that can simulate other algorithms when given their descriptions and inputs as data. This idea separates the description of a computation from the mechanism performing it. Modern general-purpose computers embody this principle at a practical level.
Syntax / Structure / Formula
- U(description(A), input x) = A(x)
Detailed Explanation
A universal interpreter can receive a program and its input and execute the program. The same underlying machine can therefore run many different algorithms.
Example
Program P: compute factorial
Input: 5
Universal procedure simulates P(5)
Output / Result
Result: 120.
Important Points / Notes
- Program descriptions can be treated as data.
- Universality is central to general-purpose computing.
- Simulation may add overhead.
Mini Practice Question
What two pieces of information are needed to simulate a particular algorithm universally?
7.2 Universal Turing Machine
Introduction / Definition
A Universal Turing Machine (UTM) is a Turing machine that takes an encoded Turing machine and its input and simulates that machine. It demonstrates that a single fixed machine can perform any computation that any Turing machine can perform, given an appropriate encoding.
Syntax / Structure / Formula
- U(⟨M⟩, w) simulates M on w
Detailed Explanation
The input contains an encoding of machine M followed by its input w. The UTM interprets the encoded transition rules and simulates each step.
Example
⟨M⟩ = encoded machine
w = 1011
U(⟨M⟩,1011) simulates M(1011)
Output / Result
The universal machine reproduces the behavior of M on the input.
Important Points / Notes
- Universality depends on an encoding scheme.
- UTM is a theoretical foundation for stored-program ideas.
- It does not make undecidable problems decidable.
Mini Practice Question
Why is the encoded machine part of the UTM's input?
7.3 Diagonal Results
Introduction / Definition
Diagonalization is a proof technique used to construct an object that differs from every object in a proposed complete list. In computability theory, diagonal arguments show that some collections of computational behaviors cannot be captured by an effective enumeration of all decision procedures.
Syntax / Structure / Formula
- Construct d(n) ≠ f_n(n) for each n
Detailed Explanation
The diagonal object is deliberately defined to disagree with the nth listed object on its nth input. This creates a contradiction if the list were assumed to contain every object of the relevant type.
Example
Suppose functions f1,f2,... are listed. Define d(n)=1−f_n(n) for binary outputs.
Output / Result
d differs from f1 at input 1, f2 at input 2, and so on; therefore d is not on the assumed complete list.
Important Points / Notes
- Diagonalization constructs a counterexample.
- It is a general mathematical technique.
- It underlies important uncomputability results.
Mini Practice Question
Why does changing the diagonal value create a contradiction with a claimed complete list?
7.4 Uncomputability
Introduction / Definition
A problem is uncomputable if no algorithm can correctly solve every valid instance while guaranteeing termination. Uncomputability is a limit on what algorithms can do, not merely a statement that a problem is difficult or slow. The halting problem is the classic example.
Syntax / Structure / Formula
Decidable problem: algorithm halts with correct yes/no answer for every input.
Undecidable problem: no such algorithm exists.
Detailed Explanation
The halting problem asks whether an arbitrary program P halts on input x. Turing showed that no algorithm can correctly decide this for all program-input pairs.
Example
HALT(P,x) = YES if P eventually halts on x; NO otherwise.
No total algorithm decides HALT for all P,x.
Output / Result
No universal halting decider exists.
Important Points / Notes
- Uncomputable ≠ merely expensive.
- Undecidability is a proof-level limitation.
- Many undecidability proofs use reduction or diagonalization.
Mini Practice Question
Why can't the halting problem be solved by simply simulating every program forever?
7.5 Gödel Theorem
Introduction / Definition
Gödel's incompleteness theorems show limitations of sufficiently expressive, consistent formal mathematical systems. Roughly, the first theorem states that such a system contains true statements that cannot be proved within the system, under its assumptions. The results are related conceptually to self-reference and computability but are not identical to the halting theorem.
Syntax / Structure / Formula
- Formal system S → sufficiently expressive + consistent ⇒ incompleteness phenomena
Detailed Explanation
Gödel constructed statements that effectively refer to their own provability status. This demonstrated that formal systems powerful enough to express arithmetic cannot, under standard assumptions, prove every true arithmetic statement.
Example
A Gödel-style statement G is constructed so that, informally, G says “G is not provable in S.”
Output / Result
If S is consistent under the theorem's assumptions, G cannot be proved in S, illustrating incompleteness.
Important Points / Notes
- Incompleteness is about formal proof systems.
- It is not simply the statement that mathematics is false.
- Gödel's results and Turing undecidability results are closely related historically and conceptually.
Mini Practice Question
How does incompleteness differ from ordinary computational inefficiency?