Skip to main content
Log in

From the sum-of-squares representation of a Boolean function to an optimal exact quantum query algorithm

  • Published:
Quantum Information Processing Aims and scope Submit manuscript

Abstract

In quantum computation, designing an optimal exact quantum query algorithm (i.e., a quantum decision tree algorithm) for any small input Boolean function is a fundamental and abstract problem. As we are aware, there is not a general method for this problem. Due to the fact that every Boolean function can be represented by a sum-of-squares of some multilinear polynomials, in this paper a primary algorithm framework is proposed with three basic steps: The first basic step is to find sum-of-squares representations of the Boolean function and its negation function; the second basic step is to construct a state which is assumed to be the final state of an optimal exact quantum query algorithm; the third basic step is to find each unitary operator in the undetermined algorithm. However, there still exist some intractable problems such that the algorithm framework may not be feasible in some cases, but it can be used to investigate the quantum query model with low complexity, such as Deutsch’s problem, a five-bit symmetric Boolean function and the characterization of Boolean functions with exact quantum 2-query complexity.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Deutsch, D.: Quantum theory, the Church–Turing principle and the universal quantum computer. Proc. R. Soc. Lond. Ser. A 400, 97 (1985)

    Article  ADS  MathSciNet  Google Scholar 

  2. Deutsch, D., Jozsa, R.: Rapid solution of problems by quantum computation. Proc. R. Soc. Lond. Ser. A 439, 553 (1992)

    Article  ADS  MathSciNet  Google Scholar 

  3. Shor, P. W.: Algorithms for quantum computation: discrete logarithms and factoring. In: Proceedings of Annual Symposium on the Foundations of Computer Science. IEEE Computer Society Press, Los Alamitos, CA, pp. 124–134 (1994)

  4. Grover, L. K.: A fast quantum mechanical algorithm for database search. In: Proceedings of the Twenty-Eighth Annual ACM Symposium on Theory of Computing. ACM, New York, p. 212 (1996)

  5. Harrow, A.W., Hassidim, A., Lloyd, S.: Quantum algorithm for linear systems of equations. Phys. Rev. Lett. 103, 150502 (2009)

    Article  ADS  MathSciNet  Google Scholar 

  6. Jordan, S.: The quantum algorithm zoo. Available at http://math.nist.gov/quantum/zoo/

  7. Barnum, H., Saks, M., Szegedy, M.: Quantum query complexity and semi-definite programming. In: IEEE Conference on Computational Complexity (2003)

  8. Grillo, S.A., Marquezino, F.L.: Quantum query as a state decomposition. Theor. Comput. Sci. 736, 62–75 (2018)

    Article  MathSciNet  Google Scholar 

  9. Arunachalam, S., Briët, J., Palazuelos, C.: Quantum query algorithms are completely bounded forms. (2017). arXiv preprint arXiv:1711.07285

  10. Nielson, M.A., Chuang, I.L.: Quantum Computation and Quantum Information. Cambridge University Press, Cambridge (2000)

    Google Scholar 

  11. Buhrman, H., de Wolf, R.: Complexity measures and decision tree complexity: a survey. Theor. Comput. Sci. 288, 21–43 (2002)

    Article  MathSciNet  Google Scholar 

  12. Beals, R., Buhrman, H., Cleve, R., Mosca, M., de Wolf, R.: Quantum lower bounds by polynomials. J. ACM 48, 4 (2001)

    Article  MathSciNet  Google Scholar 

  13. Ambainis, A.: Quantum lower bounds by quantum arguments. J. Comput. Syst. Sci. 64(4), 750–767 (2002)

    Article  MathSciNet  Google Scholar 

  14. Ambainis, A., Iraids, J., Smotrovs, J.: Exact quantum query complexity of EXACT and THRESHOLD (2013). arXiv:1302.1235

  15. Montanaro, A., Jozsa, R., Mitchison, G.: On exact quantum query complexity. Algorithmica 71, 4 (2015)

    Article  MathSciNet  Google Scholar 

  16. Ambainis, A., Iraids, J., Nagaj, D.: Exact Quantum Query Complexity of \({\rm EXACT}^{n}_{k,l}\). Lecture Notes in Computer Science, vol. 10139. Springer, Cham (2017)

    MATH  Google Scholar 

  17. Qiu, D.W., Zheng, S.G.: Generalized Deutsch–Jozsa problem and the optimal quantum algorithm. Phys. Rev. A 97, 062331 (2018)

    Article  ADS  Google Scholar 

  18. He, X. Y., Sun, X. M.,Yang, G., Pei, Y.: Exact quantum query complexity of weight decision problems (2018). arXiv:1801.05717

  19. Gangopadhyay, S., Behera, B. K., Panigrahi, P. K.: Generalization and partial demonstration of an entanglement based Deutsch–Jozsa like algorithm using a 5-Qubit quantum computer (2017). arXiv:1708.06375v1

  20. Huang, H.L., Ashutosh, K.G., Bao, W.S., Prasanta, K.P.: Demonstration of the essentiality of entanglement in a Deutsch-like quantum algorithm. arXiv:1706.09489

  21. Wong, T.G., Ambainis, A.: Quantum search with multiple walk steps per oracle query. Phys. Rev. A 92, 022338 (2015)

    Article  ADS  Google Scholar 

  22. Tulsi, A.: Postprocessing can speed up general quantum search algorithms. Phys. Rev. A 92, 022353 (2015)

    Article  ADS  Google Scholar 

  23. Childs, A.M., Landahl, A.J., Parrilo, P.A.: Quantum algorithms for the ordered search problem via semidefinite programming. Phys. Rev. A 75, 032335 (2006)

    Article  ADS  Google Scholar 

  24. Høyer, P., Ŝpalek, R.: Lower bounds on quantum query complexity. Bull. Eur. Assoc. Theor. Comput. Sci. 87, 78–103 (2005)

    MathSciNet  MATH  Google Scholar 

  25. Kaniewski, J., Lee, T., de Wolf, R.: Query Complexity in Expectation. Lecture Notes in Computer Science, vol. 9174. Springer, Berlin (2015)

    MATH  Google Scholar 

  26. Lee, T., Prakash, A., de Wolf, R., Yuen, H.: On the sum-of-squares degree of symmetric quadratic functions. In: Conference on Computational Complexity (2016)

  27. Victoria, P., Wörmann, T.: An algorithm for sums of squares of real polynomials. J. Pure. Appl. Algebra 127, 1 (1998)

    Article  MathSciNet  Google Scholar 

  28. Lasserre, J.B.: A sum of squares approximation of nonnegative polynomials. SIAM J. Optim. 16, 3 (2006)

    Article  MathSciNet  Google Scholar 

  29. Lasserre, J. B.: Conditions for a real polynomial to be sum of squares. (2006). arXiv:math/0612358v1

  30. Papachristodoulou, A., Anderson, J., Valmorbida, G., Prajna, S., Seiler, P., Parrilo, P.: SOSTOOLS version 3.00 sum of squares optimization toolbox for MATLAB. preprint (2013). arXiv:1310.4716

  31. Grigoriy, B., João, G., James, P.: Sums of squares on the hypercube. Math. Z. 284, 1–2 (2016)

    Article  MathSciNet  Google Scholar 

  32. de Wolf, R.: Nondeterministic quantum query and communication complexitiess. SIAM J. Comput. 32(3), 681–699 (2003)

    Article  MathSciNet  Google Scholar 

  33. Nisan, N., Szegedy, M.: On the degree of Boolean functions as real polynomials. Comput. Complex. 4(4), 301–313 (1994)

    Article  MathSciNet  Google Scholar 

  34. Simon, H.U.: A tight omega(\(\log \log \) n)-Bound on the Time for Parallel RAMs to Compute nondegenerated Boolean Functions. Lecture Notes in Computer Science, vol. 158. Springer, Berlin (1983)

    MATH  Google Scholar 

  35. Aaronson, S., Ambainis, A., Iraids, J., Kokainis, M., Smotrovs, J.: Polynomials, quantum query complexity, and Grothendieck’s inequality. In: Proceedings of 31st Conference on Computational Complexity (CCC), Tokyo, Japan (2016)

  36. Ambainis, A.: Understanding quantum algorithms via query complexity (2017). arXiv:1712.06349

  37. Qiu, D.W. , Zheng, S.G.: Characterizations of symmetrically partial Boolean functions with exact quantum query complexity (2016). arXiv:1603.06505

  38. Qiu, D.W., Zheng, S.G.: Revisiting Deutsch–Jozsa Algorithm. Information and Computation 275, 104605 (2020)

    Article  MathSciNet  Google Scholar 

Download references

Acknowledgements

The authors would like to thank the anonymous referees for important suggestions that help us improve the quality of the manuscript. This work is supported in part by the National Natural Science Foundation of China (Nos. 61876195, 61572532), and the Natural Science Foundation of Guangdong Province of China (No. 2017B030311011).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Daowen Qiu.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendices

Proof of Lemma 1

Proof

On the one hand, according to Lemma 7 in Ref. [11], the final state of an exact quantum query algorithm is in the form \(\sum _{j}\alpha _{j}(x)|j\rangle \) where \(\alpha _{j}(x)\) is a complex-valued n-variate multilinear polynomials. According to the discussions of Theorem 17 in Ref. [11], the acceptance probability of the set of basis states corresponding to 1-outputs is

$$\begin{aligned} \sum _{j:\text {Output}~1}|\alpha _{j}(x)|^{2}=f(x)~\text {for all}~x\in \{0,1\}^{n}. \end{aligned}$$
(117)

Equation (117) is an SOS complex representation of the Boolean function f(x). Correspondingly, the acceptance probability of the set of basis states corresponding to 0-outputs is

$$\begin{aligned} \sum _{j:\text {Output}~~0}|\alpha _{j}(x)|^{2}=1-f(x)~\text {for all}~x\in \{0,1\}^{n}. \end{aligned}$$
(118)

Equation (118) is an SOS complex representation of the Boolean function \(1-f(x)\).

On the other hand, assume that the SOS of amplitudes

$$\begin{aligned} \sum _{j\le i}|\alpha _{j}(x)|^{2}=f(x),x\in \{0,1\}^{n} \end{aligned}$$
(119)

of base \(\{|0\rangle ,|1\rangle ,\ldots ,|i\rangle \}\) which is a subset of the computational base \(\{|0\rangle ,|1\rangle ,\ldots ,|n'-1\rangle \}\), then let the quantum query algorithm output 1 when the measurement outcome is in the set \(\{|0\rangle ,|1\rangle ,\ldots ,|i\rangle \}\) and 0 when the measurement outcome is not in the set \(\{|0\rangle ,|1\rangle ,\ldots ,|i\rangle \}\). That is, the algorithm always outputs 1 when \(f(x)=1\) and always outputs 0 when \(f(x)=0\). Thus, this algorithm computes f exactly. The lemma has been proved. \(\square \)

Remark 5

In fact, for small Boolean functions \(\text {EXACT}_{1,2}^{3}(x)\) and \(\text {EXACT}_{2,3}^{5}(x)\), the proof of the lower bounds in Ref. [15] is numerical. For the lower bound \(k+1\) of the Boolean function \(\text {EXACT}_{k, k+1}^{2k+1}(x)\) (including \(\text {EXACT}_{1,2}^{3}(x)\) and \(\text {EXACT}_{2,3}^{5}(x)\)), the proof in Ref. [16] is quite complex. And, this motivates us to apply the algorithm framework to the small quantum query model.

First, we take an example of Definition 4 in the following lemma.

Lemma 2

For \(f(x)=\text {EXACT}_{1,2}^{3}(x),\) matrices \(G_{f}(1,0),~G_{f}(1,1),~G_{f}(2,0),~\text {and}~G_{f}(2,1)\) are the row or column full rank.

Proof

According to Definition 4,

(120)

Now, we list \(G_{f}(1,0),G_{f}(1,1), G_{f}(2,0),\) and \(G_{f}(2,1)\), respectively.

(121)

It is easy to verify that these matrices are the row or column full rank. Thus, the lemma has been proved. \(\square \)

Inspired by the result in Lemma 2, we get the following theorem.

Theorem 5

For every n-bit Boolean function \(f(x): \{0,1\}^{n}\rightarrow \{0,1\}\) depending on n bits and \(m<n\), if

$$\begin{aligned} \exists b\in \{0,1\},~\text {s.t.}~ \text {rank}(G_{f}(m,b))=\sum ^{m}_{i=0}\left( {\begin{array}{c}n\\ i\end{array}}\right) , \end{aligned}$$
(122)

then

$$\begin{aligned} Q_{E}(f)=Q_{E}(1-f) \ge \max \{\deg _{\mathrm{sos}}(f), \deg _{\mathrm{sos}}(1-f)\} \ge m+1. \end{aligned}$$
(123)

Proof

As we know, if there exists an exact quantum query algorithm computing f, then this algorithm can also be used to compute \(1-f\). Thus, \(Q_{E}(f)=Q_{E}(1-f).\)

According to Lemma 7 and Theorem 17 in Ref. [11], and Lemma 1 in this paper, an exact quantum query algorithm computing f produces a pair of SOS representations of f and \(1-f\). Then, the first inequality \(Q_{E}(f)\ge \max \{\deg _{\mathrm{sos}}(f), \deg _{\mathrm{sos}}(1-f)\}\) always holds.

According to Theorem 1, if there exists no a vector set \(\{\ldots , |\alpha _{p_{i}}\rangle , \ldots \}\) such that

$$\begin{aligned} f(x)=\sum _{i}|\langle \alpha _{p_{i}}|P(x)\rangle _{m}|^{2}, \forall x\in \{0,1\}^{n}, \end{aligned}$$
(124)

then there exists no a degree-m SOS representation of the Boolean function which implies that the second inequality \(\max \{\deg _{\mathrm{sos}}(f), \deg _{\mathrm{sos}}(1-f)\}\ge m+1\) holds. From discussions in Sect. 3, we know that all undetermined vectors \(|\alpha _{p_{i}}\rangle \) \((i=1,2,\ldots )\) can be represented by the fundamental set of solutions \(\{\ldots ,|Y_{k}\rangle ,\ldots \}\). According to Eq. (34), the equation

$$\begin{aligned} \text {rank}(G_{f}(m,0)){=}\sum ^{m}_{i=0}\left( {\begin{array}{c}n\\ i\end{array}}\right) \end{aligned}$$
(125)

implies that the cardinality of the set \(\{\ldots ,|Y_{k}\rangle ,\ldots \}\) is 0 and \(|\alpha _{p_{i}}\rangle {=}\overrightarrow{0}\) \((i=1,2,\ldots )\). Thus, there exists no a degree-m SOS representation of f and \(\deg _{\mathrm{sos}}(f)\ge m+1\). Similarly, the equation

$$\begin{aligned} \text {rank}(G_{f}(m,1)){=}\sum ^{m}_{i=0}\left( {\begin{array}{c}n\\ i\end{array}}\right) \end{aligned}$$
(126)

implies that \(\deg _{\mathrm{sos}}(1-f)\ge m+1\). As a result, Eq. (122) implies that the second inequality holds. The proof is completed. \(\square \)

Example 2

Take the two-bit Boolean function \(f(x)=x_{1}x_{2}\) where \(x_{1},x_{2}\in \{0,1\}\) as an example. Obviously, \(\deg (f)=2\). Since

$$\begin{aligned} \begin{aligned}&\text {rank}(G_{f}(1,0)) =\text {dim}(\{|P(x)\rangle _{1}|f(x)=0\})\\&\quad =\text {dim}(\{(1,0,0)^{T},(1,0,1)^{T},(1,1,0)^{T}\}) =3=\sum ^{1}_{i=0}\left( {\begin{array}{c}2\\ i\end{array}}\right) . \end{aligned} \end{aligned}$$
(127)

This implies that

$$\begin{aligned} \deg _{\mathrm{sos}}(f)=2>1=\frac{1}{2}\deg (f) \end{aligned}$$
(128)

and

$$\begin{aligned} Q_{E}(f)=2=\max \{\deg _{\mathrm{sos}}(f),\deg _{\mathrm{sos}}(1-f)\}. \end{aligned}$$
(129)

Similarly, query complexities of two-bit Boolean functions \(f(x)=(1-x_{1})(1-x_{2}),f(x)=(1-x_{1})x_{2}\) and \(f(x)=x_{1}(1-x_{2})\) are also 2. This is a new proof style of the quantum query complexity. Example 2 is finished.\(\square \)

A transformation technique of Eq. (38)

This section introduces a transformation technique which may be used to simplify Eq. (38) (i.e., \(f(x)=\sum _{i}\mid \sum _{k}\rho _{k,i}\langle Y_{k}|P(x)\rangle _{m}\mid ^{2}=1\)).

First, if there exists a matrix \(\overrightarrow{\rho }\) whose entries satisfy Eq. (38), then there must exist a matrix

(130)

where

$$\begin{aligned} c_{x,i}=\sum _{k}\rho _{k,i}\langle Y_{k}|P(x)\rangle _{m} \end{aligned}$$
(131)

and

$$\begin{aligned} \sum _{i}c^{2}_{x,i}=1 \end{aligned}$$
(132)

for all \(x\in \{x|f(x)=1\}\). Thus, Eq. (38) can be written as

$$\begin{aligned} G^{T}_{f}(m,1)[\ldots ,|Y_{k}\rangle ,\ldots ]\overrightarrow{\rho }=H(c). \end{aligned}$$
(133)

Here, the number of rows in the matrix H(c) is \(|\{x|f(x)=1\}|\).

Then, assume that there exists a matrix H(c) satisfying Eq. (132). Using the left-multiplication a proper invertible matrix

$$\begin{aligned} M=\left[ \begin{array}{cc} M_{0}\\ M_{1} \end{array} \right] \end{aligned}$$
(134)

on Eq. (133), the augmented matrix

$$\begin{aligned} \left[ G^{T}_{f}(m,1)[\ldots ,|Y_{k}\rangle ,\ldots ], H(c) \right] \end{aligned}$$
(135)

can be transformed into the form:

$$\begin{aligned} \left[ \begin{array}{cc} A&{} H_{1}(c) \\ O&{} H_{2}(c) \end{array} \right] . \end{aligned}$$
(136)

Here, the matrix A is a row full-rank matrix, the matrix O is a zero-matrix, and

$$\begin{aligned} \left[ \begin{array}{cc} H_{1}(c) \\ H_{2}(c) \end{array} \right] =\left[ \begin{array}{cc} M_{0}\\ M_{1} \end{array} \right] H(c) \end{aligned}$$
(137)

satisfying

$$\begin{aligned} M_{0}H(c)=H_{1}(c)~\text {and}~M_{1}H(c)=H_{2}(c). \end{aligned}$$
(138)

Thus, if we get a solution of the equation

$$\begin{aligned} M_{1}H(c)=O~\text {and}~\sum _{i}c^{2}_{x,i}=1, \end{aligned}$$
(139)

then the solution space of the equation

$$\begin{aligned} A\overrightarrow{\rho }=H_{1}(c) \end{aligned}$$
(140)

is not empty, as the matrix A is a row full-rank matrix.

For \(M_{1}H(c)=O\), we can get a fundamental set of exact solutions \(\{\ldots ,|W_{k}\rangle ,\ldots \}\) (the cardinality of the set \(\{\ldots ,|W_{k}\rangle ,\ldots \}\) is \(\text {rank}(G^{T}_{f}(m,1)[\ldots ,|Y_{k}\rangle ,\ldots ])\)) of the equation set \(M_{1}\overrightarrow{x}=\overrightarrow{0}\). Then, we aim to find a matrix P such that \(H(c)=[\ldots ,|W_{k}\rangle ,\ldots ]P\) and \(\sum _{i}c^{2}_{x,i}=1\) for all \(x\in \{x|f(x)=1\}\). Note that the number of rows in the undetermined matrix P is \(\text {rank}(G^{T}_{f}(m,1)[\ldots ,|Y_{k}\rangle ,\ldots ])\) which is not bigger than the number of rows in the matrix \(\overrightarrow{\rho }\). Meanwhile, all numbers of columns in these matrices are the same. As a result, solving Eq. (139) seems simpler than solving Eq. (38) directly.

Finally, how to find an exact general solution of Eq. (139) is still a difficult problem. In practical applications, if a Boolean function f depends on short inputs, then it is reasonable to assume that things could be done exactly. Furthermore, how do we determine a proper cardinality of the vector set \(\{|\alpha _{p_{1}}\rangle , |\alpha _{p_{2}}\rangle , \ldots , |\alpha _{p_{l}}\rangle \}\)? When we face a certain task, this should also be considered.

An application of Algorithm 3.2

This section applies Algorithm 3.2 to the Boolean function \(\text {EXACT}_{2,3}^{5}(x)\) in the following corollary that is a sub-case of the important theorem \(Q_{E}(\text {EXACT}_{k, k+1}^{2k+1}(x))\ge k+1\) in Ref. [16]. Note that Corollary 1 cannot be got by Theorem 5 and is an interesting application of Algorithm 3.2. Based on this, Algorithm 3.2 can be regarded as a general method for more similar tasks.

Corollary 1

Reprove \(Q_{E}(\text {EXACT}_{2,3}^{5}(x))\ge 3\) using Algorithm 3.2.

Proof

For \(f(x)=\text {EXACT}_{2,3}^{5}(x)\),

(141)

and

(142)

For \(G_{f}(2,1)\),

$$\begin{aligned} Y_{1}{=}(3,-2,-2,-2,-2,-2,1,1,1,1,1,1,1,1,1,1)^{T} \end{aligned}$$
(143)

and

$$\begin{aligned}{}[G_{f}(2,0)]^{T}Y_{1}=(3,1,1,1,1,1,1,1,1,1,1,3)^{T}. \end{aligned}$$
(144)

Here, since \([G_{f}(2,0)]^{T}Y_{1}\) is a column vector, \(\rho _{1}\) can be set to a row vector. Thus,

(145)

Since the Euclidean norm of all rows \(||3\rho _{1}||{=}||\rho _{1}||{=}1\) forces an empty solution space, the proof is completed. \(\square \)

Furthermore, using the method of symmetrization in Ref. [11], we have

$$\begin{aligned} \text {EXACT}_{2,3}^{5}(x)=\left( {\begin{array}{c}|x|\\ 2\end{array}}\right) -2\left( {\begin{array}{c}|x|\\ 3\end{array}}\right) +2\left( {\begin{array}{c}|x|\\ 4\end{array}}\right) \end{aligned}$$
(146)

which implies that \(\deg (\text {EXACT}_{2,3}^{5}(x))=4\). Also, using Theorem 17 (i.e., the inequality \(\deg (f)\le 2Q_{E}(f)\)) of Ref. [11], we have \(Q_{E}(\text {EXACT}_{2,3}^{5}(x))\ge 2\). By these arguments, we cannot get the lower bound 3 in Ref. [16]. By Theorem 5 and the method of symmetrization, we can know that the small function \(\text {EXACT}_{1,2}^{3}(x)\) in Lemma 2 is also in this case.

Furthermore, the important theorem \(Q_{E}(\text {EXACT}_{k, k+1}^{2k+1}(x))\ge k+1\) in Ref. [16] is proved using a quite complex result. For the sub-case \(Q_{E}(\text {EXACT}_{2,3}^{5}(x))\ge 3\), we remark that the proof of Corollary 1 is simple and a new proof style. Meanwhile, the sub-case provides an important evidence for the inequality \(\deg _{\mathrm{sos}}(f)\ge \frac{\deg (f)}{2}\) which implies that the SOS degree is a tighter lower bound of the exact quantum query complexity than a half of the polynomial degree. In contrast, Ref. [26] noted that the degree of the polynomial representing a non-negative function actually is twice the SOS degree.

Some results on Theorem 2

This section tells us how to use Theorem 2 in the algorithm framework. And, a similar discussion can also be used to analyze Theorems 3 and 4.

In order to clear the unitary operator \(U^{-1}_{t}\) in an undetermined quantum query algorithm, we define some vector spaces and corresponding matrices using the notation in Definition 5. Based on Theorem 2, basic vectors in these spaces and matrices are extracted from the representation matrix of the state \(U_{t}O_{x}U_{t-1}\ldots U_{0}|\psi _{0}\rangle \).

Definition 6

For the representation matrix of a quantum state

$$\begin{aligned} U_{t}O_{x}U_{t-1}\ldots U_{0}|\psi _{0}\rangle =\sum _{j}\left( \sum _{S}\alpha ^{S}_{j,t}(-1)^{S\cdot x}\right) |j\rangle \end{aligned}$$
(147)

in a quantum query algorithm, the vector space

$$\begin{aligned} L=L(\{|\alpha _{S,t}\rangle ||S|\in \{m-1,m\}\}) \end{aligned}$$
(148)

denotes a linear space which contains all linear combinations of vectors in the set

$$\begin{aligned} \{|\alpha _{S,t}\rangle ||S|\in \{m-1,m\}\}, \end{aligned}$$
(149)

and the matrix

$$\begin{aligned} L'=[\ldots ,|\alpha _{S,t}\rangle ,\ldots ]_{|S|\in \{m-1,m\}} \end{aligned}$$
(150)

consists of all column vectors in the same set \(\{|\alpha _{S,t}\rangle ||S|\in \{m-1,m\}\}\). Similarly, the vector space

$$\begin{aligned} L_{0}=L(\{|\alpha _{S,t}\rangle ||S|=m\}), \end{aligned}$$
(151)

and the matrix

$$\begin{aligned} L'_{0}=[\ldots ,|\alpha _{S,t}\rangle ,\ldots ]_{|S|=m}. \end{aligned}$$
(152)

For \(i\in \{1,\ldots ,n\},\) the vector space

$$\begin{aligned} L_{i}{=}L(\{|\alpha _{S,t}\rangle |S\not \supseteq \{i\},|S|\in \{m{-}1,m\}\}), \end{aligned}$$
(153)

and the matrix

$$\begin{aligned} L'_{i}{=}[\ldots ,|\alpha _{S,t}\rangle ,\ldots ]_{S\not \supseteq \{i\},|S|\in \{m{-}1,m\}}. \end{aligned}$$
(154)

\(\square \)

We can get the following basic facts of these notations.

  1. 1.

    As we know, the dimension of the vector space is the number of basis vectors in the space, as well as the rank of the matrix is equal to the number of basis vectors in all columns. Since \(L_{i}\subseteq L\), the vector space \(L_{i}=L\) if and only if \(\text {rank}(L'_{i})=\text {rank}(L')\). Considering the definition of every notation, we know that \(\text {dim}(L)=\text {rank}(L')\) and \(\text {dim}(L_{i})=\text {rank}(L'_{i})\) \((i\in \{0,1,\ldots ,n\})\).

  2. 2.

    By Definition 6, the number of columns in the matrix \(L'\) is the cardinality of the set S satisfying \(|S|\in \{m{-}1,m\}\). Thus, the number of columns in the matrix \(L'\) is \(\left( {\begin{array}{c}n\\ m\end{array}}\right) +\left( {\begin{array}{c}n\\ m-1\end{array}}\right) =\left( {\begin{array}{c}n+1\\ m\end{array}}\right) ,\) the number of columns in the matrix \(L'_{0}\) is \(\left( {\begin{array}{c}n\\ m\end{array}}\right) \), and the number of columns in the matrix \(L'_{i}\) \((i\in \{1,\ldots ,n\})\) is \(\left( {\begin{array}{c}n-1\\ m-1\end{array}}\right) +\left( {\begin{array}{c}n-1\\ m-2\end{array}}\right) =\left( {\begin{array}{c}n\\ m-1\end{array}}\right) .\)

Applying Definition 6 to Theorem 2, we can get the following theorem. For a final state (i.e., an output of the second basic step in the framework) in hand, this result provides a necessary condition of the case that the degree can be dropped.

Theorem 6

For the representation matrix of a quantum state

$$\begin{aligned} U_{t}O_{x}U_{t-1}\ldots U_{0}|\psi _{0}\rangle =\sum _{j}\left( \sum _{S}\alpha ^{S}_{j,t}(-1)^{S\cdot x}\right) |j\rangle \end{aligned}$$
(155)

in a quantum query algorithm, if the degree

$$\begin{aligned} m=\max \{|S||\alpha ^{S}_{j,t}\ne 0\} \end{aligned}$$
(156)

is dropped after applying a query operator \(O^{\dag }_{x}\) to the state \(O_{x}U_{t-1}\ldots U_{0}|\psi _{0}\rangle \), then there exists an orthonormal base \(\{|\zeta _{0}\rangle , |\zeta _{1}\rangle , \ldots , |\zeta _{n'-1}\rangle \}\) such that

$$\begin{aligned} \forall j\in \{0,1,\ldots ,n'-1\},\exists i\in \{0,1,\ldots ,n\}, s.t.~|\zeta _{j}\rangle \in L^{\bot }_{i}. \end{aligned}$$
(157)

Proof

Note that all rows of \(U^{-1}_{t}=(|\zeta _{0}\rangle , |\zeta _{1}\rangle , \ldots , |\zeta _{n'-1}\rangle )^{T}\) form an orthonormal base of \(\mathbb {C}^{n'}\) with respect to the usual inner product. By Eq. (66), \(\beta ^{S}_{j,t}=\langle \zeta _{j}|\alpha _{S,t}\rangle \) holds for all j and S. According to Theorem 2 and Definition 6, \(|\zeta _{i,j'}\rangle \perp L_{i}\) for all \(i\in \{0,1,\ldots ,n\}\). Therefore, the proof is completed. \(\square \)

In fact, Theorem 6 implies that

$$\begin{aligned} \bigcup _{i}L^{\bot }_{i}\supseteq \{|\zeta _{0}\rangle , |\zeta _{1}\rangle , \ldots , |\zeta _{n'-1}\rangle \}\Rightarrow \sum _{i}L^{\bot }_{i}\supseteq L(\{|\zeta _{0}\rangle , |\zeta _{1}\rangle , \ldots , |\zeta _{n'-1}\rangle \}). \end{aligned}$$
(158)

Furthermore, \(L_{i}\subseteq L\) implies that \(L^{\bot }\subseteq L_{i}^{\bot }\). Inspired by the two facts, we get a theorem in the following. For a final state (i.e., an output of the second basic step in the framework) in hand, this result provides a sufficient condition of the case that the degree can be dropped.

Theorem 7

For the representation matrix of a quantum state

$$\begin{aligned} U_{t}O_{x}U_{t-1}\ldots U_{0}|\psi _{0}\rangle =\sum _{j}\left( \sum _{S}\alpha ^{S}_{j,t}(-1)^{S\cdot x}\right) |j\rangle \end{aligned}$$
(159)

in a quantum query algorithm, if there exists an orthonormal base

$$\begin{aligned} \{|\zeta _{0}\rangle ,|\zeta _{1}\rangle ,\ldots ,|\zeta _{\text {dim}(L)-1}\rangle \} \end{aligned}$$
(160)

such that

$$\begin{aligned} \forall j \in \{0,1,\ldots ,\text {dim}(L)-1\},\exists i\in \{0,1,\ldots ,n\}, s.t.~|\zeta _{j}\rangle \in L\cap L^{\bot }_{i}, \end{aligned}$$
(161)

then the degree

$$\begin{aligned} m=\max \{|S||\alpha ^{S}_{j,t}\ne 0\} \end{aligned}$$
(162)

can be dropped after applying a query operator \(O^{\dag }_{x}\) to the state \(O_{x}U_{t-1}\ldots U_{0}|\psi _{0}\rangle \).

Proof

Note that

$$\begin{aligned} \sum ^{n}_{i=0}L_{i}=L \end{aligned}$$
(163)

and

$$\begin{aligned} L^{\bot }_{i}=L^{\bot }+L\cap L^{\bot }_{i} \end{aligned}$$
(164)

for all \(i\in \{0,1,\ldots ,n\}\). Let the orthonormal base \(\{|\zeta _{0}\rangle , |\zeta _{1}\rangle , \ldots , |\zeta _{n'-1}\rangle \}\) be the union of the set \(\{|\zeta _{0}\rangle ,|\zeta _{1}\rangle ,\ldots ,|\zeta _{\text {dim}(L)-1}\rangle \}\) and an orthonormal base set of the vector space \(L^{\bot }\). The proof is completed. \(\square \)

Next, we have a result in the following theorem. For a final state (i.e., an output of the second basic step of the framework) in hand, this result provides a sufficient condition of the case that the degree cannot be dropped.

Theorem 8

For the representation matrix of a quantum state

$$\begin{aligned} U_{t}O_{x}U_{t-1}\ldots U_{0}|\psi _{0}\rangle =\sum _{j}\left( \sum _{S}\alpha ^{S}_{j,t}(-1)^{S\cdot x}\right) |j\rangle \end{aligned}$$
(165)

in a quantum query algorithm, if

$$\begin{aligned} \text {rank}(L')<\sum ^{n}_{i=0}\frac{\text {rank}(L'_{i})}{n}, \end{aligned}$$
(166)

then the degree

$$\begin{aligned} m=\max \{|S||\alpha ^{S}_{j,t}\ne 0\} \end{aligned}$$
(167)

is not dropped after applying a query operator \(O^{\dag }_{x}\) to the state \(O_{x}U_{t-1}\ldots U_{0}|\psi _{0}\rangle \).

Proof

If there exists no unitary operator \(U_{t}\) such that the degree is dropped after a query, then it is sufficient to show this theorem. By Theorem 6, for a proper unitary operator \(U_{t}=(|\zeta _{0}\rangle , |\zeta _{1}\rangle , \ldots , |\zeta _{n'-1}\rangle )\), we can set

$$\begin{aligned} |\zeta _{j}\rangle =|\zeta _{j,1}\rangle +|\zeta _{j,2}\rangle ~\text {for all}~j\in \{0,1,\ldots ,n'-1\} \end{aligned}$$
(168)

where

$$\begin{aligned} |\zeta _{j,1}\rangle \in L^{\bot }~\text {and}~\exists i\in \{0,1,\ldots ,n\}, s.t.~|\zeta _{j,2}\rangle \in L\cap L^{\bot }_{i}. \end{aligned}$$
(169)

Moreover,

$$\begin{aligned} \begin{aligned} L(\{|\zeta _{0}\rangle , |\zeta _{1}\rangle , \ldots , |\zeta _{n'-1}\rangle \}) \subseteq \sum ^{n}_{i=0}((L\cap L^{\bot }_{i})+L^{\bot }) =L^{\bot }+\sum ^{n}_{i=0}(L\cap L^{\bot }_{i}) \end{aligned} \end{aligned}$$
(170)

implies that

$$\begin{aligned} \begin{aligned} n'&=\text {dim}(L(\{|\zeta _{0}\rangle , |\zeta _{1}\rangle , \ldots , |\zeta _{n'-1}\rangle \}))\\&\le \text {dim}(L^{\bot })+\text {dim}\left( \sum ^{n}_{i=0}(L\cap L^{\bot }_{i})\right) \\&\le \text {dim}(L^{\bot })+\text {dim}(L)=n'. \end{aligned} \end{aligned}$$
(171)

Thus, if there exists a unitary operator \(U_{t}\) such that the degree of the state \(O_{x}U_{t-1}\ldots U_{0}|\psi _{0}\rangle \) is dropped after a query, then

$$\begin{aligned} \text {dim}\left( \sum ^{n}_{i=0}(L\cap L^{\bot }_{i})\right) =\text {dim}(L)\le \sum ^{n}_{i=0}\text {dim}(L\cap L^{\bot }_{i}). \end{aligned}$$
(172)

However, Eq. (166) implies that

$$\begin{aligned} \begin{aligned}&\text {dim}(L)<\sum ^{n}_{i=0}\frac{\text {dim}(L_{i})}{n}\\&\quad \Rightarrow (n+1)\times \text {dim}(L)<\sum ^{n}_{i=0}\text {dim}(L_{i})+\text {dim}(L)\\&\quad \Rightarrow \sum ^{n}_{i=0}\left( \text {dim}(L)-\text {dim}(L_{i})\right)<\text {dim}(L)\\&\quad \Rightarrow \sum ^{n}_{i=0}\text {dim}(L\cap L^{\bot }_{i})<\text {dim}(L). \end{aligned} \end{aligned}$$
(173)

This is a contradiction. Therefore, the proof is completed. \(\square \)

Naturally, from the second basic step to the next step in the algorithm framework, this theorem can be regarded as a sufficient stopping criterion for the case that the degree should be dropped. In order to discuss a similar stopping criterion from the first basic step to the next step in the algorithm framework, we define some vector spaces and corresponding matrices by extracting some column vectors from the representation matrix Eq. (52) of a pair of degree-m SOS representations.

Definition 7

For the representation matrix of a pair of degree-m SOS representations, the vector space

$$\begin{aligned} B=L(\{|\alpha _{S}\rangle ||S|\in \{m-1,m\}\}) \end{aligned}$$
(174)

denotes a linear space which contains all linear combinations of vectors in the set

$$\begin{aligned} \{|\alpha _{S}\rangle ||S|\in \{m-1,m\}\}, \end{aligned}$$
(175)

and the corresponding matrix

$$\begin{aligned} B'=[\ldots ,|\alpha _{S}\rangle ,\ldots ]_{|S|\in \{m-1,m\}} \end{aligned}$$
(176)

consists of all column vectors in the same set \(\{|\alpha _{S}\rangle ||S|\in \{m-1,m\}\}\). Similarly, the vector space

$$\begin{aligned} B_{0}=L(\{|\alpha _{S}\rangle ||S|=m\}), \end{aligned}$$
(177)

and the corresponding matrix

$$\begin{aligned} B'_{0}=[\ldots ,|\alpha _{S}\rangle ,\ldots ]_{|S|=m}. \end{aligned}$$
(178)

For \(i\in \{1,2,\ldots ,n\}\), the vector space

$$\begin{aligned} B_{i}{=}L(\{|\alpha _{S}\rangle |S\not \supseteq \{i\},|S|\in \{m{-}1,m\}\}), \end{aligned}$$
(179)

and the corresponding matrix

$$\begin{aligned} B'_{i}{=}[\ldots ,|\alpha _{S}\rangle ,\ldots ]_{S\not \supseteq \{i\},|S|\in \{m{-}1,m\}}. \end{aligned}$$
(180)

\(\square \)

Similar to Definition 6, if we have got a pair of degree-m SOS representations of f and its negation in Eq. (49), we can get these spaces and corresponding matrices easily. And, we can also get the following basic facts of these notations in Definition 7.

  1. 1.

    By Definition 7, \(\text {dim}(B)=\text {rank}(B')\) and \(\text {dim}(B_{i})=\text {rank}(B'_{i})\) \((i\in \{0,1,\ldots ,n\})\). Thus, the vector space \(B_{i}=B\) if and only if the rank of the matrix \(\text {rank}(B'_{i})=\text {rank}(B')\).

  2. 2.

    By the analysis of the second basic step, \(L'=KB'\) and \(L'_{i}=KB'_{i}\) \((i\in \{0,1,\ldots ,n\})\) where the matrix K satisfying Eqs. (55) and (56).

  3. 3.

    For all \(i\in \{0,1,\ldots ,n\}\), basic operations on an SOS representation in Remark 2 keep the rank \(\text {rank}(B')\) and the rank \(\text {rank}(B'_{i})\) unchanged, while basic operations in Remark 3 may make the rank \(\text {rank}(B')\) and the rank \(\text {rank}(B'_{i})\) changed.

Then, we get the following theorem using Frobenius inequality (i.e., for any \(m\times n\) matrix A and any \(n\times s\) matrix B, the rank \(\text {rank}(AB)\ge \text {rank}(A)+\text {rank}(B)-n\)). For a pair of SOS representations of f and its negation (i.e., an output of the first basic step in the framework) in hand, this result provides a sufficient condition of the case that the degree cannot be dropped.

Theorem 9

For the representation matrix of a pair of degree-m SOS representations and \(i\in \{0,1,\ldots ,n\}\), if \(\text {rank}(B'_{i})=\text {rank}(B')\), then \(L=L_{i}\).

Proof

According to Definition 7, the matrix \(B'\) can be written as \([B'_{i}~B'/B'_{i}]C\). Here, the sub-matrix \(B'/B'_{i}\) consists of all columns in the matrix \(B'\) but not in the matrix \(B'_{i}\), and the matrix C is an invertible matrix. Meanwhile, if \(\text {rank}(B'_{i})=\text {rank}(B')\), then the matrix \(B'\) can also be written as \([B'_{i}~O]C'\) where the matrix \(C'\) is also an invertible matrix. The reason is that the matrix C (and the matrix \(C'\)) is a product of a sequence of elementary matrices which perform elementary column transformations on the matrix \(B'\). Next,

$$\begin{aligned} \text {rank}(L')=\text {rank}(KB')=\text {rank}(K[B'_{i}~O]C')=\text {rank}(K[B'_{i}~O])=\text {rank}(KB'_{i})=\text {rank}(L'_{i}) \end{aligned}$$
(181)

where the construction matrix K satisfies Eqs. (55) and (56) and the Frobenius inequality is used to the third equality. By Definition 6, \(L=L_{i}\) holds for all \(i\in \{0,1,\ldots ,n\}\). The proof is completed. \(\square \)

By Theorem 6, from the first basic step to the next step in the algorithm framework, Theorem 9 can be regarded as a sufficient stopping criterion for the case that the degree should be dropped. Combining Theorem 8 with Theorem 9, we can get the following theorem easily. For a pair of degree-\(Q_{E}(f)\) SOS representations of f and its negation (i.e., an output of the first basic step of a specific framework) in hand, the result in Theorem 10 provides a sufficient condition of the case that the optimal algorithm cannot be got.

Theorem 10

For a pair of degree-\(Q_{E}(f)\) SOS representations, if \(\text {rank}(B'_{i})=\text {rank}(B')\) for all \(i\in \{0,1,\ldots ,n\}\), then this pair of SOS representations cannot be produced by an optimal exact quantum query algorithm computing f.

Proof

Assume that a quantum query algorithm computes f exactly and the final state produces the given pair of degree-\(Q_{E}(f)\) SOS representations. According to Theorem 9, since \(\text {rank}(B'_{i})=\text {rank}(B')\) for all \(i\in \{0,1,\ldots ,n\}\), we can get \(L=L_{i}\) for all \(i\in \{0,1,\ldots ,n\}\) and then

$$\begin{aligned} \text {rank}(L')<\sum ^{n}_{i=0}\frac{\text {rank}(L'_{i})}{n}=\frac{n+1}{n}\text {rank}(L'). \end{aligned}$$
(182)

According to Theorem 8, the degree is not raised after applying the last query in the algorithm. Together with Lemma 7 in Ref. [11], since the change of the degree of a state is always at most 1 after applying a query, the number of queries in the algorithm is not less than \(Q_{E}(f)+1\). Thus, the quantum query algorithm is not optimal. The proof is completed. \(\square \)

Now, we present a supplementary step of the algorithm framework in Algorithm E.

Algorithm E An algorithm framework for obtaining a unitary operator \(U_{t}\) which makes the degree of the quantum state \(O_{x}U_{t-1}\ldots U_{0}|\psi _{0}\rangle \) drop after applying a query operator \(O^{\dag }_{x}\).

  • Input: Vector space \(L, L_{i}, L^{\bot }_{i}, L^{\bot }, L\cap L^{\bot }_{i}\) satisfying

    $$\begin{aligned} \text {dim}(L)\le \sum ^{n}_{i=0}\text {dim}(L\cap L^{\bot }_{i}). \end{aligned}$$
    (183)
  • Output: A unitary operator \(U_{t}=(|\zeta _{0}\rangle , |\zeta _{1}\rangle , \ldots , |\zeta _{n'-1}\rangle )\), or FAIL.

  • Procedure:

    1. 1.

      Obtain an orthonormal base \(\{|\eta _{1}\rangle ,\ldots ,|\eta _{m}\rangle \}\) of the vector space \(L^{\bot }\), and orthonormal base \(\{|\eta _{i,1}\rangle ,\ldots ,|\eta _{i,m_{i}}\rangle \}\) of the vector space \(L\cap L^{\bot }_{i}\). Here,

      $$\begin{aligned} m=\text {dim}(L^{\bot }), m_{i}=\text {dim}(L\cap L^{\bot }_{i}). \end{aligned}$$
      (184)
    2. 2.

      Assign i with \(|\zeta _{j}\rangle \in L\cap L^{\bot }_{i}\). Introducing undetermined coefficients \(a_{j,s},b_{j,t}\), let

      $$\begin{aligned} |\zeta _{j}\rangle =\sum _{s}a_{j,s}|\eta _{s}\rangle +\sum _{t}b_{j,t}|\eta _{i,t}\rangle . \end{aligned}$$
      (185)

      Solve the equation set

      $$\begin{aligned} \langle \zeta _{j}|\zeta _{k}\rangle =0,\forall j\ne k. \end{aligned}$$
      (186)

      If the solution space of this equation set is empty, then output FAIL.

    3. 3.

      Normalize the vectors and set them to be column vectors of \(U_{t}\).

In this paper, the problem of constructing an \(n'\times n'\) unitary matrix is transformed to find an orthonormal base (i.e., \((|\zeta _{0}\rangle , |\zeta _{1}\rangle , \ldots , |\zeta _{n'-1}\rangle )^{T}\)) of \(\mathbb {C}^{n'}\) with respect to the usual inner product. In fact, Algorithm E aims to solve the system of equations

$$\begin{aligned} \left\{ \begin{aligned}&0=\langle \zeta _{0,j'}|\alpha _{S,t}\rangle , S\subseteq \{1,2,\ldots ,n\}, |S|=m; \\&0=\langle \zeta _{i,j'}|\alpha _{S,t}\rangle , i\in \{1,2,\ldots ,n\}, S\not \supseteq \{i\}, S\subseteq \{1,2,\ldots ,n\},|S|\in \{m{-}1,m\}; \\&\langle \zeta _{j}|\zeta _{k}\rangle =0,\forall j,k\in \{0,1,\ldots ,n'-1\},j\ne k;\\&\langle \zeta _{j}|\zeta _{j}\rangle =1,\forall j\in \{0,1,\ldots ,n'-1\}. \end{aligned} \right. \end{aligned}$$
(187)

which can be got from Eq. (89) by Theorem 2. Since \(\beta ^{S}_{j,t}=\langle \zeta _{j}|\alpha _{S,t}\rangle \) can be used to get the equation \((\ldots ,\beta ^{S}_{j,t},\ldots )=\langle \zeta _{j}\mid [\ldots ,|\alpha _{S,t}\rangle ,\ldots ]\), it is not difficult to get the following two facts:

  1. 1.

    For \(i=0\), when S traverses all subsets of \(\{1,2,\ldots ,n\}\) satisfying \(|S|=m\), we have

    $$\begin{aligned} (0,0,\ldots ,0)=\langle \zeta _{j}\mid [\ldots ,|\alpha _{S,t}\rangle ,\ldots ]_{|S|=m}=\langle \zeta _{j}\mid L'_{0} \end{aligned}$$
    (188)

    which implies that the vector \(|\zeta _{j}\rangle \) is orthogonal to all vectors \(|\alpha _{S,t}\rangle \) satisfying \(|S|=m\). Thus, \(|\zeta _{j}\rangle \perp L_{0}\) and \(|\zeta _{0,j'}\rangle \subseteq L^{\perp }_{0}\).

  2. 2.

    For a fixed \(i\in \{1,2,\ldots ,n\}\), when S traverses all sets \(S\not \supseteq \{i\}\) satisfying \(|S|\in \{m-1,m\}\), we have

    $$\begin{aligned} (0,0,\ldots ,0)=\langle \zeta _{j}\mid [\ldots ,|\alpha _{S,t}\rangle ,\ldots ]_{S\not \supseteq \{i\},|S|\in \{m{-}1,m\}}=\langle \zeta _{j}\mid L'_{i} \end{aligned}$$
    (189)

    which implies that the vector \(|\zeta _{j}\rangle \) is orthogonal to all vectors \(|\alpha _{S,t}\rangle \) satisfying \(S\not \supseteq \{i\}\) and \(|S|\in \{m{-}1,m\}\). Thus, \(|\zeta _{j}\rangle \perp L_{i}\) and \(|\zeta _{i,j'}\rangle \subseteq L^{\perp }_{i}\).

As we know, for all \(i\in \{0,1,2,\ldots ,n\}\), \(L_{i}\subseteq L\) implies that \(L^{\perp }_{i}\supseteq L^{\perp }\) and \(L^{\perp }_{i}=L^{\perp }+L\cap L^{\perp }_{i}\). Thus, for every vector \(|\zeta _{i,j'}\rangle \subseteq L^{\perp }_{i}\), \(|\zeta _{j}\rangle \) can be represented by the orthonormal base \(\{|\eta _{1}\rangle ,\ldots ,|\eta _{m}\rangle \}\) of the vector space \(L^{\bot }\) and the orthonormal base \(\{|\eta _{i,1}\rangle ,\ldots ,|\eta _{i,m_{i}}\rangle \}\). That is, \(|\zeta _{j}\rangle =\sum _{s}a_{j,s}|\eta _{s}\rangle +\sum _{t}b_{j,t}|\eta _{i,t}\rangle \) for some complex numbers \(a_{j,s}, b_{j,t}\).

Now, we evaluate Algorithm E step by step as follows:

  1. 1.

    For the inputs in Algorithm E, we may do the following operations.

    1. (1)

      For vector spaces \(L, L_{i}\), we can extract them from the representation matrix by the definition. The total complexity is upper bounded by \(O((n+1)2^{n})\).

    2. (2)

      For vector spaces \(L^{\bot }_{i}, L^{\bot }, L\cap L^{\bot }_{i}\), we can get the basic vectors of every space by solving linear system of equations. Using Gauss elimination method, the total complexity is upper bounded by \(O(n(n')^{3})\).

    3. (3)

      For the condition \(\text {dim}(L)\le \sum ^{n}_{i=0}\text {dim}(L\cap L^{\bot }_{i})\), we compute the rank of generator vectors in every vector space \(L, L_{i}, L^{\bot }_{i}, L^{\bot }, L\cap L^{\bot }_{i}\), respectively. Using Gauss elimination method, the total complexity is upper bounded by \(O(n(n')^{3})\).

  2. 2.

    The step 1 in Algorithm E can be completed using Gram–Schmidt orthogonalization and the complexity is upper bounded by \(O((n')^{3})\).

  3. 3.

    For the step 2 in Algorithm E, we may do the following operations:

    1. (1)

      Assign i with \(|\zeta _{j}\rangle \in L\cap L^{\bot }_{i}\). Here, we do not know how to determine a proper assignment strategy. In the worse case, we do this operation randomly and the number of assignment strategies is not bigger than \((n')^{(n+1)}\).

    2. (2)

      Introduce undetermined coefficients \(a_{j,s},b_{j,t}\). This operation is trivial and the complexity is upper bounded by \((n'+1)2^{n}\).

    3. (3)

      Solve the equation set \(\langle \zeta _{j}|\zeta _{k}\rangle =0,\forall j\ne k.\) This paper cannot find out an efficient method to solve the multivariate equation set, so we do not know the complexity of getting an exact solution for the equation set.

  4. 4.

    The step 3 in Algorithm E can be completed using Gram–Schmidt orthogonalization and the complexity is upper bounded by \(O((n')^{3})\).

Obviously, Algorithm E succeeds if and only if the step 2 in Algorithm E outputs an exact solution of the equation set. Indeed, solving the multivariate quadratic equation set is an intractable problem in Algorithm E. The analysis is finished.\(\square \)

A simple algorithm framework and applications

In this section, we present a simple algorithm framework using Algorithms 3.2, 4.1 and E. And, we demonstrate the algorithm framework on Deutsch’s problem successfully. In addition, we investigate the optimal exact quantum 3-query algorithm computing the Boolean function \(\text {EXACT}_{3,4}^{5}(x)\).

1.1 A simple framework for proposing a quantum query algorithm

For any small Boolean function, this subsection explores to find an optimal exact quantum query algorithm computing the Boolean function.

Using Algorithms 3.2, 4.1 and E, the following strategies can be tested on some basic very small cases.

  1. 1.

    For the case that \(Q_{E}(f)=1<n\), run Algorithm 3.2 to obtain a pair of degree-1 SOS representations of the Boolean function f and its negation, and run Algorithm 4.1 to obtain an alternative final state. If there exists an alternative final state satisfying Theorem 6, then we can get an exact quantum 1-query algorithm.

  2. 2.

    For the case that \(Q_{E}(f)=2<n\), we may use one of the following two strategies to find an exact quantum 2-query algorithm. This is applied in Sect. 6.

    1. (1)

      In the first step, run Algorithm 3.2 to obtain a pair of degree-1 SOS representations of f and its negation, and run Algorithm 4.1 to obtain an alternative final state. In the second step, try to find a unitary operator \(U_{2}\) such that the representation matrix of \(U_{1}O_{x}U_{0}|0\rangle \) satisfies Theorem 6. Finally, run Algorithm E to make the degree of the state \(U_{1}O_{x}U_{0}|0\rangle \) drop.

    2. (2)

      In the first step, run Algorithm 3.2 to obtain a pair of degree-2 SOS representations of f and its negation, and run Algorithm 4.1 to obtain an alternative final state. In the second step, run Algorithm E twice such that the degree of the alternative final state is dropped to 0.

As a result, if there exists a pair of proper SOS representations of f and its negation where \(Q_{E}(f)\le 2<n\), then the above strategy can be tested.

Now, we extend the simple strategy in item (2) of item 2. For this case, we can represent all states by representation matrices in the following:

Lemma 3

For an n-bit Boolean function f, if there exists a quantum t-query algorithm \(U_{t}O_{x}\ldots U_{0}|\psi _{0}\rangle \) computing the Boolean function f exactly and this algorithm produces a pair of degree-t SOS representations of f and \(1-f\), then a sequence of \(\sum ^{m}_{i=0}\left( {\begin{array}{c}n\\ i\end{array}}\right) -\)columns matrices

(190)

represent states

$$\begin{aligned} U_{m}O_{x}U_{m-1}\ldots U_{0}|\psi _{0}\rangle ~\text {and}~O_{x}U_{m-1}\ldots U_{0}|\psi _{0}\rangle \end{aligned}$$
(191)

where \(m\in \{0,1,2,\ldots ,t\}\), respectively.

Proof

According to Lemma 7 and Theorem 17 in Ref. [11], the degree of the state after m queries will be polynomials of degree m exactly. Thus, it can be determined by the vector \(|F(x)\rangle _{m}\). Using the definition of the representation matrix, the proof is completed. \(\square \)

Therefore, for this class, we can represent the state after m queries by a \(\sum ^{m}_{i=0}\left( {\begin{array}{c}n\\ i\end{array}}\right) -\)column matrix and the state after \(m+1\) queries by a \(\sum ^{m+1}_{i=0}\left( {\begin{array}{c}n\\ i\end{array}}\right) -\)column matrix. For a Boolean function with an optimal exact quantum query algorithm in this case, we describe the simple algorithm framework in Algorithm F.1.

Algorithm F.1 A simple algorithm framework for proposing an exact quantum t-query algorithm computing the Boolean function f.

  • Input: The truth table of an \(n{-}\)bit Boolean function f(x). Set \(i=t\).

  • Output: A sequence of unitary transformations, or FAIL.

  • Procedure:

    1. 1.

      Run Algorithm 3.2 to find a pair of degree-t SOS representations of f and its negation, and turn to the next step. If Algorithm 3.2 outputs FAIL, then output FAIL.

    2. 2.

      Check the result in the step 1 using Theorem 10. If the degree cannot be dropped after a query, turn to the step 1 to get another pair. Otherwise, turn to the next step.

    3. 3.

      Run Algorithm 4.1 to choose an alternative final state by Theorem 8, and turn to the next step. If the degree cannot be dropped for all results, turn to the step 1 to get another pair.

    4. 4.

      Run Algorithm E to find the unitary matrix \(U_{i}\), and turn to the next step. If we cannot get a matrix \(U_{i}\), then turn to the step 1.

    5. 5.

      If \(i>0\), then let \(i=i-1\) and turn to the step 4. Otherwise, output \(U_{t},U_{t-1},\ldots ,U_{1}\).

Naturally, for a certain task, if Algorithms 3.2, 4.1 and E succeed, then Algorithm F.1 succeeds.

1.2 Proposing an exact quantum 1-query algorithm for Deutsch’s problem

As we know, Deutsch’s algorithm can be identified with an exact quantum 1-query algorithm computing the Boolean function \(\text {NOT-EXACT}_{0,2}^{2}(x)\). We present a known version of Deutsch’s algorithm in “Appendix F.2.1.” Now, assume that we do not know this optimal exact quantum query algorithm. Then, how do we design an exact quantum 1-query algorithm computing \(\text {NOT-EXACT}_{0,2}^{2}(x)\)? This subsection answers this question using Algorithm F.1.

First, run Algorithm 3.2. There exists a pair of unique (if one SOS representation can be got by the other using the method in Remarks 23 and 4, then they are same; otherwise, they are different) degree-1 SOS representations

$$\begin{aligned} \text {EXACT}_{0,2}^{2}(x)=\frac{1}{4}[(-1)^{x_{1}}+(-1)^{x_{2}}]^{2} \end{aligned}$$
(192)

and

$$\begin{aligned} \text {NOT-EXACT}_{0,2}^{2}(x)=\frac{1}{4}[(-1)^{x_{1}}-(-1)^{x_{2}}]^{2}. \end{aligned}$$
(193)

The representation matrix of Eqs. (192) and (193) can be written as

(194)

Thus, proposing an optimal exact quantum query algorithm computing Deutsch’s problem is transformed to the following problem. How do we find a pair of unitary operators \(U_{0}\) and \(U_{1}\) such that the quantum state \(U_{1}O_{x}U_{0}|\psi _{0}\rangle \) produces Eqs. (192) and (193)?

Then, run Algorithm 4.1. Generally, since we can perform operations in Remark 2 on Eqs. (192) and (193), the state \(U_{1}O_{x}U_{0}|\psi _{0}\rangle \) is in the form:

(195)

where

$$\begin{aligned} (\overrightarrow{\alpha })^{\dag }\overrightarrow{\alpha }=(\overrightarrow{\beta })^{\dag }\overrightarrow{\beta }=\frac{1}{4}. \end{aligned}$$
(196)

Obviously,

$$\begin{aligned} (\overrightarrow{\alpha }^{T},\overrightarrow{\beta }^{T})\perp (\overrightarrow{\alpha }^{T},-\overrightarrow{\beta }^{T}). \end{aligned}$$
(197)

Here, the construction matrix is

(198)

Next, run Algorithm E. According to Theorem 2, the unitary operator \(U_{1}\) can be used to determine a quantum 1-query algorithm computing \(\text {NOT-EXACT}_{0,2}^{2}(x)\), if and only if the state \(O_{x}U_{0}|\psi _{0}\rangle \) can be represented by the matrix

(199)

where

$$\begin{aligned} (\overrightarrow{\gamma })^{\dag }\overrightarrow{\gamma }=\frac{1}{2}=(\overrightarrow{\eta })^{\dag }\overrightarrow{\eta }. \end{aligned}$$
(200)

Here, we used the fact that the unitary operator \(U_{1}^{-1}\) preserves Euclidean norm. Then,

(201)

Therefore,

(202)

while the state \(U_{0}|\psi _{0}\rangle \) can be represented by the matrix

(203)

which can be used to determined a proper unitary operator \(U_{0}\). In fact, Deutsch’s algorithm is a specific case of this procedure.

Finally, we can see that Deutsch’s problem is simple using Algorithm E. Obviously, the simplicity benefits from the unique SOS representation. For other small Boolean functions, proposing an optimal exact quantum query algorithm may be not so easy.

1.2.1 A version of Deutsch’s Algorithm

This subsubsection describes a version of an optimal quantum 1-query algorithm computing the Boolean function \(\text {NOT-EXACT}_{0,2}^{2}(x)\).

Now, Deutsch’s algorithm can be described as follows:

  1. 1.

    The initial state is

    (204)

    Then, the representation matrix of the initial state \(|\psi _{0}\rangle \) is

    (205)
  2. 2.

    Applying the unitary operator \(U_{0}\) to the initial state \(|\psi _{0}\rangle \) where

    $$\begin{aligned} U_{0}|2\rangle =\frac{1}{\sqrt{2}}(|1\rangle +|2\rangle ), \end{aligned}$$
    (206)

    we have

    (207)

    Then, the representation matrix of the state \(|\psi _{1}\rangle \) is

    (208)
  3. 3.

    Applying the oracle operator \(O_{x}\) to the state \(|\psi _{1}\rangle \), we have

    (209)

    Then, the representation matrix of the state \(|\psi _{2}\rangle \) is

    (210)
  4. 4.

    Applying the unitary operator \(U_{1}\) to the state \(|\psi _{2}\rangle \), we have

    (211)

    Here,

    $$\begin{aligned} U_{1}|1\rangle =\frac{1}{\sqrt{2}}(|0\rangle +|1\rangle ), U_{1}|2\rangle =\frac{1}{\sqrt{2}}(|0\rangle -|1\rangle ). \end{aligned}$$
    (212)

    Then, the representation matrix of the state \(|\psi _{3}\rangle \) is

    (213)

    which produces a pair of SOS representations of \(\text {EXACT}_{0,2}^{2}(x)\) and \(\text {NOT-EXACT}_{0,2}^{2}(x)\).

Finally, the algorithm computes \(\text {NOT-EXACT}_{0,2}^{2}(x)\) by measuring the final state with the base \(\{|0\rangle ,|1\rangle ,|2\rangle \}\). Here, the algorithm outputs 1 if and only if the measurement outcome is \(|0\rangle \).

1.3 An application: exploring the optimal exact quantum query algorithm computing \(\text {EXACT}_{3,4}^{5}(x)\)

Using Algorithm F.1, this subsection investigates the optimal exact quantum query algorithm computing \(\text {EXACT}_{3,4}^{5}(x)\).

In fact, the small function \(\text {EXACT}_{3,4}^5\) itself is nothing special and very simple in classical computation. In quantum computation, the current known bound of the exact quantum query complexity is 3 (from observing the polynomial degree of \(\text {EXACT}_{3,4}^5\)) or 4 (from an exact quantum query algorithm in [16]). Also, a numerical result from [15] suggests that the exact quantum query complexity is 3. Since an exact quantum 3-query algorithm computing \(\text {EXACT}_{3,4}^{5}(x)\) has not been proposed, the equation \(Q_{E}(\text {EXACT}_{3,4}^5)=3\) is only a conjecture.

Using the definition of the SOS degree, we have

$$\begin{aligned} \deg (\text {EXACT}_{3,4}^{5}(x))=5\Rightarrow \deg _{\mathrm{sos}}(\text {EXACT}_{3,4}^{5}(x))\ge 3. \end{aligned}$$
(214)

Considering the Example 2 (i.e., \(\deg _{\mathrm{sos}}(f)=2>1=\frac{1}{2}\deg (f)\) where \(f(x)=x_{1}x_{2}\)) in “Appendix B” and Corollary 1 (i.e., \(\deg _{\mathrm{sos}}(f)\ge 3>2=\frac{\deg (f)}{2}\) where \(f(x)=\text {EXACT}_{2,3}^{5}(x)\)) in “Appendix D,” the equation

$$\begin{aligned} \deg _{\mathrm{sos}}(\text {EXACT}_{3,4}^{5}(x))=3=\deg _{\mathrm{sos}}(\text {NON-EXACT}_{3,4}^{5}(x)) \end{aligned}$$
(215)

is only a conjecture before a pair of SOS representations is found out.

According to Lemma 1,

$$\begin{aligned} Q_{E}(\text {EXACT}_{3,4}^5)=3\Rightarrow \deg _{\mathrm{sos}}(\text {EXACT}_{3,4}^{5}(x))=3. \end{aligned}$$
(216)

That is, the suggestion by Montanaro et al. [15] implies that there exists an exact quantum 3-query algorithm producing a pair of degree-3 SOS representations of \(\text {EXACT}_{3,4}^{5}(x)\) and \(\text {NOT-EXACT}_{3,4}^{5}(x)\). Thus, the optimal exact quantum query algorithm is in the solution space of Algorithm F.1. Using Algorithm F.1, the problem of obtaining a pair of proper degree-3 SOS representations is the first important problem of proposing an exact quantum 3-query algorithm computing \(\text {EXACT}_{3,4}^{5}(x)\).

Using Algorithm 3.2, we get a pair of SOS representations of \(\text {EXACT}_{3,4}^{5}(x)\) and its negation in Eqs. (217) and (218) which provide a positive constructive proof of Eq. (215). To some extent, this result is a tighter lower bound of \(Q_{E}(\text {EXACT}_{3,4}^5)\) than a half of the polynomial degree.

$$\begin{aligned}&\begin{aligned}&\text {EXACT}_{3,4}^{5}(x)=(x_{3}x_{4}x_{5}+x_{2}x_{4}x_{5}-\frac{1}{2}x_{2}x_{3}x_{5}-\frac{1}{2}x_{2}x_{3}x_{4}{-}\frac{1}{2}x_{1}x_{4}x_{5}\\&\quad -\frac{1}{2}x_{1}x_{3}x_{5}+x_{1}x_{3}x_{4}+x_{1}x_{2}x_{5}{-}x_{1}x_{2}x_{4}+x_{1}x_{2}x_{3})^{2}+\frac{3}{4}(x_{2}x_{3}x_{5}\\&\quad -x_{2}x_{3}x_{4}+x_{1}x_{4}x_{5}-x_{1}x_{3}x_{5})^{2}. \end{aligned} \end{aligned}$$
(217)
$$\begin{aligned}&\begin{aligned}&\text {NOT-EXACT}_{3,4}^{5}(x) =(1-\frac{1}{2}x_{1}-\frac{1}{2}x_{2}-\frac{1}{2}x_{3}-\frac{3}{2}x_{4}-\frac{3}{2}x_{5}+\frac{1}{2}x_{1}x_{2}\\&\quad +\frac{1}{2}x_{1}x_{3}+\frac{1}{2}x_{1}x_{4}+\frac{1}{2}x_{1}x_{5}+\frac{1}{2}x_{2}x_{3} +\frac{1}{2}x_{2}x_{4}+\frac{1}{2}x_{2}x_{5}+\frac{1}{2}x_{3}x_{4}+\frac{1}{2}x_{3}x_{5}\\&\quad +\frac{5}{2}x_{4}x_{5}-x_{3}x_{4}x_{5}-x_{2}x_{4}x_{5}-x_{1}x_{4}x_{5}-x_{1}x_{2}x_{3})^{2} +3(\frac{1}{2}x_{1}+\frac{1}{2}x_{2}+\frac{1}{2}x_{3}\\&\quad +\frac{1}{2}x_{4}-\frac{1}{2}x_{5}-\frac{1}{2}x_{1}x_{2}-\frac{1}{2}x_{1}x_{3}-\frac{1}{2}x_{1}x_{4}-\frac{1}{2}x_{1}x_{5}-\frac{1}{2}x_{2}x_{3} -\frac{1}{2}x_{2}x_{4}\\&\quad -\frac{1}{2}x_{2}x_{5}-\frac{3}{2}x_{3}x_{4}+\frac{1}{2}x_{3}x_{5}+\frac{1}{2}x_{4}x_{5}+x_{2}x_{3}x_{4}+x_{1}x_{3}x_{4}+x_{1}x_{2}x_{5})^{2}. \end{aligned}\nonumber \\ \end{aligned}$$
(218)

We also obtain another SOS representation of \(\text {EXACT}_{3,4}^{5}(x)\) in Eq. (219).

$$\begin{aligned}&\text {EXACT}_{3,4}^{5}(x) =\frac{1}{4}[(x_{1}x_{2}x_{3}-x_{2}x_{3}x_{4}+x_{3}x_{4}x_{5}-x_{4}x_{5}x_{1})^{2}{+}(x_{2}x_{3}x_{4}\nonumber \\&\quad -x_{3}x_{4}x_{5}+x_{4}x_{5}x_{1}-x_{5}x_{1}x_{2})^{2} {+}(x_{3}x_{4}x_{5}-x_{4}x_{5}x_{1}+x_{5}x_{1}x_{2}-x_{1}x_{2}x_{3})^{2}\nonumber \\&\quad {+}(x_{4}x_{5}x_{1}-x_{5}x_{1}x_{2}+x_{1}x_{2}x_{3}-x_{2}x_{3}x_{4})^{2} {+}(x_{5}x_{1}x_{2}-x_{1}x_{2}x_{3}+x_{2}x_{3}x_{4}\nonumber \\&\quad -x_{3}x_{4}x_{5})^{2}]+\frac{1}{4}[(x_{1}x_{3}x_{5}-x_{3}x_{5}x_{2}+x_{5}x_{2}x_{4}-x_{2}x_{4}x_{1})^{2} {+}(x_{3}x_{5}x_{2}-x_{5}x_{2}x_{4}\nonumber \\&\quad +x_{2}x_{4}x_{1}-x_{4}x_{1}x_{3})^{2}{+}(x_{5}x_{2}x_{4}-x_{2}x_{4}x_{1}+x_{4}x_{1}x_{3}-x_{1}x_{3}x_{5})^{2} {+}(x_{2}x_{4}x_{1}\nonumber \\&\quad -x_{4}x_{1}x_{3}+x_{1}x_{3}x_{5}-x_{3}x_{5}x_{2})^{2}{+}(x_{4}x_{1}x_{3}-x_{1}x_{3}x_{5}+x_{3}x_{5}x_{2}-x_{5}x_{2}x_{4})^{2}]. \end{aligned}$$
(219)

Based on these results, we think that the first basic step of the algorithm framework can be solved for some small cases. In fact, it is difficult for us to find a pair of exact solutions for \(\text {EXACT}_{3,4}^5\) and \(\text {NON-EXACT}_{3,4}^5\). Moreover, we are not sure whether there exists an easy method for finishing this task.

Unluckily, applying Theorem 10 to check the representation matrices of Eqs. (217), (218), and Eqs. (219), (218), we get the following negative result.

Corollary 2

Using Eqs. (217), (218) and  (219), it is impossible to find an exact quantum 3-query algorithm computing \(\text {EXACT}_{3,4}^{5}(x)\) by Algorithm F.1. \(\square \)

Corollary 2 shows that both Eqs. (217), (218), and Eqs. (219), (218) are two pairs of inappropriate SOS representations for running Algorithm F.1. Thus, a pair of proper degree-3 SOS representations of \(\text {EXACT}_{3,4}^{5}(x)\) and \(\text {NOT-EXACT}_{3,4}^{5}(x)\) is expected to be found.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Xu, G., Qiu, D. From the sum-of-squares representation of a Boolean function to an optimal exact quantum query algorithm. Quantum Inf Process 20, 33 (2021). https://doi.org/10.1007/s11128-020-02975-0

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s11128-020-02975-0

Keywords

Navigation