NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

QEDIA: Quantum Program Verification in Lean

Yuanjie, Ren, Zhicheng Zhang, Junyi Liu, Jinzheng Li, Yidi Qi, Mingsheng YingarXiv 2026

TL;DR

QEDIA is a new formal verification framework built in Lean 4 that enables the rigorous proof of correctness for quantum programs that interleave classical and quantum computation. By formalizing an advanced program logic ($QHL^+$) and leveraging an LLM-based "prover agent" to assist in constructing complex proofs, the authors successfully verified eleven sophisticated quantum algorithms, including the Quantum Fourier Transform and Hamiltonian simulations.

What Problem Does This Paper Address?

Quantum programming isn't just about gates; it’s about the "interplay" between classical and quantum states. In practical algorithms, classical data often determines which quantum gates are applied (e.g., in a loop), and quantum measurement outcomes frequently dictate the subsequent classical control flow (e.g., in repeat-until-success circuits).

Verifying these hybrid programs is notoriously difficult. Traditional testing is hampered by the no-cloning theorem and the fact that measurement collapses quantum states. Formal verification—proving a program matches its mathematical specification—is the ideal solution, but existing tools often struggle to handle this classical-quantum interplay consistently across all levels, from basic linear algebra to high-level program logic. Furthermore, building these proofs manually in a proof assistant like Lean or Coq requires an enormous amount of expert effort.

Methods

The authors introduce QEDIA, which tackles these challenges through three main pillars:

  1. Formalization of $QHL^+$: They formalized a version of Quantum Hoare Logic ($QHL^+$) in Lean 4. Unlike earlier logics, $QHL^+$ explicitly supports quantum arrays, parameterized gates, and specifications where quantum predicates depend on classical variables. They proved this logic sound for both partial correctness (the program is correct if it terminates) and total correctness (the program is correct and will terminate).
  2. Multi-Level Interplay Handling: The framework manages the classical-quantum connection at three distinct levels:
  3. (L0) Mathematical Foundation: Building on Lean’s Mathlib, they formalized the underlying Hilbert space mathematics and Dirac notation.
  4. (L1) Syntax and Semantics: They created a deep embedding of a quantum "while-language" where classical guards and updates are integrated with quantum operations.
  5. (L2) Specification: They developed a system for "cq-assertions" (classical-quantum assertions) that allow classical formulas to be paired with quantum predicates.
  6. Agent-Based Proof Construction: To overcome the "manual effort" bottleneck, they used an LLM-based prover agent. This agent uses a "leader-subagent" architecture: a leader agent defines tasks and reviews proofs, while subagents construct and repair Lean code based on feedback from the Lean compiler. This allows for AI-assisted verification that remains mathematically rigorous because every proof is ultimately checked by Lean’s kernel.

Datasets

As a formal verification paper, QEDIA does not use traditional training datasets. Instead, it evaluates its framework against a "benchmark" suite of eleven verified program examples. These include:

  • Foundational circuits: Bell-state preparation, parallel Hadamard.
  • Core algorithms: Quantum Fourier Transform (QFT) and its inverse, Quantum Phase Estimation (QPE).
  • Hybrid control flow: A Repeat-Until-Success (RUS) circuit.
  • Advanced simulations: Trotter-based Hamiltonian simulation and components for Fermi-Hubbard model simulation (Bravyi-Kitaev encoding, LCU block encoding, and QSP).

Key Insights and Ideas

  • The "Interplay" is Everywhere: The authors argue that a verifier cannot treat classical and quantum parts as separate modules. The logic must allow classical variables to index qubits and parameterize gate angles directly within the proof rules.
  • Soundness for Approximations: One of the most impressive "aha" moments is the verification of the Trotter product formula. QEDIA doesn't just prove the circuit implements a sequence of gates; it proves an approximation guarantee, showing the output state is within a specific error bound ($\epsilon$) of the ideal evolution.
  • AI as a Formal Partner: The paper demonstrates that LLMs can be highly effective at formal verification if they are embedded in a rigorous workflow. By separating "fixing the statement" from "proving the statement" and using Lean's kernel as the ultimate arbiter, they mitigate the risk of LLM hallucinations.

Key Results

  • Verified Soundness: The $QHL^+$ logic is formally proved sound in Lean 4 for both partial and total correctness.
  • Complexity Benchmarks: The framework successfully verified the QFT on arbitrary inputs and the success probability of RUS circuits—tasks that are difficult or impossible for many existing quantum verifiers.
  • Library Scale: The QEDIA library consists of approximately 13,000 lines of Lean code, with an additional 8,500 lines dedicated to the example proofs.
  • Agent Efficiency: The use of the prover agent allowed the team to build a massive, foundational library and verify complex algorithms with a degree of automation that significantly reduces the human expert hours typically required for such projects.

Limitations and Future Work

  • Quantum Recursion: The current version of QEDIA supports while loops but does not yet handle quantum recursive procedures, which require even more complex termination proofs.
  • Parallelism: The framework currently focuses on sequential quantum-classical interleaving. Extending this to parallel or distributed quantum programs (where entanglement between distant components is a factor) remains a challenge.
  • Error Correction: While the authors mention Quantum Error Correction (QEC) as a natural next target (due to its heavy reliance on classical decoding of quantum syndrome measurements), it is not yet implemented in the current library.

Summary updated

BibTeX
@misc{yuanjie2026qedia,
  author = {Yuanjie and Ren and Zhicheng Zhang and Junyi Liu and Jinzheng Li and Yidi Qi and Mingsheng Ying},
  title = {{QEDIA: Quantum Program Verification in Lean}},
  year = {2026},
  eprint = {2610.17708},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.17708},
}
Figure