Unbounded loops in quantum programs: categories and weak while loops
Control flow of quantum programs is often divided into two different classes: classical and quantum. Quantum programs with classical control flow have their conditional branching determined by the classical outcome of measurements, and these collapse quantum data. Conversely, quantum control flow is coherent, i.e. it does not perturb quantum data; quantum walk-based algorithms are practical examples where coherent quantum feedback plays a major role. This dissertation has two main contributions: (i) a categorical study of coherent quantum iteration and (ii) the introduction of weak while loops. (i) The objective is to endow categories of quantum processes with a traced monoidal structure capable of modelling iterative quantum loops. To this end, the trace of a morphism is calculated via the execution formula, which adds up the contribution of all possible paths of the control flow. Haghverdi's unique decomposition categories are generalised to admit additive inverses and equipped with convergence criteria using basic topology. In this setting, it is possible to prove the validity of the execution formula as a categorical trace on certain categories of quantum processes. Among these there are categories of quantum processes over finite dimensional Hilbert spaces (as previously shown by Bartha), but also certain categories of quantum processes over infinite dimensional Hilbert spaces, such as a category of time-shift invariant quantum processes over discrete time. (ii) A weak while loop is a classical control flow primitive that offers a trade-off between the collapse caused on each iteration and the amount of information gained. The trade-off may be adjusted by tuning a parameter and, in certain situations, it is possible to set its value so that we may control the algorithm without sacrificing its quantum speed-up. As an example, it is shown that Grover's search problem can be implemented using a weak while loop, maintaining the same time complexity as the standard Grover's algorithm (as previously shown by Mizel). In a more general setting, sufficient conditions are provided that let us determine, with arbitrarily high probability, a worst-case estimate of the number of iterations the loop will run for.