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.
翻译:因式分解、搜索与模拟中的量子算法通过基于叠加态量子数据的值执行分支与迭代等控制流,从而获得计算优势。然而,这些算法的实现面临一个根本困难:在主流量子机器模型中,由程序计数器体现的所有控制流都是经典的,无法处于叠加态。本研究发现,另一种使程序计数器处于叠加态的模型存在障碍——此类机器无法正确支持具有非单射语义的控制流构造,包括传统条件跳转。事实上,以往支持该指令的尝试会导致程序不适当地坍缩数据的叠加态,从而丧失量子优势。我们证明,一般具有非单射转移语义的控制流抽象(如传统条件跳转或λ-演算)无法在量子数据上运行时保持其叠加态与量子算法的计算优势。这一定理解释了为何迄今为止的量子编程语言一直无法直接利用经典程序中"程序即数据"的概念来支持经典编程中丰富的控制流抽象。作为替代方案,我们提出一种新的量子机器模型,其中包含具有本质单射语义的条件跳转变体,从而规避我们的不可能性定理,正确实现数据上的量子效应与数据依赖型控制流。我们识别出此类机器程序保持数据叠加态的必要条件,并证明可表达的程序与酉量子电路等价,并以相位估计、量子行走和物理模拟为例进行说明。