I resonated a lot with some of the ideas in this post. The author says:
> If I started working on it today, it would:
> 1. Compile to WebAssembly using the Garbage Collection features.
> 2. Have a Rust-inspired type system but without the difficulties of the borrow-checker.
> 3. Start with basic and more easily learnable SMT powered Liquid Types and Flow Effects.
> 4. Over time integrate Lean as the proof layer, and use some separation logic paradigm like Iris to bootstrap the language and verify its own implementation.
I've been working on something similar that: does 1 (compiles to WebAssembly without GC) and something like 4 (gives a proof/verification layer, though I demonstrated with Bend rather than Lean). In place of 2-3 I built a minimal C-like type system combined with Racket-style metaprogramming that allows for the higher-level layers (e.g., dependently typed languages like Bend or Lean) to be defined defined as libraries via importable macros. This allowed the core to be really small (<12k LOC) and fast, flexibility for future experimentation on the right kind of verifier, and enabled an initial self-bootstrap (already done).
I won't share a link here as I tend to dislike replies that advertise personal projects, but I thought this difference in approach might be interesting to the author or others (I went through a somewhat similar evolution to the author in my thinking).
"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.
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.
> 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.
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
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.
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.
Sounds like you'd be interested in Qed! The web framework I'm building which compiles lean to native js for the frontend and rust for backend, using prorobuf for communication between the two.
I reimplemented the entirety of the css grammar and fully verified the data model, hydration/dehydration pipeline, and can even formally prove accessibility at compile time (contrast > 4.5).
I'm currently working on reimplementing the full sql grammar to allow you to formally verify your queries (and even row level security policies!) at compile time.
I’d be wary of saying “formally prove accessibility”. Leaving aside the problems of computing contrast over differing surfaces (e.g. a gradient, and image or an animated surface) on a responsive site at build time, accessibility is a vastly bigger subject than just colour contrast and focusing purely on compliance to a set of rules isn’t going to get you very far.
Or rather, zero problem with accessibility linting, but don’t oversell it.
This will never take off without the proper incentives to make companies actually care.
Management would rather have vibe coding as the next step, following on cheap offshoring, than anything else, and the recent meltdowns aren't going to deter them, without liability in place.
Yet another article claiming software quality is "nose-diving" because of AI, while we're piling [insert anything]2root exploits based on decades of real human sloppiness. Meanwhile, in-house software keeps getting better.
I resonated a lot with some of the ideas in this post. The author says:
> If I started working on it today, it would:
> 1. Compile to WebAssembly using the Garbage Collection features. > 2. Have a Rust-inspired type system but without the difficulties of the borrow-checker. > 3. Start with basic and more easily learnable SMT powered Liquid Types and Flow Effects. > 4. Over time integrate Lean as the proof layer, and use some separation logic paradigm like Iris to bootstrap the language and verify its own implementation.
I've been working on something similar that: does 1 (compiles to WebAssembly without GC) and something like 4 (gives a proof/verification layer, though I demonstrated with Bend rather than Lean). In place of 2-3 I built a minimal C-like type system combined with Racket-style metaprogramming that allows for the higher-level layers (e.g., dependently typed languages like Bend or Lean) to be defined defined as libraries via importable macros. This allowed the core to be really small (<12k LOC) and fast, flexibility for future experimentation on the right kind of verifier, and enabled an initial self-bootstrap (already done).
I won't share a link here as I tend to dislike replies that advertise personal projects, but I thought this difference in approach might be interesting to the author or others (I went through a somewhat similar evolution to the author in my thinking).
"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.
[1] https://jepsen.io/analyses/particledb-1.1.4
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.
> 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.
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
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.
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.
Sounds like you'd be interested in Qed! The web framework I'm building which compiles lean to native js for the frontend and rust for backend, using prorobuf for communication between the two.
I reimplemented the entirety of the css grammar and fully verified the data model, hydration/dehydration pipeline, and can even formally prove accessibility at compile time (contrast > 4.5).
I'm currently working on reimplementing the full sql grammar to allow you to formally verify your queries (and even row level security policies!) at compile time.
https://github.com/JacobAsmuth/qed
I’d be wary of saying “formally prove accessibility”. Leaving aside the problems of computing contrast over differing surfaces (e.g. a gradient, and image or an animated surface) on a responsive site at build time, accessibility is a vastly bigger subject than just colour contrast and focusing purely on compliance to a set of rules isn’t going to get you very far.
Or rather, zero problem with accessibility linting, but don’t oversell it.
https://github.com/verus-lang/verus
The lab I worked with for my thesis used Verus for our formally verified Operating System written in Rust. https://mars-research.github.io/doc/2023-kisv-atmo.pdf
So, we write formal "code" to verify target "code"? How does this help?
Perhaps Zena is worth looking at since it also targets WebAssembly GC?
https://zena-lang.dev/
This will never take off without the proper incentives to make companies actually care.
Management would rather have vibe coding as the next step, following on cheap offshoring, than anything else, and the recent meltdowns aren't going to deter them, without liability in place.
Related project I saw recently:
> TScert: a sound core for TypeScript. An independent checker, whose soundness is proved in Lean
https://github.com/cristianoc/TScert
How will having a formally verifiable mainstream language save us?
probably won't. But, it will keep some people busy for sometime.
Is it part of the joke that the first two links in the post are 404s?
Yet another article claiming software quality is "nose-diving" because of AI, while we're piling [insert anything]2root exploits based on decades of real human sloppiness. Meanwhile, in-house software keeps getting better.