I've read through this question and its answers quite a few times. I'm curious to know what conditioning assumptions are used that are hidden from the derivation.
Here's what I mean: let's say I have a parameter $\theta$ and an estimator of $\theta$ given by $\widehat{\theta}$. I define the bias of $\widehat{\theta}$ by $$\text{bias}(\widehat{\theta} \mid \theta) = \mathbb{E}[\widehat{\theta} \mid \theta] - \theta\text{.}$$ Notice how in the above I am specifically indicating that $\theta$ is fixed by conditioning on it.
Additionally, one has that the mean-squared error of $\widehat{\theta}$ is given by $$\text{MSE}(\widehat{\theta} \mid \theta) = \mathbb{E}[(\widehat{\theta} - \theta)^2 \mid \theta] = \text{bias}^2(\widehat{\theta} \mid \theta) + \text{Var}(\widehat{\theta} \mid \theta)\text{.}$$
Going back to the problem at hand, suppose we have a training set $\{(\mathbf{x}_i, y_i)\}_{i=1}^{N}$ where $\mathbf{x}_i$ is a real-valued vector so that there exists a relationship $$y_i = f(\mathbf{x}_i) + \epsilon$$ so that $\mathbb{E}[\epsilon] = 0$ and $\text{Var}(\epsilon) = \sigma^2 > 0$.
Suppose we have have an estimator $\hat{f}$ of $f$, so that $\hat{f}(\mathbf{x}^{\prime}) = \hat{y}^{\prime}$ attempts to estimate $y^{\prime} = f(\mathbf{x}^{\prime}) + \epsilon$ at a new point $\mathbf{x}^{\prime}$. We aim to minimize the mean-squared error of $\hat{y}^{\prime}$, which should be given by $$\begin{align} \mathbb{E}[(\hat{y}^{\prime} - y^{\prime})^2 \mid y^{\prime}] &= \mathbb{E}[(\hat{f}(\mathbf{x}^{\prime}) - (f(\mathbf{x}^{\prime}) + \epsilon))^2 \mid y^{\prime}] \\ &= \mathbb{E}[(\hat{f}(\mathbf{x}^{\prime}) - f(\mathbf{x}^{\prime}))^2 + \epsilon^2 + 2\epsilon(\hat{f}(\mathbf{x}^{\prime}) - f(\mathbf{x}^{\prime})) \mid y^{\prime}] \\ &= \mathbb{E}[(\hat{f}(\mathbf{x}^{\prime}) - f(\mathbf{x}^{\prime}))^2 \mid y^{\prime}] + \mathbb{E}[\epsilon^2 \mid y^{\prime}] + 2 \cdot \mathbb{E}[\epsilon(\hat{f}(\mathbf{x}^{\prime}) - f(\mathbf{x}^{\prime})) \mid y^{\prime}]\text{.} \end{align}$$ Now here, I don't understand what's going on.
My understanding is that $\mathbb{E}[(\hat{f}(\mathbf{x}^{\prime}) - f(\mathbf{x}^{\prime}))^2 \mid y^{\prime}] = \text{MSE}(\hat{f}(\mathbf{x}^{\prime}) \mid f(\mathbf{x}^{\prime}))$, which decomposes into the squared bias and variance decomposition I mentioned above. But surely conditioning on $y^{\prime}$ is not the same as conditioning on $f(\mathbf{x}^{\prime})$?
Additionally, $\mathbb{E}[\epsilon^2 \mid y^{\prime}] = \text{Var}(\epsilon^2 \mid y^{\prime})$ (if we assume $\mathbb{E}[\epsilon \mid y^{\prime}] = 0$) should apparently equal $\sigma^2$. But we're told that the unconditional variance of $\epsilon$ is $\sigma^2$ - how does this apply when conditioning on $y^{\prime}$?
Additionally, $\mathbb{E}[\epsilon(\hat{f}(\mathbf{x}^{\prime}) - f(\mathbf{x}^{\prime})) \mid y^{\prime}]$ should equal $0$. The only way I can see this making sense is if conditioning on $y_i$ is equivalent to conditioning on $f(\mathbf{x}^{\prime})$, and in addition, $\epsilon$ and $\hat{f}(\mathbf{x}^{\prime})$ are conditionally independent given $f(\mathbf{x}^{\prime})$. How does this make sense?