jreed wrote:You left out some important steps that lead up to the non-locality. I'll see if I can make my objection clearer. I'll be back.
Here is the code with my comments:
I left out the code that generates the trial data There are 10 trials which are
shown below, 10 total for Alice (A1 and A2) and 10 for Bob(B1 and B2):
Each trial is in the format: {detector angle, detector1 value, trial# detector2 value}
m=10;
outA1
{{194,1,1,-1},{82,-1,2,1},{275,-1,3,1},{297,1,5,1},{203,-1,6,-1},{155,1,7,1},{304,-1,8,-1}}
outA2
{{48,1,4,1},{190,1,9,1},{312,1,10,1}}
Alice has 7 “good” trials and 3 “failed” trials.
outB1
{{145,-1,1,1},{108,1,2,-1},{46,-1,3,1},{0,-1,4,-1},{277,-1,6,1},{156,-1,7,-1},{182,1,8,-1},{25,-1,9,1},{234,-1,10,1}}
outB2
{{171,1,5,1}}
Bob has 9 “good” trials and 1 “failed” trial
Keep the failed trial numbers for Alice (4, 9, 10) and for Bob (5) in mind.
********Begin Fred’s magic code************
Matching Events Observed by Alice and Bob using Trial Numbers
kb1=outA1[[All,3]]; (*Two lists of only trial numbers used for matching*)
ka1=outB1[[All,3]];
Local Detection Analysis of the Events Observed by Alice
listA3=Select[outA1,Intersection[{#[[3]]},ka1]!={#[[3]]}&];
listA3
{{297,1,5,1}}
Intersection has generated a list consisting of Alice’s trials with
numbers matching Bob’s failed trials (in this case only one, trial 5)
called listA3.
M1=Length[listA3];
tna=listA3[[All,3]];
outA4=Select[outA1,Intersection[{#[[3]]},tna]!={#[[3]]}&];
outA5=Table[{0,0,0,0},M1];
ssca=ConstantArray[0,M1];
This Do-loop does the following operations:
For each trial in listA3, if Alice’s detector1 equals detector2, no action is
taken else the sign of Alice’s detector1 is flipped.
This operation is carried out on trial numbers where Bob had a
failed trial. This introduces a non-locality, since information from
Bob’s trials are used to change Alice’s data.Do[If[listA3[[i]][[2]]==listA3[[i]][[4]],δ=0,δ=1];
If[δ==0,ssca[[i]]=1,ssca[[i]]=-1]; (*spinorial sign change*)
outA5[[i]]={listA3[[i]][[1]],ssca[[i]]*listA3[[i]][[2]],listA3[[i]][[3]],listA3[[i]][[4]]},{i,M1}]
The results of the changed trial (in this case trial 5) are combined with the
unchanged data. This trial wasn’t changed since detector1=detector2.
outA=Sort[Catenate[{outA2,outA4,outA5}],#1[[3]]<#2[[3]]&];
outA5
{{297,1,5,1}}
(*Combine lists *)
a1= outA[[All,1]]; (*These results are what Alice observes as defined in Eq.(??)*)
A = outA[[All,2]];
Local Detection Analysis of the Events Observed by Bob
The same sequence of events is now done for Bob’s trials,
Using Alice’s failed trial numbers.
listB3=Select[outB1,Intersection[{#[[3]]},kb1]!={#[[3]]}&];
M2=Length[listB3];
tnb=listB3[[All,3]];
outB4=Select[outB1,Intersection[{#[[3]]},tnb]!={#[[3]]}&];
outB5=Table[{0,0,0,0},M2];
sscb=ConstantArray[0,M2];
Do[If[listB3[[i]][[2]]==listB3[[i]][[4]],δ=0,δ=1];
If[δ==0,sscb[[i]]=1,sscb[[i]]=-1]; (*spinorial sign change*)outB5[[i]]={listB3[[i]][[1]],sscb[[i]]*listB3[[i]][[2]],listB3[[i]][[3]],listB3[[i]][[4]]},{i,M2}]
Here are the input and output lists from this do loop. Alice’s failed trial numbers,
4, 9, and 10:
listB3
outB5
{{0,-1,4,-1},{25,-1,9,1},{234,-1,10,1}}
{{0,-1,4,-1},{25,1,9,1},{234,1,10,1}}
Now two signs have been flipped in Bob’s data, controlled by Alice’s failed
trials.
outB=Sort[Catenate[{outB2,outB4,outB5}],#1[[3]]<#2[[3]]&]; (*Combine lists and sort*)
b1= outB[[All,1]]; (*These results are what Bob observes as defined in Eq.(??)*)
B = outB[[All,2]];
**************End Fred’s magic code********************
The two do loops above are all that is needed to carry out this
operation. That’s what I programmed up to simplify Fred’s
code and carry out the exact same process. All the extra work
involved in selecting certain observations, done with Intersection,
then doing the do-loop on these selected observations and finally
combining them is not necessary, and makes the program much
more complex than necessary. Maybe that’s desirable if
a magic program is wanted.