A Turing machine with only 1,919 control states—roughly equivalent to a 100-to-200-line Python program—has been shown to possess behavior that is mathematically independent of the Zermelo-Fraenkel set theory (ZFC) system. This demonstrates that even relatively small pieces of software can reach a level of complexity where their correctness cannot be proven by current mathematical frameworks, regardless of the tools used.

The Collapse of Hilbert's Program

In the early 20th century, mathematician David Hilbert sought to formalize all of mathematics into a consistent and complete system. He believed that any property of a formal system could be fully understood and decided by an algorithm. This optimism was dismantled by Kurt Gödel's incompleteness theorems and the subsequent work of Alonzo Church and Alan Turing.

The resulting Halting Theorem—the first major theorem of computer science—proved that there is no algorithm capable of deciding if any given program will ever stop. This established a fundamental boundary: some computational behaviors are inherently undecidable.

“The cost of correctness – like the energy cost of reducing entropy – is a result of the “natural laws” of computation, that cannot possibly be avoided.”

— Why Writing Correct Software Is Hard

Quantifying the Difficulty of Verification

The difficulty of verifying software can be measured through the 'Busy Beaver' theorem. This theorem defines a non-computable function that represents the maximum number of steps a halting Turing machine with a specific number of states can take. Because this function is non-computable, there is no general 'shortcut' or algorithm that can predict the behavior of all programs of a certain size.

Similarly, the maximum size of a minimal proof of termination for a program of size n is also non-computable. This means the effort required to prove a program's correctness grows faster than any computable function, creating a 'cost of correctness' that cannot be bypassed by better engineering alone.

Small Programs and Mathematical Independence

The limitations of software verification are not just a matter of scale; they exist even in small programs. Using Gödel’s second incompleteness theorem, researchers have constructed programs that are 'independent' of ZFC. These programs are designed to search for a contradiction in the axioms of mathematics; if the system is consistent, the program never halts, but this fact cannot be proven within the system itself.

Because these programs are small—often under 200 lines of code—they serve as a concrete example of how software can reach a point where its behavior is mathematically indeterminate. This suggests that for certain complex logic, the limitation is not a lack of computing power, but a lack of mathematical provability.

A Venn diagram illustrating the relationship between computer programs and mathematical concepts.
A visual representation of the distinction between computer programs and formal mathematics.pron.github.io

This image illustrates the conceptual boundary between computer science and mathematics discussed in the article.

Computation as a Physical Process

While these results are rooted in abstract logic, they are tied to the physical world through the Church-Turing thesis. This thesis suggests that any computation performed by a physical process can be simulated by a universal computational model. Therefore, the theoretical limits of Turing machines directly translate to the practical limits of any physical computer.

A diagram representing the Church-Turing Thesis.
A diagram illustrating the Church-Turing Thesis and its implications for physical computation.pron.github.io

This diagram supports the discussion on how abstract logic translates to physical computation.

The distinction between mathematics as a tool and computation as a physical process is vital. Because an algorithm is something carried out in the physical world, the 'natural laws' of computation dictate that programs are fundamentally at odds with full, automated understanding and absolute correctness.