TITLE: Construct a set with different upper and lower Lebesgue density at zero.
QUESTION [7 upvotes]: For $\delta >0,$let $I(\delta)$ be the segment $(- \delta, \delta) \subset \mathbb{R}.$ Given $\alpha,\beta,$ and $0 \leq \alpha < \beta \leq 1,$ construct a measurable set $E \subset \mathbb{R}$ so that the upper and lower limits of 
$$m(E \cap I(\delta))/2 \delta$$ are $\beta$ and $\alpha$ repsectively as $\delta \rightarrow 0.$  
This is a question from Rudin's book on Real and Complex Analysis and it has been taken up before here:
Lebesgue measurable subset of $\mathbb{R}$ with given metric density at zero . 
Yuval Filmus has posted an answer which I'm trying to verify, but I can't make it to work. In his answer, he sets $E$ to be the duplication around zero of
$$\bigcup_{n \geq 1} \left[\frac{1}{(2n)!}-\alpha\left(\frac{1}{(2n)!} - \frac{1}{(2n+1)!}\right),\frac{1}{(2n)!}\right] \cup \left[\frac{1}{(2n+1)!}-\beta\left(\frac{1}{(2n+1)!} - \frac{1}{(2n+2)!}\right),\frac{1}{(2n+1)!}\right].$$
I have no problem with showing that $\beta$ and $\alpha$ can occur as limits, but I can't show that any limit must lie between $\beta$ and $\alpha.$   
My questions are thus:
 1. Is the construction of Yuval correct? Does this work?
 2. If not, what is an example that does work?  
My attempt with Yuval's example 
Let us try to show that any limit must lie between $\alpha$ and $\beta.$ Say that $0< r <1$ and that $ \dfrac{1}{(2n+1)!} < r \leq \dfrac{1}{(2n)!}.$ Then we have that $$m(E \cap I(1/(2n+1)!)) \leq m(E \cap I(r) ) \leq m(E \cap I(1/(2n)!)).$$
We have that $$m(E \cap I(1/(2n+1)!)) = 2\sum_{k=n+1}^\infty  \beta \frac{2k}{(2k+1)!} + 2 \sum_{k=n+2}^\infty \alpha \frac{2k}{(2k+1)!}$$ while
$$m(E \cap I(1/(2n)!)) = 2\sum_{k=n}^\infty  \alpha \frac{2k}{(2k+1)!} + 2 \sum_{k=n+1}^\infty \beta \frac{2k}{(2k+1)!}.$$
We have  $$m(E \cap I(1/(2n+1)!))/(2r) \leq m(E \cap I(r) )/(2r) \leq m(E \cap I(1/(2n)!))/(2r).$$
We now want an upper and a lower bound on $m(E \cap I(r))/(2r).$For the upper bound, the obvious thing would be, since $(2n)!/2 \leq 1/(2r) < (2n+1)!/2$ would be to calculate  $$(2n+1)!/2m(E \cap I(1/(2n)!)).$$ This is $$(2n+1)!\sum_{k=n}^\infty  \alpha \frac{2k}{(2k+1)!} + (2n+1)! \sum_{k=n+1}^\infty \beta \frac{2k}{(2k+1)!}.$$ But this upper bound is much too crude to give us anything valuable. I also tried by taking the midpoint of the interval $[1/(2n+1)!,1/(2n)!]$ but that similarily seemed to give me nothing.

REPLY [4 votes]: I'll deal with the cases $0<\alpha < \beta <1.$ Suppose $b_1 > a_1 > b_2 > a_2 > \cdots \to 0.$ Let $E=\cup_n [a_n,b_n].$ For $0<x<b_1,$ define
$$f(x) = \frac{m(E\cap [0,x])}{x}.$$
Check that $f$ increases on each $[a_n,b_n],$ and decreases on each $[b_{n+1},a_n].$ Thus the maximum of $f$ on $[b_{n+1},b_n]$ is one of the values $f(b_n), f(b_{n+1}),$ while the minimum equals $f(a_n).$ Thus if we can find $a_n,b_n$ such that $f(b_n) = \beta, f(a_n) = \alpha$ for all $n,$ we'll be done.
Note the following:
$$\tag 1 f(b_n)=\frac{(b_n-a_n) + (b_{n+1}-a_{n+1}) + \cdots  }{b_n}, $$ $$f(a_n)=\frac{(b_{n+1}-a_{n+1}) + (b_{n+2}-a_{n+2})\cdots  }{a_n}.$$
It turns out that we can choose $a_n,b_n$ to be geometric sequences. Define
$$c = \frac{1-\beta}{1-\alpha}, b= c\frac{\alpha}{\beta}.$$
Put $b_n = b^n, a_n = cb^n.$ Then these $b_n,a_n$ do exactly what we want. To check this, use $(1)$ to see
$$f(b_n) = \frac{(1-c)b^n + (1-c)b^{n+1} + \cdots  }{b^n} = \frac{1-c}{1-b}.$$
Do some algebra to see the last fraction equals $\beta.$ The same kind of argument gives $f(a_n)=\alpha.$ That completes the proof.
I realize that some of this seems like rabbits out of hats, but it's really not that unintuitive. If you entertain the idea that geometric sequences $a_n,b_n,$ might work, even if the $a_n$ sequence is a fixed constant times the sequence $b_n,$ then the definitions of $b,c$ arise naturally.