In thermodynamics, the first law is
$$dU = \delta Q - p dV$$
Now, second law of thermodynamics say
$$\delta Q \le T dS$$
where equality is for reversible processes. So by combination I get
$$dU \le T dS - p dV$$
But in many cases the equation is written generally as
$$dU = T dS - p dV$$
without taking care about reversibility.
If U is to be defined as a function of S, V, there must be the equality, because dU is a total derivative. But on the other hand, taking into account that $\delta Q/T \le dS$, the first form also give sense. So those two are somehow contradicting.
Which one is correct?
In some of my textbooks the first variant is first introduced, but suddenly it is written with the equality without notice.
**** EDIT 1 ****
This is an example I want to discuss:
Lets say I have an isolated vessel with an ideal gas in a state with T, p, V. When I open a door so that the new Volume is V+dV, with new new volume dV initially in vacuum, after some while I have a new equilibrium state where the gas occupies the new total volume. No heat can be exchanged and no external work is done.
The end state is an equilibrium state with
p, T, V+dV
(T must stay constant because U doesn't only depend on T and U stays constant, because there is neither heat nor extern work.
Using entropy change of ideal gas
$$dS = C_v/T \cdot dT + nR/V \cdot dV$$
we would get
$$TdS = nRT/V\cdot dV = pdV$$
and
$$dU=TdS-pdV = 0$$
This is what I expect: $dU=0$
Interestingly I used an irreversible process to come from the initial state to the end state, but the equal sign seems to be valid in $dU=TdS-pdV$. Surprising, because I thought all the time, I have to use inequality for irreversible processes.
So is it correct to say, that the exact kind of the process that drives me from from initial state I to the end state E is not relevant at all and it can even be irreversible as long as I and E are equilibrium states? So the process used has nothing to do with the state?
$$dU = d'Q+d'W$$ is a process equation whereas $$dU = TdS-pdV$$ is a state equation, independent of process?
Moreover I observe:
$$TdS = nRT/V \cdot dV > dQ = 0$$
$$TdS > dQ$$
and from
$$dU = dQ + dW$$
$$pdV > dW$$
So wouldn't it better instead of
$$dU \le TdS -pdV$$
to say
$$dU = TdS -pdV$$
$$dQ \le TdS$$ $$dW \le pdV$$
because this does not mix up process variables with state variables?