{'fraction_non_alphanumeric': 0.0501790356599794, 'fraction_numerical': 0.009466817089321627, 'mean_word_length': 4.405090137857901, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Action Principle and Dynamic Ensemble Theory for Non-equilibrium Markov Chains

An overarching action principle, the principle of minimal free action, exists for ergodic Markov chain dynamics. Using this principle and the Detailed Fluctuation Theorem, we construct a dynamic ensemble theory for non-equilibrium steady states (NESS) of Markov chains, which is in full analogy with equilibrium canonical ensemble theory. Concepts such as energy, free energy, Boltzmann macro-sates, entropy, and thermodynamic limit all have their dynamic counterparts. For reversible Markov chains, minimization of Boltzmann free action yields thermal equilibrium states, and hence provide a dynamic justification of the principle of minimal free energy. For irreversible Markov chains, minimization of Boltzmann free action selects the stable NESS, and determines its macroscopic properties, including entropy production. A quadratic approximation of free action leads to linear-response theory with reciprocal relations built-in. Hence, in so much as non-equilibrium phenomena can be modeled as Markov processes, minimal free action serves as a basic principle for both equilibrium and non-equilibrium statistical physics.

Introduction. It is remarkable that variational principles [1] underly many basic laws of physics, including those in Hamiltonian mechanics, geometric optics, quantum mechanics and equilibrium statistical mechanics. For example, the entire theory of equilibrium statistical mechanics can be formulated on the base of the principle of maximal entropy. Any equilibrium phenomenon can be claimed understood as soon as we can derive it from this principle.
Search for a similar unifying action principle of nonequilibrium phenomena has been a long and inconclusive quest. The earliest versions of "minimum dissipation theorem" were stated by Helmholtz in 1869 [2], and by Rayleigh in 1873 [3]. It was generalized substantially by Onsager [4][5][6], such that it serves a starting point for linear response theory. Another candidate is "the principle of minimal entropy production", studied by Prigogine [7] and many others [8][9][10][11][12], and caused major confusions and debates. For a more recent exposition see reference [13]. There are also many other proposals [32], including the principle of "maximal entropy production" [14,15], which is in apparent contradiction with the the previous two principles. The relations between these proposed principles have been are addressed repeatedly, but not yet completely understood. We shall not elaborate on these issues as our approach will be substantially different.
Recent progresses in study of stochastic thermodynamics [17][18][19][20][21] have supplied much fresh understanding of entropy production and dissipation in non-equilibrium processes. It has become clear that entropy production can be defined at the level of individual dynamic path, and that it changes sign under time-reversal. Given a nonequilibrium boundary conditions or driving forces, the entropy production is positive for some dynamic paths and negative for their time reversal counterparts. Fluctuation Theorems [22,[24][25][26] tell us that those paths with positive dissipation are exponentially more proba-ble than their time-reversal, which have negative dissipation. A principle of "minimal entropy production" or of "least dissipation", if taken literally, would select those paths with negative entropy production, and therefore constitutes an outright contradiction to the second law of thermodynamics.
Most, if not all, non-equilibrium problems can be modeled as Markov processes. Inspired by the conceptual progresses in stochastic thermodynamics, we feel that the theory of ergodic Markov processes can be formulated as a dynamic ensemble theory. This would allow us to use all powerful tools in equilibrium theory to study nonequilibrium physics, and hence greatly facilitate theoretical understanding of non-equilibrium statistical physics. This is indeed the case, as we will demonstrate below. As enumerated in Table I, many important concepts of equilibrium statistical mechanics, including micro-state, macro-state, energy, entropy, free energy all have their dynamic counterparts in Markov processes. The only exception is temperature, whose dynamic counterpart is unity. Most importantly, we will find that there is also an overarching action principle, i.e. the principle of minimal free action, which serves as a foundation of dynamic ensemble theory for Markov chains. This principle governs all macroscopic properties of non-equilibrium steady states, including the equations of state and conditions of stability. At the quadratic level, the principle yields linear response theory with reciprocal symmetry naturally built-in. For systems with time-reversal symmetry, the principle of minimal free action selects the thermal equilibrium state with minimal free energy, and hence constitutes a dynamic justification of the principle of maximal entropy. Consequently, under the reasonable assumption that non-equilibrium phenomena can be modeled as Markov processes, minimal free action serves as a basic principle for both equilibrium and non-equilibrium statistical physics.  We will develop the dynamic ensemble theory in parallel to equilibrium ensemble theory. To set the stage for comparison between equilibrium and non-equilibrium theories, we first summarize the key elements of equilibrium canonical ensemble theory and the principle of minimal free energy, using Ising model for illustration. The detailed comparison of equilibrium and non-equilibrium ensemble theories are shown in Table I.

Sketch of equilibrium ensemble theory.
The microstates of system are designated by a set of microscopic variables called spins, s = {s i }. The Hamiltonian H(s) is given by where H 0 (s), called the intrinsic energy, is interaction between neighboring spins, and H 1 (s) = −B s i is due to external field. H 0 (s) and H 1 (s) are respectively even and odd under flipping of spins s → −s. The canonical ensemble theory of equilibrium statistical mechanics can be constructed from the principle of minimal free energy, which is known to be equivalent to the principle of maximal entropy. Let ρ(s) be an arbitrary probability distribution in the space of micro-states. The non-equilibrium free energy F [ρ] as a functional of ρ(s) is defined as where Tr s means summation over all spin configurations, and T = β −1 is the temperature. Here we use the convention k B = 1 throughout. Minimization of F [ρ] with respect to ρ(s) leads to the equilibrium Gibbs-Boltzmann distribution: where Z = e −βFEQ = Tr s e −βH is the canonical partition function, and F EQ = −T log Z is the equilibrium canonical free energy.
For fixed values of intrinsic energy H 0 (s) = E 0 (excluding magnetic field energy), and magnetization s = M , the totality of all micro-states is defined as a Boltzmann macro-state Ω(E 0 , M ). Its entropy is called the Boltzmann entropy S B (E 0 , M ). Mathematically we have where |Ω| is the number of micro-states in set Ω. Since for every micro-state s, there is alway one spin-reversed state −s, Ω(E 0 , M ) = Ω(E 0 , −M ) must be an even function of M . Note that in equilibrium, all micro-states inside Ω(E 0 , M ) have the same energy E 0 − BM , and hence the same probability e βFEQ−β(E0−BM) . In fact, Ω(E 0 , M ) is a refining of the micro-canonical ensemble.
In thermal equilibrium, the total probability of Boltzmann state Ω(E 0 , M ) is then where F B (E 0 , M ) shall be called the Boltzmann free energy.
We note that F B , E 0 , M are all extensive quantities. In the thermodynamic limit (number of spins N → ∞), the distribution Eq. (5) becomes more and more concentrated near the minimum of F B (E 0 , M ). Except at a critical point, fluctuations of all intensive quantities, such as energy and Boltzmann entropy per spin, scale as N −1/2 , i.e., they become non-stochastic in the thermodynamic limit. This is in fact how thermodynamics emerges from the stochastic description of statistical mechanics. Minimization of Boltzmann free energy F B (E 0 , M ) determines all thermodynamic properties. In particular, the stationarity condition reads which are in fact the equations of state. The stability condition of the thermodynamic state reads unfolding of which gives positivity of specific heat and magnetic susceptibility.
It is important to note that minimization of Boltzmann free energy can be understood as an application of the principle of minimal free energy in the subspace of all Boltzmann macro-states. Indeed using the equilibrium-probability restricted inside the Boltzmann state Ω(E 0 , M ) in Eq. (2), we obtain the Boltzmann free energy Eq. (6). In the thermodynamic limit, the Boltzmann free energy and the canonical free energy must be asymptotically equivalent: otherwise the probability distribution Eq. (5) would not be normalizable as N → ∞. Similarly Boltzmann entropy also become equivalent to the Gibbs entropy. The underlying physics is the equivalence of different statistical ensembles in the thermodynamic limit.
The concepts of Boltzmann macro-states and Boltzmann entropy are very flexible. If we wish to study another macroscopic quantity A(s), we can refine the Boltzmann state Eq. (4) by fixing E 0 , M and A. Then Eq. (5) becomes a joint pdf for E 0 , M and A, which can be deemed as a straightforward generalization of Einstein's theory for thermodynamic fluctuations.
Principle of minimal free action. We shall now construct an ensemble theory for discrete time Markov chain dynamics with discrete-valued state variables. Generalization of our theory to continuous time Markov processes and non-Markov processes has technical but not conceptual difficulty. We will use N to denote the number of time steps of dynamic paths. We will take the limit N → ∞, which is the dynamic analogue of thermodynamic limit. We will not assume that the system is large, hence our theory will be applicable both for large and small systems. Let X k be the discrete-valued state variables of the system at time step k. A dynamic path is described by an ordered sequence γ N = X N . . . X 1 X 0 , where time propagates from right to left. Let p 0 (X 0 ) be the initial probability distribution, and P (X|Y ) the transition probability. The probability of a path γ N assigned by the Markov chain dynamics is We define the action of a dynamic path γ N as To formulate an action principle for Markov chain dynamics, it is valuable to study a generic path probability distribution, denoted by q(γ N ), that is different from Eq. (8). We define the dynamic entropy and the free action of a path pdf q(γ N ) as: (11) where D(q||p) ≡ γN q(γ N ) log q(γ N )/p(γ N ) is the relative entropy, which is known to be nonnegative and vanishes only for q(γ N ) = p(γ N ). Just as the free energy is minimized by the equilibrium Gibbs-Boltzmann distribution, the free action Eq. (11) is minimized by q = p as defined in Eq. (8). The proofs are exactly the same in the equilibrium and non-equilibrium cases. This is the Principle of Minimal Free Action, which is mathematically equivalent to the definition of Markov chain dynamics. E(γ N ) and H[q] are the dynamic analogues of Hamiltonian and Gibbs entropy, whereas Φ[q] is the analogue of free energy. The dynamic analogue of temperature is unity. Dynamic ensemble theory for NESS. Our main interest in this work is non-equilibrium steady states (NESS) of time-homogeneous ergodic Markov chains. For this purpose, it is convenient to study cyclic dynamic paths such that X N = X 0 . We shall call such a path a loop ℓ N = ℓ(X N · · · X 1 ), and define its action E(ℓ N ) as Using the famous Perron-Fronenius theorem, we can prove the following limit: where p SS (X 1 ) is the steady state pdf. Further summing Eq. (13) over X 1 , we obtain unity. More specifically we have the following identity: If we use Eq. (12) for the action in Eq. (11), and restrict the summation in Eq. (11) to all loops, we see that the principle of minimal free action still holds: the free action Eq. (11) is minimized by the pdf p(ℓ N ) = e −E(ℓN ) . Restriction to loops is very convenient for the study of NESS, as we no longer have to worry about initial conditions.
The time-reversal of a loop ℓ N = ℓ(X N · · · X 1 ) is defined as ℓ * = (X * 1 · · · X * N ), where X * is the time-reversal of state X. Let us define the symmetric action Θ(ℓ) and antisymmetric action Σ(ℓ) of a loop ℓ as: Θ(ℓ) and Σ(ℓ) are, respectively, even and odd under time reversal. Using the Detailed Fluctuation Theorem [24,29], it can be easily shown that Σ(ℓ) is the total entropy production of the loop ℓ. In the absence of driving force, p(ℓ) must be reversible, and hence Σ(ℓ) vanishes identically. The resulting Markov chain is then reversible. We shall define a dynamic Boltzmann entropy: Here |Ω| is understood as the number of paths in the set Ω [33].
The pdf of (Θ, Σ) is then given by Here Φ B (Θ, Σ) is the dynamic analogue of Boltzmann free energy, and will be called Boltzmann free action: which completely determines the probability distribution Eq. (18). Because H B (Θ, Σ) is even in Σ, we easily see that P (Θ, Σ) = P (Θ, −Σ)e Σ . Summing this relation over Θ, we obtain the famous Steady-State Fluctuation Theorem: P (Σ) = P (−Σ) e Σ . Note that H B , Θ, Σ are all extensive in number of time steps N . As N becomes large, P (Θ, Σ) becomes more and more concentrated near the minimum of Φ B (Θ, Σ), with a width scaling sub-extensively as √ N . The N → ∞ limit is clearly the dynamic counterpart of thermodynamic limit. Mathematicians call this large deviation limit, and would demand a mathematical proof for its existence. We shall argue that its existence is intuitive. The most probable values (Θ,Σ) are determined by minimization of the Boltzmann free action Φ B : These results are the dynamic analogues of Eqs. (7), and are valid only in the sense of extensive variables in N . Specifically Eq. (20a) determines the equations of state for NESS, (20b) is the condition of stability, and also determines the small fluctuations of Θ, Σ. Finally Eq. (20c) is demanded by normalization of probability, and signifies the equivalence of different dynamic ensembles. All these identities have analogues in equilibrium ensemble theory.
A simple example. We discuss a simple example to illustrate the dynamic ensemble theory. Consider a particle hopping randomly on a circle. An external force is applied so that the particle hops asymmetrically. The probabilities that the particle hop clockwise or counter-clockwise, or idle, are respectively z(δ) −1 e −ε0+δ , z(δ) −1 e −ε0−δ and z(δ) −1 , where δ is the driving force, and z(δ) = 1 + 2e −ε0 cosh δ is a normalization constant. Let N ± (ℓ), N 0 (ℓ) be the numbers of CW, CCW, and idle steps in a loop ℓ, and p ± (ℓ) = N ± (ℓ)/N, p 0 (ℓ) = N 0 (ℓ)/N are the empirical frequencies. p ± , p 0 are the macroscopic variables we use to characterize each loop, which satisfy p + + p − + p 0 = 1. The action E(ℓ) is Comparing this with Eq. (15) we see that the entropy production of the loop ℓ is Σ(ℓ) = 2N (p + (ℓ) − p − (ℓ))δ. The dynamic Boltzmann entropy as a function of macroscopic variables p ± , p 0 can also be easily calculated: Substituting these back into Eq. (19) and minimizing, we find the mean entropy production: Stability of the NESS can be easily verified by computing the second order derivative of Φ B (p + , p − ). We note that this example can be solved using elementary method.
Here we use it only to illustrate the structure of dynamic ensemble theory. In future publications, we will use the dynamic ensemble theory to study more realistic manybody non-equilibrium problems.
Quadratic Approximation. Consider a system driven by two weak external forces λ 1 , λ 2 . We can expand the antisymmetric action Σ(ℓ) in terms of λ 1,2 : where Q 1 (ℓ), Q 2 (ℓ) are called dissipative currents, and are odd under time-reversal, Q 1,2 (ℓ * ) = −Q 1,2 (ℓ). The symmetric action Θ(ℓ) also depends on λ α , via the normalization condition ℓ exp(−Θ(ℓ) + Σ(ℓ)/2) = 1. A simple calculation shows that (with Einstein's summation convention used) where L αβ = Q α Q β 0 is the correlation function of dissipative currents in the absence of λ 1,2 . In the last step, we have expanded in terms of λ, and have used the fact that Q α 0 ≡ 0, i.e., time-reversal symmetry in the equilibrium case. It is most convenient to treat the dynamic Boltzmann entropy as a function of Θ 0 and Q α . As such, H B (Θ 0 , Q) is independent of λ α . Furthermore, because of timereversal symmetry, H B (Θ 0 , Q) must be even in Q. We expand H B and Φ B up to Q 2 : As such H B (Θ 0 , Q) becomes identical to the dissipation functional defined by Onsager [4,5], if we identify λ α with generalized forces. The average currents are determined by minimization of Φ B (Θ 0 , Q), which yield result Q α = L αβ λ β . The reciprocal relations are already encoded by the symmetry current correlations L αβ = L βα . It is however important to note that Φ B (Θ 0 , Q) does not describe dissipation of energy, or production of entropy. Also it would be completely wrong to call Eq. (20) the principle of least dissipation of energy, or the principle of minimal entropy production. As we have shown through out this work, the entropy production changes sign under time-reversal, has no upper bound or lower bound, and certainly can not achieve minimum or maximum at the steady state. In fact, as we have demonstrated, it is the principle of minimal free action that governs the physics of non-equilibrium steady states.
From minimal free action to minimal free energy. Similar to the equilibrium ensemble theory, the dynamic ensemble theory can be used to study arbitrary macrovariables. All we need to do is to refine the definition of dynamic Boltzmann entropy Eq. (16) by specifying the additional macro-variable A(ℓ) that we aim to study: As an example, we may study the empirical pair distribution of a loop ℓ: which gives the frequency of transition from state x to state y during the dynamic path ℓ N . It is normalized as x,y f (x, y; ℓ) = 1, and hence is an intensive quantity. The symmetric and antisymmetric actions of the loop can be calculated in terms of f (x, y; ℓ): x,y f (x, y; ℓ) log (P (y|x)P (x|y)) , (28a) Σ(ℓ) = x,y f (x, y; ℓ) log P (y|x) P (x|y) .
The empirical state distribution, which gives the frequency of state x appearing in the path ℓ, can also be calculated in terms of f (x, y; ℓ): We can similarly define the dynamic Boltzmann entropy and free action as functional of f (x, y; ℓ), and construct the pdf of f (x, y): In fact, Φ B [f ] can be calculated using results of large deviation theory [34]: where f 1 (x) = y f (x, y) = y f (y, x) is the marginal distribution of f (x, y). Again H B [f ] is extensive in N , and distribution of f (x, y) becomes concentrated near the saddle pointf (x, y), which must satisfyf (x, y) = P (y|x)f 1 (x). But this precisely means thatf (x, y) is the stationary pair distribution, andf 1 (x) = p SS (x) is the stationary state distribution. Note that Θ(ℓ), Σ(ℓ), f (x, y; ℓ), f 1 (x, ℓ) are all properties of individual dynamic path. Mathematically Eqs. (18) and (30c) say that these macro-variables converge to their means in probability. A dynamic path is called typical if it minimizes the Boltzmann free action. Typical paths are selected by the principle of minimal free action. Our results then say that a typical dynamic path exhibits average entropy productionΣ, average symmetric actionΘ, and average distribution of transition frequencyf (X, Y ), as well as average distribution of states p SS (X). For time-reversal Markov chains, we know that p SS (X) is the Gibbs-Boltzmann distribution, which minimize the free energy. This means that if we pick a long, typical dynamic path, and construct its empirical state distribution, we will precisely find the Gibbs-Boltzmann distribution-This is ergodicity at work in a Markov chain model! In another word, the principle of minimal free action gives a dynamic justification of the principle of minimal free energy. This work is supported by NSFC via grant #11674217, as well as Shanghai Municipal Education Commission and Shanghai Education Development Foundation via "Shu Guang" project. * Electronic address: xxing@sjtu.edu.cn