{'fraction_non_alphanumeric': 0.048809666228017703, 'fraction_numerical': 0.004306735255413327, 'mean_word_length': 4.036754368347058, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Contextuality-by-default for behaviours in compatibility scenarios

We show that the main idea behind contextuality-by-default (CbD), i.e., the assumption that a physical measurement has to be understood as a contextual collection of random variables, is implicit in the compatibility-hypergraph approach to contextuality (CA) and use this result to develop in the latter important concepts which were introduced in the former. We introduce in CA the non-degeneracy condition, which is the analogous of consistent connectedness, and prove that this condition is, in general, weaker than non-disturbance condition. The set of non-degenerate behaviours defines a polytope, implying that one can characterize consistent connectedness using linear inequalities. We introduce the idea of extended contextuality for behaviours and prove that a behaviour is non-contextual in the standard sense iff it is non-degenerate and non-contextual in the extended sense. Finally, we use extended scenarios and behaviours to shed new light on our results.


I. INTRODUCTION
Contextuality is one of the most singular characteristics of Quantum Theory. In addition to its role in the search for a deeper understanding of the theory itself [1,2], recent work provides indisputable evidence that contextuality is an essential resource in various information protocols and computational tasks [3]. Contextuality is a property displayed by the statistics of measurements performed on a quantum system which shows that such a statistic is incompatible with the expected description for classical systems [4]. This characteristic is closely related to the existence of incompatible measurements in quantum systems.
One approach which allows us to deal with this concept is the compatibility-hypergraph approach (CA) [2,4,5], whose main elements are (compatibility) scenarios and behaviours. The definition of scenario is the following.
Definition 1 (Scenario). A scenario is a triple S ≡ (X , C, O) where X , O are finite sets and C is a collection of subsets of X satisfying the following properties.
(a) X = ∪C We call the elements of X measurements and the elements of C contexts. The picture in mind is that X represents a collection of measurements which we can perform over a given experiment and that a context represents a collection of compatible measurements; the set O represents the set of all possible outcomes for the measurements in the scenario. The approach is called "hypergraph-approach" because a scenario (X , C, O) can be associated to a hypergraph * Correspondence email address: alisson.tezzin@usp.br whose vertices are the elements of X and whose hyperedges are the elements of C.
The result of a joint measurement over a context C can be represented by a function C → O. Therefore, the set O C of all functions C → O can be understood as the set of all possible outcomes of a joint measurement on C. If it is possible to perform repetitive joint measurements over a context we should be able to assign probabilistic predictions to the resulting outcomes, henceforth providing an interpretation for O C ; this construction is known as a behaviour of the scenario [4,6,7].
Definition 2 (Behaviour). Let S be a scenario. A behaviour in S is a function p which associates to each context C a probability distribution p C on O C , that is, p C : O C → [0, 1] satisfies s∈O C p C (s) = 1.
In CA it is usually assumed that behaviours which represents probability assignments with physical meaning should satisfy the so called non-disturbance condition, which imposes that the probability distributions given by a behaviour must coincide in intersections of contexts: Definition 3 (Non-disturbance). A behaviour p in a scenario S is said to be non-disturbing if the condition p C C∩D = p D C∩D holds for any intersecting contexts C, D ∈ C, where for any E ∈ C and E ′ ⊂ E.
In this paper we will see that, in order to introduce contextuality-by-default in CA, we have to give up this requirement.
Another important physical situation happens when all measurements in a scenario are compatible. Such situations are consistent with global probability assignments to measurements. The standard definition of contextuality constitutes an attempt to deal with it: Definition 4 (Standard contextuality). A behaviour p in a scenario S is said to be non-contextual if there is a probability distribution p : O X → [0, 1] satisfying, for any context C, In any scenario, non-contextual behaviours are always non-disturbing. On the other hand, it is in general false that non-disturbing behaviours are noncontextual [4].
Another approach to deal with contextuality is what we will call the contextuality-by-default approach (CbD) [8,9]. In this approach we consider random variables instead of behaviours, and the main idea is that a physical measurement has to be seen as a collection of random variables, one for each context containing the measurement. The approach is structured as follows. We consider a finite set X , whose elements are called properties; this set represents a collection of physical properties of the physical system under description. From an operational point of view we can understand "measurement" and "physical property" as analogous concepts, i.e. the set X fulfills the same role as the set X of measurements in a scenario. In this approach it is also assumed that there are (physical) properties which are incompatible -that is the point of contextuality -and therefore we take a collection C of subsets of X , whose elements are also called contexts. To any context C ∈ C we associate a collection R C ≡ {R C x ; x ∈ C} of random variables; this collection is said to be "the result of jointly measuring all properties within C" [9]. By doing this we associate to each property x ∈ X a collection R x ≡ {R C x ; C ∈ C x } of random variables, where C x denotes the set of contexts containing x. The sets R x , x ∈ X , are called connections [9]. We impose that all the random variables R C x , for any x ∈ X and any C containing x, have the same codomain. Finally, we call system the triple is said to be consistently connected when, for any x ∈ X , all the random variables in R x have the same distribution (that is, are physically equivalent in the sense of appendix A); if this property does not hold we say that the behaviour is inconsistently connected. Finally, a system (X , C , R) is said to have a maximally noncontextual description if there is a coupling S of R satisfying the following property: for any x ∈ C , the restriction of S to C x ≡ {C ∈ C ; x ∈ C} is a maximal coupling of the connection R x (see appendix A for the definition of coupling). We refer to this notion of contextuality as contextuality in the extended sense.

Outline of this paper
In section II we establish a precise relation between behaviours and systems in a scenario: we show how a behaviour defines a system (which is unique up to "physical equivalences") and how we can associate a behaviour (not unique) to any system in a scenario. This relation make it clear that the compatibility-hypergraph approach (CA) is entirely compatible with the idea behind contextualityby-default, allowing us to develop in CA important concepts introduced in the contextality-by-default approach (CbD). In section III we introduce consistent connectedness in CA -we call non-degenerate a behaviour whose system associated to it is consistently connected. We prove that non-disturbance implies this condition and which, in general, the reverse is not true, i.e., we prove that non-disturbance and consistent connectedness are not equivalent concepts. The set of non-degenerate behaviours define a polytope, allowing us to characterize consistent connectedness using linear inequalities [10]. In section IV we introduce the definition of extended contextuality for behaviours and prove that a behaviour is non-contextual in the standard sense (definition 4) iff it is non-contextual in the extended sense and non-degenerate. Figure 1 depicts how these sets of behaviours relate to each other. Finally, in section V we rewrite our results using extended scenarios and behaviours introduced in [7].

II. BEHAVIOURS AND SYSTEMS
In this paper we will study systems in a scenario, and we justify this decision as follows. First of all, it is easy to associate a finite set O to a system: as we do in a scenario, this is the set of all possible outcomes of the properties represented in the system; moreover, in [9] the authors make it clear, by means of examples and with a comparison with the "traditional approach to contextuality", that the random variable R C x is a random variable with values on the set of outcomes (O, P(O)) (we are using the terminology presented in the appendix A). Furthermore it seems that in a system (X , C , R) it is implicitly assumed that the set of contexts C satisfies the property (a) of definition 1. In fact, if x ∈ X does not belong to any context, there is no random variable associated to it, hence we cannot talk about a measurement of this property. Finally, can we assume that C is an anti-chain? Even though it seems to be the case, it is not completely clear to us. If that is not the case, the idea of "system in a scenario" can be understood at least as a particular case of system.
. We say that (X , C, R) and (X , C, S ) are physically equivalent when R C x and S C x have the same distribution for any C ∈ C and x ∈ C.
As it has been stated in the introduction, the key idea behind CbD is that we associate to a property (measurement) not to one but to a collection of random variables, one for each context containing that property. We will see now that the definition of behaviour in CA is entirely compatible with this assumption: if we want to treat measurements as random variables whose joint distributions in contexts are given by some behaviour, we need to assume that a measurement is associated to a collection of random variables, one for each context containing the measurement. Before we begin our discussion let's fix some notation.
We denote by P the set of all this probability distributions and we define subsets P C , P x as follows.
(a) For any C ∈ C, In case we want to refer to families of probability distributions instead of sets we will add an underline in the notation. For example, given a behaviour p we define the following families of probability distributions in (O, P(O)).
With definition 6 we see that a behaviour naturally associates a collection P x of probability distributions in (O, P(O)) to each measurement x ∈ X . It is in general false that p C x = p C ′ x whenever C, C ′ ∈ C x -for example, take a disturbing behaviour in a ncycle scenario [6]. Moreover, in each context C, p C is a coupling (see appendix A) of P C . We know that any probability distribution in a finite set O is the distribution (or density function) of a random variable with values on (O, P(O)), therefore, denoting by R C x a random variable whose distribution is p C x (all the candidates are physically equivalent in the sense of see appendix A) we see that a behaviour associates to a measurement x ∈ X a collection R x of random variables R C x , one for each context C containing x. That is exactly what we consider in the contextuality-by-default approach. As stated before, we conclude that the definition of behaviour is only coherent with the assumption that physical measurements are random variables if we accept that a measurement can be associated to different random variables, depending on the context in which we are measuring it. That is, the key idea behind CbD is already implicit in the contextuality approach.
We have seen that a behaviour in S always defines one system in S (actually, it defines a collection of physically equivalent systems). The system associated to the behaviour p is any system for any C ∈ C and x ∈ X . On the other hand, we can associate more then one behaviour in S to a given system in S: any collection of contextual couplings of a system is a behaviour. Systems and behaviours are not equivalent definitions, as we should expect: this is due the the non uniqueness of couplings.

III. NON-DEGENERATE BEHAVIOURS
We call non-degenerate a behaviour which associates only one probability distribution to each measurement of the scenario: Definition 7 (non-degenerate behaviour). A behaviour p in a scenario S ≡ (X , C, O) is said to be non-degenerate if for any x ∈ X the equality holds whenever C, C ′ ∈ C x . Equivalently, a behaviour is non-degenerate when the system associated to it is consistently connected.
If p is a non-degenerate behaviour, we denote by p x the distribution which p defines for x ∈ X , that is, p x . = p C x , where C is any context containing x. In this case we have P = {p x ; x ∈ X }, P C = {p x ; x ∈ C} and P x = {p x } (see definition 6).
By definition, the system associated to a nondegenerate behaviour is consistently connected. On the other hand, if (X , C, R) is a consistently connected system in the scenario (X , C, O), any behaviour associated to it, that is, any behaviour which is a contextual collection of couplings for R, is nondegenerate.
The set of non-degenerate behaviours draws the line between the standard interpretation of physical measurements (in which a measurement is seen as one random variable) and the interpretation proposed in the contextuality-by-default approach (a measurement is a contextual collection of random variables). This condition also has a physical content similar to non-disturbance condition. This suggests that the characterization of this set is physically relevant, just as the characterization of the non-disturbing set [4].
Such characterization is usually done in R N , so let's briefly explain how behaviours in a scenario S ≡ x. Finally, we associate a behaviour p in S to the element φ(p) ≡ P ∈ R N defined by for any (s|C) ∈ {1, ..., N }. We denote by N C the set of all φ(p) ∈ R N such that p is non-contextual in the standard sense; this is the so-called non-contextual (in the standard sense) set. Analogously we define the non-disturbing set N D, the non-degenerate set N D eg and the non-contextual in the extended sense set N C ext . It is well known that N C and N D are polytopes in R N [2,4,11]. We also note that N D eg is a polytope since it constitutes of a set of linear restrictions, i.e., hyperplanes defined by equation (4), over the polytope of behaviours [4,10].
Determining the inequalities which characterizes polytopes like N C or N D in a given scenario is a very important problem in the contextuality approach [4]. Such inequalities provide very useful information about the nature of physical systems, with respect to the property defining the polytope. The polytope N D eg allows us to do the same with nondegeneracy (i.e., consistent connectedness).
The non-disturbance condition imposes that the probabilities given by a behaviour coincides in intersections of contexts. The non-degeneracy condition, on the other hand, imposes that such distributions coincide in every point x ∈ X . Non-disturbing behaviours are always non-degenerate (lemma 1), but the reverse is false (lemma 2). That is what we are going to prove now.

Lemma 1. Any non-disturbing behaviour is nondegenerate.
Proof. Let p be a non-disturbing behaviour in a scenario S. We will prove that, for any nonempty subset E of intersecting contexts C, D ∈ C, we have p C E = p D E . In particular, it follows that p C x = p D x for any x ∈ X and C, D ∈ C x (just take E = {x}). So let C, D be intersecting contexts (note that C = D is a particular case) and take any nonempty set and this implies that p C E = p D E Now let's see why non-degenerate behaviours are not necessarily non-disturbing. Let p be a nondegenerate behaviour in S and P .
= {p x ; x ∈ X } the collection of probability distributions in O defined by it. By definition, if C ∩ D = ∅, the marginals p C C∩D and p D C∩D are couplings of p x , x ∈ C ∩ D. Consequently, saying that p is non-disturbing means that p C C∩D and p D C∩D are necessarily the same coupling. But it is easy do find a non-degenerate behaviour which does not satisfies this property. In fact, take = p a (s(a))f (s(b), s(c)) (9) These are probability distributions, therefore they define a behaviour p in S. By construction, p is disturbing and non-degenerate. In fact, and analogously p D C∩D (r) = g(r(b), r(c)), which im- Hence the following lemma has been proved.

Lemma 2. Non-degenerate behaviours are not necessarily non-disturbing.
Non-disturbance seems to be a condition way stronger then non-degeneracy: why should a nondegenerate behaviour, whose component p C is any coupling for p x , x ∈ C, give always the same coupling in intersections p x , x ∈ C ∩ D?

IV. NON-CONTEXTUALITY
Before we begin our discussion we want to emphasize an important (and quite natural) property of couplings. Roughly speaking, it is the fact that marginals distributions of couplings are also couplings. Let p 1 , ..., p n be probability distributions in is a coupling of p i1 , ..., p im . Consequently, if S ≡ (S 1 , ..., S n ) is a coupling of a sequence of random variables R 1 , ..., R n , S ′ ≡ (S i1 , ..., S im ) is a coupling of R i1 , ..., R im . Now let (X , C, R) by a system in a scenario S ≡ (X , C, O) and, for any x ∈ X and C ∈ C x , let p C x : O → [0, 1] be the distribution associated to the random variable R C x of the system. The system (X , C, R) has a maximally non-contextual description iff there is a coupling q of P . = (p C x |∀x ∈ X (C ∈ C x )) such that, for any x ∈ X , its marginal (in the appropriate coordinates) is a maximal coupling of P x . = (p C x |C ∈ C x ). Note that q defines a behaviour q for this system, where q C is given by the marginal of q in the components associated to the distributions p C x , x ∈ C. We introduce the following definition. Definition 8 (Extended contextuality). We call non-contextual in the extended sense a behaviour whose system, as defined by it (see definition 6), has a maximally non-contextual description, that is, a behaviour p in a scenario S ≡ (X , C, O) is noncontextual in the extended sense when P . = (p C x |∀x ∈ X (C ∈ C x )) has a coupling q satisfying the following properties: (a) For any C ∈ C, where q C is given by the marginal of q in the coordinates corresponding to p C x , x ∈ C (b) The distribution q T (x) is a maximal coupling of P x . = (p C x |C ∈ C x ), where q T (x) is given by the marginal of q in the coordinates corresponding to p C x , C ∈ C x . Now we want to show that the so called standard definition of contextuality [4,5] (definition 4) is the above definition when restricted to nondegenerate behaviours (lemma 3), as it has already been discussed in [9]. In order to do that it is useful to fix some notation. First of all, if a behaviour p in S is non-contextual in the above sense then P has a coupling q : We also define C . = {x C ∈ X ; x ∈ C} for every C ∈ C and T (x) . = {x C ∈ X ; C ∈ C x } for every x ∈ X . This justifies the notation of definition 8. The following embedding will be very important in our discussion.
We will denote by Here, the symbol C means "constant", because any u ∈ O X is constant in the set T (x) for every x ∈ X . Now we note the following: Any probability distribution q : O X → [0, 1] has a trivial extension q : O X → [0, 1] given by Moreover, any distribution p : is the extension (in the above sense) of one, and only one, distribution q : for any C ∈ C. For x ∈ X we have This last result implies that q T (x) (s) = 0 only if s is constant, and in this case This means that q T (x) is a maximal coupling (the only one) of q x , ..., q x (|C x | times) -remember that q x = q xC . Now we prove the following lemma. Proof. We know that a "non-contextual in the standard sense" behaviour is non-disturbing, therefore it is non-degenerate (lemma 1); then what we have to prove is that a non-degenerate behaviour is noncontextual in the extended sense (definition 8) iff it is non-contextual in the standard sense. So let p be a non-degenerate behaviour in S. We have we are just repeating p x |C x | times. Suppose that p is non-contextual in the standard sense and let q : O X → [0, 1] be a global section of p, that is, a function satisfying, for any C ∈ C, p C (s) = u∈O X u|C =s q(u). We have already seen that the trivial extension q : O X → [0, 1] of q is a coupling for P . Moreover, equation 24 imply that q C = p C and equations 25 and 26 implies that q T (x) is a maximal coupling of p x , ..., p x (|C x | times), that is, conditions a and b of definition 8 are satisfied, implying that p is non-contextual (definition 8). On the the other hand, if f : This implies that f (v) = 0 whenever the restriction v| T (x) is not constant. This is true for any x ∈ X , But we have seen that this implies f = q for one (and only one) q : O X → [0, 1], and this function is a global section for p, proving that p is non-contextual in the standard sense.

V. EXTENDED SCENARIOS AND BEHAVIOURS
Now we want to formulate definition 8 using the definition of so-called extended scenarios, that were introduced in [9,12].
Let p be a non-contextual behaviour in S ≡ (X , C, O) and let q : O n → [0, 1] be a coupling of P . In the above section we have denoted by x C the component i ∈ {1, ..., n} associated to p C x , which allows us to write X ≡ {1, ..., n} and define C .
, is a scenario (note that X = ∪ C∈C C). In this scenario, a coupling q : O X → [0, 1] of P can be seen as a global section of a behavior p in S, being p given by p C .
= q C = p C for C ∈ C and p T (x) . = q T (x) for x ∈ X . Note that the behaviour p depends on q, not just on p. These behaviours p are examples of the so-called "extensions of p in S" [7], an we conclude that a behaviour p in S is non-contextual iff there is an extension p of p which is non-contextual in the standard sense (that is, has a global section) in S. Let's introduce it in a more explicit way.
Definition 9 (Extension of a scenario). Let S ≡ (X , C, O) be a scenario. For any pair x ∈ X and C ∈ C we define x C .
= (x, C); note that x C = y D iff x = y and C = D. We define, for any C ∈ C, and for any x ∈ C satisfying |C x | > 1, The "extension of S" is the scenario S ≡ ( X , C, O), where for the sake of simplicity we will write f = g.
Definition 10 (Extension of a behaviour). Let p be a behaviour in S ≡ (X , C, O). We call an "extension of p" any behaviour f in S satisfying: (a) For any C ∈ C, The following lemma has already been proved above. This says that definition 8 coincides with the definition of extended contextuality introduced in [7]. Finally, let's characterize extensions of nondegenerate behaviours. It has been proved in the appendix that a sequence of probability distributions Note that " p T (x) = p x ", that is, . Roughly speaking, we can say that the extension of a non-degenerate behaviour p is just the set of distributions P x = {p x ; x ∈ X } "plus" the set of contextual couplings p C , C ∈ C, given by p.

VI. CONCLUSION
In our work we have studied the formalism of contextuality-by-default from the perspective of the contextuality scenario paradigm. From that we were able to rephrase the notion of consistent connectedness in terms of a new definition associated to the behaviour perspective: non-degenerate behaviours. We have shown that non-degeneracy and non-disturbance are different notions. More important, such results imply that the contextuality approach is compatible with the idea of measurements as a collection of random variables, relaxing the condition of non-disturbance over the behaviours present in the experimental scenario.
From such perspective we could introduce in the already known scenario formalism the same ideas relevant for the contextuality-by-default approach. Hence obtaining an extended notion of noncontextuality that does not require non-disturbance from the behaviours, suitable for the interpretation of measurement procedures in different contexts as truly different procedures; but arising from (graph) contextuality scenarios, framework presented in [4,5]. As an observation we further noticed that the set of non-degenerate behaviours form a polytope.
Another important remark is that we have proved that non-contextuality in the usual sense is equivalent to the extended notion of non-contextuality when restricted to non-degenerate behaviours.
Our work brings light to the interplay between contextuality approaches, but there are still further directions to investigate. An interesting research can be the development of a resource theory for extended contextuality that could investigate contextual advantages beyond the non-disturbance condition. Another possible investigation would be to understand the connection between the generalized contextuality approach and the contextuality-by-default approach, since these are two very different perspectives on the notion of a context: equivalent probabilities for the former and different measurement procedures for the latter.