8. Given a non-empty set $M$ satisfying
$$
M \subseteq\{0,1, \cdots, n\}\left(n \geqslant 2, n \in \mathbf{Z}_{+}\right) \text {. }
$$

If there exists a non-negative integer $k(k \leqslant n)$, such that for any $a \in M$, we have $2 k-a \in M$, then the set $M$ is said to have property $P$. Let the number of sets $M$ with property $P$ be $f(n)$. Then the value of $f(9)-f(8)$ is $\qquad$
8. 31 .
$$
\begin{array}{l}
\text { When } n=2 \text {, } \\
M=\{0\},\{1\},\{2\},\{0,2\},\{0,1,2\}
\end{array}
$$

have property $P$, and the corresponding $k$ values are $0, 1, 2, 1, 1$. Thus, $f(2)=5$.

When $n=k$, the number of sets $M$ with property $P$ is $f(t)$. Then, when $n=k+1$, we have
$$
f(t+1)=f(t)+g(t+1),
$$

where $g(t+1)$ represents the number of sets $M$ that have property $P$ and include $t+1$.
Next, we calculate the expression for $g(t+1)$ in terms of $t$.
At this point, $2 k \geqslant t+1$, i.e., $k \geqslant \frac{t+1}{2}$, so we discuss $n=t$ in odd and even cases.
(1) When $t$ is even, $t+1$ is odd, at this time,
$$
k \geqslant \frac{t+2}{2} \text {. }
$$

Thus, for each $k$, $t+1$ and $2 k-t-1$ must belong to the set $M$, and $t$ and $2 k-t \cdots \cdots k$ and $k$ have $t+1-k$ pairs of numbers, each pair of numbers must either both belong to or not belong to the set $M$. Therefore, for each $k$, the number of sets $M$ with property $P$ is
$$
\mathrm{C}_{t+1-k}^{0}+\mathrm{C}_{t+1-k}^{1}+\cdots+\mathrm{C}_{t+1-k}^{t+1-k}=2^{t+1-k} .
$$

Then $g(t+1)=2^{\frac{1}{2}}+2^{\frac{t-2}{2}}+\cdots+2+1$
$$
=2 \times 2^{\frac{1}{2}}-1 \text {. }
$$
(2) When $t$ is odd, $t+1$ is even, at this time,
$$
k \geqslant \frac{t+1}{2} \text {. }
$$

Similarly,
$$
\begin{array}{l}
g(t+1)=2^{\frac{t+1}{2}}+2^{\frac{t-1}{2}}+\cdots+2+1 \\
=2 \sqrt{2} \times 2^{\frac{t}{2}}-1 .
\end{array}
$$

Thus $f(t+1)=\left\{\begin{array}{cc}f(t)+2 \times 2^{\frac{1}{2}}-1, & t \text { is even; } \\ f(t)+2 \sqrt{2} \times 2^{\frac{1}{2}}-1, & t \text { is odd. }\end{array}\right.$ By the summation method, we get
$$
f(n)=\left\{\begin{array}{ll}
6 \times 2^{\frac{n}{2}}-n-5, & n \text { is even; } \\
4 \times 2^{\frac{n+1}{2}}-n-5, & n \text { is odd. }
\end{array}\right.
$$

Thus $f(9)-f(8)$
$$
=4 \times 2^{5}-9-5-\left(6 \times 2^{4}-8-5\right)=31 \text {. }
$$