Whether or not local realism is a property of the real world is of course the whole issue. But let's be more modest. The realism assumption certainly does apply to any purported event-by-event local realistic computer simulation of a CHSH type experiment.
For instance, to "minkwe" (Michel Fodje's) simulation
https://github.com/minkwe/epr-simple/
So how does Michel violate the CHSH inequality? Answer: through massive use of the detection loophole. The outcomes are not +/-1, but +/-1 or 0. From all the data generated he post-selects those pairs for which neither outcome is 0. This is a famous trick going back to Pearle (1970) and also used by Caroline Thompson (chaotic ball), Luigi Accardi (chameleon statistics), Hess and Phillip (non-local hidden variable micro-time) and so on.
What about Chantal Roth's simulation?
http://libertesphilosophica.info/eprsim/eprsim.txt
Answer: some complicated function of the detector angles equals cosine squared theta (the difference of the two angles). Chantal's program repeatedly computes that function, draws a random number between zero and one, and counts it as equality of two outcomes if the number is below cosine squared theta. In other words, she simulates Bernoulli trials with the right probability, counts the number of "successes", and outputs their relative frequency. Result: a beautiful cosine curve (up to statistical error). This is not a local realistic event-by-event simulation of a rigorously performed CHSH experiment. It is a computer simulation of the binomial distribution, illustrating the law of large numbers. The code also verifies Joy's claim that that complicated thing equals cosine squared theta, is correct. Which can also be done by some simple algebra, trigonometry.
By the way, Chantal has confirmed this analysis. She moreover told me that she could not possibly implement Joy's model in a rigorous simulation experiment.
=========================================================================================
Minkwe's experiment:
I am not a wizard with Python but I managed to dive into minkwe's Python code and save the data generated by the simulation as plain text files, instead of as numpy binary files. I reduced the number of runs from 10 million (or whatever it was) down to 1 million, just to keep things manageable and fast.
I then read the output data into R and ran the script reproduced below, which converts the measurement angles from radians to degrees, rounds to multiples of 7.5 degrees, and then selects from the whole experiment just those runs corresponding to a CHSH experiment: Alice's angles are 0 or 45 degrees, Bob's are 22.5 or 67.5 degrees.
This is exactly what minkwe does before calculating CHSH; also he does this same rounding before drawing his beautiful plots (cosine curves).
I convert the settings to the numbers 1 and 2, and then print out tables of the joint outcome statistics for Alice and Bob under each pair of settings. Recall that Alice's outcome can be -1, 0 or 1; Bob's outcome can be -1, 0, or 1. The zero stands of course for no detection.
Here they are
Setting combination 1, 1
- Code: Select all
-1 0 1
-1 5 20 169
0 26 24 24
1 148 11 6
Setting combination 1, 2
- Code: Select all
-1 0 1
-1 46 36 103
0 36 0 35
1 106 41 42
Setting combination 2, 1
- Code: Select all
-1 0 1
-1 4 20 173
0 24 24 27
1 167 15 8
Setting combination 2, 2
- Code: Select all
-1 0 1
-1 5 19 137
0 15 52 25
1 137 22 5
================================================================
Modifications to minkwe's Python code:
In order to have access to the function "savetxt", add, near the top:
- Code: Select all
numpy import *
Reduce number of iterations, just for convenience:
- Code: Select all
NUM_ITERATIONS = 1000000
Further down, in the code, add two "savetxt" lines:
- Code: Select all
# save results in separate files each is a list of angles and +/- outcomes
self.alice.save()
self.bob.save()
savetxt("alice.txt", self.alice.results)
savetxt("bob.txt", self.bob.results)
===============================================================
Then here is my R script which analyses the data-files produced by epr.py:
- Code: Select all
alice <- read.table("alice.txt")
bob <- read.table("bob.txt")
AliceAngle <- (alice$V1)*180/pi
BobAngle <- (bob$V1)*180/pi
AliceRoundAngle <- round(AliceAngle/7.5)*7.5
BobRoundAngle <- round(BobAngle/7.5)*7.5
AliceOutcome <- alice$V2
BobOutcome <- bob$V2
CHSHruns <- which( (AliceRoundAngle %in% c(0, 45) ) & (BobRoundAngle %in% c(22.5, 67.5) ) )
CHSH <- data.frame(SettingAlice = AliceRoundAngle[CHSHruns],
OutcomeAlice = AliceOutcome[CHSHruns],
SettingBob = BobRoundAngle[CHSHruns],
OutcomeBob = BobOutcome[CHSHruns])
CHSH$SettingAlice <- CHSH$SettingAlice/45 + 1
CHSH$SettingBob <- (CHSH$SettingBob-22.5)/45 + 1
attach(CHSH)
table(OutcomeAlice[SettingAlice == 1 & SettingBob == 1], OutcomeBob[SettingAlice == 1 & SettingBob == 1])
table(OutcomeAlice[SettingAlice == 1 & SettingBob == 2], OutcomeBob[SettingAlice == 1 & SettingBob == 2])
table(OutcomeAlice[SettingAlice == 2 & SettingBob == 1], OutcomeBob[SettingAlice == 2 & SettingBob == 1])
table(OutcomeAlice[SettingAlice == 2 & SettingBob == 2], OutcomeBob[SettingAlice == 2 & SettingBob == 2])