[proofplan]
The proof proceeds in three steps. First, we approximate: since the [Martingale Problem](/theorems/2105) applies to functions defined on all of $\mathbb{R}^d$, we approximate $u$ on nested sub-domains $U_n \subset U$ by compactly supported $C^2$ extensions $u_n$. The Martingale Problem applied to $u_n$, stopped at the exit time $T_n$ from $U_n$, together with the PDE identity $-Lu = f$ on $U_n$, gives $u(x) = \mathbb{E}[u(X_{t \wedge T_n}) + \int_0^{t \wedge T_n} f(X_s) \, d\mathcal{L}^1(s)]$. Second, we establish $\mathbb{E}[T_U] < \infty$ using a comparison with the exit time of an auxiliary Dirichlet problem. Third, with the finite expected exit time in hand, we pass to the limits $n \to \infty$ and $t \to \infty$ using dominated convergence and continuity of $u$ on $\overline{U}$ to obtain the stochastic representation formula. Uniqueness of the solution follows from the fact that any two solutions have the same stochastic representation.
[/proofplan]
[step:Apply the Martingale Problem on sub-domains $U_n$ with smooth extensions of $u$]
Define the nested sub-domains
\begin{align*}
U_n = \left\{x \in U : |x| < n \text{ and } \operatorname{dist}(x, \partial U) > \tfrac{1}{n}\right\}
\end{align*}
and the corresponding exit times $T_n = \inf\{t \geq 0 : X_t \notin U_n\}$. Since $U$ is bounded and open and $X$ is continuous, $T_n \uparrow T_U$ a.s.
For each $n$, choose $u_n \in C^2_b(\mathbb{R}^d)$ such that $u_n = u$ on $\overline{U}_n$. Such an extension exists because $u \in C^2(\overline{U}_n)$ and $\overline{U}_n$ is compact with positive distance to $\partial U$: one can multiply $u$ by a smooth cutoff function that equals $1$ on $\overline{U}_n$ and has compact support in $U$.
By the [Martingale Problem](/theorems/2105), the process
\begin{align*}
M^{u_n}_t = u_n(X_t) - u_n(X_0) - \int_0^t Lu_n(X_s) \, d\mathcal{L}^1(s)
\end{align*}
is a continuous local martingale. Since $u_n \in C^2_b(\mathbb{R}^d)$ (bounded with bounded first and second derivatives), the stochastic integral representation from the proof of the Martingale Problem shows that the integrand is bounded. Therefore $M^{u_n}$ is a bounded continuous local martingale, and by the [Dominated Local Martingale is a Martingale](/theorems/2079) theorem, $M^{u_n}$ is a true martingale.
Stopping at $T_n$: the stopped process $M^{u_n}_{t \wedge T_n}$ is also a martingale. For $s \leq t \wedge T_n$, we have $X_s \in \overline{U}_n$, so $u_n(X_s) = u(X_s)$ and $Lu_n(X_s) = Lu(X_s) = -f(X_s)$ (using the PDE $Lu = -f$ on $U$, and $\overline{U}_n \subset U$). Therefore
\begin{align*}
M^{u_n}_{t \wedge T_n} = u(X_{t \wedge T_n}) - u(x) + \int_0^{t \wedge T_n} f(X_s) \, d\mathcal{L}^1(s).
\end{align*}
Taking $\mathbb{P}$-expectations and using $\mathbb{E}[M^{u_n}_{t \wedge T_n}] = M^{u_n}_0 = 0$:
\begin{align*}
u(x) = \mathbb{E}\!\left[u(X_{t \wedge T_n}) + \int_0^{t \wedge T_n} f(X_s) \, d\mathcal{L}^1(s)\right].
\end{align*}
[guided]
Why do we need the extensions $u_n$? The [Martingale Problem](/theorems/2105) requires $f \in C^2(\mathbb{R}^d)$, not just $f \in C^2(U)$. The solution $u$ to the Dirichlet-Poisson problem is defined on $\overline{U}$, and we cannot directly apply the Martingale Problem to it because it is not defined on all of $\mathbb{R}^d$.
The fix is approximation: we cut $U$ to a slightly smaller domain $U_n = \{x \in U : \operatorname{dist}(x, \partial U) > 1/n, \, |x| < n\}$ and extend $u|_{U_n}$ to a $C^2_b(\mathbb{R}^d)$ function $u_n$. On $U_n$, $u_n$ agrees with $u$, so the Martingale Problem applied to $u_n$ and stopped at $T_n$ (the exit time from $U_n$) gives us the correct identity using $Lu = -f$.
The key identity we obtain is:
\begin{align*}
u(x) = \mathbb{E}\!\left[u(X_{t \wedge T_n}) + \int_0^{t \wedge T_n} f(X_s) \, d\mathcal{L}^1(s)\right].
\end{align*}
This holds for every fixed $n$ and $t$. To obtain the representation formula, we need to send $n \to \infty$ and $t \to \infty$. But first, we must ensure $\mathbb{E}[T_U] < \infty$ to justify the limit passage, which we do in the next step.
[/guided]
[/step]
[step:Prove $\mathbb{E}[T_U] < \infty$ using uniform ellipticity]
We establish the finiteness of $\mathbb{E}[T_U]$ by a comparison argument. Since $a = \sigma\sigma^\top$ is uniformly elliptic on $\overline{U}$ with constant $\theta > 0$, i.e., $\sum_{i,j} a_{ij}(x)\xi_i\xi_j \geq \theta|\xi|^2$ for all $x \in \overline{U}$ and $\xi \in \mathbb{R}^d$, consider the function
\begin{align*}
v : \overline{U} &\to \mathbb{R} \\
x &\mapsto |x|^2.
\end{align*}
The generator acts on $v$ as
\begin{align*}
Lv(x) = \sum_{i=1}^d b_i(x) \cdot 2x_i + \frac{1}{2}\sum_{i,j=1}^d a_{ij}(x) \cdot 2\delta_{ij} = 2b(x) \cdot x + \sum_{i=1}^d a_{ii}(x) \geq -2\|b\|_\infty \operatorname{diam}(U) + d\theta,
\end{align*}
using the ellipticity bound $\sum_i a_{ii}(x) = \operatorname{tr}(a(x)) \geq d\theta$ (set $\xi = e_i$ in the ellipticity condition and sum over $i$). Define $c_0 = d\theta - 2\|b\|_\infty \operatorname{diam}(U)$. If $c_0 > 0$, then $Lv \geq c_0 > 0$ on $U$.
For the general case (when $c_0$ may not be positive), we use a different test function. Let $w(x) = e^{\alpha x_1}$ for a constant $\alpha > 0$ to be chosen. Then
\begin{align*}
Lw(x) = \alpha b_1(x) e^{\alpha x_1} + \frac{\alpha^2}{2} a_{11}(x) e^{\alpha x_1} = e^{\alpha x_1}\left(\alpha b_1(x) + \frac{\alpha^2}{2}a_{11}(x)\right) \geq e^{\alpha x_1}\left(-\alpha\|b\|_\infty + \frac{\alpha^2\theta}{2}\right).
\end{align*}
Choosing $\alpha > 2\|b\|_\infty / \theta$ ensures $Lw \geq c_1 > 0$ on $\overline{U}$ for some constant $c_1 = \inf_{\overline{U}} e^{\alpha x_1} \cdot (\alpha^2\theta/2 - \alpha\|b\|_\infty) > 0$.
Applying the identity from the previous step with $w$ in place of $u$ (extending $w$ to $C^2_b(\mathbb{R}^d)$ and using $Lw \geq c_1$): the [Martingale Problem](/theorems/2105) gives
\begin{align*}
w(X_{t \wedge T_n}) - w(x) - \int_0^{t \wedge T_n} Lw(X_s) \, d\mathcal{L}^1(s) \text{ is a martingale.}
\end{align*}
Taking expectations:
\begin{align*}
\mathbb{E}[w(X_{t \wedge T_n})] - w(x) = \mathbb{E}\!\left[\int_0^{t \wedge T_n} Lw(X_s) \, d\mathcal{L}^1(s)\right] \geq c_1 \, \mathbb{E}[t \wedge T_n].
\end{align*}
Since $w$ is bounded on $\overline{U}$ (as $U$ is bounded), the left-hand side is bounded by $\|w\|_{L^\infty(\overline{U})} + |w(x)|$. Therefore
\begin{align*}
\mathbb{E}[t \wedge T_n] \leq \frac{2\|w\|_{L^\infty(\overline{U})}}{c_1} < \infty
\end{align*}
for all $t$ and $n$. By the monotone convergence theorem (sending $n \to \infty$ and then $t \to \infty$):
\begin{align*}
\mathbb{E}[T_U] \leq \frac{2\|w\|_{L^\infty(\overline{U})}}{c_1} < \infty.
\end{align*}
[guided]
The finiteness of $\mathbb{E}[T_U]$ is the key analytic input from the ellipticity assumption. Without ellipticity, the diffusion could "get stuck" near the boundary and $T_U$ could have infinite expectation.
The idea is to find a smooth function $w$ with $Lw \geq c > 0$ on $U$. Then the Martingale Problem gives $\mathbb{E}[w(X_{t \wedge T_n})] - w(x) \geq c \, \mathbb{E}[t \wedge T_n]$. Since $w$ is bounded on $\overline{U}$, this forces $\mathbb{E}[T_U] \leq C/c < \infty$.
Why does such a $w$ exist? Ellipticity ensures $a_{11}(x) \geq \theta > 0$, so $Lw$ for $w = e^{\alpha x_1}$ has a leading term $\frac{\alpha^2}{2}a_{11} e^{\alpha x_1} \geq \frac{\alpha^2 \theta}{2} e^{\alpha x_1}$, which dominates the first-order term $\alpha b_1 e^{\alpha x_1}$ for $\alpha$ large enough. This is a standard trick: the exponential test function exploits the second-order nature of $L$ (which comes from the diffusion) to produce a positive lower bound on $Lw$, overpowering the drift term $b$.
[/guided]
[/step]
[step:Pass to the limit $n \to \infty$ and $t \to \infty$ to obtain the representation formula]
Starting from the identity $u(x) = \mathbb{E}[u(X_{t \wedge T_n}) + \int_0^{t \wedge T_n} f(X_s) \, d\mathcal{L}^1(s)]$, we pass to limits.
**Sending $n \to \infty$.** Since $T_n \uparrow T_U$ a.s. and $X$ is continuous, $X_{t \wedge T_n} \to X_{t \wedge T_U}$ a.s. Since $u$ is continuous on $\overline{U}$ and bounded (as a continuous function on a compact set), $u(X_{t \wedge T_n}) \to u(X_{t \wedge T_U})$ a.s. and $|u(X_{t \wedge T_n})| \leq \|u\|_{L^\infty(\overline{U})}$. By the dominated convergence theorem:
\begin{align*}
\mathbb{E}[u(X_{t \wedge T_n})] \to \mathbb{E}[u(X_{t \wedge T_U})].
\end{align*}
For the integral term, $\int_0^{t \wedge T_n} f(X_s) \, d\mathcal{L}^1(s) \to \int_0^{t \wedge T_U} f(X_s) \, d\mathcal{L}^1(s)$ by the monotone convergence theorem (applied to positive and negative parts separately), and the integral is bounded by $\|f\|_\infty \cdot (t \wedge T_U)$. Therefore
\begin{align*}
u(x) = \mathbb{E}\!\left[u(X_{t \wedge T_U}) + \int_0^{t \wedge T_U} f(X_s) \, d\mathcal{L}^1(s)\right].
\end{align*}
**Sending $t \to \infty$.** Since $\mathbb{E}[T_U] < \infty$, we have $T_U < \infty$ a.s. As $t \to \infty$, $t \wedge T_U \to T_U$ a.s. By continuity of $X$ and the fact that $X_{T_U} \in \partial U$ (as $X$ exits $U$ continuously), $u(X_{t \wedge T_U}) \to u(X_{T_U}) = g(X_{T_U})$ a.s., where $g$ is the boundary data. Since $|u(X_{t \wedge T_U})| \leq \|u\|_{L^\infty(\overline{U})}$, the dominated convergence theorem gives $\mathbb{E}[u(X_{t \wedge T_U})] \to \mathbb{E}[g(X_{T_U})]$.
For the integral, $\int_0^{t \wedge T_U} |f(X_s)| \, d\mathcal{L}^1(s) \leq \|f\|_\infty \cdot T_U$, and $\mathbb{E}[\|f\|_\infty T_U] = \|f\|_\infty \mathbb{E}[T_U] < \infty$, so by the dominated convergence theorem:
\begin{align*}
\mathbb{E}\!\left[\int_0^{t \wedge T_U} f(X_s) \, d\mathcal{L}^1(s)\right] \to \mathbb{E}\!\left[\int_0^{T_U} f(X_s) \, d\mathcal{L}^1(s)\right].
\end{align*}
Combining:
\begin{align*}
u(x) = \mathbb{E}_x\!\left[g(X_{T_U}) + \int_0^{T_U} f(X_s) \, d\mathcal{L}^1(s)\right].
\end{align*}
[/step]
[step:Deduce uniqueness of the Dirichlet-Poisson solution]
If $u_1$ and $u_2$ are two solutions to the Dirichlet-Poisson problem with the same data $f$ and $g$, then both satisfy the representation formula. For every $x \in U$:
\begin{align*}
u_1(x) = \mathbb{E}_x\!\left[g(X_{T_U}) + \int_0^{T_U} f(X_s) \, d\mathcal{L}^1(s)\right] = u_2(x).
\end{align*}
Since $u_1 = u_2 = g$ on $\partial U$ by the boundary condition, $u_1 = u_2$ on $\overline{U}$.
[/step]