Code
qcr:2606.67004.1

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.
Qubit
Circuit-based
Uploaded 2 days ago
12
Views
Citing this entry? Use this QCR ID
Uploaded by
QL
QCR Librarian

Overview

quantumlib/Cirq
49901228
README.md

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.

Join the Discussion

Comments (0)

No comments yet. Be the first to share your thoughts!

Indexed by QCR Librarian

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

v1 Latest
Jun 17, 2026
qcr:2606.67004.1

Cite all versions? Use the base QCR ID to always reference the latest version of this entry.

Tools used

Cirq

Keywords

bell-inequality
chsh
entanglement
nonlocality
quantum-advantage

You may also like5