Question about description of Gibbs free energy When introduced to the gibbs free energy, it was derived as follows:
First law: $dU=dq+dw$
Second law: $dS>dq/T$ for a spontaneous change.
Note $dq$ and $dw$ are inexact differentials.
Subsituting $dq=dU-dw$, into the second law gives us:
$TdS>dU-dw$
using $dw=-P_{ext}dV$
$Tds>dU+P_{ext}dV$
or,
$dU+P_{ext}dV - TdS<0$
Now, keeping pressure and temperature constant, we can say that:
$dU+P_{ext}dV - TdS<0$
= $d(U+P_{ext}V - TS)<0$ 
= $dG<0$, where $G$ is the gibbs free energy.
Here is my problem.
A few lectures later when we were being introduced to the idea of chemical potential, the gibbs free energy was re written as a function of pressure and temperature in the following way.
$dG=Vdp-SdT$, this expression was derived using the result above. My question is that if pressure and temperature were constant in the above expression, isnt $dp$ and $dT$ always 0? If so, how is this a valid expression of $G$?
 A: G is not defined by the equations you wrote.  For a pure substance or a mixture of constant chemical composition, it is defined by $$G=U+PV-TS$$And this equation applies only to thermodynamic equilibrium states.  So, $$dG=dU+PdV+VdP-TdS-SdT$$But since $dU=TdS-PdV$ we are left with $$dG=-SdT+VdP$$
A: I'm going to call a thermodynamic transformation that's both isothermal and isobaric a $TP$ transformation for convenience.
Let's say we have an irreversible $TP$ transformation $A$ (with $T=T_0$ & $p=p_0$) that starts from state $1$ and ends at state $2$.
$$\text{State 1 : }p_1=p_0 \;|\;T_1=T_0 \;|\;V_1\;|\;S_1\; |\; G_1=U_1+p_1V_1-T_1S_1$$
$$\text{State 2 : }p_2=p_0 \;|\;T_2=T_0 \;|\;V_2\;|\;S_2\;|\;G_2=U_2+p_2V_2-T_2S_2$$
$$\text{For an irreversible isothermal process (Second Law) : }Q_A \leq T_0 (S_2-S_1) \tag{1}$$
$$\text{For an irreversible isobaric process : }W_A=p_0(V_2-V_1)\tag{2}$$
$$\text{First Law of Thermodynamics : }\Delta U = U_2 - U_1 = Q_A - W_A \tag{3}$$
$$\Delta G=G_2-G_1=\Delta U + p_0(V_2-V_1)-T_0(S_2-S_1)=Q_A-W_A+W_A-T_0(S_2-S_1)$$
$$ \Rightarrow \Delta G \leq 0$$
$$\Delta U=\int_{1|\text{process O}}^2(TdS-pdV) \text{ holds iff the process O from state $1$ to state $2$ is reversible} \tag{4}$$

$$\underline{\text{The Subtle Detail}}$$
Given transformation $A$ exists, it is not guaranteed that there must also exist a reversible $TP$ process (with the same $T_0$ and $p_0$) that connects the same initial and final states. However, if there exists a reversible $TP$ transformation $B$ (with the same $T=T_0$ & $p=p_0$) that goes from state $1$ to state $2$, then
$$\Delta U \stackrel{\text{Eq. $(4)$}}= \int_{ 1|\text{process B}}^2(T_0 dS - p_0 dV)= T_0(S_2-S_1) - p_0(V_2-V_1) \tag{5}$$
$$\stackrel{\text{Follows from Eq. $(2),(3)$ and $(5)$}}\Rightarrow Q_{\text{over any $PT$ transformation (can be either reversible or irreversible)}}=T_0 (S_2-S_1)$$
$$\Rightarrow \Delta G=0$$
