  In a previous letter we studied the giant optical nonlinearities of a Rydberg
atomic medium within an optical cavity, in the Schwinger-Keldysh formalism. In
particular, we calculated the non-linear contributions to the spectrum of the
light transmitted through the cavity. In this article we spell out the
essential details of this calculation, and we show how it can be extended to
higher input photon numbers, and higher order correlation functions. As a
relevant example, we calculate and discuss the three-photon correlation
function of the transmitted light, and discuss its physical significance in
terms of the polariton energy levels of the Rydberg medium within the optical
cavity.
