 Welcome back to this NPTEL course on game theory. In the previous session we introduced this graphical games as a way, another way of looking at impartial game and then we also discussed the addition of these games. We also introduced the spray-grindy function of a impartial game. In this session we are interested in proving this spray-grindy theorem. So let me recall the spray-grindy function. So let us say if X, F is a game, the spray-grindy function of this game is defined in the following way. G of a position X is defined to be the max, minimum excluded value of G of Y such that Y is an Fx. This is the minimum non-negative integer that is not already given to the followers from this position X. So now we are interested in the following thing which is the spray-grindy theorem. What it says is the following thing. Let us consider n games. There are n impartial games and then we have considered this addition of these games. We consider the addition of these games. Of course the X is nothing but X1 cross X2 cross Xn the Cartesian product and F is defined in the previous case Fx1 F of X is nothing but Fx1 cross singleton X2 union and other things we have done. Now what the spray-grindy theorem says is that G of X is nothing but G1 X1 Xr G2 X2. In other words we say that G in other words we say that the spray-grindy function G is nothing but so this is the spray-grindy theorem. So we will try to prove the proof. So let X belongs to X. So remember X is hazard and coordinates. Let take B to be the G1 X1 and we need to show that we will show two things. For every a less than b any non-negative integer a less than b there is a follower of X1 X2 Xn that has G value a. So remember we need to show that this B is nothing but the grindy value of X to show that what we will do that you choose any number less than b any non-negative integer then there will be a follower of X1 X2 Xn which has G value a that is the first step and the second step no follower of X has G value b. So these are the two steps that we will do it. So in the first step we will say that the smaller than b has there is a follower of X1 X2 Xn and then b for b there is no follower having the value b. So this is the idea. Of course then this of course these two imply immediately that G of X is equals to b. So this is the proof. So now let us prove of 1. So let us take a X of b. So we will the idea is essentially to follow the proof of NIM game. So I will go through the proof because you have already seen the NIM game you can easily connect with that. Let K be the number of digits in the binary expression of D so that 2 power K minus 1 is less than equals to D less than 2 power K and D has a 1 in the kth position. So we are choosing this in the kth position of D there should be 1 and K is in such a way that 2 power K minus 1 less than equals to D which is strictly less than 2 power K. So that we are looking at it in a sense the largest this is exactly the same as in the previous this thing. Now we have a less than b therefore b has 1 in kth position therefore a will have so a is strictly less than b. So therefore in the kth position a will have 0 that is very important. Now b is given to be g1 x1 this is there therefore because b is nothing but this g1 x1 plus so on gn xn and b has 1 in the kth position. So therefore one of these must have 1 in their kth position. Therefore at least 1 xi is such that the binary expansion gixi has 1 in kth position. This follows because b is the sum of all this thing in the remember if odd number of ones are there it becomes 1 otherwise it is 0. So therefore in the kth position is a 1 so there must be odd number of them. So therefore it will come just go back to the proof of NIM you will it becomes clearer we have used exactly the same thing. So for simplicity assume this to be x1. So what we are saying is that x1 the first one has the 1 in the kth position d this will be strictly less than g1 x1 because in the kth position both of them have 1 therefore d plus g1 x1 in the kth position it will be 0. So therefore this number has to be less than that so it will be strictly less than g1 x1. So therefore there is a move from x1 to sum x1 prime with g1 x1 prime is nothing but d. So because this number is strictly less than g1 x1 so therefore there will be a move from x1 to sum x1 prime where this g1 x1 prime has to be smaller than this one. This is coming from the definition of this Grundy function or this arithmetic that we have number arithmetic. Okay therefore the move from x1 x2 xn to x1 prime x2 xn is a legal move in the game g and further what I would like to see is that g1 x1 prime plus g2 x2 gn xn this is nothing but g1 x1 prime is nothing but this I have just put there this is nothing but d plus b which is nothing but a if you calculate this here d plus b will be a this proves the one. Now we need to prove suppose to the contrary x1 x2 xn has a follower same g value. Suppose without loss of generality this involves in the first game okay therefore let us say from x1 x2 xn you have moved to x1 prime x2 xn. So this is the move that is giving you the same g value let us assume that okay and we are assuming that g1 x1 prime plus g2 x2 gn xn this is same as g1 x1 g2 x2 gn xn. So now if you recall the number arithmetic if I add g and xn both sides then what will happen is that gn xn plus gn xn and gn xn plus gn xn both sides that becomes 0. So in a sense you have a cancellation law here you repeatedly you do it add both sides by gn xn and then gn minus 1 xn and up to g2 x2 and all these will cancel what remains here is that g1 x1 prime will be same as g1 x1. But this is a contradiction that means a follower of x1 has the same g value as x1 which is not possible. So therefore this contradiction whatever we have assumed is incorrect which proves two holes that completes this fact what we have proved is that the one for any a less than b there is a follower having a g value a and no follower of x has g value b therefore g of x is b this implies g is nothing but g1 the spray Grundy value of this addition of these games satisfies this addition principle. So this is a very important result in this theory of impartial games this works with the games which are progressively bounded that means from any position the number of positions available to you is always finite. So this is a very important this thing any impartial game when you look at this its spray Grundy value gives a kind of a identification with a NIM game whose spray Grundy value of that is exactly the same. So in that sense this spray Grundy theorem is a remarkable theorem which identifies the following fact any impartial game is equivalent to a NIM game where the spray Grundy value is nothing but that corresponding the number the number associated with the NIM game. So this theorem applies to any progressively bounded games and this is a very important thing. We will now see some examples of this theorem. So we will look at the subtraction game. So let us denote by gm is one pile subtraction game where the subtraction set is given by so in a sense if you have a pile of coins and then you can remove at any point of time any coins the number of coins cannot be more than m anything between 1 to m you can remove it. So the spray Grundy function of this game the spray Grundy let me denote it by gm of x if x is the starting size this is going to be x mod m plus 1. So how do we prove this fact? In fact we have seen this earlier when we are looking at the takeaway games and other things we know the this procedure if there are x coins what is its spray Grundy function. So let us try the best way is actually to write down the terminal position. So if gm 0 is nothing but 0 that is that 0 is the terminal position. So what about gm 1 is going to be exactly 1 and of course up to gm m this is going to be m. What if there are m plus 1 coins? If there are m plus 1 coins now it is a player any player the player who is going to make the move he can remove m coins at the most. So therefore the person who is going to make the move at m plus 1 is going to lose and then if you look at it this is going to be simply 0. So and in fact this is nothing but m plus 1 mod m plus 1. So in fact proceeding inductively you can see that gm x is nothing but x mod m plus 1. Note that gm x is always in between 0 and m. Now let us consider sum of 3 subtraction games. First game let us take m is equals to 3 9 chips let us take we start with 9 chips. Second has m is equals to 5 and there are 10 chips. Third game m is equals to 7 and pile has 14 chips. Therefore initial position is going to be 9 10 14 the Cartesian product of all the positions. So therefore initial position now is going to be 9 10 14. So therefore we are actually considering the game g3 plus g5 plus g7. This is basically the game that we are considering. Now we look at the spray Grundy value. So we need to calculate g of 9 10 14 this is going to be g3 of 9 plus g5 of 10 plus g7 of 14. So this is nothing but 1 plus 4 plus 6 which is nothing but 3. You can calculate this value and this is going to be 3. So therefore by looking at this Grundy value one optimal move is to change the position in game g7 to have spray Grundy value. This can be done by removing one chip pile of 14 leaving. So apart from this there are other optimal moves. The importance of the spray Grundy function spray Grundy theorem is that when you have an addition of multiple games you can actually start looking at each game individually and start seeing their spray value spray Grundy values and use them to see which game you need to play. So this is here is there is an example and in this case you have a multiple optimal moves here and one optimal move is given here and the other optimal move you can find it as an exercise. We will stop here and we will continue this in the next session.