Adiabatical accessibility of gas unmixing Consider a thermally insulated system, made of a room divided by a barrier into two compartments, each one containing an ideal gas at the same temperature. Call this the state $X$ of the system.
If we remove the barrier, the gases spontaneously melt and we observe a typical irreversibile process. Call this the state $Y$.
Suppose now that, in place of the barrier, we insert a selective bidirectional membrane, i.e. a device that transports specifically the molecules of the two gases in the two different directions: in such a way we could place back the molecules of the first gas in one of the compartment, and the molecules of the second in the other.
Such a process seems to be attainable purely by work and not by heating or cooling, hence it seems that state $X$ is adiabatically accessible from state $Y$.
But this contradicts Caratheodory's formulation of the Second Law of Thermodynamics...where am I wrong?
 A: The condition for equilibrium of an ideal gas mixture across a semi-permeable membrane is that the partial pressure of the particular species under consideration on both sides of the membrane must be the same.  So I am going to start out with an ideal gas mixture of two species with their partial pressures being $p_A$ and $p_B$ for a total pressure of $P=p_A+p_B$.  My goal it to end up with pure species in separate containers, each at the pressure P of the original mixture.
I start by putting the mixture in a cylinder with a piston.  At the other end of the cylinder are two semi-permeable membranes, one which is permeable to A and the other which is permeable to B.  Beyond the A membrane is another cylinder which will receive the pure A, and beyond the B membrane is another cylinder which will receive the pure B.  Each of these receiving cylinders also has a piston, which initially is at the end containing the membrane (so that the initial volume of gas in each of the two receiving cylinders is zero).  Now I push the piston in the mixture cylinder inward to drive the gases through their individual membranes, and I allow the pistons in the receiving cyclinders to move out so that the total pressure in the mixture cylinder remains constant at P while the pressures in the pure-gas receiving cylinders are held constant at the partial pressures in the original mixture.  In this way, the separation is carried out reversibly.
In the end, all the gas has been expelled from the mixture cylinder, and the pure gases in the mixture cylinders are at pressures equal to their partial pressures in the original mixture.  The volumes of the gases in the receiving cylinders will each be equal to the original volume of the mixture cylinder.  This process has been carried out isothermally with no heat transfer, and there will have been no net work done.
Now to get the pure gases up to the total pressure P of the original mixture, we need to compress each of the two pure gases isothermally and reversibly.  This compression step will involve removal of heat equal to the amount of work done.  This will involve a decrease in entropy of the gases.  So the net overall effect of this un-mixing process is a decrease in entropy.
