Solution (source code)

= Solution

The <generic extension> is $M[G]=\{\tau^G:\tau\in M\text{ is a forcing name}\}$. It is transitive: if $x\in\tau^G$, an active pair in $\tau$ supplies a subname $\sigma\in M$ with $x=\sigma^G$. Ground sets belong to it by their canonical names. Without assuming a weakest condition, use $\check a=\{(\check b,p):b\in a,\ p\in P\}$; nonemptiness of $G$ gives $\check a^G=a$.

Induction on <forcing name rank> gives $\operatorname{rank}(\tau^G)\le\operatorname{nrk}(\tau)$. The right side is an <ordinal> of $M$. If $\alpha\in M[G]$ is an <ordinal>, its rank equals $\alpha$, so it is at most a ground-model <ordinal>. Transitivity of $M$ then implies $\alpha\in M$. Conversely every ground <ordinal> remains the same <ordinal> in the transitive extension, since membership is unchanged. Hence
$$
\boxed{\mathrm{Ord}\cap M[G]=\mathrm{Ord}\cap M.}
$$
This proves <forcing preserves ordinals> directly from ranks, without assuming <cardinal> preservation.