Skip to content

state_exclusion

Calculates the probability of error of single state conclusive state exclusion.

state_exclusion

state_exclusion(
    vectors: list[ndarray],
    probs: list[float] | None = None,
    strategy: str = "min_error",
    measurement: str = "positive",
    subsystems: list[int] | None = None,
    dimensions: list[int] | None = None,
    solver: str = "cvxopt",
    primal_dual: str = "dual",
    reps: int = 5,
    tol: float = 1e-07,
    max_iters: int = 100,
    num_alice_outcomes: int | None = None,
    seed: int | None = None,
    **kwargs: Any,
) -> tuple[
    float,
    list[HermitianVariable]
    | list[ndarray]
    | tuple[HermitianVariable, RealVariable],
]

Compute probability of error of single state conclusive state exclusion.

The quantum state exclusion problem involves a collection of \(n\) quantum states

\[ \rho = \{ \rho_0, \ldots, \rho_n \}, \]

as well as a list of corresponding probabilities

\[ p = \{ p_0, \ldots, p_n \}. \]

Alice chooses \(i\) with probability \(p_i\) and creates the state \(\rho_i\).

Bob wants to guess which state he was not given from the collection of states. State exclusion implies that ability to discard at least one out of the "n" possible quantum states by applying a measurement.

For strategy = "min_error", this is the default method that yields the minimal probability of error for Bob.

In that case, this function implements the following semidefinite program that provides the optimal probability with which Bob can conduct quantum state exclusion.

\[ \begin{equation} \begin{aligned} \text{minimize:} \quad & \sum_{i=1}^n p_i \langle M_i, \rho_i \rangle \\ \text{subject to:} \quad & \sum_{i=1}^n M_i = \mathbb{I}_{\mathcal{X}}, \\ & M_0, \ldots, M_n \in \text{Pos}(\mathcal{X}). \end{aligned} \end{equation} \]
\[ \begin{equation} \begin{aligned} \text{maximize:} \quad & \text{Tr}(Y) \\ \text{subject to:} \quad & Y \preceq p_1\rho_1, \\ & Y \preceq p_2\rho_2, \\ & \vdots \\ & Y \preceq p_n\rho_n, \\ & Y \in\text{Herm}(\mathcal{X}). \end{aligned} \end{equation} \]

If measurement = "ppt", the measurement operators are also constrained to be positive under partial transpose on the requested subsystem(s). In the primal minimum-error problem, this adds the constraints

\[ \Gamma_j(M_i) \succeq 0 \]

for every measurement operator \(M_i\) and for the subsystem(s) \(j\) listed in subsystems, where \(\Gamma_j\) is the partial transpose map with subsystem dimensions dimensions. The corresponding dual uses the dual PPT cone, \(\text{Pos} + \Gamma_j(\text{Pos})\), so the constraints become

\[ p_i\rho_i - Y \in \text{Pos} + \Gamma_j(\text{Pos}). \]

If measurement = "locc", the measurement is restricted to one-way local operations and classical communication on a bipartite system with subsystem dimensions dimensions = [dim_A, dim_B]. Alice measures her subsystem with a POVM \(\{A_a\}\), sends the outcome to Bob, who applies a conditional POVM \(\{B^a_k\}\); the induced global operator for guessing \(k\) is \(M_k = \sum_a A_a \otimes B^a_k\). Minimizing the error over \(\{A_a\}\) and \(\{B^a_k\}\) is bilinear, so it is solved by a see-saw (alternating semidefinite programs), restarted from reps random POVMs with the smallest value returned. The result is an upper bound on the optimal one-way LOCC exclusion error (and at least the global error). Only strategy = "min_error" is supported for this measurement.

For strategy = "unambiguous", Bob never provides an incorrect answer, although it is possible that his answer is inconclusive. This function then yields the probability of an inconclusive outcome.

In that case, this function implements the following semidefinite program that provides the optimal probability with which Bob can conduct unambiguous quantum state distinguishability.

\[ \begin{align*} \text{minimize:} \quad & \text{Tr}\left( \left(\sum_{i=1}^n p_i\rho_i\right)\left(\mathbb{I}-\sum_{i=1}^nM_i\right) \right) \\ \text{subject to:} \quad & \sum_{i=1}^nM_i \preceq \mathbb{I},\\ & M_1, \ldots, M_n \succeq 0, \\ & \langle M_1, \rho_1 \rangle, \ldots, \langle M_n, \rho_n \rangle =0 \end{align*} \]
\[ \begin{align*} \text{maximize:} \quad & 1 - \text{Tr}(N) \\ \text{subject to:} \quad & a_1p_1\rho_1, \ldots, a_np_n\rho_n \succeq \sum_{i=1}^np_i\rho_i - N,\\ & N \succeq 0,\\ & a_1, \ldots, a_n \in\mathbb{R} \end{align*} \]

Note

This function supports both pure states (vectors) and mixed states (density matrices). Linear dependence does not imply perfect exclusion: the identical pair \(|0\rangle, |0\rangle\) is linearly dependent yet cannot be excluded (Bob can never rule out \(|0\rangle\)). A sufficient condition for perfect exclusion (a value of 0) is that the states span a strict subspace of the full space, since then a measurement along a complementary direction excludes with certainty.

The conclusive state exclusion SDP is written explicitly in 1. The problem of conclusive state exclusion was also thought about under a different guise in 2.

Parameters:

  • vectors (list[ndarray]) –

    A list of states provided as vectors (for pure states) or density matrices (for mixed states).

  • probs (list[float] | None, default: None ) –

    Respective list of probabilities each state is selected. If no probabilities are provided, a uniform probability distribution is assumed.

  • strategy (str, default: 'min_error' ) –

    Whether to perform minimal error or unambiguous discrimination task. Possible values are "min_error" and "unambiguous". Both strategies support pure and mixed states.

  • measurement (str, default: 'positive' ) –

    The type of measurement to use. Possible values are "positive" (default) for standard positive measurements, "ppt" for PPT (positive partial transpose) measurements, and "locc" for one-way LOCC measurements (solved by a see-saw, see below).

  • subsystems (list[int] | None, default: None ) –

    A list of integers specifying which subsystems to transpose for PPT measurements. Required when measurement="ppt".

  • dimensions (list[int] | None, default: None ) –

    A list of integers specifying the dimensions of each subsystem. Required when measurement="ppt", and required as the two subsystem dimensions [dim_A, dim_B] when measurement="locc".

  • solver (str, default: 'cvxopt' ) –

    Optimization option for picos solver. Default option is solver_option="cvxopt".

  • primal_dual (str, default: 'dual' ) –

    Option for the optimization problem.

  • reps (int, default: 5 ) –

    Number of random see-saw restarts for measurement="locc". The smallest value found is returned.

  • tol (float, default: 1e-07 ) –

    Convergence tolerance on the see-saw error decrease for measurement="locc".

  • max_iters (int, default: 100 ) –

    Maximum number of see-saw iterations per restart for measurement="locc".

  • num_alice_outcomes (int | None, default: None ) –

    Number of outcomes available to Alice for measurement="locc". Defaults to the number of states; allowing more outcomes can only lower the value.

  • seed (int | None, default: None ) –

    Base seed for the random initial POVMs when measurement="locc" (restart r uses seed + r).

  • kwargs (Any, default: {} ) –

    Additional arguments to pass to picos' solve method.

Returns:

  • float

    The optimal probability with which Bob can guess the state he was not given from states along with the optimal

  • list[HermitianVariable] | list[ndarray] | tuple[HermitianVariable, RealVariable]

    set of measurements.

Examples:

Consider the following two Bell states

\[ \begin{equation} \begin{aligned} u_0 &= \frac{1}{\sqrt{2}} \left( |00 \rangle + |11 \rangle \right), \\ u_1 &= \frac{1}{\sqrt{2}} \left( |00 \rangle - |11 \rangle \right). \end{aligned} \end{equation} \]

It is not possible to conclusively exclude either of the two states. We can see that the result of the function in |toqito⟩ yields a value of \(0\) as the probability for this to occur.

import numpy as np
from toqito.states import bell
from toqito.state_opt import state_exclusion

vectors = [bell(0), bell(1)]
probs = [1/2, 1/2]

print(np.around(state_exclusion(vectors, probs)[0], decimals=2))
0.0

Unambiguous state exclusion for unbiased pure states.

import numpy as np
from toqito.state_opt import state_exclusion

states = [np.array([[1.], [0.]]), np.array([[1.],[1.]]) / np.sqrt(2)]

res, _ = state_exclusion(states, primal_dual="primal", strategy="unambiguous", abs_ipm_opt_tol=1e-7)

print(np.around(res, decimals=2))
0.71

State exclusion for mixed states.

import numpy as np
from toqito.state_opt import state_exclusion

# Two mixed states
rho1 = 0.7 * np.array([[1., 0.], [0., 0.]]) + 0.3 * np.eye(2) / 2
rho2 = 0.7 * np.array([[0., 0.], [0., 1.]]) + 0.3 * np.eye(2) / 2
states = [rho1, rho2]

res, _ = state_exclusion(states, primal_dual="dual")

print(np.around(res, decimals=2))
0.15

PPT-constrained minimum-error state exclusion.

import numpy as np
from toqito.state_opt import state_exclusion
from toqito.states import bell

states = [bell(0), bell(1), bell(2)]

res, _ = state_exclusion(
    states,
    measurement="ppt",
    subsystems=[0],
    dimensions=[2, 2],
    primal_dual="primal",
    cvxopt_kktsolver="ldl",
)

print(np.around(res, decimals=2))

Note

If you encounter a ZeroDivisionError or an ArithmeticError when using cvxopt as a solver (which is the default), you might want to set the abs_ipm_opt_tol option to a lower value (the default being 1e-8) or to set the cvxopt_kktsolver option to ldl.

See https://gitlab.com/picos-api/picos/-/issues/341

References

1 Bandyopadhyay, Somshubhro and Jain, Rahul and Oppenheim, Jonathan and Perry, Christopher. Conclusive exclusion of quantum states. Physical Review A. vol. 89(2). (2014). doi:10.1103/physreva.89.022336.
2 Pusey, Matthew and Barrett, Jonathan and Rudolph, Terry. On the reality of the quantum state. Nature Physics. vol. 8(6). (2012). doi:10.1038/nphys2309.

Source code in toqito/state_opt/state_exclusion.py
def state_exclusion(
    vectors: list[np.ndarray],
    probs: list[float] | None = None,
    strategy: str = "min_error",
    measurement: str = "positive",
    subsystems: list[int] | None = None,
    dimensions: list[int] | None = None,
    solver: str = "cvxopt",
    primal_dual: str = "dual",
    reps: int = 5,
    tol: float = 1e-7,
    max_iters: int = 100,
    num_alice_outcomes: int | None = None,
    seed: int | None = None,
    **kwargs: Any,
) -> tuple[
    float, list[picos.HermitianVariable] | list[np.ndarray] | tuple[picos.HermitianVariable, picos.RealVariable]
]:
    r"""Compute probability of error of single state conclusive state exclusion.

    The *quantum state exclusion* problem involves a collection of \(n\) quantum states

    \[
        \rho = \{ \rho_0, \ldots, \rho_n \},
    \]

    as well as a list of corresponding probabilities

    \[
        p = \{ p_0, \ldots, p_n \}.
    \]

    Alice chooses \(i\) with probability \(p_i\) and creates the state \(\rho_i\).

    Bob wants to guess which state he was *not* given from the collection of states. State exclusion implies that
    ability to discard at least one out of the "n" possible quantum states by applying a measurement.

    For `strategy = "min_error"`, this is the default method that yields the minimal probability of error for Bob.

    In that case, this function implements the following semidefinite program that provides the optimal probability
    with which Bob can conduct quantum state exclusion.

    \[
        \begin{equation}
            \begin{aligned}
                \text{minimize:} \quad & \sum_{i=1}^n p_i \langle M_i, \rho_i \rangle \\
                \text{subject to:} \quad & \sum_{i=1}^n M_i = \mathbb{I}_{\mathcal{X}}, \\
                                            & M_0, \ldots, M_n \in \text{Pos}(\mathcal{X}).
            \end{aligned}
        \end{equation}
    \]

    \[
        \begin{equation}
            \begin{aligned}
                \text{maximize:} \quad & \text{Tr}(Y) \\
                \text{subject to:} \quad & Y \preceq p_1\rho_1, \\
                                            & Y \preceq p_2\rho_2, \\
                                            & \vdots \\
                                            & Y \preceq p_n\rho_n, \\
                                            & Y \in\text{Herm}(\mathcal{X}).
            \end{aligned}
        \end{equation}
    \]

    If `measurement = "ppt"`, the measurement operators are also constrained to be positive under partial transpose on
    the requested subsystem(s). In the primal minimum-error problem, this adds the constraints

    \[
        \Gamma_j(M_i) \succeq 0
    \]

    for every measurement operator \(M_i\) and for the subsystem(s) \(j\) listed in `subsystems`, where \(\Gamma_j\)
    is the partial transpose map with subsystem dimensions `dimensions`. The corresponding dual uses the dual PPT cone,
    \(\text{Pos} + \Gamma_j(\text{Pos})\), so the constraints become

    \[
        p_i\rho_i - Y \in \text{Pos} + \Gamma_j(\text{Pos}).
    \]

    If `measurement = "locc"`, the measurement is restricted to one-way local operations and classical communication on
    a bipartite system with subsystem dimensions `dimensions = [dim_A, dim_B]`. Alice measures her subsystem with a POVM
    \(\{A_a\}\), sends the outcome to Bob, who applies a conditional POVM \(\{B^a_k\}\); the induced global operator for
    guessing \(k\) is \(M_k = \sum_a A_a \otimes B^a_k\). Minimizing the error over \(\{A_a\}\) and \(\{B^a_k\}\) is
    bilinear, so it is solved by a see-saw (alternating semidefinite programs), restarted from `reps` random POVMs with
    the smallest value returned. The result is an upper bound on the optimal one-way LOCC exclusion error (and at least
    the global error). Only `strategy = "min_error"` is supported for this measurement.

    For `strategy = "unambiguous"`, Bob never provides an incorrect answer, although it is
    possible that his answer is inconclusive. This function then yields the probability of an inconclusive outcome.

    In that case, this function implements the following semidefinite program that provides the
    optimal probability with which Bob can conduct unambiguous quantum state distinguishability.

    \[
        \begin{align*}
            \text{minimize:} \quad & \text{Tr}\left(
                \left(\sum_{i=1}^n p_i\rho_i\right)\left(\mathbb{I}-\sum_{i=1}^nM_i\right)
                \right) \\
            \text{subject to:} \quad & \sum_{i=1}^nM_i \preceq \mathbb{I},\\
                                     & M_1, \ldots, M_n \succeq 0, \\
                                     & \langle M_1, \rho_1 \rangle, \ldots, \langle M_n, \rho_n \rangle =0
        \end{align*}
    \]

    \[
        \begin{align*}
            \text{maximize:} \quad & 1 - \text{Tr}(N) \\
            \text{subject to:} \quad & a_1p_1\rho_1, \ldots, a_np_n\rho_n \succeq \sum_{i=1}^np_i\rho_i - N,\\
                                     & N \succeq 0,\\
                                     & a_1, \ldots, a_n \in\mathbb{R}
        \end{align*}
    \]


    !!! Note
        This function supports both pure states (vectors) and mixed states (density matrices).
        Linear dependence does not imply perfect exclusion: the identical pair \(|0\rangle, |0\rangle\)
        is linearly dependent yet cannot be excluded (Bob can never rule out \(|0\rangle\)). A
        sufficient condition for perfect exclusion (a value of 0) is that the states span a strict
        subspace of the full space, since then a measurement along a complementary direction excludes
        with certainty.

    The conclusive state exclusion SDP is written explicitly in [@bandyopadhyay2014conclusive]. The problem
    of conclusive state exclusion was also thought about under a different guise in [@pusey2012reality].

    Args:
        vectors: A list of states provided as vectors (for pure states) or density matrices (for mixed states).
        probs: Respective list of probabilities each state is selected. If no probabilities are provided, a uniform
            probability distribution is assumed.
        strategy: Whether to perform minimal error or unambiguous discrimination task. Possible values are "min_error"
            and "unambiguous". Both strategies support pure and mixed states.
        measurement: The type of measurement to use. Possible values are "positive" (default) for standard positive
            measurements, "ppt" for PPT (positive partial transpose) measurements, and "locc" for one-way LOCC
            measurements (solved by a see-saw, see below).
        subsystems: A list of integers specifying which subsystems to transpose for PPT measurements. Required when
            `measurement="ppt"`.
        dimensions: A list of integers specifying the dimensions of each subsystem. Required when `measurement="ppt"`,
            and required as the two subsystem dimensions `[dim_A, dim_B]` when `measurement="locc"`.
        solver: Optimization option for `picos` solver. Default option is `solver_option="cvxopt"`.
        primal_dual: Option for the optimization problem.
        reps: Number of random see-saw restarts for `measurement="locc"`. The smallest value found is returned.
        tol: Convergence tolerance on the see-saw error decrease for `measurement="locc"`.
        max_iters: Maximum number of see-saw iterations per restart for `measurement="locc"`.
        num_alice_outcomes: Number of outcomes available to Alice for `measurement="locc"`. Defaults to the number of
            states; allowing more outcomes can only lower the value.
        seed: Base seed for the random initial POVMs when `measurement="locc"` (restart `r` uses `seed + r`).
        kwargs: Additional arguments to pass to picos' solve method.

    Returns:
        The optimal probability with which Bob can guess the state he was not given from `states` along with the optimal
        set of measurements.

    Examples:
        Consider the following two Bell states

        \[
            \begin{equation}
                \begin{aligned}
                    u_0 &= \frac{1}{\sqrt{2}} \left( |00 \rangle + |11 \rangle \right), \\
                    u_1 &= \frac{1}{\sqrt{2}} \left( |00 \rangle - |11 \rangle \right).
                \end{aligned}
            \end{equation}
        \]

        It is not possible to conclusively exclude either of the two states. We can see that the result of the
        function in
        `|toqito⟩` yields a value of \(0\) as the probability for this to occur.

        ```python exec="1" source="above" result="text"
        import numpy as np
        from toqito.states import bell
        from toqito.state_opt import state_exclusion

        vectors = [bell(0), bell(1)]
        probs = [1/2, 1/2]

        print(np.around(state_exclusion(vectors, probs)[0], decimals=2))
        ```

        Unambiguous state exclusion for unbiased pure states.

        ```python exec="1" source="above" result="text"
        import numpy as np
        from toqito.state_opt import state_exclusion

        states = [np.array([[1.], [0.]]), np.array([[1.],[1.]]) / np.sqrt(2)]

        res, _ = state_exclusion(states, primal_dual="primal", strategy="unambiguous", abs_ipm_opt_tol=1e-7)

        print(np.around(res, decimals=2))
        ```

        State exclusion for mixed states.

        ```python exec="1" source="above" result="text"
        import numpy as np
        from toqito.state_opt import state_exclusion

        # Two mixed states
        rho1 = 0.7 * np.array([[1., 0.], [0., 0.]]) + 0.3 * np.eye(2) / 2
        rho2 = 0.7 * np.array([[0., 0.], [0., 1.]]) + 0.3 * np.eye(2) / 2
        states = [rho1, rho2]

        res, _ = state_exclusion(states, primal_dual="dual")

        print(np.around(res, decimals=2))
        ```

        PPT-constrained minimum-error state exclusion.

        ```python
        import numpy as np
        from toqito.state_opt import state_exclusion
        from toqito.states import bell

        states = [bell(0), bell(1), bell(2)]

        res, _ = state_exclusion(
            states,
            measurement="ppt",
            subsystems=[0],
            dimensions=[2, 2],
            primal_dual="primal",
            cvxopt_kktsolver="ldl",
        )

        print(np.around(res, decimals=2))
        ```

        !!! Note
            If you encounter a `ZeroDivisionError` or an `ArithmeticError` when using cvxopt as a solver (which is the
            default), you might want to set the `abs_ipm_opt_tol` option to a lower value (the default being `1e-8`) or
            to set the `cvxopt_kktsolver` option to `ldl`.

            See https://gitlab.com/picos-api/picos/-/issues/341

    """
    if measurement not in {"positive", "ppt", "locc"}:
        raise ValueError("Argument `measurement` must be 'positive', 'ppt', or 'locc'.")

    if not has_same_dimension(vectors):
        raise ValueError("Vectors for state distinguishability must all have the same dimension.")

    # Assumes a uniform probabilities distribution among the states if one is not explicitly provided.
    n = len(vectors)
    probs = [1 / n] * n if probs is None else probs
    dim = calculate_vector_matrix_dimension(vectors[0])

    if len(probs) != n:
        raise ValueError(f"The number of probabilities ({len(probs)}) must equal the number of states ({n}).")
    # `probs` are weights, not necessarily a normalized distribution (e.g. antidistinguishability passes [1]*n), so we
    # do not require them to sum to 1.
    if any(p < 0 for p in probs):
        raise ValueError("Probability vector must be nonnegative.")
    if strategy not in ("min_error", "unambiguous"):
        raise ValueError("strategy must be either 'min_error' or 'unambiguous'.")

    if primal_dual not in {"primal", "dual"}:
        raise ValueError("The primal_dual option must be either 'primal' or 'dual'.")

    if measurement == "locc":
        if strategy != "min_error":
            raise ValueError("The 'locc' measurement supports only strategy='min_error'.")
        if dimensions is None or len(dimensions) != 2:
            raise ValueError("Argument `dimensions` must be `[dim_A, dim_B]` when measurement='locc'.")
        return _locc_min_error(
            vectors=vectors,
            probs=probs,
            dimensions=dimensions,
            num_alice_outcomes=num_alice_outcomes,
            reps=reps,
            tol=tol,
            max_iters=max_iters,
            seed=seed,
        )

    if measurement == "ppt":
        _validate_ppt_params(dim=dim, subsystems=subsystems, dimensions=dimensions)
        if strategy == "min_error":
            if primal_dual == "primal":
                return _ppt_min_error_primal(
                    vectors=vectors,
                    dim=dim,
                    subsystems=subsystems,
                    dimensions=dimensions,
                    probs=probs,
                    solver=solver,
                    **kwargs,
                )
            return _ppt_min_error_dual(
                vectors=vectors,
                dim=dim,
                subsystems=subsystems,
                dimensions=dimensions,
                probs=probs,
                solver=solver,
                **kwargs,
            )
        if primal_dual == "primal":
            return _ppt_unambiguous_primal(
                vectors=vectors,
                dim=dim,
                subsystems=subsystems,
                dimensions=dimensions,
                probs=probs,
                solver=solver,
                **kwargs,
            )
        return _ppt_unambiguous_dual(
            vectors=vectors,
            dim=dim,
            subsystems=subsystems,
            dimensions=dimensions,
            probs=probs,
            solver=solver,
            **kwargs,
        )

    if strategy == "min_error":
        if primal_dual == "primal":
            return _min_error_primal(vectors=vectors, dim=dim, probs=probs, solver=solver, **kwargs)
        return _min_error_dual(vectors=vectors, dim=dim, probs=probs, solver=solver, **kwargs)

    if primal_dual == "primal":
        return _unambiguous_primal(vectors=vectors, dim=dim, probs=probs, solver=solver, **kwargs)

    return _unambiguous_dual(vectors=vectors, dim=dim, probs=probs, solver=solver, **kwargs)