I am after some intuition regarding the formal definition of the Green measure In particular its use in finding the estimated time a brownian motion spends in a set.
For some context I am working on Oksendals SDE exercise 2.14 which is as follows
"Let $B_t$ be a $n$-dimensional brownian motion and let $K \subset \mathbb{R}^n$ have zero $n$-dimensional lebesgue measure. Prove that the expected total length of time that $B_t$ spends in $K$ is zero."
Now the green measure is given as $E^{x}[\int^{\infty}_{0}\chi_{K}(B_{t})dt]$ and in the books solutions this is rewritten as
$\underbrace{E^{x}[\int^{\infty}_{0}\chi_{K}(B_{t})dt]}_{A}=\underbrace{\int^{\infty}_{0}P^{x}[B_t \in K]dt}_B$
Here is where my two main issues stem from, number one I don't understand how the author has gone from $A$ to $B$ (I assume $\chi_{K}(B_t)$ is the characteristic function?)
Secondly Im having some trouble getting my head round $B$ my issue in particular is that I dont see how it gives the expected length of time the brownian motion is in K (I am lacking an intuitive understanding) isn't $B$ simply just a sum of the probabilities for all times $t$?
$\int_0^\infty \chi_K(B_t) dt$ is a random variable giving the amount of time that $B_t$ spends in $K$. Given a starting point for the process $x$, it has some expected value. That expected value is an integral over the probability space $\Omega$:
$$E^x \left [ \int_0^\infty \chi_K(B_t) dt \right ] = \int_\Omega \int_0^\infty \chi_K(B_t(\omega)) dt dP^x(\omega).$$
The claim $A=B$ in your question is simply interchanging these two integrals. Although this is not "free" as you probably already know, you nevertheless usually expect it to be the case. In this particular case where the integrand only has one sign, the interchange is free.
You can intuitively view the right side as giving a weight to each time based on how likely you are to be in $K$ at that time, and then summing over times.