Documentation

CslibFrontier.Computability.QueryComplexity.Quantum.BitQuery

Query algorithms with bit queries #

The query model of Cslib.Quantum.run charges phase queries. A Hadamard gate on the control bit before and after a phase query turns it into a bit query |i, b, w⟩ ↦ |i, b ⊕ x_i, w⟩ (Cslib.Quantum.hadCtrl_phaseOracle_hadCtrl_eq_permute). Many algorithms are naturally written with bit queries: a preparation isometry, then T bit queries separated by input-independent permutations of the basis, then a final isometry (Cslib.Quantum.bitQueryAlg). Between the preparation and the final isometry such an algorithm is a classical reversible computation: its state after the last query is the prepared state with the basis permuted by the composite permutation Cslib.Quantum.bitQueryPerm (Cslib.Quantum.run_bitQueryAlg). Each bit query costs exactly one phase query, so the query count is T.

This is the setting of the algorithms of Bernstein–Vazirani and Simon, whose preparation and final isometries are Hadamard transforms (Cslib.Quantum.hadamardTransform). The formulation is original to this library.

Main definitions #

Main results #

noncomputable def Cslib.Quantum.bitQueryAlg {N : ℕ} {W : Type u_1} [Fintype W] (T : ℕ) (π : ℕ → Equiv.Perm (Fin N × Bool × W)) (prep post : State N W →ₗᵢ[ℂ] State N W) :

An algorithm with T bit queries: the preparation isometry prep, then the basis permutations π 0, …, π T separated by bit queries, then the final isometry post. The t-th isometry of the underlying phase-query algorithm is H π_t H with Hadamard gates H on the control bit (Cslib.Quantum.hadCtrl), except that prep replaces the first and post the last H.

def Cslib.Quantum.bitQueryPerm {N : ℕ} {W : Type u_1} (π : ℕ → Equiv.Perm (Fin N × Bool × W)) (x : Fin N → Bool) :

The basis permutation computed by Cslib.Quantum.bitQueryAlg after t bit queries to x: π_t ∘ B_x ∘ π_{t-1} ∘ ⋯ ∘ B_x ∘ π_0 with the bit oracle B_x (Cslib.Quantum.bitFlip).

@[simp]
theorem Cslib.Quantum.bitQueryPerm_zero {N : ℕ} {W : Type u_1} (π : ℕ → Equiv.Perm (Fin N × Bool × W)) (x : Fin N → Bool) :
bitQueryPerm π x 0 = π 0
@[simp]
theorem Cslib.Quantum.bitQueryPerm_succ {N : ℕ} {W : Type u_1} (π : ℕ → Equiv.Perm (Fin N × Bool × W)) (x : Fin N → Bool) (t : ℕ) :
bitQueryPerm π x (t + 1) = π (t + 1) * bitFlip x * bitQueryPerm π x t
theorem Cslib.Quantum.run_bitQueryAlg {N : ℕ} {W : Type u_1} [Fintype W] (T : ℕ) (π : ℕ → Equiv.Perm (Fin N × Bool × W)) (prep post : State N W →ₗᵢ[ℂ] State N W) (ψ₀ : State N W) (x : Fin N → Bool) :
run (bitQueryAlg T π prep post) ψ₀ x T = post ((permute (bitQueryPerm π x T)) (prep ψ₀))

A bit-query algorithm is a classical reversible computation between its first and last isometries: after its T queries, its state is post applied to the prepared state prep ψ₀ with the basis permuted by Cslib.Quantum.bitQueryPerm.