Solution (source code)

= Solution

Put $s_i=\sup_{C_i}f$ and omit empty sets. Since the sets cover the space, boundedness gives
$$
\mathbb E e^{nf(X_n)}\leq\sum_{i=1}^m e^{ns_i}\mathbb P(X_n\in C_i).
$$
For nonnegative numbers $u_{n,i}$, their sum lies between their maximum and m times their maximum. Consequently its scaled logarithmic upper limit is at most $\max_i\limsup_n n^{-1}\log u_{n,i}$; the added $n^{-1}\log m$ vanishes. Each $C_i$ is closed, so the upper bound in the <large deviation principle> gives
$$
\boxed{\limsup_n\frac1n\log\mathbb E e^{nf(X_n)}\leq\max_i\left(\sup_{C_i}f-\inf_{C_i}I\right).}
$$
The convention $\log0=-\infty$ also handles sets of zero <probability> or infinite <infimum> rate.