Table of Contents
Fetching ...

Analyzing Quantum Programs with LintQ: A Static Analysis Framework for Qiskit

Matteo Paltenghi, Michael Pradel

TL;DR

This paper tackles the risk of incorrect quantum software by introducing LintQ, a static analysis framework tailored to quantum programming concepts. Built on CodeQL and backed by a dedicated quantum-abstraction layer (LintQ-core), it enables a family of ten analyses that reason about circuits, gates, qubits, and data flow without relying on a single quantum API. The authors validate LintQ on a large real-world dataset of 7,568 Qiskit programs, achieving up to 91.0% precision in a default configuration and demonstrating that most prior tools would miss these quantum-specific bugs. The work provides practical tooling for improving reliability in quantum software and contributes a sizable dataset and an extensible framework for future research and development in quantum program analysis.

Abstract

As quantum computing is rising in popularity, the amount of quantum programs and the number of developers writing them are increasing rapidly. Unfortunately, writing correct quantum programs is challenging due to various subtle rules developers need to be aware of. Empirical studies show that 40-82% of all bugs in quantum software are specific to the quantum domain. Yet, existing static bug detection frameworks are mostly unaware of quantum-specific concepts, such as circuits, gates, and qubits, and hence miss many bugs. This paper presents LintQ, a comprehensive static analysis framework for detecting bugs in quantum programs. Our approach is enabled by a set of abstractions designed to reason about common concepts in quantum computing without referring to the details of the underlying quantum computing platform. Built on top of these abstractions, LintQ offers an extensible set of ten analyses that detect likely bugs, such as operating on corrupted quantum states, redundant measurements, and incorrect compositions of sub-circuits. We apply the approach to a newly collected dataset of 7,568 real-world Qiskit-based quantum programs, showing that LintQ effectively identifies various programming problems, with a precision of 91.0% in its default configuration with the six best performing analyses. Comparing to a general-purpose linter and two existing quantum-aware techniques shows that almost all problems (92.1%) found by LintQ during our evaluation are missed by prior work. LintQ hence takes an important step toward reliable software in the growing field of quantum computing.

Analyzing Quantum Programs with LintQ: A Static Analysis Framework for Qiskit

TL;DR

This paper tackles the risk of incorrect quantum software by introducing LintQ, a static analysis framework tailored to quantum programming concepts. Built on CodeQL and backed by a dedicated quantum-abstraction layer (LintQ-core), it enables a family of ten analyses that reason about circuits, gates, qubits, and data flow without relying on a single quantum API. The authors validate LintQ on a large real-world dataset of 7,568 Qiskit programs, achieving up to 91.0% precision in a default configuration and demonstrating that most prior tools would miss these quantum-specific bugs. The work provides practical tooling for improving reliability in quantum software and contributes a sizable dataset and an extensible framework for future research and development in quantum program analysis.

Abstract

As quantum computing is rising in popularity, the amount of quantum programs and the number of developers writing them are increasing rapidly. Unfortunately, writing correct quantum programs is challenging due to various subtle rules developers need to be aware of. Empirical studies show that 40-82% of all bugs in quantum software are specific to the quantum domain. Yet, existing static bug detection frameworks are mostly unaware of quantum-specific concepts, such as circuits, gates, and qubits, and hence miss many bugs. This paper presents LintQ, a comprehensive static analysis framework for detecting bugs in quantum programs. Our approach is enabled by a set of abstractions designed to reason about common concepts in quantum computing without referring to the details of the underlying quantum computing platform. Built on top of these abstractions, LintQ offers an extensible set of ten analyses that detect likely bugs, such as operating on corrupted quantum states, redundant measurements, and incorrect compositions of sub-circuits. We apply the approach to a newly collected dataset of 7,568 real-world Qiskit-based quantum programs, showing that LintQ effectively identifies various programming problems, with a precision of 91.0% in its default configuration with the six best performing analyses. Comparing to a general-purpose linter and two existing quantum-aware techniques shows that almost all problems (92.1%) found by LintQ during our evaluation are missed by prior work. LintQ hence takes an important step toward reliable software in the growing field of quantum computing.
Paper Structure (37 sections, 11 figures, 3 tables)

This paper contains 37 sections, 11 figures, 3 tables.

Figures (11)

  • Figure 1: Example of a quantum program with two bugs.
  • Figure 2: Example CodeQL query to find code redundant if statements.
  • Figure 3: Overview of LintQ.
  • Figure 4: Examples of LintQ's abstractions and how they are represented in the program and the circuit.
  • Figure 5: Redundant measurement example (left) and its analysis (right).
  • ...and 6 more figures