Quantum programming languages aim to reduce the burden of manipulating hardware-level logic gates when implementing a quantum algorithm. A hurdle to this goal is the difficulty of expressing control flow, such as branching and iteration, that depends on the value of data in quantum superposition. To implement algorithms for factorization, search, and simulation that contain control flow, quantum languages often require the use of bit-level logic gates as opposed to the high-level constructs provided by classical languages. The reason for this gap is that whereas a classical computer supports imperative abstractions for control flow via a program counter that can depend on data and functional abstractions via terms in the $\lambda$-calculus, the typical architecture of a quantum computer does not provide a program counter that can depend on data in superposition, nor a physical representation of $\lambda$-terms in superposition. In principle, a quantum architecture supporting such abstractions would simplify the implementation of control flow in quantum programs. However, in this work, we identify a fundamental obstacle to control flow in quantum programming, which is that a quantum computer cannot correctly support the conventional conditional jump instruction in superposition, nor the $\beta$-reduction of $\lambda$-terms in superposition. We formally prove that programming abstractions with non-injective state transition semantics, such as the above, produce incorrect results in superposition. As a way forward, we present the necessary and sufficient conditions for control flow in superposition to be correctly realizable in a program. We introduce the quantum control machine, an instruction set architecture that satisfies these conditions, and show how it enables the use of control flow to implement algorithms such as phase estimation, quantum walk, and physical simulation.
翻译:量子编程语言旨在减少实现量子算法时操作硬件级逻辑门的负担。实现这一目标的一个障碍是表达依赖于量子叠加态中数据值的控制流(如分支和迭代)的困难。为了实现包含控制流的因式分解、搜索和模拟算法,量子语言通常需要使用位级逻辑门,而非经典语言提供的高级构造。造成这一差距的原因在于,经典计算机通过依赖于数据的程序计数器支持控制流的命令式抽象,并通过$\lambda$-演算中的项支持函数式抽象,而量子计算机的典型架构既未提供可依赖叠加态中数据的程序计数器,也未提供叠加态中$\lambda$-项的物理表示。原则上,支持此类抽象的量子架构将简化量子程序中控制流的实现。然而,在本工作中,我们识别出量子编程中控制流的一个根本障碍:量子计算机无法正确支持叠加态中传统的条件跳转指令,也无法正确支持叠加态中$\lambda$-项的$\beta$-归约。我们形式化地证明,具有非单射状态转移语义的编程抽象(如上所述)会在叠加态中产生错误结果。作为前进方向,我们提出了叠加态中控制流在程序中可正确实现的必要充分条件。我们引入了量子控制机——一种满足这些条件的指令集架构,并展示了它如何使控制流用于实现相位估计、量子行走和物理模拟等算法。