explaingit

cajal-technologies/talos

11LeanAudience · researcherComplexity · 5/5LicenseSetup · hard

TLDR

A WebAssembly interpreter built in Lean 4 that lets you mathematically prove what a program will do for all possible inputs, not just run it on examples.

Mindmap

mindmap
  root((talos))
    What it does
      Executes WebAssembly
      Formal verification
      Proof writing
    Tech stack
      Lean 4
      WebAssembly
      wasm-tools
    Use cases
      Prove program correctness
      Verify Rust compiled Wasm
      Formal semantics research
    Audience
      Researchers
      Formal methods engineers
      Language designers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Prove that a Rust function compiled to WebAssembly always returns the correct result for all inputs.

USE CASE 2

Verify that two WebAssembly programs behave identically for every possible input.

USE CASE 3

State and prove postconditions about loops and branches in a Wasm program using weakest precondition calculus.

Tech stack

Lean 4WebAssemblywasm-tools

Getting it running

Difficulty · hard Time to first run · 1day+

Requires Lean 4 via its version manager and wasm-tools, the API and proof interfaces are still a work in progress.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

Talos is a WebAssembly interpreter written in Lean 4, a programming language that doubles as a proof assistant. WebAssembly (often shortened to Wasm) is a binary format that compilers for languages like Rust and C can produce, and which can then run in browsers or other environments. An interpreter is the software that actually executes that binary. What makes Talos different from a conventional Wasm interpreter is its purpose. Most interpreters are built to run code quickly. Talos is built to let you reason about code formally: you can run a program on concrete inputs, but you can also state and mathematically prove claims about what the program will do for all possible inputs, or prove that two programs behave identically, or prove that a specific function always returns the correct result. The same code that executes a program is the code you write proofs against, so there is no risk of the proof applying to a different version of the semantics than the one actually running. Proofs in Talos use a technique called weakest precondition calculus. In practical terms, this means you describe what you want to be true after a function runs (the postcondition), and the proof system works backwards to figure out what must be true going in (the precondition). This approach handles loops, branches, and function calls in a structured way without having to unfold the entire interpreter definition every time. The repository is split into three packages. The core interpreter contains the WebAssembly semantics and the proof tooling layer. A second package adds helper lemmas and utilities for reasoning about programs. A third package holds worked verification examples for Rust-compiled Wasm programs. To use it you need Lean 4 (managed automatically by its version manager) and a tool called wasm-tools for handling binary Wasm files. The project is marked as a work in progress, meaning the API and proof interfaces may still change. It is released under the MIT license.

Copy-paste prompts

Prompt 1
I have a Rust function compiled to WebAssembly. Using Talos in Lean 4, show me how to write a formal proof that the function always returns a value greater than zero.
Prompt 2
Walk me through setting up Talos with Lean 4 and wasm-tools to verify a simple WebAssembly binary from scratch.
Prompt 3
Using Talos's weakest precondition calculus, write a proof that a WebAssembly loop terminates and produces the correct output.
Prompt 4
Show me the structure of a worked verification example in the Talos repo for a Rust-compiled Wasm program.
Open on GitHub → Explain another repo

← cajal-technologies on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.