# Fast Quantum Algorithm for Solving Multivariate Quadratic Equations

In August 2015 the cryptographic world was shaken by a sudden and surprising announcement by the US National Security Agency NSA concerning plans to transition to post-quantum algorithms. Since this announcement post-quantum cryptography has become a topic of primary interest for several standardization bodies. The transition from the currently deployed public-key algorithms to post-quantum algorithms has been found to be challenging in many aspects. In particular the problem of evaluating the quantum-bit security of such post-quantum cryptosystems remains vastly open. Of course this question is of primarily concern in the process of standardizing the post-quantum cryptosystems. In this paper we consider the quantum security of the problem of solving a system of m Boolean multivariate quadratic equations in n variables (); a central problem in post-quantum cryptography. When n=m, under a natural algebraic assumption, we present a Las-Vegas quantum algorithm solving that requires the evaluation of, on average, O(2^0.462n) quantum gates. To our knowledge this is the fastest algorithm for solving .

## Authors

• 1 publication
• 2 publications
• 8 publications
• 3 publications
• 18 publications
• 2 publications
09/02/2018

### Post-Quantum Secure Cryptographic Algorithms

An overview on current developments in post quantum cryptography...
05/04/2021

### Towards security recommendations for public-key infrastructures for production environments in the post-quantum era

Quantum computing technologies pose a significant threat to the currentl...
01/19/2022

### A 334uW 0.158mm^2 Saber Learning with Rounding based Post-Quantum Crypto Accelerator

National Institute of Standard Technology (NIST) is currently runnin...
02/03/2021

### On the Sample Complexity of solving LWE using BKW-Style Algorithms

The Learning with Errors (LWE) problem receives much attention in crypto...
01/23/2018

### Post-Quantum Cryptography: Riemann Primitives and Chrysalis

The Chrysalis project is a proposed method for post-quantum cryptography...
11/20/2018

### PQC: Extended Triple Decomposition Problem (XTDP) Applied To GL(d, Fp)-An Evolved Framework For Canonical Non-Commutative Cryptography

Post-Quantum Cryptography (PQC) attempts to find cryptographic protocols...
09/16/2019

### Identifying Research Challenges in Post Quantum Cryptography Migration and Cryptographic Agility

The implications of sufficiently large quantum computers for widely used...
##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

The goal of this paper is to study the complexity of solving systems of Boolean multivariate quadratic equations (MQ) in the quantum setting. This classical NP-hard problem [22] is stated as follows:

MQ
Input. .
Goal.

Find – if any – a vector

such that:

 f1(z1,…,zn)=0,…,fm(z1,…,zn)=0.

MQ is a fundamental problem with many applications in cryptography, coding theory and beyond. Typically, the security of multivariate schemes is directly related to the hardness of MQ, e.g. [20, 27, 9, 5, 16, 17]. MQ is then central to evaluating the security of such multivariate cryptosystems. Besides multivariate cryptography, the security of a wide variety of cryptosystems is related to MQ, via algebraic cryptanalysis [30]. This includes post-quantum cryptosystems [6] such as code-based cryptography [19, 18], lattice-based cryptography [2, 1],

The status of post-quantum cryptography is currently completely evolving. It is quickly moving from a purely academic theme to a topic of major industrial interest. This is mainly driven by the fact that post-quantum cryptography has recently received much attention from the standardization and policy sectors. The triggering event appears to be the announcement in August by the National Security Agency (NSA) of preliminary plans to transition the existing systems to quantum resistant algorithms:

Currently, Suite B cryptographic algorithms are specified by the National Institute of Standards and Technology (NIST) and are used by NSA

’s Information Assurance Directorate in solutions approved for protecting classified and unclassified National Security Systems (

NSS). Below, we announce preliminary plans for transitioning to quantum resistant algorithms.

This was quickly followed by an announcement by NIST, detailing the transition process [15]. NIST then released in January a call to select standards for post-quantum public-key cryptosystems: public-key exchange, signature and public-key encryption [29]. The threat to see a large computer in a medium term was considered to be sufficient by NIST to organize a renewal of the public-key cryptosystems deployed in practice.

A key issue for the wide adoption of quantum-safe standards in the future is our confidence in their security. There is, therefore, a great need to develop quantum cryptanalysis against post-quantum cryptosystems. It is clear that a challenge in the next years will be to precisely evaluate the quantum-bit security of post-quantum cryptosystems submitted to the NIST standardization process.

We study here how quantum techniques can be used to improve the complexity of solving MQ; an important problem in post-quantum cryptography. In [4], the authors provide a theoretical upper limit on the speed-up that can be obtained in the quantum setting. They demonstrated that – relative to an oracle chosen uniformly at random – a problem in NP can not be decided by any quantum algorithm in . On the other hand, Grover’s algorithm [25] is a quantum algorithm than can decide any problem of NP in ; including MQ. Thus, Grover’s algorithm is essentially optimal in the setting of [4]. We emphasize that this does not rule out the possibility of a greater than quadratic speed-up in the quantum setting. However, it is mandatory to take advantage of the problem structure to achieve this.

In this paper, we present an algorithm that beats the bound for solving MQ. To do so, we combine Grover’s technique with a Gröbner basis-based algorithm.

### 1.1 State of the Art

#### 1.1.1 Classical Setting.

The question of solving MQ has been investigated with various algorithmic techniques in the literature. We list below those techniques with the best asymptotic complexity.

##### Exhaustive search.

The first, most obvious, technique for solving PoSSo is exhaustive search. For , the authors of [10] describe a fast exhaustive search for MQ and provide the exact cost of this approach :

 4log2(n)2n binary operations.

A classical (and challenging) theme for MQ is to design algorithms that are asymptotically faster than exhaustive search, i.e. that beat the barrier.

##### Approximation algorithm.

Recently, the authors of [28] proposed new techniques which solve MQ faster than a direct exhaustive search. The techniques from [28] allows for the approximation of a system by a single, high-degree, multivariate polynomial over variables. The polynomial is constructed such that it vanishes on the same zeroes as the original system

with high probability. We then must perform an exhaustive search on

to recover, with high probability, the zeroes . This leads to an algorithm for solving MQ with complexity

 O∗(20.8765n).

The notation omits polynomial factors.

##### Hybrid approaches.

To date, the best methods for solving MQ are based on Gröbner bases [13, 12]. More precisely, the fastest methods are hybrid techniques which combine exhaustive search and Gröbner bases algorithms [8, 7, 3]. BooleanSolve, an algorithm originally presented in [3], falls into this category and is the asymptotically fastest approach to solving MQ(Section 2.1). When , the deterministic variant of BooleanSolve has complexity bounded by , while a Las-Vegas variant has expected complexity

 O(20.792n).

We emphasize that all stated complexities for BooleanSolve are obtained under the assumption of a natural algebraic hypothesis on the input system. In contrast, the complexities of [10, 28] do not rely on any such assumption.

#### 1.1.2 Quantum Setting.

The hardness of MQ has been directly considered in [31], and somewhat indirectly in [16].

##### Quantum exhaustive search.

In [31], the authors proposed simple quantum algorithms for solving MQ

. The principle is to perform a fast exhaustive search by using Grover’s algorithm. The authors derive precise resource estimates for their algorithms, demonstrating that we can solve

binary quadratic equations in binary variables using qubits and requiring the evaluation of quantum gates. The authors also describe a variant using qubits but with twice as many quantum gates required, when compared to the first approach. In essence, this work constructs a quantum oracle to be used along with amplitude amplification performed by Grover’s algorithm. The oracle is fairly simple and takes advantage of the structure of the MQ problem, developing a straightforward way to evaluate a system of equations on a superposition of all possible boolean variable assignments. Then, Grover’s algorithm is utilized to amplify those inputs which satisfy all provided equations.

##### Quantum hybrid approach.

The main goal of [16] is to construct a multivariate signature scheme based on random instances of MQ and MQ (for field bigger than ). However, in order to derive secure parameters, the authors considered a quantum variant of the hybrid approach from [8, 7] using Grover’s algorithm. They used this approach to explicitly compute the quantum-bit security of random instances of MQ for given parameters. However, the authors of [16]

do not provide the asymptotic complexity of their approach. In this paper, we provide such an asymptotic analysis and build our quantum algorithm on top of

BooleanSolve. It should be mentioned that BooleanSolve is inspired, but different, from [8, 7]. So, the quantum algorithm presented here is different from the one sketched in [16].

### 1.2 Organization of the Paper and Main Results

##### Overview of the results.

The main result of this paper is the fastest known quantum algorithm algorithm for solving MQ (Section 3.1). More precisely:

###### Theorem 1.1 (summarized from Section 4)

There is a quantum algorithm that solves MQ and requires to

• evaluate quantum gates for the deterministic variant,

• evaluate an expected number of quantum gates for the probabilistic variant.

##### Overview of the results.

A natural step towards developing a quantum algorithm for the MQ problem which outperforms quantum exhaustive search via Grover’s algorithm [31] would be the quantization of a classical algorithm for MQ which outperforms classical exhaustive search. A first candidate for such quantization is the approximation algorithm [28] described above. The quantization of such algorithm for use in Grover’s algorithm requires building a quantum circuit. Unfortunately, a basic approach to quantize the approximation algorithm mentioned does not seem to be possible, even for MQ.

Fortunately, we have been able to quantize BooleanSolve using amplitude amplification techniques [25, 11]. Under a natural algebraic assumption the new algorithm beats quantum exhaustive search, i.e. . This is arguably a significant complexity result for a central problem in post-quantum cryptography, but more generally in computer science. The originality of our algorithm is to instantiate Grover’s algorithm with a non-trivial oracle that implements the quantum circuit corresponding essentially to a simplified Gröbner basis computation (Section 3.2). We construct the quantum circuit required to implement the simplified Gröbner basis computation.

##### Cryptographic implications.

The complexity analysis is especially important for selecting parameters in multivariate cryptography. It shows that in order to reach a quantum security level of , one has to consider an instance of MQ with at least variables. In the table below, we provide the minimal number of variables (second column) required to reach a precise security level (first column) The public-key in a multivariate cryptosystem is usually given by set of boolean equations. We report in the last column the minimum size required for a given security level.

quantum sec. level
64 139 167.36 KB
80 173 326,4 KB
128 277 1.33 MB
256 555 10.65 MB

Finally, we mention that in the signature scheme from [16], the authors proposed to use an instance of MQ with variables to achieve a quantum security level of bits. According to our new result, the quantum security is slightly less, i.e. bits.

##### Organisation.

After this introduction, the paper is organized as follows. In Section 2, we first review the two main components of our quantum algorithm : BooleanSolve (Section 2.1) and Grover’s algorithm (Section 2.2). We describe the new quantum algorithm, QuantumBooleanSolve, in Section 3.1. We construct the quantum circuit for a simplified Gröbner basis computation, used as Grover’s oracle, in Section 3.2. Finally, we derive in Section 4 the complexity of our algorithm.

## 2 Preliminaries

In the following we assume familiarity with standard classical and quantum computational notation, such as the standard bra-ket notation for specifying a quantum state. We use the following subsections to overview the classical and quantum algorithms which will be of use in this paper.

### 2.1 Classical BooleanSolve

As explained in the introduction, BooleanSolve [3] is the fastest asymptotic algorithm for MQ. From now on, we will refer to this algorithm as ClassicalBooleanSolve. We will indeed present a quantum version of this algorithm, QuantumlBooleanSolve, in Section 3.

Essentially, ClassicalBooleanSolve first specializes a subset of the variables and then checks the consistency of the specialized system using Macaulay matrices (Definition 1). If the specialized system is found to be consistent, the original algebraic system is determined to have no solution. If the specialized system is inconsistent then the algorithm conducts an exhaustive search on the remaining variables and recovers the solutions for the MQ instance.

We cover the more relevant aspects of the theory behind the algorithm in an effort to keep this paper self contained, and refer the reader to additional preliminary and theoretical information which can be found in the original work [3].

###### Definition 1

Let , and be the square-free part of , i.e. the reduction of modulo . The Boolean Macaulay matrix of degree for a set of polynomials , denoted by , has the following structure: the rows are the coefficients of polynomials where , is a square-free monomial, and the columns are the square free monomials in the polynomial ring of degree at most ordered descendingly with respect to Degree Reverse Lexicographic (DRL) ordering.

We recall below some bounds on boolean Macaulay matrices that will be useful in the complexity analysis.

###### Proposition 1

([3]) Let . Denote by (resp. ) the number of rows (resp. columns, number of nonzero entries) of the associated boolean Macaulay matrix . If <, then

 cMac\textless1−x1−2x(nd),rMac\textlessmx2(1−2x)(1−x)(nd),sMac\textlessmn2x2(1−2x)(1−x)(nd)

where .

ClassicalBooleanSolve [3] is based on a fundamental property of Macaulay matrices. Let and be the corresponding boolean Macaulay matrix in degree . It holds that if the linear system

 u⋅M=(0,0,…,0,1)

has a solution then does not have a solution in . This reduces the problem of deciding the consistency of non-linear equations to the problem of solving a linear system.

We now need to determine which degree of the Macaulay matrix should be considered. This degree is the so-called witness degree defined below:

###### Definition 2

([3]) Let and be the ideal defined by . We set:

 I≤d={p∈F2[x1,…,xn]|p∈I,deg(p)≤d}, J≤d={p∈F2[x1,…,xn]|∃h1,…,hm+n,∀i∈{1,…,m+n},deg(hi)≤d−2, p=m∑i=1hifi+n∑j=1hm+j(x2j−xj)}.

The witness degree for , denoted , is the smallest integer such that

 I≤d0=J≤d0 and ⟨{LM(f)|f∈I≤d0}⟩=LM(I),

where is the leading monomial of the polynomial with respect to DRL ordering.

Alternatively, the witness degree for can be defined as the degree where any polynomial in a (minimal) Gröbner basis of the system is obtained as a linear combination of the rows of the Macaulay matrix in this degree. Therefore, given , the witness degree provides an upper bound on the degree of required to adequately determine the consistency of .

Under some algebraic assumptions, the witness degree can be computed explicitly from the Hilbert series:

 HS(m,n,k)=(1+t)n−k(1−t)(1+t2)m. (1)

The witness degree, denoted by , is given by the index of the first nonzero coefficient of (1).

Now that we have reviewed all necessary background information, we can present the algorithm from [3] for solving MQ.

ClassicalBooleanSolve

Input: with for all .

Output: All boolean solutions to

1:procedure ClassicalBooleanSolve(m,n,k)
2:
3:
4:     for  do
5:         for  do
6:
7:         end for
8:
9:         if  is inconsistent, determined by the SparseLinearSystemSolver then
10:               solutions of the system found by exhaustive search
11:
12:         end if
13:     end for
14:     Return
15:end procedure

There are two variants of ClassicalBooleanSolve : deterministic and Las-Vegas. The only difference is on the algorithm used in SparseLinearSystemSolver, presented in Section  3.2, which can be deterministic or probabilistic. The computational complexity of ClassicalBooleanSolve is lower bounded by the complexity of the consistency check of the Macaulay matrices in degree . Therefore, a complete complexity analysis will merely determine the time required to complete the consistency check in term of the input parameters. This yields:

###### Theorem 2.1

([3]) Let be such that any two matrices [23] can be multiplied in operations in the underlying field. For any , and and sufficiently large , the complexity of all tests of consistency of Macaulay matrices in is:

• in the deterministic variant,

• in the probabilistic variant,

where , with , and

 M(x)=−x+12+12√2x2−10x−1+2(x+2)√x(x+2).

This complexity is obtained by evaluating the cost of checking the consistency of Macaulay matrices.

To derive the asymptotic complexity, we need to assume a certain algebraic condition on the systems considered during the algorithm.

###### Definition 3

Let be quadratic polynomials in and . The system is called -strong semi-regular if both the set of its solutions and the set

 {(an−k+1,…,an)∈Fk2|dwit(F(x1,…,xn−k,an−k+1,…,an))>dwit(m,n,k)}

have cardinality at most , with and as in Theorem 2.1.

Under this assumption, we can now minimize, in term of , the complexities of Theorem 2.1. The results are provided for various values of : which is the upper bound, which is the current best theoretical bound [21], and which requires careful consideration of the linear algebra problem.

###### Lemma 1

Let the notations be as in Theorem 2.1. The function is bounded by:

• , when and ,

• , when and ,

• , when and .

Finally:

###### Theorem 2.2

ClassicalBooleanSolve is correct and solves MQ. If , then the algorithm has complexity , if the system is -strong semi-regular, for the deterministic variant, and of expectation , if the the system is -strong semi-regular, for the Las-Vegas probabilistic variant.

This is essentially the cost of the first step, i.e. testing the Macaulay matrices, since the second step, i.e. exhaustive search, has negligible cost when compared to the consistency check.

### 2.2 Grover’s Algorithm

Grover’s algorithm [25], often called database search, is a quantum algorithm that can be implemented to reduce computation time for the exhaustive search of a function over the entire function domain. The problem solved by Grover’s algorithm is as follows: given a function , determine the unique such that .

Determining such a with a classical computer requires exhaustive search on the entire function domain of . Classical computation techniques cannot do better than evaluating over every possible input, resulting in time complexity of . Grover’s quantum algorithm can determine with merely evaluations of , the quantum circuit which evaluates the function .

Grover’s algorithm can be extended to perform exhaustive search over a function where with , as well as searching over a function where the preimage of has arbitrary size. Here we present a simple version of the algorithm.

In the quantum oracle model, when presented with a quantum oracle for the evaluation of , the problem is to locate an such that . The algorithm utilizes two unitary operations. First, a rotation which flips the sign of the phase of the desired .

 O±f:1√2n∑x∈{0,1}nx→1√2n∑x∈{0,1}n,x≠x∗|x⟩−1√2n|x∗⟩

Second, a diffusion operator which rotates the state around the average amplitude, of ,

 D:∑x∈{0,1}nαx|x⟩→∑x∈{0,1}n(2μ−αx)|x⟩

Successive application of these two oracles performs amplitude amplification on the quantum computer, essentially taking the state of the computer from a uniform superposition over all inputs to a state that, when measured, with high probability will return . To converge to such a final state the oracles and must be applied times.

The algorithm proceeds as follows: begin by using a Hadamard gate, , to prepare the quantum computer in a uniform superposition over all possible inputs, . Following this, apply to the quantum state times. Finally, measure to obtain with high probability. The computational complexity of Grover’s algorithm is where is the complexity of the quantum oracle for .

###### Theorem 2.3 (Amplitude Amplification ([11]))

Let be a quantum algorithm that, with no measurement, produces a superposition . Let be the probability of obtaining, after measurement, a state in the good subspace . Then, there exists a quantum algorithm that calls and as subroutines times and produces an outcome with a probability at least .

The key to successfully performing Grover’s algorithm for the function is to determine the quantum circuit for the function, in order to construct . It is sufficient to provide an oracle that computes the function , i.e. provide a unitary operator in the form of a quantum circuit which calculates , evaluating the function at a superposition of all possible inputs. Then, Grover’s algorithm can be used to amplify the desired output for measurement. What remains is to show that the quantum analog of ClassicalBooleanSolve is reversible and computable on a quantum computer. In the following section, we will construct the quantum circuit for the algorithm ClassicalBooleanSolve and analyze the complexity of the circuit.

### 2.3 Quantum Gates

The following gates are quantum gates of interest which operate on qubits, each directly corresponding to reversible classical gates. For qubits the gates perform the following operations:

• CNOT (XOR, Feynman)

 CNOT|x⟩|y⟩=|x⟩|x+y⟩
• Toffoli (AND)

 T|x⟩|y⟩|z⟩=|x⟩|y⟩|z+xy⟩
• X (NOT)

 X|x⟩=|¯x⟩=|1+x⟩
• n-qubit Toffoli (AND)

 Tn|x1⟩…|xn⟩=|x1⟩…|xn−1⟩|xn+(x1…xn−1)⟩
• Swap

 S|x⟩|y⟩=|y⟩|x⟩

It is important to note that , CNOT and . In terms of computational complexity, X, SWAP and CNOT gates are relatively cheap to compute, while the n-qubit Toffoli gates are more expensive; is equivalent to computing CNOT gates. Accounting for these equivalences can change the reported computational complexity of a given circuit. Additionally, it is important to note that one can emulate a Toffoli gate over using basic gates, in order to determine the additional resources required for any general extension of quantum computations over to quantum computations over .

## 3 A Quantum Version of BooleanSolve

### 3.1 QuantumBooleanSolve

We explain here how to combine the ClassicalBooleanSolve algorithm (Section 2.1) with Grover’s algorithm (Section 2.2). ClassicalBooleanSolve conducts two exhaustive searches over the variables. The first exhaustive search is over the last variables, specializing and projecting to the last components of a solution. The second exhaustive search, when necessary, is on the first variables, and allows the algorithm to determine the entire solution. It is clear that one can utilize Grover’s algorithm, as in [14], to quantize the second exhaustive search and obtain a speed up over the classical complexity. In what follows, will refer to the quantum algorithm [14] that solves MQ. We will see that Grover’s algorithm can be used to speed-up the first exhaustive search as well. Essentially, we will quantize the consistency check on Macaulay matrices by providing a quantum circuit which can be used as the function oracle in Grover’s algorithm.

Let . We consider the function which evaluates on with and returns only if the non-linear system defined below is consistent :

 ~F = (~f1,…,~fm) = (f1(x1,…,xn−k,y1,…,yk),…,fm(x1,…,xn−k,y1,…,yk))∈Fm2[x1,…,xn−k]

This is reduced to check whether the linear system below has a solution:

 u⋅Macaulayd(~F)=(0,0,…,0,1), % for a well chosen d. (2)

In order to quantize ClassicalBooleanSolve, we then proceed in two steps. We first use Grover’s algorithm, along with the quantum circuit which evaluates to determine such that , i.e. is such that the non-linear system below is consistent:

 ~F:=(~f1,…,~fm)=(f1(x1,…,xn−k,a2),…,fm(x1,…,xn−k+1,a2)).

The then corresponds to the variable assignments of the last components in a solution for the system . We can then use Grover’s algorithm, via QuantumSearch on to find the remainder of a complete solution corresponding to .

1:procedure QuantumBooleanSolve(m,n,k)
2:
3:
4:
5:     Return
6:end procedure

The most essential part of determining the advantage of using Grover’s algorithm to improve the computational complexity of ClassicalBooleanSolve is to construct the quantum circuit for . Below, we construct the quantum circuit that solves (2).

### 3.2 Quantum Oracle

QuantumBooleanSolve consists of constructing a quantum oracle for the consistency check of Macaulay matrices, i.e. for . We provide the classical complete sparse linear system solver for classical consistency checks below, as presented by Giesbrecht et al. [24], and then provide an outline of the quantum circuit. Classical algorithm complexity is provided in a black-box model, where we assume access to a black-box for computing matrix-matrix and matrix-vector products. Then, the complexity is given as the number of calls to such black boxes, as well as the number of additional field operations required.

#### 3.2.1 Classical case.

SparseLinearSystemSolver is the classical algorithm employed to determine the consistency of the Macaulay matrices in degree . The algorithm takes as input a matrix , a vector and a subset of the field or a field extension , and outputs either a solution to or a certificate of inconsistency, . This classical algorithm requires evaluations of black box algorithms for matrix-vector multiplications, as well as an additional additional field operations. Subroutines of the SparseLinearSystemSolver can be found below.

SparseLinearSystemSolver

Input: with >

Output: Any of the following return values, as an evaluation of the matrix : (nonsingular, ) where , (singular-consistent, ) with a random element of the solution space, (singular-inconsistent, ) with and , certifying the inconsistency of the system.

1:procedure SparseLinearSystemSolver
2:
3:     if  and  then
4:         Return (nonsingular,)
5:     end if
6:
7:
 U=⎡⎢ ⎢ ⎢ ⎢ ⎢ ⎢⎣1α2α3α4…αn−1αn01α2α3…αn−2αn−1001α2…αn−3αn−270000…01⎤⎥ ⎥ ⎥ ⎥ ⎥ ⎥⎦
8:
 L=⎡⎢ ⎢ ⎢ ⎢ ⎢ ⎢⎣1000…00β2100…00β3β210…007βnβn−1βn−2βn−3…β21⎤⎥ ⎥ ⎥ ⎥ ⎥ ⎥⎦
9:
10:      the minpoly of
11:
12:     if  then
13:         Repeat all steps following the random generation of
14:     end if
15:
16:
17:     if (True,) and  then
18:         Return (singular-inconsistent, )
19:     end if
20:     if (True, )  then
21:         Return (singular-consistent, )
22:     end if
24:end procedure

RandomSol: a subroutine of SparseLinearSystemSolver, intended to return a random element of the solution space to the system . The algorithm is stated to require evaluations of the black-box for matrix-vector product, and additional field operations.

RandomSol

Input: with , and with >

Output: One of the following two return values: (False) indicating no solution, (True, ) with a random solution to the system .

1:procedure RandomSol
2:      with
3:
4:     , the first entries of the calculated vector
5:     , the leading submatrix of
6:
7:     if  then
8:         Return (True, )
9:     end if
10:     Return (False)
11:end procedure

Wiedemann: a subroutine of SparseLinearSystemSolver. The deterministic version of the Wiedemann algorithm is presented below, as seen in [32].

Wiedemann

Input: , ,

Output: One of the following two return values: such that and or , a factor of .

1:procedure Wiedemann
2:
3:     for i = 0 …2n-1 do
4:
5:     end for
6:
7:
8:     while  < and < do
9:
10:
11:
12:          using the Berlekamp-Massey algorithm
13:
14:
15:     end while
16:     Return
17:end procedure

From the presentation of the classical algorithm SparseLinearSystemSolver, and the subroutines, it is clear that the significant operations performed classically are matrix multiplication and vector-matrix products. The complexity analysis for such operations is given in a black-box model. Therefore, it is sufficient to show that these operations can be executed (in comparable time) by a quantum circuit on a quantum computer, in order to construct a quantum oracle for matrix consistency checking.

#### 3.2.2 Quantum case.

As the basic operations implemented by the classical consistency check are linear algebra on matrices, it is important to verify that this linear algebra can be computed on a superposition of inputs via a quantum circuit. We must check that a reversible unitary operation can compute the required algebraic computations on a quantum computer, with comparable computational complexity to their classical analogs.

##### Equality Testing.

Binary equality testing, i.e. checking if , can be computed via one CNOT and one X gate, as follows: .

##### Matrix Vector Multiplication.

The formula for matrix vector multiplication calculates each element of the product vector . To compute each we require at most products between the elements of and of . Therefore, the matrix-vector product requires at most products. It remains to show that the computation is reversible.

Figure 1 shows a reversible circuit for computing the inner product between two vectors. This is simply done by replacing the products by Toffoli gates. This quantum circuit is also itself reversible; applying the circuit twice leads to identity. In total, the inner product of two -bit vectors can be computed, on a superposition of inputs, using Toffoli gates. Therefore, the computation of such a matrix vector multiplication requires at most Toffoli gates.

##### Matrix Multiplication.

In the same fashion it is possible to compute matrix products in the quantum setting. Each column of the matrix can be computed using matrix vector multiplication, which, in turn, can be implemented using Toffoli gates. In total, a reversible quantum circuit for computing matrix multiplication on a superposition of inputs requires at most Toffoli gates, for square matrices.

Utilizing this quantum circuit for inner product between two vectors the quantum oracle for consistency checking can be constructed. Despite the fact that this naive quantum matrix multiplication is computed in , time greater than where is the current classical complexity of matrix multiplication with the Coppersmith-Winograd algorithm, quantizing this computation will result in a lower quantum computational time for the classical MQ problem. ClassicalBooleanSolve, as well as SparseLinearSystemSolver and the provided subroutines are analyzed in the black box model, where matrix multiplication such as for a vector and a matrix are given by black boxes. We have provided the above construction to assure that such computations can be carried out by a quantum computer, reversibly and without entanglement concerns.

## 4 Complexity Analysis

We can now study the complexity of QuantumBooleanSolve (Section 3.1). This analysis consists of constructing the quantum oracle implementing , which on input specializes the polynomial system and indicates the consistency of the associated Macaulay matrix of appropriate degree. This can be done by analyzing SparseLinearSystemSolver and any associated subroutines separately, either illustrating the equivalence between the complexity of the classical function and the quantum circuit or proving that the quantum circuit is more efficient.

For example, the quantization of the subroutine RandomSol would consist of constructing a quantum circuit . RandomSol takes as input a matrix , a vector , a polynomial with (and , which is in the case of MQ a field extention of . We would build

 QRS:|a11⟩…|ann⟩|f[0]−1⟩|f[1]⟩…|f[n]⟩|r⟩|w1⟩…|wn⟩|b1⟩…|bn⟩|0⟩…|0⟩→ |a11⟩…|ann⟩|f[0]−1⟩|f[1]⟩…|f[n]⟩|r⟩|w1⟩…|wn⟩|b1⟩…|bn⟩|0⟩…|0⟩|b′1⟩…|b′r⟩|x1⟩…|xn⟩|sA⟩

This quantum circuit takes as input the elements of the matrix , the coefficients of the function , the elements of the random vector , , and the elements of the vector , as well as wires for computation space, and returns , , a boolean which takes the value of 1 if and 0 otherwise, along with the input for reversibility.

###### Theorem 4.1

The quantum circuit

 QRS:|A⟩|f⟩|w⟩|r⟩|b⟩|0⟩…|0⟩→|A⟩|f⟩|w⟩|r⟩|b⟩|0⟩…|0⟩|b′⟩|x⟩|sA⟩

implementing RandomSol requires quantum gates to compute. In the black-box model, when provided with an oracle to compute matrix-vector and matrix-matrix products, requires evaluations of the black box, and operations in the base field , which is equivalent to the classical complexity of RandomSol.

A proof of the above theorem is fairly straightforward when directly analyzing a quantum analogue of the classical algorithm provided above for RandomSol. It is clear that steps 4, 6, and 7 of RandomSol are the only steps computed by the quantum circuit. Firstly, step 4 consists of the computation of , the first entries of the vector . This is merely matrix-vector multiplication and vector-vector addition; we compute the entries of with T gates for multiplication and CNOT gates for addition, totaling quantum gates. In the black box model, we have 1 oracle query for matrix-vector multiplication and field operations for addition of two vectors. Secondly, step 6 consists of computing for the matrix-vector product with T gates, followed by the computation of via one T-gate, and computing the th term of the sum with an additional T gate. This is quantum gates to compute when we consider the additional NOT gate at the end of the computation. In the black box model, we have black box matrix-vector product queries and field operations for the sum. Finally, the equality test conducted in step 7 consists of computing the matrix-vector product with T gates, followed by CNOT gates to compute, element by element, , and then one gate to compute the value . In the black box model, this is 1 call to the matrix-vector product oracle. Therefore, we have established the equivalence of the classical complexity of the subroutine RandomSol with the quantum oracle implementing the function in the black-box model.

Similar arguments demonstrate the equivalence of SparseLinearSystemSolver as well as the entire quantum circuit . Due to the equivalence of the classical and quantum consistency checks in the black-box model, it is straightforward to adapt Theorem 2.1 to QuantumBooleanSolve, as follows.

###### Theorem 4.2

Let is such that any two matrices can be multiplied in operations in the underlying field. For any , and and sufficiently large , testing the consistency of all Macaulay matrices in requires the:

• evaluation of quantum gates in the deterministic variant;

• evaluation, on average, quantum gates in the probabilistic variant,

where , with and