arXiv:2611.08675cs.PLNov 2026

Manuscript Offprint

arXiv:2611.08675

A Complete Calculus for Hamiltonian Quantum Programming

Jacques Carette, Chris Heunen, Robin Kaarsgaard, Neil J. Ross, Amr Sabry

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

JACQUES CARETTE, McMaster University, Canada

CHRIS HEUNEN, University of Edinburgh, United Kingdom

ROBIN KAARSGAARD, University of Southern Denmark, Denmark

NEIL J. ROSS, Dalhousie University, Canada

AMR SABRY, Indiana University, USA

Given the forces acting on a quantum particle, a Hamiltonian models its continuous evolution. Quantum computers evolve Hamiltonians to simulate physical systems, to solve optimisation problems, and to estimate eigenvalues, and even the popular circuit abstraction is compiled to Hamiltonians on the hardware. We introduce HAMILTON, a process calculus whose parallel operator is the sum of interactions acting simultaneously. Its operational semantics is the Lie-Trotter product formula, which recovers a sum as the limit of ever finer sequential interleavings; compiling a program means halving it to a chosen precision and unrolling the interleaving into a circuit. The semantics is fully abstract, the expressible Hamiltonians are exactly those whose Pauli coefficients have the form m/2km/2^k, the precision that successive halving reaches, and the equational theory is complete and decidable. A full implementation compiles HAMILTON programs to circuits and decides their equivalence, and Agda proofs sanity-check the core metatheory.

1 Introduction

Quantum programs are often expressed as circuits. Across quantum programming languages, from low-level assembly languages like OpenQASM [Cross et al. 2022] to functional languages like Quipper [Green et al. 2013] to equational calculi like Πk\Pi_k [Carette et al. 2026, 2024], a program denotes a sequence of gates: elementary unitary operations applied one after another to an array of qubits. Sequential composition is the primitive, and it makes these languages tractable: a circuit is an instruction stream, which compiler writers and type theorists know how to reason about.

Yet one of the most common modes of quantum computation, and the original motivation for quantum computers [Feynman 1982], expresses programs by Hamiltonians [Lloyd 1996], as in simulation, optimisation [Farhi et al. 2014, 2001] and eigenvalue estimation [Kitaev 1995]. A gate jumps from one state to another, whereas a Hamiltonian defines the continuous trajectory between them, of which a gate is a snapshot. Formally, a Hamiltonian is a self-adjoint matrix HH, its evolution is e−itHe^{-itH}, and the snapshot at a time tt is a gate. For example, the state of a qubit is a pair of amplitudes, written α∣0⟩+β∣1⟩\alpha |0\rangle + \beta |1\rangle, and the Hamiltonian X=(0110)X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} drives ∣0⟩|0\rangle along cos⁡t∣0⟩−isin⁡t∣1⟩\cos t |0\rangle - i \sin t |1\rangle, a wave that oscillates between ∣0⟩|0\rangle and ∣1⟩|1\rangle. At t=π/2t = \pi/2 the snapshot is the NOT gate, which swaps the two amplitudes, up to a global phase −i-i; global phases are unobservable, and we ignore them from now on.

Hamiltonians become interesting when several act at once. Think of a Hamiltonian as a force driving a quantum particle: when several forces act on the particle simultaneously, they add. Take XX together with Z=(100−1)Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}, whose snapshot at t=π/2t = \pi/2 is the phase-flip gate, taking α∣0⟩+β∣1⟩\alpha |0\rangle + \beta |1\rangle

Authors' Contact Information: Jacques Carette, McMaster University, Hamilton, Canada, carette@mcmaster.ca; Chris Heunen, School of Informatics, University of Edinburgh, Edinburgh, United Kingdom, chris.heunen@ed.ac.uk; Robin Kaarsgaard, Centre for Quantum Mathematics (QM), Centre for Formal Methods and Future Computing (FORM), University of Southern Denmark, Odense, Denmark, kaarsgaard@imada.sdu.dk; Neil J. Ross, Department of Mathematics and Statistics, Dalhousie University, Halifax, Canada, neil.j.ross@dal.ca; Amr Sabry, Department of Computer Science, Indiana University, Bloomington, USA, sabry@iu.edu.

  1. ACM XXXX-XXXX/2026/11-ART https://doi.org/10.1145/nnnnnnnn.nnnnnnn

Figure

Fig. 1. Interleavings of XX and ZZ at levels n=0,…,3n=0,\ldots,3: orange steps run XX, blue steps run ZZ, and the dashed diagonal runs both at once. The path below the diagonal runs XX first, the path above runs ZZ first. To first order, an interleaving's error is proportional to the shaded area between its path and the diagonal, which halves at each level.

to α∣0⟩−β∣1⟩\alpha|0\rangle-\beta|1\rangle. In Figure 1, time spent running XX is drawn horizontally in orange and time spent running ZZ vertically in blue, so running one and then the other goes around a square on one side or the other, to the same corner. Whether the two orders reach the same state depends on how long each runs. Run in full, they give the gates XZXZ and ZXZX, which differ only by an overall sign, so the order is unobservable. Run halfway, the order becomes observable. Write X\sqrt{X} and Z\sqrt{Z} for the half runs: X\sqrt{X} turns each amplitude into an even blend of the two, and Z\sqrt{Z} multiplies the second amplitude by ii, halfway around the circle from 1 to −1-1. From the initial state 12(∣0⟩+∣1⟩)\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle), the two evolutions proceed as:

12(∣0⟩+∣1⟩)→X12(∣0⟩+∣1⟩)→Z12(∣0⟩+i∣1⟩)\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)\xrightarrow{\sqrt{X}}\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)\xrightarrow{\sqrt{Z}}\frac{1}{\sqrt{2}}(|0\rangle+i|1\rangle) 12(∣0⟩+∣1⟩)→Z12(∣0⟩+i∣1⟩)→X∣0⟩\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)\xrightarrow{\sqrt{Z}}\frac{1}{\sqrt{2}}(|0\rangle+i|1\rangle)\xrightarrow{\sqrt{X}}|0\rangle

In the first line, X\sqrt{X} blends equal amplitudes, which leaves them equal, and Z\sqrt{Z} then only turns the phase of the second. In the second, Z\sqrt{Z} first turns the amplitudes into 1 and ii, and X\sqrt{X} blends these so that their contributions to ∣1⟩|1\rangle cancel, leaving ∣0⟩|0\rangle. The same two steps thus give a fair coin in one order and a certain outcome in the other. Running the two at once, the diagonal of Figure 1, is a third evolution, which interleavings of ever smaller slices approach from either side.

Formally, simultaneous interactions add: their Hamiltonians are summed in the Lie algebra of the unitary group, while the gates of a circuit are multiplied in the group itself. Such interactions behave like concurrent processes. Two processes are independent when the order in which they run does not affect the outcome; two interactions are independent in exactly this sense when their Hamiltonians commute, and otherwise their order shows in the result, as it does for X and Z. Concurrency theory separates such events from a schedule that orders them [Fajstrup et al. 2016; Pratt 1991], and a single processor runs concurrent processes by interleaving time slices, approximating their simultaneous execution better as the slices shrink. Simultaneous quantum interactions are run the same way. The Lie-Trotter product formula [Trotter 1959], the bridge from the algebra back to the group, writes eA+Be^{A+B} as the limit of (eA/NeB/N)N(e^{A/N}e^{B/N})^{N}, a round-robin schedule that gives each term a time slice of 1/N.

Circuit languages can be patched to reach such sums. Trotterisation [Lloyd 1996] writes the round-robin schedule out as a circuit, and block encodings [Low and Chuang 2019], which the language Cobble [Yuan 2025] compiles, realise a sum exactly at the cost of ancillary qubits. But, as Milner observed, concurrency “requires a new conceptual framework, not just a refinement of what we find natural for sequential computing” [Milner 2007]. Rather than patch the circuit model, we develop that conceptual framework for Hamiltonians, in a language called HAMILTON. A HAMILTON program composes interactions in parallel, written ||, with no order among them, and denotes the sum of their Hamiltonians. Programs compile to circuits of the calculus Πk\Pi_k [Carette et al. 2026, 2024]. This is an ideal target, as Πk\Pi_k extends the calculus Π\Pi of classical reversible computing [Carette and Sabry 2016; James and Sabry 2012] with a square root of NOT\text{NOT} and with the 2k2^k-th roots of unity, phases of ever finer precision, each the square root of the one before. Approximation needs square roots, since a Trotter schedule interleaves ever smaller slices of each interaction, and running an interaction for half as long takes a square root of its evolution. HAMILTON adds the matching capability to the process algebra of independent events: halving a process. Compilation is then the operational semantics: to run a program is to halve it nn times, for a chosen level nn, so that every duration in it is a dyadic rational (a fraction of the form m/2km/2^k for m∈Zm \in \mathbb{Z} and k∈Nk \in \mathbb{N}), and to unroll it into a schedule of 2n2^n Trotter steps, each a Πk\Pi_k circuit.

Outline. Section 2 gives background on Πk\Pi_k and on Hamiltonians, through examples. Section 3 fixes the syntax and type system of HAMILTON, Section 4 its semantics and universality, and Section 5 full abstraction. Section 6 describes the implementation, and Section 7 applies it to a complete example. Section 8 compares HAMILTON with SimuQ [Peng et al. 2024], Paulihedral [Li et al. 2022], Cobble [Yuan 2025] and equational reasoning about circuits built from Pauli rotations. Section 9 concludes.

References (22)