Definition of simple function : in $\sum_{i=1}^n a_i\boldsymbol 1_{A_i}$ does the $A_i$'s needs to have finite measure? In my lecture and in the book Real analysis of Stein and Shakarchi, they define simple function in $(X,\mathcal X,\mu)$ as $$\varphi (x)=\sum_{i=1}^na_i\boldsymbol 1_{A_i}(x),$$
where $A_i$ are measurable with finite measure.
In wikipedia they don't require the $A_i$ to have finite measure. Is it a mistake from them or the definition of simple function doesn't require the $A_i$ to have finite measure ?
If it doesn't require to be finite, can it be a problem to define integral for simple function ? Indeed, as far as I know, you defined the integral of a simple function as $$\int \varphi =\sum_{i=1}^n a_i\mu(A_i),$$
(it can possibly be $\infty $). But how could we define the integral of $\boldsymbol 1_{[0,\infty )}-\boldsymbol 1_{(-\infty ,0)}$ ?
 A: I don't see a problem with wikipedia's definition, whereas I do see one with yours, if applied to spaces which are not $\sigma$-finite.
The correct set-up in a measure space $(X,\mathcal E,\mu)$ should be the following (which, as far as I'm concerned, is more or less taken from chapter 11 in Real Analysis by Royden):


*

*a real-valued function is simple if and only if the following equivalent conditions hold:


*

*the range of $f$ is finite and $f$ is measurable

*there are $E_1,\cdots, E_k\in\mathcal E$ and $a_1,\cdots, a_k\in\Bbb R$ such that $f=\sum_{i=1}^k a_i1_{E_i}$


*for measurable $g:X\to \Bbb R$ such that $g\ge 0$, $$\int_{X} g\,d\mu:=\sup\left\{\sum_{a\in \operatorname{range} \phi} a\mu\left(\phi^{-1}\{a\}\right)\,:\, \phi\text{ simple }\land 0\le\phi\le g\right\}$$
where implicitly $\infty+\text{nonnegative stuff}=\infty$. 

*for generic measurable $g:X\to \Bbb R$,  $$\int_X g\,d\mu:=\int_X g^+\,d\mu-\int_X g^-\,d\mu$$
whenever at least one of the terms in the RHS is finite.
You can make the intermediate step of defining $\int_X\phi\,d\mu$ for non-negative simple functions (and prove afterwards that it coincides with the other one).
Notice that taking the least upper bound over simple functions with support of possibly infinite measure is not an issue, because if there is one such funcion satisfying $0\le \phi\le g$, the by all means $\int_X g\,d\mu$ must be $\infty$.
A reason why you should consider simple functions with support of infinite measure is that, while such an assumption is irrelevant in the $\sigma$-finite case, in a more general set-up you might run into pathologies. For instance, consider the measure space $(X,\mathcal E,\mu)$, $X=\{x,y\}$, $\mathcal E=\mathscr P(X)$, $$\mu(\emptyset)=0\\ \mu\{x\}=1\\ \mu\{y\}=\infty\\ \mu(X)=\infty$$
Then, what's $\int_X1\,d\mu$? By my definition, it's indeed $\infty$, because $0\le\phi=1_X\le1$. However, if you include in the $\sup$ just the $\phi$-s that can be written as $\sum_{i=1}^k a_i1_{E_i}$ for positive $a_i$ and $E_i$-s of finite measure, then $\int_X1\,d\mu=1\ne \mu(X)$ !
