I'm trying to make sense of the derivation of the equation $$\Delta G = \Delta G^0_r + RT\ln(Q)$$
While searching for a derivation of this equation that made sense to me I came across a publication in the Journal of Chemical Education that suggests it is incorrectly applied if not completely wrong:
"Following this development, the paper investigates the source of the mathematical and logical errors contained in textbooks ca. 1950 to the present that led to the fallacious statements still present in most introductory chemistry textbooks and some more advanced texts that the conditions for spontaneity are ΔG < 0 at constant T and p and ΔA < 0 at constant T and V, whereas the corresponding conditions for equilibrium are ΔG = 0 or ΔA = 0. This investigation shows the principal errors to be (i) incorrect evaluation of definite integrals; (ii) failure to determine whether the results of such integrations produce criteria for spontaneity and equilibrium that are necessary conditions, sufficient conditions, both, or neither; and (iii) incorrect logical arguments related to equilibrium. (Spontaneity and Equilibrium III: A History of Misinformation)"
https://pubs.acs.org/doi/full/10.1021/ed500253e
Also, by the same author: https://pubs.acs.org/doi/10.1021/ed400453s
Here is the standard derivation:
For a given chemical reaction, let $v_i$ be the signed stoichiometric coefficient of reagent $i$ (That is, $v_i$ is negative for reactants and positive for products, with $|v_i| = $ the stoichiometric coefficient of reagent $i$).
Define the extent of the reaction, $\xi,$ as: $$\xi := \frac{n_i - n_{i,o}}{v_i} = \frac{\Delta n_i}{v_i}$$
where $n_i$ and $n_{i,o}$ are the instantaneous number of moles and initial number of moles, (of reagent $i$) respectively. This quantity will have the same value regardless of which reagent is chosen to compute it and is therefore well-defined. It is effectively a measure of the reaction coordinate.
Note that: $$n_i = n_{i,o} + v_i\xi \to dn_i = v_i d \xi $$
$ \\ $ $$dG = Vdp - SdT + \sum_i \mu_i dn_i \to \left(dG\right)_{P,T} = \sum_i \mu_i dn_i = \sum_i \mu_i v_i d \xi$$
In particular, $$\left( dG/d \xi \right)_{P,T} = \sum_i \mu_iv_i = \sum_i \left(\mu^o_i + RT\ln(a_i)\right)v_i = \sum_i \mu^o_iv_i + RT \sum_i \ln(a_i)v_i = \Delta G^o_r + RT \sum_i \ln(a_i^{v_i}) = \Delta G^o_r + RT \ln\left(\prod_i a_i^{v_i}\right) = \Delta G^o_r + RT \ln(Q)$$
In particular, $$\left( dG/d \xi \right)_{P,T} = \Delta G^o_r + RT \ln(Q)$$
I assert this is where it should stop. It tells you everything you need to know about the direction of spontaneity and the condition for equilibrium. For instance, the condition for equilibrium is that the free energy of the system is at a (local) minimum. To find the minimum of a differentiable function, you set its derivative equal to zero. Thus at equilibrium you have $Q = K$ and $dG/d \xi = 0$. Plugging this in gives $$K = e^{- \Delta G^o_r / RT}$$What I don't understand is how the left side gets equated with $\Delta G$. The left side is $\sum_i \mu_i v_i$. This is not the "instantaneous difference in free energy between the reactants and products". That would be $\sum_i \mu_i n_i$ (assuming such a notion even makes physical sense). I suppose you could call it $\Delta G_r$, but that perspective is confusing and would have no physical significance in the context of this equation (as you are viewing the reagents' concentrations as the variable that is moving as opposed to pressure or temperature).
I'm wondering if I am conceptually missing something?