BPP ⊆ BQP. A BPP algorithm is a deterministic polynomial-time computation
A(x,r) on the input x and a uniformly random string r∈{0,1}s. Every
deterministic computation can be made reversible with polynomial overhead and written
as a circuit of Toffoli and NOT gates acting on ∣x⟩∣r⟩∣0⋯0⟩ (section
3.2.5 of Nielsen and Chuang). Prepare r by applying H to
s fresh qubits in ∣0⟩, giving 2−s/2∑r∣r⟩, and run the reversible
circuit. Since the circuit permutes basis states, measuring the output bit gives
outcome 1 with probability 2−s#{r:A(x,r)=1}, exactly the classical
acceptance probability.
BQP ⊆ PP. By the results of Shi (with a short proof by
Aharonov), every language in BQP is decided, with
the same acceptance probabilities up to an arbitrarily small change that preserves the
32 versus 31 gap after amplification, by a uniform family of polynomial-size
circuits whose gates are Toffoli and H and whose amplitudes are therefore real. Fix
the input x and such a circuit GL⋯G1 on basis input z0=x0⋯0, and
let h be the number of Hadamards.
Paths. For b∈{0,1}h define basis strings z0,z1,…,zL and a sign
s(b): if Gj is a Toffoli, zj=Gj(zj−1); if Gj is the i-th Hadamard,
acting on qubit q, then zj equals zj−1 with bit q replaced by bi, and the
sign picks up a factor (−1)zj−1[q]bi. Write end(b)=zL. Since
H∣a⟩=2−1/2∑c∈{0,1}(−1)ac∣c⟩ and Toffoli permutes basis
states, induction on j and linearity give
GL⋯G1∣z0⟩=2−h/2b∈{0,1}h∑s(b)∣end(b)⟩,⟨y∣GL⋯G1∣z0⟩=2−h/2b:end(b)=y∑s(b).
Bias. Let χ(y)=+1 if the output bit of y is 1 and −1 otherwise. With
P1 and P0 the probabilities of outputs 1 and 0, and real amplitudes,
P1−P0=y∑χ(y)⟨y∣GL⋯G1∣z0⟩2=2−hb,b′∈{0,1}hend(b)=end(b′)∑s(b)s(b′)χ(end(b)).
A majority machine. Let M be the nondeterministic machine that, on input x,
computes the circuit (possible in polynomial time by uniformity), guesses
b,b′∈{0,1}h and one further bit c, and simulates both paths, computing
end(b), end(b′), s(b) and s(b′) in polynomial time. If
end(b)=end(b′) it accepts if and only if c=0. Otherwise it
accepts if and only if σ=s(b)s(b′)χ(end(b))=+1, whatever c is.
All computation paths have the same length. Pairs with different endpoints contribute
one accepting and one rejecting path; pairs with equal endpoints contribute two
accepting paths if σ=+1 and two rejecting paths if σ=−1. Hence
#accept(x)−#reject(x)=2end(b)=end(b′)∑σ=2h+1(P1−P0).
If x∈L then P1−P0≥31>0, so more than half of the paths of M
accept; if x∈/L then P1−P0≤−31<0, so fewer than half do. Thus
L∈PP. This proves the containment of
Adleman, DeMarrais and Huang by a path-counting
argument written with the Toffoli–Hadamard gate set; their original proof is set up
differently.
PP ⊆ PSPACE. Given a PP machine with paths of length p(n), enumerate the strings
of nondeterministic choices in lexicographic order, simulating each path in polynomial
space and reusing that space, and keep a p(n)+1-bit counter of accepting paths. At the
end compare the counter with 2p(n)−1. Combined with the previous step this gives
BQP⊆PSPACE, which was first proved by
Bernstein and Vazirani.