# Difference between revisions of "BellInequalityMax"

 Other toolboxes required BellInequalityMax Computes the maximum value of a Bell inequality CVX NonlocalGameValueNPAHierarchyXORGameValue Nonlocality and Bell inequalities no

BellInequalityMax is a function that computes the maximum possible value of a given Bell inequality 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

• BMAX = BellInequalityMax(JOINT_COE,A_COE,B_COE,A_VAL,B_VAL)
• BMAX = BellInequalityMax(JOINT_COE,A_COE,B_COE,A_VAL,B_VAL,MTYPE)
• BMAX = BellInequalityMax(JOINT_COE,A_COE,B_COE,A_VAL,B_VAL,MTYPE,K)

## Argument descriptions

• JOINT_COE: A matrix whose $(i,j)$-entry gives the coefficient of $\langle A_i B_j \rangle$ in the Bell inequality.
• A_COE: A vector whose $i$-th entry gives the coefficient of $\langle A_i \rangle$ in the Bell inequality.
• B_COE: A vector whose $i$-th entry gives the coefficient of $\langle B_i \rangle$ in the Bell inequality.
• A_VAL: A vector whose $i$-th entry gives the value of the $i$-th measurement result on Alice's side.
• B_VAL: A vector whose $i$-th entry gives the value of the $i$-th measurement result on Bob's side.
• MTYPE (optional, default 'classical'): A string indicating which type of theory should be used when computing the maximum value of the Bell inequality. Must be one of 'classical', 'quantum', or 'nosignal'. If MTYPE = 'quantum' then only an upper bound on the Bell inequality is computed, not necessarily is 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 Bell inequality. 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] says that if $\{A_1,A_2\}$ and $\{B_1,B_2\}$ are $\{-1,+1\}$-valued measurement settings, then in classical physics the following inequality holds: $\langle A_1 B_1 \rangle + \langle A_1 B_2 \rangle + \langle A_2 B_1 \rangle - \langle A_2 B_2 \rangle \leq 2.$ Similarly, the best bound on this quantity is $2\sqrt{2}$ in a quantum mechanical setting (this is Tsirelson's bound)[2], and it is $4$ in no-signalling theories. All three of these bounds can be found as follows:

>> BellInequalityMax([1 1;1 -1], [0 0], [0 0], [-1 1], [-1 1], 'classical')

ans =

2

>> BellInequalityMax([1 1;1 -1], [0 0], [0 0], [-1 1], [-1 1], 'quantum')

ans =

2.8284

>> BellInequalityMax([1 1;1 -1], [0 0], [0 0], [-1 1], [-1 1], 'nosignal')

ans =

4.0000

### The CHSH inequality again

Another (equivalent) formulation of the CHSH inequality says that if $\{A_1,A_2\}$ and $\{B_1,B_2\}$ are $\{0,1\}$-valued measurement settings, then in classical physics the following inequality holds: $\langle A_1 B_1 \rangle + \langle A_1 B_2 \rangle + \langle A_2 B_1 \rangle - \langle A_2 B_2 \rangle - \langle A_1 \rangle - \langle B_1 \rangle \leq 0.$ Similarly, the best bound on this quantity is $1/\sqrt{2} - 1/2$ in a quantum mechanical setting, and it is $1/2$ in no-signalling settings. These three bounds can be verified as follows:

>> BellInequalityMax([1 1;1 -1], [-1 0], [-1 0], [0 1], [0 1], 'classical')

ans =

0

>> BellInequalityMax([1 1;1 -1], [-1 0], [-1 0], [0 1], [0 1], 'quantum')

ans =

0.2071

>> BellInequalityMax([1 1;1 -1], [-1 0], [-1 0], [0 1], [0 1], 'nosignal')

ans =

0.5000

### The I3322 inequality

The I3322 inequality[3][4] is a Bell inequality that says that if $\{A_1,A_2,A_3\}$ and $\{B_1,B_2,B_3\}$ are $\{0,1\}$-valued measurement settings, then in classical physics the following inequality holds: $\langle A_1 B_1 \rangle + \langle A_1 B_2 \rangle - \langle A_1 B_3 \rangle + \langle A_2 B_1 \rangle + \langle A_2 B_2 \rangle + \langle A_2 B_3 \rangle - \langle A_3 B_1 \rangle + \langle A_3 B_2 \rangle - \langle A_2 \rangle - \langle B_1 \rangle - 2\langle B_2 \rangle \leq 0.$ Similarly, it is known that a value of (strictly) larger than $1/4$ is possible in quantum mechanics[5], and the best possible bound is $1$ in no-signalling theories. The following code computes the best possible classical and no-signalling bounds exactly, and computes several different upper bounds for the quantum mechanical setting:

>> BellInequalityMax([1 1 -1;1 1 1;-1 1 0], [0 -1 0], [-1 -2 0], [0 1], [0 1], 'classical')

ans =

0

>> BellInequalityMax([1 1 -1;1 1 1;-1 1 0], [0 -1 0], [-1 -2 0], [0 1], [0 1], 'quantum', 1)

ans =

0.366025403693998

>> BellInequalityMax([1 1 -1;1 1 1;-1 1 0], [0 -1 0], [-1 -2 0], [0 1], [0 1], 'quantum', '1+ab')

ans =

0.251470897708374 % as we increase K, the upper bound gets lower (better)

>> BellInequalityMax([1 1 -1;1 1 1;-1 1 0], [0 -1 0], [-1 -2 0], [0 1], [0 1], 'quantum', 2)

ans =

0.250939721548844

>> BellInequalityMax([1 1 -1;1 1 1;-1 1 0], [0 -1 0], [-1 -2 0], [0 1], [0 1], 'quantum', 3)

ans =

0.250875554481214

>> BellInequalityMax([1 1 -1;1 1 1;-1 1 0], [0 -1 0], [-1 -2 0], [0 1], [0 1], 'quantum', 4)

ans =

0.250875378885565

>> BellInequalityMax([1 1 -1;1 1 1;-1 1 0], [0 -1 0], [-1 -2 0], [0 1], [0 1], 'nosignal')

ans =

0.999999991391596

We note that the values provided for the quantum upper bound above for K = '1+ab', K = 2, and K = 3 agree with the values found in [6]. Furthermore, the value when K = 4 agrees with the value found in [5]. The exact value of the best upper bound in the quantum setting is an open problem, but is known to be approximately $0.250875$.

## Source code

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

## Notes

In practice, K probably can't be any larger than 4 when MTYPE = 'quantum'.

## 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. B.S. Tsirelson. Quantum generalizations of Bell's inequality. Lett. Math. Phys., 4:93, 1980. E-print
3. M. Froissart. Constructive generalization of Bell's inequalities. Nuov. Cim. B, 64:241, 1981
4. D. Collins and N. Gisin. A relevant two qubit Bell inequality inequivalent to the CHSH inequality. J. Phys. A: Math. Gen., 37(5):1175, 2004. E-print: arXiv:quant-ph/0306129
5. K.F. Pál and T. Vértesi. Maximal violation of a bipartite three-setting, two-outcome Bell inequality using infinite-dimensional quantum systems. Phys. Rev. A, 82:022116, 2010. E-print: arXiv:1006.3032 [quant-ph]
6. M. Navascués, S. Pironio, and A. Acín. A convergent hierarchy of semidefinite programs characterizing the set of quantum correlations. New J. Phys., 10:073013, 2008. E-print: arXiv:0803.4290 [quant-ph]