\section{Introduction}
In recent years, the field of quantum information science has experienced tremendous growth as cloud-based, noisy-intermediate scale quantum (NISQ)~\cite{Preskill2018} hardware has become widely available from several providers including IBM~\cite{IBMQ}, Rigetti~\cite{Rigetti}, and IonQ~\cite{IonQ}. In particular, a number of IBM Quantum devices are currently available freely, with additional devices and features available to members of the IBM Quantum network. The accessibility of IBM's cloud-based, NISQ hardware presents the incredible opportunity for essentially anyone to perform legitimate quantum experiments~\cite{Devitt2016} by making use of the Qiskit~\cite{Qiskit} software development kit.

Long before the availability of functional NISQ technology, it was hypothesized that quantum computers would be capable of simulating systems which would be effectively impossible to simulate classically~\cite{Feynman1982}. Later it was realized that quantum computers can provide a highly efficient scheme for factoring products of two prime numbers~\cite{Shor}. As one of the most widely-employed cryptographic frameworks is based on the impracticality of quickly factoring composite numbers~\cite{RSA}, this particularly mathematical application of quantum computers is of great interest.

Recent investigations of many-body dynamics~\cite{Smith2019,Bassman2020} and cryptography~\cite{Amico2019,Skosana2021} using currently-available systems have demonstrated the impressive development of controllable quantum hardware. But it remains unclear when advances in hardware design will yield devices capable of demonstrating a clear ``quantum advantage'' compared to classical approaches to these interesting questions~\cite{Riedel}. The noisy devices currently available are limited by unavoidable errors which accumulate considerably for even modest computations. Though some simple methods exist for correcting basic measurement errors~\cite{Qiskitbook}, devising more elaborate and scalable error-correcting schemes for large systems is a highly nontrivial task~\cite{Harper2019,Nation2021}.

A natural question in this interesting time of rapid development is: what can these noisy quantum devices do {\it now}? That is, are there any tasks for which today's imperfect devices are particularly well suited to demonstrate definitive value? The aim of this paper is to demonstrate that one viable application of current quantum hardware is to simulate small systems, capable of testing fundamental aspects of quantum mechanics. Previous work has shown that Bell's theorem~\cite{Bell} and its extensions provide numerous opportunities~\cite{DallaTorre2022,Wang2021,Sadana2022,Santini2022} for these noisy devices to clearly demonstrate the validity of the traditional framework of quantum mechanics. 

Recently, a Bell-like test was conceived~\cite{Renou2021} for testing the necessity of complex numbers in the traditional formulation of quantum mechanics. At its core, this test computes a score $\Gamma$ which, due to a specific Clauser-Horne-Shimony-Holt (CHSH) inequality~\cite{CHSH}, cannot exceed $\Gamma_{\mbox{\scriptsize crit}} \approx 7.66$ unless complex numbers are employed in the mathematical description of the basic postulates of quantum theory. The standard, complex-based quantum framework yields and ideal score of $\Gamma = 6\sqrt{2} \approx 8.49$. Two impressive experiments~\cite{qmtest1,qmtest2} have since shown convincing evidence that the traditional formulation of quantum theory does require complex-valued quantities with experimentally obtained values of $\Gamma$ exceeding $\Gamma_{\mbox{\scriptsize crit}}$ significantly. The main focus of the remainder of this paper is to demonstrate how the experimental setup in Ref.~\onlinecite{qmtest1} can be performed on IBM quantum hardware. It is shown that consistent experimental results can be obtained on these freely-available, cloud-based devices. Using Qiskit to assemble quantum circuits for this experiment has the benefit of not requiring the user to possess significant expertise in the low-level operation of the hardware (e.g., gate construction via microwave pulses and calibration protocols), thus providing a highly accessible pathway for using quantum technology to perform legitimate experiments which can probe fundamental aspects of quantum theory.

A quantum circuit for testing the relevant CHSH inequality is described below. Results from executing this circuit on several IBM Quantum devices are shown. To support the claim that IBM Quantum devices are useful for performing quantum experiments such as Bell tests which are accessible with small systems, particular attention is paid to demonstrating the robustness of the results. One tradeoff of accessing cloud-based, programmable quantum hardware with Qiksit compared to specially-fabricated devices~\cite{qmtest1} is that one generally loses at least some control over the precise calibration of the device. Evidence is presented to demonstrate the results obtained are robust with respect to IBM's daily calibrations.

The experimental system considered is described in detail in Ref.~\cite{Renou2021}, and a schematic of this experiment is depicted in Fig.~\ref{fig:1}. One considers two independent sources, each of which creates an entangled Bell state $|\Phi^{+}\rangle = (|00\rangle + |11\rangle)/\sqrt{2}$. From each of these two entangled states, one qubit is sent to observer Bob (B). Bob performs a measurement in the Bell-state basis from which he concludes that the two-qubit system is in one of the following states:
\begin{eqnarray}
|\Phi^{\pm}\rangle & = & (|00\rangle \pm |11\rangle)/\sqrt{2},\nonumber\\
|\Psi^{\pm}\rangle & = & (|01\rangle \pm |10\rangle)/\sqrt{2},\nonumber\\
\end{eqnarray}
With the remaining two qubits, Alice performs a measurement of $x$ with $x\in \left\{\hat{\sigma}^{z},\hat{\sigma}^{x},\hat{\sigma}^{y}\right\}$, while Charlie performs a measurement $z$ with $z\in \left\{(\hat{\sigma}^{z} \pm \hat{\sigma}^{x})/\sqrt{2}, (\hat{\sigma}^{z}\pm\hat{\sigma}^{y})/\sqrt{2},(\hat{\sigma}^{x}\pm\hat{\sigma}^{y})/\sqrt{2}\right\}$. Alice's and Charlie's measurement operators are chosen randomly. The outcomes of measurements made by Alice ($a = \pm 1$) and Charlie ($c = \pm 1$) are dependent upon the choice of operators ($xz$) and also (due to residual entanglement) dependent upon the result of Bob's measurement $y$, which maps the states $|\Phi^{\pm}\rangle$, $|\Psi^{\pm}\rangle$ to the binary values $b = 00, 01, 10, 11$, respectively. 

\begin{figure}
\begin{center}
\includegraphics[width=8.6cm]{abc.pdf}
\caption{Experimental setup: Independent sources each create entangled EPR states $|\Phi^{+}\rangle = (|00\rangle + |11\rangle)/\sqrt{2}$. From each state, one qubit is sent to Bob (B) who performs a measurement in the Bell state basis. One of the remaining qubits is sent to Alice (A), and the other is sent to Charlie (C). After Bob's measurement, the residual entanglement is transferred to the qubit pair received by Alice and Charlie. Alice performs a measurement of $x$, while Charlie performs a measurement of $z$.}
\label{fig:1}
\end{center}
\end{figure}

Defining the joint conditional probability $P(abc|xz)$ as the probability that Alice obtains $a$, Bob obtains $b$, and Charlie obtains $c$ given a choice $xz$ for Alice's and Charlie's operators, a particularly interesting correlation function is~\cite{Renou2021}
\begin{eqnarray}
\Gamma = \sum_{abc,xz}w_{abc,xz}P(abc|xz),\label{eq:gamma}
\end{eqnarray}
where $w_{abc,xz} = \pm 1$ are weights~\cite{Renou2021,qmtest1,supp}, $xz \in \left\{ 11, 12,21,22, 13,14,33,34,25,26,35,36\right\}$, and $abc\in \left\{0000, 0001, \cdots, 1110, 1111\right\}$ so that the sum over $abc$ runs over the entire four-qubit computational basis. It has been demonstrated~\cite{Renou2021} that $\Gamma \lesssim 7.66$ for a standard formulation of quantum mechanics which relies upon only real quantities. The main goal of this work is to measure $\Gamma$ experimentally using IBM quantum devices. A quantum circuit which realizes this experiment is shown in Fig.~\ref{fig:2}. Details of the implementation are relegated to supplemental material~\cite{supp}.


\begin{figure}
\begin{center}
\includegraphics[width=8.6cm]{maincirc.pdf}
\caption{Circuit to run on IBM Quantum devices: two pairs of Bell states $|\Phi^{+}\rangle$ are created. Bob performs a Bell state measurement on a pair constructed from both sets of qubits, while Alice and Charlie make particular measurements on the two remaining qubits.}
\label{fig:2}
\end{center}
\end{figure}

\begin{figure}
\begin{center}
\includegraphics[width=8.6cm]{ibm.pdf}
\caption{Qubit connectivity and actual usage in this work for IBM devices used: (a) qubits 0,1,3,4 were used in \texttt{ibmq\_lima}; (b) qubits 0,1,2,3 were used in \texttt{ibmq\_manila}; qubits 0,1,3,5 were used in \texttt{ibm\_lagos}.}
\label{fig:3}
\end{center}
\end{figure}


The circuit in Fig.~\ref{fig:2} can be used to reconstruct the joint conditional probability distribution $P(abc|xz)$ needed to evaluate the score $\Gamma$ in Eq.~(\ref{eq:gamma}) by randomly choosing measurements $xz$ and repeatedly executing the circuit. It is possible to sample $xz$ randomly and send a set of circuits to the IBM devices for single-shot experiments. However, one is limited by the maximum number of circuits which can be executed within a particular job, so the maximum number of single-shot runs is $\mathcal{O}(10^{2})$. Since one may execute the same circuit for at least 20,000 times (``shots''), it is computationally advantageous to execute each of the 12 possible cases of $xz$ for some equal and large number of shots. In what follows, the random sampling over $xz$ will be approximated by an equal sampling over all 12 configurations for $xz$. The reconstructed probability distributions are shown in Fig.~\ref{fig:prob}.

\begin{widetext}

\begin{figure}
\begin{center}
\includegraphics[totalheight=9.60cm]{probfig.pdf}
\caption{Final circuit results, $P(abc|xz)$, where the 16 possible four-qubit states are indexed vertically and the horizontal axis depicts one of the 12 possible Alice/Charlie measurement combinations $xz$. Theoretical prediction (upper left) follows from standard quantum mechanics calculation of the gate operations; QASM simulator refers to IBM's quantum assembly language (QASM) simulator. The label ``e.m.'' on lower plots indicates that basic readout error mitigation as described in the text has been performed. }
\label{fig:prob}
\end{center}
\end{figure}

\end{widetext}

To minimize errors in the execution of the circuit in Fig.~\ref{fig:2}, it is essential to ensure the physical qubits employed are connected in such a way that the CNOT gates can be implemented directly. The currently available IBM Quantum devices possess several types of qubit topology. Figure~\ref{fig:3} depicts which subset of qubits is chosen for each device used. While multiple options are typically available for each device, the particular choices used in this work are dictated by trying to minimize CNOT and measurement readout errors. Detailed calibration information is included in the supplemental material~\cite{supp}.

The circuit in Fig.~\ref{fig:2} has been sent to several IBM Quantum devices: {\texttt ibmq\_lima} v1.0.35, a Falcon r4T processor;  {\texttt ibmq\_manila} v1.0.29, a Falcon r5.11L processor;  and {\texttt ibm\_lagos} v1.0.27, a Falcon r5.11H processor. The first two machines are five-qubit devices which are freely available, while {\texttt ibm\_lagos} is a seven-qubit device currently available to members of the IBM Quantum Researchers Program~\cite{IBMQr}. For the five-qubit devices, 20,000 executions (``shots'') per choice of $xz$ are employed in a single job, resulting in a statistical uncertainty estimate of $\pm0.007$ for $\Gamma$. The seven qubit device allowed 32,000 shots per choice of $xz$ with a corresponding statistical uncertainty estimate of $\pm 0.006$. Each job yielded a list of counts for each of the 16 possible four-qubit states. The conditional probabilities $P(abc|xz)$ can then be reconstructed, and $\Gamma$ can be computed from Eq.~(\ref{eq:gamma}). Results of these computations---the main results of this work---are summarized in Table~\ref{tab:tab1} and depicted graphically in Fig.~\ref{fig:5}.



\begin{center}
\begin{table}
\begin{tabular}{ l | c | c | c | c }
\hline
\hline
 Device & Date &   Shots per $xz$ & $\;\Gamma$ (raw) $\;$& $\Gamma$ (r.e.m.)\\
\hline
QASM simulator & 2022-04-12 & 32,000 & 8.488 & n/a\\
{\texttt ibmq\_lima} & 2022-04-14 & 20,000 & 5.844 & 7.631 \\
{\texttt ibmq\_lima} & 2022-04-19 & 20,000 & 5.902 & 7.731 \\
{\texttt ibmq\_lima} & 2022-04-24 & 20,000 & 5.860 & 7.651 \\
{\texttt ibmq\_manila} & 2022-04-15 & 20,000 & 6.263 & 7.817 \\
{\texttt ibmq\_manila} & 2022-04-19 & 20,000 & 6.500 & 7.946 \\
{\texttt ibmq\_manila} & 2022-04-24 & 20,000 & 6.369 & 7.745 \\
{\texttt ibm\_lagos} &  2022-04-12 & 32,000 & 7.166 & 7.970\\
{\texttt ibm\_lagos} &  2022-04-19 & 32,000 & 7.202 & 8.030\\
{\texttt ibm\_lagos} &  2022-04-24 & 32,000 & 7.427 & 8.117\\
\hline
\end{tabular}
\caption{Measured scores for the QASM simulator and IBM devices with and without readout error mitigation across several days during which multiple device calibrations occur between computations. Results for {\texttt ibmq\_lima} and {\texttt ibmq\_manila} carry uncertainty of $\pm 0.007$, while results for {\texttt ibm\_lagos} have statistical uncertainty $\pm 0.006$.}\label{tab:tab1}
\end{table}
\end{center}

\begin{figure}
\begin{center}
\includegraphics[width=8.6cm]{boxplot2.pdf}
\caption{Score $\Gamma$ for the QASM simulator and various IBM devices across several days with readout error mitigation implemented. The lower dotted line denotes the quantum/classical boundary $\Gamma = 6$, the lower dashed line at $\Gamma \approx 7.66$ denotes the upper limit for real variables, and the upper dashed line $\Gamma = 6\sqrt{2}$ denotes the ideal score for a complex quantum system. Statistical error estimates are given by $N^{-\frac{1}{2}}$ with $N\geq 10^{4}$, so error bars are shown but not visible on the scale. Despite the label 04-15, data were collected from {\texttt ibmq\_lima} on 04-14 and from {\texttt ibm\_lagos} on 04-12.}
\label{fig:5}
\end{center}
\end{figure}

Results in Table~\ref{tab:tab1} depict raw output as well as a computation of $\Gamma$ corrected using basic, readout-error mitigation~\cite{Qiskitbook,supp}. Upon implementing readout-error mitigation~\cite{supp}, the noisiest device, {\texttt ibmq\_lima}, yielded values of $\Gamma$ which hover around the upper limit for real-number-based quantum mechanics~\cite{Renou2021}. The devices {\texttt ibmq\_manila} and {\texttt ibm\_lagos} give values for $\Gamma$ which comfortably exceed this bound of 7.66 when statistical error bars are considered. The readout error mitigation applied in this work consists of basic inversion of the measurable calibration matrix and least-squares optimization, which is not necessarily scalable to large systems~\cite{Nation2021}. 

A potentially confounding aspect of using cloud-based devices to perform experiments via Qiskit is that the user has little control over the calibration and tuning of the devices. Strictly speaking, the Qiskit Pulse programming kit~\cite{QiskitPulse} does afford users the ability to specify pulse-level timing dynamics in the hardware. Such low-level control could potentially improve the quality of results obtained from these devices. The intent of the present work is to demonstrate that certain devices (e.g., {\texttt ibm\_lagos}) can deliver reliable results for Bell-test-like experiments even without such low-level control. Only a basic working knowledge of quantum circuits with the simplest form of readout-error mitigation is necessary to obtain the results presented.

IBM devices are calibrated daily, and the relevant parameters are easily accessible to users. The calibrations affect the tuning of microwave pulses used to manipulate the qubits, and these daily calibrations tend to cause the results to ``drift'' significantly compared to differences attributable to statistical fluctuations for results collected within the same day. Data have been collected across several days during which several calibrations cycles have occurred. Detailed calibration information is collected in the supplemental material~\cite{supp}. The data collected from {\texttt ibm\_lagos} give results which are consistently well above the real/complex threshold. The results from {\texttt ibmq\_lima} and {\texttt ibmq\_manila} drift substantially, making firm conclusions difficult to construct.

Given that the results from {\texttt ibm\_lagos} are robust with $\Gamma \geq 7.97 \pm 0.006$, it is notable that Ref.~\onlinecite{qmtest1} found $\Gamma = 8.09(1)$ using a custom-designed quantum processor. The present work shows that the freely-available IBM processors are capable of obtaining decisive results for this same experiment while only requiring the user to arrange a set of basic quantum circuit elements. No device yields impressive results without readout-error mitigation, but all hardware considered yields experimental values of $\Gamma$ which approach or exceed the threshold for the necessity of complex numbers in a traditional formulation of quantum mechanics. Drift in results due to the daily calibration of IBM devices makes definitive results difficult to extract from the five-qubit devices in this particular experiment, but the results from {\texttt ibm\_lagos} appear insensitive to this drift and in firm agreement with previous experimental results~\cite{qmtest1,qmtest2}. Taken together, the results confirm the fairly primitive nature of currently available hardware but also demonstrate that some hardware is capable of performing delicate experiments consistently. The availability of such technology in a way that does not contain excessive barriers for non-specialists creates substantial opportunities for using NISQ devices as scientific tools



\acknowledgements
The author acknowledges the use of IBM Quantum~\cite{IBMQ} services for this work. The views expressed are those of the author and do not reflect the official policy or position of IBM or the IBM Quantum team. Additionally, the author acknowledges the access to advanced services provided by the IBM Quantum Researchers Program~\cite{IBMQr}.


