state_opt.npa_hierarchy

Generates the NPA constraints.

Attributes

Classes

Functions

_reduce(word)

Reduce an operator word to its canonical form using NPA rules.

_parse(k_str)

_gen_words(k, a_out, a_in, b_out, b_in)

_is_zero(word)

_is_identity(word)

_is_meas(word)

_is_meas_on_one_player(word)

_get_nonlocal_game_params(assemblage[, referee_dim])

npa_constraints(assemblage[, k, referee_dim])

Generate the constraints specified by the NPA hierarchy up to a finite level.

Module Contents

class state_opt.npa_hierarchy.Symbol

Bases: tuple

player
question
answer
state_opt.npa_hierarchy.IDENTITY_SYMBOL
state_opt.npa_hierarchy.PLAYERS = ('Alice', 'Bob')
state_opt.npa_hierarchy._reduce(word)

Reduce an operator word to its canonical form using NPA rules.

Identity: I*S = S*I = S, I*I = I Commutation: Alice operators commute with Bob operators. Canonical form: A…AB…B Orthogonality: P_x,a P_x,b = 0 if a != b (for same player x) Idempotence: P_x,a P_x,a = P_x,a (for same player x)

Parameters:

word (tuple[Symbol, Ellipsis])

Return type:

tuple[Symbol, Ellipsis]

state_opt.npa_hierarchy._parse(k_str)
Parameters:

k_str (str)

Return type:

tuple[int, set[tuple[int, int]]]

state_opt.npa_hierarchy._gen_words(k, a_out, a_in, b_out, b_in)
Parameters:
  • k (int | str)

  • a_out (int)

  • a_in (int)

  • b_out (int)

  • b_in (int)

Return type:

list[tuple[Symbol, Ellipsis]]

state_opt.npa_hierarchy._is_zero(word)
Parameters:

word (tuple[Symbol, Ellipsis])

Return type:

bool

state_opt.npa_hierarchy._is_identity(word)
Parameters:

word (tuple[Symbol, Ellipsis])

Return type:

bool

state_opt.npa_hierarchy._is_meas(word)
Parameters:

word (tuple[Symbol, Ellipsis])

Return type:

bool

state_opt.npa_hierarchy._is_meas_on_one_player(word)
Parameters:

word (tuple[Symbol, Ellipsis])

Return type:

bool

state_opt.npa_hierarchy._get_nonlocal_game_params(assemblage, referee_dim=1)
Parameters:
  • assemblage (dict[tuple[int, int], cvxpy.Variable])

  • referee_dim (int)

Return type:

tuple[int, int, int, int]

state_opt.npa_hierarchy.npa_constraints(assemblage, k=1, referee_dim=1)

Generate the constraints specified by the NPA hierarchy up to a finite level.

[1]

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 1 measurement, all products of one Alice and one Bob measurement, and all products of two Alice and one Bob measurement.

The commuting measurement assemblage operator must be given as a dictionary. The keys are tuples of Alice and Bob questions \(x, y\) and the values are cvxpy Variables which are matrices with entries:

\[K_{xy}\Big(i + a \cdot dim_R, j + b \cdot dim_R \Big) = \langle i| \text{Tr}_{\mathcal{H}} \Big( \big( I_R \otimes A_a^x B_b^y \big) \sigma \Big) |j \rangle\]

References

Parameters:
  • assemblage (dict[tuple[int, int], cvxpy.Variable]) – The commuting measurement assemblage operator.

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

  • referee_dim (int) – The dimension of the referee’s quantum system (default=1).

Returns:

A list of cvxpy constraints.

Return type:

list[cvxpy.constraints.constraint.Constraint]