Read all slide text
<!-- .slide: id="tentative-advice" class="cover" data-original-slide="1" --> # Building formal tools with AI agents Mike Dodds / mike@oath.tech Oath Technologies 2026-11-18  --- <!-- .slide: id="building-formal-tools" class="figure" data-original-slide="2" --> ## How do we use AI to build formal tools?  Me, building formal tools <!-- .element: class="caption" --> --- <!-- .slide: id="things-i-built" class="standard project-list" data-original-slide="3" --> ## Some public Oath projects - **ACL2Lean**: replay ACL2 proofs in Lean.<br> [https://github.com/OathTech/ACL2Lean](https://github.com/OathTech/ACL2Lean) - **golean**: executable Go semantics in Lean.<br> [https://github.com/OathTech/golean](https://github.com/OathTech/golean) - **cerberus-lean**: port Cerberus C semantics to Lean.<br> [https://github.com/OathTech/cerberus-lean](https://github.com/OathTech/cerberus-lean) - **lean-ux-proto**: model selected Linux subsystems in Lean.<br> [https://github.com/OathTech/lean-ux-proto](https://github.com/OathTech/lean-ux-proto) - **crit-infra-methodology**: agent workflows for auditing critical software.<br> [https://github.com/OathTech/crit-infra-methodology](https://github.com/OathTech/crit-infra-methodology) --- <!-- .slide: id="grind-to-victory" class="section-break" data-original-slide="4" --> ## Strategy: Grind to Victory --- <!-- .slide: id="ai-propensities" class="two-column" data-original-slide="5" --> ## AI propensities (c. Fable / Astra - late 2026) ### AIs are good at: - Math reasoning - Coding / Lean - Nit-picking - Persistence! ### AIs are bad at: - Judgement: “am I doing the right thing?” - Creativity: “is there some other way to solve this?” - Executive control: “should I stop grinding and replan?” --- <!-- .slide: id="search-and-checks" class="two-column trust-comparison" data-original-slide="6" --> ## Untrusted search, trustworthy checks  ### Heuristic search - Use any means available - Quick, powerful, opaque - May be wrong  AI <!-- .element: class="actor-label" --> **Untrusted** ### Verification - Highly predictable methods - Slow, simple, legible - Proof of the stated theorem  checker <!-- .element: class="actor-label" --> **Trusted** --- <!-- .slide: id="grind-process" class="two-column" data-original-slide="7" --> ## Grind to victory ### Ingredients - Objective: something you want to build - Oracle: a checkable root of trust that points towards the objective ### Process: 1. AI agent builds some stuff 2. AI agent checks oracle, fixes gaps (iterate for a long time until success) --- <!-- .slide: id="oracles" class="standard list-comparison" data-original-slide="8" --> ## Oracles - Tests / differential testing - Existing implementation - Theorem - Coverage metric - Agent judge / human review … The important thing: - Oracle is hard to game - Oracle can be human reviewed - Oracle points to objective --- <!-- .slide: id="golean-section" class="section-break" --> ## golean [https://github.com/OathTech/golean](https://github.com/OathTech/golean) <!-- .element: class="caption project-url" --> --- <!-- .slide: id="go-overview" class="standard" --> ## Executable Go semantics The same Lean definitions run Go programs and let us prove properties of their executions. --- <!-- .slide: id="go-pipeline" class="technical-figure" --> ## GoLean pipeline  --- <!-- .slide: id="go-execution-rules" class="standard" --> ## GoCore abstract machine GoCore is a typed, imperative language. Calls are separate statements, so the order of calls is explicit. - Each goroutine carries its current computation, local environment, and a stack of pending work. All goroutines share one heap. - Lean’s `stepFn` advances one goroutine by one small step. The read and write in `x = x + 1` are separate steps. --- <!-- .slide: id="go-testset" class="campaign" data-original-slide="9" --> ## Building the Go conformance suite - Give the test-writing agent a Go feature to exercise. - Make that feature affect the program’s return value. Run it in Go to get the expected result. - Keep the test even if GoLean fails it. --- <!-- .slide: id="go-differential-check" class="technical-figure" --> ## Differential testing against Go  --- <!-- .slide: id="go-semantics" class="campaign" data-original-slide="10" --> ## Implementing Go one feature at a time The August campaign started with all 20 floating-point tests failing. - Give the implementation agent one family of failing tests. - Fix the frontend or the interpreter. Rerun the full suite to catch regressions. --- <!-- .slide: id="go-worked-example" class="standard call-example" --> ## A slice with a side effect ```go func example() int { calls := 0 values := func() []int { calls++ // Count how many times values() runs. return []int{10, 20, 30} } // Call values() once. If it returns s, [:] means s[0:len(s)]. _ = values()[:] // The underscore discards the resulting slice. return calls } ``` Call count in the original test: **1** in Go, **2** in old GoLean. --- <!-- .slide: id="go-proof-result" class="two-column code-pair call-lowering" --> ## Go frontend fix: evaluate the slice base once `emitSliceExpr` now computes the omitted upper bound from the saved result of `values()`. <!-- .element: class="lead" --> ### Before: call again for length ```go t1 := values() t2 := values() _ = t1[0:len(t2)] ``` ### After: reuse the first result ```go t := values() _ = t[0:len(t)] ``` --- <!-- .slide: id="go-results" class="standard result-summary" --> ## Rapid progress is possible 4–6 August: 603 / 873 → 837 / 966 passing cases - No passing case regressed across 31 baseline updates. - 129 cases still failed at the end of that campaign. --- <!-- .slide: id="go-example-generation" class="campaign" data-original-slide="13" --> ## Fuzzing GoLean with Grossmith Generate small Go programs and run them through the same differential tests. Grossmith found that `v++` worked for `int8` but got stuck in GoLean for `type T int8`. [https://github.com/OathTech/grossmith/](https://github.com/OathTech/grossmith/) --- <!-- .slide: id="go-cerberus-comparison" class="two-column" --> ## Semantics, fast and slow ### Cerberus: C semantics [https://www.cl.cam.ac.uk/~pes20/cerberus/](https://www.cl.cam.ac.uk/~pes20/cerberus/) <!-- .element: class="caption project-url" --> - Which pointer behaviors does C permit? - Compare the standard with compiler practice. - 2013 survey → 2016 paper → 2023 thesis ### GoLean: Go semantics [https://github.com/OathTech/golean](https://github.com/OathTech/golean) <!-- .element: class="caption project-url" --> - What does this Go implementation do? - Run each test program to get a reference result. - Use mismatches to repair the model. --- <!-- .slide: id="cerberus-lean" class="standard" --> ## cerberus-lean We built a port of Cerberus, using agents <!-- .element: class="lead" --> - Generated from Cerberus’s existing source model (Lem). - Differentially tested against its OCaml implementation. [https://github.com/OathTech/cerberus-lean](https://github.com/OathTech/cerberus-lean) <!-- .element: class="caption project-url" --> --- <!-- .slide: id="acl2lean-section" class="section-break" --> ## ACL2Lean [https://github.com/OathTech/ACL2Lean](https://github.com/OathTech/ACL2Lean) <!-- .element: class="caption project-url" --> --- <!-- .slide: id="acl2lean" class="standard" data-original-slide="14" --> ## Can we replay ACL2 proofs in Lean? - ACL2 doesn’t emit proof objects by default - Very different proof model to Lean ### Requires the AI to build: - Deep embedding of ACL2 logic in Lean - Instrumentation of ACL2 tool to emit proof logs - Lean metaprogramming to replay proofs --- <!-- .slide: id="acl2-destination" class="two-column code-pair" --> ## Length of append ### ACL2: MY-LEN-MY-APP ```lisp (defthm my-len-my-app (equal (my-len (my-app x y)) (+ (my-len x) (my-len y)))) ``` ### Lean: lists of integers ```lean ∀ (xs ys : List Int), len (app xs ys) = len xs + len ys ``` --- <!-- .slide: id="acl2-five-stages" class="technical-figure" --> ## ACL2Lean pipeline  --- <!-- .slide: id="acl2-extraction" class="two-column acl2-step" --> ## ACL2 proof logs Dumped from a fork of ACL2 instrumented with probes. ### Clauses and definitions - Input clause and resulting subgoals - Induction cases and hypotheses - Function definitions ### Inside a rewrite - Rule applied - Argument bindings for definition unfoldings - Term before and after the step - Nested rewrites --- <!-- .slide: id="acl2-reconstruction" class="technical-figure acl2-step" --> ## The induction tree for append  --- <!-- .slide: id="acl2-embedded-semantics" class="standard acl2-step" --> ## ACL2 evaluation in Lean ```lean evalOpt : Nat → World → Env → SExpr → Option SExpr ``` Here `w` contains the book’s function definitions and `φ : SExpr` is the length-of-append formula. ```lean ∀ (env : Env), ∃ N, ∀ fuel ≥ N, ∃ v, evalOpt fuel w env φ = some v ∧ v ≠ SExpr.nil ``` For every binding of `x` and `y`, enough fuel makes the formula return a non-`NIL` value. --- <!-- .slide: id="acl2-replay-a-rewrite" class="standard acl2-step" --> ## Replaying one rewrite ```lisp (cdr (cons (car x) (my-app (cdr x) y))) → (my-app (cdr x) y) ``` The append induction step uses **CDR-CONS**. To justify that step in Lean: 1. Prove that both arguments to `cons` evaluate and that `cdr` and `cons` have their builtin meanings. 2. Apply the CDR-CONS lemma. With enough fuel, both terms evaluate to the same value. --- <!-- .slide: id="acl2-replayed-append" class="standard acl2-step" --> ## What replay proves about append ```lisp (equal (my-len (my-app x y)) (+ (my-len x) (my-len y))) ``` Give `x` the list `(2 5)` and `y` the list `(8)`. The left side counts three elements. The right side adds two and one. **Replay proves in Lean that this ACL2 formula evaluates to true for every binding of x and y**, given enough fuel. --- <!-- .slide: id="acl2-lifting" class="technical-figure acl2-step" --> ## Lifting the append theorem  --- <!-- .slide: id="acl2-transport" class="standard acl2-step" --> ## Theorem transport Transport takes a theorem about encoded values and proves it for a Lean type with a suitable encoding. - **Once per operation**, declare what the encoding preserves. For append, `encode (app xs ys) = app (encode xs) (encode ys)`. ACL2Lean proves these lemmas for supported definitions. - **For each theorem**, state the Lean target, choose the encoding, and name the decoded theorem. ACL2Lean reuses the lemmas to build the proof. --- <!-- .slide: id="acl2lean-loops" class="standard" data-original-slide="15" --> ## ACL2Lean grind loops Many grind loops across the project: - Instrument ACL2 to generate proof logs (grind on coverage) - Parse proof logs into trees (agent-judge on small examples) - Check trees are valid reasoning (grind on coverage) - Replay trees as Lean proof terms (grind on kernel pass) - … --- <!-- .slide: id="thin-slices" class="standard" data-original-slide="16" --> ## Start with thin slices, pry the window wider - Support one simple ACL2 proof (length of append) - Grind to victory - Add one more category of proof - Grind to victory - … - ACL2Lean supports the ACL2 sorting books! ← today Widen the window by a sequence of grind campaign, each with goals / oracles --- <!-- .slide: id="acl2-results" class="standard result-summary" --> ## Importing the ACL2 sorting books Insertion sort, merge sort, quicksort, and bubble sort 14 theorems at `Int`, 1 at `Option Int` [https://github.com/OathTech/ACL2Lean](https://github.com/OathTech/ACL2Lean) <!-- .element: class="caption project-url" --> --- <!-- .slide: id="acl2-limitations" class="standard" --> ## ACL2Lean limitations ACL2Lean covers a narrow slice of ACL2. These are three of the many gaps. - **ACL2 values.** The evaluator covers rational numbers. It has no representation for `#c(1 2)`. - **Proof replay.** Induction replay requires ACL2’s ordinal order `o<`. It rejects a custom well-founded relation. - **Book translation.** The direct Lisp-to-Lean translator rejects `encapsulate` and `defstobj`. --- <!-- .slide: id="other-advice" class="section-break" data-original-slide="18" --> ## Further advice on building with AI --- <!-- .slide: id="anchor-objective" class="standard advice" data-original-slide="20" --> ## You need an anchor objective Some top-level auditable claim you understand e.g ``` ∀ x ∈ args, ∀ r, goSemantics p x = some r → r = .ok (specFn x) ``` Otherwise you might build total nonsense! --- <!-- .slide: id="dont-read-the-code" class="standard advice" data-original-slide="19" --> ## Don’t read the code At least most code Your most precious resource is time - oversight and understanding is expensive! --- <!-- .slide: id="best-model" class="standard advice" data-original-slide="21" --> ## Use the best model Current best models (late 2026) - Claude Fable - Astra Other models are much worse especially for conceptual / long cycle work When the next model arrives, pick it up and test it --- <!-- .slide: id="pay-for-ai" class="standard advice" data-original-slide="22" --> ## Pay for AI August 2026 - $200 / month Claude plan is a great deal - much cheaper than API costs - Similar for Codex Typical buildout for a useful formal thing will be ~$1000s of tokens **UPDATE November 2026:** I now pay API rates and am trying to scale up. --- <!-- .slide: id="work-in-arcs" class="standard advice" data-original-slide="23" --> ## Work in arcs Describe a goal - a single grind campaign - Agent defines an ‘arc charter’ - a doc in the repo Use /goal - give the agent a completion condition --- <!-- .slide: id="get-ready-for-disappointment" class="standard advice" --> ## Get ready for disappointment - Many things won't work - Rollercoaster: things are going great, things turn out to be nonsense --- <!-- .slide: id="adversarial-audit" class="standard advice" data-original-slide="25" --> ## Adversarial audit Agents are good at the goal they are set Dispatch review agents at the end of each arc - Multiple subagents - Brief the agents to be adversarial / decorrelated Very effective at killing bugs! --- <!-- .slide: id="sandbox" class="standard advice" data-original-slide="26" --> ## Run in a sandbox - Configure network access to allow only the AI API - Stops the agent accessing anything outside current folder and allow-list I like https://nono.sh/ Agents will break things if you don’t restrict them --- <!-- .slide: id="scale-up" class="standard" data-original-slide="27" --> ## Try to scale up Human time / oversight is the most punishing bottleneck Scale up hierarchy: - [less scalable] Human reviews every action / edit - Human reviews every change at checkpoints - Human discusses each commit w/ agent - Human reviews arc plans, human watches commits go by - Multiple arcs run at once, human+agent management - [more scalable] Agents decides arcs, agents supervise agents. Human sets working practices --- <!-- .slide: id="ambition" class="standard advice" data-original-slide="28" --> ## Be insanely ambitious - Most people are aiming too low. Hard tasks reveal the boundary - Calibration on capabilities is very difficult Eg. these tasks will fail today, but it’s interesting how they fail - “Verify linux kernel” - “Verify rustc” Try to figure out what would make such tasks successful Be ready for the next model --- <!-- .slide: id="next-year" class="two-column horizon" data-original-slide="29" --> ## Build for next year ### Not today / yesterday: Common failure: “AIs are bad at X. I will build a tool that solves X” … 6 months pass AIs are good at X :( ### Not for +10 years:  “Advice for a (young) investigator in the first and last days of the Anthropocene” Jascha Sohl-Dickstein https://iclr.cc/virtual/2026/10022182 <!-- .element: class="caption" --> --- <!-- .slide: id="thank-you" class="closing" data-original-slide="30" --> ## Mike Dodds / mike@oath.tech Oath Technologies 2026-11-18 [https://github.com/OathTech/golean](https://github.com/OathTech/golean)<br> [https://github.com/OathTech/ACL2Lean](https://github.com/OathTech/ACL2Lean) <!-- .element: class="caption" --> 
←
→
Overview
Read
?
Enable JavaScript to view this presentation, or read slides.md in the source project.