Solution (source code)

= Solution

Let $\mu=\mathbb E X_1$ and let the <cumulant-generating function> and its <Legendre transform> be
$$
\psi(\theta)=\log\mathbb E e^{\theta X_1},
\qquad I(x)=\sup_{\theta\in\mathbb R}\{\theta x-\psi(\theta)\}.
$$
Under the permitted assumption that $\psi$ is finite everywhere, the right-tail form of the <Cramér theorem> is, for $a\geq\mu$,
$$
\boxed{\lim_{n\to\infty}\frac1n\log\mathbb P(S_n\geq na)=-I(a),
\qquad I(a)=\sup_{\theta\geq0}\{\theta a-\psi(\theta)\}.}
$$
Use $\log0=-\infty$. The restriction to nonnegative parameters is valid on this side of the mean: convexity gives $\psi(\theta)\geq\mu\theta$, so negative parameters cannot improve the value zero available at $\theta=0$. For $a<\mu$, the right-tail probability tends to one by the <strong law of large numbers>, so its logarithmic rate is zero; it is not generally $-I(a)$.

The full <large deviation principle> bounds probabilities of closed sets from above and open sets from below with rate $I$. For the displayed tail equality, a possible finite upper endpoint also needs attention. If $b=\operatorname{ess\,sup}X_1<\infty$, then at $a=b$ the event requires every summand to equal $b$; its probability is $\mathbb P(X_1=b)^n$, and $I(b)=-\log\mathbb P(X_1=b)$. The identity follows by taking $\theta\to\infty$ in $\mathbb E e^{\theta(X_1-b)}$. Above $b$, both sides have infinite rate. \b[The theorem describes exponential decay, including endpoints and impossible events.]