In the book Brownian motion and Stochastic Calculus by Karatzas and Shreve, page 215, there is a problem that says the following:
Let $a_{1}, ..., a_{n}$ be real numbers and denote $D=\lbrace a_{1}, ..., a_{n}\rbrace$. Suppose that $f: \mathbb{R}\rightarrow \mathbb{R}$ is continuous and $f'$ and $f''$ exist and are continuous on $R/D$ and the lateral limits of the derivatives at the points in $D$ exist and are finite. Show that $f$ is the difference of two convex functions and,
$$f(W_{t}) = f(z) + \int_{0}^{t}f'(W_{s})dW_{s} + \frac{1}{2}\int_{0}^{t}f''(W_{s})ds$$
$$+ \sum_{k=1}^{n}L_{t}(a_{k})(f'(a_{k}+) - f'(a_{k}-))$$
where $L_{t}(a) = |W_{t} - a| - |a| - \int_{0}^{t}sign(W_{s}-a)dW_{s}$
My questions is, does this version of Ito's formula holds for any Ito process, i.e
$$f(X_{t}) = f(z) + \int_{0}^{t}f'(X_{s})dX_{s} + \frac{1}{2}\int_{0}^{t}f''(X_{s})ds$$
$$+ \sum_{k=1}^{n}L_{t}(a_{k})(f'(a_{k}+) - f'(a_{k}-))$$
where $L_{t}(a) = |X_{t} - a| - |X_{0} - a| - \int_{0}^{t}sign(X_{s}-a)dX_{s}$
If this is true, in the case where $f'$ is continuous and only $f''$ is discontinuous at a finite number of points, this equation reduces to the 'regular' Ito formula. Correct?