Documentation

CslibFrontier.Computability.QueryComplexity.Quantum.DeutschJozsa

The Deutsch–Jozsa algorithm #

The Deutsch–Jozsa problem Deutsch, Jozsa, as stated in de Wolf, §2.4.1: for N = 2^n, the input x ∈ {0,1}^N, with positions identified with the bit strings {0,1}^n by an equivalence e, is promised to be constant or balanced. The goal is to decide which.

The algorithm. Apply the Hadamard transform to the query register, make one phase query, apply the Hadamard transform again, and measure whether the query register holds 0ⁿ. This is the circuit Cslib.Quantum.bernsteinVazirani e with initial state Cslib.Quantum.bernsteinVaziraniInit e; de Wolf §2.4.2 notes that the Bernstein–Vazirani algorithm "is exactly the same as the Deutsch-Jozsa algorithm". The circuit is reused here rather than redefined.

Analysis. After the query the amplitude of |z, 1⟩ is 2^{-n} ∑_a (-1)^{x_a + a ⬝ z} (Cslib.Quantum.run_bernsteinVazirani_apply), the Walsh–Hadamard coefficient of (-1)^x at z. At z = 0ⁿ it is 2^{-n} ∑_a (-1)^{x_a}, so the query register holds 0ⁿ with probability (2^{-n} ∑_i (-1)^{x_i})² (Cslib.Quantum.regProb_run_bernsteinVazirani_zero). That is 1 on a constant input and 0 on a balanced one (Cslib.BitString.IsBalanced.sum_signVal_eq_zero). So one query solves the problem with certainty (Cslib.Quantum.deutschJozsa_regProb_eq_bitVal). The original algorithm of Deutsch and Jozsa used two queries. The one-query version, with a phase oracle, is due to Cleve, Ekert, Macchiavello and Mosca [CEMM98], as de Wolf §2.4.1 records.

The separation. Every deterministic decision tree solving the problem needs 2^{n-1} + 1 queries (CslibFrontier/Computability/QueryComplexity/DeutschJozsa.lean). The bound holds in the same bit-query model on the same input. Cslib.Quantum.deutschJozsa_separation combines the two. The separation is for exact computation only. The problem is easy for bounded-error randomized algorithms (de Wolf §2.4.1): three random queries err with probability at most 1/4 on the promise (CslibFrontier/Computability/QueryComplexity/Randomized/DeutschJozsa.lean).

Main results #

References #

theorem Cslib.Quantum.regProb_run_bernsteinVazirani_zero {N : ℕ} {K : Type u_1} [Fintype K] [DecidableEq K] (e : Fin N ≃ (K → Bool)) (x : Fin N → Bool) :

The probability of measuring 0ⁿ after the Hadamard–query–Hadamard circuit on input x is (2^{-n} ∑_i (-1)^{x_i})².

theorem Cslib.Quantum.regProb_run_bernsteinVazirani_zero_of_const {N : ℕ} {K : Type u_1} [Fintype K] [DecidableEq K] (e : Fin N ≃ (K → Bool)) (c : Bool) :
regProb (run (bernsteinVazirani e) (bernsteinVaziraniInit e) (fun (x : Fin N) => c) 1) (e.symm 0) = 1

On a constant input, the circuit measures 0ⁿ with certainty.

On a balanced input, the circuit never measures 0ⁿ.

theorem Cslib.Quantum.deutschJozsa_regProb_eq_bitVal {N : ℕ} {K : Type u_1} [Fintype K] [DecidableEq K] (e : Fin N ≃ (K → Bool)) {F : (Fin N → Bool) → Bool} (hF : QueryComplexity.SolvesDeutschJozsa F) {x : Fin N → Bool} (hx : (∃ (c : Bool), x = fun (x : Fin N) => c) ∨ BitString.IsBalanced x) :

The Deutsch–Jozsa algorithm decides the problem with certainty using one query Cleve, Ekert, Macchiavello, Mosca: for every total F that solves the problem, on every constant or balanced input x the probability of measuring 0ⁿ after one query is exactly F x, read as 0 or 1.

theorem Cslib.Quantum.deutschJozsa_separation {N : ℕ} {K : Type u_1} [Fintype K] [DecidableEq K] (e : Fin N ≃ (K → Bool)) (hK : 0 < Fintype.card K) :
‖bernsteinVaziraniInit e‖ = 1 ∧ (∀ (F : (Fin N → Bool) → Bool), QueryComplexity.SolvesDeutschJozsa F → ∀ (x : Fin N → Bool), (∃ (c : Bool), x = fun (x : Fin N) => c) ∨ BitString.IsBalanced x → regProb (run (bernsteinVazirani e) (bernsteinVaziraniInit e) x 1) (e.symm 0) = BitString.bitVal ℝ (F x)) ∧ ∀ (F : (Fin N → Bool) → Bool), QueryComplexity.SolvesDeutschJozsa F → 2 ^ (Fintype.card K - 1) + 1 ≤ DecisionTree.complexity F

The exact quantum–deterministic separation for Deutsch–Jozsa, in the bit-query model on N = 2^n positions with n ≥ 1. From a unit initial state, one quantum query decides every constant or balanced input with certainty. Every deterministic decision tree solving the problem (as a total function F correct on the promise inputs) has depth at least 2^{n-1} + 1.