Front-door adjustment formula: difficulty in reconcile the two formula In The Book Of Why, the author gives two formulas related to the front-door adjustment formula.
On page 227 (formula 7.1), the front-door adjustment is given by
$$P(Y|do(X)) = \sum_zP(Z=z|X)\sum_xP(Y|X=x,Z=z)P(X=x)$$
On page 236 (figure 7.4), the front-door adjustment is given by
$$P(c|do(s)) = \sum_{s'}\sum_tP(c|t,s')P(s')P(t|s)$$
Or, after aligning the notation
$$P(Y|do(X)) = \sum_{X'}\sum_ZP(Y|z,x')P(x')P(z|x)$$
I have read this question, and understand that the final formula can be expressed as:
$$P(Y|do(X)) = \sum_Z\sum_{X'}P(z|x)P(Y|z,x')P(x')$$
which is the same as formula 7.1.
But I am not sure why $x$ becomes $x'$ in the last formula?
and secondly since $\sum_{X'}\sum_ZP(Y|z,x')P(x')P(z|x)$ is actually a multiplication inside, can I write it as $\sum_Z\sum_{X'}P(Y|z,x')P(x')P(z|x)$?

Question 1: Why does $x$ becomes $x'$ in the last formula?
Answer: $x$ does not "become" $x'$ in the last formula. $x'$ is a variable of summation, and hence a "dummy" variable. It has no scope outside the summation. You could just as easily write
$$P(Y|\operatorname{do}(X)) = \sum_Z\sum_{X}P(z|x)P(Y|z,\xi)P(\xi).$$
On the other hand, the $x$ shows up on both sides of the equation, and definitely has scope inside and outside the summation. So the $x$ is a particular value of the random variable $X,$ whereas the $x'$ is a dummy variable that ranges over all the possible values of $X.$ Here's what I would regard as the clearest way to write the equation:
$$P(Y=y|\operatorname{do}(X=x)) = \sum_{Z=z}\sum_{X=x'}P(Z=z|X=x)P(Y=y|Z=z,X=x')P(X=x').$$
This is clunkier, I admit.
Question 2: ... since $\sum_{X'}\sum_ZP(Y|z,x')P(x')P(z|x)$ is actually a multiplication inside, can I write it as $\sum_Z\sum_{X'}P(Y|z,x')P(x')P(z|x)$?
Answer: Yes, absolutely. In finite summations, you can always reverse the order of summation - a direct result of the commutativity of addition. In many integral settings you can also reverse the order of integration, though there are some situations in which you can't. Fubini's theorem provides sufficient conditions for reversing the order of integration.
