is a variational characterization in [@CD] of the free energy density in the grand canonical ensemble.)

A variational characterization of the entropy density
=====================================================

\[thm1\] For any possible pair $(e,t)$, $s_{e,t} = - \min I(g)$, where the minimum is over all graphons $g$ with $e(g)=e$ and $t(g)=t$, where $$e(g)=\int_0^1 \!\!\! \int_0^1 g(x,y) \, dx \, dy, \qquad t(g) =
  \int_0^1\!\!\!\int_0^1\!\!\!\int_0^1 g(x,y) g(y,z) g(z,x) \, dx \, dy \, dz,$$
  and the rate function is $$I(g) = \int_0^1\!\!\!\int_0^1 I_0(g(x,y)) \,dx\, dy, \hbox{
    \rm where } I_0(u)= \frac{1}{2} \left [u \ln(u) +
    (1-u)\ln(1-u)\right ].$$

We first prove that $s_{e,t}$ is well-defined. A priori all we know is that $\liminf\ln
  (Z_{e,t}^{n,\delta})/n^2$ and $\limsup\ln (Z_{e,t}^{n,\delta})/n^2$ exist as ${n\to\infty}$. However, we will show that they both approach $-\min I(g)$ as $\delta \to 0^+$.

We need to define a few sets. Let $U_\delta$ be the set of graphons $g$ with $e(g)$ and $t(g)$ strictly within $\delta$ of $e$ and $t$, i.e. the preimage of an open square of side $2\delta$ in $(e,t)$-space, and let $F_\delta$ be the preimage of the closed square. Let $\tilde U_\delta$ and $\tilde F_\delta$ be the corresponding sets in $\tilde {{\mathcal W}}$. Let $|U_\delta^n|$ and $|F_\delta^n|$ denote the number of graphs with 