For what sets does the Lebesgue Differentiation Theorem hold in one dimension? Lebesgue's differentiation theorem states that if $x$ is a point in $\mathbb{R}^n$ and $f:\mathbb{R}^n\rightarrow\mathbb{R}$ is a Lebesgue integrable function, then the limit of $\frac{\int_B f d\lambda}{\lambda(B)}$ over all balls $B$ centered at $x$ as the diameter of $B$ goes to $0$ is equal almost everywhere to $f(x)$.  But if you replace balls with other kinds of set with diameter going to $0$, this need not be true.  For instance it need not be true if you replace balls with rectangles.
But my question is, what is known about what collections of sets the Lebesgue Differentiation Theorem holds for in one dimension?  We know it holds for bounded intervals.  Does it hold for finite unions of bounded open intervals?  What about bounded Borel sets?  What about bounded Lebesgue measurable sets in general?
Or are all these open problems?
 A: Perhaps Doob's martingale convergence theorem can help. Suppose that $\newcommand{\bR}{\mathbb{R}}$ $C\subset \bR^n$ is a  cube and $f\in L^1 (C)$. Suppose that $\newcommand{\eP}{\mathscr{P}}$
$$
\eP_1\prec \eP_2\prec \cdots
$$
is a sequence  of finite partitions of $C$  into Borel subsets such   that for any $B\in\eP_{i+1}$ there exists $B'\in \eP_i$, $B'\supset B$. Assume  that the $\sigma$-algebra generated by
$$
\bigcup_{i\geq 1}\eP_i
$$
coincides  with the Borel $\sigma$-algebra of $C$.   For example this happens   if for any open subset  $U\subset \bR^n$ and any $x\in C\cap U$ there exists $i\geq 1$ and $B_i\in\eP_i$ such that
$$
x\in B_i\subset U\cap C.
$$
For any $x\in C$ there exists a unique sequence of Borel sets $B_i(x)\in\eP_i$ such that  $B_i(x)\ni x$, $\forall i$.  Then Doob's  martingale convergence theorem implies that for almost any $x\in C$ we have
$$
f(x) =\lim_{i\to \infty}\frac{1}{{\rm vol}\;(B_i(x))}\int_{B_i(x)} f(y)dy.
$$
A bit more is true. If we define
$$
f_i(x)=\sum_{B\in \eP_i}\frac{1}{{\rm vol}\;(B)}\left(\int_B f(y) dy\right) I_B(x),
$$
where $I_B$ denotes the indicator functio of the subset $B$, then  $f_i\to f$ in $L^1$ as $i\to\infty$.
A: For bounded unions of intervals it of course does not hold: take two disjoint mesaurable subsets $A,B$ of $\mathbb{R}$ such that $\lambda(A\cap E)$ and $\lambda (B\cap E)$ are positive for any interval $E$. Then for $a\in A$ any interval $\delta \ni a$ contains a density point $b\in B$ and you may take the union of an interval $\delta_1\subset \delta$ consisting mostly of points of $B$ and define $B=\delta_1 \cup (a-\lambda(\delta_1)/5,a+\lambda(\delta_1)/5)$. This set is a small union of at most two intervals, contains $a$, but contains many points from $B$. So for $f=\chi_A$ the Lebesgue ratio is far from 1.
A: The classic reference on differeniation theorems (and, yes, martingales as Liviu mentions):
Hayes, C. A.; Pauc, C. Y., Derivation and martingales, Ergebnisse der Mathematik und ihrer Grenzgebiete. 49. Berlin-Heidelberg-New York: Springer-Verlag. VII, 203 p. (1970). ZBL0192.40604.
a plug
Some more modern results may be found in  
G. A. Edgar & L. Sucheston, Stopping Times and Directed Processes, Encyclopedia of Mathematics and Its Applications 47, Cambridge University Press, 1992
