Show that $(S_t - M_t) \phi(S_t) = \Phi(S_t) - \int_{0}^{t} \phi(S_s) dM_s$ 
Show that $(S_t - M_t) \phi(S_t) = \Phi(S_t) - \int_{0}^{t} \phi(S_s) dM_s$

(This is from Le Gall's book, Brownian Motion, Martingales, and Stochastic Calculus.)
Here, $M$ is a continuous local martingale, $S_t = \sup_{0 \leq s \leq t} M_s$, $\phi$ is a twice continuously differentiable function, and $\Phi(x) = \int_0^x \phi(t)dt$.
In previous parts of this question, I showed that, for a continuous function $m$ and $s(t) = \sup_{0 \leq s \leq t} m(s)$, and for every bounded Borel function $h$, the Riemann-Stieltjes integral
$$\int_0^t (s(r) - m(r)) h(r) ds(r) = 0$$
I also showed (I think)
$$\phi(S_t) = \phi(S_0) + \int_0^t \phi'(S_s)dS_s$$
Unfortunately I can't identify how either of these facts would help with this questions so I've pursued a different course.

My idea is to argue that $(\phi(S) \cdot M)_t$ (where $(H \cdot M)_t = \int_0^t H(s) dM_s$ is a stochastic integral) satisfies
$$\langle \phi(S) \cdot M, N\rangle_t = (\phi(S))_t \cdot \langle M, N \rangle_t$$ $\forall N$ ($N$ is a cont. local m'gale) and that $\left(\Phi(S) - (S - M) \phi(S)\right)_t$ also satisfies this, so by uniqueless, $(\phi(S) \cdot M)_t = \left(\Phi(S) - (S - M) \phi(S)\right)_t$. ($\langle M, N\rangle_t$ is the quadratic variation between the cont. local martingales $M$ and $N$ and $H \cdot \langle M, N \rangle = \int_0^t H(s) d\langle M, N \rangle_s$ is a Riemann-Stieltjes integral.)
The work is in showing that $\left(\Phi(S) - (S - M) \phi(S)\right)_t$ satisfies this relation. Since for a sequence of partitions with mesh tending to zero we have
$$\lim_{n \to \infty} \sum_{i = 0}^{p_n - 1} (M_{t_{i + 1}^n} - M_{t_i^n})(N_{t_{i + 1}^n} - N_{t_i^n}) = \langle M, N \rangle_t$$
I thought I would try to compute this directly. Applying a mean-value theorem we have that:
$$\Phi(S_{t_{i + 1}^n}) - \Phi(S_{t_i^n}) = \phi(S_{t_i^n} + c_i^n S_{t_{i + 1}^n})(S_{t_{i + 1}^n} - S_{t_i^n})$$
($c_i^n \in [0,1]$.)
I write
$$\Phi(S_{t_{i + 1}^n}) - \Phi(S_{t_i^n}) - (\phi(S_{t_{i + 1}^n})S_{t_{i + 1}^n} - \phi(S_{t_{i}^n})S_{t_{i}^n})  + \phi(S_{t_{i + 1}^n}) M_{t_{i + 1}^n} - \phi(S_{t_{i}^n})M_{t_i^n}$$
This will be multiplied with $N_{t_{i + 1}^n} - N_{t_i^n}$ in the sum whose limit is the quadratic variation between the two processes. I notice that
$$\Phi(S_{t_{i + 1}^n}) - \Phi(S_{t_i^n}) - (\phi(S_{t_{i + 1}^n})S_{t_{i + 1}^n} - \phi(S_{t_{i}^n})S_{t_{i}^n}) =  \phi(S_{t_i^n} + c_i^n S_{t_{i + 1}^n})(S_{t_{i + 1}^n} - S_{t_i^n}) - (\phi(S_{t_{i + 1}^n})S_{t_{i + 1}^n} - \phi(S_{t_{i}^n})S_{t_{i}^n}) \approx 0$$
This should hold for all $i$ for large $n$ since the mesh of the partition tends to zero. Thus a rewrite simplifies an earlier expression to
$$\phi(S_{t_{i + 1}^n}) M_{t_{i + 1}^n} - \phi(S_{t_{i}^n})M_{t_i^n} \approx \phi(S_{t_i^n}) (M_{t_{i + 1}^n} - M_{t_i^n})$$
So now I consider
$$\lim_{n \to \infty} \sum_{i = 0}^{p_n - 1} \phi(S_{t_i^n}) (M_{t_{i + 1}^n} - M_{t_i^n}) (N_{t_{i + 1}^n} - N_{t_i^n})$$
If I can believe that $(M_{t_{i + 1}^n} - M_{t_i^n}) (N_{t_{i + 1}^n} - N_{t_i^n}) \approx \langle M, N \rangle_{t_{i + 1}^n} - \langle M, N \rangle_{t_i^n}$, then I would have the above some being approximately
$$\lim_{n \to \infty} \sum_{i = 0}^{p_n - 1} \phi(S_{t_i^n}) (\langle M, N \rangle_{t_{i + 1}^n} - \langle M, N \rangle_{t_i^n}) = \int_0^t \phi(S_s) d\langle M, N \rangle_s = (\phi(S))_t \cdot \langle M, N \rangle_t$$
Then I would have established what I want.

For one thing, I use $\approx$ a lot and that's not how one writes a rigorous proof (at least not without a proper definition), and I don't even know if $(M_{t_{i + 1}^n} - M_{t_i^n}) (N_{t_{i + 1}^n} - N_{t_i^n}) \approx \langle M, N \rangle_{t_{i + 1}^n} - \langle M, N \rangle_{t_i^n}$. This also seems way hard, harder than it should be. So, am I doing the right thing? How can I make my argument rigorous, or is there an easier way?
 A: In this answer I present a proof which uses the facts which you mentioned in the first part of your question.
By Itô's formula, we have
$$M_t \phi(S_t) = \int_0^t \phi(S_s) \,d M_s + \int_0^t M_s \phi'(S_s) \, dS_s \tag{1}$$
and
$$S_t \phi(S_t) = \int_0^t (\phi(S_s)+S_s \phi'(S_s)) \, dS_s. \tag{2}$$
(Note that Itô's formula is applicable because $t \mapsto S_t$ is increasing, and hence of bounded variation. There is no quadratic covariation term $[S,M]$ since $M$ has continuous sample paths and $S$ is of bounded variation.) Combining $(1)$ and $(2)$, we find
$$(S_t-M_t) \phi(S_t) = - \int_0^t \phi(S_s) \, dM_s + \int_0^t \big[ \phi(S_s) + (S_s-M_s) \phi'(S_s) \big] dS_s. $$
Using the identity (which you already showed)
$$\int_0^t (s(r)-m(r)) h(r) \, ds(r)=0$$
for $m(r) := M_r(\omega)$, $s(r) := \sup_{u \leq r} M_u(\omega)$ and $h(r) = \phi'(S_r(\omega))$, we get
$$(S_t-M_t) \phi(S_t) = - \int_0^t \phi(S_s) \, dM_s + \int_0^t  \phi(S_s) \, dS_s.$$
Finally, note that
$$\Phi(S_t) = \Phi(S_0) + \int_0^t \Phi'(S_s) \, dS_s = \int_0^t \phi(S_s) \, dS_s$$
(this follows from the second identity you mentioned, with $\phi$ replaced by $\Phi$, or you can use Itô's formula). Consequently, we conclude that
$$(S_t-M_t) \phi(S_t) = - \int_0^t \phi(S_s) \, dM_s + \Phi(S_t).$$
