MaxwellsDemon
Difficulty: hard — 3 definitions, 0 abbreviations, 1 lemmas, 7 theorems.
This file models a control mechanism, in the spirit of a well known thought experiment: a device that inspects two systems and only lets a proposed change happen when it moves information in one chosen direction — shrinking what one side holds while growing what the other holds.
One honest limitation: the device’s own yes/no decision is given size zero in this file’s model — its own record of what it just decided is treated as free. That looks like it lets information move from one side to the other for nothing. The resolution, well known for this exact problem, is that the device’s memory of its past decisions must eventually be cleared out again, and clearing memory out has an unavoidable cost that this file’s model does not yet charge for. gatedFlow’s own conserves field is exactly where that extra cost would have to be added, so this file leaves it as a natural next step rather than claiming to have resolved the paradox.
Landauer’s principle, illustrated on a two-bit memory cell
Cell below is a concrete two-bit memory. Its measure is the constant 2 — its fixed storage capacity, the natural way to size a memory cell, regardless of what it currently holds. eraseSecondBit clears the second bit while consuming and producing nothing (Unit, size 0). conserves holds trivially: capacity never changes, so InformationSystem’s size-ledger sees nothing wrong here at all — no gain, no loss, ever.
Yet the operation cannot be undone: (true, true) and (true, false) both erase to (true, false), so no function can exist that recovers which of the two a given result came from. Because Cell only has finitely many possible values, this loss is not just a coincidence about these two particular values: any function on a finite type that ever collapses two different values together must also fail to reach some other value at all (Finite.injective_iff_surjective) — so cells of the form (_, true) become permanently unreachable once erasure happens. The space of states actually still in use shrinks, a real, countable loss that the constant ‖·‖ := 2 bookkeeping never sees.
This is the formal content of Landauer’s principle: erasing information is not free, even though this file’s size-based bookkeeping stays silent about it. A bookkeeping rule that does register the erasure would have to let the erased side’s measure grow past the fixed 2-bit capacity — for example by letting the output carry the erased bit away, or by allowing some further, unbounded measure (heat, in the original physical story) to absorb it — rather than the fixed, bounded measure used here.
Dependency diagram
Drag to pan, Ctrl+scroll (or Cmd+scroll) to zoom, click a node to jump to it.