# Quantum-over-classical Advantage in Solving Multiplayer Games

We study the applicability of quantum algorithms in computational game theory and generalize some results related to Subtraction games, which are sometimes referred to as one-heap Nim games. In quantum game theory, a subset of Subtraction games became the first explicitly defined class of zero-sum combinatorial games with provable separation between quantum and classical complexity of solving them. For a narrower subset of Subtraction games, an exact quantum sublinear algorithm is known that surpasses all deterministic algorithms for finding solutions with probability 1. Typically, both Nim and Subtraction games are defined for only two players. We extend some known results to games for three or more players, while maintaining the same classical and quantum complexities: Θ(n^2) and Õ(n^1.5) respectively.

## Authors

• 4 publications
• 16 publications
• 1 publication
• 2 publications
• ### On the Complexity of Solving Subtraction Games

We study algorithms for solving Subtraction games, which sometimes are r...
08/10/2018 ∙ by Kamil Khadiev, et al. ∙ 0

• ### Mathematical Game Theory

These lecture notes attempt a mathematical treatment of game theory akin...
12/03/2020 ∙ by Ulrich Faigle, et al. ∙ 0

• ### Sublinear classical and quantum algorithms for general matrix games

We investigate sublinear classical and quantum algorithms for matrix gam...
12/11/2020 ∙ by Tongyang Li, et al. ∙ 3

• ### Sublinear quantum algorithms for training linear and kernel-based classifiers

We investigate quantum algorithms for classification, a fundamental prob...
04/04/2019 ∙ by Tongyang Li, et al. ∙ 0

• ### Complexity limitations on one-turn quantum refereed games

This paper studies complexity theoretic aspects of quantum refereed game...
02/04/2020 ∙ by Soumik Ghosh, et al. ∙ 0

• ### Computational Complexity of Games and Puzzles

In this thesis, we survey techniques and results from the study of Compl...
07/12/2018 ∙ by Diogo M. Costa, et al. ∙ 0

• ### A Quantum Approach to Subset-Sum and Similar Problems

In this paper, we study the subset-sum problem by using a quantum heuris...
07/27/2017 ∙ by Ammar Daskin, et al. ∙ 0

##### 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

Quantum game theory traditionally is being studied in the context of nonlocal properties of quantum particles, and usually stays apart from quantum computing and quantum algorithms. In contrast, Quantum combinatorial game theory is an approximately yearling branch of game theory, where quantum algorithms are applied for solving classical combinatorial games.

First explicit examples of combinatorial games with quantum-better-than-classical solving algorithms are some subsets of Subtraction games. [11] identify a specific subset of size of Subtraction games which are solvable by a quantum algorithm in time in bounded error setting. [9] identify a smaller set of size of restricted Subtraction games which are solvable by an exact quantum algorithm in time . Deterministic algorithms for both classes of games require steps for solving. (Hereafter stands for the number of positions in a game, regardless which of the players has to make the next move.)

A Subtraction game is similar to a canonical Nim game [6] in several senses. Nim is a notable game in game theory because it traditionally serves as a “base case” for Sprague-Grundy theorem [13, 8], which establishes a deterministic upper bound for solving many combinatorial games. Similarly, Subtraction games seem to become a good candidate for being a “base sample” for game-solving Quantum Dynamic Programming. And like many games are known to be reducible to some Nim games, also many games on graphs can be reduced to the corresponding Subtraction games. Finally, the rules of these games have very similar definitions.

The difference between these two games is that in a Subtraction game, the players deal with just one heap of stones, though with certain limitations imposed on the number of stones they can take from the heap. The most common limitation for Subtraction games is defining a maximum for the number of stones to be taken away, and this kind of Subtraction game has very fast deterministic solutions in . Here we study a much more general class of such limitations and thus a broader class of Subtraction games.

We investigate algorithms for solving Subtraction games, that is determining the payoffs of all the players, assuming each of them to play optimally. We exploit techniques similar to ones in [11] and [9] to establish upper bounds for the quantum complexity and asymptotes for the classical complexity.

The paper is organized in the following way. Section 2 contains basic definitions. In Section 3, we present evaluations of classical complexity and quantum algorithms for solving a special class of games which we call balanced Subtraction games. Finally, in Section 4 we analyze the complexity of solving the so called restricted Subtraction games.

## 2 Definitions

### 2.1 Subtraction Games

In a play of a Subtraction game players sequentially remove some positive amounts of stones from a heap, with player being followed by player .

Let be the initial number of stones in the heap, and be a lower-triangular binary matrix of size , with rows numbered from to and columns numbered from to . A player which has to make the next move, can remove stones () from the heap with exactly stones left iff . In simple terms, indicates the possibility for a player to receive position “ stones” from the predecessor and pass position “ stones” to the follower on the next turn.

If in some position a player, say player , cannot make a legal move, then the play ends, and each player receives their payoff . That is, player is the loser, the previous player is the major winner with payoff , the previous-to-previous player gets and so on. In order to become the major winner, a player has to take all the remaining stones, or to leave a number of stones such that no allowed moves would remain: .

Obviously, the rules of a Subtraction game are fully determined by such matrix , so hereafter we use letter to denote a corresponding game. We also reserve the name to denote the initial number of stones. This number also corresponds to the dimension of the matrix . Note that there are only meaningful bits in the matrix , as a player cannot increase the number of stones in the heap or leave it as is: for all .

Finally, we note that the selected payoff function is not a must. It may be arbitrary, provided that each player has strict preferences over the set of all possible endings. Otherwise, if some preferences are not strict, the concept of optimal behavior will not be well-defined, and the required assumption of optimal players will fail.

### 2.2 Winning Function

Let be a set of lower-triangular binary matrices of size , with rows numbered from to and columns numbered from to .

We define a winning function , such that iff a player gets payoff given position “ stones” in game , under assumption of optimal players:

 \textscWin(Γ,j)=⎧⎪ ⎪ ⎪ ⎪⎨⎪ ⎪ ⎪ ⎪⎩$0if j=0,$0if ∑iΓji=0,$(maxi:Γji=1\textscWin(Γ,i)−1)modkotherwise. We also use notation for the value of game . ### 2.3 Properties of Subtraction Games In this work we stick to the conventional terminology of [11, Section 2.3] and [9, Section 2.1], and use the following definitions. We call a game losing if the first player loses it assuming other players are optimal:  \textscWin(Γ)=$0. (1)

We call a game balanced if the values of

are uniformly distributed over the set

:

 ∀w:∣∣#{j:\textscWin(Γ,j)=$w}1≤j≤n−nk∣∣≤o(nk). (2) When considering a random balanced game we hereafter implicitly bear in mind the following procedure of picking a game: 1. Assign each position “ stones” one of the values from in the uniform fashion. 2. Assign position “ stones” value . 3. Initially assign . 4. For each position “ stones” with value put with probability whenever and position “ stones” is assigned one of the values . 5. Additionally, for each position “ stones” with value put for one such that position “ stones” is assigned value , whenever it was not already done in the previous step. 6. If the previous step failed because for some position “ stones” it is not possible to find a position “ stones” with the appropriate value, then start everything from the beginning. Should one feel that discarding in the last step essentially destroys the uniformity of , they can at the second step assign each position “ stones”, , value . This will make the last step obsolete, as no failure can occur, and will preserve the perfect uniformity. Our further observations are valid for either kind of picking a random balanced Subtraction game. Finally, we call a game restricted if in each position at most one move is possible:  ∀j:∑iΓji≤1. (3) ### 2.4 Computational Model To evaluate the complexity of a quantum algorithm, we use the standard form of the quantum query model. It is a generalization of the decision tree model of classical computation that is commonly used to lower bound the amount of time required by a computation. Let be an variable function we wish to compute on an input . We have an oracle access to the input — it is realized by a specific unitary transformation usually defined as where the register indicates the index of the variable we are querying, is the output register, and is some auxiliary work-space. An algorithm in the query model consists of alternating applications of arbitrary unitaries independent of the input and the query unitary, and a measurement in the end. The smallest number of queries for an algorithm that outputs with probability on all is called the quantum query complexity of the function and is denoted by . In this paper, as running time of an algorithm, we mean a number of queries to oracle. More information on quantum computation and query model can be found in [2, 1]. To distinguish ordinary deterministic and randomized complexities from the quantum complexity, they are traditionally called by one term classical complexity. ## 3 Balanced Subtraction Games ### 3.1 Classical Query Complexity In this subsection we limit our considerations with the number of players , for the sake of simplicity: • a player who cannot make a move at the end of a play gets ; • the previous player who managed to make the last move gets ; • the previous-to-previous player gets . All similar results also hold for arbitrary but require larger formulations, which in our mind are redundant for understanding. ###### Lemma 1. Let be a losing balanced Subtraction game picked uniformly at random. Let game differ from in exactly one random bit of their binary representations: . Then . ###### Proof. First, we mention the following three facts about balanced losing games. • Balancedness (2) of implies:  Prj[\textscWin(Γ,j)=$1]=Prj[\textscWin(Γ,j)=$0]=13. (4) • Losingness (1) of implies for each , :  either Γnj=0 or \textscWin(Γ,j)=$1, or both; (5)

otherwise the first player would be able to take stones in the first turn and thus have a positive payoff.

• Assuming to be picked at random, losingness (1) implies

 Pr[Γnj=1 ∣ \textscWin(Γ,j)=\$1]=12, (6)

since possibility or impossibility of a (worst possible) move which leads to position “ stones” with does not affect the value of any position.

Now let for some pair of indices picked at random, s.t. . Then we are interested in the value of

 Prj,i[\textscWin(Γ′)≠\textscWin(Γ)].

Let us consider four possible cases for and to evaluate this probability. Readers who only care about large values of , are welcome to skip all but the last case, as the former ones are highly unlikely to happen for random and .

1. , and .

Inversion of bit changes the value of game with certainty, since is losing (1), so and , but with can be won by taking all stones in the first turn:

 Pr[\textscWin(Γ′)≠\textscWin(Γ)]=1
2. , and .

implies that . Under this condition, inversion of bit changes the value of game from to :

 Pr[\textscWin(Γ′)≠\textscWin(Γ)]=23
3. , and .

implies that Here means that , and inversion of this bit changes the value of from to . And means that the value of is at least . These two facts together mean that inversion of bit changes the value of from to . Therefore:

 Pr[\textscWin(Γ′)≠\textscWin(Γ)]=16
4. .

implies that . Here means that , and inversion of this bit changes the value of from to . And means that the value of is at least . These two facts together mean that inversion of bit changes the value of from to . Therefore:

 Pr[\textscWin(Γ′)≠\textscWin(Γ)]=118

In either case we have that . ∎

###### Theorem 3.1.

There is no deterministic or randomized algorithm for solving function Win faster than in steps.

The proof of this theorem is next to the obvious implication of Lemma 1 and is identical to [11, Theorem 1]. We refer to the aforementioned work for the details and for the remarks on the eligibility of this proof, which are also relevant here.

### 3.2 Quantum Algorithm

In this subsection we suggest a quantum algorithm for solving an arbitrary -player Subtraction game. We assume the reader to be familiar with the basics of quantum computing and, in particular, with Grover Search algorithm [7, 3]. Among other problems, this algorithm is also applicable for searching in directed acyclic graphs (DAGs) [10, 4]. In this paper we apply it to Subtraction games which essentially are games on DAGs: if a game-representing binary is treated as an adjacency matrix of DAG , then its set corresponds to positions of the game, and its set corresponds to all the legal moves.

The algorithm determines an optimal move in each possible position, thus providing a strong solution of a game. But as we are interested in the value of only, we provide a solution which only returns the value of a game. The algorithm searches for the maximum among directly accessible vertices . This algorithm has two important properties:

• its expected running time is , where is the number of vertices directly accessible from the vertex ;

• it returns a vertex with the maximal value of Win with a constant probability (say ) if there exist one or more vertices with maximal values.

In Algorithm 1, we use Dürr-Høyer Algorithm [5] for minimum search in the form of Grover_Max subroutine which returns maximum value among its arguments. We store the search results in the array and reuse them in all the subsequent searches.

###### Theorem 3.2.

Algorithm 1 computes in expected running time and with error probability .

###### Proof.

The correctness of the algorithm is obvious: each of the variables (for running from to ) is assigned a value according to the definition of the function .

The time complexity follows from Cauchy-Bunyakovsky-Schwarz inequality:

 n∑j=1√degj≤n∑j=1√Ej[degj]=n∑j=1√|E|/n=√n|E|.

The probability of error in evaluating one particular is , so the probability of no error at all among evaluations of is .

We note that, for a random Subtraction game, the expected number of edges , and then we conclude that, while the best classical algorithms require time to solve a Subtraction game, there exists a polynomially faster quantum algorithm which runs in time .

#### The exact-time algorithm for a small number of players.

If is a small constant, one can apply a quantum algorithm that works in exact time (in contrast to Algorithm 1 which has the same evaluation for the expected running time). Algorithm 2 runs Grover’s Search times instead of running one search for the maximum. At the -th step the value is to be searched for among the values from the adjacent vertices, for running from down to . Obviously, the first found value is equal to the maximal payoff available in the considered position “ stones”. Subroutine in Algorithm 2 searches for the value among its arguments and returns with probability when there is such value, and otherwise. It has to be run times to amplify the probability of success in case if the arguments contain value .

###### Theorem 3.3.

If is a small constant, Algorithm 2 computes in exact running time and with error probability .

## 4 Restricted Subtraction Games

### 4.1 Concept of Solution

Restricted Subtraction games are, in some sense, degenerated, as players essentially have no choice in either position. Nevertheless, these games are of natural interest in terms of the computational complexity of Boolean functions. Namely, they became the first functions formulated in terms of a game, that demonstrate polynomial separation between exact quantum query complexity and classical query complexity.

We note that the adaptive deterministic query complexity of for a restricted Subtraction game is . The upper bound follows from a very simple analysis of Algorithm 3, the lower bound also is obvious.

Instead of computing for a restricted Subtraction game , [9]

aims for a more ambitious problem of solving all positions of a game, i.e. of finding vector

.

### 4.2 Classical Query Complexity

###### Theorem 4.1.

Classical query complexity of computing for a -player restricted Subtraction game is .

The proof is identical to one of [9, Theorem 1], which was formulated for the two-player games, but is valid also for the multiplayer games.

### 4.3 Quantum Algorithm

To solve a restricted Subtraction game, we modify Algorithm 1 according to the idea from [9]. We run exact Grover’s search for a non-zero element in each row. Exact Grover’s search [12] is a modification of Grover’s algorithm, which returns the position of the non-zero element in a binary string with Hamming weight 1, or if its Hamming weight is 0. It cannot handle strings with a bigger Hamming weight, but for the promised input, it works in exact time for an -bit binary string, and with no errors. Subroutine Exact_Grover of Algorithm 4 refers to the exact Grover’s search. In contrast to Algorithms 1 and 2, this subroutine has to be called just once as its result is exact and does not need to be amplified.

###### Theorem 4.2.

Algorithm 4 computes in exact running time and with no error.

The theorem follows from the properties of exact Grover’s search and the evaluation of as in the proof of Theorem 3.2.

## 5 Conclusion

Recent results in quantum game theory have stepped into the field of combinatorial games. In this work we generalized several of these results for solving multiplayer combinatorial games. In particular, we established several upper bounds for quantum query complexity, which generally correspond to the running time of a quantum algorithm. We also derived several classical lower bounds for these problems. We did not focus on the classical upper bounds, but they obviously coincide with the lower bounds, which can be shown just by describing the straightforward dynamic programming approach.

The polynomial separation between quantum and classical complexities was shown using different kinds of games and different concepts of solution, but all of them engage Subtraction games for the demonstration of the power of quantum algorithms in combinatorial game theory. Perhaps, one should expect better and more general bounds to emerge for the quantum complexity of solving Subtraction games. Of course, we hope also for detecting other examples of games with quantum-smaller-than-classical complexity.

### Acknowledgement

The research is supported by PostDoc Latvia Program, and by the ERDF within the project 1.1.1.2/VIAA/1/16/099 “Optimal quantum-entangled behavior under unknown circumstances”. The reported study was funded by RFBR according to the research project No.19-37-80008.

## References

• [1] F. Ablayev, M. Ablayev, H. J. Zhexue, K. Khadiev, N. Salikhova and D. Wu

On quantum methods for machine learning problems part I: Quantum tools

Big Data Mining and Analytics, 3(1):41–55, 2019.
• [2] Andris Ambainis. Understanding quantum algorithms via query complexity. arXiv preprint arXiv:1712.06349, 2017.
• [3] Michel Boyer, Gilles Brassard, Peter Høyer, and Alain Tapp. Tight bounds on quantum searching. Fortschritte der Physik, 46(4-5):493–505, 1998.
• [4] Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to Algorithms-Secund Edition. McGraw-Hill, 2001.
• [5] Dürr, C. and Høyer, P. A quantum algorithm for finding the minimum. arXiv:quant-ph/9607014, 1996.
• [6] Thomas S. Ferguson. Game theory class notes for math 167, fall 2000, 2000.
• [7] Lov K. Grover. A fast quantum mechanical algorithm for database search. In

Proceedings of the twenty-eighth annual ACM symposium on Theory of computing

, pages 212–219. ACM, 1996.
• [8] P. M. Grundy. Mathematics and games. Eureka, 2:6–8, 1939.
• [9] Y. Huang, Z. Ye, S. Zheng and L. Li. An Exact Quantum Algorithm for a Restricted Subtraction Game. International Journal of Theoretical Physics, 1–8, 2020.
• [10] Kamil Khadiev and Liliya Safina. Quantum algorithm for dynamic programming approach for dags. applications for zhegalkin polynomial evaluation and some problems on dags. In Proceedings of Unconventional Computation and Natural Computation 2019, LNCS. 2019.
• [11] K. Khadiev, D. Kravchenko and D.Serov. On the Quantum and Classical Complexity of Solving Subtraction Games. In Proceedings of CSR 2019, LNCS, 11532:228–236. 2019.
• [12] G.-L. Long. Grover algorithm with zero theoretical failure rate. Physical Review A, 64(2):022307. 2001.
• [13] R. P. Sprague. Über mathematische kampfspiele. Tohoku Mathematical Journal, 41:438–444, 1935.