# Statistical Assertions for Validating Patterns and Finding Bugs in   Quantum Programs

**Authors:** Yipeng Huang, Margaret Martonosi

arXiv: 1905.09721 · 2019-07-03

## TL;DR

This paper introduces statistical assertions for quantum programs, enabling debugging by checking if quantum states match expected classical or quantum properties, thus aiding development and bug detection in quantum computing.

## Contribution

It presents a novel approach to debugging quantum programs using statistical assertions integrated into a quantum programming language.

## Key findings

- Effective bug detection in quantum algorithms
- Identification of common quantum bugs
- Strategies for placing assertions to prevent bugs

## Abstract

In support of the growing interest in quantum computing experimentation, programmers need new tools to write quantum algorithms as program code. Compared to debugging classical programs, debugging quantum programs is difficult because programmers have limited ability to probe the internal states of quantum programs; those states are difficult to interpret even when observations exist; and programmers do not yet have guidelines for what to check for when building quantum programs. In this work, we present quantum program assertions based on statistical tests on classical observations. These allow programmers to decide if a quantum program state matches its expected value in one of classical, superposition, or entangled types of states. We extend an existing quantum programming language with the ability to specify quantum assertions, which our tool then checks in a quantum program simulator. We use these assertions to debug three benchmark quantum programs in factoring, search, and chemistry. We share what types of bugs are possible, and lay out a strategy for using quantum programming patterns to place assertions and prevent bugs.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/1905.09721/full.md

## Figures

19 figures with captions in the complete paper: https://tomesphere.com/paper/1905.09721/full.md

## References

59 references — full list in the complete paper: https://tomesphere.com/paper/1905.09721/full.md

---
Source: https://tomesphere.com/paper/1905.09721