hn.today

Why Writing Correct Software Is Hard

pron.github.io371 points183 comments
Screenshot of Why Writing Correct Software Is Hard

Writing correct software requires understanding its behavior, but computation has fundamental limits that prevent complete analysis of arbitrary programs. The discussion connects these limits to Hilbert’s effort to formalize mathematics and Gödel’s incompleteness theorems, then explains the halting problem: no algorithm can decide for every program and input whether execution will stop. The same obstacle applies to deciding whether a program reaches a particular state or has any non-trivial behavioral property, such as always producing the square of its input. These are not merely shortcomings of current tools; they are impossibility results.

The Busy Beaver argument shows that verification difficulty grows beyond any computable bound: as program size increases, the longest execution among programs that eventually halt cannot be calculated, and neither can the worst-case size of the shortest proofs that they halt. The discussion also distinguishes undecidable analysis from limits on proof itself. A program that searches ZFC’s theorems for a contradiction would stop exactly if ZFC were inconsistent; assuming ZFC is consistent, its non-termination cannot be proved within that system. Such behavior can occur in compact programs, not only enormous ones. The central point is that verification tools can help, but correctness carries unavoidable costs: some programs’ behavior cannot be decided or proved using a fixed formal system, regardless of effort.

Read on pron.github.io183 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Ggml v1.0.0

Ggml v1.0.0

ggml 1.0.0 removes deprecated public APIs and legacy DIAG_MASK operations, while adding configurable YaRN truncation and FP8 support. It also improves backend performance with quantized matrix multiplication, fused MoE operations, and new attention and scheduling paths. (github.com)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.