When Abstraction Breaks Physics: Rethinking Modular Design in Quantum Software

Jianjun Zhao

In the world of classical software, we live by the "black box" philosophy. We wrap complex logic into functions and modules, hiding the messy details behind clean interfaces. This abstraction is what allows us to build massive, scalable systems. But as Jianjun Zhao argues in this provocative paper, when you bring those same classical habits to quantum computing, the "black box" doesn't just hide complexity—it can actually break the laws of physics.

TL;DR

Classical software abstraction assumes that modules are independent and observable, but quantum mechanics (via entanglement and unitarity) makes these assumptions dangerous. This paper identifies how "naive" abstraction leads to physically impossible programs and proposes a new framework for "physically sound" quantum modular design.

What Problem Does This Paper Address?

The core challenge is a fundamental mismatch between classical software engineering (SE) principles and quantum semantics. In classical SE, if a function works in isolation, it generally works when composed into a larger system.

In Quantum Software Engineering (QSE), this isn't guaranteed. Quantum programs are governed by principles like unitarity (operations must be reversible), entanglement (qubits can have non-local dependencies), and the destructive nature of measurement.

The author identifies a "fundamental conflict": we are currently using classical abstraction mechanisms (like Python functions in Qiskit) that allow us to write code that is syntactically correct but physically nonsensical. For example, a programmer might hide a measurement operation inside a subroutine, unaware that this "observation" collapses the quantum state for the entire calling program, potentially ruining the computation.

Methods

This is a conceptual and position paper that establishes a roadmap for the field. The author uses a three-step approach:

  1. Categorizing Failure: The paper identifies three specific ways naive abstraction fails:
  2. Violation of Unitarity: Hiding classical control flow that prevents a circuit from being reversible.
  3. Entanglement Boundary Violation: Reusing modules without accounting for "hidden" dependencies between qubits.
  4. Violation of Measurement Semantics: Hiding state-collapsing operations, which breaks "compositional transparency."
  5. Defining Principles: It proposes five design principles for "physically sound" abstractions, such as Measurement Transparency and Entanglement Boundary Awareness.
  6. Proposing Mechanisms: It suggests concrete language features to enforce these principles, including quantum-specific type systems and effect annotations.

Datasets

Not discussed in the paper. As a conceptual/position paper, it focuses on theoretical frameworks and code examples rather than empirical data or benchmarks.

Key Insights and Ideas

  • The "Global Context" Problem: In classical systems, modules are local. In quantum systems, because of entanglement, a local operation can have global consequences. Therefore, "local reasoning"—the very heart of abstraction—is often invalid in quantum programs.
  • Measurement as a Side Effect: In classical code, "reading" a variable is passive. In quantum code, "reading" (measuring) is a massive, irreversible side effect. The paper argues that any abstraction performing a measurement must declare it in its interface, similar to how some languages handle I/O or exceptions.
  • Syntactic vs. Physical Validity: Just because a quantum program compiles doesn't mean it can run on a real device. The paper advocates for moving physical constraints "left" into the type system so that physically impossible code fails at compile-time.

Key Results

The paper provides a theoretical framework summarized in Table I, which contrasts classical vs. quantum assumptions:

  • Observability: Classical allows full inspection; Quantum suffers from state collapse.
  • Copying: Classical data is free to copy; Quantum is restricted by the No-Cloning theorem.
  • Compositionality: Classical modules compose safely; Quantum composition can break unitarity.

The author also introduces the concept of Quantum-Specific Type Systems. For example, a subroutine could be explicitly typed as Unitary :: Qubit[n] -> Qubit[n], providing a compiler-level guarantee that the function won't collapse the state.

Limitations and Future Work

The primary limitation is that the paper is a high-level proposal; it does not yet provide a fully implemented compiler or a new programming language. The author acknowledges that while these principles are necessary for correctness, they might introduce "engineering overhead" that could make quantum programming more rigid.

Future directions include: * Developing Static Analyzers that can scan for "entanglement leakage." * Creating Visualization Tools to help developers see the boundaries of entanglement across different modules. * Implementing Contract-Based Design where modules specify preconditions (e.g., "this function requires these two qubits to be unentangled before starting").

Summary updated

Abstract

Abstraction is a fundamental principle in classical software engineering, which enables modularity, reusability, and scalability. However, quantum programs adhere to fundamentally different semantics, such as unitarity, entanglement, the no-cloning theorem, and the destructive nature of measurement, which introduce challenges to the safe use of classical abstraction mechanisms. This paper identifies a fundamental conflict in quantum software engineering: abstraction practices that are syntactically valid may violate the physical constraints of quantum computation. We present three classes of failure cases where naive abstraction breaks quantum semantics and propose a set of design principles for physically sound abstraction mechanisms. We further propose research directions, including quantum-specific type systems, effect annotations, and contract-based module design. Our goal is to initiate a systematic rethinking of abstraction in quantum software engineering, based on quantum semantics and considering engineering scalability.
BibTeX
@misc{zhao2025when,
  author = {Jianjun Zhao},
  title = {{When Abstraction Breaks Physics: Rethinking Modular Design in Quantum Software}},
  year = {2025},
  eprint = {2510.18557},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.18557},
}

Loading related content...

Figure