A Verified Compiler for Quantum Simulation

Liyi Li, Fenfen An, Federico Zahariev, Zhi Xiang Chong, Amr Sabry, Mark S. Gordon · 2025

Read A Verified Compiler for Quantum Simulation by Liyi Li, Fenfen An, Federico Zahariev, Zhi Xiang Chong, Amr Sabry, Mark S. Gordon (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2509-18583.txt.

Introduction

Compilers that turn physics descriptions into quantum circuits rarely carry proof that the translation is right. Liyi Li and five co-authors present QBlue, a verified compiler for Hamiltonian simulation, in this 2025 paper. Hamiltonian simulation models how quantum systems evolve, a core use of quantum computers. Older compilers work at a low level with Pauli operators, which limits how users can write programs.

QBlue starts from second quantization, the standard language of particle creation and removal. A type system tracks particle types and enforces the symmetry the physics demands. The compiler targets both digital and analog quantum circuits. Every part, from language design to the correctness proof, is mechanized in the Rocq proof framework. The authors call it the first compiler for this class of simulation verified end to end. It aims to make quantum chemistry and materials programs safer to build.

Catalog record

CREATORLiyi Li, Fenfen An, Federico Zahariev, Zhi Xiang Chong, Amr Sabry, Mark S. Gordon
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE15 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2509-18583

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

A Verified Compiler for Quantum Simulation Liyi Li, Fenfen An, Federico Zahariev, Zhi Xiang Chong, Amr Sabry, Mark S. Gordon Abstract . Hamiltonian simulation is a central application of quantum computing, with significant potential in modeling physical systems and solving complex optimization problems. Existing compilers for such simulations typically focus on low-level representations based on Pauli operators, limiting programmability and offering no formal guarantees of correctness across the compilation pipeline. We introduce QBlue , a high-level, formally verified framework for compiling Hamiltonian simulations. QBlue is based on the formalism of second quantization, which provides a natural and expressive way to describe quantum particle systems using creation and annihilation operators. To ensure safety and correctness, QBlue includes a type system that tracks particle types and enforces Hermitian structure. The framework supports compilation to both digital and analog quantum circuits and captures multiple layers of semantics, from static constraints to dynamic evolution. All components of QBlue , including its language design, type system, and compilation correctness, are fully mechanized in the Rocq proof framework, making it the first end-to-end verified compiler for second-quantized Hamiltonian simulation. 1. Introduction Quantum simulation is a flagship application of quantum computing, promising to model physical systems ( Zhang_2021 ; osti_1782924 ; du2023multinucleon ) , chemical reactions ( Lanyon2010 ; Cao2019 ; Evangelista2023 ; RevModPhys.92.015003 ) , and materials ( Emani2021 ; Fedorov2021 ; wcms.1481 ) with precision beyond classical capabilities ( feynman1982simulating ) . Yet programming such simulations remains precarious. Current compilers for Hamiltonian simulation operate at low-level abstractions, often directly manipulating Pauli strings or untyped tensor expressions, and provide no formal guarantees about the correctness of the resulting circuits ( 10.1145/3470496.3527394 ; 10.1145/3632923 ; cao2024marqsimreconcilingdeterminismrandomness ; 10.1145/3503222.3507715 ) . This disconnect between high-level physical intent and low-level implementation risks silent errors, miscompiled models, and untrustworthy scientific outcomes. We present QBlue , the first formally verified compiler for quantum simulation based on the formalism of second quantization . QBlue allows users to express Hamiltonians in terms of creation and annihilation operators, enforcing Hermiticity and physical validity through a high-level type system. Programs written in QBlue are compiled into executable quantum circuits or analog schedules with end-to-end formal guarantees : every compilation path is verified using a mechanized proof system, and all generated artifacts preserve the intended quantum dynamics within proven error bounds. To support this, QBlue employs a three-tiered semantic architecture: • Constraint semantics defines symbolic, well-typed Hamiltonians using second-quantized expressions subject to constraints such as Hermiticity and particle type; • Dynamic semantics interprets the simulation operator \texttt{exp}(\texttt{-}ir\,e) as the time evolution of the Hamiltonian e over a duration r ; • Application semantics compiles the simulation operator into backend-specific execution artifacts, such as gate-based circuits via Trotterization or QDrift, or weighted interaction graphs for analog Ising platforms. These layers are connected via a type-indexed compilation pipeline , verified in the Rocq proof framework ( bertot2013interactive ) . Each transformation is guided by types that track not just dimensions and modes (e.g., bosonic 1 1 1 More precisely, we model finite “boson-like” systems as representing a real boson needs an infinite Hilbert space state. vs. fermionic 2 2 2 For simplicity, we restrict fermions in one system to be of the same kind and the same spin. ), but also matrix kinds (plain, Hermitian, unitary), ensuring that the semantics of quantum simulation is preserved throughout. The type system plays a central role, as it enforces anti-commutation for fermions, validates that matrix expressions are well-formed and Hermitian where required, and ensures that exponentiated Hamiltonians yield unitary operators. Equational rules, canonicalization procedures, and symbolic rewrites are all type-preserving and fully mechanized. QBlue supports multiple backends , each with distinct compilation paths and correctness theorems. For digital platforms, QBlue emits standard gate sequences with Trotterized simulation of Pauli terms. For stochastic simulation, it supports QDrift-based sampling. For analog devices, it produces native Ising Hamiltonians for direct scheduling. All paths are type-preserving and formally linked to the semantics of the original program. We prove a central compilation correctness theorem : for any Hermitian-typed Hamiltonian expression e and simulation time r , the compiled program U simulates \exp(-ire) within a formally derived error bound \epsilon . These bounds are computed symbolically as part of the compiler and are backend-specific, capturing, for instance, differences between first-order Trotterization and QDrift. Backend-specific optimizations (e.g., analog graph emission) are verified to preserve semantics modulo these error bounds. Summary of Contributions This paper contributes: • A typed second-quantization quantum programming language supporting bosonic and fermionic modes, symbolic operators, and physically meaningful type-indexed semantics; • A verified compilation pipeline that spans constraint, dynamic, and application semantics targeting multiple backends (gate-based, stochastic, and analog) with certified error bounds; • A mechanized metatheory, including type soundness, anti-commutation preservation, equational correctness, and end-to-end compilation theorems; • A complete example of typed, verified Hamiltonian simulation, illustrating how symbolic physics programs can be compiled and executed with formal confidence. Paper Roadmap Section 2 introduces the two-site Hubbard model as a running example, showcasing how QBlue encodes physical systems via typed creation and annihilation operators. Section reviews mathematical preliminaries from quantum simulation and second quantization. Section presents the core formal system of QBlue , including syntax, type system, and equational theory. Section describes the compilation pipeline in detail, including canonicalization, backend-specific transformations, and certified error bounds. Section discusses related work across quantum simulation languages and verified compilers. Finally, Section summarizes contributions and outlines future directions in verified quantum programming. The Rocq proofs mentioned in the paper are available on Zenodo https://zenodo.org/records/15852130 , anonymously. We additionally include eight appendices: Appendix provides in-depth background; Appendix collects lemmas on Trotterization error bounds; Appendix analyzes the perturbative gadget construction; Appendix surveys other particle transformation methods; Appendix presents a Hubbard model for hydrogen chains; and Appendix outlines other physical models definable in QBlue. 2. A Guided Example: QBlue on a Two-Site Hubbard Model To illustrate how QBlue expresses, compiles, and verifies quantum models, we present a complete example: the fermionic Hubbard model on two lattice sites. This minimal system captures key features of many-body quantum mechanics, including particle motion, local interactions, and coherent evolution, while remaining compact enough to explore in a single section. Conceptually, it models a simple chemical reaction in which electrons tunnel between orbitals and repel each other when co-located, offering a physically grounded yet abstractly expressive setting for quantum programming and formal verification. Model Setup and Physical Operators The fermionic Hubbard model captures essential features of strongly correlated systems, such as quantum tunneling and on-site repulsion. Although originally formulated for extended lattices, even a two-site version reveals the core phenomena of many-body dynamics. We consider a one-dimensional lattice with two fermionic sites, labeled site 0 and site 1 . Each site may be either unoccupied or occupied by a single fermion. The occupation number at each site is given by a value in \{0,1\} (for bosons, the occupation number can be bigger than 1 , see ), where 0 means no particle and 1 means a particle is present. These values describe physical quantum states, not Boolean truth values, and are distinct from the numeric indices labeling the sites. The total Hilbert space is \mathbb{C}^{2}\otimes\mathbb{C}^{2} , with computational basis states \ket{m}\ket{n} , where m and

Read the complete text