Bell Inequality (CHSH Game)
Overview
Bell Inequality (CHSH Game)
This Cirq example demonstrates Bell's theorem, one of the most profound results in physics, which proves that the predictions of quantum mechanics cannot be reproduced by any local hidden-variable (local realist) theory. It frames the test as the CHSH game, a cooperative game between two separated players, Alice and Bob, who each receive a random input bit and must produce an output bit without communicating. They win when the XOR of their outputs equals the AND of their inputs. Classically, even with the best possible shared strategy, the two players can win at most 75% of the time. By sharing an entangled pair of qubits and choosing cleverly rotated measurement bases, they can raise their winning probability to roughly 85% (the Tsirelson bound), a gap that can only be explained by genuine quantum correlations. The script builds the entangled state, applies the input-dependent measurement rotations, simulates many rounds of the game, and reports the observed win rate, making the abstract statement of Bell's inequality concrete and measurable. It is a compelling demonstration of quantum nonlocality and a foundational example for understanding entanglement as a physical resource.
Run it
pip install -r requirements.txt
python bell_inequality.py
Source and license
Imported from examples/bell_inequality.py in quantumlib/Cirq at v1.6.1, under the Apache License 2.0. Original authors: The Cirq Developers. The upstream LICENSE is included alongside this example.
This entry was created automatically from publicly available records. QCR links to public sources and only stores repository content where the license permits redistribution.
Versions
Cite all versions? Use the base QCR ID to always reference the latest version of this entry.
Join the Discussion
Comments (0)
No comments yet. Be the first to share your thoughts!