# Change in Entropy for Irreversible Processes

I was following along in my Thermodynamic textbook and began playing with some definitions. In the following formulation, I somehow managed to prove (obviously incorrectly) that $dq = TdS$ for even irreversible processes. I was hoping someone could point out where in the proof I'm going wrong.

First, consider a both reversible and adiabatic process.

Since $dw = -p_{ext}dV$ for all processes and $dq = 0$ for adiabatic processes: $dU = -p_{ext}dV$

We also know for a reversible and adiabatic process, U is a function of V only and not S, so: $dU = \frac{∂U}{∂V}dV$

Setting the coefficients equal: $\frac{∂U}{∂V}=-p_{ext}$

This equation involves only state variables and is therefore valid for all process, reversible or irreversible.

Next consider a general process (either reversible or irreversible).

As before $dw = -p_{ext}dV$ but now U is a function of S and V, so: $dq = dU - dw = (\frac{∂U}{∂S}dS + \frac{∂U}{∂V}dV) - (-p_{ext}dV)$

Simplifying: $dq = \frac{∂U}{∂S}dS + \frac{∂U}{∂V}dV + p_{ext}dV$

Finally, since we know $\frac{∂U}{∂V}=-p_{ext}$, the last two terms cancel, leaving: $dq = \frac{∂U}{∂S}dS = TdS$ for any processes, reversible or irreversible.

But clearly, this is not true since $dq >TdS$ for irreversible processes.

At which point, then, should I have needed to invoke irreversibility?