# Proof of Clausius' inequality using irreversible auxiliary engines

I'm having trouble trying to perform a general proof of Clausius' inequality. I am familiar with Fermi's (and other authors') proofs, where they imagine that the heat given/taken from the system S under consideration, in any of its infinitesimal steps, is provided by tiny Carnot engines/refrigerators (see e.g. this post: 2$^\text{nd}$ law of thermodynamics: equivalence of statements).

However, these Carnot engines appear quite artificially in the proof. They are certainly not physically justifiable by any means, even if mathematically the proof is valid.

So I tried to generalize and imagine that these tiny engines/refrigerators are actually irreversible. Then one could physically argue that all heat given to the system comes from some cold reservoir somewhere, and does all kinds of hocus-pocus before part of it is transferred to S, and this would be represented by an irreversible cycle.

Problem is, I can't make it work. Here's what I've tried. If $$C_i$$ is a general irreversible machine, then $$\delta Q_{i,0}+T_0\dfrac{\delta Q_i}{T_i}\leq 0$$ (this comes from Carnot's theorem). But $$\delta Q_i$$, being the heat rejected by $$C_i$$, is negative, while equal (in modulus) to $$\delta Q_i^S$$, i.e. the heat absorbed by S in that infinitesimal part of its cycle. So $$\delta Q_i^S = -\delta Q_i$$. Likewise the heat released by the reservoir is $$\delta Q_{i,0}^{res} = -\delta Q_{i,0}$$, so one has $$\delta Q_{i,0}^{res} + T_0 \dfrac{\delta Q_i^S}{T_i} \geq 0$$. Integrating,

$$T_0\displaystyle\int \dfrac{\delta Q}{T} \geq -Q^{res}$$.

From the 2nd Law, it can't be $$Q^{res}>0$$ otherwise we would have built a miraculous engine converting all heat into net work. So we have $$Q^{res}\leq 0 \implies -Q^{res}\geq 0$$ and therefore $$T_0\displaystyle\int \dfrac{\delta Q}{T} \geq 0$$, which is precisely the opposite of what we wanted to prove.

Any help in finding the flaw in the argument would be greatly appreciated.