Liouville's theorem & the second law of thermodynamics

In classical mechanics, Liouville's theorem states that the phase space density of a system evolving under some Hamiltonian remains constant in time. It is a straightforward proof using Hamilton's equations of motion. In thermodynamics, we have the sacred second law of thermodynamics that states that the entropy of an ergodic system (a system that goes to som equilibrium after long time) increases with time. The entropy is defined as the logarithm of the number of microstates accessible to a system. In the phase space language, the logarithm of the phase space volume gives the entropy. Thus the second law wants the phase space volume to increase but the Liouville's theorem says that this volume should be conserved. So how do we reconcile these two?

Fortunately, there is a way to reconcile these two laws. What comes to our rescue is our inability to ever make infinitely precise real world measurements. Let's imagine some closed ergodic system purely evolving under some Hamiltonian. Since the system is ergodic, eventually it should thermalize internally and come to some sort of smooth equilibrium state that maximizes entropy. At the same time, the Liouville's theorem applies and the system's phase space volume should be the same. The picture below shows a way where both of these things can happen.


The system initially starts out in a low entropy state with some confined phase space volume. As the system evolves in time, the phase remains constant in volume but spreads out into the phase space in a lot of thin filaments. These filaments can get infinitely thin with time, but summing the area of all the thin filaments still gives the original phase space volume. Remarkably, at the same time, a physical measurement of this system would lead to a conclusion that it now occupies a much larger phase space and hence has a greater entropy than what it started out with. Our physical measurements are not infinitely precise and thus we cannot distinguish this mesh of very thin filaments versus a near uniform filling of the phase space. In fact, it is not even physically relevant. In a real world scenario, a uniform phase space gives the same level of measurement information as the precise volume conserved phase space made of extremely thin filaments.

I find it very interesting in how this is intimately related to chaos. Chaotic systems are the ones which are ergodic and go to thermodynamic equilibrium by maximizing entropy. The deformation of a phase space volume into a mesh of thin filaments is also a consequence of chaos. And ultimately that reconciles the Liouville's theorem with the second law of thermodynamics.