Why Writing Correct Software Is Hard pron.github.io · 64 points · 20 comments · ...

@best

Why Writing Correct Software Is Hard pron.github.io · 64 points · 20 comments · HN thread

TL;DR Pron (Ron Korenblit, author of the Java-related Galaxy project) argues in a long essay, extended from a Curry On talk, that writing correct software is intrinsically hard because of results from computability and complexity theory: the halting problem, Rice's theorem, bounded halting, and PSPACE-completeness of model checking. He concludes that no general tool or language can make all programs feasibly verifiable, so progress must come from empirical study and ad hoc techniques.

  • Starts from Hilbert's program and Gödel/Church/Turing results, arguing that Hilbert's goal of a decision procedure for all mathematics fails.
  • Shows bounded halting is Θ(n) and that verification is reducible to bounded halting, so it is the hardest problem in computer science in the author's framing.
  • Argues restricting programs to total languages does not help, since every program can be made total with a large counter and the lower bounds still hold.
  • Claims correctness does not decompose: a Goldbach-related 10-line C/Java example shows composition of correct modules can yield an intractable verification problem.
  • Says symbolic model checking is PSPACE-complete, and that no generally useful language makes every program feasibly verifiable.
  • Concludes that since verification cannot be made universal, the way forward is empirical study of how humans write programs and targeted verification of local properties such as memory safety.

Discussion The thread is fairly short and mostly draws on practical experience rather than the article's theory. Early commenters contrast formal correctness with messy real-world inputs, sensors, and workflows, and argue that formal methods should be applied where their cost is justified, such as security, safety-critical, and adversarial software. Other comments take up the article's relevance to AI-generated code, the old 'halting' terminology that no longer matches long-running programs, and a side debate about whether computer science is really about computers. The mood is thoughtful and mostly agreeable, with some pushback on the scope of the claims.

  • Formal correctness has value but must be weighed against real-world messiness (many): Several commenters argue that real systems face unpredictable inputs and imperfect assumptions, so proofs often rest on premises that fail in practice. The useful question is when formal proof pays off compared with its cost. One commenter, with finance experience, describes academic overemphasis on proof that stalled progress.
  • Safety and security software justify verification effort (some): Commenters note that software facing networks, untrusted data, or safety requirements needs proofs of certain properties even if full correctness is out of reach. Military, medical, and industrial systems are cited as cases where abstract correctness has long been required.
  • The article is relevant to AI-generated code (some): One commenter reads the essay as a limit on token-based and LLM systems producing verified software, while another says it is refreshing to see formal verification discussed apart from hype about AI writing proofs.
  • Halting problem terminology is misleading for modern software (a few): A commenter points out that most modern programs are meant to run indefinitely, so 'halting' suggests hanging or deadlock rather than termination, and says CS jargon often translates poorly to software development.
  • Computer science is not about computers (a few): A quoted professor line that computer scientists relate to computers as astronomers relate to telescopes sparks a short debate, with some saying telescopes are central to astronomy and others agreeing the tools are not the object of study.

Links from the comments

#formalVerification #halting #computability #complexity #softwareCorrectness