> [!definition]
>
> Let $\bracs{E_r}_{r > 0} \subset \cb(\real^n)$ be a family of Borel sets. They **shrink nicely** to $x \in \real^n$ if
> 1. $E_r \subset B(x, r)$ for each $r$.
> 2. There exists $\alpha > 0$, such that for all $r > 0$, $m(E_r) > \alpha m(B(x, r))$.
> [!theoremb] Lebesgue Differentiation Theorem
>
> Let $f \in \loci(\real^d)$ be a locally integrable function, then for [[Lebesgue Measure|Lebesgue]]-almost every $x \in \real^d$, and $\bracs{E_r}_{r > 0} \subset \cb(\real)$ that shrink nicely to $x$,
> $
> \lim_{r \downto 0}\frac{1}{m(E_r)} \int_{E_r}\abs{f(y) - f(x)}dy = 0
> $
> In particular,
> $
> \lim_{r \downto 0}\frac{1}{m(E_r)}\int_{E_r}f(y) = f(x)
> $
> Moreover, if $\mu: \cb(\real^d) \to \complex$ is a [[Regular Borel Measure|regular Borel measure]] admitting a [[Lebesgue-Radon-Nikodym Theorem|Lebesgue decomposition]] $d\mu = fdm + d\lambda$, then for almost every $x \in \real^d$ and $\bracs{E_r}_{r > 0} \subset \cb(\real)$ that shrink nicely to $x$,
> $
> \lim_{r \downto 0}\frac{\mu(E_r)}{m(E_r)} = \lim_{r \downto 0}\frac{1}{m(E_r)}\int_{E_r}f(y) = f(x)
> $
# Proofs
> [!theorem] Lebesgue Differentiation Theorem (I)
>
> Let $f \in \loci(\real^d)$ be a [[Locally Integrable|locally integrable]] function, then for [[Lebesgue Measure|Lebesgue]]-almost every $x \in \real^d$,
> $
> \lim_{r \downto 0}\frac{1}{m(B(x, r))}\int_{B(x, r)}\abs{f(y) - f(x)}dy = 0
> $
> In particular,
> $
> \lim_{r \downto 0}A_rf(x) = \lim_{r \downto 0}\frac{1}{m(B(x, r))}\int_{B(x, r)}f(y)dy = f(x)
> $
> If $f \in C(\real^d)$ is [[Continuity|continuous]], then the above holds for every $x \in \real^d$.
>
> *Proof of Limit*. First suppose that $f \in C(\real^d)$, then for every $\eps > 0$, there exists $\delta > 0$ such that $\abs{f(x) - f(y)} < \eps$ whenever $\abs{x - y} < \delta$. So for any $r < \delta$,
> $
> \begin{align*}
> \abs{f(x) - A_rf(x)} &\le \frac{1}{m(B(x, r))}\int_{B(x, r)}\abs{f(y) - f(x)}dy \\
> &\le \frac{m(B(x, r))}{m(B(x, r))}\eps = \eps
> \end{align*}
> $
> Therefore $A_rf(x) \to f(x)$ as $r \downto 0$.
>
> Now suppose that $f \in L^1(\real^d)$ and let $\eps > 0$. Since $C_c(\real^d) \subset L^1(\real^d)$ is [[Dense|dense]], there exists $\phi \in C_c(\real^d)$ such that $\norm{\phi - f}_{L^1(\real^d)} < \eps/2$. In which case,
> $
> \begin{align*}
> \abs{f(x) - A_rf(x)} &\le \frac{1}{m(B(x, r))}\int_{B(x, r)}\abs{f(y) - f(x)}dy \\
> &\le \frac{1}{m(B(x, r))}\int_{B(x, r)}\abs{f(y) - g(y)} + \abs{g(y) - g(x)}dy \\
> &+ \abs{f(x) - g(x)}
> \end{align*}
> $
> and
> $
> \limsup_{r \downto 0}\abs{f(x) - A_rf(x)} \le H(f - g)(x) + \abs{f(x) - g(x)}
> $
> Let $\alpha > 0$, then the family
> $
> B_\alpha = \bracs{x \in \real^d: H(f - g)(x) + \abs{f(x) - g(x)} > \alpha}
> $
> is contained in
> $
> \underbrace{\bracs{x \in \real^d: H(f - g)(x) > \alpha/2}}_{H_\alpha} \cup \underbrace{\bracs{x \in \real^d: \abs{f(x) - f(g)} > \alpha/2}}_{D_\alpha}
> $
> By the [[Hardy-Littlewood Maximal Function|Maximal Inequality]] and [[Markov's Inequality]],
> $
> m(H_\alpha) \le \frac{2 \cdot 3^n\eps}{\alpha} \quad m(D_\alpha) \le \frac{2\eps}{\alpha}
> $
> As the above holds for all $\eps > 0$, $m(B_\alpha) = 0$. Since the proposition holds for every $x \in \real^d \setminus \bigcup_{n \in \nat}B_{1/n}$ and each $B_{1/n}$ is null, the proposition holds for Lebesgue-almost every $x \in \real^d$.
>
> Finally, suppose that $f \in \loci(\real^d)$ is arbitrary. Let $N \in \nat$, then for each $x \in B(0, N)$ and $r \le 1$, $A_rf(x) = A_r(\one_{B(0, N + 1)}f)(x)$, with $\one_{B(0, N+1)}f \in L^1(\real^d)$. By the preceding discussion, $A_rf(x) \to f(x)$ for almost every $x \in B(0, N)$. As this holds for all $N \in \nat$, $A_rf(x) \to f(x)$ for almost every $x \in \real^d$.
>
> *Proof of Lebesgue set being co-null*. Let $c \in \complex$, then for Lebesgue-almost every $x \in \real^d$,
> $
> \lim_{r \downto 0}\frac{1}{m(B(x, r))}\int_{B(x, r)}\abs{f(y) - c}dy = \abs{f(x) - c}
> $
> If $\seq{c_n} \subset \complex$ is an enumeration of a [[Dense|dense]] subset of $\complex$, then since the above holds for each $c_n$,
> $
> \lim_{r \downto 0}\frac{1}{m(B(x, r))}\int_{B(x, r)}\abs{f(y) - c_n}dy = \abs{f(x) - c_n} \quad \forall n \in \nat
> $
> for Lebesgue-almost every $x \in \real^d$ as well. Thus for any $x \in \real^d$ where the above holds and $\eps > 0$, there exists $n \in \nat$ such that $\abs{f(x) - c_n} < \eps/2$. In which case,
> $
> \begin{align*}
> &\limsup_{r \downto 0}\frac{1}{m(B(x, r))}\int_{B(x, r)}\abs{f(y) - f(x)}dy \\
> &\le \abs{f(x) - c_n} + \limsup_{r \downto 0}\frac{1}{m(B(x, r))}\int_{B(x, r)}\abs{f(y) - c_n}dy \\
> &= 2\abs{f(x) - c_n} < \eps
> \end{align*}
> $
> [!theorem] Lebesgue Differentiation Theorem (II)
>
> Let $f \in \loci(\real^d)$, then for almost $x \in \real^d$ and $\bracs{E_r}_{r > 0}$ that shrink nicely to $x$,
> $
> \lim_{r \downto 0}\frac{1}{m(E_r)}\int_{E_r}\abs{f(y) - f(x)}dy = f(x)
> $
> In particular,
> $
> \lim_{r \downto 0}\frac{1}{m(E_r)}\int f(y)dy = f(x)
> $
> *Proof*. Let $\alpha > 0$ such that $m(E_r) > \alpha m(B(x, r))$ for all $r > 0$, then
> $
> \begin{align*}
> \frac{1}{m(E_r)}\int_{E_r}\abs{f(y) - f(x)}dy &\le \frac{1}{m(E_r)}\int_{B(x, r)}\abs{f(y) - f(x)}dy \\
> &\le \frac{1}{\alpha}\frac{1}{m(B(x, r))}\int_{B(x, r)}\abs{f(y) - f(x)}dy
> \end{align*}
> $
> Since $\frac{1}{m(B(x, r))}\int_{B(x, r)}\abs{f(y) - f(x)}dy \to 0$ as $r \downto 0$ for Lebesgue-almost every $x \in \real^d$, the proposition holds for almost every $x \in \real^d$.
> [!theorem] Lebesgue Differentiation Theorem (III)
>
> Let $\mu: \cb(\real) \to \complex$ be a regular Borel measure with Lebesgue decomposition $d\mu = fdm + d\lambda$, then for Lebesgue-almost every $x \in \real^d$,
> $
> \lim_{r \downto 0}\frac{\mu(E_r)}{m(E_r)} = \lim_{r \downto 0}\frac{1}{m(E_r)}\int_{E_r}f(y) = f(x)
> $
> *Proof*. It is sufficient to show that for Lebesgue-almost every $x \in \real^d$,
> $
> \lim_{r \downto 0}\frac{\abs{\lambda}(B(x, r))}{m(B(x, r))} = 0
> $
> To this end, let $\beta > 0$, $\eps > 0$, and $A \in \cb(\real^d)$ such that $\abs{\lambda}(A) = 0$.
> $
> B_\beta = \bracs{x \in A: \sup_{r > 0}\frac{\abs{\lambda}(B(x, r))}{m(B(x, r))} > \beta}
> $
> By regularity, there exists $U \supset A$ such that $\abs \lambda(U) < \eps$.
>
> For each $x \in B_\beta$, there exists $r_x > 0$ such that $\abs{\lambda}(B(x, r_x)) > \beta m(B(x, r_x))$ and $B(x, r_x) \subset U$. Thus $B_\beta \subset \bigcup_{x \in B_\beta}B(x, r_x) = V$. By the [[Vitali Covering Lemma]], there exists $\seq{x_j} \subset B_\beta$ such that $\bracsn{B(x_j, r_{x_j}): 1 \le j \le n}$ are pairwise disjoint, and
> $
> \frac{m(V)}{2} \le 3^n\sum_{j = 1}^n m(B(x_{j}, r_{x_j})) \le \frac{3^n}{\beta}\sum_{j = 1}^n\abs{\lambda}(B(x_j, r_{x_j})) \le \frac{3^n\abs{\lambda}(U)}{\beta} \le \frac{3^n\eps}{\beta}
> $
> As the above holds for all $\eps > 0$, $B_\beta$ is a Lebesgue-null set. In addition, since the proposition holds for all $x \in A \setminus \bigcup_{n \in \nat}B_{1/n}$, it holds for Lebesgue-almost all $x \in A$. Given that $\lambda \perp m$, the proposition holds for all Lebesgue-almost every $x \in A$.