np hard
1953 United States undecidable
02

Rice's Theorem

Henry Gordon Rice, 1953 — every non-trivial question about a program's behavior is undecidable. Refactoring without breaking is, in the limit, impossible.

Henry Gordon Rice, in his Syracuse PhD thesis, proved a sweeping generalization of the Halting Problem. A semantic property of a program is any property of its behavior — does it terminate, does it produce a given output, does it satisfy a given specification, does it behave like this other program. Rice proved that every non-trivial semantic property is undecidable. "Non-trivial" means there exists at least one program with the property and at least one without. The proof reduces the question to halting. The implication for software maintenance is direct and devastating: the question "does this refactored version behave the same as the original" is a non-trivial semantic property, and is therefore undecidable in the general case. No tool, no compiler, no AI system can answer it for arbitrary programs.

Rice, H. G. (1953). Classes of Recursively Enumerable Sets and Their Decision Problems. Transactions of the American Mathematical Society, 74(2), 358–366. Source →