A microscopic, mechanical derivation of the adiabatic gas relation