Algebraic and Logical Emulations of Quantum Circuits

Quantum circuits exhibit several features of large-scale distributed systems. They have a concise design formalism but behavior that is challenging to represent let alone predict. Issues of scalability—both in the yet-to-be-engineered quantum hardware and in classical simulators—are paramount. They require sparse representations for efficient modeling. Whereas simulators represent both the system’s current state and its operations directly, emulators manipulate the images of system states under a mapping to a different formalism. We describe three such formalisms for quantum circuits. The first two extend the polynomial construction of Dawson et al.  to (i) work for any set of quantum gates obeying a certain “balance” condition and (ii) produce a single polynomial over any sufficiently structured field or ring. The third appears novel and employs only simple Boolean formulas, optionally limited to a form we call “parity-of-AND” equations. Especially the third can combine with off-the-shelf state-of-the-art third-party software, namely model counters and #SAT solvers, that we show capable of vast improvements in the emulation time in natural instances. We have programmed all three constructions to proof-of-concept level and report some preliminary tests and applications. These include algebraic analysis of special quantum circuits and the possibility of a new classical attack on the factoring problem. Preliminary comparisons are made with the libquantum simulator[2–4]. 1 A Brief But  A quantum circuit is a compact representation of a computational system. It consists of some number m of qubits represented by lines resembling a musical staff, and some number s of gates arrayed like musical notes and chords. Here is an example created using the popular visual simulator  A five-qubit quantum circuit that computes a Fourier transform on the first four qubits. The circuit C operates on m = 5 qubits. The input is the binary string x = 10010. The first n = 4 qubits see most of the action and hold the nominal input x0 = 1001 of length n = 4, while the fifth qubit is an ancilla initialized to 0 whose purpose here is to hold the nominal output bit. The circuit has thirteen gates. Six of them have a single control represented by a black dot; they activate if and only if the control receives a 1 signal. The last gate has two controls and a target represented by the parity symbol ⊕ rather than a labeled box. Called a Toffoli gate, it will set the output bit if and only if both controls receive a 1 signal. The two gates before it merely swap the qubits 2 and 3 and 1 and 4, respectively. They have no effect on the output and are included here only to say that the first twelve gates combine to compute the quantum Fourier transform QFT4. This is just the ordinary discrete Fourier transform F16 on 2 4 = 16 coordinates. The actual output C(x) of the circuit is a quantum state Z that belongs to the complex vector space C. Nine of its entries in the standard basis are shown in Figure 1; seven more were cropped from the screenshot. Sixteen of the components are absent, meaning Z has 0 in the corresponding coordinates. Despite the diversity of the nine complex entries ZL shown, each has magnitude |ZL| = 0.0625. In general, |ZL| represents the probability that a measurement—of all qubits—will yield the binary string z ∈ { 0, 1 } corresponding to the coordinate L under the standard ordered enumeration of { 0, 1 }. Here we are interested in those z whose final entry z5 is a 1. Two of them are shown; two others (11101 and 11111) are possible and also have probability 1 16 each, making a total of 1 4 probability for getting z5 = 1. Owing to the “cylindrical” nature of the set B of strings ending in 1, a measurement of just the fifth qubit yields 1 with probability 1 4 . Where does the probability come from? The physical answer is that it is an indelible aspect of nature as expressed by quantum mechanics. For our purposes the computational answer is that it comes from the four gates labeled H, for Hadamard gate. Each supplies one bit of nondeterminism, giving four bits in all, which govern the sixteen possible outcomes of this particular example. It is a mistake to think that the probabilities must be equally spread out and must be multiples of 1/2 where h is the number of Hadamard gates. Appending just one more Hadamard gate at the right end of the third qubit line creates nonzero probabilities as low as 0.0183058 . . . and as high as 0.106694 . . . , each appearing for four outcomes of 24 nonzero possibilities. This happens because the component values follow wave equations that can amplify some values while reducing or zeroing the amplitude of others via interference. Indeed, the goal of quantum computing is to marshal most of the amplitude onto a small set of desired outcomes, so that measurements— that is to say, quantum sampling—will reveal one of them with high probability. All of this indicates the burgeoning complexity of quantum systems. Our original circuit has 5 qubits, 4 nondeterministic gates, and 9 other gates, yet there are 2 = 32 components of the vectors representing states, 32 basic inputs and outputs, and 2 = 16 branchings to consider. Adding the fifth Hadamard gate creates a new fork in every path through the system, giving 32 branchings. The whole circuit C defines a 32× 32 matrix UC in which the I-th row encodes the quantum state ΦI resulting from computation on the standard basis vector x = eI . The matrix is unitary, meaning that UC multiplied by its conjugate transpose U∗ C gives the 32× 32 identity matrix. Indeed, UC is the product of thirteen simpler matrices U` representing the respective gates (` = 1, . . . , s with s = 13). Here each gate engages only a subset of the qubits of arity r < m, so that U` decomposes into its 2 r × 2 unitary gate matrix and the identity action (represented by the 2× 2 identity matrix I) on the other m− r lines. Here are some single-qubit gate matrices: H = 1 √ 2 [ 1 1 1 −1 ]