My question is about the $dG=0$ condition for the equilibrium in a system, say, solid + gas (water and ice, if you prefer).
Almost every textbook gives the following recipe to understand phase equilibrium.
First, from the laws of thermodynamics, it is stated that the transition from one state to another (in a one-component one-phase system) couldn't go more efficiently then $$\delta Q \leq TdS \tag{1}$$ Using $dU = -pdV + \delta Q$ we hence conclude $dU \leq -pdV + TdS$ or $$dU + pdV - TdS \leq 0 \tag{2}$$
Introducing Gibbs energy fucntion, $G=U+pV-TS$, we see that under constant temperature (T) and pressure (p) $$dG = dU + pdV - TdS \leq 0 \tag{3}$$ What this one states is the following: if $p$ and $T$ are kept constant then everything that could happen to the system will lead to the decrease of G. Otherwise, we're in the equilibrium and $G$ stays constant. So far, so good.
But then, in case of water+ice system, chemical potential terms are being added: $$dU = -pdV + TdS + \mu_w dN_w + \mu_i dN_i \tag{4}$$
If we follow the logic of (1) and (2), substituting the updated version of $dU$, i.e. (4), then the result we get is: $$dG - \mu_w dN_w - \mu_i dN_i \leq 0 \tag{5}$$ But in the textbook people somehow get $dG \leq 0$ instead and then using (4) and the definition of G $$dG = d(U+PV-TS) = dU + pdV + Vdp - TdS - SdT = \\ = Vdp - SdT + \mu_w dN_w + \mu_i dN_i \tag{6}$$ state that under constant $p$ and $T$ the following is true during the equilibrium: $$dG = \mu_w dN_w + \mu_i dN_i = 0 \tag{7}$$ while in my case it is (5).
What's wrong in my reasoning scheme?