The simplest formulation of the Lebesgue Differentiation Theorem (LDT) (that I am aware of) is the following:
LDT (Simplest formulation). Given a function $f \in L^1_{\text{loc}}(\mathbb R^n)$, we have that
$$ \lim_{r \to 0} \frac{1}{|B(x,r)|} \int_{B(x,r)} f(y) \, dy = f(x), $$
for almost every $x \in \mathbb R^n$.
In this post, it is presented a version of the above LDT for open sets $\Omega \subset \mathbb R^n$, which is stated as follows:
LDT (Simplest formulation for open sets). Let $\Omega \subset \mathbb R^n$ be an open set. Given $f \in L^1_{\text{loc}}(\Omega)$, we have that
$$ \tag{1} \lim_{r \to 0} \frac{1}{|B(x,r)|} \int_{B(x,r)} f(y) \, dy = f(x), $$
for almost every $x \in \Omega$.
$\color{red}{\textbf{QUESTION.}}$ There is one concern I have about the last formulation I've presented. More precisely, I am wondering about the "validity" of the integral
$$ \int_{B(x,r)} f(y) \, dy. $$
To explain my point I start by recalling that $f$ is only defined on $\Omega$. Therefore, this integral only makes sense if $B(x,r) \subset \Omega$. So essentially my question is pretty simple: how does one guarantee that in $(1)$ we are only considering $(x,r)$ such that $B(x,r) \subset \Omega$ ?
Note. Obviously if we take $f(y)\chi_{\Omega}(y)$ in $(1)$ instead of $f(y)$ this solves the problem but this is not the formulation that is presented.
Thanks for any help in advance.
For every $x\in \Omega$, there is $r(x)>0$ such that $B(x,r(x))\subset\Omega$. Hence the quantity $\int_{B(x,r)}f$ is well defined once $r\le r(x)$, and hence for every $x\in \Omega$, the $\limsup_{r\to 0}\frac{1}{|B(x,r)|}\int_{B(x,r)}f$ and $\liminf_{r\to0}\frac{1}{|B(x,r)|}\int_{B(x,r)}f$ are well defined. Then the LDT for the open set $\Omega$ is the statement that for almost every $x\in\Omega$, these two numbers agree.
Added: For every $x\in\Omega$, we define $\limsup_{r\to 0}\frac{1}{|B(x,r)|}\int_{B(x,r)}f$ in the usual way by $$ \lim_{r\to 0}\sup_{\rho\le r}\frac{1}{|B(x,\rho)|}\int_{B(x,\rho)}f. $$ The key point is that this quantity only depends on the values of $r$ arbitrarily close to zero, so in particular, the limsup at $x$ is the same as $$ \inf_{r<r(x)}\sup_{\rho\le r}\frac{1}{|B(x,\rho)|}\int_{B(x,\rho)}f. $$ Note that since $f$ is only defined on $\Omega$, if $\rho>r(x)$, then $$ \int_{B(x,\rho)}f = \int_{B(x,\rho)\cap \Omega}f. $$