How AI Agents Can Formally Verify Real Software

Key Takeaways
- •DeepMind verified key Signal protocol implementation properties using AlphaProof Code, generating over 6 million lines of Lean checked by formal proof checkers.
- •Examines the division between fallible generation and trusted checking, analyzing the structural bottlenecks and trade-offs in real-world deployments.
- •Provides engineering benchmarks and verification criteria for proving signal protocol implementation properties.
On 10 November 2026, Google DeepMind unveiled AlphaProof Code, an agentic framework that generated over six million lines of Lean proof code across four weeks to mathematically verify core implementation properties of the Signal protocol. The milestone demonstrates how autonomous agents can accelerate formal verification by pairing fallible proof generation with deterministic proof checkers.
Traditional software assurance relies on unit tests, integration suites, and automated fuzzing. While testing identifies common execution regressions, it cannot mathematically prove the absence of software defects. Edge cases in cryptographic handshakes, concurrency locks, and memory bounds frequently escape empirical test suites. Formal verification provides mathematical certainty, but human authoring of formal proofs has historically required prohibitive engineering labor.
The division between fallible generation and trusted checking
The core architectural insight behind AlphaProof Code lies in decoupling proof generation from proof checking. Large language models frequently hallucinate code, generate incorrect mathematical claims, and introduce subtle logical fallacies. In typical software development, detecting these hallucinations requires human peer review.
In formal methods, however, the validation step is entirely mechanical. The system operates across two asymmetric components:
- The generator: an ensemble of language model agents tasked with exploring proof search spaces, decomposing lemmas, and proposing candidate proof steps in the Lean 4 language.
- The checker: the Lean theorem prover's trusted kernel, a compact, verified program that evaluates whether candidate proof terms strictly satisfy formal mathematical axioms.
┌────────────────────────────────────────────────────────┐
│ Human Domain Experts │
│ │
│ [Translate Software Goals into Formal Specifications] │
└───────────────────────────┬────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ AlphaProof Code Agent Loop │
│ │
│ [Decompose Lemmas] ──> [Generate Candidate Lean Code] │
└───────────────────────────┬────────────────────────────┘
│ (Propose Proof Terms)
▼
┌────────────────────────────────────────────────────────┐
│ Lean 4 Verification Kernel │
│ │
│ [Deterministic Type Checking & Axiom Evaluation] │
│ │ │ │
│ (Valid) ▼ (Reject)▼ │
│ [Proved Theorem] [Feedback to Agent] │
└────────────────────────────────────────────────────────┘Because the Lean kernel is deterministic, an agent cannot hallucinate a pass. If an agent outputs invalid logic or references non-existent variables, the proof checker rejects the candidate term instantly, returning exact error diagnostics. The agent incorporates this compiler feedback into subsequent reasoning turns, iteratively refining the proof until the kernel accepts it.
Proving Signal protocol implementation properties
Applying formal methods to real-world software requires bridging the gap between high-level protocol designs and concrete source code. Cryptographic protocols such as Signal, documented in the open specifications published by the Signal Technology Foundation, are designed with formal mathematical guarantees on paper. However, implementation bugs in memory management, state machine transitions, or serialization can compromise security even when the underlying protocol design is sound.
In the DeepMind project, engineers and cryptographers focused on verifying the actual code running in the implementation. The process followed three phases:
- Formal specification: human researchers formalized the protocol's expected security invariants into Lean theorems, establishing exact mathematical statements for message secrecy, key agreement soundness, and replay protection.
- Automated proof synthesis: AlphaProof Code decomposed the theorems into auxiliary lemmas, systematically generating Lean tactics to bridge the gap between implementation source code and formal invariants.
- Mutation validation: to verify that the proof system was not trivially accepting flawed code, the researchers reintroduced historical fixed bugs into an isolated copy of the codebase. In every instance, the formal verification pipeline failed to prove the mutated code, successfully detecting the security flaws.
Why formal specification remains a human responsibility
While AI agents successfully automated proof generation, the project illuminated clear boundaries regarding what machine learning can achieve in software verification.
The most critical stage of the formal verification pipeline remains the formulation of the theorem itself. If human engineers specify the wrong property, or if their Lean theorem fails to capture critical side-channel vectors such as cache timing or memory allocation failures, an agent will produce a mathematically valid proof for an incomplete specification. The code will be formally verified against the written theorem, yet vulnerable in deployment.
Formal verification proves that an implementation matches a formal specification. It does not prove that:
- The specification correctly models all real-world adversary capabilities.
- The downstream compiler translates the verified source code into machine binaries without introducing regressions.
- The underlying physical hardware executes the CPU instructions without electrical or microarchitectural flaws.
Operational requirements for agentic formal methods
Deploying agentic verification across commercial software requires specialized tooling and compute infrastructure:
- High-throughput proof checking: running thousands of parallel Lean verification instances requires scalable container infrastructure optimized for low-latency kernel execution.
- Syntactic error recovery: language models frequently produce syntax errors in specialized theorem languages; effective agent harnesses must include dedicated syntax-repair loops before submitting terms to the kernel.
- State-space pruning: without heuristic guidance on theorem decomposition, proof search algorithms suffer from exponential explosion, requiring human engineers to seed intermediate proof milestones.
Sources
- Google DeepMind: Introducing AlphaProof Code (10 November 2026), Google DeepMind, 10 November 2026
- Lean Language and Theorem Prover Documentation, Lean Community, 15 October 2026
- Signal Protocol Specifications, Signal Technology Foundation, 1 November 2024
- Signal Source Code Repositories, Signal Technology Foundation, 10 November 2026



