Amplitudes of Hadamard–Toffoli circuits as path sums #
The gates of CslibFrontier/Computability/Circuit/Quantum/Code.lean act on basis states either as
permutations (NOT, CNOT, Toffoli) or by branching into two basis states with amplitudes ±1/√2
(Hadamard). Following one branch per Hadamard gate gives a path: a bit string of length h, the
number of Hadamard gates (Cslib.Quantum.hadamardCount). The classical simulation
Cslib.Quantum.pathStep follows a path on a register written as a bit string. It writes the next
path bit into the target of a Hadamard gate, flipping a sign when the old and new bits are both
one, and it applies classical gates directly. Every amplitude of the circuit is then a signed count
of paths divided by √2^h (Cslib.Quantum.run_ofCodes_apply):
⟨y|C|x⟩ = (∑_π ±[π ends in y]) / √2^h. This adapts the argument of Fortnow and Rogers
Fortnow, Rogers, Lemma 3.2, from quantum Turing machines to circuits.
Squaring and summing over the accepting outcomes, the acceptance probability is a signed count of
pairs of paths that end in the same accepting register, divided by 2^h
(Cslib.Quantum.acceptProb_eq_acceptGap). Both counts are integers computed from polynomial-time
simulations, which places BQP in the counting classes
(CslibFrontier/Computability/Complexity/Classes/BQP/Counting.lean). The same holds for the
probability that every qubit of a list S reads 1, with the pairs of paths ending in the same
register in which every qubit of S is one (Cslib.Quantum.onesProb_eq_onesGap); the acceptance
gap is the case S = [0]. Pairs of paths from two different basis states x and x' give the
overlap of the two final states on those outcomes (Cslib.Quantum.sum_onesAt_star_run_mul_run),
the projected pair gap Cslib.Quantum.onesPairGap S gs x x' over 2^h; these are the entries of
the acceptance operator of a quantum verifier on its witness space.
Main definitions #
Cslib.Quantum.pathStep,Cslib.Quantum.pathRun: the path simulation.Cslib.Quantum.hadamardCount: the number of Hadamard gates.Cslib.Quantum.pathTerm,Cslib.Quantum.pathGap: the signed path count of an amplitude.Cslib.Quantum.onesTerm,Cslib.Quantum.onesGap: the signed count of pairs of paths of the probability that every qubit of a list reads1.Cslib.Quantum.acceptGap: its case of qubit0, for the acceptance probability.Cslib.Quantum.onesPairTerm,Cslib.Quantum.onesPairGap: the same for pairs of paths from two registers.
Main results #
Cslib.Quantum.run_ofCodes_apply: amplitudes are path sums.Cslib.Quantum.onesProb_eq_onesGap,Cslib.Quantum.acceptProb_eq_acceptGap: probabilities are projected gaps over2^h.Cslib.Quantum.sum_onesAt_star_run_mul_run: overlaps are projected pair gaps over2^h.Cslib.Quantum.onesGap_nonneg_and_le,Cslib.Quantum.onesGap_nil_eq_two_pow: so projected gaps lie between0and2^h, with2^hfor the empty list.Cslib.Quantum.acceptGap_nil: the acceptance gap of the empty circuit is the bit of qubit0.
References #
The path simulation #
One step of the path simulation. The state holds the register bits, the unread path bits and a
sign. A Hadamard gate on t writes the next path bit c into t, flipping the sign when the old
and new bits are both one; a classical gate flips t when all its controls are one.
The number of Hadamard gates in a list of gate codes.
The Hadamard gates are the codes flagged true.
The signed contribution of a pair of paths, one from the register x and one from x', to the
overlap of the two final states on the outcomes in which every qubit of S reads 1: the product
of their signs when both end in the same register with every qubit of S equal to one, and 0
otherwise. For x = x' this is onesTerm (Cslib.Quantum.onesTerm_eq_onesPairTerm).
The projected pair gap of S on the registers x and x': the sum of onesPairTerm S
over all pairs of paths. For x = x' this is onesGap (Cslib.Quantum.onesGap_eq_onesPairGap).
The contribution of a pair of paths to the acceptance gap: the product of their signs when both
end in the same register with qubit 0 equal to one, and 0 otherwise.
The contribution of a pair of paths from two registers to the acceptance overlap: the product
of their signs when both end in the same register with qubit 0 equal to one, and 0
otherwise.
Amplitudes are path sums: for well-formed codes, the amplitude ⟨y|C|x⟩ of the decoded
circuit is the amplitude gap pathGap divided by √2^h, where h counts the Hadamard gates.
Probabilities are projected gaps over 2^h: for well-formed codes, the probability that
every qubit of S reads 1 is onesGap S divided by 2^h, where h counts the Hadamard
gates.
The acceptance probability is a gap over 2^h: for well-formed codes on m qubits, the
acceptance probability is acceptGap divided by 2^h, where h counts the Hadamard gates.
Overlaps are projected pair gaps over 2^h: for well-formed codes, the overlap
∑_{y ∈ onesAt m S} conj ⟨y|C|x⟩ ⟨y|C|x'⟩ of the final states from the basis states x and x' on
the outcomes in which every qubit of S reads 1 is onesPairGap S divided by 2^h. The
amplitudes are real, so no conjugate remains on the right.
A projected gap is a count between 0 and 2 ^ h for well-formed codes on the register
X, since it is 2 ^ h times a probability.
The projected gap of no condition is 2 ^ h, the squared norm of the final state.