Entangled photon pairs: Bell/CHSH test against local hidden variables, the basis of E91 secure communication.
CHSH inequality. Alice measures polarisation along a or a′, Bob along b or b′; each outcome is ±1. With correlations E(x,y) = 〈A·B〉 define S = E(a,b) − E(a,b′) + E(a′,b) + E(a′,b′). Any local-hidden-variable theory (outcomes fixed in advance by properties carried by each pair) obeys |S| ≤ 2.
Quantum prediction. For polarisation-entangled photons in the state (|HH〉+|VV〉)/√2 the correlation is E = V cos 2(x−y), V being the visibility (1 for a perfect source). At a=0°, a′=45°, b=22.5°, b′=67.5° this gives S = 2√2 V, the Tsirelson bound 2.83 for V=1. Violation needs V > 1/√2 ≈ 0.707, which the "Critical V" preset shows. The grid search button finds the best angles independently.
Hidden-variable comparison. The classical model draws a random polarisation λ per pair, A = sign cos 2(a−λ). It gives the straight-line correlation 1 − 4|Δ|/π, and S stays ≤ 2 for all angles.
E91 link. Equal settings give perfectly (anti)correlated bits for key generation; the Bell test on the other settings certifies the source, and the key error rate is (1−V)/2.
Simplifications. Perfect detectors (no detection loophole), noise modelled as a single visibility V, no timing or locality loophole; the animation speed is not a light-speed demonstration. The sampler draws only the stated probabilities, so agreement with the closed form tests the statistics, not nature.