Solution (source code)

= Solution

Eve's <computational-basis intercept-resend attack> applies a <projective measurement> of $Z$ to Bob's photon and discards her outcome from Alice and Bob's description. Their resulting <density matrix> is
$$
\rho_{AB}^{\rm Eve}=\frac12|01\rangle\langle01|+\frac12|10\rangle\langle10|.
$$
This <separable state> keeps $\langle Z\otimes Z\rangle=-1$ but removes $\langle X\otimes X\rangle$. Hence
$$
E_{\rm Eve}(\alpha,\beta)=-\cos2\alpha\cos2\beta,
\qquad
(E_{ij}^{\rm Eve})=\begin{pmatrix}
-1&-1/\sqrt2&-1/\sqrt2\\
0&0&0\\
-1/\sqrt2&-1/2&-1/2
\end{pmatrix}.
$$
Using the same signed Bell-test statistic gives
$$
\boxed{S_{\rm Eve}=\sqrt2,\qquad S_{\rm ideal}=2\sqrt2.}
$$
The ideal value is halved, and the attack no longer violates the <CHSH inequality>.

The key data show why several settings matter. For $(1,1)$, Eve's measurement leaves perfect anticorrelation, so this subset has \b[zero bit errors] after Bob flips his assignment. For $(3,2)$, $E=-1/2$, so correct anticorrelation has probability $(1-E)/2=3/4$: its <quantum bit error rate> is \b[$1/4$]. If both key-setting pairs occur equally often, their combined raw-key error rate is \b[$1/8$]. The Bell-test change detects this attack even though the vertical/horizontal key subset alone would not.