Twist: Sound Reasoning for Purity and Entanglement in Quantum Programs
arXiv:2205.02287 · doi:10.1145/3498691
Abstract
Quantum programming languages enable developers to implement algorithms for quantum computers that promise computational breakthroughs in classically intractable tasks. Programming quantum computers requires awareness of entanglement, the phenomenon in which measurement outcomes of qubits are correlated. Entanglement can determine the correctness of algorithms and suitability of programming patterns. In this work, we formalize purity as a central tool for automating reasoning about entanglement in quantum programs. A pure expression is one whose evaluation is unaffected by the measurement outcomes of qubits that it does not own, implying freedom from entanglement with any other expression in the computation. We present Twist, the first language that features a type system for sound reasoning about purity. The type system enables the developer to identify pure expressions using type annotations. Twist also features purity assertion operators that state the absence of entanglement in the output of quantum gates. To soundly check these assertions, Twist uses a combination of static analysis and runtime verification. We evaluate Twist's type system and analyses on a benchmark suite of quantum programs in simulation, demonstrating that Twist can express quantum algorithms, catch programming errors in them, and support programs that several languages disallow, while incurring runtime verification overhead of less than 3.5%.
arXiv commentThis version of the paper differs from ACM Proceedings in that it includes a more refined comparison to prior work, specifically in Sections 3.5 and 9.6
References in corpus (31)
- Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer
- Quantum Machine Learning
- Quantum cryptography: Public key distribution and coin tossing
- Separability of Mixed States: Necessary and Sufficient Conditions
- Good Quantum Error-Correcting Codes Exist
- Quantum Teleportation is a Universal Computational Primitive
- Quantum fingerprinting
- On the role of entanglement in quantum computational speed-up
- Toward the first quantum simulation with quantum speedup
- Simulating chemistry using quantum computers
- Q#: Enabling scalable quantum computing and development with a high-level domain-specific language
- Addition on a Quantum Computer
- Why Quantum Bit Commitment And Ideal Quantum Coin Tossing Are Impossible
- Statistical Assertions for Validating Patterns and Finding Bugs in Quantum Programs
- A functional quantum programming language
- A Verified Optimizer for Quantum Circuits
- Quantum++: A modern C++ quantum computing library
- Distribution of bipartite entanglement for random pure states
- Quantum entanglement analysis based on abstract interpretation
- Verified compilation of space-efficient reversible circuits
- ReQWIRE: Reasoning about Reversible Quantum Circuits
- A Probabilistic Separation Logic
- Relational Proofs for Quantum Programs
- Quantitative Robustness Analysis of Quantum Programs (Extended Version)
- Classical Control, Quantum Circuits and Linear Logic in Enriched Category Theory
- A logical analysis of entanglement and separability in quantum higher-order functions
- Analysis of Quantum Entanglement in Quantum Programs using Stabilizer Formalism
- Assertion-Based Optimization of Quantum Programs
- CertiQ: A Mostly-automated Verification of a Realistic Quantum Compiler
- An entangling-probe attack on Shor's algorithm for factorization
- Quantum computing in a piece of glass
Cited by in corpus (6)
- Formal Verification of Quantum Programs: Theory, Tools and Challenges
- Hybrid Oscillator-Qubit Quantum Processors: Instruction Set Architectures, Abstract Machine Models, and Applications
- Integration of Quantum Accelerators with High Performance Computing -- A Review of Quantum Programming Tools
- Quantum Control Machine: The Limits of Control Flow in Quantum Programming
- Qurts: Automatic Quantum Uncomputation by Affine Types with Lifetime
- Hoare meets Heisenberg: A Lightweight Logic for Quantum Programs