BellScenario.jl - Strategies
BellScenario.AbstractStrategy
— TypeAn AbstractStrategy
is an abstract type parent to all strategy matrices. A black-box device is characterized by its conditional probabilities which can be organized into a strategy matrix or column-stochastic map $S : \mathcal{X} \to \mathcal{Y}$. The strategy matrix $S$ is constructed as follows,
\[S = \sum_{x,y} P(y|x) |y\rangle\langle x|\]
where the elements of a strategy matrix must be non-negative and normalized:
- $P(y|x) \geq 0$
- $\sum_y P(y|x) = 1$
Since strategies are just stochastic matrices, the product of two strategies yields a new strategy, e.g. $S_A*S_B = S_C$.
*(S1::AbstractStrategy, S2::AbstractStrategy) :: Strategy
When multiplied together, two strategies may represent a new Scenario
, hence, a the multiplication operator can also be passed a Scenario
.
*(S1::AbstractStrategy, S2::AbstractStrategy, scenario::Scenario) :: Strategy
BellScenario.Strategy
— TypeStrategy(conditionals :: Matrix{<:Real}; atol::Float64 = 1e-7) <: AbstractMatrix{Float64}
Strategy(conditionals :: Conditionals; atol::Float64 = 1e-7) <: AbstractMatrix{Float64}
The conditionals
parameter is a column stochastic matrix. The conditionals
can either be accepted in a raw Matrix{<:Real}
format or as a Conditionals
type from QBase.jl. The atol
parameter expresses the absolute tolerance for numerical error in the constraints of conditional probablities. By default, the constructor creates a strategy for a 'BlackBox' scenario. However, a Scenario
can be passed to the Strategy
constructor.
Strategy(conditionals :: Matrix{<:Real}, scenario :: Scenario, atol::Float64=1e-7)
Errors:
A DomainError
is thrown if:
- The provided
Scenario
does not match the expected dimension of theconditionals
matrix. - The
conditionals
matrix is not a valid stochastic matrix, e.g. non-negative and normalized.
BellScenario.strategy_dims
— Functionstrategy_dims( scenario :: Scenario ) :: Tuple{Int64, Int64}
Returns the dimensions of the Conditionals
matrix describing a Strategy
for the Scenario
at hand. Each Scenario
, can place unique constraints on the matrix dimensions, therfore, separate methods are called for each concrete Scenario
.
BellScenario.random_strategy
— Functionrandom_strategy(
num_inputs :: Int64,
num_outputs :: Int64;
) :: Strategy
Constructs a randomized Strategy
matrix. Zeros are inserted into the strategy to ensure that it does not closely resemble a uniform distribution.
Deterministic Strategies
BellScenario.DeterministicStrategy
— TypeDeterministicStrategy(conditionals :: Matrix{Int64}) <: AbstractStrategy{Int64}
A strategy matrix describing the behavior of a deterministic black-box. A strategy deterministic if its elements satisfy $P(y|x)\in\{0,1\}$ in addition to the non-negativity and normalization constraints. By default, the constructor creates a strategy for a 'BlackBox' scenario, however, a Scenario
can be passed to the DeterministicStrategy
constructor.
DeterministicStrategy(conditionals :: Matrix{Int}, scenario :: Scenario)
The product of two deterministic strategies is a DeterministicStrategy
.
*(S1::DeterministicStrategy, S2::DeterministicStrategy) :: DeterministicStrategy
When multiplied a new Scenario
can be specified.
*(
S1::DeterministicStrategy,
S2::DeterministicStrategy,
scenario::Scenario
) :: Deterministic Strategy
Errors:
A DomainError
is thrown if:
- The provided
Scenario
does not match the dimension of theconditionals
matrix. - The elements of
conditionals
are not0
or1
. - The strategy elements are not non-negative and normalized.
BellScenario.is_deterministic
— Functionis_deterministic( strategy :: AbstractMatrix ) :: Bool
Returns true
if all elements of strategy
are either 0
or 1
and the matrix is a valid conditional probability distribution.
BellScenario.deterministic_strategies
— Functiondeterministic_strategies(scenario :: BlackBox) :: Vector{Matrix{Int64}}
deterministic_strategies(num_out :: Int64, num_in :: Int64) :: Vector{Matrix{Int64}}
Enumerates the set of deterministic strategies for the specified BlackBox
. For performance, enumerated deterministic strategies are left as matrices and not constructed into DeterministicStrategy
types.
Quantum Strategies
BellScenario.quantum_strategy
— FunctionConstructs a strategy matrix given quantum states and measurements. The supported scenarios include:
BlackBox
scenarios:
quantum_strategy(
Π :: AbstractVector{<:AbstractMatrix},
ρ_states :: Vector{<:State};
atol=1e-7::Float64
) :: Strategy
For a quantum system the conditional proabilities are constructed as
\[ P(y|x) = \text{Tr}[\Pi_y\rho_x].\]
LocalSignaling
scenarios:
quantum_strategy(
Π :: AbstractVector{<:AbstractMatrix},
ρ_states :: Vector{<:AbstractMatrix},
scenario :: LocalSignaling;
atol=1e-7::Float64
) :: Strategy
For quantum systems the conditional probabilities are construct as
\[ P(y|x) = \text{Tr}[\Pi_y\rho_x].\]
A DomainError
is thrown if the provided states and measurements are not compatible with the specified scenario.
BipartiteNonSignaling
scenarios:
quantum_strategy(
ρ_AB :: AbstractMatrix,
Π_Ax :: Vector{<:AbstractVector{<:AbstractMatrix}},
Π_By :: Vector{<:AbstractVector{<:AbstractMatrix}},
scenario :: BipartiteNonSignaling;
atol::Float64 = 1e-7
)
Constructs a strategy matrix in the generalized representation for the quantum system with conditional probabilities.
\[ P(ab|xy) = \text{Tr}[(\Pi_a^x\otimes\Pi_b^y)\rho_{AB}]\]
A DomainError
is thrown if
- The length of each POVM does not match the scenarios number of outputs
- The number of each party's POVMS doesn't match the the number of inputs.
Behaviors
The conditional probabilities of a Bell scenario can be represented by data structures other than a Strategy
matrix. Most notably, the conditional probabilities can be organized into a vector referred to as a behavior in the literature. A behavior is a column-major vectorization of a strategy matrix e.g. S[:]
. The dimension of the behavior vector (or strategy matrix) can be reduced to an equivalent subspace by using the normalization and non-signaling constraints to removed redundant parameters of the conditional probability distribution.
Subspaces used within BellScenario.jl include:
"generalized"
- All conditional probabilities $P(y|x)$ for the Bell scenario are present."normalized"
- The normalization constraint on each column is used to remove the last row of the strategy matrix."non-signaling"
- The non-signaling constraints are applied to reduce the"normalized"
subspace further.
Conversion Methods
Strategy matrices and behavior vectors are isomorphic representations. Therefore, a behavior can be converted into a strategy and vice versa.
Currently, behaviors are loosely represented by Vector{Int64}
and Vector{Float64}
types and a rep
argument is used to specify the subspace. This may change in future updates of BellScenario.jl.
Base.convert
— MethodVertex (Vector{Int64}
) -> DeterministicStrategy
convert(
::Type{DeterministicStrategy},
vertex :: Vector{Int64},
scenario :: Scenario;
rep = "normalized" :: String
)
Base.convert
— Methodconvert(
S :: Type{<:AbstractStrategy}, vertex::Vector{<:Real}, scenario::BipartiteNonSignaling;
rep="non-signaling" :: String
)
Transforms a behavior vector or vertex in to either a Strategy
or DeterministicStrategy
. If converting into a DeterministicStrategy
, the vertex must contain Int64
values. Valid representations are "non-signaling", "normalized", and "generalized".
Base.convert
— MethodDeterministicStrategy
-> Vertex (Vector{Int64}
)
convert(
::Type{Vector{Int64}},
strategy :: DeterministicStrategy;
rep = "normalized" :: String
)