A Rust-to-Lean Verification Pipeline with AI Provers: An Experience Report
This paper presents a sound, kernel-checked verification pipeline that integrates Rust-to-Lean extraction tools, formal cryptographic libraries, and AI provers to successfully generate machine-checked correctness proofs for production Rust cryptographic code within the Ethereum Foundation's zkEVM project.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you have a high-stakes factory that builds the digital keys for a massive, invisible vault (a Zero-Knowledge Virtual Machine). If even one tiny gear in this factory is slightly bent, the entire vault's security is compromised, and no one will know until it's too late.
For years, checking these gears has been like hiring a team of expert mechanics to inspect every single bolt by hand. It's slow, expensive, and relies on the mechanics not missing anything.
This paper describes a new, automated assembly line that does three things:
- Translates the factory's blueprints (written in a complex language called Rust) into a universal, mathematical language (Lean 4) that a computer can understand perfectly.
- Provides a perfect, pre-written "gold standard" of how the machine should work (using libraries called ArkLib and CompPoly).
- Hires a super-smart AI assistant (called Aleph and Aristotle) to compare the translated blueprints against the gold standard and write the proof that they match.
Here is how the process works, using simple analogies:
1. The Translator (Rust to Lean)
The factory's blueprints are written in Rust, a language engineers love for building fast, safe software. However, the "mathematical judges" (the Lean 4 system) don't speak Rust; they only speak pure math.
The paper uses tools called Aeneas and Hax as translators. They take the Rust code and convert it into "pure functional" math.
- The Analogy: Imagine taking a recipe written in a chef's slang (Rust) and translating it into a strict, step-by-step chemical formula (Lean). The translator also adds "safety tags" to every step. If a step might fail (like dividing by zero or running out of ingredients), the translation marks it clearly so the math can check for it.
2. The Gold Standard (The Specifications)
You can't prove a machine works unless you have a definition of "working."
- The Analogy: Think of ArkLib and CompPoly as the "Official Rulebook" for cryptography. They contain the perfect, abstract definitions of how things like "folding a paper" (FRI folding) or "checking a Merkle tree" should behave mathematically.
- The goal is to prove that the translated Rust code (the factory machine) does exactly what the Rulebook says it should do, no more and no less.
3. The AI Proof-Writer (The "Brain")
This is the most exciting part. Once the code is translated and the rulebook is ready, you need to write a proof that they match. Traditionally, a human mathematician had to write this proof, which is like solving a massive, complex puzzle.
The paper introduces AI Provers (Aleph and Aristotle) to do the heavy lifting.
- The Analogy: Imagine the AI as a tireless, super-fast detective. You give it the translated blueprint and the rulebook, and it says, "I see the connection! Here is the proof."
- Crucial Safety Check: The AI doesn't just say it's right; it writes the proof in a language the Lean Kernel (the ultimate judge) can read. The Kernel checks every single step of the AI's logic. If the AI guesses wrong, the Kernel rejects it. So, the AI can be creative, but it can't cheat.
What They Actually Did
The team applied this pipeline to real-world cryptographic code used in the Ethereum Foundation's projects (specifically Plonky3 and RISC Zero).
- The Success: They successfully proved that specific parts of the code (like calculating how to fold data or checking if a tree is included correctly) were mathematically perfect.
- The AI's Role: In one specific example involving a function called
compute_log_arity_for_round, the AI (Aleph) automatically wrote two complex proofs that had previously been stuck (marked as "sorry," meaning "we know it's true, but we haven't proven it yet"). - The Human's Role: The AI was great at handling logic puzzles, "if-then" scenarios, and basic math. However, it still needed humans to:
- Design the overall strategy (the "Rulebook").
- Handle complex loops (like finding the right pattern in a repeating sequence).
- Fix translation errors where the Rust code was too tricky for the translator to handle.
The Hiccups (Engineering Gaps)
The paper admits the assembly line isn't perfect yet.
- Version Mismatch: The translators, the rulebooks, and the AI all speak slightly different "dialects" of the math language. The team had to coordinate to get everyone on the same version.
- Translation Limits: Some complex Rust features (like generic types or external libraries) are hard for the translators to convert. The team had to rewrite some code into a simpler "model" just so the translator could understand it.
The Bottom Line
This paper doesn't claim that AI has replaced human engineers. Instead, it shows a pipeline where:
- Humans translate the code and set the goals.
- AI acts as a powerful assistant to write the tedious, logical proofs.
- A strict computer judge (the Kernel) verifies everything to ensure safety.
The result is a working system that turns production-grade cryptographic code into machine-checked, mathematically guaranteed proofs, making the "invisible vault" significantly safer.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.