Stochastic Thermodynamics : A Dynamical Systems Approach

In this paper, we develop an energy-based, large-scale dynamical system model driven by Markov diffusion processes to present a unified framework for statistical thermodynamics predicated on a stochastic dynamical systems formalism. Specifically, using a stochastic state space formulation, we develop a nonlinear stochastic compartmental dynamical system model characterized by energy conservation laws that is consistent with statistical thermodynamic principles. In particular, we show that the difference between the average supplied system energy and the average stored system energy for our stochastic thermodynamic model is a martingale with respect to the system filtration. In addition, we show that the average stored system energy is equal to the mean energy that can be extracted from the system and the mean energy that can be delivered to the system in order to transfer it from a zero energy level to an arbitrary nonempty subset in the state space over a finite stopping time.


Introduction
In an attempt to generalize classical thermodynamics to irreversible nonequilibrium thermodynamics, a relatively new framework has been developed that combines stochasticity and nonequilibrium dynamics.This framework is known as stochastic thermodynamics [1][2][3][4][5] and goes beyond linear irreversible thermodynamics addressing transport properties and entropy production in terms of forces and fluxes via linear system response theory [6][7][8][9].Stochastic thermodynamics is applicable to nonequilibrium systems extending the validity of the laws of thermodynamics beyond the linear response regime by providing a system thermodynamic paradigm formulated on the level of individual system state realizations that are arbitrarily far from equilibrium.The thermodynamic variables of heat, work, and entropy, along with the concomitant first and second laws of thermodynamics, are formulated on the level of individual dynamical system trajectories using stochastic differential equations.
The nonequilibrium conditions in stochastic thermodynamics are imposed by an exogenous stochastic disturbance or an initial system state that is far from the system equilibrium resulting in an open (i.e., driven) or relaxation dynamical process.More specifically, the exogenous disturbance is modeled as an independent standard Wiener process (i.e., Brownian motion) defined on a complete filtered probability space wherein the current state is only dependent on the most recent event.
The stochastic system dynamics are described by an overdamped Langevin equation [2,3] in which fluctuation and dissipation forces obey the Einstein relation expressing that diffusion is a result of both thermal fluctuations and frictional dissipation [10].
Brownian motion refers to the irregular movement of microscopic particles suspended in a liquid and was discovered [11,12] by the botanist Robert Brown [13].This random motion is explained as the result of collisions between the suspended particles (i.e., Brownian particles) and the molecules of the liquid.Einstein was the first to formulate the theory of Brownian motion by assuming that the particles suspended in the liquid contribute to the thermal fluctuations of the medium and, in accordance with the principle of equipartition of energy [14], the average translational kinetic energy of each particle [10].Thus, Brownian motion results from collisions by molecules of the fluid, wherein the suspended particles acquire the same average kinetic energy as the molecules of the fluid.This theory suggested that all matter consists of atoms (or molecules) and heat is the energy of motion (i.e., kinetic energy) of the atoms.
The use of statistical methods in developing a general molecular theory of heat predicated on random motions of Newtonian atoms led to the connection between the dynamics of heat flow and the behavior of electromagnetic radiation.A year after Einstein published his theory on Brownian motion, Smoluchovski [15] confirmed the relation between friction and diffusion.In an attempt to simplify Einstein's theory of Brownian motion, Langevin [16] was the first to model the effect of Brownian motion using a stochastic differential equation (now known as a Langevin equation) wherein spherical particles are suspended in a medium and acted upon by external forces.
In stochastic thermodynamics, the Langevin equation captures the coupling between the system particle damping and the energy input to the particles via thermal effects.Namely, the frictional forces extract the particle kinetic energy, which in turn is injected back to the particles in the form of thermal fluctuations.This captures the phenomenological behavior of a Brownian particle suspended in a fluid medium which can be modeled as a continuous Markov process [17].Specifically, since collisions between the fluid molecules and a Brownian particle are more inelastic at higher viscosities, and temperature decreases with increasing viscosity in a fluid, additional heat is transferred to the fluid to maintain its temperature in accordance with the equipartition theorem.This heat is transferred to the Brownian particle through an increased disturbance intensity by the fluid molecules.These collisions between the Brownian particle and fluid molecules result in the observed persistent irregular and random motion of the particles.
The balance between damping (i.e., deceleration) of the particles due to frictional effects resulting in local heating of the fluid, and consequently entropy production, and the energy injection of the particles due to thermal fluctuations resulting in local cooling of the fluid, and consequently entropy consumption, is quantified by fluctuation theorems [18][19][20][21][22][23][24][25][26][27][28].Thus, even though, on average, the entropy is positive (i.e., entropy production), there exist sample paths wherein the entropy decreases, albeit with an exponentially lower probability than that of entropy production.In other words, a stochastic thermodynamic system exhibits a symmetry in the probability distribution of the entropy production in the asymptotic nonequilibrium process.
Fluctuation theorems give a precise prediction for the cases in which entropy decreases in stochastic thermodynamic systems and provide a key relation between entropy production and irreversibility.Specifically, the entropy production of individual sample path trajectories of a stochastic thermodynamic system described by a Markov process is not restricted by the second law, but rather the average entropy production is determined to be positive.Furthermore, the notions of heat and work in stochastic thermodynamic systems allow for a formulation of the first law of thermodynamics on the level of individual sample path trajectories with microscopic states (i.e., positions and velocities) governed by a stochastic Langevin equation and macroscopic states governed by a Fokker-Planck equation [29] (or a Kolmogorov forward equation, depending on context) describing the evolution of the probability density function of the microscopic (stochastic) states.
In this paper, we combine our large-scale thermodynamic system model developed in [30] with stochastic thermodynamics to develop a stochastic dynamical systems framework of thermodynamics.Specifically, we develop a large-scale dynamical system model driven by Markov diffusion processes to present a unified framework for statistical thermodynamics predicated on a stochastic dynamical systems formalism.In particular, using a stochastic state space formulation, we develop a nonlinear stochastic compartmental dynamical system model characterized by energy conservation laws that is consistent with statistical thermodynamic principles.Moreover, we show that the difference between the average supplied system energy and the average stored system energy for our stochastic thermodynamic model is a martingale with respect to the system filtration.In addition, we show that the average stored system energy is equal to the mean energy that can be extracted from the system and the mean energy that can be delivered to the system in order to transfer it from a zero energy level to an arbitrary nonempty subset in the state space over a finite stopping time.
Finally, using the system ectropy [30] as a Lyapunov function candidate, we show that in the absence of energy exchange with the environment the proposed stochastic thermodynamic model is stochastically semistable in the sense that all sample path trajectories converge almost surely to a set of equilibrium solutions, wherein every equilibrium solution in the set is almost surely Lyapunov stable.In addition, we show that the steady-state distribution of the large-scale sample path system energies is uniform, leading to system energy equipartitioning corresponding to a maximum entropy equilibrium state.

Stochastic Dynamical Systems
To extend the dynamical thermodynamic formulation of [30] to stochastic thermodynamics we need to establish some notation, definitions, and mathematical preliminaries.A review of some basic results on nonlinear stochastic dynamical systems is given in [31][32][33][34][35]. Recall that given a sample space Ω, a σ-algebra F on Ω is a collection of subsets of Ω such that ∅ ∈ F , if F ∈ F , then Ω\F ∈ F , and if F 1 , F 2 , . . .∈ F , then ∞ i=1 F i ∈ F and ∞ i=1 F i ∈ F .The pair (Ω, F ) is called a measurable space and the probability measure P defined on (Ω, F ) is a function P : F → [0, 1] such that P(∅) = 0, P(Ω) = 1, and if F 1 , F 2 , . . .∈ F and F i ∩ F j = ∅, i = j, then P( ∞ i=1 F i ) = ∑ ∞ i=1 P(F i ).The triple (Ω, F , P) is called a probability space if F contains all subsets of Ω with P-outer measure [36] zero [33].
The subsets F of Ω belonging to F are called F -measurable sets.If Ω = R n and B n is the family of all open sets in R n , then B n is called the Borel σ-algebra and the elements B of B n are called Borel sets.If (Ω, F , P) is a given probability space, then the real valued function (random variable) x : Ω → R is F -measurable if {ω ∈ Ω : x(ω) ∈ B} ∈ F for all Borel sets B ⊂ R n .Given the probability space (Ω, F , P), a filtration is a family {F t } t≥0 of σ-algebras F t ⊂ F such that F t ⊂ F s for all 0 ≤ t < s < ∞.
In this paper, we use the notation and terminology as established in [37].Specifically, define a complete probability space as (Ω, F, P), where Ω denotes the sample space, F denotes a σ-algebra, and P defines a probability measure on the σ-algebra F; that is, P is a nonnegative countably additive set function on F such that P(Ω) = 1 [32].Furthermore, we assume that w(•) is a standard d-dimensional Wiener process defined by (w(•), Ω, F, P w 0 ), where P w 0 is the classical Wiener measure ( [33], p. 10), with a continuous-time filtration {F t } t≥0 generated by the Wiener process w(t) up to time t.
We denote a stochastic dynamical system by G generating a filtration {F t } t≥0 adapted to the stochastic process x : R + × Ω → D on (Ω, F , P x 0 ) satisfying F τ ⊂ F t , 0 ≤ τ < t, such that {ω ∈ Ω : x(t, ω) ∈ B} ∈ F t , t ≥ 0, for all Borel sets B ⊂ R n contained in the Borel σ-algebra B n .We say that the stochastic process x : R + × Ω → D is F t -adapted if x(t) is F t -measurable for every t ≥ 0. Furthermore, we say that G satisfies the Markov property if the conditional probability distribution of the future states of the stochastic process generated by G only depends on the present state.In this case, G generates a Markov process which results in a decoupling of the past from the future in the sense that the present state of G contains sufficient information so as to encapsulate the effects of the past system inputs.Here we use the notation x(t) to represent the stochastic process x(t, ω) omitting its dependence on ω.Furthermore, B n denotes the σ-algebra of Borel sets in D ⊆ R n and S denotes a σ-algebra generated on a set S ⊆ R n .
We denote the set of equivalence classes of measurable, integrable, and square-integrable R n or R n×m (depending on context) valued random processes on (Ω, F , P) over the semi-infinite parameter space [0, ∞) by L 0 (Ω, F , P), L 1 (Ω, F , P), and L 2 (Ω, F , P), respectively, where the equivalence relation is the one induced by P-almost-sure equality.In particular, elements of L 0 (Ω, F , P) take finite values P-almost surely (a.s.) or with probability one.Hence, depending on the context, R n will denote either the set of n × 1 real variables or the subspace of L 0 (Ω, F , P) comprising of R n random processes that are constant almost surely.All inequalities and equalities involving random processes on (Ω, F , P) are to be understood to hold P-almost surely.Furthermore, E[ • ] and E x 0 [ • ] denote, respectively, the expectation with respect to the probability measure P and with respect to the classical Wiener measure P x 0 .
Given x ∈ L 0 (Ω, F , P), {x = 0} denotes the set {ω ∈ Ω : x(t, ω) = 0}, and so on.Given x ∈ L 0 (Ω, F , P) and E ∈ F , we say x is nonzero on E if P({x = 0} ∩ E ) = 0. Furthermore, given x ∈ L 1 (Ω, F , P) and a σ-algebra E ⊆ F , E P [x] and E P [x|E ] denote, respectively, the expectation of the random variable x and the conditional expectation of x given E , with all moments taken under the measure P. In formulations wherein it is clear from context which measure is used, we omit the symbol P in denoting expectation, and similarly for conditional expectation.Specifically, in such cases we denote the expectation with respect to the probability space (Ω, F , P) by E[ • ], and similarly for conditional expectation.
A stochastic process x : R + × Ω → D on (Ω, F , P x 0 ) is called a martingale with respect to the filtration {F t } t≥0 if and only if x(t) is a F t -measurable random vector for all t ≥ 0, E[x(t)] < ∞, and x(τ) = E[x(t)|F τ ] for all t ≥ τ ≥ 0. Thus, a martingale has the property that the expectation of the next value of the martingale is equal to its current value given all previous values of the dynamical process.If we replace the equality in x(τ) = E [x(t)|F τ ] with "≤" (respectively, "≥"), then x(•) is a supermartingale (respectively, submartingale).Note that every martingale is both a submartingale and supermartingale.
A random variable τ : Ω → [0, ∞] is called a stopping time with respect to F t if and only if {ω ∈ Ω : τ(ω) ≤ t} ∈ F t , t ≥ 0. Thus, the set of all ω ∈ Ω such that τ(ω) ≤ t is a F t -measurable set.Note that τ(ω) can take on finite as well as infinite values and characterizes whether at each time t an event at time τ(ω) < t has occurred using only the information in F t .
Finally, we write • for the Euclidean vector norm, row i (A) and col j (A) for the i-th row and j-th column of a matrix A ∈ R p×q , tr(•) for the trace operator, (•) −1 for the inverse operator, V (x) ∂V(x)   ∂x for the Freéchet derivative of V at x, V (x) ∂ 2 V(x) ∂x 2 for the Hessian of V at x, and H n for the Hilbert space of random vectors x ∈ R n with finite average power, that is, For an open set D ⊆ R n , H D n = {x ∈ H n : x : Ω → D} denotes the set of all the random vectors in H n induced by D. Similarly, for every are equivalent, respectively, to x ≥≥ 0 and x >> 0, where x ≥≥ 0 (respectively, x >> 0) indicates that every component of x is nonnegative (respectively, positive).Furthermore, C 2 denotes the space of real-valued functions V : D → R that are two-times continuously differentiable with respect to x ∈ D ⊆ R n .Finally, we write x(t) → M as t → ∞ to denote that x(t) approaches the set M, that is, for every ε > 0 there exists T > 0 such that dist(x(t), M) < ε for all t > T, where dist(p, M) where P(x(t) ∈ B|x(s)) = P(0, x, t, B), x ∈ R n , and P(s, x, t, B), t ≥ s, is the transition probability of the point x ∈ R n at time instant s into all Borel subsets B ⊂ R n at time instant t.
where, for every standard Wiener process (i.e., Brownian motion) defined on a complete filtered probability space (Ω, is the maximal interval of existence for the solution x(•) of ( 4).
An equilibrium point of ( 4) is a point x e ∈ R n such that f (x e ) = 0 and D(x e ) = 0.It is easy to see that x e is an equilibrium point of (4) if and only if the constant stochastic process x(•) a.s.
= x e is a solution of (4).We denote the set of equilibrium points of ( 4) by E {ω ∈ Ω : The filtered probability space (Ω, F , {F t } t≥0 , P) is clearly a real vector space with addition and scalar multiplication defined componentwise and pointwise.A R n -valued stochastic process x : [0, τ] × Ω → D is said to be a solution of (4) on the time interval [0, τ] with initial condition x(0) a.s.= x 0 if x(•) is progressively measurable (i.e., x(•) is nonanticipating and measurable in t and ω) with respect to the filtration {F t } t≥0 , f ∈ L 1 (Ω, F , P), D ∈ L 2 (Ω, F , P), and where the integrals in (5) are Itô integrals [38].If the map t → w(t, ω), ω ∈ Ω, had a bounded variation, then the natural definition for the integrals in (5) would be the Lebesgue-Stieltjes integral where ω is viewed as a parameter.However, since sample Wiener paths are nowhere differentiable and not of bounded variation for almost all ω ∈ Ω the integrals in (5) need to be defined as Itô integrals [39,40].Note that for each fixed t ≥ 0, the random variable ω → x(t, ω) assigns a vector x(ω) to every outcome ω ∈ Ω of an experiment, and for each fixed ω ∈ Ω, the mapping t → x(t, ω) is the sample path of the stochastic process x(t), t ≥ 0. A path-wise solution t → x(t) of ( 4) in (Ω, {F t } t≥0 , P x 0 ) is said to be right maximally defined if x cannot be extended (either uniquely or non-uniquely) forward in time.We assume that all right maximal path-wise solutions to (4) in (Ω, {F t } t≥0 , P x 0 ) exist on [0, ∞), and hence, we assume that (4) is forward complete.Sufficient conditions for forward completeness or global solutions of (4) are given in [34,38].
Furthermore, we assume that f : D → R n and D : D → R n×d satisfy the uniform Lipschitz continuity condition and the growth restriction condition for some Lipschitz constant L > 0, and hence, since x(0) ∈ H D n and x(0) is independent of (w(t) − w(0)), t ≥ 0, it follows that there exists a unique solution x ∈ L 2 (Ω, F , P) of (4) forward in time for all initial conditions in the following sense.For every x ∈ H D n \ {0} there exists The uniform Lipschitz continuity condition (6) guarantees uniqueness of solutions, whereas the linear growth condition (7) rules out finite escape times.A weaker sufficient condition for the existence of a unique solution to (4) using a notion of (finite or infinite) escape time under the local Lipschitz continuity condition (6) without the growth condition ( 7) is given in [41].Alternatively, existence and uniqueness of solutions even when the uniform Lipschitz continuity condition (6) does not hold are given in ( [38], p. 152).
The unique solution to (4) determines a R n -valued, time homogeneous Feller continuous Markov process x(•), and hence, its stationary Feller transition probability function is given by ( [31], Theorem 3.4), ([32], Theorem 9.2.8) for all t ≥ t 0 and all Borel subsets B of R n , where P(σ, x, t, B), t ≥ σ, denotes the probability of transition of the point x ∈ R n at time instant s into the set B ⊂ R n at time instant t.Recall that every continuous process with Feller transition probability function is also a strong Markov process ( [31] p. 101).Finally, we say that the dynamical system ( 4) is convergent in probability with respect to the closed set H D c n ⊆ H D n if and only if the pointwise lim t→∞ s(t, x, ω) exists for every x ∈ D c ⊆ R n and ω ∈ Ω.
Here, the measurable map s : [0, τ x ) × D × Ω → D is the dynamic or flow of the stochastic dynamical system (2) and, for all t, τ ∈ [0, τ x ), satisfies the cocycle property s(τ, s(t, x), ω) = s(t + τ, x, ω) and the identity (on D) property s(0, x, ω) = x for all x ∈ D and ω ∈ Ω.The measurable map s t = s(t, •, ω) : D → D is continuously differentiable for all t ∈ [0, τ x ) outside a P-null set and the sample path trajectory s x = s(•, x, ω) : [0, τ x ) → D is continuous in D for all t ∈ [0, τ x ).Thus, for every x ∈ D, there exists a trajectory of measures defined for all t ∈ [0, τ x ) satisfying the dynamical processes (4) with initial condition x(0) a.s.= x 0 .For simplicity of exposition we write s(t, x) for s(t, x, ω) omitting its dependence on ω.Definition 2. A point p ∈ D is a limit point of the trajectory s(•, x) of (4) if there exists a monotonic sequence {t n } ∞ n=0 of positive numbers, with t n → ∞ as n → ∞, such that s(t n , x) a.s.
→ p as n → ∞.The set of all limit points of s(t, x), t ≥ 0, is the limit set ω(x) of s(•, x) of (4).
It is important to note that the ω-limit set of a stochastic dynamical system is a ω-limit set of a trajectory of measures, that is, p ∈ ω(x) is a weak limit of a sequence of measures taken along every sample continuous bounded trajectory of (4).It can be shown that the ω-limit set of a stationary stochastic dynamical system attracts bounded sets and is measurable with respect to the σ-algebra of invariant sets.Thus, the measures of the stochastic process x(•) tend to an invariant set of measures and x(t) asymptotically tends to the closure of the support set (i.e., kernel) of this set of measures almost surely.
However, unlike deterministic dynamical systems, wherein ω-limit sets serve as global attractors, in stochastic dynamical systems stochastic invariance (see Definition 4) leads to ω-limit sets being defined for each fixed sample ω ∈ Ω of the underlying probability space (Ω, F , P), and hence, are path-wise attractors.This is due to the fact that a cocycle property rather than a semigroup property holds for stochastic dynamical systems.For details see [42][43][44].Definition 3 ([33], Def.7.7).Let x(•) be a time-homogeneous Markov process in H D n and let V : D → R. Then the infinitesimal generator L of x(t), t ≥ 0, with x(0) a.s.= x 0 , is defined by where E x 0 denotes the expectation with respect to the transition probability measure P x 0 (x(t) ∈ B) P(0, x 0 , t, B).
If V ∈ C 2 and has a compact support [45], and x(t), t ≥ 0, satisfies (4), then the limit in (9) exists for all x ∈ D and the infinitesimal generator L of x(t), t ≥ 0, can be characterized by the system drift and diffusion functions f (x) and D(x) defining the stochastic dynamical system (4) and is given by ( [33], Theorem 7.9) Next, we extend Proposition 2.1 of [30] to stochastic dynamical systems.First, however, the following definitions on stochastic invariance and essentially nonnegative vector fields are needed.

Definition 4.
A relatively open set D ⊂ R n is invariant with respect to (4) if D is Borel and, for all x 0 ∈ D, + is an invariant set with respect to (4) if and only if f : D → R n is essentially nonnegative and D (i,j) (x) = 0, j = 1, . . ., d, whenever x i = 0, i = 1, . . ., n.
It follows from Proposition 1 that if x 0 ≥≥ 0, then x(t) a.s.≥≥ 0, t ≥ 0, if and only if f is essentially nonnegative and D (i,j) (x) = 0, j = 1, . . ., d, whenever x i = 0, i = 1, . . ., n.In this case, we say that (4) is a stochastic nonnegative dynamical system.Henceforth, we assume that f and D are such that the nonlinear stochastic dynamical system (4) is a stochastic nonnegative dynamical system.

Stability Theory for Stochastic Nonnegative Dynamical Systems
In this section, we establish key stability results in probability for stochastic nonnegative dynamical systems.The mathematical machinery used is supermartingale theory and ergodic theory of Markov processes [31].Specifically, deterministic stability theory is extended to stochastic dynamical systems by establishing supermartingale properties of Lyapunov functions.The following definition introduces several notions of stability in probability for the equilibrium solution x(t) a.s.
≡ x e ∈ R n + to (4) is asymptotically stable in probability with respect to R n + if it is Lyapunov stable in probability with respect to R n + and, for every ρ ∈ (0, 1), there exists δ = δ(ρ) > 0 such that if x 0 ∈ B δ (x e ) ∩ R n + , then (iii) As in deterministic stability theory, for a given ε > 0 the subset B ε (x e ) ∩ R n + defines a cylindrical region in the (t, x)-space wherein the trajectory x(t), t ≥ 0, belongs to.However, in stochastic stability theory, for every x 0 ∈ B δ (x e ) ∩ R n + , there exists a probability of less than or equal to ρ that the system solution s(t, x 0 ) leaves the subset B ε (x e ) ∩ R n + ; and for x 0 = x e this probability is zero.In other words, the probability of escape is continuous at x 0 = x e with small deviations from the equilibrium implying a small probability of escape.
The following lemma gives an equivalent characterization of Lyapunov and asymptotic stability in probability with respect to R n + in terms of class K, K ∞ , and KL functions ( [47], p. 162).
≡ x e is asymptotically stable in probability with respect to R n + .Conversely, suppose that the equilibrium solution x(t) a.s.
Next, we present sufficient conditions for Lyapunov and asymptotic stability in probability for nonlinear stochastic nonnegative dynamical systems.First, however, the following definition of a recurrent process relative to a domain D r is needed.
In addition, D r is positive recurrent if for every compact set D c ⊂ D.
Theorem 1.Let D be an open subset relative to R n + that contains x e .Consider the nonlinear stochastic dynamical system (4) where f is essentially nonnegative and f (x e ) = 0, D (i,j) (x) = 0, j = 1, . . ., d, whenever x i = 0, i = 1, . . ., n, and D(x e ) = 0. Assume that there exists a two-times continuously differentiable function Then the equilibrium solution x(t) ≡ x e to (4) is Lyapunov stable in probability with respect to R n then the equilibrium solution x(t) ≡ x e to (4) is asymptotically stable in probability with respect to R n + .Finally, if D = R n + and V(•) is radially unbounded, then the equilibrium solution x(t) ≡ x e to (4) is globally asymptotically stable in probability with respect to R n and let τ δ be the stopping time wherein the trajectory x(t), t ≥ 0, of (4) exits the bounded domain for all x ∈ B δ (x e ) ∩ R n + and t ≥ 0. Now, using Chebyshev's inequality ( [31], p. 29) yields Next, taking the limit as t → ∞, (30) yields and hence, Lyapunov stability in probability with respect to R n + follows from the continuity of V(•) and (25).
To prove asymptotic stability in probability with respect to R n + , note that the stochastic process V(x(τ δ (t))) is a supermartingale ([31], Lemma 5.4), and hence, it follows from Theorem 5.1 of [31] that Let B x denote the set of all sample trajectories of (4) starting from x ∈ R n + for which τ δ = ∞.Since the equilibrium solution x(t) ≡ x e to (4) is Lyapunov stable in probability with respect to R n + , it follows that lim Next, it follows from Theorem 3.9 of [31] and ( 28) that all sample trajectories contained in B x , except for a set of trajectories with measure zero, satisfy inf t>0 x(t) − x e = 0.Moreover, it follows from Lemma 5.3 of [31] and hence, using (25), lim inf t→∞ V(x(t)) = 0. Now, (32) implies for almost all sample trajectories in B x , and hence, which, using ( 25) and ( 26), further implies, that Now, asymptotic stability in probability with respect to R n + is direct consequence of ( 33) and (37).Finally, to prove global asymptotic stability in probability with respect to R n + note that it follows from Lyapunov stability in probability with respect to R n + that, for every ε > 0 and ρ = ε, there exists δ > 0 such that, for all x ∈ B δ (x e ) ∩ R n Moreover, it follows from Lemma 3.9, Theorem 3.9 of [31], and the radial unboundedness of V(•) that the solution x(t), t ≥ 0, of ( 4) is recurrent relative to the domain which proves global asymptotic stability in probability with respect to R n + .
As noted in [37], a more general stochastic stability notion can also be introduced here involving stochastic stability and convergence to an invariant (stationary) distribution.In this case, state convergence is not to an equilibrium point but rather to a stationary distribution.This framework can relax the vanishing perturbation assumption D(x e ) = 0 at the equilibrium point x e and requires a more involved analysis framework showing stability of the underlying Markov semigroup [49].
As in nonlinear stochastic dynamical system theory [31], converse Lyapunov theorems for Lyapunov and asymptotic stability in probability for stochastic nonnegative dynamical systems can also be established.However, in this case, a non-degeneracy condition on D(x), x ∈ D, is required [31].
Finally, we establish a stochastic version of the Krasovskii-LaSalle stability theorem for nonnegative dynamical systems.For nonlinear stochastic dynamical systems this result is due to Mao [50].
Theorem 2. Consider the nonlinear stochastic nonnegative dynamical system (4).Let D ⊆ R n + be an invariant set with respect to (4) and assume that there exists a two-times continuously differentiable function V : D → R + and a continuous function η : R + → R + such that Then, for every x 0 ∈ D, lim t→∞ V(x(t)) exists and is finite almost surely, and Proof.Since D ⊆ R n + is invariant with respect to (4), it follows that, for all x 0 ∈ D, P x 0 (x(t) ∈ D) = 1, t ≥ 0. Furthermore, using Itô's chain rule formula and (40) we have Now, it follows from Theorem 7 of ( [51], p. 139) that lim t→∞ V(x(t)) exists and is finite almost surely, and To show that lim t→∞ η(V(x(t))) a.s.
Note that if we define D η = {v ≥ 0 : η(v) = 0}, then it can be shown that D η = ∅ and (41) implies that is, V(x(t)) will asymptotically approach the set D η with probability one.Thus, if η(V(x)) = x e if and only if x = x e and V(•) is positive definite with respect to x e , then it follows from Theorems 1 and 2 that the equilibrium solution x(t) a.s.
≡ x e to ( 4) is asymptotically stable in probability with respect to R n + .

Semistability of Stochastic Nonnegative Dynamical Systems
As shown in [30], thermodynamic systems give rise to systems that possess a continuum of equilibria.In this section, we develop a stability analysis framework for stochastic systems having a continuum of equilibria.Since, as noted in [37,52], every neighborhood of a non-isolated equilibrium contains another equilibrium, a non-isolated equilibrium cannot be asymptotically stable.Hence, asymptotic stability is not the appropriate notion of stability for systems having a continuum of equilibria.Two notions that are of particular relevance to such systems are convergence and semistability.Convergence is the property whereby every system solution converges to a limit point that may depend on the system initial condition.Semistability is the additional requirement that all solutions converge to limit points that are Lyapunov stable.Semistability for an equilibrium thus implies Lyapunov stability, and is implied by asymptotic stability.
In this section, we present necessary and sufficient conditions for stochastic semistability.It is important to note that stochastic semistability theory was also developed in [37] for a stronger set of stability in probability definitions.The results in this section, though parallel the results in [37], are predicated on a weaker set of stability in probability definitions, and hence, provide a stronger set of semistability results.First, we present several key propositions.The following proposition gives a sufficient condition for a trajectory of (4) to converge to a limit point.For this result, D c ⊆ D ⊆ R n + denotes a positively invariant set with respect to (4) and Proposition 2. Consider the nonlinear stochastic nonnegative dynamical system (4) and let x ∈ D c .If the limit set ω(x) of ( 4) contains a Lyapunov stable in probability (with respect to R n + ) equilibrium point y, then = y as x → y for every sequence {t n } ∞ n=1 , and hence, ω(x) The following definition introduces the notion of stochastic semistability.Definition 8.An equilibrium solution x(t) a.s.
≡ x e ∈ E of (4) is stochastically semistable with respect to R n + if the following statements hold.
Note that if x(t) a.s.
≡ x e ∈ E only satisfies (i) in Definition 8, then the equilibrium solution a.s.
≡ x e ∈ E of ( 4) is Lyapunov stable in probability with respect to R n + .
Definition 9.For a given ρ ∈ (0, 1), the ρ-domain of semistability with respect to R n + is the set of points x 0 ∈ D ⊆ R n such that if x(t), t ≥ 0, is a solution to (4) with x(0) a.s.
= x 0 , then x(t) converges to a Lyapunov stable (with respect to R n + ) in probability equilibrium point in D with probability greater than or equal to 1 − ρ.
Note that if (4) is stochastically semistable, then its ρ-domain of semistability contains the set of equilibria in its interior.
Next, we present alternative equivalent characterizations for stochastic semistability of (4).This result is an extension of Proposition 2.2 of [37] to the more general semistability definition presented in this paper.Proposition 3. Consider the nonlinear stochastic nonnegative dynamical system G given by (4).Then the following statements are equivalent: (i) G is stochastically semistable with respect to R n + .(ii) For every x e ∈ E and ρ > 0, there exist class K and L functions α ρ (•) and β ρ (•), respectively, and (iii) For every x e ∈ E and ρ > 0, there exist class K functions α 1ρ (•) and α 2ρ (•), a class L function β ρ (•), and δ = δ(x e , ρ) > 0 such that, if x 0 ∈ B δ (x e ) ∩ R n + , then Proof.To show that (i) implies (ii), suppose (4) is stochastically semistable with respect to R n + and let x e ∈ E .It follows from Lemma 1 that for every ρ > 0 there exists δ = δ(x e , ρ) > 0 and a class K = x * ∈ E and, consequently, For every ε > 0, ρ > 0, and x 0 ∈ B δ (x e ) ∩ R n + , define T x 0 (ε, ρ) to be the infimum of T with the property that P x 0 sup t≥T dist(x(t), E ) > ε ≤ ρ, that is, For each x 0 ∈ B δ (x e ) ∩ R n + and ρ, the function T x 0 (ε, ρ) is nonnegative and nonincreasing in ε, and T x 0 (ε, ρ) = 0 for sufficiently large ε.
We claim that T is well defined.To show this, consider ε > 0, ρ > 0, and x 0 ∈ B δ (x e ) ∩ R n + .Since P x 0 sup t≥T x 0 (ε,ρ) dist(x(t), E ) > ε ≤ ρ, it follows from the sample continuity of s that, for every ε > 0 and ρ > 0, there exists an open neighborhood U of x 0 such that P x 0 sup t≥T z (ε,ρ) dist(s(t, z), E ) > ε ≤ ρ for every z ∈ U .Hence, lim sup z→x 0 T z (ε, ρ) ≤ T x 0 (ε, ρ) implying that the function x 0 → T x 0 (ε, ρ) is upper semicontinuous at the arbitrarily chosen point x 0 , and hence on B δ (x e ) ∩ R n + .Since an upper semicontinuous function defined on a compact set achieves its supremum, it follows that T(ε, ρ) is well defined.The function T(•) is the pointwise supremum of a collection of nonnegative and nonincreasing functions, and hence is nonnegative and nonincreasing.Moreover, T(ε, ρ) = 0 for every ε > max{α ρ ( Next, to show that (ii) implies (iii), suppose (ii) holds and let x e ∈ E .Then it follows from (i) of Lemma 1 that x e is Lyapunov stable in probability with respect to R n + .For every ρ > 0, choosing x 0 sufficiently close to x e , it follows from the inequality P x 0 x(t) − x e > α ρ ( x 0 − x e ) ≤ ρ, t ≥ 0, that trajectories of (4) starting sufficiently close to x e are bounded, and hence, the positive limit set of (4) is nonempty.Since P x 0 (lim t→∞ dist(x(t), E ) = 0) = 1 as dist(x 0 , E ) → 0, it follows that the positive limit set is contained in E as dist(x 0 , E ) → 0. Now, since every point in E is Lyapunov stable in probability with respect to R n + , it follows from Proposition 2 that lim t→∞ x(t) then it follows using similar arguments as above that there exists a class L function βρ (•) such that P x 0 dist(x(t), E ) > βρ (t) ≤ P x 0 x(t) − x e > βρ (t) ≤ ρ for every x 0 satisfying x 0 − x e < δ and t ≥ 0. Hence, Next, consider the case where x * = x e and let α 1ρ (•) be a class K function.In this case, note that and hence, it follows using similar arguments as above that there exists a class L function β ρ (•) such that [48]), Lemma 4.2), and hence, (iii) follows immediately.Finally, to show that (iii) implies (i), suppose (iii) holds and let x e ∈ E. Then it follows that for every ρ > 0, Lemma 4.2).It now follows from (i) of Lemma 1 that x e is Lyapunov stable in probability with respect to R n + .Since x e was chosen arbitrarily, it follows that every equilibrium point is Lyapunov stable in probability with respect to R n + .Furthermore, P x 0 (lim t→∞ dist(x(t), E ) = 0) ≥ 1 − ρ.
Choosing x 0 sufficiently close to x e , it follows from the inequality that trajectories of (4) are almost surely bounded as x 0 → x e , and hence, the positive limit set of ( 4) is nonempty as x 0 → x e .Since every point in E is Lyapunov stable in probability with respect to R n + , it follows from Proposition 2 that lim t→∞ x(t) a.s.= x * as x 0 → x * , where x * ∈ E is Lyapunov stable in probability with respect to R n + .Hence, by Definition 8, ( 4) is stochastically semistable with respect to R n + .
Next, we develop necessary and sufficient conditions for stochastic semistability.First, we present sufficient conditions for stochastic semistability.The following theorems generalize Theorems 3.1 and 3.2 of [37].
Theorem 3. Consider the nonlinear stochastic nonnegative dynamical system (4).Let Q ⊆ R n + be a relatively open neighborhood of E and assume that there exists a two-times continuously differentiable function If every equilibrium point of ( 4) is Lyapunov stable in probability with respect to R n + , then ( 4) is stochastically semistable with respect to R n 4) is globally stochastically semistable with respect to R n + .
Proof.Since every equilibrium point of ( 4) is Lyapunov stable in probability with respect to R n + by assumption, for every z ∈ E, there exists a relatively open neighborhood , t ≥ 0, as ε → 0. Since V z ∩ B ε (z) is bounded and invariant with respect to the solution of (4) as ε → 0, it follows that V ε is invariant with respect to the solution of (4) as ε → 0. Furthermore, it follows from (52) that LV(s(t, x)) < 0, t ≥ 0, and hence, since V ε is bounded it follows from Theorem 2 that lim t→∞ LV(s(t, x)) a.s.= 0 as ε → 0. It is easy to see that LV(x) = 0 by assumption and LV(x e ) = 0, x e ∈ E .Therefore, s(t, x) a.s.
→ E as t → ∞ and ε → 0, which implies that lim dist(x,E )→0 P x (lim t→∞ dist(s(t, x), E ) = 0) = 1.Finally, since every point in E is Lyapunov stable in probability with respect to R n + , it follows from Proposition 2 that lim t→∞ s(t, x) a.s.= x * as x → x * , where x * ∈ E is Lyapunov stable in probability with respect to R n + .Hence, by Definition 8, (4) is semistable.For Q = R n + global stochastic semistability with respect to R n + follows from identical arguments using the radially unbounded condition on V(•).
Next, we present a slightly more general theorem for stochastic semistability wherein we do not assume that all points in LV −1 (0) are Lyapunov stable in probability with respect to R n + but rather we assume that all points in (η • V) −1 (0) are Lyapunov stable in probability with respect to R n + for some continuous function η : R + → R + .
Finally, since every point in M is Lyapunov stable in probability with respect to R n + , it follows from Proposition 2 that lim t→∞ s(t, x) a.s.Example 1.Consider the nonlinear stochastic nonnegative dynamical system on H 2 given by ( [37]) where σ ij (•), i, j = 1, 2, i = j, are Lipschitz continuous and γ > 0. Equations ( 54) and (55) represent the collective dynamics of two subsystems which interact by exchanging energy.The energy states of the subsystems are described by the scalar random variables x 1 and x 2 .The unity coefficients scaling σ ij (•), i, j ∈ {1, 2}, i = j, appearing in (54) and (55) represent the topology of the energy exchange between the subsystems.More specifically, given i, j ∈ {1, 2}, i = j, a coefficient of 1 denotes that subsystem j receives energy from subsystem i, and a coefficient of zero denotes that subsystem i and j are disconnected, and hence, cannot exchange energies.
The connectivity between the subsystems can be represented by a graph G having two nodes such that G has a directed edge from node i to node j if and only if subsystem j can receive energy from subsystem i.Since the coefficients scaling σ ij (•), i, j ∈ {1, 2}, i = j, are constants, the graph topology is fixed.Furthermore, note that the directed graph G is weakly connected since the underlying undirected graph is connected; that is, every subsystem receives energy from, or delivers energy to, at least one other subsystem.
Note that (54) and (55) can be cast in the form of (4) with where the stochastic term D(x)dw represents probabilistic variations in the energy transfer between the two subsystems.Furthermore, note that since a.s.
where e 2 [1 1] T , it follows that dx 1 (t) + dx 2 (t) = 0, which implies that the total system energy is conserved.
In this example, we use Theorem 3 to analyze the collective behavior of (54) and (55).Specifically, we are interested in the energy equipartitioning behavior of the subsystems.For this purpose, we make the assumptions The first assumption implies that if the energies in the connected subsystems i and j are equal, then energy exchange between the subsystems is not possible.This statement is reminiscent of the zeroth law of thermodynamics, which postulates that temperature equality is a necessary and sufficient condition for thermal equilibrium.The second assumption implies that energy flows from more energetic subsystems to less energetic subsystems and is reminiscent of the second law of thermodynamics, which states that heat (energy) must flow in the direction of lower temperatures.It is important to note here that due to the stochastic term D(x)dw capturing probabilistic variations in the energy transfer between the subsystems, the second assumption requires that the scaled net energy flow (x i − x j )[σ ij (x j ) − σ ji (x i )] is bounded by the negative intensity of the diffusion coefficient given by 1  2 tr D(x)D T (x).To show that ( 54) and ( 55) is stochastically semistable with respect to R 2 2 , where α ∈ R + .Now, it follows that which implies that x 1 = x 2 = α is Lyapunov stable in probability with respect to R 2 + .Next, it is easy to see that LV(x 1 , x 2 ) = 0 when x 1 = x 2 , and hence, LV(x 1 , x 2 ) < 0, (x 1 , x 2 ) ∈ R 2 + \E .Therefore, it follows from Theorem 3 that x 1 = x 2 = α is stochastically semistable with respect to R 2 + for all α ∈ R + .Furthermore, note that e T 2 dx(t) Note that an identical assertion holds for the collective dynamics of n subsystems with a connected undirected energy graph topology.
Finally, we extend Theorem 3.3 of [37] to provide a converse Lyapunov theorem for stochastic semistability.For this result, recall that LV(x e ) = 0 for every x e ∈ E .Also note that it follows from (9) that LV(x) = LV(s(0, x)).
Note that W ε ⊃ E is open and contains an open neighborhood of E .Consider z ∈ D 0 \E and define λ dist(z, E ) > 0. Then it follows from stochastic semistability of (4) that there exists h > 0 such that P z (s(h, z) ∈ W λ/2 ) ≥ 1 − ρ.Consequently, P z (s(h + t, z) ∈ W λ/2 ) ≥ 1 − ρ for all t ≥ 0, and hence, it follows that T(z) is well defined.Since W λ/2 is open, there exists a neighborhood B σ (s(T(z), z) Next, choose η > 0 such that η < λ/2 and B η (z) ⊂ N .Then, for every t > T(z) and y ∈ B η (z), Therefore, for every y ∈ B η (z), Hence, Now, since f (•) and D(•) satisfy ( 6) and ( 7), it follows from continuous dependence of solutions s(•, •) = x e as n → ∞, t ≥ 0. Let ε > 0 and note that it follows from (ii) of Proposition 3 that there exists δ = δ(x e ) > 0 such that for every solution of (4) in B δ (x e ) there exists T = T(x e , ε) > 0 such that P s t (H Next, note that there exists a positive integer N 1 such that x n ∈ B δ (x e ) for all n ≥ N 1 .Now, it follows from (57) that = 0, which implies that there exists a positive integer (62) with the above result yields V(x n ) < 4ε for all n ≥ N 2 , which implies that lim n→∞ V(x n ) = 0 = V(x e ).
Finally, we show that LV(x(t)) is negative along the solution of (4) on D 0 \E .Note that for every x ∈ D 0 \E and 0 < h ≤ 1/2 such that P (s(h, ] is reached at some time t such that 0 ≤ t ≤ T(x).Hence, it follows from the law of iterated expectation that and hence, (iii) holds.

Conservation of Energy and the First Law of Thermodynamics: A Stochastic Perspective
In this section, we extend the thermodynamic model proposed in [30] to include probabilistic variations in the instantaneous rate of energy dissipation as well as probabilistic variations in the energy transfer between the subsystems.Even though the treatment in this and the next two sections closely parallels that of [30] for deterministic thermodynamics, the thermodynamic models and proofs of our results are rendered more difficult due to the inclusion of stochastic disturbances.To formulate our state space stochastic thermodynamic model, we consider the large-scale stochastic dynamical system G shown in Figure 1 involving energy exchange between q interconnected subsystems and use the notation developed in [30].Specifically, E i : [0, ∞) → R + denotes the energy (and hence a nonnegative quantity) of the i-th subsystem, S i : [0, ∞) → R denotes the external power (heat flux) supplied to (or extracted from) the i-th subsystem, σ ij : R q + → R + , i = j, i, j = 1, . . ., q, denotes the instantaneous rate of energy (heat) flow from the j-th subsystem to the i-th subsystem, J (i,k) : R q + → R + , i = 1, . . ., q, k = 1, . . ., d 1 , denotes the instantaneous rate of energy (heat) received or delivered to the i-th subsystem from all other subsystems due to the stochastic disturbance w 1k (•), σ ii : R q + → R + , i = 1, . . ., q, denotes the instantaneous rate of energy (heat) dissipation from the i-th subsystem to the environment, and D (i,l) : R q + → R + , i = 1, . . ., q, l = 1, . . ., d 2 , denotes the instantaneous rate of energy (heat) dissipation from the i-th subsystem to the environment due to the stochastic disturbance w 2l (•).
An energy balance for the i-th subsystem yields or, equivalently, in vector form, where E(t) = [E 1 (t), . . ., E q (t)] T , w 1 (•) and w 2 (•) are, respectively, a d 1 -dimensional and d 2 -dimensional independent standard Wiener process (i.e., Brownian motion) defined on a complete filtered probability space (Ω, F , {F t } t≥t 0 , P), E(t 0 ) is independent of (w 1 (t) − w 1 (t 0 )), t ≥ t 0 , and (w Here, the stochastic disturbance J(E)dw 1 in (66) captures probabilistic variations in the energy transfer rates between compartments and the stochastic disturbance D(E)dw 2 captures probabilistic variations in the instantaneous rate of energy dissipation.
Equivalently, (65) can be rewritten as or, in vector form, where E 0 = [E 10 , . . ., E q0 ] T , yielding a differential energy balance equation that characterizes energy flow between subsystems of the large-scale stochastic dynamical system G.Here we assume that S(•) satisfies sufficient regularity conditions such that (68) has a unique solution forward in time.Specifically, we assume that the external power (heat flux) S(•) supplied to the large-scale stochastic dynamical system G consists of measurable functions S(•) adapted to the filtration {F t } t≥t 0 such that S(t) ∈ H q , t ≥ t 0 , for all t ≥ s, w(t) − w(s) is independent of S(τ), w(τ), τ ≤ s, and E(t 0 ), where w(t) = [w T 1 (t), w T 2 (t)] T , and hence, S(•) is non-anticipative.Furthermore, we assume that S(•) takes values in a compact metrizable set.In this case, it follows from Theorem 2.2.4 of [53] that there exists a path-wise unique solution to (68) in (Ω, {F t } t≥t 0 , P E 0 ).
Equation (66) or, equivalently, ( 68) is a statement of the first law for stochastic thermodynamics as applied to isochoric transformations (i.e., constant subsystem volume transformations) for each of the subsystems G i , i = 1, . . ., q.To see this, let the total energy in the large-scale stochastic dynamical system G be given by U = e T E, where e T = [1, . . ., 1] and E ∈ R q + , and let the net energy received by the large-scale dynamical system G over the time interval [t 1 , t 2 ] be given by where E(t), t ≥ t 0 , is the solution to (68).Then, premultiplying ( 66) by e T and using the fact that e T f (E) ≡ 0 and e T J(E) ≡ 0, it follows that where ∆U = U(t 2 ) − U(t 1 ) denotes the variation in the total energy of the large-scale stochastic dynamical system G over the time interval [t 1 , t 2 ].
For our large-scale stochastic dynamical system model G, we assume that is essentially nonnegative.The above constraint implies that if the energy of the j-th subsystem of G is zero, then this subsystem cannot supply any energy to its surroundings nor dissipate energy to the environment.Moreover, we assume that S i (t) ≥ 0 whenever E i (t) = 0, t ≥ t 0 , i = 1, . . ., q, which implies that when the energy of the i-th subsystem is zero, then no energy can be extracted from this subsystem.
The following proposition is needed for the main results of this paper.
Next, premultiplying (66) by e T , using Proposition 4, and using the fact that e T f (E) ≡ 0 and e T J(E) ≡ 0, it follows that Now, for the large-scale stochastic dynamical system G, define the input u(t) = S(t) and the output y(t) = d(E(t)).Hence, it follows from (71) that for any two F t -stopping times τ 1 and τ 2 such that Thus, the large-scale stochastic dynamical system G is stochastically lossless [54] with respect to the energy supply rate r(u, y) = e T u − e T y and with the energy storage function U(E) = e T E, E ∈ R q + .In other words, the difference between the supplied system energy and the stored system energy is a martingale with respect to the differential energy balance system filtration.
The following lemma is required for our next result.
Lemma 2. Consider the large-scale stochastic dynamical system G with differential energy balance Equation (68).
Then, for every equilibrium state E e ∈ H + q and every ε > 0 and τ a.s.
≤ ατ, there exists S : R + → H q such that S(t) − S e a.s.
> 0 be given and, for sufficiently small dt > 0, let α > 0 be such that ≤ τ and it follows that and hence, ≤ ε, which proves the result.
It follows from Lemma 2 that the large-scale stochastic dynamical system G with the differential energy balance Equation ( 68) is stochastically reachable from and stochastically controllable to the origin in R q + .Recall from [54] that the large-scale stochastic dynamical system G with the differential energy balance Equation ( 68) is stochastically reachable from the origin in R q + if, for all E 0 ∈ R q + and ε > 0, there exist a finite random variable τ B ε (E 0 ) a.s.
≥ t 0 , called the first hitting time, defined by and a F t -adapted square integrable input S(•) defined on [t 0 , τ B ε (E 0 ) ] such that the state E(t), t ≥ t 0 , can be driven from E(t 0 ) a.s.
and the supremum is taken pointwise.Alternatively, G is stochastically controllable to the origin in R q + if, for all E(t 0 ) a.s.
and a F t -adapted square integrable input S(•) defined on [t 0 , τB ε (E 0 ) ] such that the state E(t), t ≥ t 0 , can be driven from E(t 0 ) a.s.
= E 0 to E( τB ε (E 0 ) ) ∈ B ε (0) and τE 0 sup ε>0 τB ε (E 0 ) with a pointwise supremum.We let U r denote the set of measurable bounded H + q -valued stochastic processes on the semi-infinite interval [t 0 , ∞) consisting of power inputs (heat fluxes) to the large-scale stochastic dynamical system G such that for every τ E 0 a.s.
≥ t 0 the system energy state can be driven from E(t 0 ) a.s.= 0 to E(τ E 0 ) by S(•) ∈ U r .Furthermore, we let U c denote the set of measurable bounded H + q -valued stochastic processes on the semi-infinite interval [t 0 , ∞) consisting of power inputs (heat fluxes) to the large-scale stochastic dynamical system G such that the system energy state can be driven from E(t 0 ) a.s.
Finally, let U be an input space that is a subset of measurable bounded H + q -valued stochastic processes on R. The spaces U r , U c , and U are assumed to be closed under the shift operator, that is, if S(•) ∈ U (respectively, U c or U r ), then the function S T defined by S T (t) = S(t + T) is contained in U (respectively, U c or U r ) for all T ≥ 0.
The next result establishes the uniqueness of the internal energy function U(E), E ∈ R q + , for our large-scale stochastic dynamical system G.For this result define the available energy of the large-scale stochastic dynamical system G by where E(t), t ≥ t 0 , is the solution to (68) with E(t) a.s.
≥ 0, and all system sample paths with initial value E(t 0 ) a.s.
= E 0 and terminal value left free.Furthermore, define the required energy supply of the large-scale stochastic dynamical system G by The infimum in (80) is taken over all system sample paths starting from E(t 0 ) a.s.
= E 0 at time t = τ E 0 , and all times t ≥ t 0 .
Note that the available energy U a (E) is the maximum amount of stored energy (net heat) that can be extracted from the large-scale stochastic dynamical system G at any finite stopping time τ, and the required energy supply U r (E) is the minimum amount of energy (net heat) that can be delivered to the large-scale stochastic dynamical system G such that, for all ε > 0, P 0 lim t→τ E 0 E(t) ∈ B ε (E 0 ) = 1.Theorem 6.Consider the large-scale stochastic dynamical system G with differential energy balance equation given by (68).Then G is stochastically lossless with respect to the energy supply rate r(u, y) = e T u − e T y, where u(t) ≡ S(t) and y(t) ≡ d(E(t)), and with the unique energy storage function corresponding to the total energy of the system G given by where E(t), t ≥ t 0 , is the solution to (68) with admissible input u(•) ∈ U , E(τ 0 ) a.s.
Proof.Note that it follows from (71) that G is stochastically lossless with respect to the energy supply rate r(u, y) = e T u − e T y and with the energy storage function U(E) = e T E, E ∈ R q + .Since, by Lemma 2, G is reachable from and controllable to the origin in R q + , it follows from (71), with E(t 0 ) a.s.
which implies that Furthermore, it follows from the definition of U a (•) that U a (E) ≥ 0, E ∈ R q + , since the infimum in ( 79) is taken over the set of values containing the zero value (τ a.s. Next, note that it follows from (71), with E(0) a.s.
It follows from (82) and the definitions of available energy U a (E 0 ) and the required energy supply U r (E 0 ), E 0 ∈ R q + , that the large-scale stochastic dynamical system G can deliver to its surroundings all of its stored subsystem energies and can store all of the work done to all of its subsystems.This is in essence a statement of the first law of stochastic thermodynamics and places no limitation on the possibility of transforming heat into work or work into heat.In the case where S(t) ≡ 0, it follows from (71) and the fact that σ ii (E) ≥ 0, E ∈ R q + , i = 1, . . ., q, that the zero solution E(t) ≡ 0 of the large-scale stochastic dynamical system G with the differential energy balance Equation ( 68) is Lyapunov stable in probability with respect to R n + with Lyapunov function U(E) corresponding to the total energy in the system.

Entropy and the Second Law of Thermodynamics
As for the deterministic dynamical thermodynamic model presented in [30], the nonlinear differential energy balance Equation ( 68) can exhibit a full range of nonlinear behavior, including bifurcations, limit cycles, and even chaos.However, a thermodynamically consistent energy flow model should ensure that the evolution of the system energy is diffusive in character with convergent subsystem energies.As established in [30], such a system model would guarantee the absence of the Poincaré recurrence phenomenon [56].To ensure a thermodynamically consistent energy flow model, we require the following axioms [57].For the statement of these axioms, we first recall the following graph-theoretic notions.

Definition 10 ([58]
).A directed graph G(C) associated with the connectivity matrix C ∈ R q×q has vertices {1, 2, . . ., q} and an arc from vertex i to vertex j, i = j, if and only if C (j,i) = 0.A graph G(C) associated with the connectivity matrix C ∈ R q×q is a directed graph for which the arc set is symmetric, that is, C = C T .We say that G(C) is strongly connected if for any ordered pair of vertices (i, j), i = j, there exists a path (i.e., a sequence of arcs) leading from i to j.
Recall that the connectivity matrix C ∈ R q×q is irreducible, that is, there does not exist a permutation matrix such that C is cogredient to a lower-block triangular matrix, if and only if G(C) is strongly connected (see Theorem 2.7 of [58]).Let denote the net energy flow from the j-th subsystem G j to the i-th subsystem G i of the large-scale stochastic dynamical system G.

Axiom (i):
For the connectivity matrix C ∈ R q×q associated with the large-scale stochastic dynamical system G defined by and rank C = q − 1, and for C (i,j) = 1, i = j, φ ij (E) = 0 if and only if E i = E j .
≤ 0, E ∈ R q + , and, for all c > 0, As discussed in [30] for the deterministic thermodynamic problem, the fact that φ ij (E) = 0 if and only if E i = E j , i = j, implies that subsystems G i and G j of G are connected; alternatively, φ ij (E) ≡ 0 implies that G i and G j are disconnected.Axiom (i) implies that if the energies in the connected subsystems G i and G j are equal, then energy exchange between these subsystems is not possible.This statement is consistent with the zeroth law of thermodynamics, which postulates that temperature equality is a necessary and sufficient condition for thermal equilibrium.Furthermore, it follows from the fact that C = C T and rank C = q − 1 that the connectivity matrix C is irreducible, which implies that for any pair of subsystems G i and G j , i = j, of G there exists a sequence of connectors (arcs) of G that connect G i and G j .
Axiom (ii) implies that energy flows from more energetic subsystems to less energetic subsystems and is consistent with the second law of thermodynamics, which states that heat (energy) must flow in the direction of lower temperatures [59].Furthermore, note that φ ij (E) = −φ ji (E), E ∈ R q + , i = j, i, j = 1, . . ., q, which implies conservation of energy between lossless subsystems.With S(t) ≡ 0 and J(E) = 0, Axioms (i) and (ii) along with the fact that φ ij (E) = −φ ji (E), E ∈ R q + , i = j, i, j = 1, . . ., q, imply that at a given instant of time, energy can only be transported, stored, or dissipated but not created, and the maximum amount of energy that can be transported and/or dissipated from a subsystem cannot exceed the energy in the subsystem.Finally, it is important to note here that due to the stochastic disturbance term J(E)dw 1 capturing probabilistic variations in heat transfer between the subsystems, Axiom (ii) requires that the scaled net energy flow between the subsystems is bounded by the negative intensity of the system diffusion.
Next, we show that the classical Clausius equality and inequality for reversible and irreversible thermodynamics over cyclic motions are satisfied for our stochastic thermodynamically consistent energy flow model.For this result denotes a cyclic integral evaluated along an arbitrary closed path of (68) in R q + ; that is, Proposition 5. Consider the large-scale stochastic dynamical system G with differential energy balance Equation (68), and assume that Axioms (i) and (ii) hold.Then, for all E 0 ∈ R q + , τ f ≥ t 0 , and S(•) ∈ U such that E(τ f ) where c > 0, dQ i (t) [S i (t) − σ ii (E(t))]dt, i = 1, . . ., q, is the amount of net energy (heat) received by the i-th subsystem over the infinitesimal time interval dt, and E(t), t ≥ t 0 , is the solution to (68) with initial condition E(t 0 ) a.s.
To show (93), note that it follows from (94), Axiom (i), and Axiom (ii) that (93) holds if and only if E i (t) a.s.= E j (t), t ∈ [t 0 , τ f ], i = j, i, j = 1, . . ., q, or, equivalently, there exists a continuous function Inequality (92) is a generalization of Clausius' inequality for reversible and irreversible thermodynamics as applied to large-scale stochastic dynamical systems and restricts the manner in which the system dissipates (scaled) heat over cyclic motions.Note that the Clausius inequality (92) for the stochastic thermodynamic model is stronger than the Clausius inequality for the deterministic model presented in [30].
It follows from Axiom (i) and ( 68) that for the adiabatically isolated large-scale stochastic dynamical system G (that is, S(t) ≡ 0 and D(E(t)) ≡ 0), the energy states given by E e = αe, α ≥ 0, correspond to the equilibrium energy states of G. Thus, as in classical thermodynamics, we can define an equilibrium process as a process in which the trajectory of the large-scale stochastic dynamical system G moves along the equilibrium manifold M e {E ∈ R q + : E = αe, α ≥ 0} corresponding to the set of equilibria of the isolated [60] system G.The power input that can generate such a trajectory can be given by S(t) = d(E(t)) + u(t), t ≥ t 0 , where u(•) ∈ U is such that u i (t) ≡ u j (t), i = j, i, j = 1, . . ., q.Our definition of an equilibrium transformation involves a continuous succession of intermediate states that differ by infinitesimals from equilibrium system states and thus can only connect initial and final states, which are states of equilibrium.This process need not be slowly varying, and hence, equilibrium and quasistatic processes are not synonymous in this paper.Alternatively, a nonequilibrium process is a process that does not lie on the equilibrium manifold M e .Hence, it follows from Axiom (i) that for an equilibrium process φ ij (E(t)) = 0, t ≥ t 0 , i = j, i, j = 1, . . ., q, and thus, by Proposition 5, inequality (92) is satisfied as an equality.Alternatively, for a nonequilibrium process it follows from Axioms (i) and (ii) that ( 92) is satisfied as a strict inequality.
Next, we give a stochastic definition of entropy for the large-scale stochastic dynamical system G that is consistent with the classical thermodynamic definition of entropy.Definition 11.For the large-scale stochastic dynamical system G with differential energy balance Equation (68), a function S : R q for every F t -stopping times τ 2 a.s.
≥ t 0 and S(•) ∈ U is called the entropy function of G.
Note that it follows from Definition 11 that the difference between the system entropy production and the stored system entropy is a submartingale with respect to the differential energy balance filtration.
Next, we show that (92) guarantees the existence of an entropy function for G.For this result define the available entropy of the large-scale stochastic dynamical system G by where = 0, and define the required entropy supply of the large-scale stochastic dynamical system G by S r (E 0 ) sup where Note that the available entropy S a (E 0 ) is the minimum amount of scaled heat (entropy) that can be extracted from the large-scale stochastic dynamical system G in order to transfer it from an initial state E(t 0 ) = E 0 to E(T) = 0.Alternatively, the required entropy supply S r (E 0 ) is the maximum amount of scaled heat (entropy) that can be delivered to G to transfer it from the origin to a given subset in the state space containing the initial state E(t 0 ) = E 0 over a finite stopping time.For further details, see [54].Theorem 7. Consider the large-scale stochastic dynamical system G with differential energy balance Equation (68), and assume that Axiom (ii) holds.Then there exists an entropy function for G.Moreover, S a (E), E ∈ R q + , and S r (E), E ∈ R q + , are possible entropy functions for G with S a (0) = S r (0) = 0. Finally, all entropy functions S(E), Proof.Since, by Lemma 2, G is stochastically controllable to and stochastically reachable from the origin in R q + , it follows from (96) and (97 where τ i a.s. < τ 0 a.s.< τ f .In this case, it follows from (92) that, for all τ i a.s.
Next, using the strong Markov property we have dt|E(τ 0 ) , and hence, (99) implies Now, taking the supremum on both sides of (101) over all S(•) ∈ U r and τ i a.s.
≤ −E E Next, taking the infimum on both sides of (102) over all S(•) ∈ U c and τ f a.s.
Next, it follows from the definition of S a (•), the law of iterated expectation, and the strong Markov property that for every stopping time T a.s.
≤ T , which implies that S a (E), E ∈ R q + , satisfies (95).Thus, S a (E), E ∈ R q + , is a possible entropy function for G.Note that with E(τ 0 ) a.s.
= 0 it follows from (92) that the supremum in (96) is taken over the set of negative semidefinite values with one of the values being zero for S(t) a.s.≡ 0. Thus, S a (0) = 0. Similarly, it follows from the definition of S r (•) that for every stopping time T ≤ τ 2 and S(•) ∈ U r such that E(τ 2 ) ∈ H + q and E(T ) = S r (E(τ 1 )) + which implies that S r (E), E ∈ R q + , satisfies (95).Thus, S r (E), E ∈ R q + , is a possible entropy function for G.Note that with E(t 0 ) a.s.
It is important to note that inequality (92) is equivalent to the existence of an entropy function for G. Sufficiency is simply a statement of Theorem 7, while necessity follows from (95) with E(t 2 ) a.s.

= E(t 1 ).
This definition of entropy leads to second law of stochastic thermodynamics being viewed as an axiom in the context of stochastic (anti)cyclo-dissipative dynamical systems [54].
The next result shows that all entropy functions for G are continuous on R q + .Theorem 8. Consider the large-scale stochastic dynamical system G with differential energy balance Equation ( 68), and let S : R q + → R be an entropy function of G. Then S(•) is continuous on R q + .
Proof.Let E e ∈ q + and S e ∈ R q be such that S e = d(E e ) − f (E e ).Note that with S(t) a.s.
≡ S e , E e is an equilibrium point of the differential energy balance Equation (68).Next, it follows from Lemma 2 that G is locally stochastically controllable, that is, for every τ a.s.
> 0 and ε > 0, the set of points that can be reached from and to E e in time T using admissible inputs S : [0, τ] → H q , satisfying S(t) − S e a.s.
< ε, contains a neighborhood of E e .
≤ γ( τ), there exists 0 Hence, it follows that Now, if S(•) is an entropy function of G, then or, equivalently, If S(E e ) a.s.
≥ S(E e ), then (113) can be derived by reversing the roles of E e and E( τ).Specifically, for E 0 ∈ R q + and E( τ) a.s.
Hence, since γ(•) is continuous and E( τ) is arbitrary, it follows that S(•) is continuous on R q + .Next, as a direct consequence of Theorem 7, we show that all possible entropy functions of G form a convex set, and hence, there exists a continuum of possible entropy functions for G ranging from the required entropy supply S r (E) to the available entropy S a (E).Proposition 6.Consider the large-scale stochastic dynamical system G with differential energy balance Equation (68), and assume that Axioms (i) and (ii) hold.Then

S(E) αS
is an entropy function for G.
Proof.The result is a direct consequence of the reachability of G along with inequality (95) by noting that if S r (E) and S a (E) satisfy (95), then S(E) satisfies (95).
It follows from Proposition 6 that Definition 11 does not provide enough information to define the entropy uniquely for nonequilibrium thermodynamic systems with differential energy balance Equation (68).This difficulty has long been pointed out in [61].Two particular entropy functions for G can be computed a priori via the variational problems given by ( 96) and (97).For equilibrium thermodynamics, however, uniqueness is not an issue, as shown in the next proposition.Proposition 7. Consider the large-scale stochastic dynamical system G with differential energy balance Equation (68), and assume that Axioms (i) and (ii) hold.Then at every equilibrium state E = E e of the isolated system G, the entropy S(E), E ∈ R q + , of G is unique (modulo a constant of integration) and is given by where E = E e and log e (ce + E) denotes the vector natural logarithm given by [log e (c + E 1 ), . . ., log e (c + E q )] T .
Proof.It follows from Axiom (i) and Axiom (ii) that for an equilibrium process φ ij (E(t)) a.s.
≡ 0. Consider the entropy function S a (•) given by (96), and let E 0 = E e for some equilibrium state E e .Then it follows from (68) that a.s.
Since the solution E(t), t ≥ t 0 , to ( 68) is nonnegative for all nonnegative initial conditions, it follows from Axiom (ii) that the infimum in (116) is taken over the set of nonnegative values.However, the zero value of the infimum is achieved on an equilibrium process for which φ ij (E(t)) a.s.
≡ 0, i = j, i, j = 1, . . ., q.Thus, S a (E 0 ) = e T log e (ce + E 0 ) − q log e c, E 0 = E e . (117) Similarly, consider the entropy function S r (•) given by (97).Then, it follows from (68) that, for Now, it follows from Axioms (i) and (ii) that the zero value of the supremum in ( 118) is achieved on an equilibrium process and thus S r (E 0 ) = e T log e (ce + E 0 ) − q log e c, E 0 = E e .
The next proposition shows that if (95) holds as an equality for some transformation starting and ending at an equilibrium point of the isolated dynamical system G, then this transformation must lie on the equilibrium manifold M e .Proposition 8. Consider the large-scale stochastic dynamical system G with differential energy balance Equation (68), and assume that Axioms (i) and (ii) hold.Let S(•) denote an entropy of G, and let E : [t 0 , t 1 ] → R q + denote the solution to (68) with E(t 0 ) a.s.
Furthermore, it follows from ( 68) that Even though it follows from Proposition 6 that Definition 11 does not provide a unique continuous entropy function for nonequilibrium systems, the next theorem gives a unique, two-times continuously differentiable entropy function for G for equilibrium and nonequilibrium processes.This result answers the long-standing question of how the entropy of a nonequilibrium state of a dynamical process should be defined [61,62], and establishes its global existence and uniqueness.Theorem 9. Consider the large-scale stochastic dynamical system G with differential energy balance Equation (68), and assume that Axioms (i) and (ii) hold.Then the function S : R q + → R q + given by S(E) = e T log e (ce + E) − q log e c, E ∈ R where c > 0, is a unique (modulo a constant of integration), two-times continuously differentiable entropy function of G. Furthermore, for E(t) ∈ H M e q , t ≥ t 0 , where E(t), t ≥ t 0 , denotes the solution to (68) and for every t 2 ≥ t 1 ≥ t 0 and S(•) ∈ U .
To show that (123) is a unique, two-times continuously differentiable entropy function of G, let S(E) be a two-times continuously differentiable entropy function of G so that S(E) satisfies (95) or, equivalently, where t), t ≥ t 0 , denotes the solution to the differential energy balance Equation ( 68), and LS (E(t)) denotes the infinitesimal generator of S(E) along the solution E(t), t ≥ t 0 .Hence, it follows from (126) that which implies that there exist continuous functions : R q + → R p and W : R Now, equating coefficients of equal powers (of S and D), it follows that W ( Hence, S(E) = e T log e (ce + E) − q log e c, E ∈ R q + , and Thus, (123) is a unique, two-times continuously differentiable entropy function for G.
Note that it follows from Axiom (i), Axiom (ii), and the last equality in (125) that the entropy function given by ( 123) satisfies (95) as an equality for an equilibrium process and as a strict inequality for a nonequilibrium process.For any entropy function of G, it follows from Proposition 8 that if (95) holds as an equality for some transformation starting and ending at equilibrium points of the isolated system G, then this transformation must lie on the equilibrium manifold M e .However, (95) may hold as an equality for nonequilibrium processes starting and ending at nonequilibrium states.
The entropy expression given by ( 123) is identical in form to the Boltzmann entropy for statistical thermodynamics.Due to the fact that the entropy given by ( 123) is indeterminate to the extent of an additive constant, we can place the constant of integration q log e c to zero by taking c = 1.Since S(E) given by (123) achieves a maximum when all the subsystem energies E i , i = 1, . . ., q, are equal, the entropy of G can be thought of as a measure of the tendency of a system to lose the ability to do useful work, lose order, and settle to a more homogenous state.For further details see [30].
Recalling that E [dQ i (t ]dt, i = 1, . . ., q, is the infinitesimal amount of the net heat received or dissipated by the i-th subsystem of G over the infinitesimal time interval dt, it follows from (95) that Inequality ( 131) is analogous to the classical thermodynamic inequality for the variation of entropy during an infinitesimal irreversible transformation with the shifted subsystem energies c + E i playing the role of the i-th subsystem thermodynamic (absolute) temperatures.Specifically, note that since , where S i = log e (c + E i ) − log e c denotes the unique continuously differentiable i-th subsystem entropy, it follows that dS i dE i , i = 1, . . ., q, defines the reciprocal of the subsystem thermodynamic temperatures.That is, and T i > 0, i = 1, . . ., q.Hence, in our formulation, temperature is a function derived from entropy and does not involve the primitive subjective notions of hotness and coldness.
It is important to note that in this paper we view subsystem temperatures to be synonymous with subsystem energies.Even though this does not limit the generality of our theory from a mathematical perspective, it can be physically limiting since it does not allow for the consideration of two subsystems of G having the same stored energy with one of the subsystems being at a higher temperature (i.e., hotter) than the other.This, however, can be easily addressed by assigning different specific heats (i.e., thermal capacities) for each of the compartments of the large-scale system G as shown in [30].

Stochastic Semistability and Energy Equipartition
For the (adiabatically) isolated large-scale stochastic dynamical system G,  (133) Inequality (133) implies that, for any dynamical change in an adiabatically isolated large-scale stochastic dynamical system G, the entropy of the final state can never be less than the entropy of the initial state and is a generalization of Clausius' version of the entropy principle, which states that for every irreversible (nicht umkehrbar) process in an adiabatically isolated system beginning and ending at an equilibrium state, the entropy of the final state is greater than or equal to the entropy of the initial state.Inequality (133) is often identified with the second law of thermodynamics for stochastic systems and gives as a statement about entropy increase.It is important to stress that this result holds for an adiabatically isolated dynamical system.It is, however, possible with power (heat flux) supplied from an external system to reduce the entropy of the dynamical system G.The entropy of both systems taken together, however, cannot decrease.
As for the deterministic thermodynamic problem [30], this observation implies that when the isolated large-scale dynamical system G with thermodynamically consistent energy flow characteristics (i.e., Axioms (i) and (ii) hold) is at a state of maximum entropy consistent with its energy, it cannot be subject to any further dynamical change since any such change would result in a decrease of entropy.This of course implies that the state of maximum entropy is the stable state of an isolated system, and this equilibrium state has to be stochastically semistable.The following theorem generalizes Theorem 3.9 of [30] to the stochastic setting.≡ 0, and assume that Axioms (i) and (ii) hold.Then, for every α ≥ 0, αe is a stochastic semistable equilibrium state of (68).Furthermore, E(t) a.s.
To show that αe is stochastically semistable, let R {E ∈ R q + : LV(E) = 0}.Now, by Axiom (i) and (ii) the directed graph associated with the connectivity matrix C for the large-scale dynamical system G is strongly connected, which implies that R = {E ∈ R q + : E 1 = • • • = E q }.Since the R q + is an invariant set and V(E) is radially unbounded, it follows from the Theorem 2 that for every initial condition E(t 0 ) ∈ R q + , E(t) a.s.
→ R as t → ∞, and hence, αe is a stochastic semistable equilibrium state of (68).Next, note that since e T E(t) = e T E(t 0 ) and E(t) a.s.
→ R as t → ∞, it follows that E(t) a.s.
→ 1 q ee T E(t 0 ) as t → ∞.Hence, with α = 1 q e T E(t 0 ), αe = 1 q ee T E(t 0 ) is a semistable equilibrium state of (68).To show that in the case where for some k ∈ {1, . . ., q}, σ kk (E) ≥ 0, E ∈ R q + , and σ kk (E) = 0 if and only if E k = 0, the zero solution E(t) ≡ 0 to (68) is globally asymptotically stable in probability, consider V(E) = 1 2 E T E, E ∈ R q + , as a candidate Lyapunov function.Note that V(0) = 0, V(E) > 0, E ∈ R q + , E = 0, and V(E) is radially unbounded.Now, the infinitesimal generator of Lyapunov function along the system energy trajectories of ( 68) is given by which shows that the zero solution E(t) a.s.
→ R = {0} as t → ∞, which proves global asymptotic stability in probability of the zero equilibrium state of (68).
Theorem 10 shows that the isolated (i.e., S(t) a.s.≡ 0) large-scale stochastic dynamical system G is stochastically semistable.In Theorem 10 we used the energy Lyapunov function to show that for the isolated (i.e., S(t) a.s.≡ 0) large-scale stochastic dynamical system G, E(t) a.s.
→ 1 q ee T E(t 0 ) as t → ∞ and 1 q ee T E(t 0 ) is a stochastic semistable equilibrium state.This result can also be arrived at using the system entropy.
Specifically, using the system entropy given by (123), we can show attraction of the system trajectories to stochastic Lyapunov stable equilibrium points αe, α ≥ 0, and hence show stochastic semistability of these equilibrium states.To see this, note that since e T f (E) = 0, E ∈ R q + and e T J(E) = 0, E ∈ R q + , it follows that e T dE(t) = 0, t ≥ t 0 .Hence, e T E(t) a.s.= e T E(t 0 ), t ≥ t 0 .Furthermore, since E(t) ≥≥ 0, t ≥ t 0 , it follows that 0 ≤≤ E(t) ≤≤ ee T E(t 0 ) a.s., t ≥ t 0 , which implies that all solutions to (68) are almost surely bounded.
Next, since by (125) the function −S(E(t)), t ≥ t 0 , is a supermartingale and E(t), t ≥ t 0 , is bounded, it follows from Theorem 2 that for every initial condition E(t 0 ) ∈ R q + , E(t) a.s.
→ R as t → ∞, where R {E ∈ R q + : LS (E) = 0}.It now follows from the last inequality of (125) that R = {E ∈ R q + : (E i − E j )φ ij (E) = 0, i = 1, . . ., q, j ∈ K i }, which, since the directed graph associated with the connectivity matrix C for the large-scale dynamical system G is strongly connected, implies that R = {E ∈ R q + : E 1 = • • • = E q }.Since the set R consists of the equilibrium states of (68), it follows that M = R, which, along with (136), establishes stochastic semistability of the equilibrium states αe, α ≥ 0.
Theorem 10 implies that the steady-state value of the energy in each subsystem G i of the isolated stochastic large-scale dynamical system G is equal, that is, the steady-state energy of the isolated large-scale stochastic dynamical system G given by E ∞ a.s.
is uniformly distributed over all subsystems of G.This phenomenon is known as equipartition of energy [64][65][66][67][68] and is an emergent behavior in thermodynamic systems [30].
Example 2. In this example, we apply Theorem 10 to the five-compartment thermodynamic system shown in Figure 2. Specifically, consider .

Conclusions
In this paper, we combined thermodynamics and stochastic dynamical system theory to provide a system-theoretic foundation of thermodynamics.The proposed dynamical systems framework of thermodynamics can potentially provide deeper insights into the constitutive mechanisms that explain fundamental thermodynamic processes and describe acute microcosms and macrocosms in the ever-elusive pursuit of unifying the subatomic and astronomical domains.In future research, we will use the realizations of each sample path of the stochastic energy variables characterized by the stochastic differential energy balance dynamical model to describe the probability density function of our large-scale stochastic thermodynamic model by a continuous-time and continuous-space Fokker-Planck evolution equation to give a thermodynamic interpretation between the stationary solution of the Fokker-Planck equation and the canonical thermodynamic equilibrium distribution.Furthermore, since our stochastic thermodynamic model does not restrict the second law on each individual sample path trajectory, we will explore the second law as a fluctuation theorem to give a precise prediction of the cases in which the system entropy decreases over a given time interval for our model.
where τδ is the first hitting time of the trajectories starting from the set R n + \ B δ (x e ) and transitioning into the set B δ (x e ) ∩ R n + .Now, using the strong Markov property of solutions and choosing δ

Theorem 4 .
Consider the nonlinear stochastic nonnegative dynamical system (4) and let Q ⊆ R n + be a relatively open neighborhood of E .Assume that there exist a two-times continuously differentiable function V : Q → R + and a continuous function η : R +

=
x * as x → x * , where x * ∈ M is Lyapunov stable in probability with respect to R n + .Hence, by definition, (4) is semistable.For Q = R n + global stochastic semistability with respect to R n + follows from identical arguments using the radially unbounded condition on V(•).

Figure 3
shows the sample energy trajectories along with the standard deviation of the states of each thermodynamic compartment versus time for 10 sample paths.

Figure 3 .
Figure 3. Sample average along with the sample standard deviation of the system energies versus time; E 1 (t) in blue, E 2 (t) in red, E 3 (t) in green, E 4 (t) in magenta, and E 5 (t) in black.
and B ∈ B n , is called a semigroup of Markov kernels.The Markov kernels are called time homogeneous if and only if µ s,t = µ 0,t−s holds for all s ≤ t.Consider the nonlinear stochastic dynamical system G given by 4) is globally stochastically semistable with respect to R Since, by assumption, (4) is Lyapunov stable in probability with respect to R n + for all z ∈ M, there exists a relatively open neighborhood n + .Proof.
on system initial conditions ([32], Theorem 7.3.1)and(61)that V(•) is continuous on D 0 \E .To show that V(•) is continuous on E , consider x e ∈ E .Let {x n } ∞n=1 be a sequence in D 0 \E that converges to x e .Since x e is Lyapunov stable in probability with respect to R a.s.