Solution
= Solution
Conditionally on $X_1^n=x_1^n$, the <uniform distribution>[uniform] index $J$ selects the symbol $a$ with probability $\widehat P_{x_1^n}(a)$. The <law of total probability> therefore gives
$$
\overline P(a)
=\mathbb P(X_J=a)
=\sum_{x_1^n\in B}P_n(x_1^n)\widehat P_{x_1^n}(a)
=\sum_{x_1^n\in B}\frac{Q^n(x_1^n)}{Q^n(B)}\widehat P_{x_1^n}(a).
$$
Thus $\overline P$ is the conditional mean type of a string in $B$.