Raúl Raja CTO at Predictable Machines
David Mazarro Founding Engineer at Predictable Machines
2026
2026
Harder to review and keep up with code being written at a much faster pace
=
More pressing need to provide software verification solutions
Headline!!
Edsger W. Dijkstra
Sometimes, testing could rule out bugs if you test all possible inputs, but:
Function | Possible inputs | Test all inputs? |
|---|---|---|
|
| yes |
|
| impractical |
|
| impossible |
... so yeah, not really
For any given program, you have a sea of possible inputs and expected behaviors
“Formal verification is a set of techniques used to prove the correctness of a program against a given formal specification”
Correctness: a program is correct if it behaves as specified
Prove: use mathematical techniquesthese are the famous formal methods! to guarantee this correctness
A specification is a description of a program's behavior
function withdraw(acc: Account, amount: number): Account {
acc.balance -= amount;
acc.history.push({
withdrawn: amount,
balanceAfter: acc.balance,
});
if (amount >= 1000) {
acc.flaggedForReview = true;
sendEmail(acc.owner, "Large withdrawal");
}
db.accounts.save(acc);
return acc;
}
“If amount is positive and does not exceed the account's balance, withdraw subtracts amount from the balance and records the withdrawal in some history. If amount is 1000 or more, the account is flagged for review and the account holder is emailed. It then saves the account and returns it. The balance never goes negative.”
Hoare logic (C. A. R. Hoare, 1969) is a logical framework useful for describing what a program does from what must hold before and after it runs
{P}precondition Cprogram {Q}postcondition
Hoare triple
If the precondition P holds before running the program C, the postcondition Q holds after
Hoare logic allows us to precisely state contracts for our programs
function withdraw(acc: Account, amount: number): Account {
acc.balance -= amount;
acc.history.push({
withdrawn: amount,
balanceAfter: acc.balance,
});
if (amount >= 1000) {
acc.flaggedForReview = true;
sendEmail(acc.owner, "Large withdrawal");
}
db.accounts.save(acc);
return acc;
}
Partial withdraw contract
“If amount is positive and does not exceed the account's balance [...] the balance never goes negative.”
{0<amount≤acc.balance}withdraw(acc, amount){acc.balance≥0}
For an array a where a.get(i) throws an exception out of bounds
Example
{0≤i<a.size()}the index must be in bounds r = a.get(i)⟹ {r=ai}the returned element is the one found at position i
a0,a1,… are the elements of a, in order
// Calculate the area of a rectangle
function findArea(x: number, y: number): number {
return x * y;
}
Formal specification: the function findArea takes two numbers as arguments and returns a number
So the type system of your statically typed language is indeed a formal verification tool!
Functions with types
Logical propositions
function checkIn(t: Ticket, id: Passport | IdCard): BoardingPass | Overbooked
Ticket && (Passport || IdCard)
→ BoardingPass || Overbooked
function refund(o: Overbooked): Refund
Overbooked → Refund
function board(b: BoardingPass): OnBoard
BoardingPass → OnBoard
function travel(t: Ticket, id: Passport | IdCard): OnBoard | Refund { // ? }
function travel(t: Ticket, id: Passport | IdCard): OnBoard | Refund { return board(checkIn(t, id)); } the Overbooked case is not handled
function travel(t: Ticket, id: Passport | IdCard): OnBoard | Refund { const result = checkIn(t, id); switch (result.kind) { case "boardingPass": return board(result); case "overbooked": return refund(result); } }
Ticket && (Passport || IdCard)
→ OnBoard || Refund ?✗ could not prove✓ provedboard needs a BoardingPasscheckIn gives a BoardingPass | Overbookedwe are not handling the Overbooked case, so the type checker gives an errorevery case is handled, so the type checker accepts it: it checked that our proof is sound
“Can we implement this?” = “Can we prove this?”
“We have an implementation” = “We have a proof”

Check out this talk: “Propositions as Types”, Philip Wadler, Strange Loop 2015
withdraw examplefunction withdraw(acc: Account, amount: number): Account {
// ...
}
Formal specification: the function withdraw takes an account and a number as arguments and returns an account
const acc = new Account(100);
withdraw(acc, 30); // balance: 70
withdraw(acc, 60); // balance: 10
withdraw(acc, 50); // balance: -40
Partial withdraw contract
{0<amount≤acc.balance}withdraw(acc, amount){acc.balance≥0}
Call | Type checker | Precondition | Postcondition |
|---|---|---|---|
| well-typed ✓ |
|
|
| well-typed ✓ |
|
|
| well-typed ✓ |
|
|
The type checker is still missing something to verify that the function is always called safely…
Dependent types allow us to encode function contracts by allowing us to refer to arguments in the type itself
def get : (a : List α) → (i : Nat) →
(h : i < a.length) →
{ r : α // r = a[i] }
| x :: _, 0, _ => ⟨x, rfl⟩
| _ :: xs, i + 1, h =>
⟨get xs i (byα:Type ?u.4head✝:αxs:List αi:Nath:i + 1 < (head✝ :: xs).length⊢ i < xs.length grindAll goals completed! 🐙), byα:Type ?u.4head✝:αxs:List αi:Nath:i + 1 < (head✝ :: xs).length⊢ (get xs i ⋯).val = (head✝ :: xs)[i + 1] grind [get]All goals completed! 🐙⟩
Contract for get
{0≤i<a.size()}r = a.get(i){r=ai}
def get : (a : List α) → (i : Nat) →
(h : i < a.length) → { r : α // r = a[i] }
| x :: _, 0, _ => ⟨x, rfl⟩
| _ :: xs, i + 1, h =>
⟨get xs i (byα:Type ?u.4head✝:αxs:List αi:Nath:i + 1 < (head✝ :: xs).length⊢ i < xs.length grindAll goals completed! 🐙), byα:Type ?u.4head✝:αxs:List αi:Nath:i + 1 < (head✝ :: xs).length⊢ (get xs i ⋯).val = (head✝ :: xs)[i + 1] grind [get]All goals completed! 🐙⟩
Contract for get
{0≤i<a.size()} r = a.get(i) {r=ai}
def withdraw (acc : Account) (amount : Nat) : Account :=
-- ...
theorem withdraw_nonneg (acc : Account) (amount : Nat)
-- precondition
(h : 0 < amount ∧ amount ≤ acc.balance) :
-- postcondition
(withdraw acc amount).balance ≥ 0 := byacc:Accountamount:Nath:0 < amount ∧ ↑amount ≤ acc.balance⊢ (withdraw acc amount).balance ≥ 0
grind [withdraw]All goals completed! 🐙
Hoare triple
{0<amount≤acc.balance}withdraw(acc, amount){acc.balance≥0}
You can define a function with “regular” types and keep the contract as a separate theorem
In Lean, there is even a dedicated syntax for Hoare triples for stateful code verification
def withdraw (amount : Nat) : StateM Account Unit := do
-- ...
theorem withdraw_spec (amount : Nat) :
⦃ fun (acc : Account) =>
0 < amount ∧ amount ≤ acc.balance ⦄
withdraw amount
⦃ fun _ acc => acc.balance ≥ 0 ⦄ := byamount:Nat⊢ ⦃ fun acc => 0 < amount ∧ ↑amount ≤ acc.balance ⦄ withdraw amount ⦃ fun x acc => acc.balance ≥ 0 ⦄
vcgen [withdraw]amount:Natacc:Accounta✝:0 < amount ∧ ↑amount ≤ acc.balance⊢ 0 ≤
{ balance := acc.balance - ↑amount,
history := { withdrawn := amount, balanceAfter := acc.balance - ↑amount } :: acc.history,
lowBalanceAlert := decide (acc.balance - ↑amount < 50) }.balance
grindAll goals completed! 🐙
Hoare triple
{0<amount≤acc.balance}withdraw(acc, amount){acc.balance≥0}

We are working on Predictable Code, a platform that uses formal verification techniques to reveal hidden bugs and check that code does what its requirements say, in the languages teams already use
Requirements
what the code should do,
defined as specifications
Code
aimed at languages like
Java, TypeScript or Python
Engine
being implemented in Lean
(for the most part)
Approach #1: implement a verification tool per check
but each tool has to implement support for each programming language
Approach #2: implement a verification tool per programming language
but each tool has to implement all the checks for each programming language
Approach #3 (our choice): translate programs to a common intermediate representation (IR) and implement a single verification tool for that
We are still figuring out what works best for us and our partners
A single IL decider detects this bug in all four languages

Line 30 sends the email without awaiting it
function withdraw(acc: Account, amount: number): Account {
acc.balance -= amount;
// history, email, save
return acc;
}
Partial withdraw contract
{0<amount≤acc.balance}withdraw(acc, amount){acc.balance≥0}
The returned balance acc.balance - amount may be below 0
Every caller must satisfy the precondition
Call | Precondition | IL verifier |
|---|---|---|
|
| verified ✓ |
|
| verified ✓ |
|
| violated ✗ |

Line 23 violates the requirement that the balance never goes negative
The witness reproduces a violation with a test in the project's language
// generated: no dependencies
const acc = openAccount("ada", 10);
assert(withdraw(acc, 50).balance >= 0);
violated ✗: the test reproduces the bug, with a balance of -40
held ✓: the test passes
unexercised: the test cannot reach the call
Formal semantics at the different layers of the pipeline would allow for provably correct translations between software representations
Sadly, almost no mainstream programming language provides official or complete formal semantics
A programming language with a dependent type system + interactive theorem proving capabilities
An expressive programming language and type system in the same package: huge flexibility to try different approaches to these problems
Out-of-the-box building blocks for software verification, such as vcgen
Extensibility: teams can mold and shape its capabilities to their needs
Lean is the trendy thing in this field as of 2026, but there are other dependently typed programming languages / theorem provers:
Agda
Idris
Rocq
Isabelle/HOL
Software development is way faster in general, and maintenance of projects is easier now

withdraw(acc, 50) on a balance of 10 now throws an error
Is > right? If “over 1000€” was meant to include 1000€, maybe it should be ≥ (and if so we are verifying the wrong requirement)
Open question: how do we check that a specification says what we meant?
(this is not just hard for AI, writing complete specifications is hard for humans too!)
AI calls for verification solutions
Recent AI-based software development lifecycles have spurred the need for better verification solutions beyond testing and code reviews, and formal verification is one of the most promising fields for this
AI makes formal verification easier
At the same time, AI pairs exceptionally well with theorem provers, making writing complex proofs take a fraction of the time and effort (although at the expense of understanding and readability)
Formal verification is not a silver bullet
“All our endpoints must have a P99 under 500 ms”
is a valid + unambiguous + verifiable requirement, but cannot be formally verified (without making many assumptions)
Thank you!