import numpy as np
# Pauli matrices
Z = np.array([[1,0],[0,-1]])
X = np.array([[0,1],[1,0]])
# Computational Basis
one = np.array([[0],[1]])
zero = np.array([[1],[0]])
# EPR State phi-
phi = 1. / np.sqrt(2) * (np.kron(zero, one) - np.kron(one, zero))
# Show that one of the terms from the Bell inequality has
# expected observable of 1/sqrt(2), killing "local realism"
QS = np.kron(Z, 1/np.sqrt(2) * (-1 * Z - X))
print(np.inner(phi.conj().T, np.inner(QS,phi.T).T))