Trustworthy
Foundations for
Random Testing

What’s the point
of testing
anymore?

Lean Port of Minecraft

The game: a fox on a grassy hillside.

State.step_entities_sound Entities collide properly with blocks

Session.play_dig_iff Clicks don’t get lost

mem_chunkFaces Faces are only drawn if visible

214 theorems

This took me Claude

2.5 hours

Game Logic Lean raylib C ? Graphics Model Lean tested proved
Lean Rocq F* Verus Proofs within systems. Tests between systems. ? ? ?
Model raylib Instructions upload 3 beginScene draw 3 unload 3 ≈ Generators

Basalt

Trustworthy foundations
for random testing.

Joint work with

Mike Hicks · Katie Hough · Josh Cohen
Ernest Ng · Segev Elazar Mittelman

Funded in part by

AWS

def genElapsed : G Nat :=
  frequency [
    (2, return 0),
    (5, chooseNat 1 450),
    (3, chooseNat 900 1100),
    (1, return 1000),
    (2, chooseNat 1001 16999),
    (1, chooseNat 14000 200000)
  ]
            

example : IsCompleteFor genElapsed (· ≤ 200000) := by
  intro n hn
  rw [genElapsed, SPMF.mem_support_iff_may]
  walk
  omega
            

omega could not prove the goal:
a possible counterexample may satisfy the constraints
  451 ≤ n ≤ 899
            

def genFrames : G (List Nat) :=
  oneOf [
    return [],
    do
      let n ← genElapsed
      let ns ← genFrames
      return n :: ns
  ]
            
1/2 1/4 1/8 [] [n] [n, n] …
1/2 1/4 1/8 [] [n] [n, n] … 1/10

example : HasProbability genFrames [] ≤ 1 / 10 := by
  rw [genFrames, SPMF.prob_oneOf]
  simp [prob_cons_nil]
            

unsolved goals
⊢ 1 / 2 ≤ 1 / 10
            

IsSoundAndComplete What is the support?

IsAlmostSurelyTerminating Does it terminate?

HasProbability How likely is a value?

HasExpectedValue How big is a value on average?

IsCostBounded How many choices are made?

IsExpectedCostBounded How many choices on average?

Basalt Generator [Gen G] : G α SPMF for distributional proofs SPMF.Cost for proofs about cost IO for standard PBT FuzzGen for fuzzing ...

Carette et al., Finally Tagless, Partially Evaluated, JFP 2009

Basalt QuickCheck Base_quickcheck 0% 25% 50% 75% 100% bst 86% 62% heap 59% 57% sorted 64% 44% nat 68% 56% Throughput, higher is better
IO.rand SplitMix64 Fast PRNG frequency Macros = frequency!

Richey and Cutler et al., Fail Faster, OOPSLA 2026

End-to-End AI-Accelerated Testing Basalt Synthesis Tuning Shrinking
P : α → Prop Spec Palamedes Specimen Generator

Goldstein et al., The Search for Constrained Random Generators, PLDI 2026
Elazar Mittelman et al., Testing Theorems, Fully Automatically, OOPSLA 2026

1/2 [] … ≤ 1/10 [] … Tuning [8840, 33, 250] [33, 250] [33] Shrinking

Tjoa et al., Tuning Random Generators, OOPSLA 2025
Zhuang, Ariadne, POPL SRC 2026

Basalt PBT Tools Fuzzers Synthesizers Tuners Shrinkers Use-Cases Test from Lean with IO and fuzzing backends. Extract optimized code to your language of choice. AI Agent
Cedar Lean Rust ≈ Strata AI Agent well-typed programs

Disselkoen et al., How We Built Cedar, FSE 2024
github.com/strata-org/Strata

Basalt

A new foundation for random testing.

TrustworthyEnables proofs of critical performance properties.

InterpretableProofs and code use the same generator.

PracticalRuns as fast as other flagship PBT libraries.

Next StepsLays groundwork for other PBT advances.

A couple more things…

New Course

Trustworthy Software Engineering with AI

I plan to teach students testing and verification in the context of agentic programming.

Upcoming User Study

How do programmers understand theorems?

If SEs don't have a formal methods team to support them, how do they engage with correctness theorems?

Would love to chat about these afterwards!

Thank you!

Basalt Collaborators

  • Ernest Ng
  • Segev Elazar Mittelman
  • Katie Hough
  • Josh Cohen
  • Mike Hicks

My Students

  • Francille Zhuang
  • Julia Montuori-Ahuja
  • Cassia Torczon

Funded in part by
a generous gift from

AWS