Here is some BKO:

---------------------------------------- |context> => |context: simple entanglement example> entanglement-1 |particles> => |particle 1: spin up> + |particle 2: spin down> entanglement-2 |particles> => |particle 1: spin down> + |particle 2: spin up> the-list-of-possible-entanglements |particles> => |op: entanglement-1> + |op: entanglement-2> measure |particles> #=> apply(weighted-pick-elt the-list-of-possible-entanglements|_self>,|_self>) ----------------------------------------Now, let's measure our particles:

sa: measure |particles> |particle 1: spin down> + |particle 2: spin up>It's random, so let's try again:

sa: measure |particles> |particle 1: spin down> + |particle 2: spin up>And again:

sa: measure |particles> |particle 1: spin up> + |particle 2: spin down>I guess that is simple enough. And if we want to encode the idea that the particles take a fix state on measurement, then we should use memoizing rules instead of stored rules:

wave-fn-collapse-measure |particles> !=> apply(weighted-pick-elt the-list-of-possible-entanglements|_self>,|_self>)Now, see what we have:

sa: dump ---------------------------------------- |context> => |context: simple entanglement example> entanglement-1 |particles> => |particle 1: spin up> + |particle 2: spin down> entanglement-2 |particles> => |particle 1: spin down> + |particle 2: spin up> the-list-of-possible-entanglements |particles> => |op: entanglement-1> + |op: entanglement-2> measure |particles> #=> apply(weighted-pick-elt the-list-of-possible-entanglements|_self>,|_self>) wave-fn-collapse-measure |particles> !=> apply(weighted-pick-elt the-list-of-possible-entanglements|_self>,|_self>) ----------------------------------------Now measure our particles and then see what we know:

sa: wave-fn-collapse-measure |particles> |particle 1: spin up> + |particle 2: spin down> sa: dump ---------------------------------------- |context> => |context: simple entanglement example> entanglement-1 |particles> => |particle 1: spin up> + |particle 2: spin down> entanglement-2 |particles> => |particle 1: spin down> + |particle 2: spin up> the-list-of-possible-entanglements |particles> => |op: entanglement-1> + |op: entanglement-2> measure |particles> #=> apply(weighted-pick-elt the-list-of-possible-entanglements|_self>,|_self>) wave-fn-collapse-measure |particles> => |particle 1: spin up> + |particle 2: spin down> ----------------------------------------Anyway, hope that is clear.