#### 4.1. Numerical Simulations

We performed numerical simulations of our contraption immersed in a dilute gas, modeling the collisions between the gas particles and the paddles and blades as Poisson processes. The probability per unit time that a gas particle strikes a particular location of a given paddle or blade was determined by the temperature

T and density of the gas, the angular velocity of the paddle or blade, and the radial location of the point of collision. During a given interaction interval, we simulated the dynamics of the ring and the interacting bit as a sequence of events. Each event was a blade–paddle collision, a paddle–gate collision, or a collision of a gas particle with either the paddle or the blade. After each event, the angular velocity of the blade and/or paddle was appropriately updated, and the next event was generated stochastically using the Gillespie algorithm [

50]. At the end of the interaction interval, the machine underwent a bit renewal, in which the old interacting bit was replaced by a new one, whose angular location

${\theta}_{B}$ and velocity

${\dot{\theta}}_{B}$ were assigned randomly according to the values of

$\delta $ and

T.

The degrees of freedom modeled explicitly in our simulations were the angular orientations of the demon, ${\theta}_{D}$, and the interacting bit, ${\theta}_{B}$. The steady downward motion of the stream of bits and gates was modeled implicitly as a constant interaction interval $\tau $ between bit renewal events, when the interacting bit was replaced by the next bit in line. We did not explicitly model the motion of the non-interacting bit paddles. At the moment of bit renewal, the orientation of the newly arrived interacting bit paddle was generated randomly, according to the logical state (0/1) of the bit. The interaction between the gas particles and the bit paddles or the blades of the demon was modeled as a series of discrete events, with stochastic waiting times that follow a Poisson probability rate determined by the density of the gas particles and velocity of the moving surface (i.e., the paddle or the blade). For each collision event between a gas particle and a paddle or blade, we sampled a random incoming particle velocity, as well as a random location at which the collision occurred along the paddle or blade, from consistently constructed probability distributions. Assuming elastic collisions, we computed the updated angular velocity of paddle or blade immediately after the collision.

A typical step between two events in our event-based simulation can be sketched as follows. First, compute the waiting time until the interacting bit leaves the interaction range of the demon. Then, compute the waiting time until the interacting bit collides with the demon and the waiting time until the demon collides with the gate. Then, generate a random waiting time before a collision occurs between a gas particle and the demon, and the bit, in accordance with the Poissonian probability rate mentioned in the previous paragraph. Finally, choose the event with the shortest waiting time; evolve the bit (with constant angular velocity) and the demon (with constant acceleration) until the moment of this event; and realize the change due to the event (e.g., a collision or a bit renewal). All collisions were taken to be elastic and we assumed that the blades and paddles were made of infinitely thin and rigid mesh materials to avoid secondary collisions with a gas particle. The moment of inertia of both the demon and each bit was set to 0.1. The mass of each gas particle aws also set to 0.1. The effective number density of gas particles was 1.0. The paddle for each bit took the radial range between 0.3 and 0.8 and the blade of the demon took the radial range between 0.5 and 1. The vertical dimension of both the demon and each bit was 1.0. The constant downward speed of the stream of bits was 0.1, thus the interaction interval was $\tau =20$. Energy units were chosen such that ${k}_{B}T=1$.

Figure 7 shows eleven angular trajectories of the angular rotation of the ring,

${\theta}_{D}\left(t\right)$, illustrating the engine mode and the dud mode. The simulations were performed at temperature

${k}_{B}T=1$ and load

$\Gamma =0.05{k}_{B}T$, for eleven different values of the cleanness of the incoming memory bits,

$\delta $. Each simulation lasted for 2000 interaction intervals, representing 2000 incoming bits, with

${\tau}^{\mathrm{int}}=20$. The gates were prepared in the repeating binary sequence “

$...0101101011...$”. In agreement with the arguments of

Section 3, when

$\delta $ is close to 1, the ring undergoes systematic counterclockwise rotation and the ring performs work against the external load, lifting the mass against gravity (engine mode). For less clean incoming sequences, with values

$\delta \le 0.6$, the ring can no longer overcome the external torque and rotates clockwise (dud mode).

To illustrate the eraser mode,

Figure 8 shows four trajectories simulated as in

Figure 7, except that we fix

$\delta =0.2$ and vary the external torque:

$\Gamma \left[{k}_{B}T\right]=0.1,0.15,0.2,0.25$. As expected, the stronger the load is, the faster the ring rotates in the CW direction, leading to more energy dissipated into the heat bath. We found that, for

$\Gamma \ge 0.15{k}_{B}T$, the outgoing sequence is cleaner than the incoming sequence of bits, hence the ring functions as an eraser.

#### 4.2. Analytical Results for the Slow-Moving Limit

Let us now consider the limit of long interaction time

${\tau}^{\mathrm{int}}\to \infty $. In this limit, the behavior of the ring during one interaction interval becomes uncorrelated with its behavior in the next interval. The average work performed by the ring,

W, and the Shannon entropy change of the memory tape,

$\Delta {S}_{L}$, can then be computed analytically and are given by Equations (

7) and (

11). We now sketch the approach that is taken to obtain these results, leaving the technical details to the Appendix.

Letting (

${\theta}_{B},{\theta}_{D}$) denote the instantaneous configuration of the composite system—the interacting bit and the ring—we depict the relevant features of configuration space in

Figure 9, with bold solid lines representing hard wall boundaries. Note that the boundary conditions depend on the state of the reference bit,

$\overline{0}$ or

$\overline{1}$, through the placement of the engaging gate at

$\theta =0$ or

$\theta =\pi $.

During a given interaction interval, the ring and interacting bit undergo random collisions with the surrounding bath particles, while the external load imposes a potential energy contribution

$\Gamma {\theta}_{D}$ that generates a CW torque on the ring. The ring and bit are confined within a single parallelogram-shaped cell in configuration space (see

Figure 9), and the composite system

$({\theta}_{B},{\theta}_{D})$ has sufficient time to relax to equilibrium within this cell. Hence, if the composite system begins within a particular cell at the start of an interaction interval, then at the end of the interval its statistical state is given by a Boltzmann distribution restricted to that cell.

Let us suppose that during the initial interaction interval the composite system is found in one of the two shaded cells depicted in

Figure 9, depending on the state of the reference bit. Let

${p}_{\overline{0}}^{\mathrm{eq}}({\theta}_{B},{\theta}_{D})$ and

${p}_{\overline{1}}^{\mathrm{eq}}({\theta}_{B},{\theta}_{D})$ denote the equilibrium distributions restricted to these two cells. The correlations between

${\theta}_{B}$ and

${\theta}_{D}$ differ in these two distributions, but if we integrate either distribution over

${\theta}_{B}$, then the resulting marginal equilibrium distributions for

${\theta}_{D}$ are identical:

${p}_{D}^{\mathrm{eq}}\left({\theta}_{D}\right)=\int d{\theta}_{B}{p}_{\overline{0}}^{\mathrm{eq}}=\int d{\theta}_{B}{p}_{\overline{1}}^{\mathrm{eq}}$. The distribution

${p}_{D}^{\mathrm{eq}}$ has support in the region

$-\pi \le {\theta}_{D}\le 2\pi $. In the absence of an external load, both

${p}_{\overline{0}}^{\mathrm{eq}}$ and

${p}_{\overline{1}}^{\mathrm{eq}}$ are uniform distributions within the shaded regions, and

${p}_{D}^{\mathrm{eq}}\left({\theta}_{D}\right)$ has the shape of an isosceles trapezoid. In the opposite limit of a strong external load

$\Gamma \gg {k}_{B}T$,

${p}_{D}^{\mathrm{eq}}\left({\theta}_{D}\right)$ is strongly concentrated near

${\theta}_{D}=-\pi $ (due to the Boltzmann factor

${e}^{-\beta \Gamma {\theta}_{D}}$), as the memory bit paddle becomes pinched between one of the ring’s blades and the engaging gate.

At the start of the next interaction interval, the memory and reference bits are replaced, or

renewed, by the arrival of a new paddle and engaging gate. The location of the engaging gate now reflects the new reference bit,

$\overline{0}$ or

$\overline{1}$. The state of the new memory bit,

b, either matches or mismatches the reference bit, with a probability determined by the value of

$\delta $. We can treat the configuration of the incoming memory bit as a random, uniform sample either from the range

$0\le {\theta}_{B}<\pi $ if

$b=0$, or from

$\pi \le {\theta}_{B}<2\pi $ if

$b=1$. This renewal process instantaneously maps the final distribution of the composite system at the end of one interaction interval, into a new initial distribution at the beginning of the next interval, as the variable

${\theta}_{B}$ now refers to the new memory bit rather than the old one. This mapping depends on the state of the new bit, as illustrated in

Figure 10. At the start of a new interaction interval, the bit and ring configurations,

${\theta}_{B}$ and

${\theta}_{D}$, are uncorrelated.

If the machine (bit + ring) is found in cell

$\#k$ during one interaction interval, and if the new, incoming memory and reference bits are correctly matched, then during the next interval it will be found in one of four possible cells, corresponding to a displacement

$\Delta k=-1,0,1$ or 2, as illustrated in

Figure 9 and

Figure 10 for

$k=0$. The probability distribution for

$\Delta k$ is determined by considering how the equilibrium distribution restricted to the initial cell (

$\#k$) is redistributed by the mapping that occurs upon bit renewal. By similar arguments, if the incoming memory and reference bits are mismatched, then the displacement is

$\Delta k=-2,-1,0$ or 1.

The process then repeats itself over the next interaction interval: the probability distribution relaxes to equilibrium within each cell, and then renewal occurs when the new memory and reference bits arrive. Thus, from one interaction interval to the next, we can treat the dynamics of the ring as a discrete time random walk along a lattice of cells, with each step $\Delta k$ sampled randomly from a distribution that depends on whether the incoming memory and reference bits are matched or mismatched. The net result is that $\Delta k$ can range from $-2$ to $+2$, with probabilities determined by the values of $\delta $ and $\Gamma $. On average, each positive (negative) unit increment in k corresponds to CCW (CW) rotation of the ring by half a circle.

Following the considerations discussed above, we have computed the probability distribution for

$\Delta k$ analytically, and from these results we have determined the average work performed by the ring, per interaction interval (see

Appendix A for details):

In the limit of a weak external load, Equation (

7) gives

and the ring acts as an engine when

$\delta >0$, in agreement with the discussion in

Section 2.3.

In the opposite limit of strong external load, we get

hence

$W<0$, as expected. As a consistency check on Equation (

7), both of the limiting cases represented by Equations (

8) and (

9) can be verified by directly calculating the average displacement of

${\theta}_{D}$ per period, resulting from the renewal mapping illustrated in

Figure 9 and

Figure 10.

Additionally, we can compute the fractions of bit–gate agreement and disagreement in the outgoing tape:

In the limit of a strong external load (

$\Gamma \gg {k}_{B}T$), virtually all outgoing bits will be forced to match the reference bits, as each bit paddle becomes pinched between then ring’s blade and the engaging gate (see

Section 3.2). Per interaction period, the change of the Shannon entropy of the memory tape with respect to the gate is

where recall that the variable

$L=B\mathrm{Exy}G$ is the Boolean equality between the state of the bit and the state of the gate (see

Section 2.2).

Combining Equations (

7) and (

11), we obtain (see

Appendix B for details)

where

${D}_{KL}\ge 0$ is the Kullback–Leibler divergence [

51] between the incoming and outgoing bit distributions. Since

$x/tanh\left(x\right)>1$ for all

$x\ne 0$, Equation (

12) implies

which is a strict inequality when

$\Gamma \ne 0$. Because the work

W is equal to the average energy extracted from the heat bath, per bit, the term

$-W/T$ represents the net change in the thermodynamic entropy of bath. As a result, Equation (

13) can be viewed as a statement of the second law of thermodynamics: the sum of the entropy changes of the bit stream and heat bath must be non-negative. Notice that this interpretation relies on treating the information content of the bit stream (multiplied by

${k}_{B}$) as a genuine thermodynamic entropy, on par with the Clausius entropy.

Equation (

13) suggests natural definitions of the machine’s thermodynamic efficiency in both the engine and the eraser mode. When the ring functions as an eraser, we have

and the efficiency is defined as

When the ring functions as an engine,

and the efficiency is defined as

When the ring functions in the dud mode, $W<0<{k}_{B}T\Delta {S}_{L}$.

In

Figure 11, we plot the thermodynamic efficiency over the phase diagram of the machine. By definition

$\eta >0$ within the regions corresponding to the engine and eraser modes, but

$\eta $ drops to zero at the boundaries of these regions, where the ring becomes a dud. For example, a point on the boundary of the engine mode, with

$\delta ,\beta ,\Gamma >0$, represents a stalled state. Here, the ring generates just enough CCW torque to match the CW torque exerted by the external load (hence

$W=0$), nevertheless there is a positive rate of entropy generation in the bit stream (

$\Delta {S}_{L}>0$). If the load

$\Gamma $ is decreased by a small amount, then the ring will produce a slight CCW rotation, resulting in an engine with very low efficiency.

#### 4.3. Second Law of Thermodynamics in the Slow Moving Limit

We obtained Equation (

13) from our exact solution of the dynamics in the slow-moving limit, but the result has the character of a generalized, information-theoretic second law of thermodynamics (as already mentioned), and its validity may extend to finite values of

${\tau}^{\mathrm{int}}$. While it is difficult to establish this validity from first principles, we can make some progress by ignoring correlations (of any sort) from one interval to the next, as we do in the following statistical treatment in which the variables

B and

G are treated as

information-bearing degrees of freedom [

52].

At the start of an interaction interval, let ${P}_{BG}^{in}(b,g)$ denote the joint probability to find the memory bit in state $b\in \{0,1\}$ and the reference gate in state $g\in \{\overline{0},\overline{1}\}$, and let ${P}_{B}^{in}\left(b\right)$ and ${P}_{G}^{in}\left(g\right)$ denote the corresponding marginal distributions. Let ${S}_{BG}$, ${S}_{B}$ and ${S}_{G}$ denote the Shannon entropies of these distributions.

Then,

where

is the

mutual information [

53] between the bit and gate states. Defining similar quantities for the outgoing states, the net change in the combined entropy over one interaction interval is

where

$\Delta {S}_{BG}={S}_{BG}^{out}-{S}_{BG}^{in}$, etc. Since the state of the gate remains fixed, we have

$\Delta {S}_{G}=0$, whereas both

${S}_{B}$ and

${I}_{BG}$ typically change during the interaction interval.

We have used the variables

B and

G to specify the combined state of a memory and reference bit, but we could equally well specify this state using the variables

L and

G, leading to

where

$\Delta {S}_{LG}$,

$\Delta {S}_{L}$ and

${I}_{LG}$ are defined as above, but with

L in place of

B.

The Hamiltonian analysis of Ref. [

29] (see in particular Equation (

47) therein) suggests that the change in the Shannon entropy of the information-bearing degrees of freedom

B and

G obeys a generalized second law of thermodynamics:

$W/{k}_{B}T\le \Delta {S}_{BG}$. Combining with Equation (

21) gives us

Here, we have used our assumption that incoming mismatches are statistically uncorrelated with the state of the gate (

Section 2.2) to set

${I}_{LG}^{in}=0$. Since mutual information is non-negative, Equation (

22) immediately implies Equation (

13), but note that Equation (

22) provides a stronger bound than Equation (

13). In effect, if correlations develop between the reference gate

G and the logical state

L, then these correlations represent an “unused” information-thermodynamic resource. In the slow-moving limit, these correlations vanish since the demon and bit fully equilibrate, hence Equation (

22) reduces to Equation (

13) in that limit.