Halting Problem in Theory of Computation (original) (raw)

Last Updated : 13 Apr, 2026

The Halting Problem is a fundamental concept in the theory of computation. It deals with determining whether a computer program will halt (terminate) or run indefinitely when executed with a given input. A program is said to halt if it completes execution by accepting or rejecting the input, rather than entering an infinite loop.

To understand better the halting problem, we must know Decidability, Undecidability and Turing machine, decision problems and also a theory named as Computability theory and Computational complexity theory. Some important terms:

**Proof by Contradiction

**Problem statement: Can we design a machine which if given a program can find out if that program will always halt or not halt on a particular input?

**Solution:

**1. Assumption: Suppose we can design such a machine, called **HM(P, I), where:

When provided with these inputs, HM will determine whether program P halts or not.

**2. Constructing a Contradiction: Using HM, we can create another program, called **CM(X), where **X is any program passed as an argument as shown in figure.

**3. Behavior of CM(X): In CM(X), we call HM with inputs (X, X), meaning we pass program X both as the program and as its input. HM(X, X) will return either "Halt" or "Not Halt."

**4. The Contradiction: Now, consider what happens if we pass CM itself as an argument: **CM(CM).

In both scenarios, we face a contradiction. Therefore, our initial assumption that such a machine HM could exist must be false. Hence we can conclude that Halting Problem is undecidable. No general algorithm can determine whether every program will halt or not.