Documentation

CslibFrontier.Computability.Complexity.Classes.QMA.Amplification

Weak error reduction for QMA #

The completeness 2 / 3 and soundness 1 / 3 in the definition of QMA (Cslib.Complexity.QMA) can be made exponentially close to 1 and 0: A ∈ QMA enc exactly when for every polynomial q the problem has verifiers with completeness 1 - 2^{-q(n)} and soundness 2^{-q(n)}, where n is the length of the encoded instance (Cslib.Complexity.mem_QMA_iff_forall_errorExponent). This is Kitaev's parallel repetition Kitaev, Shen, Vyalyi, Section 14.2; Marriott, Watrous, Theorem 3.2, here at the gap (2 / 3, 1 / 3). The witness grows with the number of repetitions, which Watrous, Section V.3, calls weak error reduction.

The amplified verifier family (Cslib.Quantum.UniformVerifierFamily.amplify) reuses the reversible majority vote of the error reduction for BQP (Cslib.Quantum.Amplify). On inputs of length n, for a verifier of width m and witness length p, the amplified witness consists of 2 r blocks of p qubits, and the register consists of 2 r + 1 blocks of width W = m + 2 r p and the counter's ancillas. Block 0 holds the input and the witness blocks; block j + 1 is copy j of the original register. The amplified circuit (Cslib.Quantum.QMAAmplify.codes):

  1. moves witness block j into the witness qubits of copy j with CNOT gates (Cslib.Quantum.QMAAmplify.moveInCodes, Cslib.Quantum.QMAAmplify.moveOutCodes);
  2. copies the input into each copy (Cslib.Quantum.Amplify.copyCodes);
  3. runs the original circuit on each copy (Cslib.Quantum.Amplify.copiesCodes);
  4. computes the strict majority of the copies' answers into qubit 0 with a reversible counter.

Steps 1, 2 and 4 are classical, so the acceptance probability is the weight of the outcomes with more than r accepting copies under the 2 r-fold tensor power of the original circuit applied to the witness (Cslib.Quantum.UniformVerifierFamily.acceptProb_amplify).

Taking r = 6 q gives the error 2^{-q}.

Main definitions #

Main results #

Error reduction from an arbitrary inverse-polynomial gap, as in [Marriott, Watrous] [MW05], Theorem 3.2, and strong error reduction, which keeps the witness length (Marriott, Watrous, Theorem 3.3), are not formalized here.

References #

CNOT gates copying witness block j < k (qubits n + p j, …) into the witness qubits of copy j (qubits n + (j + 1) W, …).

CNOT gates clearing the witness blocks, after moveInCodes.

theorem Cslib.Quantum.QMAAmplify.mem_moveInCodes {n p W k : ℕ} {g : GateCode} :
g ∈ moveInCodes n p W k ↔ ∃ j < k, ∃ i < p, g = (false, i + n + (j + 1) * W, [i + p * j + n])

The gates of moveInCodes.

theorem Cslib.Quantum.QMAAmplify.mem_moveOutCodes {n p W k : ℕ} {g : GateCode} :
g ∈ moveOutCodes n p W k ↔ ∃ j < k, ∃ i < p, g = (false, i + p * j + n, [i + n + (j + 1) * W])

The gates of moveOutCodes.

theorem Cslib.Quantum.QMAAmplify.nodup_moveInCodes {n p W k : ℕ} (hW : n + p ≤ W) :
(List.map (fun (g : GateCode) => g.2.1) (moveInCodes n p W k)).Nodup

The gates of moveInCodes have distinct targets.

theorem Cslib.Quantum.QMAAmplify.nodup_moveOutCodes {n p W k : ℕ} :
(List.map (fun (g : GateCode) => g.2.1) (moveOutCodes n p W k)).Nodup

The gates of moveOutCodes have distinct targets.

The registers of the amplified verifier #

def Cslib.Quantum.QMAAmplify.slotEmb {n m p W R : ℕ} (hnp : n + p ≤ m) (hm : m ≤ W) :
Fin (2 * R) × Fin p ↪ Fin (Amplify.width W (2 * R) R)

The witness qubits n, …, n + p - 1 of all copies, indexed by the copy and the qubit.

@[simp]
theorem Cslib.Quantum.QMAAmplify.slotEmb_apply_val {n m p W R : ℕ} (hnp : n + p ≤ m) (hm : m ≤ W) (q : Fin (2 * R) × Fin p) :
↑((slotEmb hnp hm) q) = ↑q.2 + n + (↑q.1 + 1) * W
def Cslib.Quantum.QMAAmplify.slotsEmb {n m p W R : ℕ} (hnp : n + p ≤ m) (hm : m ≤ W) :
Fin (2 * R * p) ↪ Fin (Amplify.width W (2 * R) R)

The witness qubits of all copies, indexed as the witness blocks are.

theorem Cslib.Quantum.QMAAmplify.slotsEmb_finProdFinEquiv {n m p W R : ℕ} (hnp : n + p ≤ m) (hm : m ≤ W) (q : Fin (2 * R) × Fin p) :
(slotsEmb hnp hm) (finProdFinEquiv q) = (slotEmb hnp hm) q

The witness qubit i of copy j.

theorem Cslib.Quantum.QMAAmplify.lt_width_of_lt {W R c : ℕ} (h : c < W) :
c < Amplify.width W (2 * R) R

The first block lies in the register.

theorem Cslib.Quantum.QMAAmplify.witBlock_le {n p W R : ℕ} (hW : n + 2 * R * p ≤ W) :
n + 2 * R * p ≤ Amplify.width W (2 * R) R

The input and the witness blocks fit in the first block of the register.

theorem Cslib.Quantum.QMAAmplify.classicalRun_moveCodes {n m p W R : ℕ} (hnp : n + p ≤ m) (hm : m ≤ W) (hW : n + 2 * R * p ≤ W) (X : Fin (Amplify.width W (2 * R) R) → Bool) (hX : ∀ (c : ℕ), n ≤ c → readBit X c = false) (Z : Fin (2 * R * p) → Bool) :
GateCode.classicalRun (moveInCodes n p W (2 * R) ++ moveOutCodes n p W (2 * R)) (glue (blockEmb n ⋯) Z X) = glue (slotsEmb hnp hm) Z X

Moving the witness blocks into the copies: the CNOT gates of moveInCodes and then moveOutCodes move the bits on the witness blocks n, …, n + 2 R p - 1 into the witness qubits of the copies, when the latter are zero.

theorem Cslib.Quantum.QMAAmplify.isClassical_moveCodes {n p W R : ℕ} (hW : n + 2 * R * p ≤ W) :
GateCode.IsClassical (Amplify.width W (2 * R) R) (moveInCodes n p W (2 * R) ++ moveOutCodes n p W (2 * R))

Moving the witness blocks is classical.

theorem Cslib.Quantum.QMAAmplify.classicalRun_prep {n m p W R : ℕ} (hnp : n + p ≤ m) (hm : m ≤ W) (hW : n + 2 * R * p ≤ W) (X : Fin (Amplify.width W (2 * R) R) → Bool) (hX : ∀ (c : ℕ), n ≤ c → readBit X c = false) (Z : Fin (2 * R * p) → Bool) :
GateCode.classicalRun (moveInCodes n p W (2 * R) ++ moveOutCodes n p W (2 * R) ++ Amplify.copyCodes n W (2 * R)) (glue (blockEmb n ⋯) Z X) = glue (slotsEmb hnp hm) Z (GateCode.classicalRun (Amplify.copyCodes n W (2 * R)) X)

The classical preparation: moving the witness blocks into the copies and copying the input into them.

theorem Cslib.Quantum.QMAAmplify.eval_prep {n m p W R : ℕ} (hnp : n + p ≤ m) (hm : m ≤ W) (hW : n + 2 * R * p ≤ W) (X : Fin (Amplify.width W (2 * R) R) → Bool) (hX : ∀ (c : ℕ), n ≤ c → readBit X c = false) (Ψ : Qubits (2 * R * p)) :
(Circuit.ofCodes (Amplify.width W (2 * R) R) (moveInCodes n p W (2 * R) ++ moveOutCodes n p W (2 * R) ++ Amplify.copyCodes n W (2 * R))).eval ((embedState (blockEmb n ⋯) X) Ψ) = (embedState (slotsEmb hnp hm) (GateCode.classicalRun (Amplify.copyCodes n W (2 * R)) X)) Ψ

The state after the classical preparation: the witness on the witness qubits of the copies.

theorem Cslib.Quantum.QMAAmplify.glue_slotsEmb_comp_block {n m p W R : ℕ} (hnp : n + p ≤ m) (hm : m ≤ W) (Z : Fin (2 * R * p) → Bool) (X : Fin (Amplify.width W (2 * R) R) → Bool) (j : Fin (2 * R)) :
glue (slotsEmb hnp hm) Z X ∘ ⇑(Amplify.block hm j) = glue (blockEmb n hnp) (fun (i : Fin p) => Z (finProdFinEquiv (j, i))) (X ∘ ⇑(Amplify.block hm j))

The bits of a copy after writing the witness blocks: the witness on its witness qubits.

noncomputable def Cslib.Quantum.QMAAmplify.amp {n m p : ℕ} (hnp : n + p ≤ m) (gs : List GateCode) (x : List Bool) (u : Fin m → Bool) (w : Fin p → Bool) :

The amplitudes of one run of the original verifier circuit gs on the input x: outcome u on the basis witness w.

The gate codes of the amplified verifier: move the 2 R witness blocks into the witness qubits of 2 R copies of the original register (of width at most W), copy the input into them, run the original circuit gs on each copy, and take the strict majority of their answers with the reversible counter of Cslib.Quantum.Amplify.

theorem Cslib.Quantum.QMAAmplify.codes_eq (n p W R : ℕ) (gs : List GateCode) :
codes n p W R gs = moveInCodes n p W (2 * R) ++ moveOutCodes n p W (2 * R) ++ Amplify.copyCodes n W (2 * R) ++ (Amplify.copiesCodes W (2 * R) gs ++ (Counter.codes (Amplify.base W (2 * R)) (R + 1) (fun (s : ℕ) => (s + 1) * W) (2 * R) ++ GateCode.swapCodes (Amplify.answer W (2 * R) R)))

The gate codes of the amplified verifier, grouped into the classical preparation, the copies of the original circuit, and the counter.

theorem Cslib.Quantum.QMAAmplify.measureProb_codes {n m p W R : ℕ} (hnp : n + p ≤ m) (hm : m ≤ W) (hW : n + 2 * R * p ≤ W) (hm0 : 0 < m) {gs : List GateCode} (hgs : ∀ g ∈ gs, GateCode.WellFormed m g) (x : List Bool) (hx : x.length = n) (Ψ : Qubits (2 * R * p)) :
measureProb ((Circuit.ofCodes (Amplify.width W (2 * R) R) (codes n p W R gs)).eval ((embedState (blockEmb n ⋯) (inputState (Amplify.width W (2 * R) R) x)) Ψ)) (accepting (Amplify.width W (2 * R) R)) = ∑ u : Fin (2 * R) → Fin m → Bool with R < {j : Fin (2 * R) | u j ∈ accepting m}.card, ‖tensorPowerApply (amp hnp gs x) (Ψ.ofLp ∘ ⇑BitString.blocksEquiv.symm) u‖ ^ 2

The acceptance probability of the amplified verifier on the witness Ψ for the 2 R blocks: the weight of the outcomes of the 2 R copies of the original circuit in which more than R copies accept, under the 2 R-fold tensor power of the original circuit applied to Ψ.

The amplified verifier is constructed in polynomial time #

The amplified verifier family Kitaev, Shen, Vyalyi, Section 14.2: on inputs of length n, the witness consists of 2 r(n) blocks of V's witness length; each block is moved into its own copy of V's register, the 2 r(n) copies of V's circuit run side by side, and a reversible majority vote of their answers is measured.

The amplitudes of one run of V on the input x: outcome u on the basis witness w.

The acceptance probability of the amplified family on the witness Ψ: the weight of the outcomes of 2 r(n) copies of V in which more than r(n) copies accept, under the 2 r(n)-fold tensor power of V's circuit applied to Ψ.

The outcomes of one run of V on the witness φ.

theorem Cslib.Quantum.UniformVerifierFamily.amp_isometry (V : UniformVerifierFamily) (x : List Bool) (φ : (Fin (V.witnessLength x.length) → Bool) → ℂ) :
∑ u : Fin (V.width x.length) → Bool, ‖∑ w : Fin (V.witnessLength x.length) → Bool, V.amp x u w * φ w‖ ^ 2 = ∑ w : Fin (V.witnessLength x.length) → Bool, ‖φ w‖ ^ 2

One run of V is an isometry from the witness to the outcomes.

theorem Cslib.Quantum.UniformVerifierFamily.sum_accepting_amp (V : UniformVerifierFamily) (x : List Bool) (φ : (Fin (V.witnessLength x.length) → Bool) → ℂ) :
∑ u ∈ accepting (V.width x.length), ‖∑ w : Fin (V.witnessLength x.length) → Bool, V.amp x u w * φ w‖ ^ 2 = V.acceptProb x (WithLp.toLp 2 φ)

The acceptance probability of one run of V on the witness φ.

A bound on the acceptance probability of unit witnesses holds for all witnesses, scaled by the squared norm.

Amplifying soundness Kitaev, Shen, Vyalyi, Section 14.2: if V accepts every unit witness with probability at most 1 / 3, then the amplified family accepts every witness, entangled across the blocks or not, with probability at most (8 / 9) ^ r(n) times its squared norm.

Amplifying completeness Kitaev, Shen, Vyalyi, Section 14.2: if V accepts the unit witness ψ with probability at least 2 / 3, then the amplified family accepts the unit witness ψ^{⊗ 2 r(n)} with probability at least 1 - (8 / 9) ^ r(n).

theorem Cslib.Complexity.PromiseQMA_subset_errorExponent {α : Type} {enc : α ↪ List Bool} (q : Polynomial ℕ) :
PromiseQMA (fun (x : ℕ) => 2 / 3) (fun (x : ℕ) => 1 / 3) enc ⊆ PromiseQMA (fun (n : ℕ) => 1 - (2 ^ Polynomial.eval n q)⁻¹) (fun (n : ℕ) => (2 ^ Polynomial.eval n q)⁻¹) enc

Weak error reduction for QMA Kitaev, Shen, Vyalyi, Section 14.2; Marriott, Watrous, Theorem 3.2 at the gap (2 / 3, 1 / 3): for every polynomial q, QMA(2 / 3, 1 / 3) ⊆ QMA(1 - 2^{-q}, 2^{-q}). The amplified verifier takes 12 q(n) copies of the witness length.

theorem Cslib.Complexity.PromiseQMA_errorExponent_subset {α : Type} {enc : α ↪ List Bool} (q : Polynomial ℕ) (hq : ∀ (n : ℕ), 2 ≤ Polynomial.eval n q) :
PromiseQMA (fun (n : ℕ) => 1 - (2 ^ Polynomial.eval n q)⁻¹) (fun (n : ℕ) => (2 ^ Polynomial.eval n q)⁻¹) enc ⊆ PromiseQMA (fun (x : ℕ) => 2 / 3) (fun (x : ℕ) => 1 / 3) enc

Conversely, QMA(1 - 2^{-q}, 2^{-q}) ⊆ QMA(2 / 3, 1 / 3) when q ≥ 2.

theorem Cslib.Complexity.mem_QMA_iff_forall_errorExponent {α : Type} {enc : α ↪ List Bool} {A : Set α} :
A ∈ QMA enc ↔ ∀ (q : Polynomial ℕ), PromiseProblem.ofSet A ∈ PromiseQMA (fun (n : ℕ) => 1 - (2 ^ Polynomial.eval n q)⁻¹) (fun (n : ℕ) => (2 ^ Polynomial.eval n q)⁻¹) enc

Error reduction for QMA: a problem is in QMA exactly when, for every polynomial q, it has a polynomial-time uniform family of verifiers with completeness 1 - 2^{-q(n)} and soundness 2^{-q(n)}, where n is the length of the encoded instance.