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 along with 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 to a low-level qubit circuit language like OpenQASM, proving the realizability of our design.
翻译:我们引入了“ 共度 ”, 这是一种新的量子编程语言, 旨在将量子计算作为古典计算的一种自然概括。 “ 共度” 是一种统一的语法, 熟悉的编程结构可以同时产生量子效应和古典效应。 例如, 可以使用总和类型来实施线性操作者的直接和对线性操作者的直接和, 例外地处理语法来实施投影测量, 并用别名来诱导缠绕。 此外, 共度利用被忽略的 BQP 子例路由理论, 允许人们通过“ garbage” 输出的未转换, 从不可逆转的量子算法中构建可逆的子例程。 与现有的语言不同, 这些语言可以使量子方面具有单独的附加效果( 类似有量子门的经典语言 ), 共度提供了一种统一的语法, 以及一种新型的注解语法, 保证程序在机械上是有效的。 我们展示了“ 共性” 、 类型系统和解说性, 表明它如何清洁地表达数量子算。 我们还可以像“ ” 。