Computational Hardness of Multidimensional Subtraction Games
CComputational Hardness of MultidimensionalSubtraction Games (cid:63)
V. Gurvich and M. Vyalyi National Research University Higher School of Economics Moscow Institute of Physics and Technology Dorodnicyn Computing Centre, FRC CSC RAS Rutgers University {vladimir.gurvich, vyalyi}@gmail.com
We study algorithmic complexity of solving subtraction games in a fixeddimension with a finite difference set. We prove that there exists a gamein this class such that any algorithm solving the game runs in exponentialtime. Also we prove an existence of a game in this class such that solvingthe game is PSPACE-hard.The results are based on the construction introduced by Larsson andW¨astlund. It relates subtraction games and cellular automata.
Keywords: subtraction games, cellular automata, computational hard-ness
An algorithmic complexity of solving combinatorial games is an important areaof research. There are famous games which can be solved efficiently. The mostimportant one is nim. The game was introduced by Bouton [8]. It can be solvedefficiently by using the theorem on Sprague-Grundy function for a disjunctivecompound (or, for brevity, sum) of games (see [2,9,15]). There are several gen-eralizations of nim solved by efficient algorithms: the Wythoff nim [24,13], theFraenkel’s game [12,13], the nim ( a, b ) game [3], the Moore’s nim [21,19,7], theexact ( n, k ) -nim with k (cid:62) n [5,7].There are ‘slow’ versions for both, Moore’s and exact nim [17,16]. In a slowversion a player can take at most one pebble from a heap. In [17] P-positions ofexact slow (3 , -nim were described. In [16] the (4 , -case was solved.Note that for many values of parameters the exact ( n, k ) -nim is not solvedyet and the set of P-positions looks rather complicated. The simplest example isthe exact (5 , -nim. Slow (5 , version of exact nim reveals a similar behavior.So, it was conjectured that there are no efficient algorithms solving thesevariants of nim. Now we have no clues how to prove this conjecture. (cid:63) The study has been funded by the Russian Academic Excellence Project ’5-100’.The second author was supported in part by RFBR grant 20-01-00645 and the stateassignment topic no. 0063-2016-0003. a r X i v : . [ c s . CC ] J a n V. Gurvich and M. Vyalyi
Looking for hardness results in solving combinatorial games, we see numerousexamples of
PSPACE -complete games, e.g. [22,10].For nim-like games, there are results on hardness of the hypergraph nim .Given a set [ n ] = { , . . . , n } and an arbitrary hypergraph H ⊆ [ n ] \ { ∅ } on theground set [ n ] , the game hypergraph nim NIM H is played as follows. By one movea player chooses an edge H ∈ H and reduces (strictly) all heaps of H . Obviously,the games of standard, exact and Moore’s nim considered above are specialcases of the hypergraph nim. For a position x = ( x , . . . , x n ) of NIM H its height h ( x ) = h H ( x ) is defined as the maximum number of successive moves that canbe made from x . A hypergraph H is called intersecting if H (cid:48) ∩ H (cid:48)(cid:48) (cid:54) = ∅ for anytwo edges H (cid:48) , H (cid:48)(cid:48) ∈ H . The following two statements were proven in [4,6]. Forany intersecting hypergraph H , its height and SG function are equal. Computingthe height h H ( x ) is NP -complete already for the intersecting hypergraphs withedges of size at most 4. Obviously, these two statements imply that, for the abovefamily of hypergraphs. computing the SG function is NP -complete too.Note that all hardness results mentioned above were established for games inunbounded dimension (the number of heaps is a part of an input).For a fixed dimension, there is a very important result of Larsson andW¨astlund [20]. They studied a wider class of games, so-called vector subtractiongames . These games were introduced by Golomb [14]. Later they were studiedunder a different name—invariant games [11]. Subtraction games include allversions of nim mentioned above. In these games, the positions are d -dimensionalvectors with nonnegative integer coordinates. The game is specified by a set of d -dimensional integer vectors (the difference set) and a possible move is a sub-traction of a vector from the difference set. Larsson and W¨astlund consideredsubtraction games of finite dimension with a finite difference set (MSG forbrevity).P-positions of a 1-dimensional MSG form a periodic structure [1]. It gives anefficient algorithm to solve such a game.In higher dimensions the MSG behave in a very complicated way. Larsson andW¨astlund proved in [20] that in some fixed dimension the equivalence problemfor MSG is undecidable.Nevertheless, this remarkable result does not answer the major questionabout efficient algorithms solving MSG. For example, there are polynomial timealgorithms solving the membership problem for CFL but the equivalence problemfor CFL is undecidable [18].In this paper we extend arguments of Larsson and W¨astlund and prove anexistence of a MSG such that any algorithm solving the game runs in exponentialtime. For this result we need no complexity-theoretic conjectures and derive itfrom the hierarchy theorem. Also, we prove by similar arguments an existence ofa MSG such that solving the game is PSPACE -hard. The latter result is notan immediate corollary of the former. It is quite possible that a language L isrecognizable only in exponential time but L is not PSPACE -hard.The rest of the paper is organized as follows. In Section 2 we introduce allconcepts used and present the main results. In Section 3 we outline main ideas omputational Hardness of Multidimensional Subtraction Games 3 of the proofs. The following sections contain a more detailed exposition of majorsteps of the proofs: in Section 4 we describe a simulation of a binary cellularautomaton by a subtraction game; Section 5 contains a discussion of convertinga Turing machine to a binary cellular automaton; Section 6 presents a way tolaunch a Turing machine on all inputs simultaneously. Finally, Section 7 containsthe proofs of main results. An impartial game of two players is determined by a finite set of positions , by theindicated initial position and by a set of possible moves. Positions and possiblemoves form vertices and edges of a directed graph. All games considered in thispaper are impartial. Also, we always assume that the graph of a game is DAG.Therefore, each play terminates after a finite number of moves.Here we restrict our attention to a normal winning condition : the playerunable to make a move loses.Recall the standard classification of positions of an impartial game. If a playerwho moves at a position x has a winning strategy in a game starting at theposition x , then the position is called N- position . Otherwise, the position is calledP- position . Taking in mind the relation with Sprague-Grundy function, we assignto a P-position the (Boolean) value and to an N-position the (Boolean) value .The basic relation between values of positions is p ( v ) = ¬ n (cid:94) i =1 p ( v i ) = n (cid:95) i =1 ¬ p ( v i ) = [ p ( v ) , . . . , p ( v n )] , (1)where the possible moves from the position v are to the positions v , . . . , v n .Using Eq. (1), it is easy to find values for all positions of a game in timepolynomial in the number of positions. We are interested in solving gamespresented by a succinct description. So, the number of positions is typically hugeand this straightforward algorithm to solve a game appears to be unsatisfactory. Now we introduce a class MSG of subtraction games. A game from this class iscompletely specified by a finite set D of d -dimensional vectors (the differenceset ). We assume that coordinates of each vector a ∈ D are integer and their sumis positive: d (cid:88) i =1 a i > . A position of the game is a d -dimensional vector x = ( x , . . . , x d ) with non-negative integer coordinates (informally, they are the numbers of pebbles in theheaps). A move from the position x to a position y is possible if x − y ∈ D . Ifa player is unable to make a move, then she loses. V. Gurvich and M. Vyalyi
Example 1.
The exact slow ( n, k ) -nim [17] is an n -dimensional subtraction gamewith the difference set consisting of all (0 , -vectors with exactly k coordinatesequal .Any subtraction game can be considered as a generalization of this example.In general case we allow to add pebbles to the heaps. But the total numberof pebbles should diminish at each move (the positivity condition above). Itguarantees that each play of a MSG terminates after finite number of moves.If a difference set is a part of an input, then it is easy to see that solvingof MSG is PSPACE -hard. To show
PSPACE -hardness we reduce solving ofthe game NODE KAYLES to solving a MSG. Recall the rules of the gameNODE KAYLES. It is played on a graph G . At each move a player puts a pebbleon an unoccupied vertex of the graph which is non-adjacent to any occupiedvertex. The player unable to make a move loses. It is known that solving NODEKAYLES is PSPACE -complete [22]. So,
PSPACE -hardness of solving MSG isan immediate corollary of the following proposition.
Proposition 2.
Solving of NODE KAYLES is reducible to solving of MSG.Proof.
Let G = ( V, E ) be the graph of NODE KAYELS. Construct a | E | -dimensional subtraction game with the difference set A G indexed by the verticesof G : D = { a ( v ) : v ∈ V } , where a ( v ) e = (cid:40) , the vertex v is incident to the edge e, , otherwise.We assume in the definition that the coordinates are indexed by the edges of thegraph G .Take a position with all coordinates equal . We are going to prove thatthis position is a P-position of the MSG A G iff the graph G is a P-position ofNODE KAYLES.Indeed, after subtracting a vector a ( v ) , coordinates indexed by the edgesincident to v are zero. It means that after this move it is impossible to subtractvectors a ( v ) and a ( u ) , where ( u, v ) ∈ E .On the other hand, if the current position is − (cid:88) v ∈ X a ( v ) and there are no edges between a vertex u and the vertices of the set X , thenthe subtraction of the vector a ( u ) is a legal move at this position.Thus, the subtraction game starting from the position is isomorphic to thegame NODE KAYLES on the graph G . (cid:117)(cid:116) In the sequel we are interested in solving of a particular MSG (the differenceset is fixed). In other words, we are going to determine algorithmic complexityof the language P ( D ) consisting of binary representations of all P-positions ( x , . . . , x d ) of the MSG with the difference set D .Our main result is unconditional hardness of this problem. omputational Hardness of Multidimensional Subtraction Games 5 Theorem 3.
There exist a constant d and a finite set D ⊂ N d such that anyalgorithm recognizing the language P ( D ) runs in time Ω (2 n/ ) , where n is theinput length. Also, we show that there are
PSPACE -hard languages P ( D ) . Theorem 4.
There exist a constant d and a finite set D ⊂ N d such that thelanguage P ( D ) is PSPACE -hard.
In the proofs we need a generalization of MSG—so-called k -modular MSGintroduced in [20]. A k -modular d -dimensional MSG is determined by k finitesets D , . . . , D k − of vectors in Z d . The rules are similar to the rules of MSG.But the possible moves at a position x are specified by the set D r , where r is theresidue of (cid:80) i x i modulo k . A notion of a Turing machine is commonly known. We adopt the definition ofTuring machines from Sipser’s book [23].Cellular automata are also well-known. But we prefer to provide the definitionsfor them.Formally, a cellular automaton (CA) C is a pair ( A, δ ) , where A is a finiteset (the alphabet ), and δ : A r +1 → A is the transition function . The number r is called the size of a neighborhood . The automaton operates on an infinitetape consisting of cells . Each cell carries a symbol from the alphabet. Thus,a configuration of C is a function c : Z → A .At each step CA changes the content of the tape using the transition function.If a configuration before the step is c , then the configuration after the step is c (cid:48) ,where c (cid:48) ( u ) = δ (cid:0) c ( u − r ) , c ( u − r + 1) , . . . , c ( u ) , . . . , c ( u + r − , c ( u + r ) (cid:1) . Note that changes are local: the content of a cell depends on the content of r + 1 cells in the neighborhood of the cell.We assume that there exists a blank symbol Λ in the alphabet and thetransition function satisfies the condition δ ( Λ, . . . , Λ ) = Λ (“nothing generatesnothing”). This convention guarantees that configurations containing only a finitenumber of non-blank symbols produce configurations with the same property.A 2CA (a binary CA) is a CA with the binary alphabet { , } . Due to relationwith games, it is convenient to assume that is the blank symbol in 2CAs.It is well-known that Turing machines can be simulated by CA with r = 1 and any CA can be simulated by a 2CA (with a larger size of a neighborhood).In the proofs we need some specific requirements on these simulations. They willbe discussed later in Section 5. V. Gurvich and M. Vyalyi
Both Theorems 3 and 4 are proved along the same lines.1. Choose a hard language L and fix a Turing machine M recognizing it.2. Construct another machine U which simulates an operation of M on allinputs in parallel (a realization of this idea is discussed in Section 6).3. The machine U is simulated by a CA C U . The cellular automaton C U issimulated in its turn by a 2CA C (2) U (see Section 5 for the details). And this C (2) U is simulated by d -dimensional MSG D U (see Section 4), where d dependson C (2) U .4. It is important that the result of operation of M on an input w is completelydetermined by the value of a specific position of D U and this position iscomputed in polynomial time. So, it gives a polynomial reduction of thelanguage L to P ( D U ) .5. Now a theorem follows from a hardness assumption on the language L . In this section we follow the construction of Larsson and W¨astlund [20] withminor changes.
Let C = ( { , } , δ ) be a 2CA. The symbol is assumed to be blank: δ (1 , . . . ,
1) = 1 .We are going to relate evolution of C starting from the configuration c (0) =( . . . . . . ) with the values p ( x ) of positions of a 2-dimensional N -modularMSG D (cid:48) C . The value of N depends on C and we will choose it greater than r .The exact form of the relation is as follows. Time arrow is a direction (1 , in the space of game positions, while the coordinate along the automaton tape isin the direction (1 , − .The configuration of C at moment t corresponds to positions on a line x + x = 2 N t . The cell coordinate is u = ( x − x ) / , as it shown in Fig. 1 ( N = 1 ).For the configuration ( . . . . . . ) we assume that has the coordinate onthe automaton tape.The relation between the content of the automaton tape and the values ofpositions of the game D (cid:48) C is c ( t, u ) = p ( N t + u, N t − u ) for | u | (cid:54) N t. (2)The choice of the initial configuration implies that if | u | > N t > rt , then c ( t, u ) = 1 . To extend the relation to this area, we extend the value function p ( x , x ) by setting p ( x , x ) = 1 if either x < or x < . In other words, weintroduce dummy positions with negative values of coordinates. These positions omputational Hardness of Multidimensional Subtraction Games 7 x x c ( , ) c ( , ) c ( , ) c ( , ) c ( , ) c ( , ) c ( , − ) c ( , − ) c ( , − ) c ( , ) c ( , ) c ( , ) c ( , − ) Fig. 1.
Encoding configurations of 2CA by positions of a modular MSG are regarded as terminal and having the value . Note that for the game evaluationfunctions [ . . . ] the equality [ p , . . . , p k , , . . . ,
1] = [ p , . . . , p k ] holds, i.e. extraarguments with the value do not affect the function value. So, the dummypositions do not change the values of real positions of a game.The starting configuration c (0) = ( . . . . . . ) satisfies this relation for anygame: the position (0 , is a P-position.To maintain the relation (2), we should choose an appropriate modulus anddifference sets.Note that the Boolean functions [ p , . . . , p n ] defined by Eq. (1) form a completebasis: any Boolean function is represented by a circuit with gates [ . . . ] . It isenough to check that the functions from the standard complete basis can beexpressed in the basis [ . . . ] : ¬ x = [ x ] , x ∨ y = [[ x ] , [ y ]] , x ∧ y = [[ x, y ]] . Now take a circuit in the basis [ . . . ] computing the transition function of the2CA C . The circuit is a sequence of assignments s , . . . , s N of the form s j := [ list of arguments ] , where arguments of the j th assignment may be the input variables or the valuesof previous assignments s i , i < j . The value of the last assignment s N coincideswith the value of the transition function δ ( u − r , . . . , u − , u , u , . . . , u r ) .For technical reasons we require that the last assignment s N does not containthe input variables u i . It is easy to satisfy this requirement: just start a circuitwith assignments in the form s i + r +1 = [ u i ] ; s i +3 r +2 = [ s i + r +1 ] , where − r (cid:54) i (cid:54) r ,and substitute a variable u i in the following assignments by s i +3 r +2 . The circuitsize of the modified circuit is obviously greater than r . V. Gurvich and M. Vyalyi
We extend the relation (2) to intermediate positions in the following way p ( N t + i, N t − i ) = c ( t, i ) ,p ( N t + i + j, N t − i + j ) = s j , (cid:54) j < N, (3)where s j is the value of j th assignment of the circuit for the input variablesvalues c ( t, i − r ) , . . . , c ( t, i ) , . . . , c ( t, i + r ) . Proposition 5.
There exist sets D j such that the relation (3) holds for valuesof the modular game D (cid:48) C with the difference sets D j .Proof. For each line x + x = 2 N t +2 j we specify the difference set D j accordingto the arguments of an assignment s j . The sets with odd indices are unimportantand may be chosen arbitrary.If an input variable u k is an argument of the assignment s j , then we includein the set D j the vector ( j − k, j + k ) . Since ( N t + i + j, N t − i + j ) = ( N t + i + k, N t − i − k ) + ( j − k, j + k ) , it guarantees that there exists a legal move from the position ( N t + i + j, N t − i + j ) to the position ( N t + i + k, N t − i − k ) .If the value of an intermediate assignment s k is an argument of the assignment s j , then we include in the set D j the vector ( j − k, j − k ) . It guarantees thatthere exists a move from the position ( N t + i + j, N t − i + j ) to the position ( N t + i + k, N t − i + k ) .The rest of the proof is by induction on the parameter A = 2 N t + 2 i , where t (cid:62) , (cid:54) i < N . For A = 0 we have t = 0 and i = 0 . So the relation (3) holds asit explained above. Now suppose that the relation holds for all lines x + x = A (cid:48) , A (cid:48) < N t + 2 j . To complete the proof, we should verify the relation on the line x + x = 2 N t + 2 j . From the construction of the sets D j and the inductionhypothesis we conclude that p ( N t + i + j, N t − i + j ) = [ arguments of the assignment s j ] . Here arguments of the assignment s j are the values of the input variables and thevalues of previous assignments in the circuit computing the transition function δ ( c ( t, u − r ) , . . . , c ( t, u ) , . . . , c ( t, u + r )) .The last touch is to note that the value of the N th assignment is just thevalue c ( t + 1 , u ) = δ ( c ( t, u − r ) , . . . , c ( t, u ) , . . . , c ( t, u + r )) . (cid:117)(cid:116) Note that the game D (cid:48) C has the property: if there is a legal move from ( x , x ) to ( y , y ) , then either x + x ≡ N ) or the residue of ( y , y ) modulo N is less than the residue of ( x , x ) (we assume the standard representativesfor residues: , , . . . , N − ). Also, x + x (cid:54)≡ y + y (mod 2 N ) since the inputvariables are not arguments of the final assignment. omputational Hardness of Multidimensional Subtraction Games 9 (2 N + 2) -dimensionalSubtraction Game To exclude modular conditions we use the trick suggested in [20].Using the 2-dimensional modular game D (cid:48) C constructed above we construct a (2 N + 2) -dimensional MSG D C with the difference set D = (cid:8) ( a , a , N (cid:1) + e ( j ) − e ( k ) : ( a , a ) ∈ D j , k = j − a − a (mod 2 N ) (cid:9) . Here e ( i ) is the ( i + 2) th coordinate vector: e ( i ) i +2 = 1 , e ( i ) s = 0 for s (cid:54) = i + 2 . Proposition 6.
The value of a position ( x , x , N ) + e (2 r ) of the game D C equals the value of a position ( x , x ) of the modular game D (cid:48) C if r ≡ x + x (mod 2 N ) .Proof. Induction on t = x + x . The base case t = 0 is due to the convention onthe values of dummy positions (with negative coordinates).The induction step. A legal move at a position ( N t + i + j, N t − i + j, N )+ e (2 j ) is to a position ( N t + i + j, N t − i + j, N ) − ( a , a , N ) + e (2 s ) , where s ≡ j − a − a (mod 2 N ) and ( a , a ) ∈ D j . It corresponds to a move from ( N t + i + j, N t − i + j ) to ( N t + i + j − a , N t − i + j − a ) in the modulargame. (cid:117)(cid:116) From Propositions 5 and 6 we conclude
Corollary 7.
For any 2CA C there exist an integer N and a (2+2 N ) -dimensionalMSG D C such that the relation c ( t, u ) = p ( N t + u, N t − u, , , . . . , , holds for | u | (cid:54) N t.
In this section we outline a way to simulate a Turing machine by a binary cellularautomaton. It is a standard simulation, but we will put specific requirements.Let M = ( Q, { , } , Γ, Λ, δ M , , , be a Turing machine, where Q = { , . . . , q } , q (cid:62) , is the set of states, the input alphabet is binary, Γ = { , , . . . , (cid:96) } is thetape alphabet, (cid:96) > is the blank symbol, δ M : Q × Γ → Q × Γ × { +1 , − } is thetransition function, and , , are the initial state, the accept state, the rejectstate respectively.We encode a configuration of M by a doubly infinite string c : Z → A , where A = { , . . . , q } × { , . . . , (cid:96) } , indicating the head position by a pair ( q, a ) , q > , a ∈ Γ ; the content of any other cell is encoded as (0 , a ) , a ∈ Γ .Let c , . . . , c t , . . . be a sequence of encoded configurations produced by M from the starting configuration c . It is easy to see that c t +1 ( u ) is determined by c t ( u − , c t ( u ) , c t ( u + 1) . In this way we obtain the CA C M = ( A, δ C ) over thealphabet A with the transition function δ C : A → A simulating operation of M in encoded configurations. It is easy to see that Λ = (0 , (cid:96) ) is the blank symbol: δ C ( Λ, Λ, Λ ) = Λ .The next step is to simulate C M by a 2CA C (2) M . For this purpose we usean automaton C (cid:48) M = ( A (cid:48) , δ (cid:48) C ) isomorphic to C M , where A (cid:48) = { , . . . , L − } and L = ( | Q | + 1) · | Γ | . The transition function δ (cid:48) C is defined as follows δ (cid:48) C ( i, j, k ) = π ( δ C ( π − ( i ) , π − ( j ) , π − ( k ))) , where π : A → A (cid:48) is a bijection. To keep a relation between the starting configu-rations we require that π ( Λ ) = 0 , π ((1 , (cid:96) )) = 1 . Recall that is the initial stateof M and (cid:96) is the blank symbol of M .To construct the transition function of C (2) M we encode symbols of A (cid:48) bybinary words of length L + 2 as follows ϕ ( a ) = 1 L − a a . In particular, ϕ (0) = ϕ ( π ( Λ )) = 1 L +2 and ϕ (1) = ϕ ( π (1 , (cid:96) )) = 1 L . Theencoding ϕ is naturally extended to words in the alphabet A (cid:48) (finite or infinite).Thus the starting configuration of M with the empty tape corresponds to theconfiguration . . . . . . of C (2) M . Recall that is the blank symbol of C (2) M .With an abuse in notation, we denote below by ϕ the extended encodingof configurations in the alphabet A (cid:48) by doubly infinite binary words. We alignconfigurations in the following way: if i = q ( L + 2) + k , (cid:54) k < L + 2 , then ϕ ( c )( i ) is a k th bit of the ϕ ( c ( q )) .The size of a neighborhood of C (2) M is r = 2( L + 2) . To define the transitionfunction δ (2) M we use a local inversion property of the encoding ϕ : looking at the r -neighborhood of an i th bit of ϕ ( c ) , where i = q ( L +2)+ k , (cid:54) k < L +2 , one canrestore symbols c ( q − , c ( q ) , c ( q + 1) and the position k of the bit provided theneighborhood contains zeroes ( is the non-blank symbol of C (2) M ). Note that if theneighborhood of a bit does not contain zeroes, then the bit is a part of encodingof the blank symbol of C (cid:48) M and, moreover, c ( q −
1) = c ( q ) = c ( q + 1) = 0 . Lemma 8.
There exists a function δ (2) C : { , } r +1 → { , } such that a 2CA C (2) M = ( { , } , δ (2) C ) simulates C (cid:48) M : starting from b = . . . . . . , it producesthe sequence of configurations b , b , . . . such that b t = ϕ ( c t ) for any t , where ( c t ) is the sequence of configurations produced by C (cid:48) M starting from the configuration c = . . . . . . Proof.
The function δ (2) C should satisfy the following property. If b = ϕ ( c ) , then δ (2) C (cid:0) ( b ( i − r ) , . . . , b ( i ) , . . . , b ( i + r ) (cid:1) = ϕ (cid:0) δ (cid:48) C (cid:0) c ( q − , c ( q ) , c ( q + 1)) (cid:1) ( k ) (4)for all integer i = q ( L + 2) + k , (cid:54) k < L + 2 . This property means that applyingthe function δ (2) C to b produces the configuration b = ϕ ( c ) , where c is theconfiguration produced by the transition function δ (cid:48) C from the configuration c . omputational Hardness of Multidimensional Subtraction Games 11 Therefore the sequence of configurations produced by C (2) M starting at ϕ ( c ) isthe sequence of the encodings of configurations c t produced by C (cid:48) M starting at c .Note that ϕ ( c ( q − , ϕ ( c ( q )) and ϕ ( c ( q + 1)) are in the r -neighborhood ofa bit i .Thus, from the condition on blank symbols in the alphabets A (cid:48) and { , } ,we conclude the required property holds if the r -neighborhood of a bit i doesnot contain zeroes (non-blank symbols of C (2) M ). In this case the i th bit of b is a part of encoding of the blank symbol in the alphabet A (cid:48) and, moreover, c ( q −
1) = c ( q ) = c ( q + 1) = 0 .Now suppose that the r -neighborhood of the i th bit contains zeroes. Take thenearest zero to this bit (either from the left or from the right) and the maximalseries a containing it. The series is a part of the encoding of a symbol in c .So, there are at least L − a ones to the left of it. They all should be in the r -neighborhood of the bit. Thus we locate an encoding of a symbol c ( q + q (cid:48) ) , q (cid:48) ∈ {− , , +1 } , and we are able to determine q (cid:48) (depends on relative positionof the i th bit with respect to the first bit of the symbol located). So, the symbols c ( q − , c ( q ) , c ( q + 1) can be restored from the r -neighborhood of the i th bit.Moreover, a relative position k of the i th bit in ϕ ( c ( q + q (cid:48) )) can also be restored.Because the symbols c ( q − , c ( q ) , c ( q +1) and the position k are the functionsof the r -neighborhood of the bit i , it is correct to define the function δ (2) C as δ (2) C (cid:0) u − r , . . . , u , . . . , u r (cid:1) = ϕ (cid:0) δ (cid:48) M ( c ( q − , c ( q ) , c ( q + 1)) (cid:1) ( k ) if the restore process is successful on ( u − r , . . . , u , . . . , u r ) ; for other arguments,the function can be defined arbitrary. It is clear that this function satisfies theproperty (4). (cid:117)(cid:116) The last construction needed in the main proofs is a Turing machine U simulatingan operation of a Turing machine M on all inputs . The idea of simulation iswell-known. But, again, we need to specify some details of the construction.We assume that on each input of length n the machine M makes at most T ( n ) > n steps.The alphabet of U includes the set A = { , . . . , q }×{ , . . . , (cid:96) } (we use notationfrom the previous section) and additional symbols.The machine U operates in stages while its tape is divided into zones . Thezones are surrounded by the delimiters, say, (cid:47) and (cid:46) . We assume that (cid:47) is placedto the cell . Also the zones are separated by a delimiter, say, (cid:5) . An operation of M on a particular input w is simulated inside a separate zone.Each zone consists of three blocks. as pictured in Fig. 2.The first block of a zone has the size . It carries (0 , iff M accepts the inputwritten in the second block. Otherwise it carries (0 , . The last block containsa configuration of M represented by a word over the alphabet A as described inSection 5. Blocks in a zone are separated by a delimiter, say result input work place n n + 2 T ( n ) Fig. 2.
A zone on the tape of U At start of a stage k there are k − zones corresponding to the inputs w , w , . . . , w k − of M . We order binary words by their lengths and words of equallength are ordered lexicographically. The last block of a zone i contains theconfiguration of M after running k − − i steps on the input w i .During the stage k , the machine U moves along the tape from (cid:47) to (cid:46) and ineach zone simulates the next step of operation of M . At the end of the stage themachine U writes a fresh zone with the input w k and the initial configurationof M on this input. The initial configuration is extended in both directions bywhite space of size T ( n ) , as it shown in Fig. 3. w k (0 , . . . (0 , , w k, )(0 , w k, ) . . . (0 , w k,n )(0 , . . . (0 , n n + 2 T ( n ) Fig. 3.
A fresh zone on the stage k When an operation of M on an input w k is finished, the machine U updatesthe result block and does not change the zone on subsequent stages.In reductions below we need U satisfying specific properties. Proposition 9. If T ( n ) = C n k for some integer constants C (cid:62) , k (cid:62) , thenthere exists U operating as it described above such that1. U produces the result of operation of M on input w in time < n k , where n = | w | .2. The head U visits the first blocks of zones only on steps t that are divisibleby .Proof. Recall that operation of the machine U is divided in stages.During the stage k , the machine U moves along the tape from the left tothe right and in each zone simulates the next step of operation of M . At theend of the stage the machine U writes a fresh zone with the input w k and theinitial configuration of M on this input. The configuration is extended in bothdirections by white space of size T ( n ) .At first, we show how to construct a machine U (cid:48) satisfying the property 1.More exactly, we explain how to construct a machine satisfying the followingclaims. Claim 1.
Updating a configuration of the simulated machine M into a zonetakes a time O ( S ) , where S is the size of the zone. omputational Hardness of Multidimensional Subtraction Games 13 A straightforward way to implement the update is the following. The head of U (cid:48) scans the zone until it detects a symbol ( q, a ) with q > . It means that thehead of the simulated machine M is over the current cell. Then U (cid:48) updates theneighborhood of the cell detected with respect to the transition function of M .After that U (cid:48) continues a motion until it detects the next zone.If a machine M finishes its operation on a configuration written in the currentzone, then additional actions should be done. The machine U (cid:48) should update theresult block. For this purpose it returns to the left end of the zone, updates theresult block and continues a motion to the right until it detects the next zone.So, each cell in the zone is scanned O (1) times. The total time for update is O ( S ) . Claim 2.
A fresh zone on the stage k is created in time O ( n k T ( n )) , where n = | w k | .Creation of the result block takes a time O (1) .To compute the next input word the machine U (cid:48) copies the previous input intothe second block of the fresh zone. The distance between positions of the secondblocks is | w k − | + 2 T ( | w k − | ) = O ( T ( n )) . Here we count three delimitersoccuring between the blocks and use the assumption that T ( n ) > n . The machine U (cid:48) should copy at most n symbols. So, the copying takes a time O ( nT ( n )) .After that, the machine U (cid:48) computes the next word in the lexicographicalorder. It can be done by adding modulo | w k − | to bin( w k − ) , where bin( w ) isthe integer represented in binary by w (the empty word represents 0). It requiresa time O ( n ) . If an overflow occurs, then the machine should write an additionalzero. It also requires a time O ( n ) .To mark the third block in the fresh zone the machine U (cid:48) computes a binaryrepresentation of T ( n ) by a polynomial time algorithm using the second block asan input to the algorithm (thus, n is given in unary). Then it makes T ( n ) stepsto the right using the computed value as a counter and decreasing the countereach step. The counter should be moved along a tape to save a time. The lengthof binary representation of T ( n ) is O ( n k ) . So, each step requires O ( n k ) time andtotally marking of T ( n ) free space requires O ( n k T ( n )) time.Then U (cid:48) copies the input word w k to the right of marked free space. It requires O ( nT ( n )) time. The first cell of the copied word should be modified to indicatethe initial state of the simulated machine M . And, finally, it repeat the markingprocedure to the right of the input.The overall time is O ( n k T ( n )) .Let us prove the property 1 is satisfied by the machine U (cid:48) . Counting timein stages, the zone corresponding to an input word w of length n appears after (cid:54) n +1 stages. After that the result of operation of M appears after (cid:54) T ( n ) stages.Let s = | w k | . At stage k there are at most s +1 zones. Updating the existingzones requires time O (2 s ( s + T ( s ))) due to Claim 1. Creation of a fresh zonerequires time O ( s k T ( s )) due to Claim 2. Thus, the overall time for a stage is O (cid:0) s +1 ( s + T ( s )) + s k T ( s ) (cid:1) = O (2 s T ( s )) . Therefore, the result of operation of M appears in time O (cid:0) (2 n +1 + T ( n )) T ( n ) (cid:1) = O (2 n k ) < n k for sufficiently large n .Now we explain how to modify the machine U (cid:48) to satisfy the property 2. Notethat the result block of a zone is surrounded by delimiters: (cid:47) or (cid:5) to the left.We enlarge the state set of U (cid:48) adding a counter modulo 3. It is increased by +1 each step of operation. If the head of a modified machine U is over the (cid:47) or (cid:5) and U (cid:48) should go to the right, then the machine U makes dummy moves in theopposite direction and back to ensure that it visits the cell to the right on a step t divisible by 3. In a similar way the machine U simulates the move to the leftfrom the cell carrying the delimiter (cid:117)(cid:116) Proof (of Theorem 3).
Time hierarchy theorem [23] implies that
DTIME (2 n/ ) ⊂ DTIME (2 n ) . Take a language L ∈ DTIME (2 n ) \ DTIME (2 n/ ) . For someconstant C there exists a Turing machine M recognizing L such that M makesat most T ( n ) = C n steps on inputs of length n .Apply the construction from Section 6 and Proposition 9 to construct themachine U . Then convert U into 2CA C (2) U as it described in Section 5. We putan additional requirement on the bijection π , namely, π (0 , (0 , L − . Itlocates the result of computation of M in the third bit of the encoding of theresult block.Finally, construct O (1) -dimensional MSG D C as it described in Section 4.The dimension N + 2 of the game is determined by the machine M .Due to Corollary 7 the symbol c ( t, u ) on the tape of C (2) U equals the value ofposition ( N t + u, N t − u, , , . . . , , of the game.Suppose that we have an algorithm A to solve the game D C in time T A ( m ) .Consider the following algorithm recognizing L .On an input w of length n do:1. Compute the number k of the zone corresponding to the input w of length n .2. Compute the position u of the bit carrying the result of computation of M on input w in the image of the result block of the zone k .3. Set t = 2 n .4. Apply the algorithm A to compute the value of the position ( N t + u, N t − u, , , . . . , , of the game and return the result.Correctness of the algorithm is ensured by previous constructions and by theproperty 2 of Proposition 9. The latter guarantees that at moment t = 2 n the omputational Hardness of Multidimensional Subtraction Games 15 head of U is not on the result block. Thus the third bit of the encoding of theblock is iff M accepts w .It can be easily verified (see Proposition 10 below) that the first two steps ofthe algorithm can be done in time poly( n ) and u = O (2 n ) . The property 1 ofProposition 9 ensures that U produces the result of M on the input w in time < n for sufficiently large n .Thus, the total running time of the algorithm is at most poly( n ) + T A (5 n ) .But by choice of L it is Ω (2 n/ ) . We conclude that T A ( m ) = Ω (2 m/ ) . (cid:117)(cid:116) To complete the proof of Theorem 3, we provide the proof of a technical claimmade.
Proposition 10.
The first two steps of the algorithm in the proof of Theorem 3can be done in time poly( n ) for T ( n ) = C n k and u = O (2 n ) if T ( n ) = C n .Proof. For the first step, note that k = 2 n + bin( w ) . Indeed, there are n − shorter words, all of them precede w in the ordering of binary words we use. Alsothere are exactly bin( w ) words of length n preceding the word w . The formulafor k follows from these observations (note that we count words starting from 1).It is quite obvious now that k is computed in polynomial time.For the second step, we should count the sizes of zones preceding the zonefor w and add a constant to take into account delimiters. Let count the size of azone including the delimiter to the left of it. Then the size of a zone for an inputword of length (cid:96) is (cid:96) + 1 + (cid:96) + 2 T ( (cid:96) ) = 4 + 2 (cid:96) + 2 T ( (cid:96) ) . There are (cid:96) words of length (cid:96) . Thus, the total size of the zones preceding thezone of w is S = n − (cid:88) (cid:96) =0 (cid:96) (4 + 2 (cid:96) + 2 T ( (cid:96) )) + bin( w )(4 + 2 n + 2 T ( n )) + 2 For T ( n ) = C n k this expression can be computed in polynomial time in n by a straightforward procedure (the expression above has poly( n ) arithmeticoperations and the results of these operations are integers represented in binaryby poly( n ) bits).Thus, the result block of the zone of w is S + 1 (the delimiter to the left ofthe zone adds 1).To compute u we should multiply S +1 by L = O (1) (the size of encoding) andadd 3 (because the third bit indicates the result of computation of the simulatedmachine M ).All these calculations can be done in polynomial time. If T ( n ) = C n , thenwe upperbound u as follows u (cid:54) L (cid:0) n n (4 + 2 n + 2 C n ) + 2 n (4 + 2 n + 2 C n ) + 3 (cid:1) + 3 = O (2 n ) . (cid:117)(cid:116) Proof (of Theorem 4).
Take a
PSPACE -complete language L and repeat ar-guments from the previous proof using an upper bound T ( n ) = C n k of therunning time of a machine M recognizing L . The bound follows from the standardcounting of the number of configurations in an accepting computation usingpolynomial space.At the step 3 set t = 2 n k . It gives a polynomial reduction of L to P ( D C ) : w (cid:55)→ ( N t + u, N t − u, , , . . . , , . (cid:117)(cid:116) References
1. Albert, M., Nowakowski, R., Wolfe, D.: Lessons in Play: An Introduction to Com-binatorial Game Theory. Taylor & Franscis, Abington (2007)2. Berlekamp, E.R., Conway, J.H., Guy, R.K.: Winning ways for your mathematicalplays. Vol. 1–4. A.K. Peters, Natick, MA (2001-2004)3. Boros, E., Gurvich, V., Oudalov, V.: A polynomial algorithm for a two parameterextension of Wythoff NIM based on the Perron-Frobenius theory. Int J. GameTheory 42(4), 891–915 (2013)4. Boros, E., Gurvich, V., Ho, N.B., Makino, K., Mursic, P.: Tetris hypergraphs andcombinations of impartial games. CoRR abs/1701.02819 (2017), http://arxiv.org/abs/1701.02819
5. Boros, E., Gurvich, V., Ho, N.B., Makino, K., Mursic, P.: On the Sprague-Grundyfunction of exact k -nim. Discrete Appl. Math. 239, 1–14 (2018)6. Boros, E., Gurvich, V., Ho, N.B., Makino, K., Mursic, P.: Sprague-Grundy functionof matroids and related hypergraphs. Theoretical Computer Science 799, 40–58(2019)7. Boros, E., Gurvich, V., Ho, N.B., Makino, K., Mursic, P.: Sprague-Grundy functionof symmetric hypergraphs. Journal of Combinatorial Theory, Series A 165, 176–186(2019)8. Bouton, C.L.: Nim, a game with a complete mathematical theory. Ann. of Math.,2nd Ser. 3, 35–39 (1901–02)9. Conway, J.H.: On numbers and games. Acad. Press, London, New York, SanFrancisco (1976)10. Demaine, E.D., Hearn, R.A.: Playing games with algorithms: Algorithmic combina-torial game theory. CoRR abs/cs/0106019v2 (2008), http://arxiv.org/abs/cs/0106019v2
11. Duchˆene, E., Rigo, M.: Invariant games. Theoret. Comput. Sci. 411, 3169–3180(2010)12. Fraenkel, A.: How to beat your Wythoff games’ opponent on three fronts. Amer.Math. Monthly 89, 353–361 (1982)13. Fraenkel, A.: Wythoff games, continued fractions, cedar trees and fibonacci searches.Theoretical Computer Science 29, 49–73 (1984)14. Golomb, S.W.: A mathematical investigation of games of “take-away”. J. Combin.Theory 1(4), 443–458 (1966)15. Grundy, P.M., Smith, C.: Disjunctive games with the last player loosing. Proc.Cambridge Philos. Soc. 52, 527–533 (1956)16. Gurvich, V., Heubach, S., Ho, N.B., Chikin, N.: Slow k -nim. Integers. ElectronicJournal of Combinatorial Number Theory (to appear)17. Gurvich, V., Ho, N.B.: Slow k -nim. RUTCOR Research Report RRR-03-2015 (2015)omputational Hardness of Multidimensional Subtraction Games 1718. Hopcroft, J.E., Motwani, R., Ullman, J.D.: Introduction to Automata Theory,Languages, and Computation (3rd Edition). Addison-Wesley Longman PublishingCo., Inc., Boston, MA, USA (2006)19. Jenkyns, T., Mayberry, J.: The skeletion of an impartial game and the Nim-Functionof Moore’s Nim kk