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 #
Cslib.Quantum.bitQueryAlg: an algorithm withTbit queries.Cslib.Quantum.bitQueryPerm: the basis permutation computed by its bit queries.
Main results #
Cslib.Quantum.run_bitQueryAlg: the state after the last query.
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.
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).
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.