Any attempt to construct a realist interpretation of quantum theory founders on the Kochen–Specker theorem, which asserts the impossibility of assigning values to quantum quantities in a way that preserves functional relations between them. We construct a new type of valuation which is defined on all operators, and which respects an appropriate version of the functional composition principle. The truth-values assigned to propositions are (i) contextual and (ii) multivalued, where the space of contexts and the multivalued logic for each context come naturally from the topos theory of presheaves. The first step in our theory is to demonstrate that the Kochen–Specker theorem is equivalent to the statement that a certain presheaf defined on the category of self-adjoint operators has no global elements. We then show how the use of ideas drawn from the theory of presheaves leads to the definition of a generalized valuation in quantum theory whose values are sieves of operators. In particular, we show how each quantum state leads to such a generalized valuation. A key ingredient throughout is the idea that, in a situation where no normal truth-value can be given to a proposition asserting that the value of a physical quantity A lies in a subset Δ ⊆ ℝ, it is nevertheless possible to ascribe a partial truth-value which is determined by the set of all coarse-grained propositions that assert that some function ƒ(A) lies in ƒ(Δ), and that are true in a normal sense. The set of all such coarse-grainings forms a sieve on the category of self-adjoint operators, and is hence fundamentally related to the theory of presheaves.