# What type of "local hidden variable" is ruled out when discussing (non)contextuality?

While reading about noncontextuality and the Peres-Mermin square, I encountered the statement that noncontextuality is tightly related to nonlocality à la Bell. For example, (Kleinmann et al. 2011) mention (Eq. (2) in the arxiv version) that any noncontextual model for the Peres-Mermin square satisfies the inequality: $$\langle\chi\rangle \equiv\langle A B C\rangle+\langle a b c\rangle+\langle\alpha \beta \gamma\rangle+\langle A a \alpha\rangle+\langle B b \beta\rangle-\langle C c \gamma\rangle \leq 4,$$ where the square is written as $$\left[\begin{array}{ccc} A & B & C \\ a & b & c \\ \alpha & \beta & \gamma \end{array}\right]=\left[\begin{array}{ccc} \sigma_{z} \otimes \mathbb{1} & \mathbb{1} \otimes \sigma_{z} & \sigma_{z} \otimes \sigma_{z} \\ \mathbb{1} \otimes \sigma_{x} & \sigma_{x} \otimes \mathbb{1} & \sigma_{x} \otimes \sigma_{x} \\ \sigma_{z} \otimes \sigma_{x} & \sigma_{x} \otimes \sigma_{z} & \sigma_{y} \otimes \sigma_{y} \end{array}\right].$$ From this formulation, I assume that the inequality is derived using some specific assumption on an underlying conditional probability distribution that makes it "noncontextual". I'm however not clear on what exactly this assumption is. By comparison, when discussing nonlocality, we want to rule out the underlying conditional probability distribution being writable as $$p(ab|xy)=\sum_\lambda p_\lambda p_\lambda^A(a|x)p_\lambda^B(b|y).$$ What's the corresponding class of probability distributions one seeks to rule out when discussing (non)contextuality? Bonus points if it's expressible as a causal model in DAG form.

• I think the answer should be that there is no violation of 'local' hidden-variables because the entire scenario is local. But I would guess that you want a description of the relationship between Bell and Kochen-Specker, in particular, in the Kochen-Specker reading of Bell-like scenarios such as the $4$-cycle graphs, right?
– R.W
Commented Mar 24, 2022 at 12:27
• @R.W there is no notion of locality here, I agree. What I meant is, however, that these inequalities, I suppose, are derived under some specific assumption on the structure of the corresponding probability distribution, so the question is what exactly is that assumption. Going by your answer to the other question, maybe the assumption is the existence of a specific conditional probability distribution with three inputs and three outputs, but I'm still not entirely clear on what the inputs and outputs are in there
– glS
Commented Mar 24, 2022 at 15:56
• Yes, so this structure is a structure of noncontextuality. In the other question I have mentioned that this implies that one must have a factorizable and deterministic hidden-variable model. This is what is shown for instance in Fine-Abramsky-Brandenburger theorems. I could write an answer about this, showing that in fact assumptions like outcome determinism imply some structure of the hidden-variables. Thank you very much for so many relevant questions!
– R.W
Commented Mar 24, 2022 at 16:52
• I recall reading that Landau's proof of Bell's inequality assumes that the observables are represented as random variables on the same sample space, no need to discuss locality Commented Mar 25, 2022 at 18:40

## Ontological Explanations

Any prepare-and-measure experiment has an operational-probabilistic structure that is causal in the sense that there is first a preparation step where $$P$$ is a set of preparation procedures to be performed preparing some system followed by a set of measurement procedures $$M$$ that return outcomes $$A$$, in general. Any ontological explanation for this causal operational description will preserve this structure that can be putted in a DAG as follows (see the left DAG on the figure); preparations $$P_i \in P$$ prepare an ontic state $$\lambda \in \Lambda$$ describing all relevant degrees of freedom (aka states of affairs, even possible hidden, hance hidden-variables) associated with the preparation stage of a given system. This happens at the very least with some probability $$p(\lambda \vert P_i)$$, since the preparation could at best be explained in the model as a sampling operation over $$\Lambda$$ (this is why we normally refer to this as the epistemic states associated with the preparation, since they only describe some possible knowledge of the preparation over the true real states of the system). At the measurement stage we are operating over $$\lambda$$ that describes for each given measurement in $$M_j \in M$$ some probability that we obtain the outcomes $$a \in A$$, denoted as $$p(a\vert M_j,\lambda)$$ and properly normalized. The success of the OM explaining the probabilities $$\{p(a\vert M_j, P_i)\}_{i,j,a}$$ is given by the relation, $$p(a\vert M_j,P_i) = \sum_{\lambda \in \Lambda}p(\lambda \vert P_i)p(a\vert M_j,\lambda)$$

To describe contextuality or not of some probabilistic data-table we must define what is an experimental scenario. Since Kochen-Specker noncontextuality does not treat preparations we mostly ignore $$P$$ and simply write $$p(\lambda \vert P) \equiv p(\lambda)$$ as the probability that the variable $$\lambda$$ is being sampled from $$\Lambda$$. So we would simply write,

$$p(a\vert M_j) = \sum_{\lambda \in \Lambda}p(\lambda)p(a\vert M_j,\lambda)$$ and this is already very close to what I think you want. Note that $$M_j$$ can be actually a joint measurement and $$a$$ can be the set of outcomes for those. This is important because in particular for testing contextuality we want to see what happens in a statistics generated by measuring different observables w.r.t. different contexts. I therefore now proceed to define those, and in the following I will show how Bell scenarios appear as an example of these more general scenarios used to study contextuality (that does not need the assumption of many party systems for instance; one could test contextuality in a single chip or a single processor in a quantum computer).

## Measurement Scenario

Let $$(M,A,\mathcal{C})$$ be a triple where $$M$$ is a set of measurements, $$A$$ a set of outcomes and $$\mathcal{C}$$ a set of (maximal) contexts. This triple is called a compatibility scenario, or also sometimes a measurement scenario. A (maximal) context, in quantum theory, corresponds to a (largest) set of measurements that is jointly implementable. This is the same as the measurements being compatible, which in the case of ideal von Neumann measurements corresponds to commuting operators, i.e., all projections defining the PVM commute. Note that compatibility can be described entirely in terms of the operational probabilities without reference to quantum theory.

In a given scenario, we have that the probability distributions must satisfy some constraints due to physical assumptions, or simply due to probabilistic assumptions. Since we have contexts of jointly measurable observables, i.e., jointly implementable measurements, we have that in a given scenario the relevant data-tables (behaviours) are given as $$p_{C}(a_1,\dots,a_n\vert M_1,\dots,M_n)$$ where we have that $$a_i$$ is a possible outcome of measurement $$M_i$$ and the set $$M_i \in C, \forall i$$ and we have made explicit the fact that we are performing measurements with respect to the same context jointly. Hence, the behaviour associated with the entire scenario is the collection of all conditional probabilities $$p_C$$ over the contexts. So the probabilistic constraints are that $$0\leq p_C(\dots)\leq 1$$ and $$\sum_{a_1,\dots,a_n}p_C(a_1,\dots,a_n\vert M_1,\dots,M_n)=1$$. Moreover, for these scenarios we assume the physical constraint that we name non-disturbance and it is described as follows: Letting $$C_1,C_2 \in \mathcal{C}$$ any pair of maximal contexts with $$C_1 \cap C_2 \neq \emptyset$$, let $$\{\tilde{M}_1,\dots,\tilde{M}_k\} \in C_1 \cap C_2$$, then

$$p_{C_1}(\tilde{a}_1,\dots,\tilde{a}_k \vert \tilde{M}_1,\dots,\tilde{M}_k) = p_{C_2}(\tilde{a}_1,\dots,\tilde{a}_k \vert \tilde{M}_1,\dots,\tilde{M}_k)$$ for every set of outcomes $$\{\tilde{a}_i\}_1^k$$. In words, this implies that the marginal for each context over the intersection must coincide.

So, already you may have noticed that statistics arising from Bell scenarios allow for this description. Both Bell scenarios are a particular case of compatibility scenarios and the nonsignaling condition is a particular case of the nondisturbing condition. Let us see the particular case for the CHSH scenario where Alice has two binary outcome measurements $$\{x_1,x_2\}$$ and Bob has two binary outcome measurements $$\{y_1,y_2\}$$ with the set of outcomes being $$\{+1,-1\}$$. In this case we have that the contexts are imposed by space-like separation hence we have the structure of contexts as $$\mathcal{C} := \{\{x_1,y_1\},\{x_1,y_2\},\{x_2,y_1\},\{x_2,y_2\}\}$$. Note that this structure may be putted in a graph (known as the compatibility graph)

Now notice that the statistics arising from such scenario has the structure of a statistics arising from a Bell scenario $$\{p(ab\vert xy)\}_{a,b,x,y}$$ with in the particular case of the CHSH we have $$a,b \in \{+1,-1\}$$ and $$x \in \{x_1,x_2\}$$ the same for the $$y$$. I hope that by now I have successfully showed you that this is just an example of the following structural result: compatibility scenarios that are used to study contextuality has, as special examples Bell scenarios. Now, in any Bell experiment we must have non-signaling. If we look at the non-disturbing condition for the contexts and apply for the example I am describing we have the following must hold,

$$p_{\{x_1,y_1\}}(a\vert x_1)=\sum_{a}p(ab\vert x_1y_1) = \sum_{a}p(ab\vert x_1y_2) = p_{\{x_1,y_2\}}(a\vert x_1)$$ This is the assumption of nonsignaling (see for instance Eq. 7 in this review) and hence we see that already this statistics is remembering a lot the statistics in a Bell experiment. The assumption of noncontextuality associated with hidden-variable models is that whenever the set of statistics for all contexts is non-disturbing that it can be explained by an ontological model independent of the measuring context, which means that: (ontological models part) $$\forall C \in \mathcal{C}$$

$$p(a_1,\dots,a_n\vert M_1,\dots,M_n) = \sum_\lambda p(\lambda)p_C(a_1,\dots,a_n\vert M_1,\dots,M_n,\lambda)$$

with $$C = \{M_1,\dots,M_n\}$$, moreover we also assume that (noncontextuality) which means that if $$M_i$$ for some $$i$$ is an element of two different contexts $$C_1$$ and $$C_2$$ we have then that the model assigns the same values independently of the measurement contexts, i.e.,

$$p_{C_1}(a_i\vert M_i) = p_{C_2}(a_i\vert M_i).$$

This implies that the joint distributions $$p(a_1,\dots,a_n\vert M_1,\dots,M_n,\lambda)$$ factorize (which is even sometimes taken as the definition of noncontextuality due to the Fine-Abramsky-Brandenburguer theorem) since there is no dependence of contexts we then have that in a noncontextual model must satisfy

$$p_C(a_1,\dots,a_n\vert M_1,\dots,M_n,\lambda) = p(a_1,\dots,a_n \vert M_1,\dots,M_n,\lambda) = p(a_1\vert M_1,\lambda)\dots p(a_2\vert M_n,\lambda)$$

This factorization condition implies that whenever we consider the subset of compatibility scenarios to be that of Bell scenarios we have that the equation you wanted arises. For instance, in the case of the CHSH scenario that I used as an example we have that for the contexts $$p(ab\vert xy,\lambda) = p(a\vert x,\lambda)p(b\vert y,\lambda)$$, which sets the model exactly as the one you have depicted in your question. Finally, I think that this answers your question in the following way:

What's the corresponding class of probability distributions one seeks to rule out when discussing (non)contextuality?

Answer: The question is strange because the models we want to rule out are exactly noncontextual models, but one can talk about the form these models must have. For instance they must be factorizable. They must lead to a global distribution over all contexts. They must be outcome determinist, and so on. But I take your question to be more nontrivial than that so I interpreted your question as the more complicated one of,

What is the comparison between models ruled out by Bell experiments and models ruled out by Contextuality experiments?

This is a question that is harder, but I supposed I answered at least partially that Bell scenarios are subset of contextuality scenarios and local models are a subset of noncontextual models. Really, there are many different equivalent ways to go about, but one could define noncontextuality as follows as well:

Noncontextual Ontological Model: Ontological model that preserves the same statistical equalities of the operational statistics (operational equivalences described a la Spekkens) as well as satisfy outcome determinism.

In this case you can then show that this leads to models that are factorizable and hence satisfy the relationship I have outlined here for Local models (note that without loss of generality any local model can be chosed to be deterministic). This reference here does exactly this.

Here is the main reference of Abramsky and Brandenburger, instead of defining noncontextual model as I have, you can suppose that noncontextuality is really what happens when there exists a global distribution for your behaviour in a measurement scenario. Then, the FAB theorem shows that this is equivalent to an existence of a hidden-variable model that is factorizable and deterministic.

## Appendix: Proof of the FAB theorem

Theorem (Fine, Abramsky, Brandenburger): A nondisturbing behaviour has a noncontextual ontological model iff has a global probability distribution for the entire scenario.

proof: 1 Let $$(M,A,\mathcal{C})$$ any scenario as described before. (Global distributions induce noncontextual models) Suppose that there is some global probability distribution, then there is some $$p_M: O^M \to [0,1]$$ such that restricted to the contexts gives the correct distributions for the behaviours. Let $$\Lambda := \{\lambda_1, \dots, \lambda_{\vert O^M \vert}\}$$, each element of $$\Lambda$$ is uniquely associated with an element of $$O^M$$, that can be interpreted as all possible outcomes of the scenario that form the domain of $$p_M$$. Let $$p(\lambda_k)$$ given by $$p_M$$ and let $$p_{C}(a\vert M_i,\lambda_k)=1$$ iff $$\lambda_k$$ is associated with the outcome $$a$$ of measurement $$M_i$$ in $$M$$ for any $$C$$. This implies that independently of contexts $$C$$ the probability gives the correct behaviour, constructed from the global distribution, marginalizing over a particular outcome. Above, the construction is simple: in this case the outcomes describe $$\Lambda$$ and $$p_M$$ describes the sampling over $$\Lambda$$. Obs: Note that this is a neat useful trick used in many proofs of noncontextuality that are constructive (e.g. Lemma 2 in Ref.); use the outcomes as the ontic set and try to construct a noncontextual model for it given some known structure of the statistics. (Noncontextual models allow for global distributions) On the other hand, suppose that the scenario admits a Kochen-Specker noncontextual model, therefore for any context $$C = \{M_1,\dots,M_m\}$$ we have that $$p_C(a_1, \dots, a_m\vert M_1, \dots, M_m) = \sum_{\lambda_k}p(\lambda_k)\prod_{i=1}^m p(a\vert M_i,\lambda_k)$$ Define then, for $$M = \{M_1, \dots, M_m, \dots, M_n\}$$, in words, for all measurements (and all outcomes for those) the distribution, $$p(a_1, \dots, a_n\vert M_1, \dots, M_n) := \sum_{\lambda_k}p(\lambda_k)\prod_{i=1}^n p(a_i\vert M_i, \lambda_k)$$ this is a global probability distribution that recovers the correct distribution for all contexts $$C$$, for instance, take $$C=\{M_1, \dots, M_m\}$$ as before, if we want to marginalize for $$a_{m+1}$$ we have that, $$\sum_{a_{m+1}}p(a_1, \dots, a_n\vert M_1, \dots, M_n) = \sum_{\lambda_k}p(\lambda_k)\prod_{i=1, i\neq m+1}^n\left(\underbrace{\sum_{a_{m+1}}p(a_{m+1}\vert M_{m+1},\lambda_k)}_{=1}\right)p(a_i \vert M_i , \lambda_k)$$ and now if you iterate this for all the remaining outcomes until $$a_n$$ one will recover the distribution for the context $$C$$. This concludes the proof.

1 This proof is taken from "Contextualidade e Grafos", Master Thesis by Rafael Freitas dos Santos, Unicamp, Brazil.