Raúl Raja speaking into a microphone and David Mazarro beside him on stage at Lambda World 2026, under the projected title slide of their talk Towards Multi-language Program Verification for AI

On 30 October 2026, at Lambda World in Torremolinos, David Mazarro (Founding Engineer at Predictable Machines) and I, Raúl Raja (CTO at Predictable Machines), gave a talk called Towards Multi-language Program Verification for AI to a room full of functional programmers. Our argument: AI assistants now write code faster than anyone can check it, formal verification is key to closing that gap, and Predictable Code does it for Java, Kotlin, TypeScript and C# (more languages on the way) with a single verification engine built in Lean. The slides are online at slides.davidmazarro.com/lw-2026, and the recording will follow on the Lambda World YouTube channel when the organisers publish this year's videos.

This post is a walk through what we said, plus a few words about why this particular conference means so much to us.

A conference we hold close

Lambda World is a functional programming conference we co-founded many years ago, back in our 47 Degrees days. We are no longer involved in organising it, but we are still part of its technical committee, and every year it feels a bit like coming home.

What struck me this year was how much of the programme was about mathematics applied to software, and especially to AI. Proof assistants, type theory, verification, correctness of generated code. Not long ago those were the talks people attended out of curiosity, but this year they filled the rooms.

The Lean team had some presence in the conference too: Sebastian Ullrich, Head of Engineering at the Lean FRO, gave Customizing the World with Lean, a tour of how Lean is written in Lean and how the same parser, macros, elaborators and tactics the core uses are open to every user, while a small kernel keeps rechecking every proof. His slides, written in Lean with Verso, are in the Lean presentations repository. Derek Sorensen, from the Ethereum Foundation, gave Lean is More Than a Proof Language, about verified Lean code that competes with C and Rust and about using Lean as a harness for language models (slides source).

The gap AI opened

We started with one picture. AI assistants make the amount of code written grow much faster than the amount of code anyone actually checks. The distance between those two lines is the gap, and it gets wider every month.

Code reviews and tests were already struggling to keep up, and the industry now needs solutions to help scale this process now that an agent can write in an afternoon what a team used to write in a sprint.

Dijkstra said it decades ago: testing can show the presence of bugs, but not their absence. The number of possible inputs can get untenable pretty easily for many functions:

FunctionPossible inputsCan you test them all?
and(Bool, Bool)4Yes
multiply(Int32, Int32)2³² × 2³² ≈ 1.8 × 10¹⁹Not in practice
toUpper(String)Infinitely manyNo

Unit tests check individual points in a sea of inputs. Property-based testing and fuzzing explore further, but some bugs still go unnoticed.

From specifications to proofs

Formal verification is a set of techniques used to prove that a program is correct against a formal specification (we wrote a longer introduction in Formal verification in AI and why it matters). "Correct" means it behaves as specified, and "prove" means we give mathematical guarantees (using formal methods) about the specified behavior.

Our running example was a humble withdraw function for a bank account. In plain English its requirement reads: if the amount to withdraw is positive and does not exceed the balance of the account, then the withdrawal never leaves the balance negative.

Hoare logic, from 1969, gives us a precise way to write that down as a contract: a precondition, the program, and a postcondition.

{ 0 < amount ≤ acc.balance }  withdraw(acc, amount)  { acc.balance ≥ 0 }

Static types are already one common example of a verification tool. From the signature withdraw(acc: Account, amount: number): Account, the type checker proves that withdraw takes an account and a number and returns an account. But most mainstream programming language type systems cannot help us check that calls to the withdraw function honor its contract. As an example, take an account that starts with 100 and withdraw from it three times:

const acc = new Account(100);
withdraw(acc, 30); // balance: 70
withdraw(acc, 60); // balance: 10
withdraw(acc, 50); // balance: -40
CallType checkerPreconditionPostcondition
withdraw(acc, 30)well typed ✓0 < 30 ≤ 100 ✓70 ≥ 0 ✓
withdraw(acc, 60)well typed ✓0 < 60 ≤ 70 ✓10 ≥ 0 ✓
withdraw(acc, 50)well typed ✓0 < 50 ≤ 10 ✗-40 ≥ 0 ✗

Every one of those calls is well typed, but the last one breaks the contract and leaves the balance at -40.

Functional programmers know where this goes next. Through the Curry-Howard correspondence, types are propositions and programs are proofs. With dependent types, a type can mention the values of the arguments, so the contract itself can live in the type. In Lean we can define a theorem stating the contract for withdraw, and the type checker will check any valid proof we give for this theorem, confirming that the withdraw function behaves as specified:

theorem withdraw_nonneg (acc : Account) (amount : Nat)
    -- precondition
    (h : 0 < amount ∧ amount ≤ acc.balance) :
    -- postcondition
    (withdraw acc amount).balance ≥ 0 := by
  grind [withdraw]

Then we can reuse this theorem later on to prove that calls to the withdraw function are safe and honor its contract, which prevents any unexpected results.

Lean even has dedicated syntax for Hoare triples over stateful code, with vcgen generating the verification conditions for you. A language with a dependent type system gives you a very powerful verification tool almost for free.

One engine, many languages

The second half of the talk was about Predictable Code, the platform we are building to check that code does what its requirements say, in the languages teams already use: Java, Kotlin, TypeScript, C# and more. The engine itself is written, for the most part, in Lean, for the reasons we explained in why we chose Lean for Predictable Code.

We walked through the three ways to approach this. Formal verification tools perform various types of "checks", that is, they try to rule out different kinds of bugs: memory safety errors or null dereferences, integer overflows, data races, unhandled exceptions, or calls that break their contract as withdraw(acc, 50) did earlier in our example. One verification tool per check means every tool has to understand every language. One verification tool per language means every tool has to reimplement every check. The third common approach, which is the one we chose, is translating programs in the different languages into a common intermediate representation, and building one unified verification framework on top of it.

The Predictable Code pipeline: Java, Kotlin, TypeScript and C# go through their compiler front ends into the Predictable IL, which feeds the IL deciders, the IL verifier and the witness generator

Each language goes through its own compiler front end (Spoon on Eclipse JDT, the K2 compiler plugin, tsc, Roslyn) into the Predictable IL, the intermediate language every program is translated into before it is verified. From there three engines give verdicts:

  • IL deciders find structural defects and bug patterns. For example, a single decider catches an async call whose result is dropped, such as an email that is sent without an await afterwards.
  • The IL verifier checks requirements and unsafe operations, and gives three types of answers: verified, violated or undecided. It is the one that flags withdraw(acc, 50) on a balance of 10.
  • The witness turns a violation into a test in the project's own language and runs it on a copy of the code. For withdraw(acc, 50) on a balance of 10, the generated test reproduces the bug and leaves the balance at -40.

We were honest about what is still missing. For instance, to prove that each translation preserves meaning, you need formal semantics for the source languages, and almost no mainstream language has official or complete ones. We are still figuring out what works best for us and our partners.

Where AI helps, and where it doesn't

AI and theorem provers turn out to be a very good pair. When the code changes and a proof breaks, an agent proposes a new proof and the kernel rechecks it. A wrong proof simply does not type check, so the agent tries again. The same loop works for keeping language integrations up to date, with tests as the referee. In the talk we showed an agent's proposed fix for withdraw, which Predictable Code's analysis only accepted after every requirement was verified.

But there are still major challenges on the other end of the formally verified software development lifecycle: getting from intent to a valid and verifiable specification.

  • Autoformalization. "Withdrawals over 1000€ are flagged for review" becomes ∀ acc n, n > 1000 → (withdraw acc n).isFlagged. Lean will happily check it. But was "over 1000€" meant to include 1000€? If so it should be ≥, and we are verifying the wrong requirement.
  • Missed requirements. Ask an agent to implement seat booking and it will write some sensible requirements: the seat exists, mark it as taken, send a confirmation. But under those requirements, Ana and Ben could both book seat 12A, because there is no requirement mandating that "a seat cannot be booked twice". To be fair, writing complete specifications is also hard for humans, not just for AI.
  • Granularity and ambiguity. "The index is in bounds" or "the balance is never negative" are usually easy to verify. "Withdrawals are recorded in order" is harder. But something like "the bank is fair" is such an ambiguous requirement that it cannot be verified without making some heavy assumptions about what that means.

There is no general, hands-off way to turn natural language requirements into formally verifiable ones. At Predictable Machines we try to navigate that spectrum, between automation and verifiability, to find practical solutions for our partners.

What we took home

AI calls for better verification than tests and code review alone, and formal verification is one of the most promising answers. At the same time, AI makes formal verification much easier, because it pairs so well with theorem provers that writing complex proofs takes a fraction of the time, even if the proofs get harder to read.

Having said that, it's important to recognize that it is no silver bullet. "All our endpoints must have a P99 under 500 ms" is a valid, unambiguous and verifiable requirement, and you still cannot formally verify it without a pile of assumptions.

But the gap between code written and code checked can close, and seeing a whole conference full of people working on that from different angles was the best part of the week.

Thanks to everyone who came to the talk and stayed for the questions, and to the Lambda World team for another great edition. If you want to talk about verification, Lean or the gap in your own codebase, write to me at [email protected], or try Predictable Code on your own repository.

Raúl Raja speaking into a microphone and David Mazarro beside him on stage at Lambda World 2026, under the projected title slide of their talk Towards Multi-language Program Verification for AI
Diagram of the Predictable Code pipeline: Java, Kotlin, TypeScript and C# go through their compiler front ends into a common Predictable IL, which feeds IL deciders, an IL verifier and a witness test generator

What we're building

Predictable Code gives every developer and AI assistant the same shared specifications so the code generated is consistent, verified, and always aligned with what your team intended.

Join the beta

Series

This article is part of our ongoing series on the hidden problems with AI code assistants in engineering teams.

Read the AI Code Pain Points →

More Articles

All articles

/ Curious to see our products in action? \

Let's have a chat about it

Predictable Code