Lately the software industry has been changing like crazy due to AI, and one side effect has been increased interest in software verification. As someone who has been broadly interested analyzing programs ever since I wrote my first compiler a long time ago, it took me for surprise when I started seeing startups pop up specifically targeting correctness of software as an economic problem instead of one mainly interesting to academics. Reasonable, Praamana Labs, Axiom, Harmonic, and Sequent are just a handful of the many recent startups I’ve seen looking at this problem seriously.

The rationale is pretty clear. When individuals and organizations are shipping code at a significantly higher rate, especially relative to the number of software engineers involved, there are simply fewer opportunities for POHI (Plain Old Human Intelligence) to detect bugs and design flaws organically through the development process. That results in a growing correctness gap. We need much stronger tools, mechanisms, and systems to deal with that correctness gap. If we don’t, we will be stuck with more software outages, cyberattacks, etc. Personally, I’m very excited about future developments in this space.

But I’ve also noticed more people sharing online that they’ve used tools like Lean or Rocq to “prove their software is correct.” This sounds like great news, except there’s an issue: software correctness is a very fuzzy concept. We all want to know if our software is error-free (and since AI seems to be pretty good at proving math theorems, using math to prove that facts about programs sounds like a slam dunk!), but what does it mean to be “correct”?

  • Does correct mean it’s memory-safe?
  • Does correct mean it never crashes?
  • Does correct mean it’s fast to run?
  • Does correct mean it never loses data or leaks resources?
  • Does correct mean it calculates results accurately, and/or within some margin of error?
  • Does correct mean it eventually processes every request it receives?
  • Does correct mean it works on both 32-bit and 64-bit machines, and on every distribution of Linux in existence?
  • Does correct mean it’s forever forwards and backwards compatible with all other hardware or software it interacts with, from the beginning of the universe to the end of time?

I’m just scratching the surface here!

Unfortunately, if your program runs in the real world, then you likely care about a lot of these properties. I say unfortunately because if your program were an abstract algorithm like merge sort or Dijkstra’s algorithm, then you could brush them off by claiming your program is running on an abstract computer with infinite memory where every operation has an exact mathematical definition, and so proving correctness would be a cinch! 1

Alas, programs running in the real world depend a lot on how data is stored and represented, and programs run on real hardware with varying levels of reliability, and programs often rely on storage and networking infrastructure that can have faults due to the realities of physics. Furthermore, we’re often interested in not just proving properties about individual programs, but about entire systems where many programs run in tandem, so these issues concerning probabilistic failure only increase.

This is all to say, when someone says they’ve verified a program or proved a program is correct, you should take that claim with a healthy dose of skepticism.

The speaker might mean well! But saying a program is correct says little by itself. It’s a bit like telling your housemate, “yes, I picked up groceries!” without saying what you purchased.

You should ask: what kinds of properties about the program did you prove? What assumptions about the program’s execution did you allow in your proof? Did they prove parts of the program’s functional correctness, or did they also prove that it’s free from memory management bugs? These are the kinds of details that matter and can serve as the grounds for a useful discussion.

  1. I should caveat that the situation isn’t entirely black and white. For example, beyond the abstract models of turing machines and pseudocode, computer scientists have also developed abstract models of many programming languages that faithfully represent most programs written in those languages (for examples, see Featherweight Java or Featherweight Go). But these models still exclude many of the ways that programs can fail (for example, due to interactions with external systems), and many of these formal models haven’t been made accessible programmatically to developers writing code in those languages. ↩