Solution (source code)

= Solution
{c}

A <self-financing replicating portfolio> for a terminal payoff $F(S_T)$ has the same terminal value on every relevant path, with all earlier rebalancing funded internally. In a <complete market> its initial cost is unique under <no-arbitrage>: otherwise buy the cheaper payoff and sell the more expensive identical payoff.

In the <Black-Scholes model>, the portfolio holds $V_s$ shares and bond value $V-SV_s$, where $V$ solves the <Black-Scholes equation> with terminal data $F$. <Itô's formula> verifies the <self-financing condition>. Equivalently,
$$
\boxed{V(t,s)=e^{-r\tau}\mathbb E_{\mathbb Q}[F(S_T)\mid S_t=s],\qquad dS_t=rS_t\,dt+\sigma S_t\,dW_t^{\mathbb Q}.}
$$
This relates <claim replication>, the <Black-Scholes equation>, and <risk-neutral valuation>.