The Bell Experiment, Monadically
Abstract
Bell's theorem says that no classical model satisfying certain independence assumptions can reproduce the correlations that quantum mechanics predicts and experiments observe. In this paper we write the two-party Bell experiment as a small Haskell program, and find those assumptions in its structure: in what each part of the program can see, and in how the parts are composed. The boxes of the two parties compute in one monad, and the experiment that schedules and repeats their trials computes in another; a \emph{membrane} runs the first inside the second. A run keeps the record of its trials, and both of its verdicts, the CHSH value and whether the boxes signal, are read off one table: the empirical model of that run. In this setting, a model is classical when it has three properties. It is \emph{blind}: the hidden strategy of the boxes is drawn without seeing the measurement settings. It is \emph{local}: given that strategy, neither box's outcome depends on the other party's setting. It is \emph{factored}: given the strategy and the settings, the two outcomes are independent. Together, they give the classical bound of . We give them up one at a time and run what results. Without blindness, we get experimental loopholes and superdeterminism. Without factoring, we get quantum boxes, which reach , and the hypothetical PR boxes, which reach , both without signaling. Without locality, we get boxes that rewrite a shared hidden state; whether they signal depends on how that state is sampled. We also compare two ways to check no-signaling: reading it off the run's own table, and estimating it in separate experiments at fixed settings.