Nonstandard analysis and lattice statistical mechanics: a variational principle