Let $f:[a,b]\to R$ be a bounded function such that $D:=$ the subset of $[a,b]$ such that $f$ is not continuous at any point of $D$. $f$ is Riemann integrable iff $\lambda (D)=0$.
Proof: For $n\in \mathbb N$, let $P_n$ be the partition that divides $[a,b]$ in $2^n$ equal subintervals $I_j, j=1,2,...,2^n$. Define $g_n=\sum_{i=1}^{2^n}\inf f(I_i) \chi_{I_i}, h_n=\sum_{i=1}^{2^n}\sup f(I_i) \chi_{I_i}$.
$g_n$'s are increasing, $h_n$'s are decreasing. Define $f^U:= \lim_n h_n, f^L:= \lim_n g_n$. Lower Riemann sum $L(f, P_n)=\int_{[a,b]} g_nd\lambda$. Similarly, $U(f,P_n)=\int_{[a,b]} h_n d\lambda.$
Lower Riemann integral then is given by $L(f)=\lim_n L(f, P_n)=\int_{[a,b]}f^Ld\lambda$ by Dominated convergence theorem. Similarly, $ U(f)=\int_{[a,b]} f^Ud\lambda.$
$f$ is Riemann integrable iff $U(f)=L(f)\iff \int_{[a,b]}f^U- f^L d\lambda=0\iff f^U-f^L=0$ almost everywhere.
Noting that $\{x\in [a,b]: f^L(x)\ne f^U(x)\}=\{x\in [a,b]: f$ is not continuous at $x\}$, the result follows.
I don't understand why this last step is true. Can anyone please explain that to me? Thanks.
The following should work but I got stuck:
Let $x_n\to x$ be any sequence converging to $x\in [a,b]$ such that $x_n\in [a,b], f^L(x)\ne f^U(x)$.
We have $f^L(x_n)\le f(x_n)\le f^U(x_n)$ for all $n\in \mathbb N$.
I'm not sure how to go from here.
Edit: Page no. 94 here. It seems that the converse need not be true: changes at finitely many points in $g_n, h_n$ definition are required to make the converse true. Else both the sets differ by at most countably many points. I had erroneously overlooked this part and requested proof of the equality. But it doesn't have to be an equality. Thanks a lot for your time.
Given $x$ and $n$, we can consider the definition of $g_n$. In particular, there is some $x_n$ in the same subinterval as $x$ such that $|f(x_n) - g_n(x_n)| < \frac1n$. Since $x_n, x$ are in the same subinterval, we have $|x_n - x| \leq \frac{b-a}{2^n}$, and since $g_n$ is constant on each subinterval, we have $g_n(x_n) = g_n(x)$ and therefore $|f(x_n) - g_n(x)| < \frac1n$.
Doing this for every $n$ gives us a sequence $x_n$ such that $x_n \to x$ and $$\lim_{n\to\infty} f(x_n) = \lim_{n\to\infty} g_n(x) = f^L(x)$$
Doing similarly with the $h_n$, we can also show there is some $y_n \to x$ such that $f(y_n) \to f^U(x)$.
If $f$ were continuous, then by uniqueness of the limit, we could conclude $f^U(x)=f^L(x)$.