Difference between revisions of "XORGameValue"

From QETLAB
Jump to navigation Jump to search
(Added XORClassicalValue examples)
(→‎The odd cycles game: Make example more general)
Line 50: Line 50:
 
>> n = 5;
 
>> n = 5;
 
>> % first compute the probability matrix (see the cited paper for details)
 
>> % first compute the probability matrix (see the cited paper for details)
>> p = diag([1,1,1,1,1])/10 + circshift(diag([1,1,1,1,1]),-1)/10
+
>> p = diag(ones(1,n))/(2*n) + circshift(diag(ones(1,n)),-1)/(2*n)
  
 
p =
 
p =
Line 61: Line 61:
  
 
>> % now we specify the winning condition matrix
 
>> % now we specify the winning condition matrix
>> f = circshift(diag([1,1,1,1,1]),-1)
+
>> f = circshift(diag(ones(1,n)),-1)
  
 
f =
 
f =

Revision as of 13:54, 20 November 2014

XORQuantumValue
Computes the quantum value of a nonlocal binary XOR game

Other toolboxes required cvx
Related functions XORClassicalValue
Function category Nonlocal games

XORQuantumValue is a function that computes the 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 share entanglement but can not communicate during the game.

Syntax

  • WG = XORQuantumValue(P,F)

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.

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];
>> XORQuantumValue(p,f)

ans =

    0.8536

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

ans =

    0.8536

>> XORClassicalValue(p,f) % 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

>> XORQuantumValue(p,f)

ans =

    0.9755

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

ans =

    0.9755

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

ans =

    0.9000

Source code

Click here to view this function's source code on github.

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