Quantum Computing : Modeling Bell's (CHSH) inequality with Qiskit
CHSH correlation function vs relative angle between detectors ().
Formulation
From the classical point of view, the following inequality holds for any local hidden variable theory \begin{equation} |S|<2 \ . \end{equation} Here \begin{equation} S=E(\textbf{AB})-E(\textbf{AB’})+E(\textbf{A’B’})+E(\textbf{A’B}) \ , \end{equation} where \(E(\textbf{AB})\) - is a correlation function (for example, spin-spin correlation function) between two points on different sides of the source and arbitary unit vectors (\(\textbf{A}\), \(\textbf{B}\)) specify orientations of the linear detectors.
However, within the framework of the quantum mechanics (QM), things are different. QM states that there are specific configurations of the experiment for which becomes greater than two.
Thus ineq. 1 appears to be an important and convenient test in favor of one or another theory. So far, the experiment (despite some challenges) confirms prediction of the quantum mechanic and, consequently, the non-locality of our nature.
Detectors
Whithout losing generality we can choose to constrain angles between detectors as \(\angle(\textbf{A, B})=\angle(\textbf{B, A’})=\angle(\textbf{A’,B’ })=\theta\).
Then \(S\) becomes only a function of \(\theta \)
Projection of Bloch’s sphere onto xz plane and positions of detectors (A, A’, B, B’) for .
QM analytical solution for spin 1/2 system
\begin{equation} E(\textbf{AB}) = < \psi|\sigma(\textbf{A}) \sigma(\textbf{B})|\psi > =cos(\theta) \ , \end{equation}
here \( | \psi > \) is an entangled state of two qubits (Bell state): \begin{equation} \left |\psi > \right .= \frac{[ \ |00> + |11> ]}{\sqrt{2}} \ . \end{equation}
Modeling with Qiskit
\begin{equation} E(\textbf{AB}) = \frac{N_{11}(\textbf{AB})+N_{00}(\textbf{AB})-N_{01}(\textbf{AB})-N_{10}(\textbf{AB})}{N_{11}(\textbf{AB})+N_{00}(\textbf{AB})+N_{01}(\textbf{AB})+N_{10}(\textbf{AB})} , \end{equation}
and
\(N_{ij}(\textbf{AB}) \) is a number of counts registered in a given state \(|i,j>\), where \(i,j=\{0,1\}\).
QM errors
While quantum simulator gives perfect agreement with the analytical solution, quantum calculations on real devices accompanied by certain noise/errors. For example, measurement of the Bell state along the z-axis, should not in principle, contains any contribution with the mixed spin. Still, QC produces non-zero probability to obtain \(|01>\) and \(|10>\) states (check /quantum_errors/).
Manual
Required packages can be installed using pip and are listed in requirements.txt file.
To get correlation use
$ python run.py
There are two options for QM calculations :
- using Aer qiskit simulator (
run_type='sim'
); - using real quantum computer (
run_type='ibmq'
).
To use ibm quantum computer one has to register here and specify token and name of the machine in ibm_setting.json.
Usefull links
Acknowledgements
Thanks to Alexandra Malyavina