nonlocal_games.extended_nonlocal_game

Two-player extended nonlocal game.

Classes

ExtendedNonlocalGame

Create two-player extended nonlocal game object.

Module Contents

class nonlocal_games.extended_nonlocal_game.ExtendedNonlocalGame(prob_mat, pred_mat, reps=1)

Create two-player extended nonlocal game object.

Extended nonlocal games are a superset of nonlocal games in which the players share a tripartite state with the referee. In such games, the winning conditions for Alice and Bob may depend on outcomes of measurements made by the referee, on its part of the shared quantum state, in addition to Alice and Bob’s answers to the questions sent by the referee.

Extended nonlocal games were initially defined in [1] and more information on these games can be found in [2].

An example demonstration is available as a tutorial in the documentation. Go to Extended nonlocal games.

References

Parameters:
  • prob_mat (numpy.ndarray)

  • pred_mat (numpy.ndarray)

  • reps (int)

__get_game_dims()

Initialize game dimensions from the prediction matrix.

This private method checks whether the game dimensions have already been initialized by inspecting the ‘_dims_initialized_by_get_game_dims’ flag. If not, it extracts the dimensions from the shape of ‘self.pred_mat’ and assigns the following instance attributes:

  • referee_dim: The first dimension of self.pred_mat.

  • num_alice_out: The third element of self.pred_mat.shape.

  • num_bob_out: The fourth element.

  • num_alice_in: The fifth element.

  • num_bob_in: The sixth element.

After extracting these values, the flag ‘_dims_initialized_by_get_game_dims’ is set to True to prevent re-initialization on subsequent calls.

unentangled_value()

Calculate the unentangled value of an extended nonlocal game.

The unentangled value of an extended nonlocal game is the supremum value for Alice and Bob’s winning probability in the game over all unentangled strategies. Due to convexity and compactness, it is possible to calculate the unentangled extended nonlocal game by:

\[\omega(G) = \max_{f, g} \lVert \sum_{(x,y) \in \Sigma_A \times \Sigma_B} \pi(x,y) V(f(x), g(y)|x, y) \rVert\]

where the maximum is over all functions \(f : \Sigma_A \rightarrow \Gamma_A\) and \(g : \Sigma_B \rightarrow \Gamma_B\).

Returns:

The unentangled value of the extended nonlocal game.

Return type:

float

nonsignaling_value()

Calculate the non-signaling value of an extended nonlocal game.

The non-signaling value of an extended nonlocal game is the supremum value of the winning probability of the game taken over all non-signaling strategies for Alice and Bob.

A non-signaling strategy for an extended nonlocal game consists of a function

\[K : \Gamma_A \times \Gamma_B \times \Sigma_A \times \Sigma_B \rightarrow \text{Pos}(\mathcal{R})\]

such that

\[\sum_{a \in \Gamma_A} K(a,b|x,y) = \rho_b^y \quad \text{and} \quad \sum_{b \in \Gamma_B} K(a,b|x,y) = \sigma_a^x,\]

for all \(x \in \Sigma_A\) and \(y \in \Sigma_B\) where \(\{\rho_b^y : y \in \Sigma_A, \ b \in \Gamma_B\}\) and \(\{\sigma_a^x : x \in \Sigma_A, \ a \in \Gamma_B\}\) are collections of operators satisfying

\[\sum_{a \in \Gamma_A} \rho_b^y = \tau = \sum_{b \in \Gamma_B} \sigma_a^x,\]

for every choice of \(x \in \Sigma_A\) and \(y \in \Sigma_B\) where \(\tau \in \text{D}(\mathcal{R})\) is a density operator.

Returns:

The non-signaling value of the extended nonlocal game.

Return type:

float

quantum_value_lower_bound(iters=20, tol=1e-08, seed=None, initial_bob_is_random=False, solver=cvxpy.SCS, solver_params=None, verbose=False)

Calculate lower bound on the quantum value of an extended nonlocal game.

Uses an iterative see-saw method involving two SDPs.

Parameters:
  • iter – Maximum number of see-saw iterations (Alice optimizes, Bob optimizes (default is 20).

  • tol (float) – Tolerance for stopping see-saw iteration based on improvement (default is 1e-8).

  • seed (int) – Optional seed for initializing random POVMs for reproducibility (default is None).

  • solver (str) – Optional option for different solver (default is SCS).

  • solver_params (dict) – Optional parameters for solver (default is {“eps”: 1e-8, “verbose”: False}).

  • verbos – Optional printout for optimizer step (default is False).

  • iters (int)

  • initial_bob_is_random (bool | dict)

  • verbose (bool)

Returns:

The best lower bound found on the quantum value.

Return type:

float

__optimize_alice(fixed_bob_povms_np, solver=cvxpy.SCS, solver_params=None)

Fix Bob’s measurements and optimize over Alice’s measurements.

Parameters:
  • fixed_bob_povms_np (dict)

  • solver (str)

  • solver_params (dict)

Return type:

tuple[dict | None, cvxpy.Problem]

__optimize_bob(alice_rho_cvxpy_vars, solver=cvxpy.SCS, solver_params=None)

Fix Alice’s measurements and optimize over Bob’s measurements.

Parameters:
  • alice_rho_cvxpy_vars (dict | None)

  • solver (str)

  • solver_params (dict)

Return type:

tuple[dict | None, cvxpy.Problem]

commuting_measurement_value_upper_bound(k=1)

Compute an upper bound on the commuting measurement value of an extended nonlocal game.

This function calculates an upper bound on the commuting measurement value by using k-levels of the NPA hierarchy [3]. The NPA hierarchy is a uniform family of semidefinite programs that converges to the commuting measurement value of any extended nonlocal game.

You can determine the level of the hierarchy by a positive integer or 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 one measurement, all products of one Alice and one Bob measurement, and all products of two Alice and one Bob measurements.

References

Parameters:

k (int | str) – The level of the NPA hierarchy to use (default=1).

Returns:

The upper bound on the commuting strategy value of an extended nonlocal game.

Return type:

float