A proof of the Kochen-Specker theorem can always be converted to a state-independent noncontextuality inequality

Quantum contextuality is one of the fundamental notions in quantum mechanics. Proofs of the Kochen-Specker theorem and noncontextuality inequalities are two means for revealing the contextuality phenomenon in quantum mechanics. It has been found that some proofs of the Kochen-Specker theorem, such as those based on rays, can be converted to a state-independent noncontextuality inequality, but it remains open whether it is true in general, i.e., whether any proof of the Kochen-Specker theorem can always be converted to a noncontextuality inequality. In this paper, we address this issue. We prove that all kinds of proofs of the Kochen-Specker theorem, based on rays or any other observables, can always be converted to state-independent noncontextuality inequalities. Besides, our constructive proof also provides a general approach for deriving a state-independent noncontextuality inequality from a proof of the Kochen-Specker theorem.


Introduction
Quantum contextuality [1] as a natural generalization of Bell nonlocality [2] is one of the fundamental notions in quantum mechanics, and has drawn a lot of interest recently. Proofs of the Kochen-Specker (KS) theorem and noncontextuality inequalities are two different methods for revealing the contextuality phenomenon in quantum mechanics. Both of them have been widely used in many fields of quantum mechanics, including quantum computation [3][4][5] and quantum information [6][7][8][9][10][11].
KS theorem was found from the inconsistency of the noncontextual hidden variable (NCHV) model with quantum mechanics. The NCHV model [1,2] consists of two basic assumptions: that every observable A has a definite value v(A) at all time, and that v(A) does not depend on whether A is measured alone or together with B or C if A is compatible with B and C. The first assumption is at the core of the hidden variable theory while the latter is the exhibition of noncontextuality. An observable corresponds to a Hermitian operator in quantum mechanics, and two observables being compatible in the NCHV model is corresponding to the operators being commutative in quantum mechanics. A measurement context in the NCHV model, defined as a set of mutually compatible observables, is corresponding to a set of mutually commutative operators in quantum mechanics. To examine the inconsistency of the NCHV model with quantum mechanics, Kochen and Specker assumed that the algebraic structure of compatible observables in quantum mechanics is also preserved in the NCHV model, which leads to the sum rule and product rule [12,13]. The sum rule means that if A and B are two compatible observables and C = A + B, then v(C) = v(A) + v(B). Similarly, the product rule means that if A and B are two compatible observables and C = A · B, then v(C) = v(A) · v(B). It was found that there always exists a finite set of observables for any n-dimensional Hilbert space with n ≥ 3, such that all elements in the set cannot simultaneously have values satisfying the sum rule and product rule. This finding is usually called the KS theorem, which shows that the NCHV model is not compatible with quantum mechanics.
A proof of the KS theorem is accomplished by finding an observable set in which no value assignment of the observables can satisfy the sum rule and product rule, i.e., it inevitably leads to a logical contradiction if the value assignments of the observables are required to satisfy the sum rule and product rule. Such sets of the observables that can lead to a logical contradiction between the value assignments and the algebraic structure are not unique, and each of them provides a proof of the KS theorem. Early proofs of the KS theorem are all based on the rays, rank-1 projectors, in the Hilbert space. The original proof of the KS theorem proposed by Kochen and Specker involves 117 rays. The size of the ray sets is reduced step by step [14][15][16][17][18] and the simplest proofs based on rays are with 31 rays for a 3-dimensional Hilbert space [16] and 18 rays for a 4-dimensional Hilbert space [18]. Generalization of proofs of the KS theorem started from the works of Mermin and Peres [19,14], who found that the number of observables involved in a proof of the KS theorem can be significantly reduced if general observables are used, instead of only using rays. The Mermin-Peres square proposed by them involves only 9 observables in a 4-dimensional Hilbert space. Since then, a great number of proofs of the KS theorem based on general observables have been proposed [20][21][22][23][24][25][26][27][28][29][30][31][32].
Noncontextuality inequalities are an alternative tool for demonstrating the inconsistency between the NCHV model and quantum mechanics. A noncontextuality inequality is an expression which is fulfilled for all value assignments of observables in the NCHV model but is violated for some states in quantum mechanics. A noncontextuality inequality is said to be state-independent if it is violated by all quantum states. Proofs of the KS theorem and noncontextuality inequalities are two ways of showing the inconsistency between the NCHV model and quantum mechanics. Compared with proofs of the KS theorem, noncontextuality inequalities are more experiment-friendly, and therefore have drawn a lot of interest recently .
Cabello may be the first who noted that some proofs of the KS theorem can be used to construct state-independent noncontextuality inequalities, and proposed the first state-independent noncontextuality inequality [35]. Soon after, Badziag et al showed that every proof of the KS theorem based on rays can be converted to a stateindependent noncontextuality inequality [36]. Indeed, for a proof of the KS theorem based on the ray set S = {P 1 , P 2 , . . . , P µ } in an n-dimensional Hilbert space, one can construct the function . . , P k α n } ∈ S is the α-th basis of the space, α = 1, 2, . . . , N with N being the total number of the bases. If S satisfies the condition that every pair of orthogonal rays belongs to some {P k α 1 , P k α 2 , . . . , P k α n }, then one can immediately obtain the noncontextuality inequality for the NCHV model, F ≤ N(n − 2) − 2, which is violated for all quantum states since F = N(n − 2) in quantum mechanics. If S does not satisfy this condition, it should be enlarged by adding new rays to satisfy the condition and an inequality can be derived from the enlarged set. Most recently, the result of Badziag et al was improved by Yu and Tong in Ref. [49], where the authors put forward an alternative method, which need not enlarge the given ray set S and can give a simpler inequality from a proof of the KS theorem based on rays.
These previous results show that some proofs of the KS theorem, such as those based on rays, can be converted to state-independent noncontextuality inequalities. However, it remains open whether such correspondence is true in general, i.e., whether any proof of the KS theorem, not limited to those based on rays, can always be converted to a state-independent noncontextuality inequality. This is a fundamental issue related to the relation between proofs of the KS theorem and noncontextuality inequalities. In this paper, we address this issue. Our results show that every proof of the KS theorem, based on rays or other observables, can always be converted to a state-independent noncontextuality inequality. Besides, our constructive proof also provides a simple approach for deriving a state-independent noncontextuality inequality from a general proof of the KS theorem. Proofs of the KS theorem based on general observables are usually simpler than those only based on rays, and therefore the inequalities derived from them are expected to be simpler and more useful.
This paper is organized as follows. In section 2, we demonstrate the existence of a noncontextuality inequality in any proof of the KS theorem and put forward a general approach to derive the inequality. In sections 3 and 4, as examples of showing its application, we apply our approach to proofs of the KS theorem based on rays and proofs of the KS theorem based on parity arguments, respectively, and derive the corresponding noncontextuality inequalities. Section 4 is the conclusion and remarks.

A general approach of converting a proof of the KS theorem to a noncontextuality inequality
We first specify some notation and relations. S is used to denote a set of observables which carries out a proof of the KS theorem, S = {A 1 , A 2 , . . . , A µ }, where the observables A i may be rays or other observables. A measurement context is defined as a subset of S, denoted as S α , in which all observables are mutually compatible, where the subscript α is used to label different measurement contexts, α = 1, 2, . . . , L. The α-th measurement context can be written as is the number of observables in the α-th measurement context. Note that m in the subscript of k α m depends on α, i.e., the number of observables in different measurement contexts may be different. We use is an eigenvalue of the operatorÂ i . If a value assignment v satisfies the sum rule and product rule, . . , A k α m are mutually compatible. We now demonstrate the existence of a noncontextuality inequality in a proof of the KS theorem expressed by S. The fact that the observable set S provides a proof of the KS theorem means that no value assignment v can simultaneously fulfil all the equations is a Noetherian ring, and therefore I α can be finitely generated. For each I α , we can always find a finite subset of I α , {r α 1 , r α 2 , . . . , r α Iα }, such that all r ∈ I α can be written as . This implies that r| v = 0 for all r ∈ I α if and only if r α i | v = 0 for i = 1, 2, . . . , I α . Hence, the observable set S provides a proof of the KS theorem if and only if no value assignment v can simultaneously fulfil the equations, {r α i | v = 0|i = 1, 2, . . . , I α , α = 1, 2, . . . , L}, which include a finite number of polynomials r α i . By using these polynomials, we can define a function, It is easy to verify that F < 0 plays the role of a state-independent noncontextuality inequality. In fact, since at least one r α i | v is nonzero for any value assignment v and therefore Tr((r α i ) 2 ρ) = 0 for all quantum states ρ, which means that all quantum states violate the inequality F < 0.
With the help of the above demonstration, we may now develop a general approach of converting a proof of the KS theorem to a state-independent noncontextuality inequality. The above discussions show that the key is to find a set of observable polynomials, {r 1 , r 2 , . . . , r N }, which satisfies the two conditions: that r i is a polynomial of some measurement context S α = {A k α 1 , A k α 2 , . . . , A k α m } satisfying that r i (Â k α 1 ,Â k α 2 , . . . ,Â k α m ) = 0, and that for any value assignment v, at least one of {r 1 | v , r 2 | v , . . . , r N | v } is nonzero. For convenience, hereafter, we call such a set of observable polynomials that satisfy the two conditions as a complete set of polynomials. Clearly, for a given set of observables S, there may be many different complete sets of polynomials and the number N for different sets may be different too. We only need to find one of them to construct a noncontextuality inequality in S. Although it is difficult to prove whether an observable set provides a proof of the KS theorem, it is trivial to find a complete set of polynomials from the observable set that has been proved to be a proof of the KS theorem. Indeed, if a set of observables is a proof of the KS theorem, it means that no value assignment to the set can satisfy the sum rule and product rule. This is verified either by finding, for each value assignment, a polynomial of compatible observables that is equal to zero in quantum mechanics but nonzero for the value assignment in the NCHV model, or by finding several polynomials of compatible observables that are equal to zero in quantum mechanics but lead to a logical contradiction if they are required to be zero in the NCHV model. In each of the two cases, the set of the polynomials used in the proof is just what we want to find. They comprise a complete set of polynomials, {r 1 , r 2 , . . . , r N }, and can be used to construct a noncontextuality inequality, F < 0 with F = − N i=1 r 2 i . If we would like to obtain an inequality being with an explicit upper bound, we may normalize each polynomial by to take the place of r i , the inequality can be expressed as F ≤ −1. Besides, the state-independent inequality obtained can be simplified by reducing So far, we have demonstrated the existence of a noncontextuality inequality in any proof of the KS theorem and have shown how to convert a proof of the KS theorem to a noncontextuality inequality. To summarize our approach briefly, one may derive a state-independent noncontextuality inequality from a proof of the KS theorem expressed by a set of observables S = {A 1 , A 2 , . . . , A µ } via the following three steps. 1) Find a complete set of normalized polynomials, denoted as P c = {r 1 , r 2 , . . . , r N }. (1) This can be done by first finding a complete set of polynomials and then normalizing them by multiplying each by a suitable constant.
2) Define a function of observables by using the normalized polynomials, and simplify F = F (A 1 , A 2 , . . . , A µ ) by using the relation 3) Write out the expression, which is a state-independent noncontextuality inequality, i.e., violated by all the quantum states.
It is worth noting that in the above discussions, the polynomials r i have been assumed to be real for simplification. Although this assumption is applicable for almost all known proofs of the KS theorem, there are a few proofs of the KS theorem in which complex polynomials are involved [24,29]. Our approach is also applicable to these cases. When complex polynomials are involved in a proof of the KS theorem, the only modification is that equation (2) is replaced by In the following sections, we will take two well-known kinds of proofs of the KS theorem, proofs based on rays and proofs based on parity arguments, as examples to illustrate the approach.

Application to proof of the KS theorem based on rays
Let S be a set of rays that provides a proof of the KS theorem, S = {P 1 , P 2 , . . . , P µ }, where P i are rays in an n-dimensional Hilbert space. A ray set provides a proof of the KS theorem if and only if no value assignment v can simultaneously satisfy the KS rules: . . , n} forms an orthogonal basis for the n-dimensional Hilbert space. In other words, at least one of these equations is invalid for each value assignment.
We now derive a state-independent noncontextuality inequality from the set S by using our approach described in section 2. First, {P i P j |P iPj = 0, P i , P j ∈ S}∪{ n i=1 P k α i −1 | n i=1P k α i = I n , P k α i ∈ S} comprise a complete set of polynomials ‡, and each of the polynomials is already normalized since v(P i )v(P j ) = 1 if v(P i )v(P j ) = 0 and n i=1 v(P k α i )−1 = −1 or ≥ 1 if n i=1 v(P k α i )−1 = 0. Therefore, we may take this set of polynomials as P c , a complete set of normalized polynomials defined in equation (1). Second, substituting all the polynomials for r i in equation (2), and using the relation P i (P i − 1) = 0, i.e., P 2 i = P i , we obtain Third, the state-independent noncontextuality inequality reads F < −1 and the quantum violation is given by F = 0 for all quantum states ρ. It is interesting to note that the inequality obtained by using the general approach is equivalent to the one in [49], which is given by trial and error. For the case considered by Badziag et al [36], where S includes N bases, S α = {P k α 1 , P k α 2 , . . . , P k α n }, α = 1, 2, . . . , N, and every pair of orthogonal rays belongs to some ‡ If the ray set is denoted by a graph, in which each vertex corresponds to a ray and two vertices corresponding to two orthogonal rays are connected by an edge, then these polynomials just correspond to the edges and n-vertex cliques in the graph. S α , the complete set of normalized polynomials can be taken as P c = { n i=1 P k α i − 1 = 0|α = 1, 2, . . . , N}. In this special case, equation (5) is reduced to and state-independent noncontextuality inequality reads which is valid for the NCHV model, but is violated by all quantum states ρ since the expectation is N in quantum mechanics. In the previous work on noncontextuality inequalities, observables were usually chosen to be {−1, 1}-dichotomic. If we let (5), (6) and (7) can be rewritten with observables A i . For example, the inequality (7) becomes an equivalent form, which is valid for the NCHV model, but is violated by all quantum states ρ since the expectation is (n 2 − 3n + 4)N in quantum mechanics. Compared with the noncontextuality inequality constructed by Badziag et al, in which correlations of n compatible observables are involved, the inequalities derived by our approach, which only involve correlations of two compatible observables, are simpler and should be more feasible experimentally.

Application to proof of the KS theorem based on parity arguments
Let S = {A 1 , A 2 , . . . , A µ } be a set of observables that provides a proof of the KS theorem based on parity arguments, i.e., a parity proof, in an n-dimensional Hilbert space. The observables in S are {−1, 1}-dichotomic §, and there are N measurement contexts in S, denoted as S α = {A k α 1 , A k α 2 , . . . , A k α m }, α = 1, 2, . . . , N, which satisfy the expressionŝ where δ α equals to 1 or −1 and m = m(α) is the number of observables in S α . S being a parity proof means that these N measurement contexts satisfy the relations: (i) δ 1 δ 2 · · · δ N = −1, and (ii) each A i appears an even number of times in total in all N measurement contexts, i.e., the number of measurement contexts that contain any A i is even. According to the expressionsÂ k α the value assignment v satisfies the sum rule and product rule. However, these equations, for any value assignment, cannot be simultaneously valid, because there is a contradiction if they are used to calculate . . . v(A k α m ) = 1, since § For a parity proof based on rays, it can be convert to an equivalent form by replacing every ray P i by an the number of each A i in the expression is even. This is the main idea of a proof of the KS theorem based on parity arguments.
We now derive a state-independent noncontextuality inequality from the parity proof. The above discussion shows that A k α 1 A k α 2 . . . A k α m − δ α = 0 and that at least one of the equations, v( . . , N} comprise a complete set of polynomials. The normalized forms of the N polynomials are We then obtain the complete set of normalized polynomials. Substituting them into equation (2) and using the relations (A i − 1)(A i + 1) = 0, i.e., A 2 i = 1, we obtain The state-independent noncontextuality inequality can be written as which is violated by all quantum states ρ since N α=1 δ α By applying our approach to proofs of the KS theorem based on parity arguments, we have obtained a general expression of the state-independent noncontextuality inequality. With this result, all known parity proofs, for example, those in Refs. [19,14,20,17,18,22,23,[25][26][27][28]30] can be easily converted to state-independent noncontextuality inequalities, and the inequalities in Refs. [35] and [51] are special cases of equation (10).

Conclusions
We have shown that a proof of the KS theorem can always be converted to a stateindependent noncontextuality inequality. This conclusion is true for all kinds of proofs of the KS theorem, based on rays or any other observables. It is interesting to note that our constructive proof actually provides a general approach of deriving a noncontextuality inequality from a proof of the KS theorem. By following the steps described by equations (1) to (3), one can derive a state-independent noncontextuality inequality from any proof of the KS theorem. As examples, we have applied our approach to two kinds of well-known proofs of the KS theorem, i.e., proofs based on rays and proofs based on parity arguments. Certainly, our approach is applicable to all kinds of proofs of the KS theorem,including those in [21,26,31,32], not limited to the two examples.
Compared with the methods proposed in [36] and [49], which are applicable only to proofs of the KS theorem based on rays, the present approach is applicable to all kinds of proofs of the KS theorem. The inequalities obtained by our approach are simpler than the previous results in [36] and as simple as the ones in [49] when it is applied to proofs based on rays, and new state-independent noncontextuality inequalities are given when it is applied to proofs based on other observables.