Hoare logic provides a syntax-oriented method to reason about program correctness and has been proven effective in the verification of classical and probabilistic programs. Existing proposals for quantum Hoare logic either lack completeness or support only quantum variables, thus limiting their capability in practical use. In this paper, we propose a quantum Hoare logic for a simple while language which involves both classical and quantum variables. Its soundness and relative completeness are proven for both partial and total correctness of quantum programs written in the language. Remarkably, with novel definitions of classical-quantum states and corresponding assertions, the logic system is quite simple and similar to the traditional Hoare logic for classical programs. Furthermore, to simplify reasoning in real applications, auxiliary proof rules are provided which support standard logical operation in the classical part of assertions, and of super-operator application in the quantum part. Finally, a series of practical quantum algorithms, in particular the whole algorithm of Shor's factorisation, are formally verified to show the effectiveness of the logic.
翻译:Hoare逻辑提供了一种以语法为导向的方法来解释程序正确性,并被证明在验证古典和概率性程序方面是有效的。关于量子 Hoare逻辑的现有建议要么缺乏完整性,要么只支持量子变量,从而限制其实际使用能力。在本文中,我们提出量子 Hoare逻辑用于一种简单而同时涉及古典和量子变量的语言。它的健全性和相对完整性被证明是用语言编写的量子程序的部分和完全正确性。值得注意的是,由于对古典量子状态和相应说法的新定义,逻辑系统非常简单,与传统的Hoare逻辑相似。此外,为了简化实际应用的推理,提供了辅助证据规则,支持理论传统部分的标准逻辑操作,以及量子部分的超级操作应用。最后,一系列实用的量子算法,特别是Shor系数化的整个算法,得到了正式验证,以显示逻辑的有效性。