Solution (source code)

= Solution

In a <local hidden-variable theory>[local hidden-variable] description, assign predetermined values $X_j,Y_j\in\{+1,-1\}$ to the two possible <quantum measurements>[measurements] at <photon> $j$. The perfect correlations of <6/b> require
$$
X_1X_2Y_3=-1,\qquad X_1Y_2X_3=-1,\qquad Y_1X_2X_3=-1.
$$
Multiplying these identities cancels each squared X value and gives $\boxed{Y_1Y_2Y_3=-1}$. Thus <local hidden-variable theory>[local realism] predicts only the YYY outcomes $++-,$ $+-+,$ $-++,$ and $---$. Combining this parity rule with the measured unbiased single-Y marginals forces all four frequencies to be $1/4$: four weights subject to <normalization> and the three zero-mean conditions are uniquely uniform.

Quantum mechanics instead has $k=3$ in the amplitude formula of <6/b>, giving $\mathcal A_3=(1+abc)/4$. Therefore
$$
\boxed{|\mathrm{GHZ}\rangle_{YYY}=\frac12\left(
|+++\rangle+|+--\rangle+|-+-\rangle+|--+\rangle\right).}
$$
Quantum mechanics predicts each positive-product outcome with <probability> $1/4$ and every negative-product outcome with <probability> zero. The local and quantum allowed sets are disjoint.

This is the <GHZ theorem>: in the ideal case the contradiction follows from deterministic product constraints, an all-versus-nothing argument. A usual two-party <Bell state>[Bell-state] test instead violates a statistical <Bell inequality> assembled from several settings. Both require appropriate locality and measurement-choice assumptions and careful treatment of experimental imperfections; the distinction is the deterministic form of the ideal three-party argument.