Deutsch-Jozsa algorithm #
The Deutsch-Jozsa problem gives oracle access to a Boolean function on
N = 2^n inputs, promised either constant or balanced: all values equal,
or exactly half zero and half one [dW19, qcnotes.tex:1179, 1181-1182].
The algorithm uses one phase query between two layers of Hadamards
[dW19, qcnotes.tex:1193]. The Walsh-Hadamard layer and the XOR phase-query
pipeline are the shared LeanPool.LeanQuantumAlg.WalshHadamard primitive; this module adds
only the Deutsch-Jozsa-specific content. After the query, the second Hadamard
layer makes the amplitude of |0^n⟩ equal to
(2^n)⁻¹ * ∑ x, (-1)^{f x} [dW19, qcnotes.tex:1245, 1251]. This scalar is
1 or -1 for constant inputs
and 0 for balanced inputs [dW19, qcnotes.tex:1253, 1255], so testing
whether the |0^n⟩ amplitude is
nonzero decides the promise problem exactly.
Main results #
LeanPool.LeanQuantumAlg.deutschJozsa_query_phase— one XOR query with a|−⟩target is the phase query used by the algorithm (viaWalshHadamard+ phase kickback).LeanPool.LeanQuantumAlg.DeutschJozsa.circuitZeroAmplitude_eq_zeroAmplitude_mul— the actual final joint amplitude (fromWalshHadamard.finalJointState) is a nonzero scalar multiple of the standard signed phase average.LeanPool.LeanQuantumAlg.DeutschJozsa.main— under the explicit constant/balanced promise, the nonzero final amplitude test is equivalent to the oracle being constant.
The constant/balanced promise #
The constant side of the Deutsch-Jozsa promise.
Instances For
Inputs on which the oracle returns true.
Instances For
Inputs on which the oracle returns false.
Instances For
The balanced side of the Deutsch-Jozsa promise: exactly as many true
inputs as false inputs.
Equations
Instances For
The explicit Deutsch-Jozsa promise.
Equations
Instances For
The |0^n⟩ amplitude test #
The final input-register amplitude of the all-zero basis state |0^n⟩,
in the phase-query view.
Equations
Instances For
The actual final joint amplitude of |0^n⟩ ⊗ |0⟩. It is a nonzero
scalar multiple of the input-register |0^n⟩ amplitude because the target
qubit remains |−⟩.
Equations
Instances For
The numerator of the final |0^n⟩ amplitude after the second Hadamard
layer: ∑ x, (-1)^{f x}.
Equations
- QuantumAlg.DeutschJozsa.zeroAmplitudeNumerator f = ∑ x : Fin (2 ^ n), QuantumAlg.WalshHadamard.phaseSign f x
Instances For
The standard signed-average formula for the final |0^n⟩ amplitude.
Equations
Instances For
The algorithm reports "constant" exactly when the actual final joint
amplitude |0^n⟩ ⊗ |0⟩ is nonzero. Under the Deutsch-Jozsa promise, this
test is exact.
Equations
Instances For
The signed phase sum is the number of false inputs minus the number of
true inputs.
Applying the closed-form second Hadamard layer to the post-query input
state makes the final |0^n⟩ amplitude equal to the standard signed average.
The actual final joint amplitude tested by the algorithm is the input
|0^n⟩ amplitude times the nonzero |0⟩ component of |−⟩.
Balanced oracles have zero final |0^n⟩ amplitude.
Constant oracles have final |0^n⟩ amplitude exactly 1 or -1,
depending on the constant value.
Constant oracles are reported as constant by the amplitude test.
Balanced oracles are not reported as constant by the amplitude test.
The final Deutsch-Jozsa joint state, annotated with one oracle query.
Equations
Instances For
Public resource profile for the Deutsch-Jozsa circuit:
one oracle query and two n-qubit Hadamard layers plus the target Hadamard.
Equations
Instances For
The final Deutsch-Jozsa joint state with its public resource profile.
Equations
Instances For
The TimeM return value is the same final state used by the amplitude test.
One Deutsch-Jozsa oracle query with the target qubit in |-⟩ is the
phase query |x⟩ ↦ (-1)^{f x}|x⟩.
Deutsch-Jozsa correctness: under the explicit promise that the oracle is constant or balanced, the one-query amplitude test reports "constant" iff the oracle is constant.
Deutsch-Jozsa correctness, phrased through the TimeM return value.
Deutsch-Jozsa supporting theorem for the public statement: under the constant/balanced promise, the profiled circuit decides the constant side exactly and records the accepted exact resource counts.