Consider a reversible heat engine working between two sources. Suppose that one of the sources is a thermostat, while the other is an ideal gas which follows a transformation and exchanges some heat with the engine.
Does the fact that the engine exchanging heat with the gas is reversible imply that the transformation of the ideal gas (no matter what that transformation is) is a reversible transformation?
In other words, does the following hold?
A reversible heat engine exchanges heat with an ideal gas that does a transformation $\implies$ the transformation of the gas is reversible
Said in another manner, can I have a reversible engine that takes heat from a sudden (but not adiabatic) and irreversible compression of some ideal gas and gives heat to a thermostat?
I'm confused about this beacuse in the definition of reversible heat engine nothing is said about an hypotetical transformation that happens in the source of the heat itself. The only necessary thing is that the cycle inside heat engine is made of reversible transformations. On the other hand, if the transformation in the ideal gas which is the source is not reversible, the heat engine cannot work backwards of course (and that's in contrast with the definition of reversible engine).