Phase oracles and the reflection about zero #
Conjugating NOT by Hadamard gives the phase flip Z = diag(1, -1)
(Cslib.Quantum.Gate.hadamard_mul_not_mul_hadamard), so the gate codes H, X, H on qubit t
negate the amplitudes of the basis strings with bit t set
(Cslib.Quantum.Circuit.eval_ofCodes_zCodes). Computing a bit with classical codes, flipping its
phase and uncomputing gives the phase oracle of the computation
(Cslib.Quantum.Circuit.eval_ofCodes_phaseOracleCodes): the amplitude of |y⟩ is negated when
the computed bit is one, and nothing else changes. For arbitrary quantum codes, the amplitude of
returning to the input after this construction on the output qubit is one minus twice the original
acceptance probability (Cslib.Quantum.Circuit.run_phaseOracleCodes_input).
Toffoli gates compute the AND of any number of qubits into a qubit, given zeroed scratch qubits
(Cslib.Quantum.GateCode.readBit_classicalRun_andCodes). After NOT gates on the inputs they test
whether the inputs are all zero (Cslib.Quantum.GateCode.readBit_classicalRun_zeroTestCodes). The
phase oracle of this test is the reflection about the all-zero string of a set of qubits
(Cslib.Quantum.Circuit.eval_ofCodes_reflectZeroCodes), the operator Λ̄(σ_z) of Shi,
§4.2, realized with Λ₂(σ_x) and σ_z as Shi indicates. Here σ_z is exactly H σ_x H, so the
approximate phase flip of Shi's §4.1 is not needed with the Hadamard gate.
Main definitions #
Cslib.Quantum.GateCode.zCodes: the phase flipH X Hon one qubit.Cslib.Quantum.GateCode.phaseOracleCodes: compute, flip the phase, uncompute.Cslib.Quantum.GateCode.andCodes,Cslib.Quantum.GateCode.zeroTestCodes: the AND of qubits, and the test that qubits are all zero.Cslib.Quantum.GateCode.reflectZeroCodes: the reflection about the all-zero string.
Main results #
Cslib.Quantum.Gate.hadamard_mul_not_mul_hadamard:H X H = Z.Cslib.Quantum.unitaryEquiv_place_of_diagonal: a placed diagonal gate acts pointwise.Cslib.Quantum.Circuit.eval_ofCodes_phaseOracleCodes: the phase oracle of classical codes.Cslib.Quantum.Circuit.eval_ofCodes_reflectZeroCodes: the reflection about zero.
References #
- Y. Shi, Both Toffoli and Controlled-NOT need little help to do universal quantum computation, §4 (arXiv:quant-ph/0205115v2)
A placed diagonal unitary acts pointwise: it multiplies each amplitude by the diagonal entry at the qubits it acts on.
The codes H, X, H on qubit t: the phase flip Z on t.
The phase oracle of a classical computation: phaseOracleCodes gs t negates the amplitude
of each basis string y for which bit t of classicalRun gs y is set.
The amplitude of returning to the initial basis state after applying a circuit, flipping the phase of its accepting subspace, and running it backwards is its rejection probability minus its acceptance probability. This also applies when the circuit prepares a superposition.
andCodes cs w computes the AND of cs into qubit w when the scratch qubits
w, …, w + |cs| start at zero.
A polynomial-time generator of control indices and a scratch base gives a polynomial-time generator of the elementary gates testing those controls for zero.
zeroTestCodes cs w computes into qubit w whether the qubits cs are all zero, when the
scratch qubits w, …, w + |cs| start at zero.
The reflection about the all-zero string: on basis strings whose scratch qubits
w, …, w + |cs| are zero, reflectZeroCodes cs w negates the amplitude exactly when every qubit
of cs is zero.