Here is the formula of CVA in page 74 in book Modern Derivatives Pricing and Credit Exposure Analysis
.
Here $t_0 = t<t_1<\cdots<t_n = T;$ $\tau$ is the default; $X(t)$ is any value.
I don't much understand how we get the second equation: $$E^Q[\mathbb{1}_{\tau>t_i}X(t_{i-1})|\mathcal{F}_t] = E^Q\Big[E^Q[\mathbb{1}_{\tau>t_i}]X(t_{i-1})|\mathcal{F}_t\Big]$$ It hints that
This is possible for the expectations containing $X(t_i)$ and $X(t_{i−1})$ since these are both $\mathcal{F}(t_i)$-measurable; apply the tower law of conditional expectations.
Does that mean $$E^Q[\mathbb{1}_{\tau>t_i}X(t_{i-1})|\mathcal{F}_t] = E^Q\Big[E^Q[\mathbb{1}_{\tau>t_i}X(t_{i-1})|\mathcal{F}_{t_{i-1}}]|\mathcal{F}_t\Big]=E^Q\Big[E^Q[\mathbb{1}_{\tau>t_i}|\mathcal{F}_{t_{i-1}}]X(t_{i-1})|\mathcal{F}_t\Big].$$
But how to convert $E^Q[\mathbb{1}_{\tau>t_i}|\mathcal{F}_{t_{i-1}}]$ to $E^Q[\mathbb{1}_{\tau>t_i}]?$