Exponential Martingales This is a two-part question concerning exponential martingales.
It is stated that an application of Ito's lemma to
\begin{align}
\rho_t = \exp\left[-\int_{0}^{t} \lambda_s\,dW_s - \frac{1}{2}\int_{0}^{t} \lambda_s^2\,ds\right]
\end{align}
gives
\begin{align}
d\rho_t = -\rho_t\lambda_t\,dW_t
\end{align}
I have tried to obtain this by treating $\lambda$ as a constant, hence
\begin{align}
\rho_t &= \exp\left[-\int_{0}^{t} \lambda_s\,dW_s - \frac{1}{2}\int_{0}^{t} \lambda_s^2\,ds\right]\\
&= \exp\left[ -\lambda W_t - \frac{1}{2} \lambda_t^2 t \right]
\end{align}
thus,
\begin{align}
d\rho_t &= \frac{\partial\rho_t}{\partial t} dt + \frac{\partial\rho_t}{\partial W_t} dW_t + \frac{1}{2}\frac{\partial^2\rho_t}{\partial W_t^2} (dW_t)^2\\
&= -\frac{1}{2}\lambda^2\exp(\cdots)\,dt -\lambda\exp(\cdots)\,dW_t + \frac{1}{2}\lambda^2\exp(\cdots)\,dt\\
&= \lambda\rho_t\,dW_t
\end{align}
$\textbf{Question 1}:$ I can't help but feel treating $\lambda$ as a constant isn't the correct way to do this. Can anyone confirm or explain how to do it treating $\lambda$ as a function of $t$?
With regards to the second question I am reading some lecture notes which state the following. Let,
\begin{align}
X(t) = -\int_{0}^{t} \lambda_s\,dW_s
\end{align}
and define $f(t,x) = \exp x$, then since $X$ is an Ito process,
\begin{align}
f(t,X(t)) = 1 - \int_{0}^{t} f(s,X(s))\,\lambda(s)\,dW(s)
\end{align}
or in differential form,
\begin{align}
df(t,X(t)) = -f(t,X(t))\,dX(t)
\end{align}
$\textbf{Question 2}:$ In light of question 1 I find it hard to agree the result stated. e.g. if I was to let
\begin{align}
f(t,x) = \exp\left[-\int_{0}^{t} \lambda_s\,dW_s \right]
\end{align}
then treating $\lambda$ as constant so $f(t,x) = \exp\left[-\lambda W_t\right]$ and applying Ito I obtain,
\begin{align}
df(t,x) &= 0\,dt -\lambda\exp(\cdots)dW_t + \frac{1}{2}\lambda^{2}\exp(\cdots)\,dt\\
&= f(t,x)\,dX + \tfrac{1}{2}\lambda^{2}\,f(t,x)\,dt
\end{align}
where I have an additional term and I seem to be missing a minus sign (assuming $dX(t) = - \lambda_t dW_t$).
$\textbf{Question 2}:$ I keep thinking to myself the original $X(t)$ should have been defined like $\rho_t$ in question 1 (i.e. two terms), then it would make sense. Would anyone be able to confirm if I'm making serious error or whether the original definition of $X(t)$ appears incorrect?
All help is appreciated.
Many thanks,
John
 A: What follows assumes that processes involved are well-defined for our immediate purposes so that, for instance, $(W_s)_{s\geqslant 0}$ is a regular Brownian-motion adapted to some underlying filtration, $(\lambda_s)_{s\geqslant 0}$ is previsible and adapted to the same filtration, and $\int_{0}^{t}\lambda_s^2\text ds<\infty$. We move by a sequence of steps:   
Step 1: Identify a relevant $C^{2}$ real-valued function defined on $\mathbb R$:
$$
f(x)=e^{-x}
$$
Step 2: Identify the underlying Itô Process:
$$
\text dX_t=\lambda_t\text dW_t+\frac{1}{2}\lambda_t^2\text dt\tag{1}
$$
Notice, this follows, by definition, from the stochastic process $X_t=\int_0^t\lambda_s\text dW_s+\frac{1}{2}\int_0^t\lambda_s^2\text ds$ (where $X_0=0$). Also, from (1), we deduce that $\text d\langle X \rangle_t=\lambda_t^2\text dt$. 
Step 3: Apply Itô's lemma to $f(X_t)$:
$$\text df(X_t) = \frac{\partial f}{\partial x}\Big\vert_{X_t}\text dX_t+\frac{1}{2}\frac{\partial^2 f}{\partial x^2}\Big\vert_{X_t}\text d\langle X\rangle_t = -e^{-X_t}\text dX_t+\frac{1}{2}e^{-X_t}\text d\langle X\rangle_t =-f(X_t)\lambda_t\text dW_t\,, $$
by using (1). That is, 

$$\text de^{-\int_0^t\lambda_s\text dW_s-\frac{1}{2}\int_0^t\lambda_s^2\text ds} = -e^{-\int_0^t\lambda_s\text dW_s-\frac{1}{2}\int_0^t\lambda_s^2\text ds}\lambda_t\text dW_t$$


Remarks:
Had we chosen the alternative Itô process $X_t=\int_0^t\lambda_s\text dW_s$ instead (or, in sde form, $\text dX_t=\lambda_t\text dW_t$), while keeping the same function $f$, you can check that we would obtain the different (but still related) process sde 

$$\text de^{-\int_0^t\lambda_s\text dW_s} = -e^{-\int_0^t\lambda_s\text dW_s}(\lambda_t\text dW_t-\frac{1}{2}\lambda^2_t\text dt).$$

The difference between the two cases is that the choice of $X_t$ as in (1) ensures that $f(X_t)$ is a martingale, while the other choice of $X_t$ does not.
