# Martingale change of measure at a stopping time

Given is a filtered space $(\Omega, \mathcal{F}, P, (\mathcal{F}_t))$. Suppose that $M=(M_t)$ is a martingale adapted to the filtration $(\mathcal{F}_t)$ with unit mean. Define a new probability measure on $\Omega$ by $$\frac{dQ}{dP}\bigg\vert_{\mathcal{F}_t} = M_t.$$ Suppose $\tau$ is a bounded stopping time, that $(X_t)$ is another $\mathcal{F}_t$-adapted process and that $f,g$ are measurable functions on $\mathbb{R}$ ($f$ non-negative). Does the following equation hold?

$$Q\bigg(f(X_{\tau}) \textbf{1}_{(X_s \leq g(s) \,\, \forall s \leq \tau)}\bigg) = P\bigg(f(X_{\tau}) \textbf{1}_{(X_s \leq g(s) \,\, \forall s \leq \tau)} M_{\tau} \bigg).$$

Is showing this equation equivalent to showing $$\frac{dQ}{dP}\bigg\vert_{\mathcal{F}_{\tau}} = M_{\tau}?$$ I'm not sure even how to do this...

N.B. The processes $X$ and $M$ are cadlag in my application.

Do you write $Q(Z)$ as a shorthand notation for $E_Q(Z)$, so for the expectation of $Z$ with respect to Q? (I think so, but I will stick to the latter notation.)
The answer to the second question should be a consequence of the optional sampling theorem. Let $A \in \mathcal F_\tau$ and $\tau$ be bounded by $T$. Then in particular $A \in \mathcal F_T$ and
$$Q(A) = E_P[1_A M_T] = E_P[E_P[1_A M_T|\mathcal F_\tau]] = E_P[1_A E_P[M_T|\mathcal F_\tau]] = E_P[1_AM_\tau].$$
This is exactly what needs to be shown for the second property. (And from this the first claim follows by "standard arguments", approximating any non-negative $\mathcal F_\tau$-measurable $Z_\tau$ by simple functions.)