← All papers
First page of Specifying & Verifying Quantum Error-Correcting Codes

Specifying & Verifying Quantum Error-Correcting Codes

Stavan Jain, Nithin Raveendran, Aws Albarghouthi

quant-ph Nov 16, 2026 · v1 cs.PL
Builds QECLean, a Lean/Mathlib library for specifying quantum error-correcting codes and machine-checking their parameters, including code distance via code combinators.
Building quantum computers is challenging due to the noise that affects qubits. Quantum error correction tackles noise by encoding information in quantum error-correcting (QEC) codes. These codes are often complex, increasingly found by computational search, presented in diverse formalisms with informal arguments, and hard to reason about algorithmically. Given that the rest of the quantum computing stack relies on a QEC code's properties for correct computation, we propose a formally verified foundation for QEC codes. We present QECLean, a Lean-based framework for formally specifying and verifying QEC codes. QECLean backs every claimed QEC-code property with a machine-checked proof, unifies the diverse presentations of codes in the literature through common abstractions, and makes new codes easy to specify. We present a new compositional technique, code combinators, for proving code distance analytically. Code combinators allow us to prove the distance of large codes that are out of reach for algorithmic techniques; for example, we show that IBM's $[[360, 12, \leq 24]]$ code has distance 24, which was previously only known as an upper bound. Furthermore, we show how our approach allows us to formalize and prove entire code families, such as the surface code. Our work lays the foundation required for reasoning about circuit-level implementations of codes on given architectures and for building end-to-end verified compilers for quantum computers. QECLean is available at https://github.com/Stavan-Jain/QECLean

Quantum error-correcting codes are complex, often found by computational search, and justified with informal arguments. Their distance is hard to establish algorithmically for large codes. The rest of the quantum stack depends on these properties being correct.

QECLean is a Lean framework in which a value of type Code[[n,k,d]] packages a code with machine-checked proofs of its qubit count, logical qubits, and distance. Pauli operators, stabilizer groups and stabilizer codes are defined using Mathlib's group theory, linear algebra and homology. Code combinators are introduced to prove distance compositionally, and small obligations are discharged with decision procedures such as decide.

QECLean proves that IBM's [[360,12,≤24]] code has distance exactly 24, which was previously known only as an upper bound. It also formalizes entire code families such as the surface code.