(*ideal) It's not really easy to visually show "pressure", but two things happen to the box of air: it will shrink (it's easy to show this), and its internal temperature will increase.
The first effect may seem obvious, but why the second one? In the particular action we took of crushing the box, we performed work on the box (so we did something that changed its internal energy) but did not add or remove heat from the contents. And, if we assume that the box is a thermal insulator, then we know that the gas cannot respond to being compressed by radiating away energy.
Thermodynamically, a change of a box of air's internal energy is related to the amount of heat that is transferred into or out of it, and the work performed on the box to change its volume.
Where U is the internal energy of the box, Q is the heat that is added to the box, and W is a work term that is equal to PdV, such that an increase in volume is seen as a loss of internal energy (the box expends energy to push its walls out). Conversely, pushing on the box to make it smaller is an addition to the internal energy. Broadly speaking, if you do work on the box (shrink it) without letting it radiate, then its internal energy will increase; and internal energy is a function of the temperature of the gas. This type of action on the box—this type of transformation—is called an adiabatic transformation. "Adiabatic" means "without transfer of heat."
Why does this matter?Consider the atmosphere: due to the weight of the air above you, there is higher atmospheric pressure at the surface of the planet than there is, say, 10 kilometers above us. If we are very sloppy in our treatment of what we just learned, we might conclude that the very fact that pressure at the surface is higher means that the temperature at the surface is higher.
And believe it or not, this is something that is used (again, sloppily and erroneously) by some to deny that the greenhouse effect causes warming on the surface of our, and frankly any, planet. Because if gravity can cause pressure change and high pressure is associated with high temperature, then who needs a greenhouse effect, right?
The problem comes from a fundamental misunderstanding of what the above equation represents. The above equation (and all of the ones I will include soon derive the "adiabatic lapse rate" in the title) describes changes in variables of a box, or parcel, of air that is undergoing a transformation. It does not describe a static system; but, the pressure gradient caused by gravity describes a static system (it actually holds in a variety of dynamic systems as well).
The article linked above tries to make an argument that the temperature profile in the atmosphere with height, which we will call the environmental temperature lapse rate (the rate at which temperature lapses, or falls, with height), can be described merely by gravity. How? By thinking that because adiabatic lapse rate, the rate at which a parcel of air will cool as it rises adiabatically (i.e. as it goes through a pressure change adiabatically), can be, then the environmental lapse rate can be. But these are not the same thing!
To derive the adiabatic lapse rate (skip to equation  if you wish), consider our above thermodynamic equation, and plug in the work equivalence:
so a small change in enthalpy is:
We can also define the heat capacity of our system as being the amount of heat we need to add (remove) to (from) a system in order to increase (decrease) its temperature by a certain amount. Typically, we would have to restrain certain parameters of our system in order to measure such a heat capacity, for instance the pressure of the system. If our system is at constant pressure (dP = 0), and we define constant-pressure heat capacity as below:
If we divide by the mass of the system, we can obtain the specific heat capacity and the specific volume, which are, respectively, the amount of heat needed to cause a temperature change per unit of mass, and the amount of volume a unit of mass occupies (inverse of the density). These variables will be in lowercase from the uppercase above. And finally, we can use the hydrostatic equation to finish our derivation of the adiabatic lapse rate:
Here, g is a negative quantity (which I find exceedingly more appropriate than how it's treated as a positive variable with a negative sign attached to it, as in the Wikipedia link above). On Earth, this adiabatic lapse rate value is about –9.8˚C per kilometer in height. In other words, for every kilometer you adiabatically raise a parcel of air, it will cool by 9.8˚C.
Pay close attention to how the equations still describe the parcel of air, and are under the framework of literally moving a "piece" of air through a medium that has reached a pressure equilibrium with gravity. We do not know anything about the temperature distribution in this medium, I never had to reference it. We only know (or at least presumed) that it is stable.
It is also completely worth pointing out that if this was indeed the environmental lapse rate here on Earth, then our environmental lapse rate should equal –9.8˚C/km, no? But it does not, the environmental lapse rate is instead roughly –6.5˚C/km, up until you hit the tropopause. This is not a simple "well they're close, it's just an error between measurement and theory"—no, theory actually dictates that in our atmosphere the environmental lapse rate cannot be as negative as the adiabatic lapse rate. While I will not go into that in particular in this part, allow me to show how a "shallow" environmental lapse rate is still completely compatible with a "steep" adiabatic lapse rate.
Equation  describes how the temperature of an air parcel will change when it rises to a particular height. Consider what will happen to it if it does: once it reaches that height, it will have the same pressure as the pressure of the air around it, and one of three things will happen.
• The air parcel will wind up being colder than the surrounding air, which means it is denser, and thus will sink. This is a condition where the environmental lapse rate is "shallower" (lower in magnitude) than the adiabatic lapse rate, a condition of stability where vertical motion is hampered. A stable atmosphere will stay the way it is.
• The air parcel will reach the exact same temperature as the surrounding air, which means its density is equal, and thus it won't experience a force stopping its motion (but also not helping it). The environmental lapse rate and the adiabatic lapse rate are equal, and this is a condition of neutrality. Neutral atmospheres are "stable" in that when you move an air parcel adiabatically, you are not convecting heat from one location to another. So, the environmental lapse rate will not change.
• The air parcel will be warmer than the surrounding air, which means it is less dense and will accelerate upward further. The environmental lapse rate is "steeper" than the adiabatic lapse rate, and the atmosphere is unstable. In an unstable atmosphere, these adiabatically rising air parcels are carrying hot air upward—this will lead to warming higher up, which makes the environmental lapse rate more "shallow". It will work its way to a stable condition.
This implies an important point: an atmosphere with a very shallow environmental lapse rate is stable and can coexist with a steeper adiabatic lapse rate. In fact, an atmosphere that has no greenhouse gases, or in other words does not have gases that can react with thermal radiation, will be isothermal with no environmental lapse rate at all. This is again something in particular I will not explain in this part.
The next statement necessarily follows: the fact that the pressure is higher at the surface does not dictate that the temperature will be higher at the surface. (You need to have a radiatively-interactive atmosphere, one with greenhouse gases, in order to have temperatures higher at the surface.)
If you're still not convinced, allow me to derive the temperature-dependent pressure profile of the atmosphere. In other words, the pressure at a given height that has a given temperature. That given temperature will depend on the environmental lapse rate.
Starting with the hydrostatic equation, and soon using the ideal gas law:
In these equations, in particular our final one, tau is our environmental lapse rate (see the substitution from equation  to equation ), and variables that have zero subscripts denote values at the surface of the planet (or any surface, so long as that surface remains the same in the problem).
The real question: if we give our tau variable a value very very close to zero, does that make our pressure profile very wonky? In particular, does it imply that our pressure profile won't be "high at surface, low up above?" The graph below shows that the answer is no. In fact, the pressure profile corresponding to a near-zero temperature profile (–0.01˚C/km) is very close to the pressure profile corresponding to an environmental lapse rate close to our adiabatic lapse rate (–9.8˚C/km). For this graph, the temperature and pressure at the surface for each scenario are the same, and are 14˚C and 100,000 Pa respectively.
So, not only does the adiabatic lapse rate not describe a static system, instead the change that an individual air parcel experiences when you move it up or down, but the suggestion that a pressure gradient must cause a temperature gradient is unfounded as well and has many mathematical counterexamples. In the next post, I will offer up a couple theoretical examples to direct how we should think about energy transfer in a simple atmosphere, and why radiative interaction (i.e. greenhouse gases) is needed for the convection that drives our actual environmental lapse rate. I'll also briefly discuss some of the published science on many of these scenarios.