NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Quantum Computing without the Linear Algebra

Aws AlbarghouthiIACR ePrint 2025

Abstract

Traditional quantum computing education relies heavily on linear algebra and physics-based notation, creating a significant barrier for software engineers and computer scientists. This paper proposes an alternative framework that replaces complex matrices and vectors with functional programming constructs like map, flatMap, and reduce. By representing quantum states as sets of bitstring-amplitude pairs, we provide a more intuitive operational model that simplifies both human reasoning and automated formal verification.

The Problem: The Matrix Barrier

Quantum computing is typically introduced through the lens of physics, using Dirac notation ($| \psi \rangle$) and complex-valued matrices. For many in the computer science community, this "math-first" approach obscures the operational logic of quantum algorithms. Furthermore, the matrix-based representation is poorly suited for automated reasoning. Building compilers that can formally prove the correctness of a quantum circuit requires a representation that integrates naturally into standard logic and verification frameworks.

Methods: An Operational, Set-Based View

To bridge this gap, author Aws Albarghouthi introduces a set-based representation of quantum mechanics. In this model, a quantum state is not a vector but a dictionary (or set of key-value pairs). The key is a bitstring (e.g., 01), and the value is its associated complex amplitude.

Gates as Functional Transformations

Under this framework, quantum gates are redefined as standard functional programming operations:

  • Bitstring Transformations (X and CX): Gates like the NOT ($X$) and Controlled-NOT ($CX$) are implemented as map operations that transform the bitstring keys. For example, an $X$ gate simply swaps the amplitudes of the 0 and 1 keys.
The X (NOT) gate represented as a map operation swapping the amplitudes of bitstrings 0 and 1.
  • Phase Transformations (S and T): These gates are map operations that multiply the amplitudes by specific complex numbers, leaving the bitstrings unchanged.
  • Superposition and Interference (Hadamard): The Hadamard ($H$) gate is the most complex. It is implemented as a flatMap (which splits one state into two) followed by a reduceByKey. The reduceByKey step is crucial as it sums amplitudes, elegantly capturing constructive and destructive interference.
The CNOT gate as a conditional map on a 2-qubit state, where the second bit is flipped only if the first bit is 1.

Key Insights

Interference as Reduction

In linear algebra, interference is represented as vector addition. In this functional view, interference is captured by reduceByKey. When multiple computational paths result in the same bitstring, their amplitudes are summed. If one path has a positive amplitude and another a negative one, they cancel out—providing a clear, algorithmic explanation for destructive interference in algorithms like Deutsch’s.

Bridge to Formal Verification

By representing quantum operations as set transformations, quantum programs can be encoded into first-order logic. This allows the use of SMT solvers—tools widely used in software verification—to automatically check the correctness of quantum programs. This shift moves quantum programming away from black-box matrix multiplication and toward verifiable software engineering.

Results and Limitations

The author implemented this logic in a concise Python library called qwla, which successfully simulates foundational circuits and algorithms like EPR pair construction. While this approach provides a powerful pedagogical tool and a path toward verification, it does not solve the "curse of dimensionality." Simulating $n$ qubits still requires a set of up to $2^n$ elements, maintaining the exponential complexity inherent in classical simulation of quantum systems.

Conclusion

By reframing quantum mechanics in the language of data structures and functional programming, we can make the field more accessible to the broader computer science community. This "Quantum Computing without the Linear Algebra" approach not only aids in teaching but also provides the formal foundations necessary for the next generation of quantum compilers and verification tools.

Summary updated

BibTeX
@article{albarghouthi2025quantum,
  author = {Aws Albarghouthi},
  title = {{Quantum Computing without the Linear Algebra}},
  journal = {IACR Cryptol. ePrint Arch.},
  year = {2025},
}
Figure