Riemann Integrability of Indicator Functions and Denseness For Lebesgue integrability, for all subsets $A$ of $[0,1]$, the indicator function $1_A$ is Lebesgue integrable iff $A$ is measurable.
Is there any similar characterization of Riemann integrability for indicator functions in terms of denseness? For example, it is well-known that:


*

*if $A\subseteq[0,1]$ and $[0,1]\setminus A$ are both dense in $[0,1]$, then $1_A$ is not integrable;

*$1_A$ is Riemann integrable iff it is continuous almost everywhere.


I initially guessed that for all subsets $A$ of $[0,1]$, the indicator function $1_A$ is not Riemann integrable iff $A$ and $[0,1]\setminus A$ are both dense in $[0,1]$, but that's not true -- just take something like $A=\mathbb{Q}\cap[1/4,3/4]$, and then there are no elements of $A$ in the interval $(0,1/4)$, so $A$ isn't dense in $[0,1]$. My conjecture now is that function $1_A$ is not Riemann integrable iff $\exists\varnothing\neq B\subseteq[0,1]$ s.t. $A$ and $B\setminus A$ are both dense in $B$.
 A: Perhaps the result you are looking for is this:
$$1_A \text{ is integrable} \iff \partial A \text{ has measure zero}$$
This criterion follows from your second statement, the so-called Lebesgue criterion for Riemann integrability. Namely, the set of discontinuities of $1_A$ is precisely the boundary of $A$, so $1_A$ is almost everywhere continuous if and only if $\partial A$ has measure zero.
Your first statement is then a direct consequence. Assume that $A$ and $[0,1] \setminus A$ are both dense in $[0,1]$.
Then:
$$\partial A = \overline{A} \cap \overline{[0,1]\setminus A} = [0,1] \cap [0,1] = [0,1]$$
$[0,1]$ certainly doesn't have measure zero so $1_A$ is not integrable.
It is also clear that denseness of $A$ and $[0,1] \setminus A$ is not necessary for integrability because $\partial A$ does not have to be equal to $[0,1]$, it just has to be sufficiently large.
You took $A = \mathbb{Q} \cap \left[\frac14, \frac34\right]$.
We have:
\begin{align}
\partial A &= \overline{A} \cap \overline{[0,1]\setminus A} \\
&= \overline{\mathbb{Q} \cap \left[\frac14, \frac34\right]} \cap \overline{\left(\left[\frac14, \frac34\right] \setminus \mathbb{Q}\right)\cup \left[0, \frac14\right\rangle \cup \left\langle\frac34, 1\right]} \\
&= \left[\frac14, \frac34\right]\cap [0,1] \\
&= \left[\frac14, \frac34\right]
\end{align}
This has measure $\frac12$ so $1_A$ is integrable even though $A$ is not dense in $[0,1]$.
So, regarding your conjecture, you can conclude that $1_A$ is not integrable if and only if there exists $B \subseteq [0,1]$ of positive measure such that $A$ and $[0,1] \setminus A$ are both dense in $B$. Namely, take $B = \partial A$.
