Unitary Expressions: A Necessary Abstraction for Extensible Quantum Programming Languages and Systems
Ed Younis
TL;DR
The paper addresses the fragility and rigidity of gate-name-based quantum software by introducing unitary expressions as a first-class abstraction. It presents OpenQudit, comprising the Qudit Gate Language (QGL) for unitary expressions, the QCIR intermediate representation that uses expression identity, and the Qudit Virtual Machine (QVM) for fast unitary and gradient evaluation; these components support symbolic differentiation, optimization, and efficient compilation through two pipelines. Key contributions include a scalable e-graph–based optimization framework, a novel congruence notion that handles global phase and parameter mappings, and a high-performance, qudit-capable runtime that demonstrates substantial speedups over existing frameworks in both unitary and gradient computations. The work enables safe tool composition, extensibility to new gates and hardware, and streamlined interoperability across quantum programming languages and runtimes, with practical impact demonstrated in circuit construction benchmarks and large-scale QFT synthesis.
Abstract
Quantum gates are the fundamental instructions of digital quantum computers. Current programming languages, systems, and software development toolkits identify these operational gates by their titles, which requires a shared understanding of their meanings. However, in the continuously developing software ecosystem surrounding quantum computing -- spanning high-level programming systems to low-level control stacks -- this identification process is often error-prone, challenging to debug, maintenance-heavy, and resistant to change. In this paper, we propose replacing this nominal gate representation with a functional one. We introduce the OpenQudit system for describing, parsing, optimizing, analyzing, and utilizing programs comprising gates described as symbolic unitary expressions. As part of this effort, we design the Qudit Gate Language (QGL), a unitary-specific expression language, and implement a differentiating just-in-time compiler in OpenQudit towards embedding this language in quantum programming languages and systems. Additionally, we have precisely designed and implemented the Qudit Virtual Machine (QVM) to evaluate quantum programs and their gradients efficiently. This evaluation is performed millions of times during the compilation of quantum programs. Our QVM can compute gradients approximately ten times faster than current leading numerical quantum compilation frameworks in the most common use cases. Altogether, the OpenQudit system is envisioned to (1) support many-level or qudit-based quantum systems, (2) enable the safe composition of program transformation tools, (3) accelerate circuit optimizers and transpilers, (4) enable compiler extensibility, and (5) provide a productive, simple-to-use interface to quantum practitioners.
