AlphaProof Code: DeepMind's agents write 7 million lines of Lean to prove security properties of Signal's compiled cryptographic library

Google DeepMind's AlphaProof Code produced machine-checked Lean proofs that an AArch64 build of libsignal has forward secrecy, post-compromise security and authentication, in a symbolic and a computational model. We explain the machine-code model, the untrusted-prover and gatekeeper design, what remains trusted (about 18,000 lines of statements plus stubs for the crypto primitives), the bug test and the limits.
In short
On 10 November 2026 Google DeepMind presented AlphaProof Code, a system of LLM agents that writes proofs in the Lean proof assistant about real programs. Its first result: machine-checked security proofs for a compiled build of libsignal, the cryptographic core of the Signal messenger. The theorems speak about the 140,000 machine instructions of the binary, not about the Rust source or a paper model of the protocol. Five people worked for about four weeks and wrote specifications; the agents wrote about 7 million lines of Lean and no human wrote proof code. The proofs cover one-to-one sessions of a command-line build, not the Signal apps, and they exclude side channels. Within those limits this is the deepest verification of a deployed messaging protocol so far.
How it works
Verification has always had a gap. Cryptographers prove that a protocol design is secure. Engineers then write code, a compiler translates it, and bugs can enter at each step. AlphaProof Code closes the gap by proving the security property for the final executable.
Three steps:
- Say what to prove. People, helped by agents, write the security goals as formal statements in Lean: what the attacker may do, and what must stay secret. Experts review every statement. This is where the human time went.
- Prove it. Teams of 40 to 80 agents search for proofs. They are not trusted.
- Check it. A "gatekeeper" holds a read-only copy of the statements, lets Lean's small kernel check each finished proof, and confirms that the proof proves exactly the agreed statement with only the standard axioms.
The important design idea: it does not matter how the agents found a proof, or whether they "understood" it. If the kernel accepts it, it is correct relative to the statement. What must be right is the statement.
Analogy: the agents are contractors who may build as they like; the building inspector checks only the finished structure against the approved plan. The risk moves to the plan.
Under the hood
The target. A small command-line harness, libsignal-cli, around libsignal v0.105.4 and the post-quantum ratchet crate spqr v1.6.0. It is built with the stock Rust compiler (rustc 1.98.1), statically linked with musl, for AArch64 Linux: about 560 KB and roughly 140,000 instructions. The theorems cover the init, send and recv operations, that is PQXDH session setup, Triple Ratchet messaging and the SPQR state machine. Key generation is not verified.
The machine model. A model of user-mode AArch64 Linux written in Lean (about 7,500 lines): 467 instructions following Arm's official ASL specification, 31 system calls, byte-addressed memory with page permissions, and an ELF loader. The team tested it instruction by instruction against the Unicorn emulator and the Sail Armv9.4-A model, and tested loader and system calls against qemu. Because the proofs are about the binary, the Rust compiler and the Rust source are not trusted.
Two security proofs on the same binary.
- Symbolic (Dolev–Yao). Cryptography is treated as perfect, and the attacker controls the network. Ten theorems hold over every reachable trace: forward secrecy, post-compromise security, secrecy of the handshake for initiator and responder, authentication, and resistance to key-compromise impersonation. Corollaries include resistance to "harvest now, decrypt later".
- Computational. A concrete bound on the success probability of any classical attacker with bounded queries against confidentiality and authenticity, including forward secrecy and post-compromise security, under standard assumptions (Gap Diffie–Hellman, XEdDSA unforgeability, PRF security of HKDF and HMAC, one-time CCA security of AES-CBC with HMAC, and others). The reductions are written in a language with a cost model, so "there is a reduction" cannot be satisfied by an unrealistic one.
Proof size.
| Part | Lines of Lean |
|---|---|
| Binary-level proofs (shared by both security proofs) | about 5.3 million |
| Computational security proof | about 860,000 |
| Symbolic security proof | about 350,000 |
| Proofs for the two re-introduced bugs | about 140,000 |
| Memory allocator verification | about 70,000 |
| Total | about 7 million |
DeepMind's blog text says "over six million lines" and its summary line says "over three million"; the paper's breakdown above is the most detailed source.
What you must still trust.
- Lean's kernel.
- The AArch64 and Linux model (about 8,000 lines) and about 95,000 lines of generated representation of the binary.
- About 18,000 lines of statements and definitions that the main theorems depend on. A reader who wants to check the result needs to read these, not the 7 million lines.
- Contracts for routines that were not verified but replaced by trusted stubs: SHA-2 compression, AES-256-CBC, X25519 and Edwards operations, Kyber1024, ML-KEM-768 and HMAC (from the libcrux library), five libc memory routines and the output writers.
- The cryptographic assumptions.
The agents. An orchestrator that never edits Lean, team leads, proof workers, an architect and an integrator; one editor per file, and only the integrator commits. Gemini 4 Carbon ran the proof teams and much of the specification work; Claude Opus 5.5 was used for drafting specifications and for review by a different model family. Each proof campaign ran 24 to 72 hours on one workstation. The gatekeeper rejects sorry (an unfinished proof) and native_decide. If a statement turns out to be unprovable, a separate critic agent that never sees proof attempts reviews the proposed change; it requires a machine-checked disproof of the old statement and no weakening of security, and a human approves anything that affects trust.
A test of the method. The team re-introduced two known, already fixed libsignal bugs by reverting their fix commits: one stores unconfirmed session state after a trial decryption, the other skips a check on the initiator's X25519 key (small-subgroup problem). For both buggy binaries the agents produced Lean proofs that the symbolic security theorem is false, each with a concrete attack trace. So the statements are strong enough to notice real bugs.
Limits stated in the paper.
- Side channels (timing, cache, power) and other secrets in memory are out of scope.
- No group messaging, no multi-device state, no more than two parties.
- The computational proof covers classical attackers only. The post-quantum "healing" of SPQR is not covered.
- Loss of forward secrecy through message replay is not excluded by the model.
- The bounds lose meaning at very large scale (about 25,000 messages in one session).
- The 8-byte MAC allows a forgery with probability at least 2⁻⁶⁴ per attempt.
- The result holds for this binary started as a fresh process. It does not transfer automatically to the Android or iOS apps, which use other builds and other surrounding code.
- The Lean and mathlib versions are not stated in the paper.
Context. In October, Anthropic and Theorem published no-crash proofs for 123 open-source libraries written with Claude in Rocq. That work proves a simpler property (no crash) at source level across many libraries. The DeepMind work proves a hard property (cryptographic security) at machine-code level for one program. The two results are not comparable by line counts.
Try it yourself
The Lean development is public at google-deepmind.github.io/code-verification. We did not rebuild it; the paper says a clean build can take several hours. If you want to judge the result, read the trusted statements first.
Two Python live snippets show the security properties themselves in toy form (standard library only; these are teaching models, not Signal).
- Forward secrecy and post-compromise security in a toy ratchet. A hash chain derives one key per message. An attacker who steals the state before message 3 gets keys 3, 4, 5 but no old key; mixing in a fresh secret heals the chain. Expected output:
attacker derives an OLD key (0, 1, 2): False
attacker derives keys 3, 4, 5 : True
attacker has the healed chain key : False
chance of repeated 'fresh coins' over 2^40 draws: about 2^-171
forgery chance per attempt with an 8-byte MAC : 2^-64
- A tiny Dolev–Yao attacker. Terms are built from pairing, encryption and key derivation; the attacker can take pairs apart and decrypt only with a known key. Expected output:
no compromise: m1 secret? True m2 secret? True
k1 leaked: m1 secret? False m2 secret? True
k1 and dh2 leaked (bug): m1 secret? False m2 secret? False
The second line is post-compromise security: the next key mixes in a fresh secret, so the later message stays safe. The third line is the shape of the bug experiment: one concrete trace disproves the theorem. The real proofs make the same kind of statement, but for every trace that the 140,000-instruction binary can produce.
Python in your browser
Sources
What should happen next with this?
One click per article, no account needed. “Go deeper” feeds the research queue.