Im studying analisis on my own, actually reading the third edition of "Real and complex analisis" by Walter Rudin. Im stuck on this theorem.
Suppose that $f: X\to [0,\infty]$ is measurable, and $$\tag{1}\varphi(E)=\int_E fd\mu \ \ \ \ \ (E\ \text{measurable set)}$$ Then $\varphi$ is a measure and $$\tag{2}\int_X gd\varphi=\int_X fgd\mu$$ for all measurable $g:X\to [0,\infty]$
If (2) holds for every simple and measurable functions then i understand why the general case is true. Take an $\{s_n\}$ of simple and measurable functions such that $0\leq s_n \leq g$ and $s_n \to g$, then
$$\int_X gd\varphi=\lim_{n \to \infty}\int_X s_nd\varphi = \lim_{n \to \infty} \int_Xs_nfd\mu$$
Given that $f\geq 0$, then $s_nf\leq gf$ and $s_nf \to gf$, hence
$$\lim_{n \to \infty} \int_Xs_nfd\mu = \int_Xgfd\mu$$
Tho, i cannot actually see why if $g=\chi_E$ then (1) shows that (2) holds, neither why this implies that (2) holds for every simple.
This my attempt: For $g$ measurable, take $\{t_n\}$ a family of simple and measurable functions such that $0\leq t_n =\sum_{i=1}^m \alpha_i^n\chi_{A_i^n}\leq g$ and $t_n \to g$. By definition, $$\int_Xgd\phi=\text{sup}\int_X t_nd\varphi = \text{sup}\sum_{i}\alpha_i^n\varphi(A_i^n)=\text{sup}\sum_{i}\alpha_i^n\int_{A_i^n}fd\mu=\text{sup}\sum_{i}\alpha_i^n\int_X \chi_{A_i^n}fd\mu$$ $$\tag{3}=\text{sup}\int_X\sum_{i}\alpha_i^n\chi_{A_i^n}fd\mu =\text{sup}\int_X t_nfd\mu = \int_X gfd\mu$$
Notice that i dont use the process suggested by Rudin and makes me wonder whether this even true. If it is true, can someone show me the proof suggested by Rudin. And if it is not true, please, point out where im mistaken.
Also, i have problem with understanding how actually u work with $\text{sup}\int_Xt_nd\mu=\underset{n\geq 1}{sup}\sum_{i=1}^{m(n)}\alpha_i^n\mu(A_i^n)$ and even if i wrote this correctly. Any clarification on that its well received.

Let $E \subseteq X$ be measurable. Then $$\int_X \chi_E\,\mathrm{d}\varphi = \int_E\mathrm{d}\varphi = \varphi(E) = \int_Ef\,\mathrm{d}\mu = \int_X\chi_Ef\,\mathrm{d}\mu.$$
That is, $$\int_X g \,\mathrm{d}\varphi = \int_X fg\,\mathrm{d}\mu$$ holds for any $g \in \{\chi_E : E\subseteq X \text{ is measurable}\}.$ From there, showing it's true for every simple $g$ is just by linearity of the integrals.
That is, you let $g = \sum_{k=1}^n c_k\chi_{E_k}$ where each $c_k \geq 0$ and each $E_k$ is measurable to find $$\begin{align*} \int_X g\,\mathrm{d}\varphi &= \int_X\sum_{k=1}^nc_k\chi_{E_k}\,\mathrm{d}\varphi \\ &= \sum_{k=1}^n c_k\int_X\chi_{E_k}\,\mathrm{d}\varphi \\ &= \sum_{k=1}^nc_k \int_X\chi_{E_k}f\,\mathrm{d}\mu \\ &= \int_X\sum_{k=1}^nc_k\chi_{E_k}f\,\mathrm{d}\mu \\ &= \int_Xfg\,\mathrm{d}\mu \end{align*}$$