XORGameValue

From QETLAB
(Redirected from XORClassicalValue)
Jump to navigation Jump to search
XORGameValue
Computes the classical or quantum value of a nonlocal binary XOR game

Other toolboxes required CVX
Related functions BCSGameValue
BellInequalityMax
NonlocalGameValue
Function category Nonlocality and Bell inequalities

XORGameValue is a function that computes the classical or quantum value of a nonlocal binary XOR game. That is, it computes the optimal probability of two parties (Alice and Bob) winning such a game, assuming that they can communicate before the game, but not during the game, and either (1) they cannot share entanglement, or (2) they can share entanglement.

Syntax

  • VAL = XORGameValue(P,F)
  • VAL = XORGameValue(P,F,VTYPE)

Argument descriptions

  • P: A matrix whose (s,t)-entry gives the probability that the referee will give Alice the value s and Bob the value t. The sum of all entries of this matrix must be 1.
  • F: A binary matrix (of the same size as P) whose (s,t)-entry indicates the winning choice (either 0 or 1) when Alice and Bob receive values s and t from the referee.
  • VTYPE (optional, default 'classical'): One of 'classical' or 'quantum', indicating whether or not Alice and Bob can use quantum strategies (i.e., shared entanglement).

Examples

The CHSH game

The CHSH game[1] is a game in which the referee (uniformly at random) gives each of Alice and Bob a single bit, and Alice and Bob win if the XOR of their responses is the AND of the bits received by the referee. That is, Alice and Bob want the XOR of their responses to be 1 if and only if they both received a 1 from the referee.

It is well-known that the maximum probability of winning this game if Alice and Bob share entanglement is $\cos^2(\pi/8)$, whereas the maximum probability of winning this game without entanglement is $3/4$. The following code demonstrates this fact: the p matrix has each entry 1/4 because each of the 4 possible combinations of bits from the referee are equally likely, and the matrix f equals [0 0;0 1] because Alice and Bob want the XOR of their answers to be 1 only when they both receive a 1 from the referee (the first row of the matrix corresponds to Alice receiving a 0, the second row of the matrix corresponds to Alice receiving a 1, and the columns are similar for Bob).

>> p = [1/4 1/4;1/4 1/4];
>> f = [0 0;0 1];
>> XORGameValue(p,f,'quantum')

ans =

    0.8536

>> cos(pi/8)^2 % compare the answer to the known theoretical answer

ans =

    0.8536

>> XORGameValue(p,f,'classical') % compare to the classical value of this game

ans =

    0.7500

The odd cycles game

The odd cycles game[2] is a game where Alice and Bob try to convince the referee that an cycle of length n has a 2-coloring, which is impossible when n is odd. The referee gives each of Alice and Bob a number from 1 to n (representing the n different vertices of the n-cycle), and Alice and Bob respond with a color (0 or 1). They win the game if either (1) the referee gave Alice and Bob the same number and Alice and Bob's responses are the same; or (2) the referee gave Alice and Bob numbers that differ by 1 (corresponding to adjacent vertices) and Alice and Bob's responses are different. Otherwise, they lose the game.

If $n$ is odd, it is known that the maximum probability of winning this game with shared entanglement is $\cos^2(\pi/4n)$, whereas the maximum probability of winning this game without entanglement is $1 - 1/(2n)$. These facts are verified by the following code when $n = 5$:

>> n = 5;
>> % first compute the probability matrix (see the cited paper for details)
>> p = diag(ones(1,n))/(2*n) + circshift(diag(ones(1,n)),-1)/(2*n)

p =

    0.1000    0.1000         0         0         0
         0    0.1000    0.1000         0         0
         0         0    0.1000    0.1000         0
         0         0         0    0.1000    0.1000
    0.1000         0         0         0    0.1000

>> % now we specify the winning condition matrix
>> f = circshift(diag(ones(1,n)),-1)

f =

     0     1     0     0     0
     0     0     1     0     0
     0     0     0     1     0
     0     0     0     0     1
     1     0     0     0     0

>> XORGameValue(p,f,'quantum')

ans =

    0.9755

>> cos(pi/(4*n))^2 % compare the answer to the known theoretical answer

ans =

    0.9755

>> XORGameValue(p,f,'classical') % compare to the classical value of this game

ans =

    0.9000

Source code

Click on "expand" to the right to view the MATLAB source code for this function.

References

  1. John Watrous. Lecture 20: Bell inequalities and nonlocality, Quantum Computation Lecture Notes, 2006.
  2. R. Cleve, P. Hoyer, B. Toner, and J. Watrous. Consequences and limits of nonlocal strategies. In Proceedings of 19th IEEE Conference on Computational Complexity (CCC 2004). E-print: arXiv:quant-ph/0404076