Twist: Sound Reasoning for Purity and Entanglement in Quantum Programs

Charles Yuan, Christopher McNally, Michael Carbin
5/4/2022
cs.PLquant-ph

Official code: psg-mit/twist-popl22 (51 stars, OCaml, MIT, last commit 2021-11-16).

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.

Show full abstract

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%.

View on arXivView PDF

Code Implementations(1)

MIT

POPL'22 Artifact for "Twist: Sound Reasoning for Purity and Entanglement in Quantum Programs".

517OCaml, C++Sep 30, 20215 years agoMIT

Similar Papers

Cite this paper

@article{yuan2022twist,
  title  = {Twist: Sound Reasoning for Purity and Entanglement in Quantum Programs},
  author = {Charles Yuan and Christopher McNally and Michael Carbin},
  year   = {2022},
  eprint = {2205.02287},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2205.02287}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2205.02287.svg)](https://codeofpaper.com/paper/2205.02287)

Discussion