Reversible quantum realization of Boolean samplers #
A De Morgan circuit on n input bits is a sampler when its inputs are fair coins. This module
realizes that sampler as an elementary quantum circuit: put Hadamard gates on n zero qubits,
compile the Boolean gate list with Cslib.Quantum.Reversible.codes, retain the seed and compiler
garbage, and copy every Boolean output into a fresh declared output block. A single final
computational-basis measurement reads that block.
The construction is exact relative to the Boolean circuit's output distribution. In particular, it introduces no additional abort or approximation: non-dyadic error, collisions, and fixed-weight guarantees remain properties of the Boolean sampler supplied by a client. Concrete instruction, qubit, measurement and encoded-description costs are kept separate from the static generator program and its offline running time.
Main definitions #
Cslib.Quantum.Reversible.outputCopyCodes: CNOT gates copying Boolean output wires into a fresh consecutive block.Cslib.Quantum.Reversible.samplerCodes: the Hadamard preparation, reversible compilation and output copy.Cslib.Quantum.Reversible.samplerDist: the distribution read from the copied output block after one final measurement.
Main results #
Cslib.Quantum.Reversible.wellFormed_samplerCodes: every emitted elementary gate is valid for the declared width.Cslib.Quantum.Reversible.samplerDist_eq_outputDist: the measured quantum distribution is exactly the Boolean circuit's distribution on uniform inputs.Cslib.Quantum.Reversible.computableInPolyTime_samplerOutputStart: the copied-output block position is generated in polynomial time from the seed count and Boolean code.Cslib.Quantum.Reversible.computableInPolyTime_samplerCodes: the native gate-code generator is polynomial time when the Boolean circuit code is.
References #
- J. Watrous, Quantum computational complexity, Section IV.3.
Read the copied output block of a typed Boolean circuit from a measured basis string.
The measured output distribution of the reversible realization, started with every qubit zero. The construction performs one final computational-basis measurement and reads only the fresh copied output block.
Every copied-output CNOT is classical and well formed when the target block follows z and
fits in the register.
The classical suffix is well formed for the sampler's declared width.
Classical correctness #
Copying an output block writes source outputs[j] into target base + j, provided the target
block starts after every possible source and is initially zero.
Basis-state correctness of the classical suffix: on a seed x followed by zero ancillas,
the copied output block is exactly the output of the typed Boolean circuit.
Exact output law #
Exact fair-seed realization: measuring the copied output block of the reversible quantum sampler gives exactly the output distribution of the Boolean circuit on uniform inputs. The classical suffix only permutes basis states, so seed branches cannot interfere.
Output-copy code generation is polynomial time in the unary block positions and binary output wire list.
The first copied-output position is generated in polynomial time from the unary seed count and complete binary-wire circuit code.
The complete fair-seed reversible sampler is generated in polynomial time from the input arity and Boolean circuit code. This is an offline generator certificate, not an online execution-time or static generator-program-size bound.