We introduce Qunity, a new quantum programming language designed to treat quantum computing as a natural generalization of classical computing. Qunity presents a unified syntax where familiar programming constructs can have both quantum and classical effects. For example, one can use sum types to implement the direct sum of linear operators, exception-handling syntax to implement projective measurements, and aliasing to induce entanglement. Further, Qunity takes advantage of the overlooked BQP subroutine theorem, allowing one to construct reversible subroutines from irreversible quantum algorithms through the uncomputation of "garbage" outputs. Unlike existing languages that enable quantum aspects with separate add-ons (like a classical language with quantum gates bolted on), Qunity provides a unified syntax and a novel denotational semantics that guarantees that programs are quantum mechanically valid. We present Qunity's syntax, type system, and denotational semantics, showing how it can cleanly express several quantum algorithms. We also detail how Qunity can be compiled into a low-level qubit circuit language like OpenQASM, proving the realizability of our design.
翻译:我们引入了“ 共度 ”, 这是一种新的量子编程语言, 旨在将量子计算作为古典计算的一种自然概括。 “ 共度” 提供了一种统一的语法, 熟悉的编程结构可以同时产生量子效应和古典效应。 例如, 可以使用总类型来实施线性操作员的直接和, 例外处理语法来实施预测性测量, 并用别名诱导纠缠。 此外, 共度利用被忽略的 BQP 子例程理论, 允许人们通过“ garbage” 输出的不转换, 从不可逆转的量子算法中构建可逆的子路程。 与现有的语言不同, 这些语言可以使量子部分具有单独的附加效果( 类似有量子门的古典语言), 共度提供统一的语法和新的解记性语法, 保证程序在机械上是有效的。 我们展示了“ 共度” 的语法、 类型系统和分解语学,, 表明它如何通过“ 量子算算法” 。 我们还详细说明了Qunity 如何可以编成一个低层次的流。