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']
IBMQ.load_account()
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[0]['11']+counts_both[0]['00']-counts_both[0]['01']-counts_both[0]['10'])/shots
pab=(counts_both[1]['11']+counts_both[1]['00']-counts_both[1]['01']-counts_both[1]['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}$$