Say I have a gas enclosed in a bottle with a weight on top exerting pressure P0. Let the gas pressure be P. If P0 is not equal to P the compression/expansion will be irreversible. If P0>P and the gas is being compressed: Work done on the gas is: -PdV Work done on surroundings by the gas is: P0dV If P0<P and the gas is expanding: Work done on the gas is: -PdV Work done on surroundings by the gas is: P0dV Is this correct? My textbook says that work done on the gas during compression should instead be -P0dV but it seems to me that the internal gas pressure is the one in contact with the gas. My second question is about how the first law of thermo works. I know that engineering textbooks often define their work as work done by the gas while my chemistry textbook defines work as work done on the gas. It would seem though from the list I made above that the work done on the gas is not equal to the work done by the gas during irreversible compression/expansion and so one would get different results depending on which version of the first law was used. Thanks!