A proof technique in recursive function theory that is used to prove the unsolvability of, for example, the halting problem. The proof assumes (for the sake of argument) that there is an effective procedure for testing whether programs terminate. Under this assumption the method of diagonalization allows a contradiction to be derived. From this it is deduced that there is no such effective procedure.
The technique was developed by G. Cantor to prove that the cardinality of the real numbers is greater than the cardinality of the integers. In this application the real numbers are enumerated in the form of a grid. A real number is then constructed, using the diagonal of the grid, that is not part of the original enumeration.
The technique was also used by J. Richard to generate a paradox about the namability of real numbers. This paradox (together with the “liar paradox” of antiquity) is reputed to have prompted K. Gödel to apply a similar technique of diagonalization in constructing a number-theory formula not provable in formal arithmetic. See Gödel's incompleteness theorems.