Documentation

CslibFrontier.Computability.Circuit.Quantum.HadamardLayer

A layer of Hadamard gates #

The gate codes hadamardCodes o p put one Hadamard gate on each of the qubits o, …, o + p - 1. On a basis state whose qubits o, …, o + p - 1 are zero, the layer prepares the uniform superposition of the 2^p strings on those qubits, each with amplitude 2^{-p/2} (Cslib.Quantum.eval_hadamardCodes_ket). This is how a quantum circuit simulates p fair coins: Hadamard gates on fresh qubits, followed by a classical circuit reading them Watrous, Section IV.3.

Main definitions #

Main results #

References #

Hadamard gate codes on the qubits o, …, o + p - 1.

theorem Cslib.Quantum.eval_hadamardCodes_ket {N o p : ℕ} (h : o + p ≤ N) (X : Fin N → Bool) (hX : ∀ (i : Fin p), X ((blockEmb o h) i) = false) :
(Circuit.ofCodes N (hadamardCodes o p)).eval (ket X) = ∑ r : Fin p → Bool, ↑(√2)⁻¹ ^ p • ket (glue (blockEmb o h) r X)

A layer of Hadamard gates on zero qubits prepares the uniform superposition: on a basis state |X⟩ whose qubits o, …, o + p - 1 are zero, it gives 2^{-p/2} ∑_r |X with r on them⟩.

theorem Cslib.Quantum.wellFormed_hadamardCodes {W o p : ℕ} (hW : o + p ≤ W) (g : GateCode) :

A Hadamard layer whose target block fits in the register consists of well-formed gates.

The Hadamard codes on a block are computable in polynomial time from the block in unary.