Why must heat supplied in the definition of entropy be reversible? Can't it be irreversible after all it is a state function? The definition of entropy contains the term $Q_\text{rev}$ which means the heat supplied or taken out reversibly. I thought yes it can be after all only the initial & final states are important as entropy is a state function irrespective of the process heat is transferred. However I was baffled when I first read Clausius' theorem where it is written that $dS \geq \dfrac{Q}{T}$. If $Q$ is transferred irreversibly, then $dS$ is greater than $\dfrac{Q_\text{irrev}}{T}$; if the heat transfer is reversible, then only $dS$ equals $\dfrac{Q_\text{rev}}{T}$. So, does that mean entropy depends on the process heat energy is transferred?? Then, how can it be a state function? Where am I mistaking? Please explain.
 A: Suppose you start with a system in some state $P_1, V_1, T_1$ and you add some quantity of heat $\Delta Q$ to it so the system changes to a different state $P_2, V_2, T_2$. The final state will depend on how you added the heat $\Delta Q$. Adding the heat $\Delta Q$ in a reversible process will result in different values for $P_2, V_2, T_2$ compared with adding the same amount of heat $\Delta Q$ in an irreversible process.
Entropy is indeed a state function, so if you know $P_2, V_2, T_2$ you can calculate the entropy change. Since reversible and irreversible processes will result in different values for $P_2, V_2, T_2$ they will also result in different values for the entropy change.
A: For an infinitesimal heat transfer $\delta Q$ the inequality of Clausius states that 
$$\Delta S = S_1-S_0 = \int_0^1 {\dfrac {\delta Q_\text{rev}}{T}} > \int_0^1 {\dfrac {\delta Q_\text{irrev}}{T}}$$ 
Here $\delta Q_\text{rev}$ and $\delta Q_\text{irrev}$ denote reversible and irreversible heat transfers, respectively. Thus if the process is reversible and we know what $\delta Q = \delta Q_\text{rev}$ is at each step then we can calculate the entropy change from the integral $\Delta S = \int_0^1 {\dfrac {\delta Q}{T}} $. But if the process is irreversible the integral $\int_0^1 {\dfrac {\delta Q}{T}}$ only gives a lower bound for the entropy change not the actual change. 
The difference between the entropy change and the integral is the internally generated entropy by the process $$\Delta S - \int_0^1 {\dfrac {\delta Q}{T}} = \sigma_\text{irrev} $$ and is characteristic to it. For example, a resistor $R$ with a dc current $I$ through it and kept at constant temperature in steady state generates $\dot \sigma = \dfrac {I^2R}{T}$ entropy per unit time and sheds the same to its environment along with ${\dot q = I^2R}$ heat flux.
