Contextuality has become a cornerstone of modern foundational approaches to quantum physics. This paper introduces contextual mathematics (CM), a categorical framework for context-indexed observations and agent-dependent evaluation. Contexts are organized into a category Ctx, and observation is modeled as a contravariant bifunctor into an epistemic category E; context refinements induce restriction maps, and a Grothendieck construction organizes evaluations over agent–context pairs. We show how the established sheaf-theoretic account of Kochen–Specker contextuality (Abramsky–Brandenburger) can be represented inside this framework, recovering non-existence of a global section as the relevant obstruction. We then formulate, as comparison problems rather than established equivalences, several further candidate obstruction theories that a fully developed CM might connect to this sheaf-theoretic core: homological extension classes (Ext1 ), Kan-extension reconstruction, deformation-quantization cocycles, and device-dependent restriction in algebraic quantum field theory (AQFT) over globally hyperbolic spacetimes. We are explicit about which of these connections are proved, which are illustrative analogies, and which remain open.
Contextuality has become a cornerstone of modern foundational approaches to quantum physics. This paper introduces contextual mathematics (CM), a categorical framework for context-indexed observations and agent-dependent evaluation. Contexts are organized into a category Ctx, and observation is modeled as a contravariant bifunctor into an epistemic category E; context refinements induce restriction maps, and a Grothendieck construction organizes evaluations over agent–context pairs. We show how the established sheaf-theoretic account of Kochen–Specker contextuality (Abramsky–Brandenburger) can be represented inside this framework, recovering non-existence of a global section as the relevant obstruction. We then formulate, as comparison problems rather than established equivalences, several further candidate obstruction theories that a fully developed CM might connect to this sheaf-theoretic core: homological extension classes (Ext1 ), Kan-extension reconstruction, deformation-quantization cocycles, and device-dependent restriction in algebraic quantum field theory (AQFT) over globally hyperbolic spacetimes. We are explicit about which of these connections are proved, which are illustrative analogies, and which remain open.
Contextuality is a key distinguishing feature between classical and quantum physics. It expresses a fundamental obstruction to describing quantum theory using classical concepts. In turn, understood as a resource for quantum computation, it is expected to hold the key to quantum advantage. Yet, despite its long recognised importance in quantum foundations and, more recently, in quantum computation, the structural essence of contextuality has remained somewhat elusive - different frameworks address different aspects of the phenomenon, yet their precise relationship often remains unclear. This issue already looms large at the level of the Bell-Kochen-Specker theorem: while traditional proofs proceed by showing the nonexistence of valuations, the notion of state-independent contextuality in the marginal approach allows to prove contextuality from seemingly weaker assumptions. In the light of this, and at the absence of a unified mathematical framework for Kochen-Specker contextuality, the original algebraic approach has been widely abandoned, in favour of the study of contextual correlations. Here, we reinstate the algebraic perspective on contextuality. Concretely, by building on the novel concept of context connections, we reformulate the algebraic relations between observables originally postulated by Kochen and Specker, and we explicitly demonstrate their consistency with the notion of state-independent contextuality. In the present paper, we focus on the new conceptual ideas and discuss them in the concrete setting of spin-1 observables, specifically those in the example of [S. Yu and C.H. Oh, Phys. Rev. Lett., 108, 030402 (2012)]; in a companion paper, we generalise these ideas, obtain a complete characterisation of Kochen-Specker contextuality and provide a detailed comparison with the related notions of contextuality in the marginal and graph-theoretic approach.
Recent work by Abramsky and Brandenburger used sheaf theory to give a mathematical formulation of non-locality and contextuality. By adopting this viewpoint, it has been possible to define cohomological obstructions to the existence of global sections. In the present work, we illustrate new insights into different aspects of this theory. We shed light on the power of detection of the cohomological obstruction by showing that it is not a complete invariant for strong contextuality even under symmetry and connectedness restrictions on the measurement cover, disproving a previous conjecture. We generalise obstructions to higher cohomology groups and show that they give rise to a refinement of the notion of cohomological contextuality: different "levels" of contextuality are organised in a hierarchy of logical implications. Finally, we present an alternative description of the first cohomology group in terms of torsors, resulting in a new interpretation of the cohomological obstructions.
In a previous paper with Adam Brandenburger, we used sheaf theory to analyze the structure of non-locality and contextuality. Moreover, on the basis of this formulation, we showed that the phenomena of non-locality and contextuality can be characterized precisely in terms of obstructions to the existence of global sections. Our aim in the present work is to build on these results, and to use the powerful tools of sheaf cohomology to study the structure of non-locality and contextuality. We use the Cech cohomology on an abelian presheaf derived from the support of a probabilistic model, viewed as a compatible family of distributions, in order to define a cohomological obstruction for the family as a certain cohomology class. This class vanishes if the family has a global section. Thus the non-vanishing of the obstruction provides a sufficient (but not necessary) condition for the model to be contextual. We show that for a number of salient examples, including PR boxes, GHZ states, the Peres-Mermin magic square, and the 18-vector configuration due to Cabello et al. giving a proof of the Kochen-Specker theorem in four dimensions, the obstruction does not vanish, thus yielding cohomological witnesses for contextuality.
Life of Research AbstractThis paper introduces a novel theoretical framework for understanding semantic processing in Large LanguageModels through the lens of sheaf theory and quantum contextuality. We propose that the semantic structure ofLLM-generated text can be rigorously modeled as a sheaf over the topological space of prompt contexts, wherelocal semantic sections may fail to glue into globally consistent interpretations. This mathematical formalizationreveals a deep structural parallel between LLM behavior and quantum mechanical systems exhibitingcontextuality, as characterized by the Kochen-Specker theorem. Our central thesis posits that hallucinationphenomena in LLMs arise fundamentally from cohomological obstructions to the existence of global semanticsections, analogous to how quantum systems exhibit measurement outcomes that cannot be explained by preexisting hidden variables. We develop a complete categorical framework using topos-theoretic methods, introduceformal definitions of semantic presheaves and their associated Grothendieck topologies, and demonstrate howCech cohomology groups can quantify the degree of semantic inconsistency in model outputs. This work bridgesabstract mathematics with practical AI interpretability, offering new diagnostic tools for understanding when andwhy language models produce incoherent or factually inconsistent outputs.
Contextuality is a key feature of quantum mechanics that provides an important non-classical resource for quantum information and computation. Abramsky and Brandenburger used sheaf theory to give a general treatment of contextuality in quantum theory [New Journal of Physics 13 (2011) 113036]. However, contextual phenomena are found in other fields as well, for example database theory. In this paper, we shall develop this unified view of contextuality. We provide two main contributions: firstly, we expose a remarkable connection between contexuality and logical paradoxes; secondly, we show that an important class of contextuality arguments has a topological origin. More specifically, we show that "All-vs-Nothing" proofs of contextuality are witnessed by cohomological obstructions.
Contextuality is a key distinguishing feature between classical and quantum physics. It expresses a fundamental obstruction to describing quantum theory using classical concepts. In turn, when understood as a resource for quantum computation, it is expected to hold the key to quantum advantage. Yet, despite its long recognised importance in quantum foundations and, more recently, in quantum computation, the mathematics of contextuality has remained somewhat elusive - different frameworks address different aspects of the phenomenon, yet their precise relationship often is unclear. In fact, there is a glaring discrepancy already between the original notion of contextuality introduced by Kochen and Specker on the one side [J. Math. Mech., 17, 59, (1967)], and the modern approach of studying contextual correlations on the other [Rev. Mod. Phys., 94, 045007 (2022)]. In a companion paper [arXiv:2408.16764], we introduce the conceptually new tool called ``context connections'', which allows to cast and analyse Kochen-Specker (KS) contextuality in new form. Here, we generalise this notion, and based on it prove a complete characterisation of KS contextuality for finite-dimensional systems. To this end, we develop the framework of ``observable algebras". We show in detail how this framework subsumes the marginal and graph-theoretic approaches to contextuality, and thus that it offers a unified perspective on KS contextuality. In particular, we establish the precise relationships between the various notions of ``contextuality" used in the respective settings, and in doing so, generalise a number of results on the characterisation of the respective notions in the literature.