Quantum algorithms for factorization, search, and simulation obtain computational advantage by performing control flow such as branching and iteration based on the value of quantum data in superposition. Complicating realization of these algorithms is the fact that in predominant quantum machine models, all control flow as embodied by the program counter is classical, and cannot exist in superposition. In this work, we identify that an alternative model to enable a program counter in superposition faces an obstacle -- no such machine can correctly support control flow constructs with non-injective semantics, including the conventional conditional jump. In fact, prior attempts to support this instruction cause programs to inappropriately collapse the superposition of data, meaning that quantum advantage is lost. We prove that in general, control flow abstractions with non-injective transition semantics, such as the conventional conditional jump or the $\lambda$-calculus, cannot operate over quantum data while preserving its superposition and the computational advantage of the quantum algorithm. This theorem explains why quantum programming languages to date have been unable to directly leverage the classical concept of programs as data to support the rich control flow abstractions known in classical programming. As an alternative, we present a new quantum machine model featuring variants of conditional jump with inherently injective semantics, which sidesteps our impossibility theorem and correctly enables both quantum effects on data and data-dependent control flow. We identify the necessary condition for programs for such a machine to preserve superposition of data, and show that expressible programs coincide with the unitary quantum circuits, with examples for phase estimation, quantum walk, and physical simulation.
翻译:暂无翻译