Well written piece and certainly on-topic. There is a ton of conversation going on how AI can assist with formal methods.
Personally I am having great success using Ada SPARK. The SPARK subset has been greatly enhanced over the past years. I spent yesterday taking existing C repos, translating to SPARK, lifting it to SPARK Silver (absence of runtime errors) and then reporting the findings to the various maintainers. All as a background activity.
Result: integer overflows, typically on boundary conditions, some logic mistakes, again on boundary conditions.
I have not looked into Magmide, but I think the next breakthrough is a combination of something like SysMLv2 to describe architecture and requirements, TLA+ for modeling and formal proofs at the system level and then Lean or SPARK for the implementation.
Wow, I feel like Blaine is describe a language a lot like the one I'm working on now, Zena: https://zena-lang.dev/
I started Zena from wanting a TypeScript-like syntax that compiled to very efficient WebAssembly GC, and AssemblyScript had issues...
The motivation for targeting Wasm was as a good sandboxing and orchestration unit for AI-generated code. So, out of both general PL curiosity and enthusiasm, and an attempt to make a language that's good for AI generation, I started adding what I thought were the best features from other languages with a lot of focus on correctness, structure, and optimizability: pattern matching with exhaustiveness checking, ADTs and sum types via sealed classes, value types, async cancelation / structured concurrency, ownership and borrow checking for resources, unicode safe strings, and recently I added runtime contracts and I'll start on refinement types and some kind of proof system soon.
The idea is exactly to take a mainstream and familiar-looking language and add more cutting-edge and academic features that help with software correctness.
I wrote about some of this here, though not the formal methods parts: https://zena-lang.dev/blog/2026/09/languages-for-the-ai-era/
Dafny, SPARK Ada, Why3, Verus, Frama-C, TLA+, etc. are all sort of in this direction for different languages and styles of verification. It is nice to see them getting attention now that LLMs make them digestible for a broader set of programmers. I'm not sure one can start with a goal of creating a "mainstream" language that is verification-oriented. Mainstreamness comes from adoption. I'd look at those past languages (like the ones I listed), and ask "why did these not go mainstream" or "why did they not see broad adoption", and try some new ideas to address their gaps to see if a new one will catch on. But the "mainstream" part seems backwards as the goal - if it’s verifiable, ergonomic, flexible, and accessible, maybe it will go mainstream.
I think that's the next step for the Logos project, is to take and formally verify the entire language now.
We have a lot of formal verification mechanics built into the language being able to handle the compilation of the lean kernel and I want to next focus on making it so the code and compiler itself is formally verified to meet it's spec.
The author has another blog post about Flow Effects[0]. They propose an open-ended set of effects you could attach to functions, and then verify, at compile time, that certain functions either do or do not invoke certain effects.
So if I had some functions like:
foo_1 (must NOT access the HDD)
foo_2
foo_3
foo_4 (does access the HDD)
Only 2 of them are annotated with effects related to HDD access, but we can verify at compile time that foo_1 does NOT invoke foo_4, either directly or indirectly (we can verify this recursively).Perhaps foo_3 calls foo_4, but we forgot to annotate foo_3 with the proper effect. No matter, because foo_3 would automatically inherit the effects of foo_4 by virtue of calling it.
This is just one of the feature the blog advocates for, and I think this feature alone would be quite simple and helpful in wrangling LLM code.
A nice thing about this is that it's optional. You can annotate the effects gradually into existing systems.
30 years ago, my then boss, a PhD in industrial automation theory, told me formal verification of even simple systems is impossible due to the practically infinite number of states systems can occupy. I have been thinking about this a lot over the years, and I still think this is the case, even more so than before with the bloat that introduces insanely fuzzy edges to any state graph. I wonder if there is really any chance of this becoming a viable concept for systems more complex than a tic-tac-toe game.
>Software engineering was struggling before LLMs.
For a lot of software, they are more like an act of writing than engineering. Especially in domains where they are most abstracted.
I would call something like SQLite and TigerStyle with TigerBeetle Software engineering.
Isnt this exactly what Ada language was created for? Hence, the use by the military for avionics and critical systems.
"It also includes facilities to help program verification. For these reasons, Ada is sometimes used in critical systems, where any anomaly might lead to very serious consequences, e.g., accidental death, injury or severe financial loss. Examples of systems where Ada is used include avionics, air traffic control, railways, banking, military and space technology."
All that was once old, is new again.
"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.
I read a couple of things on this subject and tried to remember some other things form university year but I feel a bit lost about the cost benefit and the advantages in a real world software.
so let me ask a simple question:
We have a file of 10 requirements defined by business in English. Then we create a Lean representation of them.
Who is verifying that the representation is the correct one with respect to the requirements? (not that the lean code is correct)
Rather than migrating all code to some new program language, I've been building ProgLib: https://github.com/thomasnormal/proglib which is like "MathLib for Programming".
It allows you to import code from any programming language (So far, Python, C++, Rust, and SystemVerilog are partially supported,) and prove stuff about it in Lean.
You don't need a "verifiable programming language". All you need is formalized semantics for the programming language you are already using.
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
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 properties at compile time (e.g. 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.
If you want a language that is mainstream and applies formal verification and works everywhere you could use Frama-C. It formally verifies C code. C is as mainstream as things get. You can run C code in the browser via web assembly and C works everywhere else as well.
I’ve been playing with Quint [1]. Compared to TLA+, it has been a lot more approachable and even enjoyable at times. With their Studio, even non-technical people have been able to try it out with agents.
[1]: https://quint.sh
Maybe Bend? https://bend-lang.com/
My product requires very careful thought about security, and I would love to be able to formally verify it. I cannot write it in Lean, though; what I have done instead is to write the trust model in Lean, around 4k lines of code that allows me (well, the agents) to reason about security, experiment with changes, prove outcomes.
We have now 144 proven theorems, like “an agent never passes as a person, and never approves where a person is required”. And then we link it to the actual code by using the Lean model to generate the tests.
Formal correctness is mostly useless for mainstream software. Models are strong enough that their bottom 10% of code is acceptable garbage, like in any human codebase. Top 10% is excellent.
From my experience on vibed complex algorithms (like voxel terrain generation within 200km radius at sub second generation), formal software was usefull, if not necessary, prior to opus 5.5
Now it's plain useless unless you need an absolute guarantee of correctness. But that's niche, not mainstream.
So we don't need a mainstream programming language, we already have good options that are sufficient.
Urbit is tackling this problem, and Nock has been formally verified using Lean 4. [1]
Totally agree, I recently used gobra, and found it a plesent experience (with ai on my side, the documentation is a bit hard to find for me), and it slots right into your go files. Only issue I found it adds alot of comments and waters the code a bit too much (would love to have a header file like system for this).
Also your intuition for wasm is the the thing that cam to my mind when reading the headline.
I also think that go is a great language to be formally verifiable (idk about multi threading), due to its very clear and verbose syntax.
I think this is too long of a game (a new language). Unless something changes considerably about the way LLMs code I think we need to come up with a solution that is compatible with the existing languages. There is just too much infrastructure and training data supporting the status quo.
That’s what I’m betting on anyway. I’m building a tool to write proofs for TypeScript in Lean (instead of or alongside tests) with familiar syntax. It’s called Pud (https://pud.dev). Very keen to see what others come up with in this space though!
I have started my own PL project after going through Crafting Interpreters.
I know there is a ton of stuff I need and want to learn but no language has all the features I'd like.
Namely systems language "zero overhead" performance, modern ergonomics and compile-time guarantees like Rust, dependent types (I don't know much about type systems so maybe there is - and probably there is - some good alternative I am missing), powerful generics (the shit people do with C++ templates often leave me admiring the creativity and also wondering why it has to be so unreadable), reflection, and more stuff I currently have as ideas but not in a very solid form admittedly. And all those working synergistically and coherently.
I do have a good foundation in abstract math but there is lots to study for sure. And it has to be something that really offers some great combination of features otherwise it's not worth it for anything else than me learning how to write a proper compiler. There are too many languages already, but I am not sure whether this is because it is too hard of a problem or because of choices people made. I guess I am going to find out.
At least my motivation is in a relatively sufferable shape despite it having tendencies of going down the shitter with all this vibe-coding crap going on.
We do not need a full-on theorem prover for achieving this.
Something like ZFC axioms is good enough. External formal verification tools are not ideal either. Its better if the type system of the host language's got these essentials included, like having a model checker for its abstract machine or something. However, model checker for enforcing correctness(especially of the intent) will be much harder to implement in languages without a well defined, stable ABI and type system, which typically is the case with almost all mainstream languages. Even though operational semantics is the semantics of the hardware, most languages do not strictly adhere to it due to a lot of practical reasons.
Mainstream languages that become practical enough to be used by masses will usually be in a spot where it becomes very hard to formally define the language and when that happens, enforcing "correctness" becomes close to impossible. Stuff like this needs to be addressed since the start.
Selling to the entire industry the idea that "memory safety" is the only thing essential security requirement, while all else is a low priority, simply means that anyone who bought that ad either had surplus resources or was operating with inadequate requirements to justify doing so. Computer programming is about deductive reasoning of the programs and that means its much more than just writing code and handling resources properly.
I'm experimenting with LLVM IR to Lean conversion and checking propositions on C-code based on that in https://github.com/jfhg/c2lean. It shows the possibilities but mostly limitations of such an approach.
Obviously Lean, right? Just network effects and not needing an intermediary.
I don't really understand this sudden obsession in the industry with formal verification
Why not use/contribute to MoonBit [0]?
It already checks boxes listed in the article:
- wasm(-gc) target
- uses gc
- rust type system, without borrow checker difficulties
- formal verification
- ...and has few more like fast compile times, which is a must/underappriciated in agentic development (see below) etc.
As an example I attempted to rewrite MSSQL 3 times:
1. TS based on SQLite [1]
2. Rust based on DuckDB [2]
3. MoonBit [3]
MoonBit version materialized more than order of magnitude faster compared to Rust version, tasks that were taking weeks in Rust took hours in MoonBit (!) – not only that, instead of using multiple build machines including maxed 128 GB RAM Ryzen box eating hundreds of gigabytes of SSD to support Rust worktrees / parallel compilation, MoonBit was run on MacMini M1 with 16GB RAM and limited disk space – still destroying Rust version in terms of development speed going more than 10x faster.
Formal proofs is early stage support, you can see some of it here [4] if you're interested.
If you find it somehow interesting, feel free to have a look at bitSQL repo/website [3] (it's public domain like all my recent projects), especially the final artifact which is a marvel – ~30 MB (!) of hardened container image, drop it replacement for MSSQL container – tiny, performant (wins all benchmarks against MSSQL), passes 25k tests, low resource usage (MBs instead of GBs of RAM needed) – what a beauty. Great for ie. running CI tests on projects using MSSQL.
[0] https://www.moonbitlang.com
[1] https://github.com/mirek/mssqlite
[2] https://github.com/mirek/msduck
[3] https://github.com/mirek/bitsql
[4] https://github.com/mirek/bitsql/blob/main/docs/design/verifi...
How will having a formally verifiable mainstream language save us?
For the barrier between natural and formal language, see Elenxis. https://github.com/kbr-/elenxis
It still plugs in LLM as a module, and LLM can be misaligned, so there is no guarantee that the spec will be 100% reflecting the user's intent. (I do know how to solve this, and I will in the future.)
But even right now in practice, with Opus 5.5 or GPT 6.2 Sol (medium reasoning both) it works fantastic. I use daily at $dayjob and in personal projects.
I’m working on verifying JavaScript code by having LLM transcribe it to Lean, model the environment, do differential testing, and then proving things about the Lean code. You’ll be surprised how far this can take you.
Does anyone have practical experience with using LLMs + formal methods to verify software they ship that is not a research / prototype?
Code itself should be safe. Any product definition must be able to converge on the desired outcome, iteratively, so it is accepted code must be reformulated from time to time. Those are the two requirements. The absence of state and a single source of truth help a lot.
Perhaps Zena is worth looking at since it also targets WebAssembly GC?
Formal verification is not a silver bullet! I am afraid AI has positioned it as the ultimate red herring (and nerd-snipe).
I recommend reading Cantwell Smith's "The Limits of Correctness" https://dl.acm.org/doi/pdf/10.1145/379486.379512
The TL;DR is that proofs only show that the program matches a spec, not that the spec matches the world. The gap between "what you can model" and "the real world" is generally too large for formal methods to be useful (outside of narrow domains, where they are highly useful).
In other words, computing is closer to an empirical science than a formal one.
Following some of the same sentiment, let me offer my own thoughts on how hardware/software co-design also should change to enable both digital sovereignty and inherent defensibility. https://acje.github.io/systems/new_stack/
Again the OP makes the provably incorrect assumption that the current state of code generation and validation cannot meet quality standards.
I’ve been doing it with a custom engineering harness on top of Claude Code for a year.
I certainly see the desire for a validation framework in code generation, but until we invent that and migrate the entire world to it, let’s focus on discipline.
The reality the OP sees isn’t wrong. Most of what I see publicly is trash. Undisciplined vibe coders are in a death spiral of agentic madness.
But if you bring discipline to software construction, you can extract high-quality results.
We still need requirements. We still need invariants. We still need wireframes. We still need user experience design.
Then we reach into history and bring back Functional Design Specifications.
Add TDD, DDD, behavior testing, mutation verification. And finally people need to use it for the final validation.
Now you have a disciplined approach that works today.
I firmly believe that Lean is already the language OP wants
There's lots of progress being made towards compilation to WASM and LLVM, as well as interop with Rust and other languages
This is a new frontier, we do not need to be able to read the code so why do we even need a code editor, we need a completely new language that might use symbols, context, location, images and human langauge.
Frustrating. The repeated failure of developers trying to fix broken human behavior with a software solution.
LLMs are not the problem. Quality will degrade anyways because there is no reason why it shouldn’t degrade. There is no magic to any of this. It’s just economics. Quality will remain high provided there is an incentive to keep it high, but once other factors achieve a greater desired value those incentives collapse.
This is not a new problem and it has been solved countless times outside software. So long as software people continue to whine about the symptoms while intentionally ignoring the problem we should expect conditions to continue to degrade. A new programming language will not alter the trajectory or acceleration towards failure. Perverse desires always find a way.
This is not a technical problem. People need to stop inventing new programming languages and bring these techniques to the ones they already use.
For various historical and self preservation reasons, some of these language ecosystems create social and technical taboos.
The author’s proposal reminds me of the JavaScript framework craze. Industrial-scale formal verification does not require a new language unless your program involves exotic types and/or logic not supported by any of the mainstream languages. There is still lots of work to be done, of course, but projects like Rust’s Verus and Aeneas already provide a clean and modular interface to plug in a formal methods layer, like Lean, without needing to reinvent the wheel.
Seamless formal verification requires a native formal specification to verify against. In my view, focusing work on formally modelling existing languages (like Rust), or if intractable at least a fragment with Cartesian closed semantics, is far more encouraging to mainstream adoption of formal methods than trying to convince the industry to adopt a new language.
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.
This is why languages like Rebeca exist, but sadly most "Software Engineers" skipped the Master's degree and didn't get to really get into the weeds of things. https://rebeca-lang.org/
The link for the claim "[Software] Quality is nose-diving" being a 404 is some nice irony.
I couldn’t read past the first paragraph.
What are people doing that they are finding quality is nose diving? That’s completely the opposite of my experience. I’d like to know, but the link is broken
But of course software engineering has always had this problem, right? Oh! Another broken link.
Maybe we need to start closer to home when it comes to quality.
Related project I saw recently:
> TScert: a sound core for TypeScript. An independent checker, whose soundness is proved in Lean
There are a reasonable number of candidate programming languages. That problem has been addressed before. The big problem now is specification. If the specification is too formal, it's too long and too hard for humans to read. We need something in between. There aren't many candidates. There was UML, but that was something of a dud.
Consider a specification at roughly the level that Rust crates are documented. Rust crate documents contain all the exported types and functions, along with a textual description of what each does. The document should provide enough information to use the crate without looking inside it. That's a widely accepted form of documentation.
Rust crate documents are usually created from the code. But consider going the other way. Write the crate documentation first, and let an LLM implement it from there. With an LLM creating the code and reading the documentation, the LLM can create formal contract constraints for proof purposes. Constraints visible at the API level can be re-exported to the document.
That seems within reach of current LLM technology. Is it? It's worth trying. Take some low-level crate documentation for existing crates and see what an LLM with a moderately large budget can do with it. Try to create a drop-in replacement.
Doing this on low-level Rust crates would be a useful exercise. Try to formalize the bottom of the stack.