The Magic Squares Game¶
Magic squares is a cooperative game where two players Alice and Bob each produce a three-bit string \((a_0,a_1,a_2)\) and \((b_0,b_1,b_2)\). Alice’s bitstring is required to have even parity while Bob’s must have odd parity. Alice’s bitstring is then used to fill in the \(x^{th}\) row of a 3x3 grid while Bob’s bitstring is used to fill in the \(y^{th}\) column of a 3x3 grid. The game is won if \(a_y = b_x\) that is, the intesection of Alice’s row and Bob’s column is filled in with same value by both Alice and Bob.
The magic square game is interesting because classically the winning probability is bounded as \(P_{Win}\leq 8/9\). On the other hand, there exists a quantum strategy that can win the game with certainty. The foundational physics behind the winning strategy was independently observed by D. Mermin [Mermin1990_magic_squares], and A. Peres [Peres1990]. Mermin and Peres’ thought experiment in quantum noncontextuality was later showed to achieve a perfect winning score in the magic square game by P. Aravind [Aravind2002], [Aravind2004]. In our implementation of the magic squares game, we apply the approach outlined by G. Brassard et al. [Brassard2005]. The optimal quantum strategy reduces to a bipartite non-signaling scenario where Alice and Bob perform local measurements on a shared static entangled state. The optimal quantum protocol is performed as follows:
Alice and Bob receive independent classical inputs \(x,\;y\in \{0,1,2\}\).
Alice and Bob apply local unitaries \(U^A_x\) and \(U^B_y\) respectively.
Alice and Bob measure two-qubits in the computational basis to obtain two-bit outcomes \((a_0,a_1)\) and \((b_0, b_1)\) respectively where \(a_i,\;b_j \in \{0,1\}\).
Alice’s third bit \(a_2\) is selected such that the bitstring \((a_0,a_1, a_2)\) has even parity while Bob’s third bit is selected such that the bitstring \((b_0,b_1,b_2)\) has odd parity.
The winning condition \(a_y = b_x\) is evaluated.
As an example, optimal state preparation and measurements are provided in [Brassard2005].
- qnetvo.magic_squares_game_cost_fn(network_ansatz, **qnode_kwargs)[source]¶
Constructs a cost function that maximizes the winning probability for the magic squares game.
- Parameters:
network_ansatz (NetworkAnsatz) – A
NetworkAnsatz
class specifying the quantum network simulation.- Returns:
A cost function evaluated as
cost(*network_settings)
where thenetwork_settings
are obtained from the providednetwork_ansatz
class.- Return type:
Function
References
Mermin, N. David. “Simple unified form for the major no-hidden-variables theorems.” Physical review letters 65.27 (1990): 3373.
Peres, Asher. “Incompatible results of quantum measurements.” Physics Letters A 151.3-4 (1990): 107-108.
Aravind, Padmanabhan K. “Bell’s theorem without inequalities and only two distant observers.” Journal of Genetic Counseling 15.4 (2002): 397-405.
Aravind, Padmanabhan K. “Quantum mysteries revisited again.” American Journal of Physics 72.10 (2004): 1303-1307.