Is my proof of equation 0.6 in the book "Reinforcement Learning: Theory and Algorithms" correct?
The expectation of a sum is equal to the sum of the expectation this just follows from the linearity property of expectations
$$ \begin{aligned} E[\sum_{t} f(s_t,a_t)] &amp;= \sum_{\tau} p(\tau)\left(\sum_t f(s_t,a_t)\right)
 \\ &amp;= \sum_\tau\sum_{t}p(\tau)f(s_t,a_t) 
 \\ &amp;= \sum_t\sum_\tau p(\tau)f(s_{t,\tau},a_{t,\tau}) 
 \\ &amp;= \sum_tE[f(s_t,a_t)]
\end{aligned} $$
note that in the penultimate line I swapped the sums around which can be understood as looking at all trajectories for a single time-step instead of looking at time-steps within  a single trajectory (the second expression). I append subscript for variables in the penultimate line for clarity since they also depend on which trajectory they were drawn from.

As mentioned by nboro in the comments, the linearity of property only holds for infinite sums if
$$\sum_{i=0}^\infty E[|X|]&lt; \infty  \quad or \quad E\left[\sum_{i=0}^{\infty}|X|\right]. &lt;\infty$$
More details can be found here. Using this theory alongside knowledge that since we know that value functions in RL are always bounded (in continuing tasks discounting factors are introduced) then we can say there exists an $M$ such that
$$ |f(s_{t,\tau},a_{t,\tau})| \leq M \qquad \forall t,\tau $$
Then
$$ \begin{aligned}\sum_t\sum_\tau \lambda^t p(\tau)|f(s_{t,\tau},a_{t,\tau})| &amp;\leq \sum_t\sum_\tau \lambda^t p(\tau)M 
\\ &amp;=M\sum_t\lambda^t\sum p(\tau)
\\ &amp;=M\sum\lambda^t
\\ &amp;&lt; \infty
\end{aligned}$$
As for the rest of the proof is there anything else you need clarity on? it looks good to me. From that step to the next step where you change distribution from $p(\tau)$ to $p(s,a)$ is just because of marginalisation but I think you got that.