nonlocal_games.quantum_hedging¶
Semidefinite programs for obtaining values of quantum hedging scenarios.
Classes¶
Calculate optimal winning probabilities for hedging scenarios. |
Module Contents¶
- class nonlocal_games.quantum_hedging.QuantumHedging(q_a, num_reps)¶
Calculate optimal winning probabilities for hedging scenarios.
Calculate the maximal and minimal winning probabilities for quantum hedging to occur in certain two-party scenarios [1, 2].
Examples
This example illustrates the initial example of perfect hedging when Alice and Bob play two repetitions of the game where Alice prepares the maximally entangled state:
\[u = \frac{1}{\sqrt{2}}|00\rangle + \frac{1}{\sqrt{2}}|11\rangle,\]and Alice applies the measurement operator defined by vector
\[v = \cos(\pi/8)|00\rangle + \sin(\pi/8)|11\rangle.\]As was illustrated in [2], the hedging value of the above scenario is \(\cos(\pi/8)^2 \approx 0.8536\)
>>> import numpy as np >>> from numpy import kron, cos, sin, pi, sqrt, isclose >>> from toqito.states import basis >>> from toqito.nonlocal_games.quantum_hedging import QuantumHedging >>> >>> e_0, e_1 = basis(2, 0), basis(2, 1) >>> e_00, e_01 = kron(e_0, e_0), kron(e_0, e_1) >>> e_10, e_11 = kron(e_1, e_0), kron(e_1, e_1) >>> >>> alpha = 1 / sqrt(2) >>> theta = pi / 8 >>> w_var = alpha * cos(theta) * e_00 + sqrt(1 - alpha ** 2) * sin(theta) * e_11 >>> >>> l_1 = -alpha * sin(theta) * e_00 + sqrt(1 - alpha ** 2) * cos(theta) * e_11 >>> l_2 = alpha * sin(theta) * e_10 >>> l_3 = sqrt(1 - alpha ** 2) * cos(theta) * e_01 >>> >>> q_1 = w_var @ w_var.conj().T >>> q_0 = l_1 @ l_1.conj().T + l_2 @ l_2.conj().T + l_3 @ l_3.conj().T >>> molina_watrous = QuantumHedging(q_0, 1) >>> >>> # cos(pi/8)**2 \approx 0.8536 >>> np.around(molina_watrous.max_prob_outcome_a_primal(), decimals=2) np.float64(0.85)
References
[1]Srinivasan Arunachalam, Abel Molina, and Vincent Russo. Quantum hedging in two-round prover-verifier interactions. 2017. arXiv:1310.7954.
[2] (1,2)Abel Molina and John Watrous. Hedging bets with correlated quantum strategies. Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences, 468(2145):2614–2629, Apr 2012. URL: https://arxiv.org/abs/1104.1140.
- Parameters:
q_a (numpy.ndarray)
num_reps (int)
- _q_a¶
- _num_reps¶
- _sys¶
- _dim¶
- max_prob_outcome_a_primal()¶
Compute the maximal probability for calculating outcome “a”.
The primal problem for the maximal probability of “a” is given as:
\[\begin{split}\begin{equation} \begin{aligned} \text{maximize:} \quad & \langle Q_{a_1} \otimes \ldots \otimes Q_{a_n}, X \rangle \\ \text{subject to:} \quad & \text{Tr}_{\mathcal{Y}_1 \otimes \ldots \otimes \mathcal{Y}_n}(X) = I_{\mathcal{X}_1 \otimes \ldots \otimes \mathcal{X}_n},\\ & X \in \text{Pos}(\mathcal{Y}_1 \otimes \mathcal{X}_1 \otimes \ldots \otimes \mathcal{Y}_n \otimes \mathcal{X}_n) \end{aligned} \end{equation}\end{split}\]- Returns:
The optimal maximal probability for obtaining outcome “a”.
- Return type:
float
- max_prob_outcome_a_dual()¶
Compute the maximal probability for calculating outcome “a”.
The dual problem for the maximal probability of “a” is given as:
\[\begin{split}\begin{equation} \begin{aligned} \text{minimize:} \quad & \text{Tr}(Y) \\ \text{subject to:} \quad & \pi \left(I_{\mathcal{Y}_1 \otimes \ldots \otimes \mathcal{Y}_n} \otimes Y \right) \pi^* \geq Q_{a_1} \otimes \ldots \otimes Q_{a_n}, \\ & Y \in \text{Herm} \left(\mathcal{X} \otimes \ldots \otimes \mathcal{X}_n \right) \end{aligned} \end{equation}\end{split}\]- Returns:
The optimal maximal probability for obtaining outcome “a”.
- Return type:
float
- min_prob_outcome_a_primal()¶
Compute the minimal probability for calculating outcome “a”.
The primal problem for the minimal probability of “a” is given as:
\[\begin{split}\begin{equation} \begin{aligned} \text{minimize:} \quad & \langle Q_{a_1} \otimes \ldots \otimes Q_{a_n}, X \rangle \\ \text{subject to:} \quad & \text{Tr}_{\mathcal{Y}_1 \otimes \ldots \otimes \mathcal{Y}_n}(X) = I_{\mathcal{X}_1 \otimes \ldots \otimes \mathcal{X}_n},\\ & X \in \text{Pos}(\mathcal{Y}_1 \otimes \mathcal{X}_1 \otimes \ldots \otimes \mathcal{Y}_n \otimes \mathcal{X}_n) \end{aligned} \end{equation}\end{split}\]- Returns:
The optimal minimal probability for obtaining outcome “a”.
- Return type:
float
- min_prob_outcome_a_dual()¶
Compute the minimal probability for calculating outcome “a”.
The dual problem for the minimal probability of “a” is given as:
\[\begin{split}\begin{equation} \begin{aligned} \text{maximize:} \quad & \text{Tr}(Y) \\ \text{subject to:} \quad & \pi \left(I_{\mathcal{Y}_1 \otimes \ldots \otimes \mathcal{Y}_n} \otimes Y \right) \pi^* \leq Q_{a_1} \otimes \ldots \otimes Q_{a_n}, \\ & Y \in \text{Herm} \left(\mathcal{X} \otimes \ldots \otimes \mathcal{X}_n \right) \end{aligned} \end{equation}\end{split}\]- Returns:
The optimal minimal probability for obtaining outcome “a”.
- Return type:
float