# Rigorous derivation of dΠ for stock with continuous dividend

Posted on StackExchange, but they have a nasty habit of deleting unanswered questions after a while, in an irrecoverable way, so I’m going to re-post all my random questions here as I go along in life.  (You can see dead questions if you know the URL, they keep it around, but if you lose the URL, forget about it.)  So….

Suppose we are holding a replicating portfolio $\Pi_t$ of long an option $f(S,t)$ and short some stock, so $\Pi_t=f(S_t,t)-\Delta_t S_t$ Suppose the stock follows geometric Brownian motion and pays continuous dividends at rate $q$, so $d S_t = S_t((\mu-q)dt + \sigma dW_t$ Naively, $d\Pi_t = d f(S_t,t)-\Delta_t dS_t$ However, because the stock pays a dividend, common sense and the literature tell us that $d\Pi_t=df(S_t,t)-\Delta_t dS_t-\Delta_t S_t dt$

Question: How do we rigorously arrive at the total derivative for $d\Pi_t$ which includes extra term $-\Delta_t S_t dt$, given that we know $\Pi_t=f(S_t,t)-\Delta_t S_t$, without appeal to common sense i.e., from the equations, without recalling the mechanics of how the stock works? Because, naively, I would not include the extra term, if I just knew the equation defining $\Pi_t$ and nothing about the mechanics of the stock.