Representation of stochastic integral w.r.t. semimartingale with finitely many jumps in finite time In the book "Semimartingale theory and Stochastic Calculus" from He, Wang and Yan I found the following integration by parts formula for semimartingales (Theorem 9.33):
If $X$ and $Y$ are semimartingales then,
$$X_tY_t = \int_0^t X_{s-} \text{d} Y_s + \int_0^t Y_{s-} \text d X_s + X_0Y_0 + \langle X^c, Y^c\rangle _t + \sum_{s\le t} \Delta X_s \Delta Y_s$$
where $X_{s-} := \lim_{r\nearrow s} X_s$ and $X^c$ denotes the continuous part of $X$, $\langle \rangle_t $ is the quadratic variation and $\Delta X_s := X_s - X_{s-}$.
In my application I have given the case that $Y$ is in fact purely discontinuous and both $X$ and $Y$ have finitely many jumps up to a time $t>0$.
In this case I conjecture that
$$X_tY_t = X_0Y_0 + \int_0^t Y_{s-} \text d X_s^c + \sum_{s\le t} \Delta (XY) _s$$
In my calculation by intuition I assumed the following:
$$\int_0^tX_{s-} \text dY_s = \sum_{s\le t}X_{s-} \Delta Y_s \quad\text{and}\quad \int_0^t Y_{s-} \text d X_s = \int_0^t Y_{s-}\text dX_s^c + \sum_{s\le t} Y_{s-} \Delta X_s$$
Is this true? If yes, how can I prove it? The reason must be that there are just finitly many jumps.
Edit: I searched in the book but the definition of purely discontinuous is not clear to me. Anyway, may I just state the particular situation I work with:
Let us take the definition of pure jump type from here. Then in my case
$X = M + A$,
where $M$ is a local martingale (possibly with jumps) and $Y,A$ are pure jump type. Unfortunately, I really want to use this integration by parts formula.
 A: I think what you conjectured would be true if $Y$ is a pure jump process, but the condition of a purely discontinuous $Y$ is too weak. Indeed, $Y$ is purely discontinuous if and only if $\langle Y\rangle$ is a pure jump process (by definition). However, we can easily find examples in which $Y$ is purely discontinuous and has finitely many jumps but $\mathrm dY^c\ne 0$ on some intervals. For example, consider a degenerate case (i.e., $Y_t(\omega)$ is given by $Y(t)$ below almost surely): 
$$Y(t)=\begin{cases}t, &\text{if }0\le t<1\\t+1, &\text{otherwise}\end{cases}$$
It is easy to verify that
$$\langle Y\rangle_t=\begin{cases}0, &\text{if }0\le t<1\\1,&\text{otherwise}\end{cases},$$
which is a pure jump process, and so $Y$ is purely discontinuous. In this case, we have $\mathrm d Y^c_t=1$ for each $t>0$. Notice that $Y$ exhibits finitely many jumps (indeed only one jump) almost surely for $t>1$.
A: As far as I understand it, finitely many jumps implicated pure jump type of the discontinuous part, so we can do the following. Let $H$ be a cadlag process and $Z$ a semimartingale of purejump type with finitely many jumps in $[0,t]$.
Define $t_k^n := \frac k n \wedge t$ for $k\in\Bbb N_0$. Then by Theorem 9.29 of that book I cited in the question we have the following well-known fact:
$$\sum_{i=0}^\infty H_{t_i^n} ( X_{t_{i+1}^n} - X_{t_i^n}) \overset{\Bbb P}{\longrightarrow} \int_0^t H_{s-} \text dX_s$$
On the other hand, fix $\omega \in \Omega$. $X (\omega)$ has finitely many jumps on $[0,t]$. Denote them by $0< s_1 < \ldots < s_m$. We have that $\max_{i\in\Bbb N _0} |t_{i+1}^n - t^n_i| \to 0$ as $n\to \infty$. Therefore there exists $N$ s.t. $\forall n \ge N $ we have
$$\forall k=1,\ldots, m  \quad (s_k \in (t_i^n , t^n_{i+1}] \Rightarrow s_l \notin (t_i^n , t^n_{i+1}]\; \forall l \neq k)$$
Define $t^n (s) := \sup \{ t_i^n : t_i^n < s \} $. Note that $t^n(s) \nearrow$ s. Then for $n\ge N$
$$\sum_{i=0}^\infty H_{t_i^n} (\omega) ( X_{t_{i+1}^n}(\omega) - X_{t_i^n}(\omega)) = \sum_{k=1}^m H_{t^n (s_k)} (\omega) (X_{s_k}(\omega) - X_{s_k-}(\omega)) \\
\longrightarrow \sum_{k=1}^m H_{s_k -} (\omega) (X_{s_k}(\omega) - X_{s_k-}(\omega)) = \sum_{s\leq t} H_{s-}(\omega) \Delta X_{s}(\omega)$$
Therefore 
$$\int_0^t H_{s-} \text dX_s =\sum_{s\leq t} H_{s-} \Delta X_{s}$$
This implies what I assumed in my calculation because $\Delta X = \Delta X^d$.
