Bernstein-Vazirani algorithm #
The Bernstein-Vazirani problem gives oracle access to the inner-product
function x ↦ x · s mod 2 of an unknown string s, and asks to find s
[dW19, qcnotes.tex:1282-1283]. The original problem is due to Bernstein and
Vazirani (1997).
The circuit is exactly the Deutsch-Jozsa circuit [dW19, qcnotes.tex:1288]:
after one query, the input register holds the phase pattern
(1/√N) ∑_x (-1)^{x·s} |x⟩ [dW19, qcnotes.tex:1293-1294], and the second
Hadamard layer maps it exactly to the classical state |s⟩
[dW19, qcnotes.tex:1296]. One query therefore
recovers the whole hidden string.
This module reuses the shared Walsh-Hadamard pipeline
(WalshHadamard.finalJointState applied to the inner-product oracle): the
query is the actual XOR-oracle gate, bridged by phase kickback. The new
mathematical content is Walsh-character orthogonality, proved by a
pair-cancellation involution (flip a bit on which the two characters
disagree).
Conventions #
- Bit order:
WalshHadamard.bit x k = x.val.testBit k.val, as in theWalshHadamardprimitive. The recovered string is expressed in the same convention used by the oracle, so the statement is convention-consistent. - Big-endian basis labelling as in
Core/State.lean.
Main results #
LeanPool.LeanQuantumAlg.BernsteinVazirani.oracle— the inner-product oracle of a hidden string, as aWalshHadamardBoolean oracle.LeanPool.LeanQuantumAlg.BernsteinVazirani.sum_walshSign_mul_walshSign— Walsh-character orthogonality via the bit-flip involution.LeanPool.LeanQuantumAlg.BernsteinVazirani.finalState_oracle— the final input register is exactly|s⟩.LeanPool.LeanQuantumAlg.BernsteinVazirani.main— the joint register after the circuit is exactly|s⟩ ⊗ |−⟩: one query recovers the hidden string.
Walsh-sign algebra #
The bitwise inner-product parity is symmetric.
The Walsh sign is symmetric.
A Walsh sign squares to 1.
Bit-flip involution #
Two distinct labels differ at some bit.
Flipping a bit on which y and s disagree negates the product of their
Walsh signs.
Circuit correctness #
Querying the inner-product oracle phases each basis label by its Walsh sign with the hidden string [dW19, qcnotes.tex:1293].
The second Hadamard layer maps the Bernstein-Vazirani phase pattern
exactly to the classical state |s⟩ [dW19, qcnotes.tex:1296].
The final Bernstein-Vazirani joint state, annotated with one oracle query.
Equations
Instances For
Public resource profile for the Bernstein-Vazirani circuit:
one oracle query and two n-qubit Hadamard layers plus the target Hadamard.
Equations
Instances For
Bernstein-Vazirani correctness: running the Deutsch-Jozsa circuit
with the inner-product oracle of hidden string s leaves the joint register
in exactly |s⟩ ⊗ |−⟩ [dW19, qcnotes.tex:1296], so a single query recovers
the hidden string (Bernstein and Vazirani 1997).
Bernstein-Vazirani correctness, phrased through the TimeM return value.
Bernstein-Vazirani supporting theorem for the public statement: the profiled
circuit returns |s⟩ ⊗ |-⟩ and records the accepted exact resource counts.