Artificial intelligent assistant

Interchanging the order of a double infinite sum I'm stuck at a proof of Wald's first equation about interchanging the order of a double infinite sum: > Suppose $X_n \ge 0$ and $1_{\\{\cdot \\}}$ be indicator function. $$ \sum_{n=1}^\infty \sum_{m=1}^n EX_m 1_{\\{N=n\\}} = \text{why?} = \sum_{m=1}^\infty \sum_{n=m}^\infty EX_m 1_{\\{N=n\\}} $$ I know that Fubini's theorem works here, since $X_n \ge 0$, but I don't see how to interchange the summation order with assigning proper indexes. I consulted two books + wiki, but still don't get a satisfactory answer, they just simply said that we can rearrange the sum in this way. Is there a simple rule for such situations that I can follow?

Note that $$\sum_{k\geqslant 1}\sum_{n\leqslant k}=\sum_{k\geqslant 1}\sum_{n\geqslant 1}[n\leqslant k]=\sum_{n\geqslant 1}\sum_{k\geqslant 1}[n\leqslant k]=\sum_{n\geqslant 1}\sum_{k\geqslant 1}[k\geqslant n]=\sum_{n\geqslant 1}\sum_{k\geqslant n}$$

This is an example of the usefulness of the Iverson bracket.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy ff46a26874ce21327e2d854d87291876