This is from the book Fundamentals of Probability with Stochastic Processes by Saeed Ghahramani, pages 249-250 which asserts, for any random variable $X$ that is non-negative, expectation of $X$ is
$$ E(X)= \int_{0}^{\infty} [1-F(t)]dt= \int_{0}^{\infty} P(X>t) dt $$
Where $F(t)$ is a cumulative distribution function. Somehow this is equal to $\int_{0}^{\infty}x. P(X=x)dx$ and I don't see it.Though the proof is provided in the book, I find it lacking and wasn't completely satisfied with it.
I would like to see a proof of the discrete analog of the above expression
$$ E(X) = \sum_{x=0}^{\infty}x. P(X=x)= \sum_{x=0}^{\infty} [1- F(x)] = \sum_{x=0}^{\infty} \sum_{y=0}^{x} P(Y=y) $$
This is a very basic probability question.