I was recently asked a question about Exercise 9.2.4(i) in Klenke's Probability theory. First I state the exercise itself.
Let $X$ be a real-valued random variable (on $(\Omega,\mathcal F,\mathbb P)$) with $|X|\leq 1$ almost surely. Then there exists a random variable $Y:\Omega\rightarrow \{-1,1\}$ such that $E[Y|X]=X$.
Now the question is regarding the following counter-example. Consider two coin tosses, which leads to the event space $$\Omega=\{HH,HT,TH,TT\},$$ and the random variable $X:\Omega\rightarrow\mathbb R$ with $$X(HH)=-0.5, \, X(HT)=X(TH)=0, \, X(TT)=0.5.$$
Using the definition of conditional expectation $E[Y|X]$ is a random variable defined w.r.t. $\sigma(X)$ and satisfies
$$ E[Y|X](TT)\, \mathbb P(\{TT\}) = \int_{\{TT\}} E[Y|X](\omega)d\mathbb P(\omega) = \int_{\{TT\}} Y (\omega) d\mathbb P(\omega) = Y(TT)\mathbb P(\{TT\}), $$
and therefore $E[Y|X]=X$ would mean that
$$0.5=X(TT)= E[Y|X](TT)=Y(TT),$$
which means that $Y$ has to have values other than $\{-1,1\}$. But this contradicts the exercise which states that $Y$ should only have values in $\{-1,1\}$.
Question: What is the issue with the argument in this counterexample.
Its possible that I missing something simple with conditional expectations. Also any hints on the original question in Klenke's book.