arXiv:2610.17708quant-phOct 2026

Manuscript Offprint

arXiv:2610.17708

QEDIA: Quantum Program Verification in Lean

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

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

YUANJIE (COLLIN) REN*, Massachusetts Institute of Technology, USA and Atomic Inference Inc, USA

ZHICHENG ZHANG*, Griffith University, Australia

JUNYI LIU*, University of Maryland, USA

JINZHENG LI, Northeastern University, USA

YIDI QI, Harvard University, USA

MINGSHENG YING, University of Technology Sydney, Australia

Practical quantum programs interleave quantum and classical computation: classical data shape the quantum operations that are performed, and measurement outcomes shape the classical computation that follows. Formal verification of such programs in a proof assistant requires mechanizing a program logic that handles this interplay consistently at every level, from the mathematics of quantum mechanics, through program syntax and semantics, to specifications and proof rules. Such mechanizations, along with the program proofs built on them, typically require substantial manual effort.

We present QEDIA, a framework for verifying quantum programs with classical variables in Lean 4. At its foundation is an open library that formalizes the quantum Hoare logic QHL +^{+} across all these levels and proves the logic sound for both partial and total correctness. We construct the library and the program proofs, under human supervision, using an LLM-based prover agent, whose general-purpose core we extend for quantum program verification. We illustrate QEDIA with verified programs including the quantum Fourier transform, phase estimation, repeat-until-success circuits, and Hamiltonian simulation.

CONTENTS

Abstract 1
Contents 1
1 Introduction 2
2 Motivating Examples 4
3 Preliminaries: QHL +^{+} 7
3.1 Classical and Quantum Variables 7
3.2 Syntax and Semantics of qWhile +^{+} 7
3.3 Formal Quantum States and Assertions 9
3.4 Proof System 10
4 Formalization in Lean and Library Organization 11
4.1 State Spaces and Programs 12
4.2 Execution Paths 13
4.3 Assertions and Validity 13
4.4 Proof Systems and Soundness 14
4.5 Code Metrics 14
5 The Prover Agent: Building the Library and Verifying Programs 15
5.1 Core Agent 15
5.2 Quantum Extension 16

∗^{*}These authors contributed equally to this work.

Authors' Contact Information: Yuanjie (Collin) Ren, Massachusetts Institute of Technology, Cambridge, MA, USA and Atomic Inference Inc, Cambridge, MA, USA, yuanjie@mit.edu; Zhicheng Zhang, School of Information and Communication Technology, Griffith University, Brisbane, Australia, iszczhang@gmail.com; Junyi Liu, Joint Center for Quantum Information and Computer Science, University of Maryland, College Park, MD, USA; Jinzheng Li, Department of Physics, Northeastern University, Boston, MA, USA; Yidi Qi, Harvard University, Cambridge, MA, USA; Mingsheng Ying, Centre for Quantum Software and Information, University of Technology Sydney, Sydney, Australia, Mingsheng.Ying@uts.edu.au.

Ren et al.

6 Verified Program Examples 17
6.1 Overview 17
6.2 Quantum Fourier Transform 18
6.3 Repeat-Until-Success 20
6.4 The Trotter Product-Formula Circuit 22
7 Related Work 23
8 Conclusion and Future Work 24
Acknowledgments 25
References 25
A Details of the Formalization 27
A.1 Deriving the Original Measurement Axiom 27
A.2 The RUS Program and Specification in Lean 28
B Further Verified Examples 29
B.1 The QFT on Arbitrary Inputs 29
B.2 Bell-State Preparation 29
B.3 Parallel Hadamard 30
B.4 Inverse QFT 30
B.5 Quantum Phase Estimation 31
B.6 Cluster-State Preparation 32
B.7 Building Blocks for Fermi-Hubbard Simulation 33

References (59)