Variational Programs with Open Clocks
Variational quantum algorithms are quantum programs with holes: a classical optimizer fills the holes with numbers and runs the program repeatedly, and a compiler must rewrite the program correctly however the holes are filled. We treat the holes as durations, or clocks, of Hamiltonian motions. VHamilton, the language we introduce, builds on Hamilton, whose programs describe simultaneous motions with exact binary-fraction clocks (dyadic rationals), compile to circuits, and have a sound and complete equational theory. Hamilton fixes every clock; VHamilton adds one construct, the open clock, so one program describes a family of motions, each an ordinary Hamilton program. Because a program’s Hamiltonian is affine in its clocks, with exact coefficients, two programs can be proved equivalent for every valuation of their clocks by a finite calculation. We mechanize this check in Agda for a fragment of the language, and we run the programs through a prototype compiler on QAOA, Trotterized and chemistry examples.