Why thermodynamics is a logical consequence of information theory