Documentation

CslibFrontier.Foundations.Quantum.HadamardTransform

The Hadamard transform on a register of qubits #

Let the computational basis ι of a quantum system split, by an equivalence e : ι ≃ (K → Bool) × R, into a register of qubits indexed by K and a remaining part R. The Hadamard transform on the register applies a Hadamard gate to each of its qubits: |a, r⟩ ↦ 2^{-|K|/2} ∑_z (-1)^{a ⬝ᵥ z} |z, r⟩ (Cslib.Quantum.hadamardTransform). It is an isometry by Parseval's identity for the sign matrix (-1)^{a ⬝ᵥ z} (Cslib.BitString.sum_sq_sum_mul_signVal_dotProduct).

The Hadamard transform is the Fourier transform of the group (K → Bool, +): it is the first and last step of the algorithms of Bernstein–Vazirani and Simon (CslibFrontier/Computability/QueryComplexity/Quantum/BernsteinVazirani.lean, CslibFrontier/Computability/QueryComplexity/Quantum/Simon.lean), de Wolf, Chapters 2 and 3.

Main definitions #

Main results #

References #

noncomputable def Cslib.Quantum.hadamardTransform {K : Type u_1} {ι : Type u_2} {R : Type u_3} [Fintype K] [DecidableEq K] [Fintype ι] [Fintype R] (e : ι ≃ (K → Bool) × R) :

The Hadamard transform on the register K → Bool of a basis ι ≃ (K → Bool) × R: a Hadamard gate on each qubit of the register, |a, r⟩ ↦ 2^{-|K|/2} ∑_z (-1)^{a ⬝ᵥ z} |z, r⟩.

theorem Cslib.Quantum.hadamardTransform_apply {K : Type u_1} {ι : Type u_2} {R : Type u_3} [Fintype K] [DecidableEq K] [Fintype ι] [Fintype R] (e : ι ≃ (K → Bool) × R) (ψ : EuclideanSpace ℂ ι) (p : ι) :
((hadamardTransform e) ψ).ofLp p = ↑(√(2 ^ Fintype.card K))⁻¹ * ∑ a : K → Bool, ↑(BitString.signVal (a ⬝ᵥ (e p).1)) * ψ.ofLp (e.symm (a, (e p).2))
theorem Cslib.Quantum.hadamardTransform_ket {K : Type u_1} {ι : Type u_2} {R : Type u_3} [Fintype K] [DecidableEq K] [Fintype ι] [Fintype R] [DecidableEq ι] [DecidableEq R] (e : ι ≃ (K → Bool) × R) (q p : ι) :
((hadamardTransform e) (ket q)).ofLp p = if (e q).2 = (e p).2 then ↑(√(2 ^ Fintype.card K))⁻¹ * ↑(BitString.signVal ((e q).1 ⬝ᵥ (e p).1)) else 0

The Hadamard transform of a basis state |a, r⟩ has amplitude 2^{-|K|/2} (-1)^{a ⬝ᵥ z} at |z, r⟩ and 0 elsewhere.