Solution (source code)

= Solution

For $\lambda\in\mathbb R$, define the finite-alphabet <exponential family>
$$
P_\lambda(x)=\frac{2^{\lambda f(x)}}{Z(\lambda)},
\qquad
Z(\lambda)=\sum_{y\in A}2^{\lambda f(y)}.
$$
The mean $\mathbb E_{P_\lambda}f$ is continuous and nondecreasing in $\lambda$, with limits $\min f$ and $\max f$ as $\lambda\to-\infty$ and $+\infty$. The strict interior assumption on $v$ therefore supplies a $\lambda$ with $\mathbb E_{P_\lambda}f=v$.

For any other $P$ satisfying the same constraint,
$$
D(P\Vert P_\lambda)
=-H(P)-\lambda v+\log_2Z(\lambda),
$$
so
$$
H(P)=\log_2Z(\lambda)-\lambda v-D(P\Vert P_\lambda)
\leq H(P_\lambda).
$$
Equality in <Gibbs inequality> holds only for $P=P_\lambda$. Hence this Gibbs-form mass function is the unique entropy maximizer.