That only works in models whose predictions are computed by functions that are defined on some state space. This is exactly not the case in QM.
Assume we have a model whose predictions are computed by functions ##O_\xi :\Lambda\rightarrow\mathbb R##. Then we can add these functions and multiply them as follows: ##(O_\xi + O_\zeta)(\lambda) := O_\xi(\lambda) + O_\zeta(\lambda)## and ##(O_\xi O_\zeta)(\lambda) := O_\xi(\lambda) O_\zeta(\lambda)##
Given some element ##\lambda\in\Lambda##, we can define define the evaluation map ##v_\lambda## that takes a function ##O_\xi## and evaluates it at ##\lambda##: ##v_\lambda(O_\xi) := O_\xi(\lambda)##
It is now easy to prove that ##v_\lambda(O_\xi + O_\zeta) = v_\lambda(O_\xi) + v_\lambda(O_\zeta)## and ##v_\lambda(O_\xi O_\zeta) = v_\lambda(O_\xi) v_\lambda(O_\zeta)##. We take these identities as the definining identities for an evaluation map.
In quantum mechanics, observables aren't functions ##O_\xi : \Lambda\rightarrow\mathbb R##, but rather operators ##\hat O_\xi## that are defined on a Hilbert space. We can now ask ourselves whether this is just an artifact of the formulation. It turns out that it is impossible to reformulate the theory in the previous language. If it were possible to map the operators ##\hat O_\xi## to ordinary functions ##O_\xi## on some state space ##\Lambda##, then there would be evaluation maps ##v## such that at least for commuting ##\hat O_\xi##, the defining identities of such evaluation maps would be satisfied, i.e. for commuting ##\hat O_\xi##, ##\hat O_\zeta##, we would have ##v(\hat O_\xi + \hat O_\zeta) = v(\hat O_\xi) + v(\hat O_\zeta)## and ##v(\hat O_\xi \hat O_\zeta) = v(\hat O_\xi) v(\hat O_\zeta)##. The Kochen-Specker theorem tells us that no such evaluation map ##v## exists. However, if the ##\hat O_\xi## could be mapped to ordinary functions on some state space ##\Lambda##, there would be plenty of these evaluation maps: One for every ##\lambda\in\Lambda##. Thus, not all quantum mechanical observables ##\hat O_\xi## can be represented as ordinary functions ##O_\xi:\Lambda\rightarrow \mathbb R## on some state space ##\Lambda##. Hence, QM violates counterfactual definiteness.
The simplest example of this is the
GHZ state. See also http://www.phy.pku.edu.cn/~qiongyihe/content/download/3-2.pdf.