# Quantinuum corporation says they have a Bell test for quantum randomness. Why does the simulator pass the test?

I'm researching the quantum random number service offered by the computer maker Quantinuum. They say that they have verified quantum randomness by a Bell test. I took Bell's 1964 classic paper and coded up the corresponding circuit. The circuit prepares a singlet Bell state, rotates by 45 degrees about the x axis in the Bloch sphere and performs a measurement. Adding one to the correlation (mean spin product) gives the left hand side of Bell's equation 15 for the angles he specifies in the discussion following equation 22. I repeated the circuit and took the absolute value of the correlation, giving the right-hand side of equation 15. The inequality is violated, implying that there is quantum randomness and that there is no hidden variable. If a simulator can pass the Bell test, what does it prove that Quantinuum's product passes the Bell test? Furthermore, the numbers aren't truly random - they are derived from a seed. So shouldn't they fail the Bell test?

(15) $$1+P(b,c)\ge|P(a,b)-P(a,c)|$$

from make_bell import *
config=get_config()
def initialize(qc):
qc=QuantumCircuit(2,2)
qc = make_bell_nc(1,1,0,1,qc) #singlet
theta = np.pi/4
qc.rx(theta,0)
return qc
compute_state=0
shots=100
simulate=0
q = QuantumRegister(2)
c = ClassicalRegister(2)
qc = QuantumCircuit(q,c)
qc = initialize(qc)
for i_qubit in range(2):
qc.measure(i_qubit,i_qubit)
counts_both=[]
# IBMQ.save_account("")
for irun in range(2):
if simulate==0: #Live back end
backend_name = config['BACKENDS']['live']
provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main')
backend = provider.get_backend(backend_name)

elif simulate == 1:
if compute_state:
backend=qiskit.BasicAer.get_backend('statevector_simulator')
backend_name = 'statevector_simulator'
else:
from qiskit.providers.aer import QasmSimulator
backend = QasmSimulator()  #    Use Aer's qasm_simulator
backend_name = 'qasm_simulator'
if simulate==1:
result = execute(qc, backend=backend,shots=shots).result()
counts=result.get_counts()
elif simulate==0: #Live back end
compiled_circuit = transpile(qc, backend)
job = backend.run(compiled_circuit, shots=20000)
job_monitor(job)
result = job.result()
counts=result.get_counts()
counts_both.append(counts)
pbc=(counts_both['11']+counts_both['00']-counts_both['01']-counts_both['10'])/shots
pab=(counts_both['11']+counts_both['00']-counts_both['01']-counts_both['10'])/shots
print(f'correlations {pbc:.2f} {pab:.2f}')
lhs = 1+pbc
rhs = np.abs(pab)
print(f"lhs {lhs:.3f} rhs {rhs:.3f} {lhs>=rhs}")



The left-hand side was about .3 $$1-1/\sqrt{2}$$ and the right-hand side was about .7 $$1/\sqrt{2}$$

• If it simulates the laws of quantum physics, of course it will pass the test. But likely, your simulator will not separate the two particles it measures in a way where they cannot exchange information any more. May 24 at 17:11
• If you're considering actually using this service, I recommend asking about it at the Cryptography SE. I'm pretty sure they'll tell you not to use it, because even if Quantinuum is honest, it's very easy to screw up the implementation. Modern x64 and ARM CPUs have built-in quantum RNGs that are safer. May 24 at 19:26

The code you have implemented can't be executed on two separated computers because the state vector inside the simulator doesn't split into Alice and Bob parts. So in this case your non-local hidden variable is the state_vector: np.ndarray field inside the simulator plus the state of the pseudo-random number generator being used to sample the state vector.