Solution (source code)

= Solution
{c}

Before <condensation>, assume a closed parcel with fixed <atmospheric mixing ratio>, constant <specific heat capacities>, and negligible irreversible heating. The <first law of thermodynamics> for a dry <adiabatic process> is
$$
c_p\,dT-\frac1\rho\,dp=0.
$$
The parcel remains in approximate <pressure equilibrium> with a hydrostatic environment. With the standard approximation that parcel and environmental <densities> are close, $dp/dz\simeq-\rho g$, hence
$$
\frac{dT}{dz}=-\frac g{c_p}=-\Gamma_d,\qquad
\boxed{T(z)=T_s-\Gamma_d z.}
$$
This is the <dry adiabatic lapse rate>, about $9.8\,\mathrm{K\,km^{-1}}$ for air. More precisely the environmental <hydrostatic balance> gives $dT/dz=-g\rho_{\rm env}/(c_p\rho_{\rm parcel})$; the familiar constant <dry adiabatic lapse rate> uses their ratio close to one.