Why does the function in Dynkin's formula need to have compact support? I'm reading Oksendal's SDE book and I don't quite understand why Lemma7.3.2 and Theorem 7.4.1 requires compact support condition.
 A: In fact Dynkin's formula holds for a larger class of functions, one does not need that the corresponding function has compact support:


(Dynkin's formula) Let $$X_t = x+ \int_0^t b(s) \, ds + \int_0^t \sigma(s) \, dB_s \tag{1}$$ a one-dimensional Itô process. Then $$\mathbb{E}^x(f(X_{\tau})) - f(x) = \mathbb{E}^x \left(\int_0^{\tau} A_s f(X_s) \, ds \right) \tag{2}$$ for $\tau \in L^1(\mathbb{P}^x)$ and $f \in C^2_b$ such that  $$M:= \sup_{s \geq 0} \|A_s f\|_{\infty} < \infty \tag{3}$$ where $$A_s f(x) = b(s) \cdot f'(x) + \frac{1}{2} \sigma^2(s) \cdot f''(x)$$


If $b$, $\sigma$ are bounded, we have in particular $$\|A_s f\|_{\infty} \leq C \cdot (\|f''\|_{\infty}+\|f'\|_{\infty})$$ i.e. $(2)$ holds for any function $f \in C_b^2 \subset C_0^2$.
The reason for the assumption on the (uniform) boundedness of $A_s f$ is the following: By Itô's formula, we have that
$$f(X_t)-f(x) = \int_0^t f'(X_s) \, dX_s + \frac{1}{2} \int_0^t f''(X_s) \, d\langle X \rangle_s$$
where $\langle X \rangle$ denotes the quadratic covariation of $X$. Using $(1)$ we see that
$$M_t^f := f(X_t)-f(x)- \int_0^t A_s f(X_s) \, ds$$
is a $\mathbb{P}^x$-martingale, satisyfing $\mathbb{E}^xM_t^f = \mathbb{E}^xM_0^f = 0$. We can apply the optional stopping theorem to the bounded stopping time $\tau \wedge n$ and get
$$0 = \mathbb{E}^x(M_{\tau \wedge n}^f) = \mathbb{E}^x(f(X_{\tau \wedge n})) - f(x) - \mathbb{E}^x \left( \int_0^{\tau \wedge n} A_sf(X_s) \, ds \right)$$
Now the idea is to use the dominated convergence theorem, but to do so we need a majorant series. Under the assumption $(3)$, we have
$$\mathbb{E}^x \left( \int_0^{\tau \wedge n} |A_sf(X_s)| \, ds \right) \leq M \cdot \mathbb{E}^x(\tau)<\infty$$
i.e. we can apply the dominated convergence theorem.
