I found a similar question but I could not solve my doubt. So, if you consider this question to be a double, I am sorry.
Consider a system $S$ that undergoes a cyclic transformation and the $n$ sources from which it receives heat have temperatures $T_1, T_2... T_n$. Let $Q_i$ be the heat received/given by the $i$-th source. After deriving Clausius inequality for all cycles:
\begin{equation}\tag{1}\sum\limits_{i=1}^n\frac{Q_i}{T_i}\leqslant0 \end{equation}
I've seen some books (Fermi, Thermodynamics is an example) doing what follows:
If the cycle is reversible, we can consider the inverse cycle, and the only difference will be the opposite sign of the heats. So:
\begin{equation}\tag{2}\sum\limits_{i=1}^n\frac{-Q_i}{T_i}\leqslant0\iff\sum\limits_{i=1}^n\frac{Q_i}{T_i}\geqslant0\end{equation}
In order to have both this inequality and the $(1)$ satisfied, for a reversible cycle we must have:
\begin{equation}\tag{3}\sum\limits_{i=1}^n\frac{Q_i}{T_i}=0 \end{equation}
Okay, there it is. From the equation $(3)$ we can conclude that for reversible cycles equality signs holds.
But Fermi also concluded that the equality holds only in that case. We have proved that the equation $(3)$ is true in the case of a reversible cycle, but we haven't proved that the equality cannot hold in any other case, so how do we conclude that \begin{equation} \sum\limits_{i=1}^n\frac{Q_i}{T_i}<0 \end{equation} for non-reversible cycle?
Am I missing something or does that book take it somehow for granted? Please, note I am asking for a theoretical and mathematical explanation of this conclusion. Thanks in advance.