Note
Go to the end to download the full example code.
The BB84 extended nonlocal game¶
In our Extended nonlocal games tutorial, we introduced the framework for extended nonlocal games. Now, we will construct our first concrete example, the BB84 extended nonlocal game.
The BB84 extended nonlocal game is defined as follows. Let \(\Sigma_A = \Sigma_B = \Gamma_A = \Gamma_B = \{0,1\}\), define
define
for all \(a \not= b\) or \(x \not= y\), define \(\pi(0,0) = \pi(1,1) = 1/2\), and define \(\pi(x,y) = 0\) if \(x \not=y\).
We can encode the BB84 game, \(G_{BB84} = (\pi, V)\), in numpy
arrays where prob_mat corresponds to the probability distribution
\(\pi\) and where pred_mat corresponds to the operator \(V\).
45 # Define the BB84 extended nonlocal game.
46 import numpy as np
47
48 from toqito.states import basis
49
50 # The basis: {|0>, |1>}:
51 e_0, e_1 = basis(2, 0), basis(2, 1)
52
53 # The basis: {|+>, |->}:
54 e_p = (e_0 + e_1) / np.sqrt(2)
55 e_m = (e_0 - e_1) / np.sqrt(2)
56
57 # The dimension of referee's measurement operators:
58 dim = 2
59 # The number of outputs for Alice and Bob:
60 a_out, b_out = 2, 2
61 # The number of inputs for Alice and Bob:
62 a_in, b_in = 2, 2
63
64 # Define the predicate matrix V(a,b|x,y) \in Pos(R)
65 bb84_pred_mat = np.zeros([dim, dim, a_out, b_out, a_in, b_in])
66
67 # V(0,0|0,0) = |0><0|
68 bb84_pred_mat[:, :, 0, 0, 0, 0] = e_0 @ e_0.conj().T
69 # V(1,1|0,0) = |1><1|
70 bb84_pred_mat[:, :, 1, 1, 0, 0] = e_1 @ e_1.conj().T
71 # V(0,0|1,1) = |+><+|
72 bb84_pred_mat[:, :, 0, 0, 1, 1] = e_p @ e_p.conj().T
73 # V(1,1|1,1) = |-><-|
74 bb84_pred_mat[:, :, 1, 1, 1, 1] = e_m @ e_m.conj().T
75
76 # The probability matrix encode \pi(0,0) = \pi(1,1) = 1/2
77 bb84_prob_mat = 1 / 2 * np.identity(2)
The unentangled value of the BB84 extended nonlocal game¶
It was shown in [1] and [2] that
This can be verified in |toqito⟩ as follows.
94 # Calculate the unentangled value of the BB84 extended nonlocal game.
95 import numpy as np
96
97 from toqito.nonlocal_games.extended_nonlocal_game import ExtendedNonlocalGame
98
99 # Define an ExtendedNonlocalGame object based on the BB84 game.
100 bb84 = ExtendedNonlocalGame(bb84_prob_mat, bb84_pred_mat)
101
102 # The unentangled value is cos(pi/8)**2 \approx 0.85356
103 print("The unentangled value is ", np.around(bb84.unentangled_value(), decimals=2))
The unentangled value is 0.85
The BB84 game also exhibits strong parallel repetition. We can specify how many
parallel repetitions for |toqito⟩ to run. The example below provides an
example of two parallel repetitions for the BB84 game.
110 # The unentangled value of BB84 under parallel repetition.
111 import numpy as np
112
113 from toqito.nonlocal_games.extended_nonlocal_game import ExtendedNonlocalGame
114
115 # Define the bb84 game for two parallel repetitions.
116 bb84_2_reps = ExtendedNonlocalGame(bb84_prob_mat, bb84_pred_mat, 2)
117
118 # The unentangled value for two parallel repetitions is cos(pi/8)**4 \approx 0.72855
119 print("The unentangled value for two parallel repetitions is ", np.around(bb84_2_reps.unentangled_value(), decimals=2))
The unentangled value for two parallel repetitions is 0.73
It was shown in [2] that the BB84 game possesses the property of strong parallel repetition. That is,
for any integer \(r\).
The standard quantum value of the BB84 extended nonlocal game¶
We can calculate lower bounds on the standard quantum value of the BB84 game
using |toqito⟩ as well.
136 # Calculate lower bounds on the standard quantum value of the BB84 extended nonlocal game.
137 import numpy as np
138
139 from toqito.nonlocal_games.extended_nonlocal_game import ExtendedNonlocalGame
140
141 # Define an ExtendedNonlocalGame object based on the BB84 game.
142 bb84_lb = ExtendedNonlocalGame(bb84_prob_mat, bb84_pred_mat)
143
144 # The standard quantum value is cos(pi/8)**2 \approx 0.85356
145 print("The standard quantum value is ", np.around(bb84_lb.quantum_value_lower_bound(), decimals=2))
/home/docs/checkouts/readthedocs.org/user_builds/toqito/envs/latest/lib/python3.11/site-packages/scs/__init__.py:83: UserWarning: Converting A to a CSC (compressed sparse column) matrix; may take a while.
warn(
The standard quantum value is 0.85
From [2], it is known that \(\omega(G_{BB84}) = \omega^*(G_{BB84})\), however, if we did not know this beforehand, we could attempt to calculate upper bounds on the standard quantum value.
There are a few methods to do this, but one easy way is to simply calculate the non-signaling value of the game as this provides a natural upper bound on the standard quantum value. Typically, this bound is not tight and usually not all that useful in providing tight upper bounds on the standard quantum value, however, in this case, it will prove to be useful.
The non-signaling value of the BB84 extended nonlocal game¶
Using |toqito⟩, we can see that \(\omega_{ns}(G) = \cos^2(\pi/8)\).
163 # Calculate the non-signaling value of the BB84 extended nonlocal game.
164 import numpy as np
165
166 from toqito.nonlocal_games.extended_nonlocal_game import ExtendedNonlocalGame
167
168 # Define an ExtendedNonlocalGame object based on the BB84 game.
169 bb84 = ExtendedNonlocalGame(bb84_prob_mat, bb84_pred_mat)
170
171 # The non-signaling value is cos(pi/8)**2 \approx 0.85356
172 print("The non-signaling value is ", np.around(bb84.nonsignaling_value(), decimals=2))
The non-signaling value is 0.85
So we have the relationship that
It turns out that strong parallel repetition does not hold in the non-signaling scenario for the BB84 game. This was shown in [3], and we can observe this by the following snippet.
184 # The non-signaling value of BB84 under parallel repetition.
185 import numpy as np
186
187 from toqito.nonlocal_games.extended_nonlocal_game import ExtendedNonlocalGame
188
189 # Define the bb84 game for two parallel repetitions.
190 bb84_2_reps = ExtendedNonlocalGame(bb84_prob_mat, bb84_pred_mat, 2)
191
192 # The non-signaling value for two parallel repetitions is cos(pi/8)**4 \approx 0.73825
193 print(
194 "The non-signaling value for two parallel repetitions is ", np.around(bb84_2_reps.nonsignaling_value(), decimals=2)
195 )
The non-signaling value for two parallel repetitions is 0.74
Note that \(0.73825 \geq \cos(\pi/8)^4 \approx 0.72855\) and therefore we have that
for \(r = 2\).
Next, we will explore another well-known example, The CHSH extended nonlocal game, and see how its properties compare.
References¶
Total running time of the script: (0 minutes 6.039 seconds)