# probabilistic interpretation of elliptic equation with mixed boundary condition

I would like to understand the probabilistic interpretation of the following elliptic problem with mixed Dirichlet-Neumann boundary conditions:

Let $B := \{ x \in \mathbb{R}^n, \quad \| x \|_2 \leq 1 \}, n \geq 1$. We assume that the boundary of $B$ is composed of two disjoint subsets : $\partial B = \Gamma_N \cup \Gamma_D$. Consider $\lambda>0,\ f \in \mathcal{C}(\bar{B}), g \in \mathcal{C}(\partial B)$ and $u$ satisfying \begin{align} \lambda u - \frac{1}{2} \Delta u & = f \quad \mbox{in} \quad B,\\ u & = g \quad \mbox{in} \quad \Gamma_D,\\ \frac{\partial u}{\partial n} & = 0 \quad \mbox{in} \quad \Gamma_N. \end{align}

I believe that it is a stopping problem for a reflected Wiener process, in the sense that $$u(x) = \mathbb{E} \left ( \int_0^\tau \exp(-\lambda t) f(\beta(t)) dt \right ) + \mathbb{E} \exp(-\lambda \tau) g(\beta(\tau))$$ where \begin{align} & d \beta(t) \in \partial \mathbf{1}_\bar{B} (\beta(t)) + d w(t)\\ & \tau = \inf \{ t>0, \quad \beta(t) \in \Gamma_D \}. \end{align} here $\mathbf{1}_\bar{B}(x) = 0$ if $x \in \bar{B}$ and $\infty$ otherwise. Also, $w(t)$ is Wiener process. If it is correct, how to establish it rigorously?

$$\star \star \star$$ Let me comment the purely Dirichlet case / stopped case. We keep working with the domain $B$ and the functions $f$ and $g$. Consider $u$ satisfying \begin{align} \lambda u - \frac{1}{2} \Delta u & = f \quad \mbox{in} \quad B,\\ u & = g \quad \mbox{in} \quad \partial B. \end{align} So, if we define $$\tau_B = \inf \{ t > 0, \quad w(t) \in \partial B \}$$ which is known to satisfy $\mathbb{E} \tau_B = \frac{1-|x|^2}{n} < \infty$ then Dynkin formula (rigorously speaking we need $u \in \mathcal{C}^2$) tells us that $$u(x) = \mathbb{E} \exp(-\lambda \tau_B) g(x+w(\tau_B)) + \mathbb{E} \int_0^{\tau_B} \exp(-\lambda s) f(x+w(s)) ds.$$ $$\star \star \star$$