When a parcel of air rises, it expands because the pressure is lower at higher altitudes. As the air parcel expands, it pushes the surrounding air outward, transferring energy in the form of work from that parcel to the atmosphere. As energy transfer to a parcel of air by way of heat is very slow, it is assumed to not exchange energy by way of heat with the environment. Such a process is called an adiabatic process (no energy transfer by way of heat). Since the rising parcel of air is losing energy as it does work on the surrounding atmosphere and no energy is transferred into it as heat from the atmosphere to make up for the loss, the parcel of air is losing energy, which manifests itself as a decrease in the temperature of the air parcel. The reverse, of course, will be true for a parcel of air that is sinking and is being compressed.