"Minesweeper" and spectrum of discrete Laplacians
The paper is devoted to a problem inspired by the "Minesweeper" computer game. It is shown that certain configurations of open cells guarantee the existence and the uniqueness of solution. Mathematically the problem is reduced to some spectral proper…
Authors: Oleg German, Evgeny Lakshtanov
Minesw eep er and sp ectrum of discrete Laplacians O.German ∗ E.Laksh tano v † Abstract The pap er is dev oted to a problem inspired b y the Minesw eep er computer game. I t is sho wn that certain congurations of op e n cells guaran tee the existence and the uniqueness of solution. Mathemat- ically the problem is reduced to some sp ectral prop erties of discrete dieren ti a l op erators. It is sho wn ho w the uniqueness can b e used to create a new game whic h p reserv es the spirit of Minesw eep er but do es not require a computer. 1 P ap er Minesw eep er: history There is a certain class of mathematical problems whic h , b e ing quite dicult to solv e for an adult math e matician in their most general setting, can b e understo o d and ev e n b e approac hed to in some particul ar cases b y little kids. This pap er i s dev oted to a problem of suc h a kind. Ev eryb o dy kno ws the Minesw eep e r computer game. A subset of a rectangular table is lled with mines and in ev ery spare cell the n um b er of neigh b ouring mines is indicated. The general problem can b e form ulated as follo ws: giv en a subset of the spare part of the table with the corresp onden t n um b ers of neigh b ouring mines, is th e re a unique w a y to reconstruct th e original distribution of mines? ∗ Mosco w State Univ ersit y , Russia. This researc h w as supp orted b y RFBR (gran t N ◦ 060100518) and gran t of the Presiden t of Russian F ederation N ◦ MK4466.2008.1. † Departmen t of M athematics, A v ei r o Univ ersit y , A v eiro 3810, P ortu g al. This researc h w as supp ort e d b y Centr e for R ese ar ch on Optimization and Contr ol (CEOC) from the F un da c ao p ar a a Ci encia e a T e cnolo gia (F CT), conanced b y the Europ ean Com- m unit y F und FEDER/POCTI, and b y F CT resea r c h pro jec ts PTDC/MA T/72840/2006, PTDC/MA T/103197/20 08. 1 This problem in some simple cases can b e us e d v ery fruitfully when teac h- ing mathem at i cs in primary sc ho ol, since it allo ws to do it while pla ying and do es not actually require a computer. The rst exp erience of this kind b e- longs to the second author, who prop osed for his pupils to reconstruct the distribution of mines in tables of the foll o wing t yp e: 2 2 2 1 2 1 2 1 1 1 The result w as v ery successful, our colleagues in sev eral A v ei r o sc ho ols started using suc h tasks. The only practical problem w e had w as c reating new tables so that the distribution of mines w ould b e determi n e d uniquely b y the op en area (this simplies c hec king whether the solution is correct) and that the solution w ould not b e to o easy . Ev en tually , w e found a form of t he set to b e op en that guaran tees t he existence of a unique solution, n di ng whic h in most cases requires some though t. As an op en set w e prop ose to tak e the set of staggered cells of the initi al table, in the form of a c hess table. In what follo ws w e state and pro v e the corresp onding theorem. 2 F ormal desc ription of the game. In the rs t v ersion of the presen t pap er [1] w e restricted ourselv es to the case of rectangular elds as it is in the classical computer Minesw eep er game. No w w e decide rst to giv e a formal description of P ap er Minesw eep er. The reason for suc h a formalization is that, as our exp erie nce with dieren t t yp es of elds sho ws, the spirit of the game is not strictly connected with the rectangularit y of the eld. P articularly , our exp erience with tables based on the triangle tiling of the plane sh o ws that the pap er v ersion of this game encoun ters situations t ypical for the computer Minesw eep er game. 2 2.1 General c a se Let G b e a nite undirected graph 1 , with v ertex set V ( G ) and edge se t E ( G ) . W e sa y that t w o v ertices u, v ∈ V ( G ) are neighb ors , if they are connected b y an edge, that is, i f uv ∈ E ( G ) . Th us, for ev ery v ∈ V ( G ) w e can dene its neighb orho o d , N G ( v ) , as the the set of neigh b ors N G ( v ) = { w ∈ V : v w ∈ E ( G ) } . A pair ( A, f ) , where A ⊂ V ( G ) and f : A → { 0 } ∪ N , is called an op ening if there is a subset M ⊂ V ( G ) \ A , suc h that for ev ery v ∈ A , f ( v ) = | N G ( v ) ∩ M | , v ∈ A. By solving an op ening ( A, f ) w e shall mean nding the corresp onding set M . Resp ectiv ely , A will b e called the set of op en c el ls and M will b e called the set of mines . Denition 1. An op ening ( A, f ) is calle d a table for Pap er Mineswe ep er if and only if it admits a unique solution. Uniqueness of the solution giv es the p ossibilit y to compare th e obtained answ er with the righ t one. Besides that, it mak es the game deterministic, i.e. the presence or the absence of a mine in eac h cell is predetermi ned. T o prepare a table one can use the follo wing algorithm: F or eac h t w o subsets A ⊂ V ( G ) , M ⊆ V ( G ) \ A w e can de ne a function f ( A,M ) ( v ) = | N G ( v ) ∩ M | , v ∈ A. (1) By construction, the set M solv es the op ening ( A, f ( A,M ) ) , so it remains in this case to nd out when the solution is unique. 2.2 Classical computer Minesw e ep er In the computer Minesw eep er the table is an m × n rectangular subset R of Z 2 , m ≤ n : R = { ( i, j ) | 1 ≤ i ≤ m, 1 ≤ j ≤ n } . 1 F or the game it is supp osed that V has a certain graphical represen tation, suc h that eac h v ertex represen ts a cell in whic h either a mine or a n um b er can p oten tiall y b e lo cated. 3 F or eac h i ∈ R the set of its neigh b ours is dened as V i = { i + v | v ∈ V } ∩ R, where V = { ( − 1 , 1) , (0 , 1) , (1 , 1) , (1 , 0) , (1 , − 1) , (0 , − 1) , ( − 1 , − 1) , ( − 1 , 0) } . 2.3 Non-formal description T o pl a y the game w e desc r i b e in its general setting y ou need a pla ying eld (for instance, prin ted on pap er), a writing device (for instance, a p en) and a solution table. The pla ying e ld consi st s of op e n cells with n um b ers in them and closed cells wh i c h are to b e lled b y a pla y er either with sym b ols of mines (crosses, for instance), or b y sym b ols of absence of mines (dashes, for instance). The aim of the game is to ll ALL the c losed cells in suc h a w a y that eac h n um b er i s equal to the n um b er of mines in the neigh b ouring cells. Eac h pla ying eld should b e supplemen ted b y the denition describing whic h cells are to b e called neigh b ours. A ccording to Denition 1, a table with some of the cells lled b y n um b ers is called a playing eld for Pap er Mineswe ep er if the distribution of mines c an b e restored uniquely . This particularly means t hat a pla y e r can c hec k whether the obtained solution is correct b y comparing it with t he solution table. 3 Statemen t of the main theorem The rst result in this direction app eared within the fram ew ork of a pro je ct of the second author's departmen t after prop osing sc ho ol studen ts of the 8 -th form to reconstruct the distribution of mines in a table 2 × n with the upp er string as A . 2 A t that time the follo wing theorem w as pro v ed: Theorem 1. Supp ose that R = { ( i, j ) | 1 ≤ i ≤ 2 , 1 ≤ j ≤ n } and that n + 1 is not divisible by 3 . let A b e one of the two s tr i n gs of R : A = { (1 , i ) ∈ R | i = 1 , . . . , n } . 2 Sp ecial thanks to Prof. Ana Breda for organization of this pro ject 4 Then for every M ⊂ R \ A the op ening ( A, f A,M ) admits only one solution. T o pro v e Theorem 1 w e used inductiv e calculation of 3 -diagonal determi- nan ts. The argumen t is quite simple, so w e skip it. Later on w e obtained a more in teresting theorem, whic h mak es the main result of this pap er: Theorem 2. Supp ose that R = { ( i, j ) | 1 ≤ i ≤ m, 1 ≤ j ≤ n } , m ≤ n, the numb ers n + 1 and m + 1 ar e c oprime. L et A b e the subset of R in the form of a chess table: A = { ( i, j ) ∈ R | i + j is even } . Then for every M ⊂ R \ A the op ening ( A, f A,M ) admits only one solution. 3.1 T ables based on the triangle tiling of the plane. Let the neigh b ours of i = ( i, j ) ∈ R b e dened b y the follo wing r ul e: V i = { i + v | v ∈ V i t } ∩ R , where V i t = { (0 , 1) , (1 , 1) , (1 , 0) , ( − 1 , 0) , (1 , − 1) , (0 , − 1) , ( − 1 , − 1) , ( − 1 , 1) , (0 , 2) , (0 , − 2) , (( − 1) i + j , 2) , (( − 1) i + j , − 2) , } , i = ( i, j ) . (2) If w e asso ciate naturally the v ertices of this graph with triangles in the triangle tiling of the plane, then this rule means that t w o triangles should b e called ne igh b ours if they ha v e at least one c ommon v ertex (see g. 7) . 5 Theorem 3. L et R = { ( i, j ) | 1 ≤ i ≤ m, 1 ≤ j ≤ n } , and let ( m + 1) and ( n + 1) b e not divi sible by 4 . L et neighb ours b e dene d by the set (2) . Supp ose that A is a subset of R in the form of a chess table: A = { ( i, j ) ∈ R | i + j even } . Then for e ach set of mines M ⊂ R \ A the op ening ( A, f A,M ) admits only one solution. It should b e noticed th a t , due to th e larger n um b e r of neigh b ours, games based on suc h tables ha v e a higher lev el of complexit y . It is curious that in these tables a pla y er regularly encoun te r s situations similar to those in the computer game. 4 An alg orithm of table making. Figure 1: T able o n base of equilate r al triangles. Before pro ving Theorem 2 w e apply it to describ e an algorithm of ge n e rating op enings with unique solutions. In most cases the resulting op ening will b e non trivial to solv e. Supp ose that m and n satisfying the condi- tions of Theorem 2 are c hosen. Set M to b e empt y initially . 1. F or ev ery i ∈ R \ A w e execute a B e r noul li test, and if the result is 1 , w e add i to M . The probabilities p and q in the test can b e tak en equal to 1 / 2 . 2. After ha ving run through all t he elemen ts of R \ A w e dene f A,M b y (1) and ll all the cells i ∈ A with the v alues f A,M ( i ) . An op ening w i th a unique solution is ready . Enjo y the game! Here are some exampl es of op enings that can b e obtained this w a y: 1 2 2 1 1 1 1 1 1 2 2 1 3 2 1 1 3 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 (3) The solutions can b e found at the e n d of the pap er. 6 The rst step of the algorithm can b e mo die d in order to a v oid the situation when for some i ∈ A one has either f ( A,M ) ( i ) = ] ( V ( i )) , or f ( A,M ) ( i ) = 0 . (4) W e prop ose to ll up the rst ro w indep enden tly and then ll all the o t he r ro ws, starting with the second one and on do wn w ards, lling eac h ro w from left to righ t and taking in to accoun t the distribution o f mines a lready placed. Consider the follo wing pseudo co de: for i:=2 to m for j:=1 to n if f ( A,M ) ( i − 1 , j ) == 0 then put a mine in to the cell (i,j) if f ( A,M ) ( i − 1 , j ) == ( ] ( V ( i − 1 , j )) − 1) then lea v e the cell (i,j) empt y end end A table obtained b y the application of this algorithm can ha v e c ells sat- isfying the condition (4) only in the last ro w. Th us, in general, suc h tables are already more complicated. But if w e w an t the inequalit y 0 < f ( A,M ) ( i ) < ] ( V ( i )) to b e v alid for ev e r y i ∈ A w e should apply the pr e vious algorithm for all the ro ws but the last one. And for the last ro w w e should apply the follo wing algorithm: for j:=2 to n if f ( A,M ) ( m − 1 , j ) == 0 then put a mine in to the cell (m,j) if f ( A,M ) ( m − 1 , j ) == ( ] ( V ( m − 1 , j )) − 1) then lea v e the cell (m,j) e mpt y if f ( A,M ) ( m, j − 1) == 0 then put a mine in to the cell (m,j) if f ( A,M ) ( m, j − 1) == ( ] ( V ( m, j − 1)) − 1) then lea v e the cell (m,j) e mpt y end Note, ho w ev er, that this pro ce du re guaran t e es that there is no cell satis- fying (4) only in the case when the n um b er of columns plus the n um b er of ro ws is ev en. In the other case (4) can hold for the cell ( m, n ) . These algorithms w ere realized in h ttp://www2.mat.ua.pt/jp edro/minesw eep er/the-tablep.h tm 5 Pro of of Theorem 2. Consider the op ening ( A, f ) . Denote b y X the set of c haracteristic functions { 0 , 1 } R \ A . W e remind that there is a natural bijection b et w een X and the 7 set o f all the subsets of R \ A . Namely , eac h M ⊂ R \ A corresp onds to the function x M ∈ X dened b y the equalit y x M ( i ) = 1 , i ∈ M , 0 , i 6∈ M , i ∈ R \ A. (5) Due to this bijection w e can sa y that an elemen t of X solv es the op ening meaning that its supp ort do es. No w, the condition that a function x ∈ X solv es the op ening ( A, f ) can b e written as a system of l inear equations: X j ∈ V i ∩ ( R \ A ) x ( j ) = f ( i ) , i ∈ A. (6) Since A = { ( i, j ) ∈ R : i + j is ev en } w e can r e write (6) as X j ∈{ ( i − 1 ,j ) , ( i +1 ,j ) , ( i,j − 1) , ( i,j +1) }∩ R x ( j ) = f ( i ) , i = ( i, j ) ∈ A. (7) W e x arbitrary orders on the se t s A, R \ A . Giv en these orders w e can con- sider the matrix of the system 7 and denote it b y E . This matrix is square, since mn is ev en and therefore | A | = | R \ A | . T o pro v e the uniqueness of the solution of (7) it suces to sho w that E is in v ertible. Since t he in v ertibilit y of E do es not dep end on the order on R , w e s hal l not sp ecify the latter. Denote P = ( x, y ) = π k m + 1 , π l n + 1 , ( k , l ) ∈ R ⊂ S 1 × S 1 . Consider the real space L = L 2 ( P ) . It is w ell kno wn that the system { sin k x sin l y , ( k , l ) ∈ R } forms a basis in L . Consider the op erator L acting on L 2 ( P ) as m ultiplication b y 2(cos x + cos y ) : 1 2 ( Lg )( x, y ) = cos x + cos y g ( x, y ) , g ∈ L , ( x, y ) ∈ P . Note that L (sin ix sin j y ) = X ( k,l ) ∈{ ( i − 1 ,j ) , ( i +1 ,j ) , ( i,j − 1) , ( i,j +1) }∩ R sin k x sin l y , ( i, j ) ∈ R . 8 Denote b L 1 = span { sin k x sin l y , ( k , l ) ∈ R , k + l is o dd } ⊂ L , b L 2 = span { sin k x sin l y , ( k , l ) ∈ R , k + l is ev en } ⊂ L . It is easy to see that L ( b L 2 ) ⊂ b L 1 , L ( b L 1 ) ⊂ b L 2 . Denote L 12 = L | b L 2 , L 21 = L | b L 1 . The matrix of the op erator L 21 coincides exactly with the transp ose of E (it is supp osed that bases in b L 1 and b L 2 are c hosen in accordance with th e orders on A and R \ A , whic h w ere used to dene the matrix E ). Th us it suces to sho w that L 21 is in v ertible. The subspace b L 1 is in v arian t under the action of L 2 . The restriction of L 2 to b L 1 coincides with L 12 L 21 . Th us, if w e pro v e that L 2 is in v ertible, so will b e b oth L 21 and L 12 . The sp ectrum of L coincides with the set n 2 cos x + cos y ( x, y ) ∈ P o . T o sho w this it suces to notice that the functions de n e d b y the equalities χ x,y ( u, v ) = δ xu δ y v , ( x, y ) ∈ P , are eige n f u nc tions of L : 1 2 Lχ x,y = cos x + cos y χ x,y . W e get that 0 is an eigen v alue of L if and only if there are in tegers k , l , suc h that π k m + 1 − π l n + 1 = ± π , 1 ≤ k ≤ m, 1 ≤ l ≤ n. But this is not so, since m + 1 and n + 1 are coprime . Th us, L is in v ertible, whic h pro v es the theorem. 9 6 Pro of of Theorem 3 The pro of is quite similar in this case, sa v e that L no w acts as L (sin ix sin j y ) = X sin( i + k ) x sin( l + j ) y , ( i, j ) ∈ R, (8) where the summation is tak en o v er al l the pairs ( k , l ) ∈ { (0 , 1) , (1 , 0) , ( − 1 , 0) , (0 , − 1) , (( − 1) i + j , 2) , (( − 1) i + j , − 2) } ∩ R . This op erator is not symmetrical and th us cannot b e represen ted as m ultipli- cation b y a function in L 2 ( P ) . Same as w e did b efore, w e can dene spaces b L 1 and b L 2 , and op erators L 12 and L 21 . No w our ob jectiv e is a lso to nd out whether L 21 has maximal rank. Indeed, b y our denition of sets A and (2) w e ha v e | R \ A | = | A | − 1 in case of o dd mn and | R \ A | = | A | in case of ev en mn (see pict). In the latter case maximalit y of rank means in v ertibilit y of L 21 . By straigh tforw ard calculations w e obtain that LL ∗ acts as LL ∗ (sin ix sin j y ) = X { ( k,l ) ∈ V LL ∗ ∩ R sin( i + k ) x sin( l + j ) y , ( i, j ) ∈ R, (9) where 1 2 LL ∗ f ( x, y ) = [3 + 3 cos(2 x ) + cos(4 x ) + cos(2 y )+ + 6 cos( x ) cos( y ) + 2 cos(2 x ) cos(2 y )+ + 2 cos(3 x ) cos( y )] f ( x, y ) , ( x, y ) ∈ P or 1 4 ( LL ∗ f )( x, y ) = cos( x ) + cos( y ) + e ix cos(2 y ) 2 f ( x, y ) , ( x, y ) ∈ P . W e ha v e cos( x ) + cos( y ) + cos( x ) cos(2 y ) = 0 sin( x ) cos(2 y ) = 0 (10) W e cannot ha v e sin( x ) = 0 , since ( x, y ) ∈ P , and so, x = π k /m + 1 , k = 1 , . . . , m . H ence cos(2 y ) = 0 , whic h means that n + 1 is a m ultiple of 4 , since 2 π l n + 1 = π 2 , l = 1 , . . . , n. 10 Th us, the second equation of (10) is equiv alen t to cos 2 y = 0 . This, together with the rst equation of (10), implies that | cos x | = √ 2 2 , ( x, y ) ∈ P . Hence m + 1 is a m u l tiple of 4 . Theorem 3 is pro v ed. 7 Solutions of (3) . 1 * 2 - 2 * 1 - 1 * 1 - - 1 - 1 * 1 2 * 2 - 1 - * 3 * 2 - 1 1 - 3 * 2 * - 1 * 2 - 1 - 1 - 1 * 1 1 * 1 - 1 - - 1 - 1 - 1 1 - 1 * 2 * * 1 - 1 - 1 A c kno wledgmen ts This researc h w as done in frames of the EECM pro ject of the mathematical departmen t of the univ ersit y of A v eiro. This w ork w as done during the visit of Oleg German to A v eiro, P ortugal. He thanks the CEOC researc h unit y for w arm hospitalit y . After the release of the rst v ersion of the pap er E.L. had most fruitful discussions with Alexander Klimo v, Dmitry Y arotsky and Vl adimir Viro. He is also grateful to Prof. Laszlo Erd os for the opp ortunit y of giving a talk on this sub ject at his seminar. References [1] Oleg German, Evgen y Laksh tano v, Mineswe ep er without a c omputer , [cs.DM] Figure 2: Solution for the table presen ted on Figure 1. 11
Original Paper
Loading high-quality paper...
Comments & Academic Discussion
Loading comments...
Leave a Comment