Feature: Add Magic Square game for Contextuality demonstration#448
Feature: Add Magic Square game for Contextuality demonstration#448alejogoogle wants to merge 26 commits into
Conversation
|
In addition to addressing Doug's comments about the code, I think also it's important to add a description to the pull request. Here are some points to address:
I realize it's more work to write a description, and I'm sorry for that. Perhaps an AI tool can help with this in some way. |
mhucka
left a comment
There was a problem hiding this comment.
A number of these items are nit-picky details, and I tried to make it easy to accept or reject the changes using GitHub's interface for suggested edits. Hopefully that'll make this easier.
79b20c3 to
46c5d79
Compare
Co-authored-by: Michael Hucka <mhucka@google.com>
Co-authored-by: Michael Hucka <mhucka@google.com>
Co-authored-by: Michael Hucka <mhucka@google.com>
Co-authored-by: Michael Hucka <mhucka@google.com>
Co-authored-by: Michael Hucka <mhucka@google.com>
46c5d79 to
ab303de
Compare
| """Find the fraction of the time that Alice and Bob | ||
| Alice and Bob "agree" (in the intersection) | ||
| and | ||
| they "multiply correctly" (alice to -1 and bob to +1). |
There was a problem hiding this comment.
Looks like something happened to the formatting of this docstring. Suggested fix:
| """Find the fraction of the time that Alice and Bob | |
| Alice and Bob "agree" (in the intersection) | |
| and | |
| they "multiply correctly" (alice to -1 and bob to +1). | |
| """Find the fraction of the time that Alice and Bob "agree" (in the intersection) | |
| and they "multiply correctly" (alice to -1 and bob to +1). |
There was a problem hiding this comment.
Also, @alejogoogle should that really say alice to -1 and bob to +1? I thought Alice was +1 and Bob was -1.
Co-authored-by: Michael Hucka <mhucka@google.com>
This PR adds a new experimental module to the ReCirq repository that implements the Mermin-Peres Magic Square game (a form of quantum pseudo-telepathy).
Specifically, this code:
Adds new functionality: It provides a framework to run the game using cirq on both simulators and quantum hardware.
Implements three experimental variations:
infer_3rd: Measuring two observables and calculating the third classically.
measure_3rd_classical_multiplication: Measuring components and multiplying the outcomes.
measure_3rd_quantum_multiplication: Using two-qubit interactions to directly measure the product observable.
Provides analysis tools: Includes a ContextualityResult class to calculate win rates, agreement matrices, and parity check fractions to verify quantum non-locality.
Relevance to Contextuality Work
The Magic Square game is a cornerstone "warm-up" experiment for demonstrating quantum contextuality (https://arxiv.org/pdf/2512.02284). It proves that measurement outcomes cannot be pre-determined independently of their "context" (which other measurements are performed simultaneously).
No new external libraries are required.