"Beware of bugs in the above code; I have only proved it correct, not tried it." — Donald Knuth
Formal correctness does not guarantee desired function. People have written TLA+ specs for their software[1] and not have it materially improve the quality or reliability. You cannot just throw formal verification at a problem.
I am very much of the opinion that crap code is an issue of organisation and aesthetics, and that can be automated. This is something that is enforced by frameworks, and despite the popular consensus that LLMs are good at frameworks because of training data, I make another argument that LLMs are good at them because frameworks massively restrict the possibility space of code that can exist and enforce a consistent organisation and aesthetic. The solution as I see it is to make more restrictive frameworks that have a higher chance of producing desired functionality, then afterward we can worry about correctness.
> Formal correctness does not guarantee desired function
Rust doesn't guarantee desired function either. It doesn't mean that average rust program has the same probability to have segfault at runtime as a similar program written in C.
I don't get this broken logic. A software engineer should have elementary reasoning skills.
"Formal correctness doesn't guarantee desired function, therefore we don't need it."
But in reality it will actually catch bugs, in addition to other verification methods, and give more confidence in software.
> People have written TLA+ specs for their software[1] and not have it materially improve the quality or reliability
That particleDB link is VERY unconvincing. All the folks I know who wrote a TLA+ spec have said that it helped them discover bugs. Just that it was a massive pain to keep maintaining code and spec independently.
However, I am confused on why new PL is needed. Why not just improve lean and its libraries so that it becomes a standard big-software language like Go/Java/Rust ?
Quite ironically I see formal methods being extremely key to your central argument. That is, the design should be started by modelling with some formal language that then gets expanded into an implementation. I fully agree about massively restricting the possibility space of code as being why they work. I've found that to basically be the only thing that produces consistently good results in the face of all the non-determinism. The entire codebase doesn't fit into the context window though, but formal models of it can act as some form of lossy compression that helps it fit into the context window better. I think formal methods definitely have a role to play, as to do anything that restricts what the valid moves are like frameworks and fitness functions etc.
TLA+ proofs are detached from actual implementation.
If you have proofs attached to an actual implementation, things get much, much better.
For example, you can have type-checked distributed APIs (you can't omit a parameter for an HTTP request), you can have adherence to protocols checked at compile time (API calls sequences, etc), you can have many other things to be checked before any program run.
The same limitation is true of every other method of verifying and validating software too. You can have 100% unit test coverage and still have nothing work. It's another tool in the toolkit and a pretty powerful one
> ParticleDB’s home page advertised that ParticleDB was “formally proven” with a TLA+ proof. However, during our collaboration no TLA+ specification was available. It is unclear what properties might be proven, or whether they described ParticleDB as built.
That link is a pretty weak strawman. Also TLA+ is special in that it (usually) does not directly verify the implementation but a model of it.
Formal methods may or may not help you. I remember Amazon or another company using TLA+ on a distributed system quickly found a bug that would've taken over two dozen steps to hit.
The concurrency bugs SPIN and TLA+ find also eat tons of debugging time because they are hard to replicate. They're often called heisenbugs for how they're there and not there depending on the observer.
Static analyzers with low, false positives catch tedious or corner-case bugs developers often miss. That already tells you that any formal method that makes software immune to those big classes will also improve quality. SPARK Ada and Frama-C both do that.
Our first year CS Pascal lecturer in '79 used to quip "I've compiled this but not run it" and I used to think this was savage but I now see he was simply repeating the mantra. The Fortran I did on cards in '76 they insisted we run, and learn the cost of sloppy code in the debug cycle through batch processing cycle costs.
Linked article says they only said they had a TLA+ proof but none was actually provided and the rest of the article makes it clear that ParticleDB is pure vibeslop. I wonder who paid them to test it.
Favourite line:
> Under normal operation, ParticleDB was slow, deadlocked, and crashed without warning.
Thank you. It's ridiculous how some people giddily reach for anything that remotely smells like a solution while unaware that they complicate things even more.
Loosely related: the German TÜV now wants to certify AI systems https://www.tuev-verband.de/pressemitteilungen/tuev-organisa... (original in German, use your favorite translation tool)
I wonder whether such a certificate will be a future requirement for selling or running certain hosted software. It would be hilariously German when the certificate then mandates using formally verifiable programming languages.
> People have written TLA+ specs for their software[1] and not have it materially improve the quality or reliability.
They have said they wrote them, but I doubt it. The quote from the report:
"We found several incompatibilities or bugs involving static or dynamic type safety, or behaviors that would normally have been caught by static analysis of a query, such as referring to a nonexistent column. These issues occurred with a single server, single client, and no faults.
They failed to catch references to a nonexistent column with a formal proof? I doubt it, the more likely explanation they hadn't proven their code, they probably did something that allowed them to claim that they wrote TLA+ specs, and stopped at that.
Formal proof is a static analysis on steroids, if it can't catch bugs that can be caught by a static analysis then what the point of it?
The report doesn't answer how it happened (I presume) because of: "during our collaboration no TLA+ specification was available. It is unclear what properties might be proven, or whether they described ParticleDB as built.
Frameworks often lead to crap code because people don't recognise when they're doing something the framework isn't good at. Do we expect LLMs to be better? So far they're a lot worse and will happily churn out reams of code that would make even the worst programmer stop in their tracks questioning whether this is right.
"You cannot just throw formal verification at a problem."
Oh. Look external stripe calls are hanging. (HALT problem)
> Formal correctness does not guarantee desired function. People have written TLA+ specs for their software[1] and not have it materially improve the quality or reliability.
Boris said they heavily use TLA+ for Claude Code and they've noticed an improvement. Comparing CC with 6 months ago, it has indeed improved in terms of reliability and screen flicker, etc.
As a “creative programmer” I resonate with this strongly. While I think things like Lean and Rust are valuable tools which should exist, they only represent added friction TO ME.
> People have written TLA+ specs for their software[1] and not have it materially improve the quality or reliability
Given how vibe coded the rest of that whole DB appears to be, and the number of holes the Jepsen test found, I’m not terribly sure I’d trust, or use it as an example of “used formal methods”.
A better example would be the AWS S3 team who used TLA+ to formally verify their permissions model, especially around whether something was publicly accessible.