Tests can find mistakes in code. A computer-checked proof can show that a precise rule holds for every input covered by its assumptions. We are exploring how AI can help with both.
Bring the discipline of proof to AI-written software.
OpenAI’s work on AI and mathematics, including proofs formalized in Lean for computers to check, helped inspire this direction. Could that discipline help us check AI-written code, too?
Assay is an experiment in answering that question. We have not proved that the whole database is correct.
A test tries chosen examples. It can catch a mistake, but passing those examples does not show that every other input works.
A proof checks a precise rule. Software checks an argument that the code follows that rule for every input included in the claim.
Start with one question
What is the biggest number?
Teaching example, not a proof result
Example query
SELECT MAX(value) FROM numbers
375→7
For this example, use a list with at least one whole number. NULL, SQL’s marker for a missing value, is left out here.
What a proof needs to show
The result comes from the input. Returning 1000 would give a number larger than all three inputs, but that number was never in the table.
No input value is larger. Returning 3 would select an input value but fail because 7 is larger.
We need both rules to describe a correct answer. This example does not prove the whole engine.
What must always be true? What input could expose a mistake? You can help by spotting a missing rule, working out an expected answer, or writing a proof. People still need to check that the rule describes what users actually want. Contribute technical review →
Kani checks selected functions in the real Rust engine. A small test program, called a harness, states the allowed inputs and the rule to check. Kani searches for an input that breaks the rule. Its result covers only the modeled inputs and the limits set for that check.
For example, the multiply_all_i64 check covers every pair of signed 64-bit integers. It compares multiplication with a wider number format that can hold the expected product. This helps check overflow: what happens when an answer is too large for the engine’s number format.
Verus / simpler reference code
Prove the SQL behavior clearly.
The fast engine juggles SQL rules, speed, shared work and memory. We also built a simpler, slower program, called a reference evaluator. Verus helps check proofs about selected SQL operations in that separate program. Explore the reference experiment →
The same input: [3, 7, 5]
Next value
What the code does
Saved answer
3
Read 3. There is no answer yet, so save 3.
3
7
Read 7. It is larger than 3, so save 7.
7
5
Read 5. It is smaller than 7, so leave the answer at 7.
7
After every step, the saved answer is the largest value read so far.
Verus checks that the reference code starts with this rule, keeps it true at every step, and returns the required answer. The proof covers the allowed inputs, not just these three numbers.
[3, NULL, 7, 5] → 7. NULL values are ignored.
[] or [NULL, NULL] → NULL. There is no value to choose.
Both tools check precise claims about code. Kani is not the tool proving this MAX example. Neither tool certifies the whole fast engine, which remains experimental. New arithmetic results still need review.
Connecting the two
The fast engine must follow the same rules.
The reference supplies an expected answer for supported queries. The fast engine may process the same rows differently.
Illustrative example: [3, 7, 5]
Reference: read the rows in order.
The simpler program reads 3, 7 and 5 in order.
375→
Reference answer: 7
Possible optimization: split, then combine.
Two workers could handle separate groups, [3, 7] and [5], at the same time. They would find 7 and 5, then choose the larger answer.
375
↓ Local answers: 7 and 5. ↓ MAX(7, 5) = 7.
Proposed engine answer: 7
This is an idea to illustrate the reasoning. It does not describe the current engine or show a measured speed gain or completed proof.
What comparison tells us: We compare answers for supported queries where row order does not matter. We check that the rows match, including repeated rows. Agreement on these tests does not prove agreement for every possible input.
What we want to prove: First, show that splitting the work and combining the answers is valid for every allowed input. Then show that the real engine follows those steps. Proving the idea alone does not prove the code.
Changing the engine can also change what a proof needs to cover. Doing both at once has slowed this project down.
We are improving speed and useful SQL support first, with tests for every change. After Alpha 3, we plan to expand proofs for the riskiest parts of the real engine, building on the Kani work.
Each future proof will name the code it covers, the rule it checks and the evidence reviewed.
This is the project’s current sequence, not a claim that optimization and verification can never run in parallel.