Solution (source code)

= Solution

Let $R=\mathcal O_k$, $S=\mathcal O_K$ and $n=[K:k]$. For each <prime ideal> $\mathfrak P$ of $S$ above $\mathfrak p$ of $R$, set $f_{\mathfrak P}=[S/\mathfrak P:R/\mathfrak p]$. The relative <norm of a fractional ideal> can be specified on the unique <prime ideal factorization> by
$$
N_{K/k}\left(\prod_{\mathfrak P}\mathfrak P^{a_{\mathfrak P}}\right)
=\prod_{\mathfrak p}\mathfrak p^{\sum_{\mathfrak P\mid\mathfrak p}f_{\mathfrak P}a_{\mathfrak P}},\qquad a_{\mathfrak P}\in\mathbb Z.
$$
Here is why this definition is the intrinsic <relative ideal norm from norms of elements>, and why the residue weights occur. Localize at $\mathfrak p$. The finite torsion-free $R_{\mathfrak p}$-module $S_{\mathfrak p}$ is free of rank $n$, because $R_{\mathfrak p}$ is a <discrete valuation ring>. Multiplication by a nonzero integral $a$ has <determinant> $N_{K/k}(a)$. The <Smith normal form> gives
$$
v_{\mathfrak p}(N_{K/k}(a))=\operatorname{length}_{R_{\mathfrak p}}(S_{\mathfrak p}/aS_{\mathfrak p}).
$$
Decompose the quotient at the <prime ideals> above $\mathfrak p$. In $S_{\mathfrak P}$ each quotient $\mathfrak P^j/\mathfrak P^{j+1}$ is one-dimensional over $S/\mathfrak P$, so has length $f_{\mathfrak P}$ over $R_{\mathfrak p}$. Therefore
$$
v_{\mathfrak p}(N_{K/k}(a))=\sum_{\mathfrak P\mid\mathfrak p}f_{\mathfrak P}v_{\mathfrak P}(a).
$$
For an integral <ideal> $I$, all norms of elements of $I$ have valuations at least $\sum f_{\mathfrak P}v_{\mathfrak P}(I)$. These minima can be attained simultaneously at the finitely many <prime ideals> above a fixed $\mathfrak p$. In fact the <Chinese remainder theorem for ideals>, applied inside the finitely generated module $I$, chooses an $a\in I$ with nonzero image in each $I/\mathfrak PI$. Equivalently $v_{\mathfrak P}(a)=v_{\mathfrak P}(I)$ at all these primes. The generated ideal of the element norms consequently has exactly the displayed valuations. Clearing a denominator extends this description to <fractional ideals>.

Multiplication of <fractional ideals> adds their prime valuations. The displayed formula therefore proves
$$
\boxed{N_{K/k}(IJ)=N_{K/k}(I)N_{K/k}(J).}
$$
It also gives $N_{K/k}((a))=(N_{K/k}(a))$.

Finally, reduction of the free rank-$n$ module $S_{\mathfrak p}$ modulo $\mathfrak p$ has dimension $n$ over $R/\mathfrak p$. The factorization $\mathfrak pS=\prod_i\mathfrak P_i^{e_i}$ and the <Chinese remainder theorem for ideals> identify this reduction with the product of the quotients by $\mathfrak P_i^{e_i}$. Their filtrations have $e_i$ successive quotients of dimension $f_i$ over $R/\mathfrak p$. Adding dimensions proves the <fundamental identity for prime decomposition>:
$$
\boxed{[K:k]=\sum_i e_if_i.}
$$