Difference between revisions of "NonlocalGameValue"

From QETLAB
Jump to navigation Jump to search
(Function Removed notice)
 
(11 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
|name=NonlocalGameValue
 
|name=NonlocalGameValue
 
|desc=Computes the maximum value of a two-player non-local game
 
|desc=Computes the maximum value of a two-player non-local game
|rel=[[BellInequalityMax]]<br />[[NPAHierarchy]]<br />[[XORGameValue]]
+
|rel=[[BCSGameValue]]<br />[[BellInequalityMax]]<br />[[NPAHierarchy]]<br />[[XORGameValue]]
|req=[http://cvxr.com/cvx/ cvx]
+
|req=[http://cvxr.com/cvx/ CVX]
 
|cat=[[List of functions#Nonlocality_and_Bell_inequalities|Nonlocality and Bell inequalities]]
 
|cat=[[List of functions#Nonlocality_and_Bell_inequalities|Nonlocality and Bell inequalities]]
 
|upd=March 6, 2015
 
|upd=March 6, 2015
 
|cvx=no}}
 
|cvx=no}}
 +
{| class="wikitable"
 +
|-
 +
! FUNTION REMOVED
 +
|-
 +
| This function was removed from QETLAB between versions 0.9 and 1.0, being replaced by [[ParallelRepetition]]. The documentation below is for the version 0.9 version of this function, and will be kept as-is in case it can be useful for users of old versions of QETLAB.
 +
|}
 +
 +
 
<tt>'''NonlocalGameValue'''</tt> is a [[List of functions|function]] that computes the maximum possible value of a given non-local game under either classical mechanics, quantum mechanics, or general no-signalling theories. In the classical and non-signalling cases, an exact value is computed, whereas the value computed in the quantum case is only an upper bound (found using the [[NPAHierarchy|NPA hierarchy]]).
 
<tt>'''NonlocalGameValue'''</tt> is a [[List of functions|function]] that computes the maximum possible value of a given non-local game under either classical mechanics, quantum mechanics, or general no-signalling theories. In the classical and non-signalling cases, an exact value is computed, whereas the value computed in the quantum case is only an upper bound (found using the [[NPAHierarchy|NPA hierarchy]]).
  
Line 17: Line 25:
 
* <tt>P</tt>: A probability matrix whose $(x,y)$-entry gives the probability that the referee asks Alice question $x$ and Bob question $y$.
 
* <tt>P</tt>: A probability matrix whose $(x,y)$-entry gives the probability that the referee asks Alice question $x$ and Bob question $y$.
 
* <tt>V</tt>: A 4-D array whose $(a,b,x,y)$-entry gives the value awarded to Alice and Bob if they reply with answers $(a,b)$ to questions $(x,y)$.
 
* <tt>V</tt>: A 4-D array whose $(a,b,x,y)$-entry gives the value awarded to Alice and Bob if they reply with answers $(a,b)$ to questions $(x,y)$.
* <tt>MTYPE</tt> (optional, default <tt>'classical'</tt>): A string indicating which type of theory should be used when computing the maximum value of the non-local game. Must be one of <tt>'classical'</tt>, <tt>'quantum'</tt>, or <tt>'nosignal'</tt>. If <tt>MTYPE = 'quantum'</tt> then only an upper bound on the non-local game is computed, not necessarily is <em>best</em> upper bound (see the argument <tt>K</tt> below).
+
* <tt>MTYPE</tt> (optional, default <tt>'classical'</tt>): A string indicating which type of theory should be used when computing the maximum value of the non-local game. Must be one of <tt>'classical'</tt>, <tt>'quantum'</tt>, or <tt>'nosignal'</tt>. If <tt>MTYPE = 'quantum'</tt> then only an upper bound on the non-local game is computed, not necessarily the ''best'' upper bound (see the argument <tt>K</tt> below).
 
* <tt>K</tt> (optional, default <tt>1</tt>): If <tt>MTYPE = 'quantum'</tt> then this is a non-negative integer indicating what level of the NPA hierarchy should be used when bounding the value of the non-local game. Higher values of <tt>K</tt> give better bounds, but require more memory and time. Alternatively, <tt>K</tt> can be a string of a form like <tt>'1+ab+aab'</tt>, which indicates that an intermediate level of the hierarchy should be used, where this example uses all products of 1 measurement, all products of one Alice and one Bob measurement, and all products of two Alice and one Bob measurement. Use plus signs to separate the different categories of products, as above. The first character of this string should always be a number, indicating the base level to use. If <tt>MTYPE</tt> is anything other than <tt>'quantum'</tt> then <tt>K</tt> has no effect.
 
* <tt>K</tt> (optional, default <tt>1</tt>): If <tt>MTYPE = 'quantum'</tt> then this is a non-negative integer indicating what level of the NPA hierarchy should be used when bounding the value of the non-local game. Higher values of <tt>K</tt> give better bounds, but require more memory and time. Alternatively, <tt>K</tt> can be a string of a form like <tt>'1+ab+aab'</tt>, which indicates that an intermediate level of the hierarchy should be used, where this example uses all products of 1 measurement, all products of one Alice and one Bob measurement, and all products of two Alice and one Bob measurement. Use plus signs to separate the different categories of products, as above. The first character of this string should always be a number, indicating the base level to use. If <tt>MTYPE</tt> is anything other than <tt>'quantum'</tt> then <tt>K</tt> has no effect.
  
Line 64: Line 72:
 
A generalization of the CHSH inequality to higher dimensions is exactly as above, except each of $a,b,x,y$ are taken from the set $\{0,1,\ldots,d-1\}$.<ref>M. Howard. Maximum nonlocality and minimum uncertainty using magic states. E-print: [http://arxiv.org/abs/1501.05319 arXiv:arXiv:1501.05319] [quant-ph], 2015.</ref> The following code computes the values of the CHSH-3 game:
 
A generalization of the CHSH inequality to higher dimensions is exactly as above, except each of $a,b,x,y$ are taken from the set $\{0,1,\ldots,d-1\}$.<ref>M. Howard. Maximum nonlocality and minimum uncertainty using magic states. E-print: [http://arxiv.org/abs/1501.05319 arXiv:arXiv:1501.05319] [quant-ph], 2015.</ref> The following code computes the values of the CHSH-3 game:
 
<syntaxhighlight>
 
<syntaxhighlight>
>> d = 2;
+
>> d = 3;
 
>> p = ones(d,d)/d^2;
 
>> p = ones(d,d)/d^2;
 
>> V = zeros(d,d,d,d);
 
>> V = zeros(d,d,d,d);
Line 108: Line 116:
 
     1.0000
 
     1.0000
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
===The Fortnow-Feige-Lovász game===
 +
The Fortnow-Feige-Lovász (FFL) game<ref>U. Feige, L. Lovász, In Proceedings of the 24th ACM STOC, pages 733-744, 1992.</ref><ref>L. Fortnow, PhD thesis, Massachusetts Institute of Technology, Technical Report MIT/LCS/TR-447, May 1989.</ref> is well-known example of a non-local game for which perfect parallel repetition does not hold (i.e., quantum players playing two copies of the game in parallel can do better than they can by playing the games in succession).
 +
 +
The game has binary inputs and outputs, and is defined by the rule that the referee asks Alice and Bob the question pair $(x,y) = (0,0)$, $(0,1)$, or $(1,0)$ with probability $1/3$ each, and Alice and Bob win if and only if their answers satisfy $x \vee a \neq y \vee b$, where $\vee$ denotes the bitwise OR operation.
 +
 +
It is known that both the classical value and quantum value of this game equal $2/3$, which we can verify as follows:
 +
<syntaxhighlight>
 +
>> p = [1 1;1 0]/3;
 +
>> V = zeros(2,2,2,2);
 +
>> for a = 1:2
 +
      for b = 1:2
 +
          for x = 1:2
 +
              for y = 1:2
 +
                  if(max(x,a) ~= max(y,b))
 +
                      V(a,b,x,y) = 1;
 +
                  end
 +
              end
 +
          end
 +
      end
 +
  end
 +
>> NonlocalGameValue(p,V,'classical')
 +
 +
ans =
 +
 +
    0.6667
 +
 +
>> NonlocalGameValue(p,V,'quantum',1)
 +
 +
ans =
 +
 +
    0.6667
 +
</syntaxhighlight>
 +
 +
====Parallel repetition====
 +
In fact, we can even compute the classical and quantum values of two copies of the FFL game being run in parallel: we simply specify the <tt>REPT</tt> input argument to be 2:
 +
<syntaxhighlight>
 +
>> NonlocalGameValue(p,V,'classical',1,2)
 +
 +
ans =
 +
 +
    0.6667
 +
 +
>> NonlocalGameValue(p,V,'quantum',1,2)
 +
 +
ans =
 +
 +
    0.6667
 +
</syntaxhighlight>
 +
Indeed, the fact that both of these values also equal $2/3$ is a known fact <ref>R. Cleve, W. Slofstra, F. Unger, and S. Upadhyay. Perfect parallel repetition theorem for quantum XOR proof systems. ''Computational Complexity'', 17:282&ndash;299, 2008. E-print: [http://arxiv.org/abs/quant-ph/0608146 arXiv:quant-ph/0608146]</ref>. Note that in the command <tt>NonlocalGameValue(p,V,'classical',1,2)</tt>, the "1" that is provided as the value of <tt>K</tt> does not do anything: it is simply provided as a placeholder so that we can set <tt>REPT = 2</tt> in the next input argument (e.g., we could have just as well entered the command <tt>NonlocalGameValue(p,V,'classical',9873,2)</tt>, and the same calculation would have been carried out).
 +
 +
{{SourceCode|name=NonlocalGameValue}}
  
 
==Notes==
 
==Notes==
In practice, <tt>K</tt> probably can't be any larger than 4 when <tt>MTYPE = 'quantum'</tt>.
+
* In practice, <tt>K</tt> probably can't be any larger than 4 when <tt>MTYPE = 'quantum'</tt>, due to memory and time restrictions.
 +
* When <tt>MTYPE = 'classical'</tt>, the game's value is computed via the algorithm (which is faster than naive brute force) presented in <ref>M. Araújo, F. Hirsch, and M. T. Quintino. Bell nonlocality with a single shot. E-print: [https://arxiv.org/abs/2005.13418 arXiv:2005.13418]</ref>.
  
 
==References==
 
==References==
 
<references />
 
<references />

Latest revision as of 19:00, 27 October 2022

NonlocalGameValue
Computes the maximum value of a two-player non-local game

Other toolboxes required CVX
Related functions BCSGameValue
BellInequalityMax
NPAHierarchy
XORGameValue
Function category Nonlocality and Bell inequalities
Usable within CVX? no
FUNTION REMOVED
This function was removed from QETLAB between versions 0.9 and 1.0, being replaced by ParallelRepetition. The documentation below is for the version 0.9 version of this function, and will be kept as-is in case it can be useful for users of old versions of QETLAB.


NonlocalGameValue is a function that computes the maximum possible value of a given non-local game under either classical mechanics, quantum mechanics, or general no-signalling theories. In the classical and non-signalling cases, an exact value is computed, whereas the value computed in the quantum case is only an upper bound (found using the NPA hierarchy).

Syntax

  • NGVAL = NonlocalGameValue(P,V)
  • NGVAL = NonlocalGameValue(P,V,MTYPE)
  • NGVAL = NonlocalGameValue(P,V,MTYPE,K)

Argument descriptions

  • P: A probability matrix whose $(x,y)$-entry gives the probability that the referee asks Alice question $x$ and Bob question $y$.
  • V: A 4-D array whose $(a,b,x,y)$-entry gives the value awarded to Alice and Bob if they reply with answers $(a,b)$ to questions $(x,y)$.
  • MTYPE (optional, default 'classical'): A string indicating which type of theory should be used when computing the maximum value of the non-local game. Must be one of 'classical', 'quantum', or 'nosignal'. If MTYPE = 'quantum' then only an upper bound on the non-local game is computed, not necessarily the best upper bound (see the argument K below).
  • K (optional, default 1): If MTYPE = 'quantum' then this is a non-negative integer indicating what level of the NPA hierarchy should be used when bounding the value of the non-local game. Higher values of K give better bounds, but require more memory and time. Alternatively, K can be a string of a form like '1+ab+aab', which indicates that an intermediate level of the hierarchy should be used, where this example uses all products of 1 measurement, all products of one Alice and one Bob measurement, and all products of two Alice and one Bob measurement. Use plus signs to separate the different categories of products, as above. The first character of this string should always be a number, indicating the base level to use. If MTYPE is anything other than 'quantum' then K has no effect.

Examples

The CHSH inequality

One formulation of the CHSH inequality[1] is as follows:

  • A referee asks Alice a question $x \in \{0,1\}$ and Bob a question $y \in \{0,1\}$.
  • Alice and Bob then reply with answers $a \in \{0,1\}$ and $b \in \{0,1\}$ respectively.
  • Alice and Bob win if and only if $a \oplus b = xy$.

The optimal probability with which Alice and Bob can win this game in classical, quantum, and no-signalling theories are as follows:

>> d = 2;
>> p = ones(d,d)/d^2;
>> V = zeros(d,d,d,d);
>> for a = 1:d
     for b = 1:d
       for x = 1:d
         for y = 1:d
           if(mod(a+b+x*y,d)==0)
             V(a,b,x,y) = 1;
           end
         end
       end
     end
   end
>> NonlocalGameValue(p,V,'classical')

ans =

    0.7500

>> NonlocalGameValue(p,V,'quantum',1)

ans =

    0.8536

>> NonlocalGameValue(p,V,'nosignal')

ans =

    1.0000

The CHSH-d inequality

A generalization of the CHSH inequality to higher dimensions is exactly as above, except each of $a,b,x,y$ are taken from the set $\{0,1,\ldots,d-1\}$.[2] The following code computes the values of the CHSH-3 game:

>> d = 3;
>> p = ones(d,d)/d^2;
>> V = zeros(d,d,d,d);
>> for a = 1:d
     for b = 1:d
       for x = 1:d
         for y = 1:d
           if(mod(a+b+x*y,d)==0)
             V(a,b,x,y) = 1;
           end
         end
       end
     end
   end
>> NonlocalGameValue(p,V,'classical')

ans =

    0.6667

>> NonlocalGameValue(p,V,'quantum',1)

ans =

    0.7182

>> NonlocalGameValue(p,V,'quantum',2)

ans =

    0.7182

>> NonlocalGameValue(p,V,'quantum','2+aab')

ans =

    0.7124

>> NonlocalGameValue(p,V,'nosignal')

ans =

    1.0000

The Fortnow-Feige-Lovász game

The Fortnow-Feige-Lovász (FFL) game[3][4] is well-known example of a non-local game for which perfect parallel repetition does not hold (i.e., quantum players playing two copies of the game in parallel can do better than they can by playing the games in succession).

The game has binary inputs and outputs, and is defined by the rule that the referee asks Alice and Bob the question pair $(x,y) = (0,0)$, $(0,1)$, or $(1,0)$ with probability $1/3$ each, and Alice and Bob win if and only if their answers satisfy $x \vee a \neq y \vee b$, where $\vee$ denotes the bitwise OR operation.

It is known that both the classical value and quantum value of this game equal $2/3$, which we can verify as follows:

>> p = [1 1;1 0]/3;
>> V = zeros(2,2,2,2);
>> for a = 1:2
       for b = 1:2
           for x = 1:2
               for y = 1:2
                   if(max(x,a) ~= max(y,b))
                       V(a,b,x,y) = 1;
                   end
               end
           end
       end
   end
>> NonlocalGameValue(p,V,'classical')

ans =

    0.6667

>> NonlocalGameValue(p,V,'quantum',1)

ans =

    0.6667

Parallel repetition

In fact, we can even compute the classical and quantum values of two copies of the FFL game being run in parallel: we simply specify the REPT input argument to be 2:

>> NonlocalGameValue(p,V,'classical',1,2)

ans =

    0.6667

>> NonlocalGameValue(p,V,'quantum',1,2)

ans =

    0.6667

Indeed, the fact that both of these values also equal $2/3$ is a known fact [5]. Note that in the command NonlocalGameValue(p,V,'classical',1,2), the "1" that is provided as the value of K does not do anything: it is simply provided as a placeholder so that we can set REPT = 2 in the next input argument (e.g., we could have just as well entered the command NonlocalGameValue(p,V,'classical',9873,2), and the same calculation would have been carried out).

Source code

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

Notes

  • In practice, K probably can't be any larger than 4 when MTYPE = 'quantum', due to memory and time restrictions.
  • When MTYPE = 'classical', the game's value is computed via the algorithm (which is faster than naive brute force) presented in [6].

References

  1. J.F. Clauser, M.A. Horne, A. Shimony, R.A. Holt. Proposed experiment to test local hidden-variable theories. Phys. Rev. Lett., 23(15):880–884, 1969.
  2. M. Howard. Maximum nonlocality and minimum uncertainty using magic states. E-print: arXiv:arXiv:1501.05319 [quant-ph], 2015.
  3. U. Feige, L. Lovász, In Proceedings of the 24th ACM STOC, pages 733-744, 1992.
  4. L. Fortnow, PhD thesis, Massachusetts Institute of Technology, Technical Report MIT/LCS/TR-447, May 1989.
  5. R. Cleve, W. Slofstra, F. Unger, and S. Upadhyay. Perfect parallel repetition theorem for quantum XOR proof systems. Computational Complexity, 17:282–299, 2008. E-print: arXiv:quant-ph/0608146
  6. M. Araújo, F. Hirsch, and M. T. Quintino. Bell nonlocality with a single shot. E-print: arXiv:2005.13418