Is this a valid derivation of the chemical equilibrium criterion? In the book "Combustion Theory" for Forman Williams, appendix A, and also in the book "Combustion Physics" for C.K. Law, chapter 1, the following derivation can be found for the chemical equilibrium criterion:
$$\sum_{i} \mu_i dN_i = 0.$$
The derivation starts by stating out the first law of thermodynamics as:
$$\delta Q = dE + \delta W = dE + pdV, \qquad  (1)$$
where $\delta Q$ is the heat added to the system, $E$ is the internal energy and $\delta W = pdV$ is the work done by the system. Then, we state the second law of thermodynamics as:
$$TdS \geq \delta Q, \qquad (2)$$
where $S$ is the entropy, and where the inequality holds for natural processes while equality holds for reversible processes. Combining equations (1) and (2) then gives
$$dE \leq TdS - pdV, \qquad (3)$$
where again inequality holds for natural processes while equality holds for reversible processes.
Then, it is stated that for a single-component system, $S$ and $V$ suffice as independent variables to describe the state of the system, while for a multi-component system, we also need the mole numbers $N_i$ of the various species. In which case internal energy is written as:
$$dE = TdS - pdV + \sum_i \mu_idN_i. \qquad (4)$$
Now, by comparing equations (3) and (4), we notice that
$$\sum_{i} \mu_i dN_i \leq 0, \qquad (5)$$
where inequality holds for natural processes and equality holds at equilibrium. It is also stated in both books that this condition is general and not restricted to the conditions of constant temperature and constant pressure.
Well, the last step in this derivation just doesn't make any sense to me. My understanding is that in equations (1) and (3), it is implied that the system has a fixed composition ($dN_i = 0$), so you can't use them simultaneously with equation (4).
Also, I still recall the derivation of this equilibrium criterion in Callen's thermodynamics, where the author invoked the extremum principle at constant pressure and temperature, stated in terms of the Gibbs energy ($dG = 0$), from which he deduced the equality in equation (5). Thus, constant pressure and temperature are a requirement for the validity of the result.
So, am I missing something here, or is this derivation just as dumb as it looks?
 A: Overall, the system is closed; it does not exchange matter with the outside. We can therefore apply the first principle to it as $dE=\delta Q+\delta W$ and (if we assume that the pressure within the system is uniform) $dE=\delta Q-pdV$. (The only irreversibility considered here is that associated with a chemical reaction.)
The above relation does not assume that the composition remains constant—simply that there is no exchange of particles with the outside.
Relation (4) is the thermodynamic identity for a system of variable composition.
The second principle postulate is $\delta Q\le TdS$, and the equality is assumed to be verified at equilibrium.
We then arrive at the relationship $\sum_{i} \mu_i dN_i \leq 0 $.
Indeed, we did not assume an isothermal or isobaric transformation. We simply assumed that pressure and temperature are uniform within the system. So this relation is general. It amounts to writing that "uncompensated heat" $\delta Q'=TdS-\delta Q$ is positive, zero at equilibrium.
We easily verify that $\delta Q'=-dE$ at constant entropy and volume, $\delta Q'=-dH$ at constant entropy and pressure, $\delta Q'=-dG$ at constant temperature and pressure...; in any case, we write $\delta Q'\geq0$.
This relation is universal because it leads to the law of mass action. Once equilibrium is achieved, the relationship between the thermodynamic parameters does not depend on the way in which this equilibrium has been obtained.
