Stephen Wolfram explores a theoretical foundation for software bugs using concepts from ruliology and computational irreducibility. Starting with simple Turing machines and cellular automata, he demonstrates that even minimal programs can produce unexpected outputs — bugs — that only manifest at specific inputs (e.g., n=63 for a 4-state Turing machine). The core argument is that computational irreducibility makes it fundamentally impossible to predict all program behavior without running it, meaning bugs are an inevitable consequence of any computationally non-trivial program. Wolfram examines formal proof techniques (equational logic, type theory via Lean) for verifying bug-free behavior, showing these work only in pockets of computational reducibility. He also discusses the failure of 'ruliological induction' (assuming observed behavior always holds), parallels with mathematical counterexamples, and practical implications for language design, testing, AI-generated code, and software verification. The piece argues that well-designed high-level languages (like Wolfram Language) reduce bugs by packaging irreducibility into primitives, and that visualizing program internals is often more effective than formal proofs alone.

41m read timeFrom writings.stephenwolfram.com
Post cover image
Table of contents
“My Program Did the Wrong Thing!”Bugs in Turing MachinesWhat Counts as a Bug?A Cellular Automaton ExampleCan One Tell If There’s Going to Be a Bug?But What about Formal Proofs?Computational Irreducibility and BugsDid I Test Enough Cases? The Failure of Ruliological InductionSome Typical Ruliological SurprisesMathematical “Bugs”Bugs in PracticeThanks
362 Impressions