← Back to context

Comment by ogogmad

3 years ago

With LLMs revolutionising programming, maybe there's not much room left for using formal methods. Postmortem:

The problem that needed solving: Computer programs make mistakes because they're too literal and they don't understand a programmer's intentions.

The problem they tried to solve instead: Computer programs make mistakes because we don't write out mathematical formulas detailing how programs should behave, and mathematically prove that our programs obey said formulas.

Problems they ignored: First, the problem they tried to solve wasn't the problem they were given -- this would be OK if the researchers produced usable methods on time. Second, if the formula is sufficiently detailed, it becomes effectively an executable program in its own right, and so you're back to square one. Thirdly, the formula might not capture a programmer's intent either.

How they tried solving it: Spent 60 years not producing nearly any working product, except for final-year-projects done by their Bachelor's students. Published endless papers in conferences and journals*. Spent a few decades telling the software industry that it should drop everything and use formal methods.

Assessment: Like a lot of software engineering fads that are promised as panaceas, this probably had a niche application somewhere, but its problems were ignored by its advocates and it underdelivered.

* - Some of the theory they worked on was interesting in its own right: Type theory, constructive logic, computerised proof assistants, computable topology (and domain theory), substructural logics, some category theory, etc. I just think that now that LLMs are revolutionising programming, it's too late for this stuff to deliver anything to Software Engineering, and this stuff turned out to be of purely intellectual interest.

> The problem that needed solving: Computer programs make mistakes because they're too literal and they don't understand a programmer's intentions.

> The problem they tried to solve instead: Computer programs make mistakes because we don't write out mathematical formulas detailing how programs should behave, and mathematically prove that our programs obey said formulas.

The problem is documenting the intent of a rule-based system and confirming that it acts as expected.

As every programmer knows, thoroughly defining intended behavior is the meat of impmenting said behavior.

Often refining the intent based on thinking through or implementing intermediate solutions.

This is not just because of the difficulty to make computers behave the way we want to, it includes the difficulty of defining how we want it to behave, too.

There is no silver bullet that can remove ambiguity from human instructions, or always guess "correctly" when missing clear instructions.

Because by definition, what is correct?

LLMs and other generative AI methods are nowhere near replacing the need for better reasoning about software, especially in safety critical systems.

  • Maybe, but I'm not totally convinced: If an AI understands intentions, then it can carry out our intentions without us doing any traditional programming, specified using only plain English, especially in a safety-critical situation where this would probably be the best thing to do. Anyway, how would formal methods measurably help here [EDIT: By here, I mean security critical applications]? And have they shipped anything yet in that area, given that we've been waiting 60 years for them to do that?

    The answer is partially yes, admittedly, with TLA+. What else have they shipped?

    • If, by "here", you mean AI, the answer is "unlikely". I was replying to the GP's assumption that such technology exists for traditional software. It does.

      CBMC exists today, and can be used to enforce function contracts in C, Java, and C++. Similar systems are being tested for Rust.

      Spark is a subset of Ada that incorporates function contract enforcement using a combination of model checking and a proof assistant. There are commercial projects using Spark today.

      seL4 was built from the ground up using Isabelle / HOL in order to formally verify their process isolation guarantees. There are much easier ways to do much of the work done in seL4 today.

      I use formal methods daily. About 95% of my work is checked using model checking. The rest is extracted to C using Lean 4.

      5 replies →