IT lexicon Programming Halting problem

Halting problem

Programming På svenska → Updated: 2026-05-25

Is there an algorithm that, given any code, can determine whether the code will terminate or run forever? Alan Turing (1936): no, impossible. Classic undecidability proof.

Proof technique: assume Halt(P,I) exists; construct P' that runs Halt(P', P') and does the opposite → contradiction. Practical consequences: static analysis can never perfectly detect infinite loops, undefined behavior, etc. Must always use heuristics + bounds. Rice's theorem generalizes: all non-trivial semantic properties of programs are undecidable.

← Back to the lexicon