Prove that definition of simple expectation is well-defined 
If X only takes finitely many values $x_1,\cdots,x_n$, and $A_i=\{\omega:X(\omega)=x_i\}$, define the simple expectation of $X$ by $$\mathbb E\: X=\sum_{i=1}^n x_i\mathbb P(A_i)$$ 
Prove that definition is well-defined. That is, if $\{A_i\}$ and $\{B_j\}$ are partition of $\Omega$ with $\sum_{i=1}^nx_i\unicode{x1D7D9}_{A_i}=\sum_{i=1}^ny_i\unicode{x1D7D9}_{B_i}$, then $\sum_{i=1}^nx_i\mathbb P(A_i)=\sum_{i=1}^ny_i\mathbb P(B_i)$

let $\{x_n\}$ the values taken by $X$.
If I define $S_N:=\sum_{n=1}^Nx_n\mathbb P(X=x_n)$ then maybe $S_N\leq X$ (Actually I don't know why should be $S_N\leq X$, I just assume it and then get it right. It will be helped if anyone answer why that's true?).
Then $\sum_{n=1}^Nx_nP(X=x_n)\leq\mathbb E[X]$ for all $N$. How can we apply monotone convergence theorem to get the other direction?
Is it prove the definition is well defined. I didn't get how the second statement justify the prove.
 A: Let $(S,\mathcal{E},\mu)$ denote a measure space. For any $A \in \mathcal{E}$, we have that
$$
\int \unicode{x1D7D9}_A \ d\mu = \mu(A).
$$
In addition, the Lebesgue integral is linear i.e. for measurable functions $f,g$ and $\alpha \in \mathbb{R}$
$$
\int\alpha f+g \ d\mu = \alpha \int f \ d\mu+ \int g \ d\mu.
$$
Finally if $f=g$ $\mu$-almost everywhere, then
$$
\int f \ d \mu=\int g \ d \mu.
$$
In particular we can use these properties on say a measure space (or more precisely a probability space) $(\Omega, \mathcal{F},\mathbb{P})$.
If we assume $\sum_{i=1}^nx_i\unicode{x1D7D9}_{A_i}=\sum_{i=1}^ny_i\unicode{x1D7D9}_{B_i}$ then
$$
\sum_{i=1}^nx_i\mathbb P(A_i) = \sum_{i=1}^n x_i \int \unicode{x1D7D9}_{A_i} \ d\mathbb{P} = \int \sum_{i=1}^n x_i \unicode{x1D7D9}_{A_i} \ d\mathbb{P} = \int \sum_{i=1}^n y_i \unicode{x1D7D9}_{B_i} \ d\mathbb{P} = \sum_{i=1}^n y_i \int \unicode{x1D7D9}_{B_i} \ d\mathbb{P} = \sum_{i=1}^ny_i\mathbb P(B_i)
$$
using the above properties and we thus obtain the desired.
