Quantum contextuality is the failure of a classical-looking idea: that every measurement can be assigned a pre-existing outcome that is independent of which other compatible measurements are performed alongside it.
Bell nonlocality is one form of contextuality with a spacetime separation structure. Kochen–Specker contextuality is more general. It can appear in one laboratory without assuming two distant parties, provided the same observable participates in different compatible measurement contexts and no single global noncontextual value assignment can reproduce all quantum predictions.
This guide develops measurement contexts, functional consistency, the Kochen–Specker theorem, the Peres–Mermin square, compatibility and exclusivity graphs, noncontextual polytopes, inequality witnesses and the contextual fraction. Guide 29 owns Bell/CHSH nonlocality; Guide 56 owns contextuality as the wider compatibility-based obstruction.
List compatible measurements → assume context-independent values → impose algebraic constraints → test global consistency → quantify the irreducibly contextual remainder.
1. Measurement scenario
Let X be a set of measurements. Not every subset of X must be jointly measurable.
A context C⊆X is a set of measurements that can be performed together in the operational scenario.
Each context has an experimentally observed joint probability distribution
p_C(s)
over outcome assignments s for measurements in C.
The contextuality question asks whether all these overlapping distributions are marginals of one global classical probability distribution over outcomes for every measurement at once.
2. Noncontextual hidden-variable idea
In a deterministic noncontextual model, each measurement M has a value v(M) assigned before the context is chosen.
If the same measurement M appears in contexts C and C’, its value must be the same in both.
Probabilistic noncontextual models are convex mixtures of such deterministic global assignments.
Thus deterministic assignments are the vertices of a noncontextual polytope; ordinary shared classical randomness fills in its convex hull.
3. Functional consistency
Suppose compatible observables A and B satisfy an operator identity
C=f(A,B).
A noncontextual value assignment intended to reproduce sharp quantum predictions should respect the same functional relation:
v(C)=f(v(A),v(B)).
For commuting ±1 observables with C=AB, this becomes
v(C)=v(A)v(B).
Kochen–Specker contradictions exploit sets of such mutually compatible algebraic constraints that cannot all be satisfied by one context-independent assignment.
4. Kochen–Specker theorem
Kochen and Specker proved that in Hilbert-space dimension at least three, there exist finite sets of projective measurements for which no assignment of predetermined noncontextual outcomes can satisfy the quantum functional constraints. [1]
The theorem does not say measurement outcomes are mathematically undefined before observation in every interpretation. It rules out a specific class of hidden-variable models: outcome assignments that are both noncontextual and consistent with the relevant sharp-measurement relations.
Contextuality is therefore a constraint on explanatory models, not merely a slogan that “measurement changes reality”.
5. Projector colouring picture
For rank-one projectors forming an orthonormal basis in dimension d, quantum mechanics predicts that exactly one projector returns 1 and the others return 0 in an ideal projective measurement.
A Kochen–Specker colouring would assign 0 or 1 to every projector such that every orthonormal basis contains exactly one 1.
Suitable finite ray sets admit no such colouring.
The impossibility is combinatorial: local basis rules cannot be extended to one globally consistent assignment.
6. State-dependent versus state-independent contextuality
Some contextual inequalities are violated only by selected quantum states.
State-independent constructions produce a contextual contradiction for every quantum state in the specified Hilbert space because the operator algebra itself forces the violation.
The Peres–Mermin square is a compact two-qubit state-independent example.
7. Peres–Mermin square
Consider nine two-qubit observables arranged as
| X⊗I | I⊗X | X⊗X |
| I⊗Y | Y⊗I | Y⊗Y |
| X⊗Y | Y⊗X | Z⊗Z |
Every row contains mutually commuting observables. Every column also contains mutually commuting observables.
Quantum operator multiplication gives row products +I,+I,+I and column products +I,+I,−I.
8. Verify the first two rows
Row 1:
(X⊗I)(I⊗X)(X⊗X)=I.
Row 2:
(I⊗Y)(Y⊗I)(Y⊗Y)=I.
The first two operators in each row multiply to the third, so multiplying all three gives identity.
9. Verify the third row
Use XY=iZ and YX=−iZ:
(X⊗Y)(Y⊗X)=(XY)⊗(YX)=(iZ)⊗(−iZ)=Z⊗Z.
Multiplying by the final Z⊗Z gives +I.
Thus all three row-product predictions are +1 for every quantum state.
10. Verify the columns
Column 1:
(X⊗I)(I⊗Y)(X⊗Y)=I.
Column 2 similarly gives +I.
For column 3,
(X⊗X)(Y⊗Y)=(XY)⊗(XY)=iZ⊗iZ=−Z⊗Z.
Multiplying by Z⊗Z gives
−I.
11. Noncontextual contradiction
Assign each of the nine observables a predetermined value ±1.
Multiply the six required row/column product equations together.
Every individual assigned value appears exactly twice—once in its row and once in its column. Therefore the product of all left-hand sides must be +1 because v²=1.
But the quantum-required right-hand side is
(+1)^5(−1)=−1.
Contradiction.
No context-independent ±1 value assignment can satisfy all six compatible-context products simultaneously.
12. Why the same observable must keep the same value
X⊗I appears in both its row and column.
A contextual hidden-variable model can allow its outcome to depend on whether it is co-measured with {I⊗X,X⊗X} or with {I⊗Y,X⊗Y}.
The contradiction appears only because noncontextuality demands one value for X⊗I independent of which compatible context surrounds it.
The theorem therefore pinpoints exactly which classical assumption fails.
13. Experimental contextuality requires operational care
Real measurements are not ideal algebraic symbols.
Two laboratory implementations claimed to represent the same observable in different contexts may differ slightly.
A robust noncontextuality test must therefore state an operational equivalence assumption or explicitly model compatibility disturbance.
Otherwise contextuality can be faked by context-dependent apparatus rather than revealed as a property of the intended operational statistics.
14. Contextuality inequalities
An all-or-nothing contradiction is elegant but sensitive to perfect algebraic assumptions.
Experiments usually test an inequality
S≤S_NC
obeyed by all noncontextual models.
Quantum theory predicts S>SNC for suitable states and measurements.
The amount of violation becomes a noise-robust witness rather than an exact logical contradiction.
15. KCBS pentagon
Klyachko, Can, Binicioğlu and Shumovsky developed a five-measurement contextuality inequality for a qutrit.
In one projector formulation, five events are arranged cyclically so adjacent events are mutually exclusive.
A noncontextual deterministic assignment cannot label adjacent exclusive events both 1, so the maximum number of 1s around the pentagon is the graph independence number α(C₅)=2.
Quantum probabilities can reach √5≈2.236 in the ideal symmetric construction, violating the noncontextual bound 2.
16. Exclusivity graph
Represent each event as a vertex. Draw an edge when two events are mutually exclusive.
Then:
- the independence number α(G) often gives a deterministic noncontextual bound for a sum of event probabilities;
- the Lovász theta number ϑ(G) often bounds or characterises the corresponding quantum maximum in important exclusivity scenarios;
- the fractional packing number can describe a broader probabilistic/exclusivity bound.
Graph invariants translate contextuality into combinatorial optimisation.
17. Compatibility graph
A compatibility graph uses vertices for measurements and edges for pairs that can be jointly measured.
This is different from an exclusivity graph, whose vertices are events/outcomes and edges mean mutual exclusion.
Confusing the two graphs leads to incorrect bounds because their vertices encode different objects.
Hypergraphs or simplicial complexes are often needed because compatibility can involve whole contexts rather than only pairwise edges.
18. Empirical model
In the sheaf-theoretic framework of Abramsky and Brandenburger, an empirical model is a compatible family of probability distributions over each measurement context.
No-signalling/no-disturbance consistency means overlapping contexts agree on the marginal statistics of measurements they share.
A model is noncontextual when there exists one global probability distribution whose marginals reproduce every context distribution.
This turns contextuality into a marginal-extension problem.
19. Linear-program test for noncontextuality
Enumerate deterministic global assignments g.
Let wg≥0 be their mixture weights with Σwg=1.
For every context event e, require
Σ_g M_{e,g}w_g=p_e
where Me,g is 1 if assignment g produces event e and 0 otherwise.
If this linear feasibility problem has a solution, the empirical model is noncontextual. If not, separating-hyperplane duality produces a contextuality inequality witness.
20. Contextual fraction
An empirical model e can sometimes be decomposed as
e=λ e_NC +(1−λ)e’
where eNC is noncontextual and e’ is an arbitrary residual empirical model.
The noncontextual fraction NCF(e) is the largest possible λ.
The contextual fraction is
CF(e)=1−NCF(e).
CF=0 means fully noncontextual. CF=1 means no positive noncontextual component can be extracted in this decomposition. [4]
21. Linear program for NCF
Let b contain all observed event probabilities and M map global deterministic assignments to context events.
Allow subnormalised noncontextual weights w≥0 satisfying
Mw≤b.
Maximise
1^T w.
The optimum is the largest noncontextual fraction λ.
Thus contextual fraction is computable by linear programming once the finite measurement scenario and empirical probabilities are specified.
22. Worked contextual-fraction mixture
Suppose an empirical model is known to have a decomposition
e=0.70 e_NC+0.30 e_C
and a linear program proves no decomposition with noncontextual weight above 0.70 exists.
Then
NCF=0.70
and
CF=0.30.
The 30% does not mean “30% of individual trials are contextual events” in a unique ontological sense. It quantifies the irreducible contextual weight under the specified convex decomposition framework.
23. Relation to Bell inequalities
A Bell scenario is a contextuality scenario with measurements partitioned among separated parties and contexts chosen by taking one setting from each party.
Local hidden-variable models are then a special class of noncontextual global assignments respecting the party structure.
The contextual fraction has a precise relationship to normalised Bell-inequality violations and can quantify nonclassical advantage across Bell and non-Bell scenarios. [4]
24. Contextuality as a computational resource
In several models of quantum computation, noncontextual states/operations form a classically simulable subtheory, while contextual resource states enable computational advantage.
For example, contextuality is necessary for magic-state quantum computation in important odd-prime-dimensional stabilizer settings, and contextual fraction can bound advantage in certain measurement-based computational tasks.
“Contextuality is the resource for all quantum speedup” is too broad. Necessity and sufficiency depend on the computation model and free-operation definition.
25. Spekkens contextuality
The original Kochen–Specker notion concerns sharp measurements and outcome assignments.
Spekkens generalised noncontextuality operationally: procedures that are operationally indistinguishable should have the same ontological representation.
This includes preparation noncontextuality, transformation noncontextuality and measurement noncontextuality.
The generalised framework is especially useful for realistic noisy experiments where ideal projective compatibility is unavailable.
26. Contextuality and quasiprobability negativity
Some quantum subtheories admit quasiprobability representations in which noncontextual states and operations correspond to nonnegative distributions.
Contextual resources then require negativity somewhere in the representation.
This creates a useful analogy with Guide 55’s quasiprobability error cancellation: negative weights signal departure from an ordinary classical stochastic mixture. The operational meanings are different, however, and the two negativities should not be identified automatically.
27. Noise destroys contextuality continuously
Mix an ideal contextual model e with noncontextual noise n:
e_v=v e+(1−v)n.
As visibility v decreases, contextual inequality violations shrink.
Below a scenario-dependent threshold, ev enters the noncontextual polytope and no longer violates any noncontextual inequality.
Robust contextuality experiments therefore report confidence intervals and explicit noise/compatibility assumptions rather than only ideal theoretical values.
28. Common misconception: contextuality means the result depends on what the experimenter is thinking
The “context” is an operational measurement context—what compatible procedures are jointly implemented—not a psychological context.
29. Common misconception: noncommuting measurements are enough to prove contextuality
Contextuality tests use structured overlaps among compatible measurements. Mere incompatibility between A and B does not by itself create a Kochen–Specker contradiction.
30. Common misconception: Bell nonlocality and contextuality are identical
Bell nonlocality is a special contextuality scenario with separated parties and locality constraints. Contextuality can be demonstrated without spacelike separation.
31. Worked synthesis problem
Take the Peres–Mermin square and assume a deterministic noncontextual assignment vij∈{±1}.
Step 1: Row constraints. Each row product must be +1, so multiplying all three rows gives +1.
Step 2: Column constraints. The first two column products are +1 and the third is −1, so multiplying all columns gives −1.
Step 3: Global assignment check. Multiplying the values by rows or by columns multiplies every vij exactly once in each grouping. Both must equal the same product of all nine values.
Step 4: Contradiction. The row grouping requires that product to be +1 while the column grouping requires −1.
Step 5: Interpretation. The contradiction is independent of the quantum state because the six operator-product identities themselves are state independent.
32. Practice set
- What is a measurement context?
- What does measurement noncontextuality require when one observable appears in two compatible contexts?
- What does functional consistency require for C=AB?
- What does the Kochen–Specker theorem rule out?
- Why is the Peres–Mermin square state independent?
- What are the three row products in the square used here?
- What are the three column products?
- Why does multiplying all six constraints give a contradiction?
- What is an exclusivity graph?
- What graph invariant gives the classical pentagon bound in KCBS?
- Define contextual fraction.
- Why is a Bell scenario a special contextuality scenario?
Answers
- A set of measurements that can be jointly implemented in the operational scenario.
- The observable’s ontic/predetermined response must not depend on which other compatible measurements accompany it.
v(C)=v(A)v(B)for commuting sharp ±1 observables.- A globally consistent noncontextual value assignment satisfying the relevant projective/functional constraints in dimension at least three.
- The commuting operator products give the contradiction for every state.
- +I,+I,+I.
- +I,+I,−I.
- Every assigned value appears twice across row+column products, forcing +1, while quantum operator constraints require −1.
- A graph whose vertices are events and whose edges indicate mutual exclusivity.
- The independence number α(C₅)=2.
CF=1−NCF, where NCF is the maximum weight of a noncontextual component in a convex decomposition of the empirical model.- Its contexts are combinations of local settings from separated parties, and locality becomes the corresponding noncontextuality constraint.
Sources and further study
[1] Simon Kochen and Ernst P. Specker, The Problem of Hidden Variables in Quantum Mechanics, Journal of Mathematics and Mechanics 17, 59–87 (1967). The foundational no-go theorem for noncontextual value assignments.
[2] N. David Mermin, Hidden variables and the two theorems of John Bell, Reviews of Modern Physics 65, 803 (1993). A classic exposition including the two-qubit square contradiction.
[3] Adán Cabello, Simone Severini and Andreas Winter, Graph-Theoretic Approach to Quantum Correlations. Connects noncontextual, quantum and exclusivity bounds to graph invariants.
[4] Samson Abramsky, Rui Soares Barbosa and Shane Mansfield, The contextual fraction as a measure of contextuality. Defines contextual fraction, its linear-program computation and operational relationships to contextual inequalities and computational advantage.
[5] Robert W. Spekkens, Contextuality for preparations, transformations, and unsharp measurements. Extends noncontextuality beyond ideal sharp-measurement value assignments.
Batch 14 series navigation
- Guide 53: Quantum Optimal Control, Lie-Algebraic Controllability, GRAPE and Pulse Engineering
- Guide 54: Continuous Quantum Measurement, Stochastic Master Equations, Quantum Filtering and Feedback
- Guide 55: Quantum Error Mitigation, Zero-Noise Extrapolation, Probabilistic Error Cancellation and Symmetry Verification
- Guide 56: Quantum Contextuality, Kochen–Specker Theorem, Compatibility Graphs and Contextual Fractions
- Return to the BTT Mathematics Learning Hub
Educational note: contextuality conclusions depend on the operational equivalences, compatibility assumptions and statistical model actually implemented. Ideal algebraic contradictions should not be transferred to noisy hardware without those assumptions being tested.
