Typed compositional quantum computation with lenses

Jacques Garrigue,Takafumi Saikawa
2024-07-23
Abstract:We propose a type-theoretic framework for describing and proving properties of quantum computations, in particular those presented as quantum circuits. Our proposal is based on an observation that, in the polymorphic type system of Coq, currying on quantum states allows us to apply quantum gates directly inside a complex circuit. By introducing a discrete notion of lens to control this currying, we are further able to separate the combinatorics of the circuit structure from the computational content of gates. We apply our development to define quantum circuits recursively from the bottom up, and prove their correctness compositionally.
Programming Languages,Logic in Computer Science
What problem does this paper attempt to address?
The core problem that this paper attempts to solve is to provide a type - theoretical framework for quantum computing in order to describe and prove the properties of quantum circuits. Specifically, the author hopes that by introducing a new abstraction method (i.e., the concept based on lens), the correctness of quantum circuits can be defined and verified more efficiently. The following are the main objectives of the paper and the problems it solves: 1. **Compositionality**: - **Defining compositionality**: Enable any pure quantum circuit to be transformed into an abstract component that can be instantiated multiple times in different larger circuits. - **Proving compositionality**: Ensure that the proofs of the functional properties of pure quantum circuits can be stated by taking these properties as general lemmas and constructing the proofs of large circuits by applying this lemma to the instances of the components, without expanding the specific definitions of the components during the proof process. 2. **Abstraction Overhead**: - Reduce the number of additional steps required for abstraction and instantiation in the definition and proof processes to minimize the abstraction overhead. 3. **Separating Linear Algebra and Combinatorial Structures**: - By introducing the concept of discrete lenses, separate the complex linear - algebraic operations in quantum circuits from their combinatorial structures, thereby simplifying the definition and proof of circuits. 4. **Scalability**: - The proposed method can work directly on explicit state representations but is still able to prove properties in a scalable manner without relying on automation, and does not increase the complexity of the proof even when combining circuits. ### Specific Problem Description - **Characteristics of Qubits and Quantum Computing**: - A qubit is different from a classical bit. It can retain multiple values simultaneously, but only probabilities can be finally observed. - Quantum computing is usually modeled in Hilbert space through unitary transformations, which consist of various simple transformations called quantum gates. - **Limitations of Existing Work**: - Many existing works have already allowed the proof of quantum algorithms in certain settings or the representation of computations in symmetric monoidal categories using string diagrams. - This paper aims to explore whether type - theoretical insights can help describe and prove the properties of quantum computing more effectively, especially those computations represented by quantum circuits. ### Solution The author proposes the following solutions: 1. **The Concept of Lens**: - A lens is a data structure used to describe how sub - circuits are combined into larger circuits. It forms a combinatorial - mathematical basis for composition. 2. **Currying and Uncurrying**: - Through currying and uncurrying operations via lenses, quantum gates can be directly applied in complex circuits without having to explicitly handle the state of each qubit. 3. **Type System**: - Using Coq's polymorphic type system, combined with the MathComp library, the recursive definition of quantum circuits and the combinatorial proof of their correctness are realized. 4. **Instance Verification**: - The author verifies the effectiveness of the proposed method through several specific examples (such as Shor encoding, GHZ - state preparation, etc.). In summary, the goal of this paper is to improve the efficiency and composability of quantum - circuit definition and verification while reducing the abstraction overhead by introducing the concept of lens and the type - theoretical framework.