{'fraction_non_alphanumeric': 0.03357883899580265, 'fraction_numerical': 0.009048071592618992, 'mean_word_length': 4.502069716775599, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Entropy production from stochastic dynamics in discrete full phase space

The stochastic entropy generated during the evolution of a system interacting with an environment may be separated into three components, but only two of these have a non-negative mean. The third component of entropy production is associated with the relaxation of the system probability distribution towards a stationary state and with nonequilibrium constraints within the dynamics that break detailed balance. It exists when at least some of the coordinates of the system phase space change sign under time reversal, and when the stationary state is asymmetric in these coordinates. We illustrate the various components of entropy production, both in detail for particular trajectories and in the mean, using simple systems defined on a discrete phase space of spatial and velocity coordinates. These models capture features of the drift and diffusion of a particle in a physical system, including the processes of injection and removal and the effect of a temperature gradient. The examples demonstrate how entropy production in stochastic thermodynamics depends on the detail that is included in a model of the dynamics of a process. Entropy production from such a perspective is a measure of the failure of such models to meet Loschmidt's expectation of dynamic reversibility.


I. INTRODUCTION
Entropy production is a measure of the irreversibility of a thermodynamic process: the difficulty, even impossibility of reversing the observed, often macroscopic behaviour of a system that exchanges heat or matter with a complex environment. The apparent breakage of time reversal symmetry associated with thermodynamic irreversibility has attracted discussion for more than a century. It was given a particular focus by Loschmidt's views on Boltzmann's work in gas dynamics [1] but the issue was apparent far earlier in the contrast between Fourier's law of heat flow and Newton's laws in mechanics. But in spite of such concerns, the concept of entropy generation in the thermodynamics of large systems has been developed and applied widely, to the extent that equations for macroscopic entropy generation and transport associated with nonequilibrium hydrodynamic and thermal flows are available, for example see [2][3][4].
However, a microscopic understanding of the nature of entropy and its production has proved elusive, particularly with regard to understanding the one-way character of the second law. But some considerable steps forward have been made by modelling the microscopic evolution of a system and its environment using a framework of stochastic dynamics [5] and stochastic thermodynamics [6][7][8]. Such an approach explicitly breaks time reversal symmetry through the use of a simplified model of the interactions between system and environment, a consequence of coarse-graining, such that a second law can emerge naturally. Nevertheless, it is imperative to define entropy in this framework in such a way that makes contact with results known to hold macroscopically. Entropy is often interpreted as a measure of uncertainty at the microscopic level, and the viewpoint offered by stochastic thermodynamics is that its overall production is a reflection, according to some views verging on the tautological [9], of the uncertain or stochastic dynamics that drive the evolution, though other interpretations based on deterministic dynamics exist as well [10][11][12].
The stochastic approach suggests that a change in thermodynamic entropy, satisfying the second law, is an expectation value, or more simply the mean, of the change in a microscopic, path-dependent entropy that evolves stochastically in line with the dynamical model of the evolution of the system [6][7][8]. This view allows us to consider entropy as an instantaneous microscopic property of a system and its environment, based on assignments of probabilities to each of the available microstates, but with the potential to increase or decrease during the process in question. This confers meaning to the entropy change that follows from a single realisation of a process, and avoids associating entropy production only with some sort of average over many realisations. It is only after such an averaging procedure that the total entropy is expected to increase. Thus realisations that reduce entropy are quite possible: the second law within this framework quite clearly holds only in a statistical sense.
In detail, the entropy change associated with a specific evolution of a system, referred to as a trajectory or path, is defined in stochastic thermodynamics in terms of the probability that the path might be realised under the prevailing 'forward' dynamics, driven by a forward protocol of time dependence, and the probability of realisation of a path that represents the reversal of the first, under the same dynamical rules but driven by a reversed protocol [13][14][15][16][17]. This definition strongly associates the concept of entropy change with that of dynamical irreversibility. When the system state is described in a full phase space of spatial and velocity variables, or indeed any set that includes variables that change sign under time reversal, the reversed path clearly corresponds to a set of points in phase space that retraces the sequence of spatial positions, but with velocity coordinates that are inverted. It should be noted that the sequence where the velocities are not reversed is sometimes inaccessible under the given dynamics. The probability of the starting configuration for the reversed path is specified to be that which is generated from the forward process. Such a specification produces a path-dependent entropy change that satisfies a number of requirements (see, for example, [18]).
These issues have recently been explored in the context of a master equation describing the evolution of system probabilities over a discrete full phase space [19], and for the stochastic dynamics of continuous coordinates that transform differently under time reversal [20]. It has been established that the total pathdependent entropy change for such cases may be divided into three components, only two of which, together with the sum of the three, are expected to be non-negative on average. In this paper we analyse a number of examples involving a discrete full phase space, in order to provide a greater appreciation of this division of entropy production, and to reflect on the meaning of entropy production when the dynamics of a system and its environment are considered at various levels of detail under coarse-graining. We begin with a summary of the division of path-dependent entropy production into its components, before discussing particle drift and diffusion, flow brought about by injection and removal, and the transport of heat brought about through interaction of the particle with a temperature gradient. We end with some conclusions and remarks on how entropy production, defined within a framework of stochastic thermodynamics, in essence quantifies the failure of Loschmidt's expectation of time reversal symmetry and dynamical reversibility for a given set of circumstances.

II. FORMALISM OF ENTROPY PRODUCTION
Consider a particle that can occupy one of L discrete spatial positions X i in one dimension, and assume one of M discrete values of velocity V m . The particle can make stochastic transitions between phase space points (X i , V m ) ≡ (i, m). We define the forward dynamics in terms of a transition rate T (i ′ , m ′ |i, m) characterising a move from (i, m) to (i ′ , m ′ ), such that the probabilities of occupation of the phase space points P (i, m, t) evolve according to the Markovian master equation where the notation T (i, m|i, m) represents the total rate of transitions from point (i, m): These dynamical rules can be employed to generate stochastic paths of a particle across the discrete phase space. Master equation treatments of dynamics in a discrete phase space of velocities as well as positions have a long history [21,22]. Stochastic entropy production is associated with the probabilities of dynamically generating a path and its reverse, and in a phase space with coordinates that change sign under time reversal, such as a velocity, the reversal of a path naturally requires an inversion of those coordinates. This is indicated in Fig. 1, where we denote a path by the sequence of phase space points x ≡ {x 0 , · · · , x k , · · · , x N }, each point represented by the coordinates (X i , V m ). A particle resides at point x k in the time interval t k ≤ t ≤ t k+1 such that the duration of the path is from t 0 to t N +1 . The reversed sequence of spatial coordinates and inverted velocity coordinates, visited for a reversed sequence of intervals and denoted x † ≡ {εx N , · · · , εx k , · · · , εx 0 }, where ε indicates the change in sign of the velocity coordinate (such that εX i = X i and εV m = −V m ), is the appropriate path to use in defining the total entropy change associated with path x: in units of the Boltzmann constant, where P F (x) and P R (x † ) are the probabilities that the sequences x and x † are generated. Explicitly, the path probability P F (x) may be written where P (x 0 , t 0 ) is the probability that the system resides at x 0 at the initial time t 0 , and T (x j+1 |x j ) is synonymous with T (i j+1 , m j+1 |i j , m j ). The path probability is a product of component probabilities of residence and transition. P R (x † ) is constructed similarly, but the initial distribution is specified to be that which generated by all possible paths corresponding to the forward process, namely the solution to Eq. (1) at t = t N +1 starting from a distribution corresponding to P (x 0 , t 0 ). The superscripts refer to the time dependence of the transition rates: a forward protocol of time dependence is signified by an F, and R denotes the reversal of this dependence [19]. For the systems under consideration in this paper, the distinction has no meaning since for simplicity we assume the rates to be time-independent, though for clarity the labels are retained. The definition of entropy change according to Eq. (3) is compatible with other treatments based on master equations [17,23]. Fig. 1 indicates two further paths that are related to x, the probabilities of which are to be established using a set of transition rates T ad known as adjoint dynamics [15,24], and given by where the P st (i, m) are the phase space probabilities in the stationary state, which is by definition Figure 1. The phase space coordinate sequence x, with its associated set of residence times, and its time-reversed counterpart x † , both shown on the left, can be generated by the forward dynamics. The probabilities of each are used to define the total entropy production ∆Stot of the path x. The probabilities of a further two paths x R and x T , shown on the right on the same grid, are considered according to adjoint dynamics, and serve to define contributions ∆S1 and ∆S2.
the same for both forward and adjoint dynamics. The adjoint dynamics are designed to generate a flux of probability in the stationary state that is opposite to that which arises from the forward dynamics. Path x R ≡ {x N , · · · , x 0 } is the explicit reverse sequence of points, without velocity inversion, and x T ≡ {εx 0 , · · · , εx N } is the forward sequence of spatial points but with inverted velocities. These paths allow us to define path-dependent entropy change-like quantities where P ad,R (x R ) is the probability of generating the path x R under a reversed protocol of time dependence of the transition rates of adjoint dynamics, and in a similar notation, where P ad,F (x T ) is the probability of generating the path x T under adjoint dynamics with a forward protocol of time dependence. These quantities each satisfy an integral fluctuation relation exp(−∆S tot,1,2 ) F = 1, where the brackets and superscript denote an average over all paths generated by the forward dynamics from a given distribution of initial coordinates, which implies that the expectation values of ∆S tot , ∆S 1 and ∆S 2 over the forward dynamics are never negative [15,16,[24][25][26]. Furthermore, for paths taken by a system when in a stationary state, ∆S 1 is identically zero: it then consists of a sum of changes to system and environmental or medium entropies that cancel [19,26]. The forms taken by ∆S 1 , ∆S 2 and ∆S tot imply that we can represent the total entropy change as a sum of three components: ∆S tot = ∆S 1 + ∆S 2 + ∆S 3 . In contrast to the other terms, the path average of the contribution does not have a fixed sign: however the average of this quantity in a stationary state is zero. Note that the total entropy production in stochastic thermodynamics may also be divided into the components corresponding to changes in the entropies of the system and surrounding medium, respectively [6,7], and furthermore that the latter can be divided into 'housekeeping' and 'excess' contributions ∆S med = ∆S hk + ∆S ex according to the descriptive scheme for nonequilibrium processes proposed by Oono and Paniconi [27]. The correspondence with the present division of entropy change is ∆S 1 = ∆S sys + ∆S ex and ∆S 2 + ∆S 3 = ∆S hk . The terms ∆S 2 and ∆S 3 may be designated the generalised and transient housekeeping contributions to entropy production, respectively [19]. ∆S 1 and ∆S 2 can also be mapped, respectively, onto the nonadiabatic and adiabatic entropy productions of Esposito and Van den Broeck [16], but only for systems described by coordinates that are even under time reversal, or for which the stationary state is symmetric in odd variables. We can write ∆S 1 in terms of the time dependent phase space probabilities P (i, m, t), more compactly denoted P (x k , t), that satisfy the master equation (1) and an appropriate initial condition, together with the corresponding distribution in the stationary state, P st (x k ), as follows: (10) It is useful to associate each term with features of the path. The first sum represents contributions due to residence at x j in the periods t j ≤ t ≤ t j+1 and the second relates to transitions from x j to x j+1 at time t j+1 . Similarly, we can write ∆S 2 in terms of the transition rates T and the stationary probabilities P st (x k ): Again, the first sum may be viewed as contributions due to residence at point x j for a period t j+1 − t j , and the second sum may be associated with the transitions. Finally, we write which is a sum of contributions associated with the transitions. Clearly ∆S 3 vanishes if none of the phase space coordinates change sign under time reversal (εx j = x j ) or if the stationary state is symmetric in odd variables (P st (x j ) = P st (εx j )).
The entropy production associated with a specific path is straightforward to compute from the elementary contributions arising from residence and transition. The path x in Fig. 1, for example, consists of residence at four points and three transitions between them: both ∆S 1 and ∆S 2 are therefore sums of seven terms, while ∆S 3 is a sum of only three.
The meaning of the above formalism is explored next using simple stochastic systems that involve velocity as well as spatial coordinates on a discrete grid. The systems are easier to analyse than those described by dynamics in continuous coordinates, and so we can readily calculate contributions to entropy production, both for individual paths and when averaged over all possible paths, and understand better their distinct physical origins, properties and meaning.

III. ASYMMETRIC TELEGRAPH PROCESS
The telegraph or Kac process is a well known example of stochastic dynamics on a phase space involving both position and velocity [28]. For our purposes, it is best understood as an elaboration, in the following way, of a standard asymmetric random walk in one dimension. At times separated by a fixed interval of length ∆t, a particle chooses the direction of its next step to be to the right or left with probabilities (c + a)/2c and (c − a)/2c, respectively, with c ≥ 0 and −c ≤ a ≤ c. It then spends the subsequent interval ∆t performing the move at a constant speed. The position and direction of motion of the particle are recorded halfway through each timestep. At the next recording, the particle will have either returned to its previous position but with the opposite velocity, having reversed its direction of motion in between, or will have moved to an adjacent spatial position without having changed its direction. These events may be modelled using a master equation of the form given in Eq. (1) evolving the probabilities P (i, ±, t) that the particle should assume position X i and velocity ± at time t, and with the rates We assume spatially periodic boundary conditions, such that the stationary phase space probabilities are P st (i, ±) = (c ± a)/(2cL). Notice that a/c plays the role of the dimensionless nonequilibrium constraint parameter in this example: if it were zero, then Contributions to path-dependent housekeepingtype entropy production in an asymmetric telegraph or Kac process. A particle follows a random walk in one spatial dimension with periodic boundary conditions, on a phase space defined in terms of position Xi and direction of motion ±. The transition rates T in the appropriate master equation are shown, together with values of ∆S2 and ∆S3 specific to each step.
the stationary state would be symmetric in velocity and detailed balance in the sense of We have all the ingredients needed to compute the entropy production. A section of the phase space and the contributions to the housekeeping-type entropy changes ∆S 2 and ∆S 3 made by each of the four distinct transitions are shown in Fig. 2. There are no contributions to ∆S 2 from residence at each site in this example, since T ( The contributions to ∆S 1 depend on the P (i, ±, t) and are not shown in the diagram for reasons of clarity.
For a given path followed by a particle across the phase space, it is clear from the diagram that the contribution to ∆S 3 depends solely on whether the velocity has changed sign. The distribution of ∆S 3 over an ensemble of paths generated by the dynamics is therefore trimodal on the values ±2 ln[(c + a)/(c − a)] and zero. In contrast, the distribution of ∆S 2 depends on the net spatial displacement from the initial position, as well as whether the velocity has changed sign, and is broader, but still discrete in units of To illustrate this, let us introduce test case A: evolution from an initial distribution with P (K, +, 0) = 1, for a specified K, and P (i, ±, 0) = 0 for all other points. From consideration of the changes to ∆S 2 associated with each transition in Fig. 2, we can deduce that if the particle is found at point X K+k + at time t, having reached it by any path with a winding number around the periodic boundaries of zero, then the accumulated ∆S 2 is equal to k ln[(c+a)/(c−a)]. Similarly, if the particle has reached point X K+k − the accumulated ∆S 2 is (k−1) ln[(c+a)/(c−a)]. The probabilities P (K + k, ±, t) are straightforward to obtain from the master equations (13), and for early times are dominated by contributions with zero winding number. As an illustration, we solve Eqs.  the given initial condition, and provide a histogram of the resulting distribution P (∆S 2 ) in Fig. 3. The distribution can be used to verify the expected integral fluctuation relation exp(−∆S 2 )P (∆S 2 ) = 1. Furthermore, it satisfies a detailed fluctuation relation P (∆S 2 ) = exp(∆S 2 )P (−∆S 2 ). In contrast, the distribution of ∆S 3 for test case A is P (∆S 3 = 0) = 0.825, P (∆S 3 = 2 ln 3) = 0.175, corresponding to the summed probabilities of positive and negative velocity states, respectively, for these conditions, and does not satisfy either fluctuation relation.
An illustration of the stochastic evolution of ∆S 1 may be obtained by considering a transition between stationary states brought about by a change in sign of the parameter a (from negative to positive) at t = 0. The master equations are readily solved to give and using these we can identify the contributions to ∆S 1 that arise from residence and transitions between phase space points: where ∆t is the residence period. There are no contributions for transitions without a change in direction. These supplement the assignments given in Fig.  2 and using paths generated by Monte Carlo simulation, can be employed to obtain probability distributions P (∆S 1 ), P (∆S 2 ) and P (∆S 3 ) associated with such an evolution away from a stationary state. We . Probability distributions of the entropy production ∆S1, ∆S2 and ∆S3 accumulated in the period 0 ≤ t ≤ 0.5 for test case B: evolution away from a stationary state of the asymmetric telegraph process for t < 0 with a = −1 and c = 2, induced by setting a = 1 for t ≥ 0. The entropy production is given in units of ln 3. Note that the distribution for ∆S1 is continuous whilst those for ∆S2 and ∆S3 are discrete. explore this by introducing test case B with c = 2, a = −1 for t < 0 and a = 1 for t ≥ 0, and illustrate the entropy generating behaviour in Fig. 4. Probability distributions are determined for elapsed time t = 0.5 and can be used to verify that P (∆S 1 ) and P (∆S 2 ) satisfy an integral fluctuation relation. Furthermore it may be shown that P (∆S 2 ) satisfies a detailed fluctuation relation.
Next we consider the mean value of each component of entropy production. Clearly, if a = 0 there is a nonequilibrium stationary state with an overall probability current directed spatially to right or left depending on the sign of a. The stationary state is then asymmetric in the velocity coordinate and breaks detailed balance. The mean rate of entropy production d ∆S 2 /dt is a sum of transition-specific contributions weighted by the phase space probabilities and transition rates, and with reference to Fig. 2 it is given by Note that there are no terms associated with residence. The form of this expression indicates that d ∆S 2 /dt is never negative, consistent with the integral fluctuation relation. It is also time independent, whether the system is in the stationary state or relaxing towards it, and its magnitude depends on the condition for the breakage of detailed balance a = 0. We deduce that ∆S 2 = 2a ln[(c + a)/(c − a)]t and this result may be confirmed explicitly for the distribution in Fig. 3 for test case A, and the distribution in Fig. 4 for test case B. The rate d ∆S 3 /dt may be computed similarly: This expression has no bounds on its sign, but it vanishes in the stationary state when P (i, ±, t) = P st (i, ±) = (c ± a)/(2cL). It can be integrated for the conditions of test case A to obtain ∆S 3 = 0.35 ln 3 at t = 0.3, which is compatible with the distribution of ∆S 3 reported earlier. And for the evolution away from a stationary state caused by switching the sign of a, we can insert Eq. (14) into Eq. (17) to obtain Finally, we consider the increment δ ∆S 1 over an increment in time δt using Eq. (10): Figure 5. Mean rates of entropy production against time for test case B: a transition between nonequilibrium stationary states of the asymmetric telegraph process. The initial state is characterised by c = 2 and a = −1 and a total mean rate of entropy production equal to 2 ln 3.
At t = 0 the parameter a changes instantaneously to +1, and the mean rate of change of ∆S1 (thin solid line), ∆S2 (dashed) and ∆S3 (dotted) evolve as shown. The mean rate of total entropy production (thick solid line) decreases temporarily but is eventually restored to its initial value.
Using the P (i, ±, t) from Eq. (14) for the transition between stationary states, and considering terms to first order in δt, we obtain d ∆S 1 /dt for such situations: The three mean contributions together with their sum d ∆S tot /dt are shown in Fig. 5 for test case B. The two transient contributions d ∆S 1 /dt and d ∆S 3 /dt cancel initially, but their differing time dependence apparent in Eqs. (20) and (18) gives rise to a shortlived reduction in the mean rate of total entropy production as the transition proceeds. The system reorganises itself until the initial mean rate of entropy production is restored. The integrals of the curves between t = 0 and t = 0.5 correspond to the means of the distributions in Fig. 4.
It is instructive to contrast this behaviour with the mean entropy production associated with the asymmetric random walk when described in terms of spatial position alone. An appropriate master equation for probabilities P (i, t) on a spatial grid with periodic boundaries can be constructed using transition rates to right and left of (c + a) and (c − a) respectively. The stationary probabilities are P st (i) = L −1 and a transition between stationary states brought about by a change in sign of a does not disturb them. Hence d ∆S 1 /dt and d ∆S 3 /dt are zero and the total mean rate of entropy production corresponds to d ∆S 2 /dt, which arises from contributions to ∆S 2 of ln[(c + a)/(c − a)] for a step to the right, and of ln[(c − a)/(c + a)] for a step to the left. The mean rate of total entropy production in a stationary state is hence as before and is independent of time. Clearly the transition between stationary states is not now accompanied by a change in the mean rate of total entropy production. The reorganisation of probability with respect to the velocity coordinate is neglected at this level of description of the dynamics, and the time dependence in the mean rate of total entropy production seen in the more detailed description in Fig. 5 cannot be appreciated. The example serves to demonstrate that entropy production depends upon the chosen level of coarse graining: it is after all a measure of the irreversibility of a dynamical system, and perceived irreversibility will depend on the detail employed in modelling the dynamics.

IV. DIFFUSION AND BARRIER CROSSING
We elaborate the telegraph process now to illustrate the generation of entropy associated with the diffusion of a particle across the spatial extent of a system driven by a chemical potential gradient. We consider the asymmetric random walk of a particle, as represented by the telegraph process, but with a = 0 for now, and for a system with reflective boundaries. The latter condition implies that the probability of a change in direction is unity when a particle is incident upon a boundary, such that we should modify the transition rates in those circumstances. This is illustrated in the upper part of Fig. 6 for a system with L = 10 spatial points. Transitions occurring at a rate c are indicated with standard size single-headed arrows. The double-headed arrows at positions i = 1 and 10 represent reflections at the boundaries and correspond to transition rates of 2c. In the absence of further processes, it is clear from counting the rates of gain and loss at each point that the stationary phase space probabilities for such a system are uniform both in position and velocity: an equilibrium state corresponding to zero mean entropy production. Now consider transfers of a particle into and out of the system. Physically, we can imagine the insertion and removal taking place at the spatial boundaries to the left and right of the diagram. In order to include the situation where the physical system is empty, we create an additional phase space point available to the particle, but without spatial or velocity coordinates. We allow the insertion of a particle from this point into physical phase space points corresponding to inwardly directed motion at the extreme left and right hand positions, as shown by block arrows in Fig. 6. The rates of insertion are z L and z R , respectively, and such rates appear in the relevant master equations multi-  Figure 6. A simple model of the dynamics of particle flow driven by a chemical potential gradient, and its consequent entropy production. The upper part of the diagram shows a phase space consisting of ten spatial points each associated with two velocities, with transitions between them indicated by various arrows described in the text. Particles are injected and removed from the left and right hand sites at specific rates. In the lower part of the diagram, a section of the phase space with transition rates that represent a barrier to the flow is illustrated.
plied by the probability P E (t) that the system should be empty. To balance these insertions, we include removals from the extreme left and right hand positions, this time from the phase space point corresponding to outwardly directed motion, again shown by block arrows in Fig. 6. The rates of removal are z −1 L and z −1 R , respectively, such that an equilibrium state can be established at z L = z R = z, with uniform stationary probabilities defined by P st (i, m) = P e F /(2L). The probability P e F that there is a particle somewhere in the physical phase space when at equilibrium, divided by the equilibrium probability P e E that the system is empty, is then controlled by z according to P e F /P e E = 2Lz 2 . The insertion and removal rates can be related to the exponential of the chemical potential of a local particle bath and the approach resembles grand canonical Monte Carlo. Thus if we were to consider the stochastic dynamics under conditions z L > z R , we would expect the particle to follow paths involving transfers into and out of the physical system, producing a mean flux of probability from left to right across the physical phase space, and a positive mean rate of entropy production. The ratio (z L − z R )/z R plays the role of the dimensionless nonequilibrium constraint parameter for this case.
In order to explore this in detail, we consider the nonequilibrium stationary state corresponding to the rates c = 1, z L = 2 and z R = 1. The stationary probabilities P st (i, ±) are shown as vertical bars in the upper part of Fig. 7 together with points representing the increments in ∆S 2 associated with steps to the right starting from position i. Profiles of pathdependent entropy increments associated with steps to the left, and with reversals of direction, may also be generated but are not shown. The increasing pathdependent contributions to entropy production as a function of position are a consequence of the constant probability current to the right, and the linear decrease in the stationary probabilities. The situation is analogous to a stationary state of particle diffusion between a source at high chemical potential on the left and a sink at low chemical potential on the right. This behaviour is modified if the transition rates are altered in the fashion indicated in the lower part of Fig. 6. The thicker and thinner arrows represent transition rates c−a and c+a respectively, with a < 0, and we can imagine the replacement of the central part of the transition rate scheme by such a 'barrier section'. The replacement creates local external forces that impede the particle flow between source and sink, and distort the stationary probability distribution across the phase space. Nevertheless, the probability distribution with z L = z R even in the presence of the barrier remains symmetric in the velocity coordinate and is an equilibrium state. For a nonequilibrium stationary state with z L = 2, z R = 1, c = 1 and a = −0.9 (in the barrier section) the profile of probabilities across phase space and the contributions to ∆S 2 associated with each spatial step to the right are illustrated in the lower part of Fig. 7. The interpretation is that the specific passage of the particle across the barrier is associated with a relatively large contribution to entropy production. Rare moves in a direction favoured by the prevailing thermodynamic forces are more irreversible than commonplace ones: this is an intuitively use- ful viewpoint, though we recognise it to be somewhat tautological [9]. The history of entropy production associated with a stochastic path taken by a particle on this phase space will contain periods during which the entropy fluctuates up and down, as the particle explores the phase space region to the left of the barrier, which are terminated by relatively large positive spikes in entropy production when the particle crosses the barrier.
The mean rates of change of the various components of entropy production for the system without a barrier and with c = 1, for a process starting in equilibrium at z L = z R = 1 for t < 0 and driven out of equilibrium by an instantaneous switch to z L = 2 for t ≥ 0, are shown in Fig. 8. The system responds to the implied change in chemical potential of the left hand source with mean entropy production in all three components. For t ≤ 0 the mean rate of production of entropy is zero for all components, and so there is a discontinuity in the rate of production when the process begins. Once again, this pattern of mean entropy production differs with respect to a model of the system that involves only the spatial phase space points: in particular there would be no contribution ∆S 3 in the latter case. At such a coarser level of description the reorganisation of the probability distribution over the velocity coordinate of phase space would not be perceived, and consequently the assessment of the irreversibility of the process would not be the same.

V. DYNAMICS ON A RING WITH M DISCRETE VELOCITIES
We now consider a phase space composed of discrete spatial positions X i with periodic boundary conditions, as before, but now with an extended set of available velocities V m = (m − 1) − (M − 1)/2, where m = 1, · · · , M with M an even integer. We define Figure 9. A phase space of discrete spatial (labelled i) and velocity (labelled m) coordinates with a selection of allowed moves of a particle as described in Eqs. (22). Periodic boundary conditions apply spatially. Figure 10. An illustration of the four types of behaviour of a particle in the phase space illustrated in Fig. 9, indicating the associated transition rates T and housekeepingtype contributions ∆S2 and ∆S3 to entropy production. The particle resides at phase space point (Xi, Vm) ≡ (i, m) for a time t(i, m) prior to a move described by one of the rates in Eq. (22). The ∆S1 take a form that depends on the probabilities P (i, m, t) and are specified in Eq. (10).

non-zero transition rates to be
where A, B and C are positive. The spatial displacements ∆i 0,± m are defined by and some examples of transitions are illustrated in Fig. 9. The dynamics represent changes of velocity according to the familiar Ehrenfest model [29], such that in the limit of large M the stationary velocity distribution approximates to a gaussian envelope with a mean determined by A and B. The spatial displacements correspond to propagation at either the velocity V m , or an average of V m and V m±1 if there should be a change in velocity, for a period ∆t = 2.
In spite of some similarities in appearance, this model with M = 2 is not equivalent to the asym-metric telegraph process discussed earlier: the specification of the transition rates is different. In fact this case is a generalisation of the two-velocity system considered previously [19], and is a discrete version of a treatment of driven Brownian motion of a particle on a ring [20]. The stationary probability distribution is which is uniform over spatial coordinates, and is characterised by a mean velocity equal to (A − B)(M − 1)/(2(A+B)). The dimensionless nonequilibrium constraint parameter is (A − B)/B: if this were zero, the stationary distribution would be symmetric in velocity.
The transition rates and stationary probabilities allow us, as before, to compute contributions to entropy production associated with the detailed history of a path. Values of ∆S 2 and ∆S 3 are illustrated for the model in Fig. 10: ∆S 1 is not included since it depends on P (i, m, t) and is less compact in form. Note that there are now non-zero contributions to ∆S 2 arising from residence at the phase space points. These were absent in the telegraph process considered earlier, as a consequence of the particular choice of transition rates.
Let us examine the means of entropy contributions ∆S 1 , ∆S 2 and ∆S 3 over a short time interval δt. We average over the behaviour of the particle, employing probabilities 1 − T (x j |x j )δt for residence over the period at x j , and probability T (x j+1 |x j )δt for a transition from x j to x j+1 . We do not consider multiple transitions during the interval since it is short. According to Eq. (10) the mean increment in ∆S 1 is Note that the last term vanishes to order δt due to normalisation. We rearrange to get a form that is explicitly positive, or zero in a stationary state when P (i, m, t) = P st (i, m). Similarly for small δt, giving which is also explicitly positive unless A = B, the condition for a symmetric stationary state over velocities, in which case it vanishes. Its mean in a stationary state is obtained by inserting Eq. (24): Finally, which can take either sign, but which vanishes when the system is in the stationary state or when A = B. These results with M = 2 coincide with those obtained previously [19]. The importance of the velocity coordinate for the deeper appreciation of irreversibility in this system may be demonstrated by determining the mean entropy production associated with a transition between stationary states brought about by the instantaneous swapping of the values of the parameters A and B. From a perspective of a treatment in a phase space of positions alone, there would be no relaxation of the probability distribution: the only entropy production brought about by the transition would arise from ∆S 2 , as was found in test case B for the telegraph process. However, according to Eq. (29), which remains valid for this coarser grained treatment, the mean rate of entropy production would not change. Only from a perspective of the more detailed dynamics would there be additional contributions ∆S 1 and ∆S 3 , arising from the relaxation in the probability distribution over velocities. The latter behaviour is illustrated in Fig. 11 for an example with parameters A = 2 and B = 1 with M = 8, C being arbitrary for this example. The total mean rate of entropy production falls momentarily to zero during the transition, as is also seen in the treatment of driven Brownian motion on a continuous phase space reported elsewhere [20]. The deviation from the constant contribution d ∆S 2 /dt is due to the relaxational terms d ∆S 1 /dt and d ∆S 3 /dt. Without a consideration of velocity coordinates, the implication that the system behaves less irreversibly, on average, during the transition between stationary states would be missed. We conclude again that coarse-graining alters the perception of irreversibility. It is worth noting, however, that the behaviour seen in Fig. 11 is similar that which emerges from a continuum treatment of the same system [20], suggesting that dynamics on a coarse-grained, discrete representation of a continuous phase space can still capture certain features of the irreversibility. Figure 11. Mean rates of entropy production against time for a transition between stationary states for a particle on a ring with M = 8 available velocities and transition rules illustrated in Fig. 9 and Eq. (22). For t < 0 the system is in a stationary state parametrised by A = 1 and B = 2. For t ≥ 0, these parameter values are swapped and the system makes a transition to a new stationary state.

VI. A SIMPLE MODEL OF THERMAL CONDUCTION
Our final example system is illustrated in Fig. 12. It is one of the simplest phase space dynamical schemes that can represent thermal conduction and the associated production of entropy. The phase space consists of a single spatial position, with four possible velocities: fast (suffix f ) and slow (suffix s) in each direction. The transitions between the points correspond to the reflection of a particle from boundaries situated to the left and right of the spatial position. The left hand boundary has the property that slow arrivals are reflected with probability (b + ∆b)/(2b) into the fast returning velocity state and with probability (b − ∆b)/(2b) into the slow state, with transition rate b > 0 and −b ≤ ∆b ≤ b. For positive ∆b the bias towards the fast return velocity suggests we can regard the left hand boundary as 'hot'. For simplicity, the left hand boundary is assumed to partition fast arrivals into fast and slow returning states with equal probability. In contrast, the right hand boundary reflects fast arrivals with probability (b + ∆b)/(2b) into the slow return state, and with probability (b − ∆b)/(2b) into the fast state. Slow arrivals at this boundary are partitioned with equal probabilities into fast and slow returns. These rules allow us to regard the right hand boundary as 'cold'. More elaborate schemes than these might be conceived, but the symmetries in the transitions and associated rates, as illustrated in Fig. 12, simplify the analysis of entropy production (in particular, there are no contributions to ∆S 2 from residence at the phase space points) while allowing the model to capture something of the physics of thermal conduction, with ∆b representing a thermal gradient across the system and ∆b/b the dimensionless nonequilibrium constraint parameter.
The contributions to ∆S 2 and ∆S 3 associated with Figure 12. A simple model of thermal conduction involving one spatial point and four values of velocity. A particle is reflected from hot and cold boundaries and the consequent transitions between fast and slow velocity coordinates in each direction are represented by arrows with specific rates shown. The contributions ∆S2 and ∆S3 to entropy production associated with each transition are given as a function of the thermal gradient parameter ∆b.
the eight available transitions in the system are listed in Fig. 12. These are calculated on the basis of the transition rates indicated in the diagram and the stationary state probabilities ). Since V f > V s , this implies that the mean particle velocity is directed towards the right for ∆b > 0. Clearly some paths undertaken by the particle between the boundaries, such as V f → −V f → V f , give no net change in entropy, whilst those that involve a slowing down at the cold boundary and speeding up at the hot boundary (for example V f → −V s → V f ) produce a positive increment for ∆b > 0. In contrast, the circuit V s → −V f → V s produces a negative increment, compatible with a distribution of both positive and negative values of ∆S 2 .
The mean rate of change of ∆S 2 in the stationary state may be shown to be which reduces to a form that is never negative for the physical range −b ≤ ∆b ≤ b. For ∆b = 0 we recover the equilibrium state where d ∆S 2 st /dt vanishes and where the phase space probabilities are symmetric in velocity.
The mean value of exp(−∆S 2 ) for an incremental time period δt is where the last term is made up of contributions arising from residence at each point. This reduces to exp(−∆S 2 ) = 1 for the period δt, a result that therefore also holds for a finite time period by consideration of a sequence of incremental periods under the Markovian dynamics. By a similar analysis, the mean rate of change of ∆S 3 in the stationary state is vanishing as expected. Transient departures from equilibrium can be investigated using a numerical solution of the relevant with ∆b = 0 for t < 0 and t > 4, and b = 1 throughout. The mean rates d ∆S 1 /dt, d ∆S 2 /dt and d ∆S 3 /dt, together with their sum, are shown in Fig. 13 over the course of such a process. Several now-familiar features are apparent. The mean rates of change of ∆S 1 , ∆S 2 and ∆S tot , quantities that each satisfy integral fluctuation relations, are never negative, whilst d ∆S 3 /dt can take either sign. d ∆S 2 /dt and d ∆S 3 /dt are non-zero only when detailed balance is broken through the condition ∆b = 0. The evolution of d ∆S 2 /dt mirrors the time dependence of ∆b(t) and both d ∆S 1 /dt and d ∆S 3 /dt are transient contributions that tend to die away when ∆b is constant. Of the transient terms, the production rate d ∆S 1 /dt continues to evolve after ∆b(t) has gone to zero, whilst d ∆S 3 /dt vanishes in these circumstances. The pattern of the mean rate of total entropy production d ∆S tot /dt provides a characterisation of the thermal conduction and its irreversibility. It emerges with a delay in response to the time dependent thermal gradient, which seems physically intuitive. The contribution d ∆S 3 /dt plays an important part in establishing this pattern, and it relies on the presence of odd velocity coordinates in the phase space. In fact it would be impossible to describe the entropy production associated with thermal conduction without considering the velocity coordinates of a system: heat flow is the conveyance of kinetic energy. This has already been established through an analysis of the process using continuum stochastic dynamics [20]. A heat current with associated entropy production cannot be established in a phase space of one spatial dimension with reflective boundaries and so dynamics on a phase space of spatial points cannot capture the irreversibility of heat conduction. This is the clearest of our demonstrations that a failure to take account of dynamics in full phase space can lead to the neglect of an important mechanism of entropy production and alter the apparent irreversibility of the process in question.

VII. CONCLUSIONS
We have investigated several simple examples where entropy production can be associated with specific, stochastically generated paths taken by a particle on a discrete full phase space. We have shown how it is formed from three components, each with particular statistical properties and a specific relationship to the underlying physical origins of irreversibility. The component ∆S 1 is associated with relaxation towards a stationary state. ∆S 2 is associated with the breakage of detailed balance brought about by the dynamical rules, and with entropy production in nonequilibrium stationary states. ∆S 3 is also associated with the breakage of detailed balance but only exists for dynamics that include coordinates that change sign (are 'odd') under time reversal [19,20]. A further condition for its existence is that the probability distribution for the stationary state under the prevailing conditions has to be asymmetric in an odd coordinate. The mean of ∆S 3 is zero in a stationary state and so, like ∆S 1 , it is associated with relaxation. Thus ∆S 3 has its origin in the dissipative mechanisms that are separately responsible for ∆S 1 and ∆S 2 . The three components can be related to the changes in system and medium entropy [6] as well as, in some circumstances, adiabatic and nonadiabatic entropy production [16].
Specifically, we have considered stochastic particle dynamics on discrete full phase spaces with transition rules that capture aspects of drift and diffusion, barrier crossing, injection, removal and interaction with a thermal gradient. The examples are necessarily simplified, but they illustrate the properties of the various components of entropy production summarised in the last paragraph, and furthermore demonstrate that the distributions of ∆S 1 and ∆S 2 satisfy integral fluctuation relations. They also show that the inclusion of additional detail in the specification of a system, or its opposite, coarse-graining, can have an impact on the assessment of entropy production. This is compatible with the notion that entropy is a representation of the uncertainty in microscopic state, and that its production is linked to the dynamics employed when modelling the evolution. By taking into account greater levels of detail in a dynamical system, we potentially alter our perception of the uncertainty in the microscopic state, and the pattern of entropy production could be modified as a result. At the deepest level, of course, when we neglect no detail of either system or environment, there will be no stochasticity in the model (we would then employ the 'real' dynamics) and no consequent development of uncertainty, and from a point of view of stochastic thermodynamics there would be no production of entropy. Entropy change in this perspective is subjective, and depends on choices made in the modelling.
We emphasise that these conclusions are based on an interpretation of entropy change and the second law acquired in the context of stochastic thermodynamics. The underlying dynamics have been taken to be stochastic and to break time reversal symmetry. Entropy change is then associated with dynamical irreversibility expressed in terms of path probabilities. An interpretation based on deterministic and timereversible dynamics is also available, whereby entropy generation is associated with the contraction of a continuous phase space and it is possible to derive fluctuation relations and a second law [10,11].
In closing, and from a perspective of stochastic thermodynamics, we reflect briefly on the nature of entropy and its production. Time reversal invariance and determinism imply that events in the future as well as the past will be apparent to a being capable of perceiving the current state of the universe in all its detail, a point made by Laplace. Loschmidt used the same reasoning to identify the flaw in Boltzmann's initial attempts to build a mechanical model of entropy production in an isolated ideal gas: the model could not provide the arrow of time. But Loschmidt is far from being the villain of this piece of the history of science [1]. Consideration of time reversal enriches the meaning of entropy production in models that explicitly break this symmetry, in many cases through a representation of the interactions between a system and its environment that reflects a state of perception inferior to that of Laplace's being. Symmetry of equations of motion under time reversal is either present or it is not, but the practical consequence of its absence emerges on a broader spectrum, and in stochastic thermodynamics, entropy production is its measure. Some trajectories generated by a stochastic model are hard to reverse (meaning the reverse trajectory is relatively unlikely); some are easier. The second law in stochastic thermodynamics is a statement about the statistical dominance of the hard cases.