Certified Quantum Realization in Lean 4: A Two-Pattern Prototype with Measurement-Based Uncomputation, Validated Routing, and Conditional Noise Bounds
Year: 2026
Type: preprint
Abstract: Certified quantum realization (CQR) replaces translation-by-trusted-passes with three steps:1. match a classical specification against a library of pre-proved, resource-graded circuit patterns;2. instantiate the pattern;3. emit a certificate that a proof-assistant kernel checks, or reject the request with a diagnostic and a repair hint. We report a two-pattern prototype of CQR in Lean 4 on Mathlib and Physlib. The specifications are Boolean predicates on bit vectors written in a small functional language, and the two patterns are Grover search and quantum counting by amplitude estimation. What a certificate states. Each certificate is a kernel-checked theorem with two conjuncts:- the generated circuit (ε, δ)-realizes the specification under a decoding measurement, within a resource grade, with the decoding taken after the ancillae are traced out;- the circuit restores every ancilla, a separate statement on density operators, so measurement-based uncomputation (MBU) lies inside the correctness notion. For the running example, an 8-bit predicate with 32 solutions, the certificate gives δ = 7/128 at the measured grade (15, 134, 72, 7). Restoration. Around these certificates we mechanize a theory of restoration under measurement:- a general MBU theorem, which separates the computation of the uncomputed function from the implementation of its phase correction;- its boundary in our circuit language, where classically controlled gates are Clifford: a correction exists exactly when the uncomputed function is quadratic over 𝔽_2 (the classical characterization of Clifford diagonals, applied to MBU);- implications among the clean, conditionally clean and dirty ancilla regimes;- a proof that a Khattar–Gidney two-ancilla multi-controlled Z is correct for every n, with its T-count checked for n = 4…12;- a counting lower bound of 8n − 24 T gates within its schedule family and cost model. Routing and noise.- Routed circuits. An untrusted transpiler (Qiskit) routes a circuit on a fake IBM backend and records a witness. Lean reconstructs the physical circuit from the witness, the kernel checks the reconstruction against the transpiler's output, and a soundness theorem transfers the certified realization to the routed circuit, on an ideal device with the target's gates and connectivity.- Noise. We prove a perturbation theorem whose stochastic premise is stated on the full register. Instantiated with calibration-derived numbers, it gives conditional certificates whose premises are named in every artifact. Within the tested Grover family, on two shipped calibration snapshots, the bound is non-vacuous only up to three data qubits, and for some of those instances it does not beat a classical baseline. Scope. The development has 39 503 lines of Lean library, no sorry, and only the standard axioms. The evidence is kernel checking and internal consistency (Lean against an independent statevector harness). No device was run. The repository is public, with its full history, under the Apache License 2.0. Version 1.2 corrects version 1.1 after two more AI-generated reviews (docs/REVIEW_RESPONSE_3.md in the repository): an emulator threshold that version 1.1 had changed wrongly is restored, and the paper now states that the approximate-QFT counting bound is vacuous at the sizes reported. Version 1.1 had corrected version 1.0 after three AI-generated reviews (docs/REVIEW_RESPONSE_2.md). The code and the certificates are unchanged (tag v1.2.0).
Author: Zambak, Aziz F.
Institution: Middle East Technical University
Language: English
Subfield: Artificial Intelligence
Field: Computer Science
Domain: Physical Sciences
Open Access status: green
OpenAlex ID: W7234956269
