We study expected runtimes for quantum programs. Inspired by recent work on probabilistic programs, we first define expected runtime as a generalisation of quantum weakest precondition. Then, we show that the expected runtime of a quantum program can be represented as the expectation of an observable (in physics). A method for computing the expected runtimes of quantum programs in finite-dimensional state spaces is developed. Several examples are provided as applications of this method, including computing the expected runtime of quantum Bernoulli Factory -- a quantum algorithm for generating random numbers. In particular, using our new method, an open problem of computing the expected runtime of quantum random walks introduced by Ambainis et al. (STOC 2001) is solved.
翻译:我们研究量子方案的预期运行时间。根据最近关于概率程序的工作,我们首先将预期运行时间定义为对量子最弱的先决条件的概括。然后,我们证明量子方案的预期运行时间可以作为可观测(物理)的预期时间。我们开发了一种计算有限维度国家空间量子方案的预期运行时间的方法。作为这种方法的应用,我们提供了几个例子,包括计算量子伯努利工厂的预期运行时间,这是生成随机数字的量子算法。特别是使用我们的新方法,计算Ambainis等人引进的量子随机行走的预期运行时间(STOC,2001年)的公开问题得到解决。