Quantum algorithms for tasks such as factorization, search, and simulation rely on control flow such as branching and iteration that depends on the value of data in superposition. High-level programming abstractions for control flow, such as switches, loops, and higher-order functions, are ubiquitous in classical languages. By contrast, many quantum languages do not provide high-level abstractions for control flow in superposition, and instead require the use of hardware-level logic gates to implement such control flow. The reason for this gap is that whereas a classical computer supports control flow using a program counter that can depend on data, the typical architecture of a quantum computer does not provide a program counter that can depend on data in superposition. As a result, the complete set of control flow abstractions that can be correctly realized on a quantum computer has not yet been established. In this work, we provide a complete characterization of the properties of control flow abstractions that are correctly realizable on a quantum computer. First, we prove that even on a quantum computer whose program counter exists in superposition, one cannot correctly realize control flow in quantum algorithms by lifting the classical conditional jump instruction to work in superposition. This theorem denies the ability to directly lift general abstractions for control flow such as the $\lambda$-calculus from classical to quantum programming. In response, we present the necessary and sufficient conditions for control flow to be correctly realizable on a quantum computer. We introduce the quantum control machine, an instruction set architecture featuring a conditional jump that is restricted to satisfy these conditions. We show how this design enables a developer to correctly express control flow in quantum algorithms using a program counter in place of logic gates.
翻译:用于因式分解、搜索和模拟等任务的量子算法依赖于控制流(如基于叠加态数据值的分支和迭代)。在经典语言中,控制流的高级编程抽象(如开关、循环和高阶函数)无处不在。相比之下,许多量子语言并未提供针对叠加态控制流的高级抽象,而是要求使用硬件级逻辑门来实现此类控制流。产生这一差距的原因在于,经典计算机通过依赖数据的程序计数器支持控制流,而量子计算机的典型架构并未提供能依赖叠加态数据的程序计数器。因此,能在量子计算机上正确实现的控制流抽象完整集合尚未确定。在本工作中,我们完整刻画了量子计算机上可正确实现的控制流抽象的性质。首先,我们证明:即使在一台程序计数器处于叠加态的量子计算机上,也无法通过将经典条件跳转指令提升至叠加态工作来正确实现量子算法中的控制流。该定理否定了将一般控制流抽象(如λ-演算)直接从经典编程提升至量子编程的可能性。作为回应,我们给出了量子计算机上控制流可被正确实现的充分必要条件。我们引入量子控制机——一种指令集架构,其条件跳转被限定以满足这些条件。我们展示了这种设计如何使开发者能够通过程序计数器代替逻辑门来正确表达量子算法中的控制流。