Hernan and Robins provide a proof for the equivalency of inverse probability weights and standardization for estimating the potential outcome mean that I am struggling to follow (technical point 2.3, page 24 of the first edition, excerpts pasted below).
There are two steps that I don't understand.
(1) Why is it that we can they rewrite the first term as the second, specifically replacing the $f[A|L]$ with $f[a|l]$. And then, why is it that we can replace the indicator function in the numerator with the expected value (i.e. $(I(A=a)Y)$ with $E[Y[A=a, L=l]]$ now that they are summing over $l$)? Canceling $f(a|l)$ from the numerator and denominator I understand.
$$\begin{align*}\text{E}\left[\frac{I(A=a)Y}{f\left[A|L\right]}\right] & = \sum_{l}{\frac{1}{f[a|l]}\{\text{E}[Y|A=a,L=l]\phantom{.}f[a|l]\phantom{.}\text{Pr}[L=l]\}}\\ & = \sum_{l}\{\text{E}[Y|A=a,L=a]\phantom{.}\text{Pr}[L=l]\}\end{align*}$$
(2) In the second line of this proof, again, I don't understand the implications of $f[A|L]$ as compared to $f[a|L]$, though I understand it's made possible by conditioning on $L$. And similarly, why is it that we can "move" $Y(a)$ out of the first expectation and multiply by $E[Y(a)|L]$ because of conditional exchangeability?
$$\text{E}\left[\frac{I(A=a)}{f[A|L]}Y\right]\text{ is equal to }\text{E}\left[\frac{I(A=a)}{f[A|L]}Y^{a}\right]\text{ by consistency.}$$
$$\begin{align*}&\text{Next, because positivity implies }f[a|L]\text{ is never 0, we have}\\\\ &\text{E}\left[\frac{I(A=a)}{f[A|L]}Y^{a}\right]= \text{E}\left\{\left[\frac{I(A=a)}{f[a|L]}Y^{a}\Big{|}L\right]\right\}= \text{E}\left\{\left[\frac{I(A=a)}{f[a|L]}\Big{|}L\right]\text{E}\left[Y^{a}|L\right]\right\}\\\\ & \text{(by conditional exchangeability).}\\\\ & = \text{E}\left\{\text{E}\left[Y^{a}|L\right]\right\}\text{(because }\text{E}\left[\frac{I(A=a)}{f[a|L]}\Big{|}L\right]=1\text{)}\\ & = \text{E}\left[Y^{a}\right]\end{align*}$$
Hernan/Robins discuss $f[A|L]$ as compared to $f[a|l]$ in technical point 2.2, which helps somewhat, but, I'm not sure I understand what it means to evaluate $A$ and $L$ at random arguments as opposed to fixed arguments.
Any help with the intuition, or the mathematical properties of expectations that make these steps possible would be greatly appreciated.