Google DeepMind made the Lean 4 framework publicly available, a tool designed to validate quantum algorithms created through its Gemini 4 agents. One algorithm achieved a 290-fold reduction in estimated computational costs. The public release includes mathematical definitions, formal specifications, and verified solutions accessible via GitHub, though Google has not disclosed the internal coordination system that managed the agents' collaboration.

This announcement builds on research published to arXiv on November 6 under the title "Discovering Formally Verified Quantum Programs with AI," which outlines how Google combined multi-agent algorithm discovery with machine-checked proofs. "The agents used a theorem prover to check whether their quantum programs met predefined requirements for correctness and computational cost." Google previously demonstrated a comparable methodology when deploying Gemini 4 Carbon to validate encryption properties in Signal using Lean.

Lean 4 Framework Architecture

The framework extends Lean 4 by building upon the Mathlib and Physlib libraries to enable quantum programming and cost verification. The same theorem prover foundation supports other code-verification initiatives, including Mistral's Leanstral. Two primary components structure the framework: QuantumComputation houses the essential quantum programming utilities and mathematical foundations, while QuantumComputationSpecs establishes the optimization challenges and correctness criteria the agents addressed.

The system accommodates both conventional control structures and quantum operations, employing quantum Hoare logic to establish program correctness. Resource consumption calculations form a key capability, with Google quantifying computational expense through the product of logical qubits and T gate count. Developers can compile the repository using Lean's Lake build system.

lake exe cache get
lake build

Google distributes the software under the Apache 2.0 license and maintains verified algorithms in a dedicated discoveries branch. Future iterations will broaden the cost models to incorporate classical computation and control flow considerations.

Agent Coordination and Collaboration

Multiple independent teams of Gemini 4 Carbon agents tackled optimization challenges with predetermined mathematical parameters. Lean's verification feedback guided iterative algorithm refinement. "The most collaborative effort involved a non-Born-Oppenheimer photochemistry simulation, with as many as seven teams working in parallel." Teams documented verified findings on a shared wiki and conducted virtual synchronization sessions every four hours to assess progress and incorporate each other's breakthroughs.

Preventing Specification Manipulation

Since agents could alter files within their working environments, a risk existed that they might relax specifications or introduce unwarranted assumptions to achieve proof completion. To mitigate this, submissions underwent validation in isolated sandboxes against immutable specifications. Lean Comparator identified modifications to definitions and theorems while rejecting proofs containing unverified placeholders or unauthorized axioms. This verification strategy parallels Anthropic's Claude Code methodology, prioritizing automated validation over manual inspection of AI-generated code. Google has made the formal verification libraries and solutions available publicly, but the proprietary infrastructure orchestrating the Gemini agents remains undisclosed.

Computational Savings Achieved

The most substantial improvement emerged from a fixed-point arcsin algorithm, where estimated resource requirements decreased by a factor of 290. The optimized circuit operates with 100 logical qubits and 3,698 T gates compared to the original design requiring 245 qubits and at least 440,576 T gates. Classical testing produced initial gains, with formal verification enabling more sophisticated circuit architectures that delivered an additional 11% cost reduction.

"Photochemical simulation costs fell roughly eightfold, while a simulation involving cytochrome P450 saw a 2.5-fold improvement." An inertial confinement fusion simulation experienced an 11.8-fold cost reduction, with logical qubit requirements dropping from 5,650 to 4,338. These represent formally verified resource projections rather than measurements from actual quantum hardware execution; current quantum systems lack the capability to perform such scientific simulations.

Developers can independently verify the published proofs using the repository's fixed Lean, Mathlib, and Physlib versions, with verified algorithms available in a separate branch. Replicating the discovery workflow presents a different challenge, as Google's agent coordination infrastructure remains proprietary. The framework's resource accounting also carries constraints—it does not yet comprehensively model classical computation and control flow, a limitation Google intends to address in subsequent releases.