Solution (source code)

= Solution

Use the normalized <inner product>
$$
\langle g,h\rangle=\mathbb E_{n\leq N}g(n)h(n)=\frac1N\sum_{n\leq N}g(n)h(n).
$$
The <test-function seminorm> generated by $\mathcal F$ and its <dual test-function norm> are
$$
\|g\|_{\mathcal F}=\sup_{f\in\mathcal F}|\langle g,f\rangle|,
\qquad
\|g\|_{\mathcal F}^{*}=\sup_{\|h\|_{\mathcal F}\leq1}|\langle g,h\rangle|.
$$
The first quantity may only be a <seminorm> if $\mathcal F$ does not separate all functions in $\mathcal H_N$; correspondingly, the second may be infinite outside the linear span detected by $\mathcal F$.